| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 #ifndef MediaSourceBase_h | 31 #ifndef MediaSourceBase_h |
| 32 #define MediaSourceBase_h | 32 #define MediaSourceBase_h |
| 33 | 33 |
| 34 #include "core/dom/ActiveDOMObject.h" | 34 #include "core/dom/ActiveDOMObject.h" |
| 35 #include "core/events/EventTarget.h" | 35 #include "core/events/EventTarget.h" |
| 36 #include "core/html/HTMLMediaSource.h" | 36 #include "core/html/HTMLMediaSource.h" |
| 37 #include "core/html/URLRegistry.h" | 37 #include "core/html/URLRegistry.h" |
| 38 #include "core/platform/graphics/MediaSourcePrivate.h" | |
| 39 #include "wtf/PassOwnPtr.h" | 38 #include "wtf/PassOwnPtr.h" |
| 40 #include "wtf/RefCounted.h" | 39 #include "wtf/RefCounted.h" |
| 41 #include "wtf/Vector.h" | 40 #include "wtf/Vector.h" |
| 42 | 41 |
| 42 namespace blink { |
| 43 class WebMediaSource; |
| 44 class WebSourceBuffer; |
| 45 } |
| 46 |
| 43 namespace WebCore { | 47 namespace WebCore { |
| 44 | 48 |
| 45 class ExceptionState; | 49 class ExceptionState; |
| 46 class GenericEventQueue; | 50 class GenericEventQueue; |
| 47 | 51 |
| 48 class MediaSourceBase : public RefCounted<MediaSourceBase>, public HTMLMediaSour
ce, public ActiveDOMObject, public EventTargetWithInlineData { | 52 class MediaSourceBase : public RefCounted<MediaSourceBase>, public HTMLMediaSour
ce, public ActiveDOMObject, public EventTargetWithInlineData { |
| 49 REFCOUNTED_EVENT_TARGET(MediaSourceBase); | 53 REFCOUNTED_EVENT_TARGET(MediaSourceBase); |
| 50 public: | 54 public: |
| 51 static const AtomicString& openKeyword(); | 55 static const AtomicString& openKeyword(); |
| 52 static const AtomicString& closedKeyword(); | 56 static const AtomicString& closedKeyword(); |
| 53 static const AtomicString& endedKeyword(); | 57 static const AtomicString& endedKeyword(); |
| 54 | 58 |
| 55 virtual ~MediaSourceBase(); | 59 virtual ~MediaSourceBase(); |
| 56 | 60 |
| 57 void addedToRegistry(); | 61 void addedToRegistry(); |
| 58 void removedFromRegistry(); | 62 void removedFromRegistry(); |
| 59 void openIfInEndedState(); | 63 void openIfInEndedState(); |
| 60 bool isOpen() const; | 64 bool isOpen() const; |
| 61 | 65 |
| 62 // HTMLMediaSource | 66 // HTMLMediaSource |
| 63 virtual bool attachToElement(HTMLMediaElement*) OVERRIDE; | 67 virtual bool attachToElement(HTMLMediaElement*) OVERRIDE; |
| 64 virtual void setPrivateAndOpen(PassOwnPtr<MediaSourcePrivate>) OVERRIDE; | 68 virtual void setWebMediaSourceAndOpen(PassOwnPtr<blink::WebMediaSource>) OVE
RRIDE; |
| 65 virtual void close() OVERRIDE; | 69 virtual void close() OVERRIDE; |
| 66 virtual bool isClosed() const OVERRIDE; | 70 virtual bool isClosed() const OVERRIDE; |
| 67 virtual double duration() const OVERRIDE; | 71 virtual double duration() const OVERRIDE; |
| 68 virtual PassRefPtr<TimeRanges> buffered() const OVERRIDE; | 72 virtual PassRefPtr<TimeRanges> buffered() const OVERRIDE; |
| 69 virtual void refHTMLMediaSource() OVERRIDE { ref(); } | 73 virtual void refHTMLMediaSource() OVERRIDE { ref(); } |
| 70 virtual void derefHTMLMediaSource() OVERRIDE { deref(); } | 74 virtual void derefHTMLMediaSource() OVERRIDE { deref(); } |
| 71 | 75 |
| 72 void setDuration(double, ExceptionState&); | 76 void setDuration(double, ExceptionState&); |
| 73 const AtomicString& readyState() const { return m_readyState; } | 77 const AtomicString& readyState() const { return m_readyState; } |
| 74 void setReadyState(const AtomicString&); | 78 void setReadyState(const AtomicString&); |
| 75 void endOfStream(const AtomicString& error, ExceptionState&); | 79 void endOfStream(const AtomicString& error, ExceptionState&); |
| 76 | 80 |
| 77 | 81 |
| 78 // ActiveDOMObject interface | 82 // ActiveDOMObject interface |
| 79 virtual bool hasPendingActivity() const OVERRIDE; | 83 virtual bool hasPendingActivity() const OVERRIDE; |
| 80 virtual void stop() OVERRIDE; | 84 virtual void stop() OVERRIDE; |
| 81 | 85 |
| 82 // EventTarget interface | 86 // EventTarget interface |
| 83 virtual ExecutionContext* executionContext() const OVERRIDE; | 87 virtual ExecutionContext* executionContext() const OVERRIDE; |
| 84 | 88 |
| 85 // URLRegistrable interface | 89 // URLRegistrable interface |
| 86 virtual URLRegistry& registry() const OVERRIDE; | 90 virtual URLRegistry& registry() const OVERRIDE; |
| 87 | 91 |
| 88 protected: | 92 protected: |
| 89 explicit MediaSourceBase(ExecutionContext*); | 93 explicit MediaSourceBase(ExecutionContext*); |
| 90 | 94 |
| 91 virtual void onReadyStateChange(const AtomicString& oldState, const AtomicSt
ring& newState) = 0; | 95 virtual void onReadyStateChange(const AtomicString& oldState, const AtomicSt
ring& newState) = 0; |
| 92 virtual Vector<RefPtr<TimeRanges> > activeRanges() const = 0; | 96 virtual Vector<RefPtr<TimeRanges> > activeRanges() const = 0; |
| 93 | 97 |
| 94 PassOwnPtr<SourceBufferPrivate> createSourceBufferPrivate(const String& type
, const MediaSourcePrivate::CodecsArray&, ExceptionState&); | 98 PassOwnPtr<blink::WebSourceBuffer> createWebSourceBuffer(const String& type,
const Vector<String>& codecs, ExceptionState&); |
| 95 void scheduleEvent(const AtomicString& eventName); | 99 void scheduleEvent(const AtomicString& eventName); |
| 96 GenericEventQueue* asyncEventQueue() const { return m_asyncEventQueue.get();
} | 100 GenericEventQueue* asyncEventQueue() const { return m_asyncEventQueue.get();
} |
| 97 | 101 |
| 98 private: | 102 private: |
| 99 OwnPtr<MediaSourcePrivate> m_private; | 103 OwnPtr<blink::WebMediaSource> m_webMediaSource; |
| 100 AtomicString m_readyState; | 104 AtomicString m_readyState; |
| 101 OwnPtr<GenericEventQueue> m_asyncEventQueue; | 105 OwnPtr<GenericEventQueue> m_asyncEventQueue; |
| 102 HTMLMediaElement* m_attachedElement; | 106 HTMLMediaElement* m_attachedElement; |
| 103 }; | 107 }; |
| 104 | 108 |
| 105 } | 109 } |
| 106 | 110 |
| 107 #endif | 111 #endif |
| OLD | NEW |