1/* 2 * Copyright (C) 2007, 2008, 2009 Apple Inc. All rights reserved. 3 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright 9 * notice, this list of conditions and the following disclaimer. 10 * 2. Redistributions in binary form must reproduce the above copyright 11 * notice, this list of conditions and the following disclaimer in the 12 * documentation and/or other materials provided with the distribution. 13 * 14 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY 15 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 17 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR 18 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 19 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 20 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 21 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 22 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 */ 26 27#ifndef MediaPlayerPrivateWinCE_h 28#define MediaPlayerPrivateWinCE_h 29 30#if ENABLE(VIDEO) 31 32#include <wtf/Forward.h> 33#include "MediaPlayerPrivate.h" 34#include "Timer.h" 35#include <wtf/OwnPtr.h> 36 37namespace WebCore { 38 39 class GraphicsContext; 40 class IntSize; 41 class IntRect; 42 43 class MediaPlayerPrivate : public MediaPlayerPrivateInterface { 44 public: 45 static void registerMediaEngine(MediaEngineRegistrar); 46 47 ~MediaPlayerPrivate(); 48 49 IntSize naturalSize() const; 50 bool hasVideo() const; 51 52 void load(const String& url); 53 void cancelLoad(); 54 55 void play(); 56 void pause(); 57 58 bool paused() const; 59 bool seeking() const; 60 61 float duration() const; 62 float currentTime() const; 63 void seek(float time); 64 65 void setRate(float); 66 void setVolume(float); 67 68 MediaPlayer::NetworkState networkState() const { return m_networkState; } 69 MediaPlayer::ReadyState readyState() const { return m_readyState; } 70 71 PassRefPtr<TimeRanges> buffered() const; 72 float maxTimeSeekable() const; 73 unsigned bytesLoaded() const; 74 unsigned totalBytes() const; 75 76 void setVisible(bool); 77 void setSize(const IntSize&); 78 79 void loadStateChanged(); 80 void didEnd(); 81 82 void paint(GraphicsContext*, const IntRect&); 83 84 private: 85 MediaPlayerPrivate(MediaPlayer*); 86 87 void updateStates(); 88 void doSeek(); 89 void cancelSeek(); 90 void seekTimerFired(Timer<MediaPlayerPrivate>*); 91 float maxTimeLoaded() const; 92 void sawUnsupportedTracks(); 93#if ENABLE(PLUGIN_PROXY_FOR_VIDEO) 94 void setMediaPlayerProxy(WebMediaPlayerProxy*); 95 void setPoster(const String& url); 96 void deliverNotification(MediaPlayerProxyNotificationType); 97#endif 98 99 // engine support 100 static MediaPlayerPrivateInterface* create(MediaPlayer*); 101 static void getSupportedTypes(HashSet<String>& types); 102 static MediaPlayer::SupportsType supportsType(const String& type, const String& codecs); 103 static bool isAvailable(); 104 105 MediaPlayer* m_player; 106 float m_seekTo; 107 float m_endTime; 108 Timer<MediaPlayerPrivate> m_seekTimer; 109 MediaPlayer::NetworkState m_networkState; 110 MediaPlayer::ReadyState m_readyState; 111 unsigned m_enabledTrackCount; 112 unsigned m_totalTrackCount; 113 bool m_hasUnsupportedTracks; 114 bool m_startedPlaying; 115 bool m_isStreaming; 116#if ENABLE(PLUGIN_PROXY_FOR_VIDEO) 117 WebMediaPlayerProxy* m_proxy; 118#endif 119 }; 120 121} 122 123#endif // ENABLE(VIDEO) 124 125#endif // MediaPlayerPrivateWinCE_h 126