author | harlekin <harlekin> | 2002-11-09 11:18:45 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2002-11-09 11:18:45 (UTC) |
commit | 29758bfcaabf75a3155e8af140c11ca9ed014c42 (patch) (unidiff) | |
tree | ea8a0ed7eaffe1517a61fb5ac8bc2491eaf59f77 | |
parent | 84e685e0c2922899dcdd69cfc23ecbccbf855af4 (diff) | |
download | opie-29758bfcaabf75a3155e8af140c11ca9ed014c42.zip opie-29758bfcaabf75a3155e8af140c11ca9ed014c42.tar.gz opie-29758bfcaabf75a3155e8af140c11ca9ed014c42.tar.bz2 |
adated to todays version of xine api
-rw-r--r-- | noncore/multimedia/opieplayer2/lib.cpp | 59 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/lib.h | 6 |
2 files changed, 30 insertions, 35 deletions
diff --git a/noncore/multimedia/opieplayer2/lib.cpp b/noncore/multimedia/opieplayer2/lib.cpp index c0e5acd..1ebbbd8 100644 --- a/noncore/multimedia/opieplayer2/lib.cpp +++ b/noncore/multimedia/opieplayer2/lib.cpp | |||
@@ -87,6 +87,7 @@ Lib::Lib( XineVideoWidget* widget ) { | |||
87 | 87 | ||
88 | xine_config_load( m_xine, str.data() ); | 88 | xine_config_load( m_xine, str.data() ); |
89 | 89 | ||
90 | xine_init( m_xine ); | ||
90 | 91 | ||
91 | // allocate oss for sound | 92 | // allocate oss for sound |
92 | // and fb for framebuffer | 93 | // and fb for framebuffer |
@@ -98,7 +99,8 @@ Lib::Lib( XineVideoWidget* widget ) { | |||
98 | 99 | ||
99 | 100 | ||
100 | null_display_handler( m_videoOutput, xine_display_frame, this ); | 101 | null_display_handler( m_videoOutput, xine_display_frame, this ); |
101 | xine_init( m_xine, m_audioOutput, m_videoOutput ); | 102 | |
103 | m_stream = xine_stream_new (m_xine, m_audioOutput, m_videoOutput ); | ||
102 | 104 | ||
103 | if (m_wid != 0 ) { | 105 | if (m_wid != 0 ) { |
104 | printf( "!0\n" ); | 106 | printf( "!0\n" ); |
@@ -108,12 +110,13 @@ Lib::Lib( XineVideoWidget* widget ) { | |||
108 | m_wid->repaint(); | 110 | m_wid->repaint(); |
109 | } | 111 | } |
110 | 112 | ||
111 | xine_register_event_listener( m_xine, xine_event_handler, this ); | 113 | m_queue = xine_event_new_queue (m_stream); |
114 | |||
115 | xine_event_create_listener_thread (m_queue, xine_event_handler, this); | ||
112 | } | 116 | } |
113 | 117 | ||
114 | Lib::~Lib() { | 118 | Lib::~Lib() { |
115 | // free( m_config ); | 119 | // free( m_config ); |
116 | xine_remove_event_listener( m_xine, xine_event_handler ); | ||
117 | xine_exit( m_xine ); | 120 | xine_exit( m_xine ); |
118 | /* FIXME either free or delete but valgrind bitches against both */ | 121 | /* FIXME either free or delete but valgrind bitches against both */ |
119 | //free( m_videoOutput ); | 122 | //free( m_videoOutput ); |
@@ -150,55 +153,55 @@ int Lib::subVersion() { | |||
150 | 153 | ||
151 | int Lib::play( const QString& fileName, int startPos, int start_time ) { | 154 | int Lib::play( const QString& fileName, int startPos, int start_time ) { |
152 | QString str = fileName.stripWhiteSpace(); | 155 | QString str = fileName.stripWhiteSpace(); |
153 | if ( !xine_open( m_xine, QFile::encodeName(str.utf8() ).data() ) ) { | 156 | if ( !xine_open( m_stream, QFile::encodeName(str.utf8() ).data() ) ) { |
154 | return 0; | 157 | return 0; |
155 | } | 158 | } |
156 | return xine_play( m_xine, startPos, start_time); | 159 | return xine_play( m_stream, startPos, start_time); |
157 | } | 160 | } |
158 | 161 | ||
159 | void Lib::stop() { | 162 | void Lib::stop() { |
160 | qDebug("<<<<<<<< STOP IN LIB TRIGGERED >>>>>>>"); | 163 | qDebug("<<<<<<<< STOP IN LIB TRIGGERED >>>>>>>"); |
161 | xine_stop( m_xine ); | 164 | xine_stop( m_stream ); |
162 | } | 165 | } |
163 | 166 | ||
164 | void Lib::pause() { | 167 | void Lib::pause() { |
165 | xine_set_param( m_xine, XINE_PARAM_SPEED, XINE_SPEED_PAUSE ); | 168 | xine_set_param( m_stream, XINE_PARAM_SPEED, XINE_SPEED_PAUSE ); |
166 | } | 169 | } |
167 | 170 | ||
168 | int Lib::speed() { | 171 | int Lib::speed() { |
169 | return xine_get_param ( m_xine, XINE_PARAM_SPEED ); | 172 | return xine_get_param ( m_stream, XINE_PARAM_SPEED ); |
170 | } | 173 | } |
171 | 174 | ||
172 | void Lib::setSpeed( int speed ) { | 175 | void Lib::setSpeed( int speed ) { |
173 | xine_set_param ( m_xine, XINE_PARAM_SPEED, speed ); | 176 | xine_set_param ( m_stream, XINE_PARAM_SPEED, speed ); |
174 | } | 177 | } |
175 | 178 | ||
176 | int Lib::status() { | 179 | int Lib::status() { |
177 | return xine_get_status( m_xine ); | 180 | return xine_get_status( m_stream ); |
178 | } | 181 | } |
179 | 182 | ||
180 | int Lib::currentPosition() { | 183 | int Lib::currentPosition() { |
181 | xine_get_pos_length( m_xine, &m_pos, &m_time, &m_length ); | 184 | xine_get_pos_length( m_stream, &m_pos, &m_time, &m_length ); |
182 | return m_pos; | 185 | return m_pos; |
183 | } | 186 | } |
184 | 187 | ||
185 | int Lib::currentTime() { | 188 | int Lib::currentTime() { |
186 | xine_get_pos_length( m_xine, &m_pos, &m_time, &m_length ); | 189 | xine_get_pos_length( m_stream, &m_pos, &m_time, &m_length ); |
187 | return m_time/1000; | 190 | return m_time/1000; |
188 | } | 191 | } |
189 | 192 | ||
190 | int Lib::length() { | 193 | int Lib::length() { |
191 | xine_get_pos_length( m_xine, &m_pos, &m_time, &m_length ); | 194 | xine_get_pos_length( m_stream, &m_pos, &m_time, &m_length ); |
192 | return m_length/1000; | 195 | return m_length/1000; |
193 | } | 196 | } |
194 | 197 | ||
195 | bool Lib::isSeekable() { | 198 | bool Lib::isSeekable() { |
196 | return xine_get_stream_info( m_xine, XINE_STREAM_INFO_SEEKABLE ); | 199 | return xine_get_stream_info( m_stream, XINE_STREAM_INFO_SEEKABLE ); |
197 | } | 200 | } |
198 | 201 | ||
199 | void Lib::seekTo( int time ) { | 202 | void Lib::seekTo( int time ) { |
200 | // xine_trick_mode ( m_xine, XINE_TRICK_MODE_SEEK_TO_TIME, time ); NOT IMPLEMENTED YET IN XINE :_( | 203 | //xine_trick_mode ( m_stream, XINE_TRICK_MODE_SEEK_TO_TIME, time ); NOT IMPLEMENTED YET IN XINE :_( |
201 | xine_play( m_xine, 0, time ); | 204 | xine_play( m_stream, 0, time ); |
202 | } | 205 | } |
203 | 206 | ||
204 | 207 | ||
@@ -208,15 +211,15 @@ Frame Lib::currentFrame() { | |||
208 | }; | 211 | }; |
209 | 212 | ||
210 | QString Lib::metaInfo( int number) { | 213 | QString Lib::metaInfo( int number) { |
211 | return xine_get_meta_info( m_xine, number ); | 214 | return xine_get_meta_info( m_stream, number ); |
212 | } | 215 | } |
213 | 216 | ||
214 | int Lib::error() { | 217 | int Lib::error() { |
215 | return xine_get_error( m_xine ); | 218 | return xine_get_error( m_stream ); |
216 | }; | 219 | }; |
217 | 220 | ||
218 | void Lib::handleXineEvent( xine_event_t* t ) { | 221 | void Lib::handleXineEvent( const xine_event_t* t ) { |
219 | if ( t->type == XINE_EVENT_PLAYBACK_FINISHED ) { | 222 | if ( t->type == XINE_EVENT_UI_PLAYBACK_FINISHED ) { |
220 | emit stopped(); | 223 | emit stopped(); |
221 | } | 224 | } |
222 | } | 225 | } |
@@ -232,17 +235,7 @@ bool Lib::isShowingVideo() { | |||
232 | } | 235 | } |
233 | 236 | ||
234 | bool Lib::hasVideo() { | 237 | bool Lib::hasVideo() { |
235 | //looks like it is not implemented yet | 238 | return xine_get_stream_info( m_stream, 18 ); |
236 | //return xine_get_stream_info( m_xine, XINE_STREAM_INFO_VIDEO_CHANNELS ); | ||
237 | // ugly hack until xine is ready, look for the width of the video | ||
238 | int test = xine_get_stream_info( m_xine, 2 ); | ||
239 | if( test > 0 ) { | ||
240 | // qDebug( QString(" has video: %1").arg( test ) ); | ||
241 | return true; | ||
242 | } else { | ||
243 | //qDebug ( "does not have video "); | ||
244 | return false; | ||
245 | } | ||
246 | } | 239 | } |
247 | 240 | ||
248 | void Lib::showVideoFullScreen( bool fullScreen ) { | 241 | void Lib::showVideoFullScreen( bool fullScreen ) { |
@@ -259,7 +252,7 @@ void Lib::setScaling( bool scale ) { | |||
259 | 252 | ||
260 | void Lib::setGamma( int value ) { | 253 | void Lib::setGamma( int value ) { |
261 | //qDebug( QString( "%1").arg(value) ); | 254 | //qDebug( QString( "%1").arg(value) ); |
262 | int gammaValue = ( 100 + value ); | 255 | /* int gammaValue = ( 100 + value ); */ |
263 | ::null_set_videoGamma( m_videoOutput, value ); | 256 | ::null_set_videoGamma( m_videoOutput, value ); |
264 | } | 257 | } |
265 | 258 | ||
@@ -267,7 +260,7 @@ bool Lib::isScaling() { | |||
267 | return ::null_is_scaling( m_videoOutput ); | 260 | return ::null_is_scaling( m_videoOutput ); |
268 | } | 261 | } |
269 | 262 | ||
270 | void Lib::xine_event_handler( void* user_data, xine_event_t* t ) { | 263 | void Lib::xine_event_handler( void* user_data, const xine_event_t* t ) { |
271 | ( (Lib*)user_data)->handleXineEvent( t ); | 264 | ( (Lib*)user_data)->handleXineEvent( t ); |
272 | } | 265 | } |
273 | 266 | ||
diff --git a/noncore/multimedia/opieplayer2/lib.h b/noncore/multimedia/opieplayer2/lib.h index 6cdd9c6..191dbbd 100644 --- a/noncore/multimedia/opieplayer2/lib.h +++ b/noncore/multimedia/opieplayer2/lib.h | |||
@@ -180,14 +180,16 @@ namespace XINE { | |||
180 | bool m_video:1; | 180 | bool m_video:1; |
181 | XineVideoWidget *m_wid; | 181 | XineVideoWidget *m_wid; |
182 | xine_t *m_xine; | 182 | xine_t *m_xine; |
183 | xine_stream_t *m_stream; | ||
183 | xine_cfg_entry_t *m_config; | 184 | xine_cfg_entry_t *m_config; |
184 | xine_vo_driver_t *m_videoOutput; | 185 | xine_vo_driver_t *m_videoOutput; |
185 | xine_ao_driver_t* m_audioOutput; | 186 | xine_ao_driver_t* m_audioOutput; |
187 | xine_event_queue_t *m_queue; | ||
186 | 188 | ||
187 | void handleXineEvent( xine_event_t* t ); | 189 | void handleXineEvent( const xine_event_t* t ); |
188 | void drawFrame( uint8_t* frame, int width, int height, int bytes ); | 190 | void drawFrame( uint8_t* frame, int width, int height, int bytes ); |
189 | // C -> C++ bridge for the event system | 191 | // C -> C++ bridge for the event system |
190 | static void xine_event_handler( void* user_data, xine_event_t* t); | 192 | static void xine_event_handler( void* user_data, const xine_event_t* t); |
191 | static void xine_display_frame( void* user_data, uint8_t* frame , | 193 | static void xine_display_frame( void* user_data, uint8_t* frame , |
192 | int width, int height, int bytes ); | 194 | int width, int height, int bytes ); |
193 | }; | 195 | }; |