[GStreamer][MSE] MediaSourceClientGStreamerMSE
[WebKit-https.git] / Source / WebCore / platform / graphics / gstreamer / SourceBufferPrivateGStreamer.cpp
1 /*
2  * Copyright (C) 2013 Google Inc. All rights reserved.
3  * Copyright (C) 2013 Orange
4  * Copyright (C) 2014 Sebastian Dröge <sebastian@centricular.com>
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions are
8  * met:
9  *
10  *     * Redistributions of source code must retain the above copyright
11  * notice, this list of conditions and the following disclaimer.
12  *     * Redistributions in binary form must reproduce the above
13  * copyright notice, this list of conditions and the following disclaimer
14  * in the documentation and/or other materials provided with the
15  * distribution.
16  *     * Neither the name of Google Inc. nor the names of its
17  * contributors may be used to endorse or promote products derived from
18  * this software without specific prior written permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  */
32
33 #include "config.h"
34 #include "SourceBufferPrivateGStreamer.h"
35
36 #if ENABLE(MEDIA_SOURCE) && USE(GSTREAMER)
37
38 #include "ContentType.h"
39 #include "NotImplemented.h"
40
41 namespace WebCore {
42
43 Ref<SourceBufferPrivateGStreamer> SourceBufferPrivateGStreamer::create(MediaSourceClientGStreamer& client, const ContentType& contentType)
44 {
45     return adoptRef(*new SourceBufferPrivateGStreamer(client, contentType));
46 }
47
48 SourceBufferPrivateGStreamer::SourceBufferPrivateGStreamer(MediaSourceClientGStreamer& client, const ContentType& contentType)
49     : m_type(contentType)
50     , m_client(&client)
51     , m_readyState(MediaPlayer::HaveNothing)
52 {
53 }
54
55 SourceBufferPrivateGStreamer::~SourceBufferPrivateGStreamer()
56 {
57 }
58
59 void SourceBufferPrivateGStreamer::setClient(SourceBufferPrivateClient* client)
60 {
61     m_sourceBufferPrivateClient = client;
62 }
63
64 void SourceBufferPrivateGStreamer::append(const unsigned char* data, unsigned length)
65 {
66     ASSERT(m_client);
67     ASSERT(m_sourceBufferPrivateClient);
68
69     SourceBufferPrivateClient::AppendResult result = m_client->append(this, data, length);
70     m_sourceBufferPrivateClient->sourceBufferPrivateAppendComplete(this, result);
71 }
72
73 void SourceBufferPrivateGStreamer::abort()
74 {
75     notImplemented();
76 }
77
78 void SourceBufferPrivateGStreamer::resetParserState()
79 {
80     notImplemented();
81 }
82
83 void SourceBufferPrivateGStreamer::removedFromMediaSource()
84 {
85     m_client->removedFromMediaSource(this);
86 }
87
88 MediaPlayer::ReadyState SourceBufferPrivateGStreamer::readyState() const
89 {
90     return m_readyState;
91 }
92
93 void SourceBufferPrivateGStreamer::setReadyState(MediaPlayer::ReadyState state)
94 {
95     m_readyState = state;
96 }
97
98 // TODO: Implement these
99 void SourceBufferPrivateGStreamer::flushAndEnqueueNonDisplayingSamples(Vector<RefPtr<MediaSample>>, AtomicString)
100 {
101     notImplemented();
102 }
103
104 void SourceBufferPrivateGStreamer::enqueueSample(PassRefPtr<MediaSample>, AtomicString)
105 {
106     notImplemented();
107 }
108
109 bool SourceBufferPrivateGStreamer::isReadyForMoreSamples(AtomicString)
110 {
111     notImplemented();
112
113     return false;
114 }
115
116 void SourceBufferPrivateGStreamer::setActive(bool)
117 {
118     notImplemented();
119 }
120
121 void SourceBufferPrivateGStreamer::stopAskingForMoreSamples(AtomicString)
122 {
123     notImplemented();
124 }
125
126 void SourceBufferPrivateGStreamer::notifyClientWhenReadyForMoreSamples(AtomicString)
127 {
128     notImplemented();
129 }
130
131 }
132 #endif