| OLD | NEW |
| (Empty) |
| 1 /* | |
| 2 * Copyright (C) 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved. | |
| 3 * | |
| 4 * Redistribution and use in source and binary forms, with or without | |
| 5 * modification, are permitted provided that the following conditions | |
| 6 * are met: | |
| 7 * 1. Redistributions of source code must retain the above copyright | |
| 8 * notice, this list of conditions and the following disclaimer. | |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | |
| 10 * notice, this list of conditions and the following disclaimer in the | |
| 11 * documentation and/or other materials provided with the distribution. | |
| 12 * | |
| 13 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY | |
| 14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
| 15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |
| 16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR | |
| 17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | |
| 18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | |
| 19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR | |
| 20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY | |
| 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
| 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | |
| 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
| 24 */ | |
| 25 | |
| 26 #ifndef MediaPlayerPrivateQuickTimeVisualContext_h | |
| 27 #define MediaPlayerPrivateQuickTimeVisualContext_h | |
| 28 | |
| 29 #if ENABLE(VIDEO) | |
| 30 | |
| 31 #include "MediaPlayerPrivate.h" | |
| 32 #include "Timer.h" | |
| 33 #include <CoreGraphics/CGAffineTransform.h> | |
| 34 #include <wtf/Forward.h> | |
| 35 #include <wtf/OwnPtr.h> | |
| 36 #include <wtf/RetainPtr.h> | |
| 37 | |
| 38 #ifndef DRAW_FRAME_RATE | |
| 39 #define DRAW_FRAME_RATE 0 | |
| 40 #endif | |
| 41 | |
| 42 typedef struct CGImage *CGImageRef; | |
| 43 class QTMovie; | |
| 44 class QTMovieVisualContext; | |
| 45 class QTDecompressionSession; | |
| 46 | |
| 47 namespace WebCore { | |
| 48 | |
| 49 class GraphicsContext; | |
| 50 class IntSize; | |
| 51 class IntRect; | |
| 52 | |
| 53 #if USE(ACCELERATED_COMPOSITING) | |
| 54 class PlatformCALayer; | |
| 55 class WKCAImageQueue; | |
| 56 #endif | |
| 57 | |
| 58 class MediaPlayerPrivateQuickTimeVisualContext : public MediaPlayerPrivateInterf
ace { | |
| 59 public: | |
| 60 static void registerMediaEngine(MediaEngineRegistrar); | |
| 61 | |
| 62 ~MediaPlayerPrivateQuickTimeVisualContext(); | |
| 63 | |
| 64 private: | |
| 65 MediaPlayerPrivateQuickTimeVisualContext(MediaPlayer*); | |
| 66 | |
| 67 virtual bool supportsFullscreen() const; | |
| 68 virtual PlatformMedia platformMedia() const; | |
| 69 #if USE(ACCELERATED_COMPOSITING) | |
| 70 virtual PlatformLayer* platformLayer() const; | |
| 71 #endif | |
| 72 | |
| 73 IntSize naturalSize() const; | |
| 74 bool hasVideo() const; | |
| 75 bool hasAudio() const; | |
| 76 | |
| 77 void load(const String& url); | |
| 78 void cancelLoad(); | |
| 79 void loadInternal(const String& url); | |
| 80 void resumeLoad(); | |
| 81 | |
| 82 void play(); | |
| 83 void pause(); | |
| 84 void prepareToPlay(); | |
| 85 | |
| 86 bool paused() const; | |
| 87 bool seeking() const; | |
| 88 | |
| 89 float duration() const; | |
| 90 float currentTime() const; | |
| 91 void seek(float time); | |
| 92 | |
| 93 void setRate(float); | |
| 94 void setVolume(float); | |
| 95 void setPreservesPitch(bool); | |
| 96 | |
| 97 MediaPlayer::NetworkState networkState() const { return m_networkState; } | |
| 98 MediaPlayer::ReadyState readyState() const { return m_readyState; } | |
| 99 | |
| 100 PassRefPtr<TimeRanges> buffered() const; | |
| 101 float maxTimeSeekable() const; | |
| 102 bool didLoadingProgress() const; | |
| 103 unsigned totalBytes() const; | |
| 104 | |
| 105 void setVisible(bool); | |
| 106 void setSize(const IntSize&); | |
| 107 | |
| 108 void loadStateChanged(); | |
| 109 void didEnd(); | |
| 110 | |
| 111 void paint(GraphicsContext*, const IntRect&); | |
| 112 void paintCompleted(GraphicsContext&, const IntRect&); | |
| 113 | |
| 114 bool hasSingleSecurityOrigin() const; | |
| 115 | |
| 116 bool hasClosedCaptions() const; | |
| 117 void setClosedCaptionsVisible(bool); | |
| 118 | |
| 119 void setPreload(MediaPlayer::Preload); | |
| 120 | |
| 121 void updateStates(); | |
| 122 void doSeek(); | |
| 123 void cancelSeek(); | |
| 124 void seekTimerFired(Timer<MediaPlayerPrivateQuickTimeVisualContext>*); | |
| 125 float maxTimeLoaded() const; | |
| 126 void sawUnsupportedTracks(); | |
| 127 | |
| 128 // engine support | |
| 129 static PassOwnPtr<MediaPlayerPrivateInterface> create(MediaPlayer*); | |
| 130 static void getSupportedTypes(HashSet<String>& types); | |
| 131 static MediaPlayer::SupportsType supportsType(const String& type, const Stri
ng& codecs, const KURL&); | |
| 132 static bool isAvailable(); | |
| 133 | |
| 134 #if USE(ACCELERATED_COMPOSITING) | |
| 135 virtual bool supportsAcceleratedRendering() const; | |
| 136 virtual void acceleratedRenderingStateChanged(); | |
| 137 #endif | |
| 138 | |
| 139 enum MediaRenderingMode { MediaRenderingNone, MediaRenderingSoftwareRenderer
, MediaRenderingMovieLayer }; | |
| 140 MediaRenderingMode currentRenderingMode() const; | |
| 141 MediaRenderingMode preferredRenderingMode() const; | |
| 142 bool isReadyForRendering() const; | |
| 143 | |
| 144 void setUpVideoRendering(); | |
| 145 void tearDownVideoRendering(); | |
| 146 bool hasSetUpVideoRendering() const; | |
| 147 | |
| 148 void createLayerForMovie(); | |
| 149 void destroyLayerForMovie(); | |
| 150 | |
| 151 void setUpCookiesForQuickTime(const String& url); | |
| 152 String rfc2616DateStringFromTime(CFAbsoluteTime); | |
| 153 | |
| 154 void visualContextTimerFired(Timer<MediaPlayerPrivateQuickTimeVisualContext>
*); | |
| 155 void retrieveCurrentImage(); | |
| 156 | |
| 157 virtual void setPrivateBrowsingMode(bool); | |
| 158 | |
| 159 virtual String engineDescription() const { return "QuickTime"; } | |
| 160 | |
| 161 class MovieClient; | |
| 162 friend class MovieClient; | |
| 163 OwnPtr<MovieClient> m_movieClient; | |
| 164 | |
| 165 #if USE(ACCELERATED_COMPOSITING) | |
| 166 class LayerClient; | |
| 167 friend class LayerClient; | |
| 168 OwnPtr<LayerClient> m_layerClient; | |
| 169 #endif | |
| 170 | |
| 171 class VisualContextClient; | |
| 172 friend class VisualContextClient; | |
| 173 OwnPtr<VisualContextClient> m_visualContextClient; | |
| 174 | |
| 175 void retrieveAndResetMovieTransform(); | |
| 176 | |
| 177 virtual float mediaTimeForTimeValue(float) const; | |
| 178 | |
| 179 MediaPlayer* m_player; | |
| 180 RefPtr<QTMovie> m_movie; | |
| 181 #if USE(ACCELERATED_COMPOSITING) | |
| 182 RefPtr<PlatformCALayer> m_qtVideoLayer; | |
| 183 RefPtr<PlatformCALayer> m_transformLayer; | |
| 184 OwnPtr<WKCAImageQueue> m_imageQueue; | |
| 185 OwnPtr<QTDecompressionSession> m_decompressionSession; | |
| 186 CGAffineTransform m_movieTransform; | |
| 187 #endif | |
| 188 RefPtr<QTMovieVisualContext> m_visualContext; | |
| 189 float m_seekTo; | |
| 190 Timer<MediaPlayerPrivateQuickTimeVisualContext> m_seekTimer; | |
| 191 Timer<MediaPlayerPrivateQuickTimeVisualContext> m_visualContextTimer; | |
| 192 IntSize m_size; | |
| 193 MediaPlayer::NetworkState m_networkState; | |
| 194 MediaPlayer::ReadyState m_readyState; | |
| 195 unsigned m_enabledTrackCount; | |
| 196 unsigned m_totalTrackCount; | |
| 197 bool m_hasUnsupportedTracks; | |
| 198 bool m_startedPlaying; | |
| 199 bool m_isStreaming; | |
| 200 bool m_visible; | |
| 201 bool m_newFrameAvailable; | |
| 202 bool m_delayingLoad; | |
| 203 String m_movieURL; | |
| 204 bool m_privateBrowsing; | |
| 205 MediaPlayer::Preload m_preload; | |
| 206 mutable float m_maxTimeLoadedAtLastDidLoadingProgress; | |
| 207 #if DRAW_FRAME_RATE | |
| 208 double m_frameCountWhilePlaying; | |
| 209 double m_timeStartedPlaying; | |
| 210 double m_timeStoppedPlaying; | |
| 211 #endif | |
| 212 | |
| 213 }; | |
| 214 | |
| 215 } | |
| 216 | |
| 217 #endif | |
| 218 #endif | |
| OLD | NEW |