summaryrefslogtreecommitdiff
path: root/noncore/multimedia
Unidiff
Diffstat (limited to 'noncore/multimedia') (more/less context) (show whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/lib.cpp59
-rw-r--r--noncore/multimedia/opieplayer2/lib.h6
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
@@ -84,39 +84,42 @@ Lib::Lib( XineVideoWidget* widget ) {
84 } 84 }
85 85
86 m_xine = xine_new( ); 86 m_xine = xine_new( );
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
93 m_audioOutput = xine_open_audio_driver( m_xine, "oss", NULL ); 94 m_audioOutput = xine_open_audio_driver( m_xine, "oss", NULL );
94 m_videoOutput = ::init_video_out_plugin( m_config, NULL ); 95 m_videoOutput = ::init_video_out_plugin( m_config, NULL );
95 96
96 97
97//xine_open_video_driver( m_xine, NULL, XINE_VISUAL_TYPE_FB, NULL); 98//xine_open_video_driver( m_xine, NULL, XINE_VISUAL_TYPE_FB, NULL);
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" );
105 resize ( m_wid-> size ( ) ); 107 resize ( m_wid-> size ( ) );
106 ::null_set_mode( m_videoOutput, qt_screen->depth(), qt_screen->pixelType() ); 108 ::null_set_mode( m_videoOutput, qt_screen->depth(), qt_screen->pixelType() );
107 109
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 );
120 //delete m_audioOutput; 123 //delete m_audioOutput;
121} 124}
122 125
@@ -147,79 +150,79 @@ int Lib::subVersion() {
147 xine_get_version ( &m_major_version, &m_minor_version, &m_sub_version ); 150 xine_get_version ( &m_major_version, &m_minor_version, &m_sub_version );
148 return m_sub_version; 151 return m_sub_version;
149} 152}
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
205Frame Lib::currentFrame() { 208Frame Lib::currentFrame() {
206 Frame frame; 209 Frame frame;
207 return frame; 210 return frame;
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}
223 226
224 227
225void Lib::setShowVideo( bool video ) { 228void Lib::setShowVideo( bool video ) {
@@ -229,23 +232,13 @@ void Lib::setShowVideo( bool video ) {
229 232
230bool Lib::isShowingVideo() { 233bool Lib::isShowingVideo() {
231 return ::null_is_showing_video( m_videoOutput ); 234 return ::null_is_showing_video( m_videoOutput );
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 ) {
249 ::null_set_fullscreen( m_videoOutput, fullScreen ); 242 ::null_set_fullscreen( m_videoOutput, fullScreen );
250} 243}
251 244
@@ -256,21 +249,21 @@ bool Lib::isVideoFullScreen() {
256void Lib::setScaling( bool scale ) { 249void Lib::setScaling( bool scale ) {
257 ::null_set_scaling( m_videoOutput, scale ); 250 ::null_set_scaling( m_videoOutput, 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
274void Lib::xine_display_frame( void* user_data, uint8_t *frame, 267void Lib::xine_display_frame( void* user_data, uint8_t *frame,
275 int width, int height, int bytes ) { 268 int width, int height, int bytes ) {
276 ( (Lib*)user_data)->drawFrame( frame, width, height, bytes ); 269 ( (Lib*)user_data)->drawFrame( frame, width, height, bytes );
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
@@ -177,20 +177,22 @@ namespace XINE {
177 int m_bytes_per_pixel; 177 int m_bytes_per_pixel;
178 int m_length, m_pos, m_time; 178 int m_length, m_pos, m_time;
179 int m_major_version, m_minor_version, m_sub_version; 179 int m_major_version, m_minor_version, m_sub_version;
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 };
194}; 196};
195 197
196 198