| 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
|
|
|