#ifndef WebMediaStreamSource_h
#define WebMediaStreamSource_h
#include "WebCommon.h"
#include "WebNonCopyable.h"
#include "WebPrivatePtr.h"
#include "WebVector.h"
namespace WebCore {
class MediaStreamSource;
}
namespace blink {
class WebAudioDestinationConsumer;
class WebMediaConstraints;
class WebString;
class WebMediaStreamSource {
public:
class ExtraData {
public:
ExtraData() : m_owner(0) { }
virtual ~ExtraData() { }
BLINK_PLATFORM_EXPORT WebMediaStreamSource owner();
#if INSIDE_BLINK
BLINK_PLATFORM_EXPORT void setOwner(WebCore::MediaStreamSource*);
#endif
private:
WebCore::MediaStreamSource* m_owner;
};
enum Type {
TypeAudio,
TypeVideo
};
enum ReadyState {
ReadyStateLive = 0,
ReadyStateMuted = 1,
ReadyStateEnded = 2
};
WebMediaStreamSource() { }
WebMediaStreamSource(const WebMediaStreamSource& other) { assign(other); }
~WebMediaStreamSource() { reset(); }
WebMediaStreamSource& operator=(const WebMediaStreamSource& other)
{
assign(other);
return *this;
}
BLINK_PLATFORM_EXPORT void assign(const WebMediaStreamSource&);
BLINK_PLATFORM_EXPORT void initialize(const WebString& id, Type, const WebString& name);
BLINK_PLATFORM_EXPORT void reset();
bool isNull() const { return m_private.isNull(); }
BLINK_PLATFORM_EXPORT WebString id() const;
BLINK_PLATFORM_EXPORT Type type() const;
BLINK_PLATFORM_EXPORT WebString name() const;
BLINK_PLATFORM_EXPORT void setReadyState(ReadyState);
BLINK_PLATFORM_EXPORT ReadyState readyState() const;
BLINK_PLATFORM_EXPORT ExtraData* extraData() const;
BLINK_PLATFORM_EXPORT void setExtraData(ExtraData*);
BLINK_PLATFORM_EXPORT WebMediaConstraints constraints();
BLINK_PLATFORM_EXPORT bool requiresAudioConsumer() const;
BLINK_PLATFORM_EXPORT void addAudioConsumer(WebAudioDestinationConsumer*);
BLINK_PLATFORM_EXPORT bool removeAudioConsumer(WebAudioDestinationConsumer*);
#if INSIDE_BLINK
BLINK_PLATFORM_EXPORT WebMediaStreamSource(const WTF::PassRefPtr<WebCore::MediaStreamSource>&);
BLINK_PLATFORM_EXPORT WebMediaStreamSource& operator=(WebCore::MediaStreamSource*);
BLINK_PLATFORM_EXPORT operator WTF::PassRefPtr<WebCore::MediaStreamSource>() const;
BLINK_PLATFORM_EXPORT operator WebCore::MediaStreamSource*() const;
#endif
private:
WebPrivatePtr<WebCore::MediaStreamSource> m_private;
};
}
#endif