1 | /* |
2 | * Copyright (C) 2016 Metrological Group B.V. |
3 | * Copyright (C) 2016 Igalia S.L |
4 | * |
5 | * This library is free software; you can redistribute it and/or |
6 | * modify it under the terms of the GNU Library General Public |
7 | * License as published by the Free Software Foundation; either |
8 | * version 2 of the License, or (at your option) any later version. |
9 | * |
10 | * This library is distributed in the hope that it will be useful, |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | * Library General Public License for more details. |
14 | * |
15 | * You should have received a copy of the GNU Library General Public License |
16 | * aint with this library; see the file COPYING.LIB. If not, write to |
17 | * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
18 | * Boston, MA 02110-1301, USA. |
19 | */ |
20 | |
21 | #pragma once |
22 | |
23 | #if ENABLE(VIDEO) && USE(GSTREAMER) && ENABLE(MEDIA_SOURCE) |
24 | |
25 | // PlaybackPipeline is (sort of) a friend class of WebKitMediaSourceGStreamer. |
26 | |
27 | #include "WebKitMediaSourceGStreamer.h" |
28 | #include "WebKitMediaSourceGStreamerPrivate.h" |
29 | |
30 | #include <gst/gst.h> |
31 | #include <wtf/Condition.h> |
32 | #include <wtf/glib/GRefPtr.h> |
33 | |
34 | namespace WTF { |
35 | template<> GRefPtr<WebKitMediaSrc> adoptGRef(WebKitMediaSrc*); |
36 | template<> WebKitMediaSrc* refGPtr<WebKitMediaSrc>(WebKitMediaSrc*); |
37 | template<> void derefGPtr<WebKitMediaSrc>(WebKitMediaSrc*); |
38 | }; |
39 | |
40 | namespace WebCore { |
41 | |
42 | class ContentType; |
43 | class SourceBufferPrivateGStreamer; |
44 | class MediaSourceGStreamer; |
45 | |
46 | class PlaybackPipeline: public RefCounted<PlaybackPipeline> { |
47 | public: |
48 | static Ref<PlaybackPipeline> create() |
49 | { |
50 | return adoptRef(*new PlaybackPipeline()); |
51 | } |
52 | |
53 | virtual ~PlaybackPipeline() = default; |
54 | |
55 | void setWebKitMediaSrc(WebKitMediaSrc*); |
56 | WebKitMediaSrc* webKitMediaSrc(); |
57 | |
58 | MediaSourcePrivate::AddStatus addSourceBuffer(RefPtr<SourceBufferPrivateGStreamer>); |
59 | void removeSourceBuffer(RefPtr<SourceBufferPrivateGStreamer>); |
60 | void attachTrack(RefPtr<SourceBufferPrivateGStreamer>, RefPtr<TrackPrivateBase>, GstCaps*); |
61 | void reattachTrack(RefPtr<SourceBufferPrivateGStreamer>, RefPtr<TrackPrivateBase>, GstCaps*); |
62 | void notifyDurationChanged(); |
63 | |
64 | // From MediaSourceGStreamer. |
65 | void markEndOfStream(MediaSourcePrivate::EndOfStreamStatus); |
66 | |
67 | // From SourceBufferPrivateGStreamer. |
68 | void flush(AtomicString); |
69 | void enqueueSample(Ref<MediaSample>&&); |
70 | void allSamplesInTrackEnqueued(const AtomicString&); |
71 | |
72 | GstElement* pipeline(); |
73 | private: |
74 | PlaybackPipeline() = default; |
75 | GRefPtr<WebKitMediaSrc> m_webKitMediaSrc; |
76 | }; |
77 | |
78 | } // namespace WebCore. |
79 | |
80 | #endif // USE(GSTREAMER) |
81 | |