2 * Copyright (C) 2007, 2009 Apple Inc. All rights reserved.
3 * Copyright (C) 2007 Collabora Ltd. All rights reserved.
4 * Copyright (C) 2007 Alp Toker <alp@atoker.com>
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library General Public License for more details.
16 * You should have received a copy of the GNU Library General Public License
17 * aint with this library; see the file COPYING.LIB. If not, write to
18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 * Boston, MA 02110-1301, USA.
22 #ifndef MediaPlayerPrivateGStreamer_h
23 #define MediaPlayerPrivateGStreamer_h
27 #include "MediaPlayerPrivate.h"
34 typedef struct _WebKitVideoSink WebKitVideoSink;
35 typedef struct _GstBuffer GstBuffer;
36 typedef struct _GstMessage GstMessage;
37 typedef struct _GstElement GstElement;
38 typedef struct _GstBus GstBus;
42 class GraphicsContext;
47 gboolean mediaPlayerPrivateMessageCallback(GstBus* bus, GstMessage* message, gpointer data);
49 class MediaPlayerPrivate : public MediaPlayerPrivateInterface {
50 friend gboolean mediaPlayerPrivateMessageCallback(GstBus* bus, GstMessage* message, gpointer data);
51 friend void mediaPlayerPrivateRepaintCallback(WebKitVideoSink*, GstBuffer *buffer, MediaPlayerPrivate* playerPrivate);
54 static void registerMediaEngine(MediaEngineRegistrar);
55 ~MediaPlayerPrivate();
57 IntSize naturalSize() const;
58 bool hasVideo() const;
59 bool hasAudio() const;
61 void load(const String &url);
70 float duration() const;
71 float currentTime() const;
73 void setEndTime(float);
76 void setVolume(float);
80 MediaPlayer::NetworkState networkState() const;
81 MediaPlayer::ReadyState readyState() const;
83 PassRefPtr<TimeRanges> buffered() const;
84 float maxTimeSeekable() const;
85 unsigned bytesLoaded() const;
86 bool totalBytesKnown() const;
87 unsigned totalBytes() const;
89 void setVisible(bool);
90 void setSize(const IntSize&);
92 void loadStateChanged();
97 void loadingFailed(MediaPlayer::NetworkState);
100 void paint(GraphicsContext*, const IntRect&);
102 bool hasSingleSecurityOrigin() const;
104 bool supportsFullscreen() const;
107 MediaPlayerPrivate(MediaPlayer*);
108 static MediaPlayerPrivateInterface* create(MediaPlayer* player);
110 static void getSupportedTypes(HashSet<String>&);
111 static MediaPlayer::SupportsType supportsType(const String& type, const String& codecs);
112 static bool isAvailable();
116 void endPointTimerFired(Timer<MediaPlayerPrivate>*);
117 float maxTimeLoaded() const;
118 void startEndPointTimerIfNeeded();
120 void createGSTPlayBin(String url);
123 MediaPlayer* m_player;
124 GstElement* m_playBin;
125 GstElement* m_videoSink;
126 GstElement* m_source;
127 GstClockTime m_seekTime;
131 MediaPlayer::NetworkState m_networkState;
132 MediaPlayer::ReadyState m_readyState;
133 bool m_startedPlaying;
134 mutable bool m_isStreaming;