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 "GStreamerCommon.h"
26#include "MediaSourcePrivate.h"
27#include "MediaSourcePrivateClient.h"
28#include "WebKitMediaSourceGStreamer.h"
29#include <wtf/MediaTime.h>
30
31namespace WebCore {
32
33class ContentType;
34class MediaPlayerPrivateGStreamerMSE;
35class MediaSample;
36class SourceBufferPrivateGStreamer;
37
38class MediaSourceClientGStreamerMSE : public RefCounted<MediaSourceClientGStreamerMSE> {
39public:
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 void resetParserState(RefPtr<SourceBufferPrivateGStreamer>);
51 void append(RefPtr<SourceBufferPrivateGStreamer>, Vector<unsigned char>&&);
52 void removedFromMediaSource(RefPtr<SourceBufferPrivateGStreamer>);
53 void flush(AtomicString);
54 void enqueueSample(Ref<MediaSample>&&);
55 void allSamplesInTrackEnqueued(const AtomicString&);
56
57 const MediaTime& duration();
58 GRefPtr<WebKitMediaSrc> webKitMediaSrc();
59
60private:
61 MediaSourceClientGStreamerMSE(MediaPlayerPrivateGStreamerMSE&);
62
63 MediaPlayerPrivateGStreamerMSE& m_playerPrivate;
64 MediaTime m_duration;
65};
66
67} // namespace WebCore.
68
69#endif // USE(GSTREAMER)
70