Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1387)

Unified Diff: Source/modules/mediasource/SourceBuffer.h

Issue 16625011: Add minimal implementation of unprefixed MediaSource API that has feature parity with prefixed API (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix global-constructors-listing-expected.txt Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/modules/mediasource/MediaSourceBase.cpp ('k') | Source/modules/mediasource/SourceBuffer.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/modules/mediasource/SourceBuffer.h
diff --git a/Source/modules/mediasource/MediaSourceBase.h b/Source/modules/mediasource/SourceBuffer.h
similarity index 57%
copy from Source/modules/mediasource/MediaSourceBase.h
copy to Source/modules/mediasource/SourceBuffer.h
index 60a0ebf7a3aea7ca8ed8a72da01d2293e37cd1b5..464487a07de3de30ea2796951dec28206ca24a7a 100644
--- a/Source/modules/mediasource/MediaSourceBase.h
+++ b/Source/modules/mediasource/SourceBuffer.h
@@ -28,42 +28,41 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef MediaSourceBase_h
-#define MediaSourceBase_h
+#ifndef SourceBuffer_h
+#define SourceBuffer_h
+#include "bindings/v8/ScriptWrappable.h"
#include "core/dom/ActiveDOMObject.h"
#include "core/dom/EventTarget.h"
-#include "core/html/URLRegistry.h"
-#include "core/platform/graphics/MediaSourcePrivate.h"
-#include "wtf/PassOwnPtr.h"
+#include "core/dom/ExceptionCode.h"
+#include "core/platform/Timer.h"
+#include "wtf/PassRefPtr.h"
#include "wtf/RefCounted.h"
+#include "wtf/text/WTFString.h"
namespace WebCore {
-
class GenericEventQueue;
+class MediaSource;
+class SourceBufferPrivate;
+class TimeRanges;
-class MediaSourceBase : public RefCounted<MediaSourceBase>, public ActiveDOMObject, public EventTarget, public URLRegistrable {
+class SourceBuffer : public RefCounted<SourceBuffer>, public ActiveDOMObject, public EventTarget, public ScriptWrappable {
public:
- static const AtomicString& openKeyword();
- static const AtomicString& closedKeyword();
- static const AtomicString& endedKeyword();
-
- virtual ~MediaSourceBase();
+ static PassRefPtr<SourceBuffer> create(PassOwnPtr<SourceBufferPrivate>, MediaSource*, GenericEventQueue*);
- void setPrivateAndOpen(PassOwnPtr<MediaSourcePrivate>);
- void addedToRegistry();
- void removedFromRegistry();
- void openIfInEndedState();
- bool isOpen() const;
- bool isClosed() const;
- void close();
+ virtual ~SourceBuffer();
- double duration() const;
- void setDuration(double, ExceptionCode&);
- const AtomicString& readyState() const { return m_readyState; }
- virtual void setReadyState(const AtomicString&);
- void endOfStream(const AtomicString& error, ExceptionCode&);
+ // SourceBuffer.idl methods
+ bool updating() const { return m_updating; }
+ PassRefPtr<TimeRanges> buffered(ExceptionCode&) const;
+ double timestampOffset() const;
+ void setTimestampOffset(double, ExceptionCode&);
+ void appendBuffer(PassRefPtr<ArrayBuffer> data, ExceptionCode&);
+ void appendBuffer(PassRefPtr<ArrayBufferView> data, ExceptionCode&);
+ void abort(ExceptionCode&);
+ void abortIfUpdating();
+ void removedFromMediaSource();
// ActiveDOMObject interface
virtual bool hasPendingActivity() const OVERRIDE;
@@ -71,33 +70,39 @@ public:
// EventTarget interface
virtual ScriptExecutionContext* scriptExecutionContext() const OVERRIDE;
+ virtual const AtomicString& interfaceName() const OVERRIDE;
+
+ using RefCounted<SourceBuffer>::ref;
+ using RefCounted<SourceBuffer>::deref;
+
+protected:
+ // EventTarget interface
virtual EventTargetData* eventTargetData() OVERRIDE;
virtual EventTargetData* ensureEventTargetData() OVERRIDE;
virtual void refEventTarget() OVERRIDE { ref(); }
virtual void derefEventTarget() OVERRIDE { deref(); }
- // URLRegistrable interface
- virtual URLRegistry& registry() const OVERRIDE;
+private:
+ SourceBuffer(PassOwnPtr<SourceBufferPrivate>, MediaSource*, GenericEventQueue*);
- virtual void reportMemoryUsage(MemoryObjectInfo*) const OVERRIDE;
+ bool isRemoved() const;
+ void scheduleEvent(const AtomicString& eventName);
- using RefCounted<MediaSourceBase>::ref;
- using RefCounted<MediaSourceBase>::deref;
+ void appendBufferInternal(unsigned char*, unsigned, ExceptionCode&);
+ void appendBufferTimerFired(Timer<SourceBuffer>*);
-protected:
- explicit MediaSourceBase(ScriptExecutionContext*);
+ OwnPtr<SourceBufferPrivate> m_private;
+ MediaSource* m_source;
+ GenericEventQueue* m_asyncEventQueue;
+ EventTargetData m_eventTargetData;
- PassOwnPtr<SourceBufferPrivate> createSourceBufferPrivate(const String& type, const MediaSourcePrivate::CodecsArray&, ExceptionCode&);
- void scheduleEvent(const AtomicString& eventName);
- GenericEventQueue* asyncEventQueue() const { return m_asyncEventQueue.get(); }
+ bool m_updating;
+ double m_timestampOffset;
-private:
- OwnPtr<MediaSourcePrivate> m_private;
- EventTargetData m_eventTargetData;
- AtomicString m_readyState;
- OwnPtr<GenericEventQueue> m_asyncEventQueue;
+ Vector<unsigned char> m_pendingAppendData;
+ Timer<SourceBuffer> m_appendBufferTimer;
};
-}
+} // namespace WebCore
#endif
« no previous file with comments | « Source/modules/mediasource/MediaSourceBase.cpp ('k') | Source/modules/mediasource/SourceBuffer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698