#ifndef MediaPlayer_h
#define MediaPlayer_h
#include "platform/PlatformExport.h"
#include "platform/graphics/GraphicsTypes3D.h"
#include "public/platform/WebMediaPlayer.h"
#include "wtf/Forward.h"
#include "wtf/Noncopyable.h"
namespace blink {
class WebGraphicsContext3D;
class WebContentDecryptionModule;
class WebInbandTextTrack;
class WebLayer;
class WebMediaSource;
}
namespace WebCore {
class AudioSourceProvider;
class GraphicsContext;
class IntRect;
class IntSize;
class KURL;
class MediaPlayer;
class TimeRanges;
typedef unsigned GC3Denum;
typedef int GC3Dint;
class MediaPlayerClient {
public:
virtual ~MediaPlayerClient() { }
virtual void mediaPlayerNetworkStateChanged() = 0;
virtual void mediaPlayerReadyStateChanged() = 0;
virtual void mediaPlayerTimeChanged() = 0;
virtual void mediaPlayerDurationChanged() = 0;
virtual void mediaPlayerPlaybackStateChanged() = 0;
virtual void mediaPlayerRequestFullscreen() = 0;
virtual void mediaPlayerRequestSeek(double) = 0;
virtual KURL mediaPlayerPosterURL() = 0;
virtual void mediaPlayerRepaint() = 0;
virtual void mediaPlayerSizeChanged() = 0;
virtual void mediaPlayerSetWebLayer(blink::WebLayer*) = 0;
virtual void mediaPlayerSetOpaque(bool) = 0;
virtual void mediaPlayerDidAddTextTrack(blink::WebInbandTextTrack*) = 0;
virtual void mediaPlayerDidRemoveTextTrack(blink::WebInbandTextTrack*) = 0;
virtual void mediaPlayerMediaSourceOpened(blink::WebMediaSource*) = 0;
};
typedef PassOwnPtr<MediaPlayer> (*CreateMediaEnginePlayer)(MediaPlayerClient*);
class PLATFORM_EXPORT MediaPlayer {
WTF_MAKE_NONCOPYABLE(MediaPlayer);
public:
static PassOwnPtr<MediaPlayer> create(MediaPlayerClient*);
static void setMediaEngineCreateFunction(CreateMediaEnginePlayer);
static double invalidTime() { return -1.0; }
MediaPlayer() { }
virtual ~MediaPlayer() { }
virtual void load(blink::WebMediaPlayer::LoadType, const String& url, blink::WebMediaPlayer::CORSMode) = 0;
virtual void play() = 0;
virtual void pause() = 0;
virtual bool supportsSave() const = 0;
virtual IntSize naturalSize() const = 0;
virtual bool hasVideo() const = 0;
virtual bool hasAudio() const = 0;
virtual double duration() const = 0;
virtual double currentTime() const = 0;
virtual void seek(double) = 0;
virtual bool seeking() const = 0;
virtual double rate() const = 0;
virtual void setRate(double) = 0;
virtual bool paused() const = 0;
virtual void setPoster(const KURL&) = 0;
enum NetworkState { Empty, Idle, Loading, Loaded, FormatError, NetworkError, DecodeError };
virtual NetworkState networkState() const = 0;
enum ReadyState { HaveNothing, HaveMetadata, HaveCurrentData, HaveFutureData, HaveEnoughData };
virtual ReadyState readyState() const = 0;
virtual double maxTimeSeekable() const = 0;
virtual PassRefPtr<TimeRanges> buffered() const = 0;
virtual bool didLoadingProgress() const = 0;
virtual void paint(GraphicsContext*, const IntRect&) = 0;
virtual bool copyVideoTextureToPlatformTexture(blink::WebGraphicsContext3D*, Platform3DObject, GC3Dint, GC3Denum, GC3Denum, bool, bool) = 0;
enum Preload { None, MetaData, Auto };
virtual void setPreload(Preload) = 0;
virtual void showFullscreenOverlay() = 0;
virtual void hideFullscreenOverlay() = 0;
virtual bool canShowFullscreenOverlay() const = 0;
virtual bool hasSingleSecurityOrigin() const = 0;
virtual bool didPassCORSAccessCheck() const = 0;
virtual double mediaTimeForTimeValue(double timeValue) const = 0;
virtual unsigned decodedFrameCount() const = 0;
virtual unsigned droppedFrameCount() const = 0;
virtual unsigned corruptedFrameCount() const = 0;
virtual unsigned audioDecodedByteCount() const = 0;
virtual unsigned videoDecodedByteCount() const = 0;
#if ENABLE(WEB_AUDIO)
virtual AudioSourceProvider* audioSourceProvider() = 0;
#endif
virtual blink::WebMediaPlayer* webMediaPlayer() const = 0;
};
}
#endif