/* * Copyright (C) 2007-2014 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef MediaPlayer_h #define MediaPlayer_h #if ENABLE(VIDEO) #include "GraphicsTypes3D.h" #include "AudioTrackPrivate.h" #include "CDMSession.h" #include "InbandTextTrackPrivate.h" #include "IntRect.h" #include "URL.h" #include "LayoutRect.h" #include "MediaPlayerEnums.h" #include "NativeImagePtr.h" #include "PlatformLayer.h" #include "PlatformMediaResourceLoader.h" #include "PlatformMediaSession.h" #include "Timer.h" #include "VideoTrackPrivate.h" #include #include #include #include #include #include #if ENABLE(AVF_CAPTIONS) #include "PlatformTextTrack.h" #endif OBJC_CLASS AVAsset; OBJC_CLASS AVPlayer; OBJC_CLASS NSArray; OBJC_CLASS QTMovie; class AVCFPlayer; class QTMovieGWorld; class QTMovieVisualContext; namespace WebCore { class AudioSourceProvider; class AuthenticationChallenge; class Document; class MediaPlaybackTarget; #if ENABLE(MEDIA_SOURCE) class MediaSourcePrivateClient; #endif #if ENABLE(MEDIA_STREAM) class MediaStreamPrivate; #endif class MediaPlayerPrivateInterface; class TextTrackRepresentation; struct Cookie; // Structure that will hold every native // types supported by the current media player. // We have to do that has multiple media players // backend can live at runtime. struct PlatformMedia { enum { None, QTMovieType, QTMovieGWorldType, QTMovieVisualContextType, AVFoundationMediaPlayerType, AVFoundationCFMediaPlayerType, AVFoundationAssetType, QtMediaPlayerType, } type; union { QTMovie* qtMovie; QTMovieGWorld* qtMovieGWorld; QTMovieVisualContext* qtMovieVisualContext; AVPlayer* avfMediaPlayer; AVCFPlayer* avcfMediaPlayer; AVAsset* avfAsset; MediaPlayerPrivateInterface* qtMediaPlayer; } media; }; struct MediaEngineSupportParameters { MediaEngineSupportParameters() { } String type; String codecs; URL url; String keySystem; bool isMediaSource { false }; bool isMediaStream { false }; }; extern const PlatformMedia NoPlatformMedia; class CDMSessionClient; class CachedResourceLoader; class ContentType; class GraphicsContext; class GraphicsContext3D; class IntRect; class IntSize; class MediaPlayer; class PlatformTimeRanges; struct MediaPlayerFactory; #if PLATFORM(WIN) && USE(AVFOUNDATION) struct GraphicsDeviceAdapter; #endif #if USE(GSTREAMER) class MediaPlayerRequestInstallMissingPluginsCallback; #endif class MediaPlayerClient { public: virtual ~MediaPlayerClient() { } // Get the document which the media player is owned by virtual Document* mediaPlayerOwningDocument() { return 0; } // the network state has changed virtual void mediaPlayerNetworkStateChanged(MediaPlayer*) { } // the ready state has changed virtual void mediaPlayerReadyStateChanged(MediaPlayer*) { } // the volume state has changed virtual void mediaPlayerVolumeChanged(MediaPlayer*) { } // the mute state has changed virtual void mediaPlayerMuteChanged(MediaPlayer*) { } // time has jumped, eg. not as a result of normal playback virtual void mediaPlayerTimeChanged(MediaPlayer*) { } // the media file duration has changed, or is now known virtual void mediaPlayerDurationChanged(MediaPlayer*) { } // the playback rate has changed virtual void mediaPlayerRateChanged(MediaPlayer*) { } // the play/pause status changed virtual void mediaPlayerPlaybackStateChanged(MediaPlayer*) { } // The MediaPlayer has found potentially problematic media content. // This is used internally to trigger swapping from a