summaryrefslogtreecommitdiff
authorharlekin <harlekin>2002-11-09 11:18:45 (UTC)
committer harlekin <harlekin>2002-11-09 11:18:45 (UTC)
commit29758bfcaabf75a3155e8af140c11ca9ed014c42 (patch) (unidiff)
treeea8a0ed7eaffe1517a61fb5ac8bc2491eaf59f77
parent84e685e0c2922899dcdd69cfc23ecbccbf855af4 (diff)
downloadopie-29758bfcaabf75a3155e8af140c11ca9ed014c42.zip
opie-29758bfcaabf75a3155e8af140c11ca9ed014c42.tar.gz
opie-29758bfcaabf75a3155e8af140c11ca9ed014c42.tar.bz2
adated to todays version of xine api
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/lib.cpp63
-rw-r--r--noncore/multimedia/opieplayer2/lib.h6
2 files changed, 32 insertions, 37 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
114Lib::~Lib() { 118Lib::~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
151int Lib::play( const QString& fileName, int startPos, int start_time ) { 154int 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
159void Lib::stop() { 162void 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
164void Lib::pause() { 167void 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
168int Lib::speed() { 171int 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
172void Lib::setSpeed( int speed ) { 175void 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
176int Lib::status() { 179int Lib::status() {
177 return xine_get_status( m_xine ); 180 return xine_get_status( m_stream );
178} 181}
179 182
180int Lib::currentPosition() { 183int 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
185int Lib::currentTime() { 188int 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
190int Lib::length() { 193int 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
195bool Lib::isSeekable() { 198bool 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
199void Lib::seekTo( int time ) { 202void 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
210QString Lib::metaInfo( int number) { 213QString 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
214int Lib::error() { 217int Lib::error() {
215 return xine_get_error( m_xine ); 218 return xine_get_error( m_stream );
216}; 219};
217 220
218void Lib::handleXineEvent( xine_event_t* t ) { 221void 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
234bool Lib::hasVideo() { 237bool 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
248void Lib::showVideoFullScreen( bool fullScreen ) { 241void Lib::showVideoFullScreen( bool fullScreen ) {
@@ -258,16 +251,16 @@ void Lib::setScaling( bool scale ) {
258} 251}
259 252
260void Lib::setGamma( int value ) { 253void 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
266bool Lib::isScaling() { 259bool Lib::isScaling() {
267 return ::null_is_scaling( m_videoOutput ); 260 return ::null_is_scaling( m_videoOutput );
268} 261}
269 262
270void Lib::xine_event_handler( void* user_data, xine_event_t* t ) { 263void 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 };