/* * Copyright (C) 2007, 2008, 2009, 2010, 2011 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 COMPUTER, 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 COMPUTER, 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) #if ENABLE(PLUGIN_PROXY_FOR_VIDEO) #include "MediaPlayerProxy.h" #endif #include "Document.h" #include "IntRect.h" #include #include #include #include #include #include #if USE(ACCELERATED_COMPOSITING) #include "GraphicsLayer.h" #endif #ifdef __OBJC__ @class AVPlayer; @class QTMovie; #else class AVPlayer; class QTMovie; #endif class QTMovieGWorld; class QTMovieVisualContext; namespace WebCore { class GStreamerGWorld; class MediaPlayerPrivateInterface; // 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, GStreamerGWorldType, ChromiumMediaPlayerType, QtMediaPlayerType, AVFoundationMediaPlayerType, } type; union { QTMovie* qtMovie; QTMovieGWorld* qtMovieGWorld; QTMovieVisualContext* qtMovieVisualContext; GStreamerGWorld* gstreamerGWorld; MediaPlayerPrivateInterface* chromiumMediaPlayer; MediaPlayerPrivateInterface* qtMediaPlayer; AVPlayer* avfMediaPlayer; } media; }; extern const PlatformMedia NoPlatformMedia; class ContentType; class FrameView; class GraphicsContext; class IntRect; class IntSize; class MediaPlayer; struct MediaPlayerFactory; class TimeRanges; 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