Diffstat (limited to 'noncore/multimedia/opieplayer2/lib.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/multimedia/opieplayer2/lib.cpp | 59 |
1 files changed, 46 insertions, 13 deletions
diff --git a/noncore/multimedia/opieplayer2/lib.cpp b/noncore/multimedia/opieplayer2/lib.cpp index d04af08..11ad745 100644 --- a/noncore/multimedia/opieplayer2/lib.cpp +++ b/noncore/multimedia/opieplayer2/lib.cpp | |||
@@ -33,9 +33,5 @@ | |||
33 | 33 | ||
34 | #include <stdio.h> | 34 | |
35 | #include <stdlib.h> | ||
36 | #include <qimage.h> | ||
37 | #include <qtextstream.h> | 35 | #include <qtextstream.h> |
38 | #include <qpe/resource.h> | ||
39 | 36 | ||
40 | #include <qfile.h> | ||
41 | #include <qdir.h> | 37 | #include <qdir.h> |
@@ -74,3 +70,3 @@ using namespace XINE; | |||
74 | 70 | ||
75 | Lib::Lib( InitializationMode initMode, XineVideoWidget* widget ) | 71 | Lib::Lib( InitializationMode initMode, XineVideoWidget* widget ) |
76 | { | 72 | { |
@@ -90,2 +86,12 @@ Lib::Lib( InitializationMode initMode, XineVideoWidget* widget ) | |||
90 | ts << "misc.memcpy_method:glibc\n"; | 86 | ts << "misc.memcpy_method:glibc\n"; |
87 | ts << "# uncomment if you experience double speed audio \n #audio.oss_sync_method:softsync\n"; | ||
88 | ts << "codec.ffmpeg_pp_quality:3\n"; | ||
89 | ts << "audio.num_buffers:50\n"; | ||
90 | ts << "audio.size_buffers:4160\n"; | ||
91 | ts << "video.num_buffers:20\n"; | ||
92 | ts << "video.size_buffers:4096\n"; | ||
93 | ts << "audio.out_num_audio_buf:16\n"; | ||
94 | ts << "audio.out_size_audio_buf:8096\n"; | ||
95 | ts << "audio.out_size_zero_buf:1024\n"; | ||
96 | ts << "audio.passthrough_offset:0\n"; | ||
91 | f.close(); | 97 | f.close(); |
@@ -141,3 +147,3 @@ void Lib::initialize() | |||
141 | 147 | ||
142 | ::null_preload_decoders( m_stream ); | 148 | ::null_preload_decoders( m_stream ); |
143 | 149 | ||
@@ -193,4 +199,12 @@ int Lib::play( const QString& fileName, int startPos, int start_time ) { | |||
193 | assert( m_initialized ); | 199 | assert( m_initialized ); |
200 | // FIXME actually a hack imho. Should not be needed to dispose the whole stream | ||
201 | // but without we get wrong media length reads from libxine for the second media | ||
202 | //xine_dispose ( m_stream ); | ||
194 | 203 | ||
195 | QString str = fileName.stripWhiteSpace(); | 204 | QString str = fileName.stripWhiteSpace(); |
205 | |||
206 | //m_stream = xine_stream_new (m_xine, m_audioOutput, m_videoOutput ); | ||
207 | //m_queue = xine_event_new_queue (m_stream); | ||
208 | //xine_event_create_listener_thread (m_queue, xine_event_handler, this); | ||
209 | |||
196 | if ( !xine_open( m_stream, QFile::encodeName(str.utf8() ).data() ) ) { | 210 | if ( !xine_open( m_stream, QFile::encodeName(str.utf8() ).data() ) ) { |
@@ -245,3 +259,7 @@ int Lib::currentTime() const { | |||
245 | xine_get_pos_length( m_stream, &pos, &time, &length ); | 259 | xine_get_pos_length( m_stream, &pos, &time, &length ); |
246 | return time/1000; | 260 | if ( time > 0 ) { |
261 | return time/1000; | ||
262 | } else { | ||
263 | return 0; | ||
264 | } | ||
247 | } | 265 | } |
@@ -252,4 +270,21 @@ int Lib::length() const { | |||
252 | int pos, time, length; | 270 | int pos, time, length; |
253 | xine_get_pos_length( m_stream, &pos, &time, &length ); | 271 | /* dilb: patch to solve the wrong stream length reported to the GUI*/ |
254 | return length/1000; | 272 | int iRetVal=0, iTestLoop=0; |
273 | |||
274 | do | ||
275 | { | ||
276 | iRetVal = xine_get_pos_length( m_stream, &pos, &time, &length ); | ||
277 | if (iRetVal) | ||
278 | {/* if the function didn't return 0, then pos, time and length are valid.*/ | ||
279 | return length/1000; | ||
280 | } | ||
281 | /*don't poll too much*/ | ||
282 | usleep(100000); | ||
283 | iTestLoop++; | ||
284 | } | ||
285 | while ( iTestLoop < 10 ); /* if after 1s, we still don't have any | ||
286 | valid stream, then return -1 (this value could be used to make the stream | ||
287 | unseekable, but it should never occur!! Mr. Murphy ? :) ) */ | ||
288 | |||
289 | return -1; | ||
255 | } | 290 | } |
@@ -368,5 +403,3 @@ void Lib::setGamma( int value ) { | |||
368 | 403 | ||
369 | //qDebug( QString( "%1").arg(value) ); | 404 | ::null_set_videoGamma( m_videoOutput, value ); |
370 | /* int gammaValue = ( 100 + value ); */ | ||
371 | ::null_set_videoGamma( m_videoOutput, value ); | ||
372 | } | 405 | } |