Diffstat (limited to 'noncore/multimedia/opieplayer2/lib.h') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/multimedia/opieplayer2/lib.h | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/noncore/multimedia/opieplayer2/lib.h b/noncore/multimedia/opieplayer2/lib.h index 4b8dc81..34b85b9 100644 --- a/noncore/multimedia/opieplayer2/lib.h +++ b/noncore/multimedia/opieplayer2/lib.h | |||
@@ -34,49 +34,50 @@ | |||
34 | #ifndef ZECKEXINELIB_H | 34 | #ifndef ZECKEXINELIB_H |
35 | #define ZECKEXINELIB_H | 35 | #define ZECKEXINELIB_H |
36 | 36 | ||
37 | #include <qcstring.h> | 37 | #include <qcstring.h> |
38 | #include <qstring.h> | 38 | #include <qstring.h> |
39 | #include <qobject.h> | 39 | #include <qobject.h> |
40 | 40 | ||
41 | #include <xine.h> | 41 | #include <xine.h> |
42 | //#include "xine.h" | 42 | //#include "xine.h" |
43 | 43 | ||
44 | #include "threadutil.h" | 44 | #include "threadutil.h" |
45 | 45 | ||
46 | class XineVideoWidget; | 46 | class XineVideoWidget; |
47 | 47 | ||
48 | namespace XINE { | 48 | namespace XINE { |
49 | 49 | ||
50 | /** | 50 | /** |
51 | * Lib wrapps the simple interface | 51 | * Lib wrapps the simple interface |
52 | * of libxine for easy every day use | 52 | * of libxine for easy every day use |
53 | * This will become a full C++ Wrapper | 53 | * This will become a full C++ Wrapper |
54 | * It supports playing, pausing, info, | 54 | * It supports playing, pausing, info, |
55 | * stooping, seeking. | 55 | * stooping, seeking. |
56 | */ | 56 | */ |
57 | class Frame; | 57 | class Frame; |
58 | class Lib : public ThreadUtil::Channel { | 58 | class Lib : public ThreadUtil::Channel, private ThreadUtil::Thread |
59 | { | ||
59 | Q_OBJECT | 60 | Q_OBJECT |
60 | public: | 61 | public: |
61 | Lib(XineVideoWidget* = 0); | 62 | Lib(XineVideoWidget* = 0); |
62 | ~Lib(); | 63 | ~Lib(); |
63 | static int majorVersion(); | 64 | static int majorVersion(); |
64 | static int minorVersion(); | 65 | static int minorVersion(); |
65 | static int subVersion(); | 66 | static int subVersion(); |
66 | 67 | ||
67 | 68 | ||
68 | void resize ( const QSize &s ); | 69 | void resize ( const QSize &s ); |
69 | 70 | ||
70 | int play( const QString& fileName, | 71 | int play( const QString& fileName, |
71 | int startPos = 0, | 72 | int startPos = 0, |
72 | int start_time = 0 ); | 73 | int start_time = 0 ); |
73 | void stop(); | 74 | void stop(); |
74 | void pause( bool toggle ); | 75 | void pause( bool toggle ); |
75 | 76 | ||
76 | int speed() const; | 77 | int speed() const; |
77 | 78 | ||
78 | /** | 79 | /** |
79 | * Set the speed of the stream, if codec supports it | 80 | * Set the speed of the stream, if codec supports it |
80 | * XINE_SPEED_PAUSE 0 | 81 | * XINE_SPEED_PAUSE 0 |
81 | * XINE_SPEED_SLOW_4 1 | 82 | * XINE_SPEED_SLOW_4 1 |
82 | * XINE_SPEED_SLOW_2 2 | 83 | * XINE_SPEED_SLOW_2 2 |
@@ -156,56 +157,71 @@ namespace XINE { | |||
156 | /** | 157 | /** |
157 | * Set the Gamma value for video output | 158 | * Set the Gamma value for video output |
158 | * @param int the value between -100 and 100, 0 is original | 159 | * @param int the value between -100 and 100, 0 is original |
159 | */ | 160 | */ |
160 | void setGamma( int ); | 161 | void setGamma( int ); |
161 | 162 | ||
162 | /** | 163 | /** |
163 | * test | 164 | * test |
164 | */ | 165 | */ |
165 | Frame currentFrame() const; | 166 | Frame currentFrame() const; |
166 | 167 | ||
167 | /** | 168 | /** |
168 | * Returns the error code | 169 | * Returns the error code |
169 | * XINE_ERROR_NONE 0 | 170 | * XINE_ERROR_NONE 0 |
170 | * XINE_ERROR_NO_INPUT_PLUGIN 1 | 171 | * XINE_ERROR_NO_INPUT_PLUGIN 1 |
171 | * XINE_ERROR_NO_DEMUXER_PLUGIN 2 | 172 | * XINE_ERROR_NO_DEMUXER_PLUGIN 2 |
172 | * XINE_ERROR_DEMUXER_FAILED 3 | 173 | * XINE_ERROR_DEMUXER_FAILED 3 |
173 | */ | 174 | */ |
174 | int error() const; | 175 | int error() const; |
175 | 176 | ||
176 | signals: | 177 | signals: |
177 | 178 | ||
178 | void stopped(); | 179 | void stopped(); |
179 | 180 | ||
181 | void initialized(); | ||
182 | |||
180 | protected: | 183 | protected: |
181 | virtual void receiveMessage( ThreadUtil::ChannelMessage *msg, SendType sendType ); | 184 | virtual void receiveMessage( ThreadUtil::ChannelMessage *msg, SendType sendType ); |
182 | 185 | ||
186 | virtual void run(); | ||
187 | |||
183 | private: | 188 | private: |
184 | void initialize(); | 189 | void initialize(); |
185 | 190 | ||
186 | void assertInitialized() const; | 191 | void assertInitialized() const; |
187 | 192 | ||
193 | enum { XineMessageType = 1, InitializationMessageType }; | ||
194 | |||
195 | struct XineMessage : public ThreadUtil::ChannelMessage | ||
196 | { | ||
197 | XineMessage( int _xineEvent ) : ThreadUtil::ChannelMessage( XineMessageType ), | ||
198 | xineEvent( _xineEvent ) | ||
199 | {} | ||
200 | |||
201 | int xineEvent; | ||
202 | }; | ||
203 | |||
188 | mutable ThreadUtil::Mutex m_initGuard; | 204 | mutable ThreadUtil::Mutex m_initGuard; |
189 | bool m_initialized : 1; | 205 | bool m_initialized : 1; |
190 | 206 | ||
191 | int m_bytes_per_pixel; | 207 | int m_bytes_per_pixel; |
192 | bool m_video:1; | 208 | bool m_video:1; |
193 | XineVideoWidget *m_wid; | 209 | XineVideoWidget *m_wid; |
194 | xine_t *m_xine; | 210 | xine_t *m_xine; |
195 | xine_stream_t *m_stream; | 211 | xine_stream_t *m_stream; |
196 | xine_cfg_entry_t *m_config; | 212 | xine_cfg_entry_t *m_config; |
197 | xine_vo_driver_t *m_videoOutput; | 213 | xine_vo_driver_t *m_videoOutput; |
198 | xine_ao_driver_t* m_audioOutput; | 214 | xine_ao_driver_t* m_audioOutput; |
199 | xine_event_queue_t *m_queue; | 215 | xine_event_queue_t *m_queue; |
200 | 216 | ||
201 | void handleXineEvent( const xine_event_t* t ); | 217 | void handleXineEvent( const xine_event_t* t ); |
202 | void handleXineEvent( int type ); | 218 | void handleXineEvent( int type ); |
203 | void drawFrame( uint8_t* frame, int width, int height, int bytes ); | 219 | void drawFrame( uint8_t* frame, int width, int height, int bytes ); |
204 | // C -> C++ bridge for the event system | 220 | // C -> C++ bridge for the event system |
205 | static void xine_event_handler( void* user_data, const xine_event_t* t); | 221 | static void xine_event_handler( void* user_data, const xine_event_t* t); |
206 | static void xine_display_frame( void* user_data, uint8_t* frame , | 222 | static void xine_display_frame( void* user_data, uint8_t* frame , |
207 | int width, int height, int bytes ); | 223 | int width, int height, int bytes ); |
208 | }; | 224 | }; |
209 | }; | 225 | }; |
210 | 226 | ||
211 | 227 | ||