MediaPlaybackTargetContext.h [plain text]
#ifndef MediaPlaybackTargetContext_h
#define MediaPlaybackTargetContext_h
#if ENABLE(WIRELESS_PLAYBACK_TARGET)
#include <wtf/text/WTFString.h>
OBJC_CLASS AVOutputContext;
#if PLATFORM(COCOA)
OBJC_CLASS NSKeyedArchiver;
OBJC_CLASS NSKeyedUnarchiver;
#endif
namespace WebCore {
class MediaPlaybackTargetContext {
public:
enum Type : int32_t {
None,
AVOutputContextType,
MockType,
};
enum ContextState {
Unknown = 0,
OutputDeviceUnavailable = 1,
OutputDeviceAvailable = 2,
};
typedef unsigned State;
MediaPlaybackTargetContext()
: m_type(None)
{
}
MediaPlaybackTargetContext(AVOutputContext *outputContext)
: m_type(AVOutputContextType)
, m_outputContext(outputContext)
{
}
MediaPlaybackTargetContext(const String& name, State state)
: m_type(MockType)
, m_name(name)
, m_state(state)
{
}
Type type() const { return m_type; }
const String& mockDeviceName() const
{
ASSERT(m_type == MockType);
return m_name;
}
State mockState() const
{
ASSERT(m_type == MockType);
return m_state;
}
AVOutputContext *avOutputContext() const
{
ASSERT(m_type == AVOutputContextType);
return m_outputContext;
}
bool encodingRequiresPlatformData() const { return m_type == AVOutputContextType; }
private:
Type m_type { None };
AVOutputContext *m_outputContext { nullptr };
String m_name;
State m_state { Unknown };
};
}
#endif // ENABLE(WIRELESS_PLAYBACK_TARGET)
#endif // MediaPlaybackTargetContext