#ifndef MediaSource_h
#define MediaSource_h
#if ENABLE(MEDIA_SOURCE)
#include "ActiveDOMObject.h"
#include "GenericEventQueue.h"
#include "MediaSourcePrivate.h"
#include "SourceBuffer.h"
#include "SourceBufferList.h"
#include <wtf/RefCounted.h>
namespace WebCore {
class MediaSource : public RefCounted<MediaSource>, public EventTarget, public ActiveDOMObject {
public:
static const String& openKeyword();
static const String& closedKeyword();
static const String& endedKeyword();
static PassRefPtr<MediaSource> create(ScriptExecutionContext*);
virtual ~MediaSource() { }
SourceBufferList* sourceBuffers();
SourceBufferList* activeSourceBuffers();
double duration() const;
void setDuration(double, ExceptionCode&);
SourceBuffer* addSourceBuffer(const String& type, ExceptionCode&);
void removeSourceBuffer(SourceBuffer*, ExceptionCode&);
const String& readyState() const;
void setReadyState(const String&);
void endOfStream(const String& error, ExceptionCode&);
static bool isTypeSupported(const String& type);
void setPrivateAndOpen(PassOwnPtr<MediaSourcePrivate>);
virtual const AtomicString& interfaceName() const OVERRIDE;
virtual ScriptExecutionContext* scriptExecutionContext() const OVERRIDE;
virtual bool hasPendingActivity() const OVERRIDE;
virtual void stop() OVERRIDE;
using RefCounted<MediaSource>::ref;
using RefCounted<MediaSource>::deref;
private:
explicit MediaSource(ScriptExecutionContext*);
virtual EventTargetData* eventTargetData() OVERRIDE;
virtual EventTargetData* ensureEventTargetData() OVERRIDE;
virtual void refEventTarget() OVERRIDE { ref(); }
virtual void derefEventTarget() OVERRIDE { deref(); }
void scheduleEvent(const AtomicString& eventName);
EventTargetData m_eventTargetData;
String m_readyState;
OwnPtr<MediaSourcePrivate> m_private;
RefPtr<SourceBufferList> m_sourceBuffers;
RefPtr<SourceBufferList> m_activeSourceBuffers;
OwnPtr<GenericEventQueue> m_asyncEventQueue;
};
}
#endif
#endif