| 1 |
|
|---|
| 2 |
|
|---|
| 3 |
|
|---|
| 4 |
|
|---|
| 5 |
|
|---|
| 6 |
|
|---|
| 7 |
|
|---|
| 8 |
|
|---|
| 9 |
|
|---|
| 10 |
|
|---|
| 11 |
|
|---|
| 12 |
|
|---|
| 13 |
|
|---|
| 14 |
|
|---|
| 15 |
|
|---|
| 16 |
|
|---|
| 17 |
|
|---|
| 18 |
|
|---|
| 19 |
|
|---|
| 20 |
|
|---|
| 21 |
|
|---|
| 22 |
|
|---|
| 23 |
#ifndef MediaPlayerPrivateGStreamer_h |
|---|
| 24 |
#define MediaPlayerPrivateGStreamer_h |
|---|
| 25 |
|
|---|
| 26 |
#if ENABLE(VIDEO) || ENABLE(CEHTML_MEDIA_OBJECTS) || ENABLE(DAE_TUNER) |
|---|
| 27 |
|
|---|
| 28 |
#include "MediaPlayerPrivate.h" |
|---|
| 29 |
#include "Timer.h" |
|---|
| 30 |
|
|---|
| 31 |
#include <cairo.h> |
|---|
| 32 |
#include <glib.h> |
|---|
| 33 |
#include <gst/gst.h> |
|---|
| 34 |
|
|---|
| 35 |
typedef struct _WebKitVideoSink WebKitVideoSink; |
|---|
| 36 |
typedef struct _GstBuffer GstBuffer; |
|---|
| 37 |
typedef struct _GstMessage GstMessage; |
|---|
| 38 |
typedef struct _GstElement GstElement; |
|---|
| 39 |
typedef struct _GstBus GstBus; |
|---|
| 40 |
|
|---|
| 41 |
namespace WebCore { |
|---|
| 42 |
|
|---|
| 43 |
class GraphicsContext; |
|---|
| 44 |
class IntSize; |
|---|
| 45 |
class IntRect; |
|---|
| 46 |
class String; |
|---|
| 47 |
|
|---|
| 48 |
gboolean mediaPlayerPrivateMessageCallback(GstBus* bus, GstMessage* message, gpointer data); |
|---|
| 49 |
void mediaPlayerPrivateVolumeChangedCallback(GObject* element, GParamSpec* pspec, gpointer data); |
|---|
| 50 |
void mediaPlayerPrivateSourceChangedCallback(GObject* element, GParamSpec* pspec, gpointer data); |
|---|
| 51 |
|
|---|
| 52 |
class MediaPlayerPrivate : public MediaPlayerPrivateInterface { |
|---|
| 53 |
friend gboolean mediaPlayerPrivateMessageCallback(GstBus* bus, GstMessage* message, gpointer data); |
|---|
| 54 |
friend void mediaPlayerPrivateRepaintCallback(WebKitVideoSink*, GstBuffer* buffer, MediaPlayerPrivate* playerPrivate); |
|---|
| 55 |
friend void mediaPlayerPrivateSourceChangedCallback(GObject* element, GParamSpec* pspec, gpointer data); |
|---|
| 56 |
|
|---|
| 57 |
public: |
|---|
| 58 |
|
|---|
| 59 |
static void registerMediaEngine(MediaEngineRegistrar); |
|---|
| 60 |
~MediaPlayerPrivate(); |
|---|
| 61 |
|
|---|
| 62 |
IntSize naturalSize() const; |
|---|
| 63 |
bool hasVideo() const; |
|---|
| 64 |
bool hasAudio() const; |
|---|
| 65 |
|
|---|
| 66 |
#if ENABLE(DAE_TUNER) |
|---|
| 67 |
void load(PassRefPtr<Channel>); |
|---|
| 68 |
#endif |
|---|
| 69 |
void load(const String &url); |
|---|
| 70 |
void cancelLoad(); |
|---|
| 71 |
bool loadNextLocation(); |
|---|
| 72 |
|
|---|
| 73 |
void play(); |
|---|
| 74 |
void pause(); |
|---|
| 75 |
|
|---|
| 76 |
bool paused() const; |
|---|
| 77 |
bool seeking() const; |
|---|
| 78 |
|
|---|
| 79 |
float duration() const; |
|---|
| 80 |
float currentTime() const; |
|---|
| 81 |
void seek(float); |
|---|
| 82 |
|
|---|
| 83 |
void setRate(float); |
|---|
| 84 |
|
|---|
| 85 |
void setVolume(float); |
|---|
| 86 |
void volumeChanged(); |
|---|
| 87 |
void volumeChangedCallback(); |
|---|
| 88 |
|
|---|
| 89 |
bool supportsMuting() const; |
|---|
| 90 |
void setMuted(bool); |
|---|
| 91 |
void muteChanged(); |
|---|
| 92 |
void muteChangedCallback(); |
|---|
| 93 |
|
|---|
| 94 |
void setAutobuffer(bool); |
|---|
| 95 |
bool queryBufferingStats(); |
|---|
| 96 |
|
|---|
| 97 |
MediaPlayer::NetworkState networkState() const; |
|---|
| 98 |
MediaPlayer::ReadyState readyState() const; |
|---|
| 99 |
|
|---|
| 100 |
PassRefPtr<TimeRanges> buffered() const; |
|---|
| 101 |
float maxTimeSeekable() const; |
|---|
| 102 |
unsigned bytesLoaded() const; |
|---|
| 103 |
unsigned totalBytes() const; |
|---|
| 104 |
|
|---|
| 105 |
void setVisible(bool); |
|---|
| 106 |
void setSize(const IntSize&); |
|---|
| 107 |
|
|---|
| 108 |
void mediaLocationChanged(GstMessage*); |
|---|
| 109 |
void loadStateChanged(); |
|---|
| 110 |
void sizeChanged(); |
|---|
| 111 |
void timeChanged(); |
|---|
| 112 |
void didEnd(); |
|---|
| 113 |
void durationChanged(); |
|---|
| 114 |
void loadingFailed(MediaPlayer::NetworkState); |
|---|
| 115 |
|
|---|
| 116 |
void repaint(); |
|---|
| 117 |
void paint(GraphicsContext*, const IntRect&); |
|---|
| 118 |
|
|---|
| 119 |
bool hasSingleSecurityOrigin() const; |
|---|
| 120 |
|
|---|
| 121 |
bool supportsFullscreen() const; |
|---|
| 122 |
|
|---|
| 123 |
bool pipelineReset() const { return m_resetPipeline; } |
|---|
| 124 |
|
|---|
| 125 |
#if ENABLE(CEHTML_MEDIA_OBJECTS) || ENABLE(DAE_TUNER) |
|---|
| 126 |
void stop(); |
|---|
| 127 |
void setAspect(MediaPlayer::VideoScale); |
|---|
| 128 |
WTF::Vector<float> playSpeeds(); |
|---|
| 129 |
#endif |
|---|
| 130 |
|
|---|
| 131 |
#if ENABLE(CEHTML_MEDIA_OBJECTS) |
|---|
| 132 |
bool nextTrack(); |
|---|
| 133 |
bool previousTrack(); |
|---|
| 134 |
unsigned int numTracks(); |
|---|
| 135 |
unsigned int currentTrack(); |
|---|
| 136 |
void setCurrentTrack(unsigned int); |
|---|
| 137 |
#endif |
|---|
| 138 |
|
|---|
| 139 |
private: |
|---|
| 140 |
|
|---|
| 141 |
MediaPlayerPrivate(MediaPlayer*); |
|---|
| 142 |
static MediaPlayerPrivateInterface* create(MediaPlayer* player); |
|---|
| 143 |
|
|---|
| 144 |
static void getSupportedTypes(HashSet<String>&); |
|---|
| 145 |
static MediaPlayer::SupportsType supportsType(const String& type, const String& codecs); |
|---|
| 146 |
static bool isAvailable(); |
|---|
| 147 |
|
|---|
| 148 |
void updateStates(); |
|---|
| 149 |
void cancelSeek(); |
|---|
| 150 |
void endPointTimerFired(Timer<MediaPlayerPrivate>*); |
|---|
| 151 |
float maxTimeLoaded() const; |
|---|
| 152 |
void startEndPointTimerIfNeeded(); |
|---|
| 153 |
|
|---|
| 154 |
void createGSTPlayBin(); |
|---|
| 155 |
bool changePipelineState(GstState state); |
|---|
| 156 |
|
|---|
| 157 |
void processBufferingStats(GstMessage* message); |
|---|
| 158 |
|
|---|
| 159 |
private: |
|---|
| 160 |
MediaPlayer* m_player; |
|---|
| 161 |
GstElement* m_playBin; |
|---|
| 162 |
GstElement* m_videoSink; |
|---|
| 163 |
GstElement* m_fpsSink; |
|---|
| 164 |
GstElement* m_source; |
|---|
| 165 |
GstClockTime m_seekTime; |
|---|
| 166 |
bool m_changingRate; |
|---|
| 167 |
float m_endTime; |
|---|
| 168 |
bool m_isEndReached; |
|---|
| 169 |
MediaPlayer::NetworkState m_networkState; |
|---|
| 170 |
MediaPlayer::ReadyState m_readyState; |
|---|
| 171 |
bool m_startedPlaying; |
|---|
| 172 |
mutable bool m_isStreaming; |
|---|
| 173 |
IntSize m_size; |
|---|
| 174 |
GstBuffer* m_buffer; |
|---|
| 175 |
GstStructure* m_mediaLocations; |
|---|
| 176 |
gint m_mediaLocationCurrentIndex; |
|---|
| 177 |
bool m_resetPipeline; |
|---|
| 178 |
bool m_paused; |
|---|
| 179 |
bool m_seeking; |
|---|
| 180 |
float m_playbackRate; |
|---|
| 181 |
bool m_errorOccured; |
|---|
| 182 |
guint m_volumeIdleId; |
|---|
| 183 |
gfloat m_mediaDuration; |
|---|
| 184 |
guint m_muteIdleId; |
|---|
| 185 |
bool m_startedBuffering; |
|---|
| 186 |
guint m_fillTimeoutId; |
|---|
| 187 |
float m_maxTimeLoaded; |
|---|
| 188 |
gdouble m_fillStatus; |
|---|
| 189 |
}; |
|---|
| 190 |
} |
|---|
| 191 |
|
|---|
| 192 |
#endif |
|---|
| 193 |
#endif |
|---|
| 194 |
|
|---|