[GStreamer][MSE] MediaSourceClientGStreamerMSE
[WebKit-https.git] / Source / WebCore / platform / graphics / gstreamer / mse / MediaSourceClientGStreamerMSE.h
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 #include "GRefPtrGStreamer.h"
26 #include "MediaSourcePrivate.h"
27 #include "MediaSourcePrivateClient.h"
28 #include "WebKitMediaSourceGStreamer.h"
29 #include <wtf/MediaTime.h>
30
31 namespace WebCore {
32
33 class ContentType;
34 class MediaPlayerPrivateGStreamerMSE;
35 class MediaSample;
36 class SourceBufferPrivateGStreamer;
37
38 class MediaSourceClientGStreamerMSE : public RefCounted<MediaSourceClientGStreamerMSE> {
39 public:
40     static Ref<MediaSourceClientGStreamerMSE> create(MediaPlayerPrivateGStreamerMSE&);
41     virtual ~MediaSourceClientGStreamerMSE();
42
43     // From MediaSourceGStreamer.
44     MediaSourcePrivate::AddStatus addSourceBuffer(RefPtr<SourceBufferPrivateGStreamer>, const ContentType&);
45     void durationChanged(const MediaTime&);
46     void markEndOfStream(MediaSourcePrivate::EndOfStreamStatus);
47
48     // From SourceBufferPrivateGStreamer.
49     void abort(RefPtr<SourceBufferPrivateGStreamer>);
50     bool append(RefPtr<SourceBufferPrivateGStreamer>, const unsigned char*, unsigned);
51     void removedFromMediaSource(RefPtr<SourceBufferPrivateGStreamer>);
52     void flush(AtomicString);
53     void enqueueSample(PassRefPtr<MediaSample>);
54
55     void clearPlayerPrivate();
56
57     const MediaTime& duration();
58     GRefPtr<WebKitMediaSrc> webKitMediaSrc();
59
60 private:
61     MediaSourceClientGStreamerMSE(MediaPlayerPrivateGStreamerMSE&);
62
63     MediaPlayerPrivateGStreamerMSE* m_playerPrivate;
64     MediaTime m_duration;
65 };
66
67 } // namespace WebCore.
68
69 #endif // USE(GSTREAMER)