author | alwin <alwin> | 2005-04-09 21:37:02 (UTC) |
---|---|---|
committer | alwin <alwin> | 2005-04-09 21:37:02 (UTC) |
commit | 274690da3f91a808b77a7b9bf98b6bc09a302fc9 (patch) (unidiff) | |
tree | 7f87991f04a8ad41f2178871f75ba1c2466217c8 | |
parent | af5f26910ae74bd5446db73fd9c870d4aad94f52 (diff) | |
download | opie-274690da3f91a808b77a7b9bf98b6bc09a302fc9.zip opie-274690da3f91a808b77a7b9bf98b6bc09a302fc9.tar.gz opie-274690da3f91a808b77a7b9bf98b6bc09a302fc9.tar.bz2 |
cleanup audio/videooutput the right way
-rw-r--r-- | noncore/multimedia/opieplayer2/lib.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/noncore/multimedia/opieplayer2/lib.cpp b/noncore/multimedia/opieplayer2/lib.cpp index 6ed4cea..9f0d448 100644 --- a/noncore/multimedia/opieplayer2/lib.cpp +++ b/noncore/multimedia/opieplayer2/lib.cpp | |||
@@ -1,348 +1,350 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the Opie Project | 2 | This file is part of the Opie Project |
3 | 3 | ||
4 | Copyright (c) 2002 Max Reiss <harlekin@handhelds.org> | 4 | Copyright (c) 2002 Max Reiss <harlekin@handhelds.org> |
5 | Copyright (c) 2002 LJP <> | 5 | Copyright (c) 2002 LJP <> |
6 | Copyright (c) 2002 Holger Freyther <zecke@handhelds.org> | 6 | Copyright (c) 2002 Holger Freyther <zecke@handhelds.org> |
7 | =. | 7 | =. |
8 | .=l. | 8 | .=l. |
9 | .>+-= | 9 | .>+-= |
10 | _;:, .> :=|. This program is free software; you can | 10 | _;:, .> :=|. This program is free software; you can |
11 | .> <`_, > . <= redistribute it and/or modify it under | 11 | .> <`_, > . <= redistribute it and/or modify it under |
12 | :`=1 )Y*s>-.-- : the terms of the GNU General Public | 12 | :`=1 )Y*s>-.-- : the terms of the GNU General Public |
13 | .="- .-=="i, .._ License as published by the Free Software | 13 | .="- .-=="i, .._ License as published by the Free Software |
14 | - . .-<_> .<> Foundation; either version 2 of the License, | 14 | - . .-<_> .<> Foundation; either version 2 of the License, |
15 | ._= =} : or (at your option) any later version. | 15 | ._= =} : or (at your option) any later version. |
16 | .%`+i> _;_. | 16 | .%`+i> _;_. |
17 | .i_,=:_. -<s. This program is distributed in the hope that | 17 | .i_,=:_. -<s. This program is distributed in the hope that |
18 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 18 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
19 | : .. .:, . . . without even the implied warranty of | 19 | : .. .:, . . . without even the implied warranty of |
20 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 20 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
21 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 21 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
22 | ..}^=.= = ; Library General Public License for more | 22 | ..}^=.= = ; Library General Public License for more |
23 | ++= -. .` .: details. | 23 | ++= -. .` .: details. |
24 | : = ...= . :.=- | 24 | : = ...= . :.=- |
25 | -. .:....=;==+<; You should have received a copy of the GNU | 25 | -. .:....=;==+<; You should have received a copy of the GNU |
26 | -_. . . )=. = Library General Public License along with | 26 | -_. . . )=. = Library General Public License along with |
27 | -- :-=` this library; see the file COPYING.LIB. | 27 | -- :-=` this library; see the file COPYING.LIB. |
28 | If not, write to the Free Software Foundation, | 28 | If not, write to the Free Software Foundation, |
29 | Inc., 59 Temple Place - Suite 330, | 29 | Inc., 59 Temple Place - Suite 330, |
30 | Boston, MA 02111-1307, USA. | 30 | Boston, MA 02111-1307, USA. |
31 | 31 | ||
32 | */ | 32 | */ |
33 | 33 | ||
34 | #include "xinevideowidget.h" | 34 | #include "xinevideowidget.h" |
35 | #include "frame.h" | 35 | #include "frame.h" |
36 | #include "lib.h" | 36 | #include "lib.h" |
37 | 37 | ||
38 | /* OPIE */ | 38 | /* OPIE */ |
39 | #include <opie2/odebug.h> | 39 | #include <opie2/odebug.h> |
40 | #include <qpe/global.h> | 40 | #include <qpe/global.h> |
41 | 41 | ||
42 | /* QT */ | 42 | /* QT */ |
43 | #include <qtextstream.h> | 43 | #include <qtextstream.h> |
44 | #include <qdir.h> | 44 | #include <qdir.h> |
45 | #include <qgfx_qws.h> | 45 | #include <qgfx_qws.h> |
46 | 46 | ||
47 | /* STD */ | 47 | /* STD */ |
48 | #include <assert.h> | 48 | #include <assert.h> |
49 | #include <unistd.h> | 49 | #include <unistd.h> |
50 | 50 | ||
51 | typedef void (*display_xine_frame_t) (void *user_data, uint8_t* frame, | 51 | typedef void (*display_xine_frame_t) (void *user_data, uint8_t* frame, |
52 | int width, int height,int bytes ); | 52 | int width, int height,int bytes ); |
53 | 53 | ||
54 | extern "C" { | 54 | extern "C" { |
55 | xine_vo_driver_t* init_video_out_plugin( xine_t *xine, void* video, display_xine_frame_t, void * ); | 55 | xine_vo_driver_t* init_video_out_plugin( xine_t *xine, void* video, display_xine_frame_t, void * ); |
56 | int null_is_showing_video( const xine_vo_driver_t* self ); | 56 | int null_is_showing_video( const xine_vo_driver_t* self ); |
57 | void null_set_show_video( const xine_vo_driver_t* self, int show ); | 57 | void null_set_show_video( const xine_vo_driver_t* self, int show ); |
58 | int null_is_fullscreen( const xine_vo_driver_t* self ); | 58 | int null_is_fullscreen( const xine_vo_driver_t* self ); |
59 | void null_set_fullscreen( const xine_vo_driver_t* self, int screen ); | 59 | void null_set_fullscreen( const xine_vo_driver_t* self, int screen ); |
60 | int null_is_scaling( const xine_vo_driver_t* self ); | 60 | int null_is_scaling( const xine_vo_driver_t* self ); |
61 | void null_set_scaling( const xine_vo_driver_t* self, int scale ); | 61 | void null_set_scaling( const xine_vo_driver_t* self, int scale ); |
62 | void null_set_gui_width( const xine_vo_driver_t* self, int width ); | 62 | void null_set_gui_width( const xine_vo_driver_t* self, int width ); |
63 | void null_set_gui_height( const xine_vo_driver_t* self, int height ); | 63 | void null_set_gui_height( const xine_vo_driver_t* self, int height ); |
64 | void null_set_mode( const xine_vo_driver_t* self, int depth, int rgb ); | 64 | void null_set_mode( const xine_vo_driver_t* self, int depth, int rgb ); |
65 | void null_set_videoGamma( const xine_vo_driver_t* self , int value ); | 65 | void null_set_videoGamma( const xine_vo_driver_t* self , int value ); |
66 | void null_display_handler( const xine_vo_driver_t* self, display_xine_frame_t t, void* user_data ); | 66 | void null_display_handler( const xine_vo_driver_t* self, display_xine_frame_t t, void* user_data ); |
67 | 67 | ||
68 | void null_preload_decoders( xine_stream_t *stream ); | 68 | void null_preload_decoders( xine_stream_t *stream ); |
69 | } | 69 | } |
70 | 70 | ||
71 | using namespace XINE; | 71 | using namespace XINE; |
72 | 72 | ||
73 | Lib::Lib( InitializationMode initMode, XineVideoWidget* widget ) | 73 | Lib::Lib( InitializationMode initMode, XineVideoWidget* widget ) |
74 | { | 74 | { |
75 | m_initialized = false; | 75 | m_initialized = false; |
76 | m_duringInitialization = false; | 76 | m_duringInitialization = false; |
77 | m_video = false; | 77 | m_video = false; |
78 | m_wid = widget; | 78 | m_wid = widget; |
79 | printf("Lib"); | 79 | printf("Lib"); |
80 | QString configPath = QDir::homeDirPath() + "/Settings/opiexine.cf"; | 80 | QString configPath = QDir::homeDirPath() + "/Settings/opiexine.cf"; |
81 | // get the configuration | 81 | // get the configuration |
82 | 82 | ||
83 | // not really OO, should be an extra class, later | 83 | // not really OO, should be an extra class, later |
84 | if ( !QFile::exists(configPath) ) { | 84 | if ( !QFile::exists(configPath) ) { |
85 | QFile f(configPath); | 85 | QFile f(configPath); |
86 | f.open(IO_WriteOnly); | 86 | f.open(IO_WriteOnly); |
87 | QTextStream ts( &f ); | 87 | QTextStream ts( &f ); |
88 | ts << "misc.memcpy_method:glibc\n"; | 88 | ts << "misc.memcpy_method:glibc\n"; |
89 | ts << "# uncomment if you experience double speed audio \n #audio.oss_sync_method:softsync\n"; | 89 | ts << "# uncomment if you experience double speed audio \n #audio.oss_sync_method:softsync\n"; |
90 | ts << "codec.ffmpeg_pp_quality:3\n"; | 90 | ts << "codec.ffmpeg_pp_quality:3\n"; |
91 | ts << "audio.num_buffers:50\n"; | 91 | ts << "audio.num_buffers:50\n"; |
92 | ts << "audio.size_buffers:4096\n"; | 92 | ts << "audio.size_buffers:4096\n"; |
93 | ts << "video.num_buffers:20\n"; | 93 | ts << "video.num_buffers:20\n"; |
94 | ts << "video.size_buffers:4096\n"; | 94 | ts << "video.size_buffers:4096\n"; |
95 | ts << "audio.out_num_audio_buf:16\n"; | 95 | ts << "audio.out_num_audio_buf:16\n"; |
96 | ts << "audio.out_size_audio_buf:8096\n"; | 96 | ts << "audio.out_size_audio_buf:8096\n"; |
97 | ts << "audio.out_size_zero_buf:1024\n"; | 97 | ts << "audio.out_size_zero_buf:1024\n"; |
98 | ts << "audio.passthrough_offset:0\n"; | 98 | ts << "audio.passthrough_offset:0\n"; |
99 | f.close(); | 99 | f.close(); |
100 | } | 100 | } |
101 | 101 | ||
102 | if ( initMode == InitializeImmediately ) { | 102 | if ( initMode == InitializeImmediately ) { |
103 | initialize(); | 103 | initialize(); |
104 | m_initialized = true; | 104 | m_initialized = true; |
105 | } | 105 | } |
106 | else | 106 | else |
107 | start(); | 107 | start(); |
108 | } | 108 | } |
109 | 109 | ||
110 | void Lib::run() | 110 | void Lib::run() |
111 | { | 111 | { |
112 | odebug << "Lib::run() started" << oendl; | 112 | odebug << "Lib::run() started" << oendl; |
113 | initialize(); | 113 | initialize(); |
114 | m_initialized = true; | 114 | m_initialized = true; |
115 | odebug << "Lib::run() finished" << oendl; | 115 | odebug << "Lib::run() finished" << oendl; |
116 | } | 116 | } |
117 | 117 | ||
118 | void Lib::initialize() | 118 | void Lib::initialize() |
119 | { | 119 | { |
120 | m_duringInitialization = true; | 120 | m_duringInitialization = true; |
121 | m_xine = xine_new( ); | 121 | m_xine = xine_new( ); |
122 | 122 | ||
123 | QString configPath = QDir::homeDirPath() + "/Settings/opiexine.cf"; | 123 | QString configPath = QDir::homeDirPath() + "/Settings/opiexine.cf"; |
124 | xine_config_load( m_xine, QFile::encodeName( configPath ) ); | 124 | xine_config_load( m_xine, QFile::encodeName( configPath ) ); |
125 | 125 | ||
126 | xine_init( m_xine ); | 126 | xine_init( m_xine ); |
127 | 127 | ||
128 | // allocate oss for sound | 128 | // allocate oss for sound |
129 | // and fb for framebuffer | 129 | // and fb for framebuffer |
130 | m_audioOutput = xine_open_audio_driver( m_xine, "oss", NULL ); | 130 | m_audioOutput = xine_open_audio_driver( m_xine, "oss", NULL ); |
131 | m_videoOutput = ::init_video_out_plugin( m_xine, NULL, xine_display_frame, this ); | 131 | m_videoOutput = ::init_video_out_plugin( m_xine, NULL, xine_display_frame, this ); |
132 | 132 | ||
133 | m_stream = xine_stream_new (m_xine, m_audioOutput, m_videoOutput ); | 133 | m_stream = xine_stream_new (m_xine, m_audioOutput, m_videoOutput ); |
134 | xine_set_param( m_stream, XINE_PARAM_AUDIO_CLOSE_DEVICE, 1); | 134 | xine_set_param( m_stream, XINE_PARAM_AUDIO_CLOSE_DEVICE, 1); |
135 | 135 | ||
136 | if (m_wid != 0 ) | 136 | if (m_wid != 0 ) |
137 | setWidget( m_wid ); | 137 | setWidget( m_wid ); |
138 | 138 | ||
139 | 139 | ||
140 | m_queue = xine_event_new_queue (m_stream); | 140 | m_queue = xine_event_new_queue (m_stream); |
141 | xine_event_create_listener_thread (m_queue, xine_event_handler, this); | 141 | xine_event_create_listener_thread (m_queue, xine_event_handler, this); |
142 | 142 | ||
143 | ::null_preload_decoders( m_stream ); | 143 | ::null_preload_decoders( m_stream ); |
144 | 144 | ||
145 | m_duringInitialization = false; | 145 | m_duringInitialization = false; |
146 | } | 146 | } |
147 | 147 | ||
148 | Lib::~Lib() { | 148 | Lib::~Lib() { |
149 | assert( isRunning() == false ); | 149 | assert( isRunning() == false ); |
150 | assert( m_initialized ); | 150 | assert( m_initialized ); |
151 | 151 | ||
152 | // free( m_config ); | 152 | // free( m_config ); |
153 | 153 | ||
154 | xine_close( m_stream ); | 154 | xine_close( m_stream ); |
155 | xine_event_dispose_queue( m_queue ); | 155 | xine_event_dispose_queue( m_queue ); |
156 | xine_dispose( m_stream ); | 156 | xine_dispose( m_stream ); |
157 | xine_close_audio_driver(m_xine,m_audioOutput); | ||
158 | xine_close_video_driver(m_xine,m_videoOutput); | ||
157 | xine_exit( m_xine ); | 159 | xine_exit( m_xine ); |
158 | 160 | ||
159 | /* FIXME either free or delete but valgrind bitches against both */ | 161 | /* FIXME either free or delete but valgrind bitches against both */ |
160 | //free( m_videoOutput ); | 162 | //free( m_videoOutput ); |
161 | //delete m_audioOutput; | 163 | //delete m_audioOutput; |
162 | } | 164 | } |
163 | 165 | ||
164 | void Lib::resize ( const QSize &s ) { | 166 | void Lib::resize ( const QSize &s ) { |
165 | assert( m_initialized || m_duringInitialization ); | 167 | assert( m_initialized || m_duringInitialization ); |
166 | 168 | ||
167 | if ( s. width ( ) && s. height ( ) ) { | 169 | if ( s. width ( ) && s. height ( ) ) { |
168 | ::null_set_gui_width( m_videoOutput, s. width() ); | 170 | ::null_set_gui_width( m_videoOutput, s. width() ); |
169 | ::null_set_gui_height( m_videoOutput, s. height() ); | 171 | ::null_set_gui_height( m_videoOutput, s. height() ); |
170 | } | 172 | } |
171 | } | 173 | } |
172 | 174 | ||
173 | int Lib::majorVersion() { | 175 | int Lib::majorVersion() { |
174 | int major, minor, sub; | 176 | int major, minor, sub; |
175 | xine_get_version ( &major, &minor, &sub ); | 177 | xine_get_version ( &major, &minor, &sub ); |
176 | return major; | 178 | return major; |
177 | } | 179 | } |
178 | 180 | ||
179 | int Lib::minorVersion() { | 181 | int Lib::minorVersion() { |
180 | int major, minor, sub; | 182 | int major, minor, sub; |
181 | xine_get_version ( &major, &minor, &sub ); | 183 | xine_get_version ( &major, &minor, &sub ); |
182 | return minor; | 184 | return minor; |
183 | } | 185 | } |
184 | 186 | ||
185 | int Lib::subVersion() { | 187 | int Lib::subVersion() { |
186 | int major, minor, sub; | 188 | int major, minor, sub; |
187 | xine_get_version ( &major, &minor, &sub ); | 189 | xine_get_version ( &major, &minor, &sub ); |
188 | return sub; | 190 | return sub; |
189 | } | 191 | } |
190 | 192 | ||
191 | int Lib::play( const QString& fileName, int startPos, int start_time ) { | 193 | int Lib::play( const QString& fileName, int startPos, int start_time ) { |
192 | assert( m_initialized ); | 194 | assert( m_initialized ); |
193 | 195 | ||
194 | QString str = fileName.stripWhiteSpace(); | 196 | QString str = fileName.stripWhiteSpace(); |
195 | 197 | ||
196 | 198 | ||
197 | if ( !xine_open( m_stream, str.utf8().data() ) ) { | 199 | if ( !xine_open( m_stream, str.utf8().data() ) ) { |
198 | return 0; | 200 | return 0; |
199 | } | 201 | } |
200 | return xine_play( m_stream, startPos, start_time); | 202 | return xine_play( m_stream, startPos, start_time); |
201 | } | 203 | } |
202 | 204 | ||
203 | void Lib::stop() { | 205 | void Lib::stop() { |
204 | assert( m_initialized ); | 206 | assert( m_initialized ); |
205 | xine_stop( m_stream ); | 207 | xine_stop( m_stream ); |
206 | xine_set_param( m_stream, XINE_PARAM_AUDIO_CLOSE_DEVICE, 1); | 208 | xine_set_param( m_stream, XINE_PARAM_AUDIO_CLOSE_DEVICE, 1); |
207 | } | 209 | } |
208 | 210 | ||
209 | void Lib::pause( bool toggle ) { | 211 | void Lib::pause( bool toggle ) { |
210 | assert( m_initialized ); | 212 | assert( m_initialized ); |
211 | 213 | ||
212 | if ( toggle ) { | 214 | if ( toggle ) { |
213 | xine_set_param( m_stream, XINE_PARAM_SPEED, XINE_SPEED_PAUSE ); | 215 | xine_set_param( m_stream, XINE_PARAM_SPEED, XINE_SPEED_PAUSE ); |
214 | xine_set_param( m_stream, XINE_PARAM_AUDIO_CLOSE_DEVICE, 1); | 216 | xine_set_param( m_stream, XINE_PARAM_AUDIO_CLOSE_DEVICE, 1); |
215 | } | 217 | } |
216 | 218 | ||
217 | else { | 219 | else { |
218 | xine_set_param( m_stream, XINE_PARAM_SPEED, XINE_SPEED_NORMAL ); | 220 | xine_set_param( m_stream, XINE_PARAM_SPEED, XINE_SPEED_NORMAL ); |
219 | } | 221 | } |
220 | } | 222 | } |
221 | 223 | ||
222 | int Lib::speed() const { | 224 | int Lib::speed() const { |
223 | assert( m_initialized ); | 225 | assert( m_initialized ); |
224 | 226 | ||
225 | return xine_get_param ( m_stream, XINE_PARAM_SPEED ); | 227 | return xine_get_param ( m_stream, XINE_PARAM_SPEED ); |
226 | } | 228 | } |
227 | 229 | ||
228 | void Lib::setSpeed( int speed ) { | 230 | void Lib::setSpeed( int speed ) { |
229 | assert( m_initialized ); | 231 | assert( m_initialized ); |
230 | 232 | ||
231 | xine_set_param ( m_stream, XINE_PARAM_SPEED, speed ); | 233 | xine_set_param ( m_stream, XINE_PARAM_SPEED, speed ); |
232 | } | 234 | } |
233 | 235 | ||
234 | int Lib::status() const { | 236 | int Lib::status() const { |
235 | assert( m_initialized ); | 237 | assert( m_initialized ); |
236 | 238 | ||
237 | return xine_get_status( m_stream ); | 239 | return xine_get_status( m_stream ); |
238 | } | 240 | } |
239 | 241 | ||
240 | int Lib::currentPosition() const { | 242 | int Lib::currentPosition() const { |
241 | assert( m_initialized ); | 243 | assert( m_initialized ); |
242 | 244 | ||
243 | int pos, time, length; | 245 | int pos, time, length; |
244 | xine_get_pos_length( m_stream, &pos, &time, &length ); | 246 | xine_get_pos_length( m_stream, &pos, &time, &length ); |
245 | return pos; | 247 | return pos; |
246 | } | 248 | } |
247 | 249 | ||
248 | int Lib::currentTime() const { | 250 | int Lib::currentTime() const { |
249 | assert( m_initialized ); | 251 | assert( m_initialized ); |
250 | 252 | ||
251 | int pos, time, length; | 253 | int pos, time, length; |
252 | pos = time = length = 0; | 254 | pos = time = length = 0; |
253 | 255 | ||
254 | if ( xine_get_pos_length( m_stream, &pos, &time, &length ) ) | 256 | if ( xine_get_pos_length( m_stream, &pos, &time, &length ) ) |
255 | return time/1000; | 257 | return time/1000; |
256 | else | 258 | else |
257 | return 0; | 259 | return 0; |
258 | } | 260 | } |
259 | 261 | ||
260 | int Lib::length() const { | 262 | int Lib::length() const { |
261 | assert( m_initialized ); | 263 | assert( m_initialized ); |
262 | 264 | ||
263 | int pos, time, length; | 265 | int pos, time, length; |
264 | /* dilb: patch to solve the wrong stream length reported to the GUI*/ | 266 | /* dilb: patch to solve the wrong stream length reported to the GUI*/ |
265 | int iRetVal=0, iTestLoop=0; | 267 | int iRetVal=0, iTestLoop=0; |
266 | 268 | ||
267 | do | 269 | do |
268 | { | 270 | { |
269 | iRetVal = xine_get_pos_length( m_stream, &pos, &time, &length ); | 271 | iRetVal = xine_get_pos_length( m_stream, &pos, &time, &length ); |
270 | if (iRetVal) | 272 | if (iRetVal) |
271 | {/* if the function didn't return 0, then pos, time and length are valid.*/ | 273 | {/* if the function didn't return 0, then pos, time and length are valid.*/ |
272 | return length/1000; | 274 | return length/1000; |
273 | } | 275 | } |
274 | /*don't poll too much*/ | 276 | /*don't poll too much*/ |
275 | usleep(100000); | 277 | usleep(100000); |
276 | iTestLoop++; | 278 | iTestLoop++; |
277 | } | 279 | } |
278 | while ( iTestLoop < 10 ); /* if after 1s, we still don't have any | 280 | while ( iTestLoop < 10 ); /* if after 1s, we still don't have any |
279 | valid stream, then return -1 (this value could be used to make the stream | 281 | valid stream, then return -1 (this value could be used to make the stream |
280 | unseekable, but it should never occur!! Mr. Murphy ? :) ) */ | 282 | unseekable, but it should never occur!! Mr. Murphy ? :) ) */ |
281 | 283 | ||
282 | return -1; | 284 | return -1; |
283 | } | 285 | } |
284 | 286 | ||
285 | bool Lib::isSeekable() const { | 287 | bool Lib::isSeekable() const { |
286 | assert( m_initialized ); | 288 | assert( m_initialized ); |
287 | 289 | ||
288 | return xine_get_stream_info( m_stream, XINE_STREAM_INFO_SEEKABLE ); | 290 | return xine_get_stream_info( m_stream, XINE_STREAM_INFO_SEEKABLE ); |
289 | } | 291 | } |
290 | 292 | ||
291 | void Lib::seekTo( int time ) { | 293 | void Lib::seekTo( int time ) { |
292 | assert( m_initialized ); | 294 | assert( m_initialized ); |
293 | 295 | ||
294 | odebug << "Seeking to second " << time << oendl; | 296 | odebug << "Seeking to second " << time << oendl; |
295 | //Keep it paused if it was in that state | 297 | //Keep it paused if it was in that state |
296 | if ( xine_get_param( m_stream, XINE_PARAM_SPEED ) ) { | 298 | if ( xine_get_param( m_stream, XINE_PARAM_SPEED ) ) { |
297 | xine_play( m_stream, 0, time*1000 ); | 299 | xine_play( m_stream, 0, time*1000 ); |
298 | } | 300 | } |
299 | 301 | ||
300 | else { | 302 | else { |
301 | xine_play( m_stream, 0, time*1000 ); | 303 | xine_play( m_stream, 0, time*1000 ); |
302 | xine_set_param( m_stream, XINE_PARAM_SPEED, XINE_SPEED_PAUSE ); | 304 | xine_set_param( m_stream, XINE_PARAM_SPEED, XINE_SPEED_PAUSE ); |
303 | } | 305 | } |
304 | 306 | ||
305 | } | 307 | } |
306 | 308 | ||
307 | 309 | ||
308 | Frame Lib::currentFrame() const { | 310 | Frame Lib::currentFrame() const { |
309 | assert( m_initialized ); | 311 | assert( m_initialized ); |
310 | 312 | ||
311 | Frame frame; | 313 | Frame frame; |
312 | return frame; | 314 | return frame; |
313 | }; | 315 | }; |
314 | 316 | ||
315 | QString Lib::metaInfo( int number) const { | 317 | QString Lib::metaInfo( int number) const { |
316 | assert( m_initialized ); | 318 | assert( m_initialized ); |
317 | 319 | ||
318 | return xine_get_meta_info( m_stream, number ); | 320 | return xine_get_meta_info( m_stream, number ); |
319 | } | 321 | } |
320 | 322 | ||
321 | int Lib::error() const { | 323 | int Lib::error() const { |
322 | assert( m_initialized ); | 324 | assert( m_initialized ); |
323 | 325 | ||
324 | return xine_get_error( m_stream ); | 326 | return xine_get_error( m_stream ); |
325 | }; | 327 | }; |
326 | 328 | ||
327 | void Lib::ensureInitialized() | 329 | void Lib::ensureInitialized() |
328 | { | 330 | { |
329 | if ( m_initialized ) | 331 | if ( m_initialized ) |
330 | return; | 332 | return; |
331 | 333 | ||
332 | odebug << "waiting for initialization thread to finish" << oendl; | 334 | odebug << "waiting for initialization thread to finish" << oendl; |
333 | wait(); | 335 | wait(); |
334 | odebug << "initialization thread finished!" << oendl; | 336 | odebug << "initialization thread finished!" << oendl; |
335 | } | 337 | } |
336 | 338 | ||
337 | void Lib::setWidget( XineVideoWidget *widget ) | 339 | void Lib::setWidget( XineVideoWidget *widget ) |
338 | { | 340 | { |
339 | m_wid = widget; | 341 | m_wid = widget; |
340 | resize ( m_wid-> size ( ) ); | 342 | resize ( m_wid-> size ( ) ); |
341 | ::null_set_mode( m_videoOutput, qt_screen->depth(), qt_screen->pixelType() ); | 343 | ::null_set_mode( m_videoOutput, qt_screen->depth(), qt_screen->pixelType() ); |
342 | m_wid->repaint(); | 344 | m_wid->repaint(); |
343 | } | 345 | } |
344 | 346 | ||
345 | void Lib::receiveMessage( ThreadUtil::ChannelMessage *msg, SendType sendType ) | 347 | void Lib::receiveMessage( ThreadUtil::ChannelMessage *msg, SendType sendType ) |
346 | { | 348 | { |
347 | assert( sendType == ThreadUtil::Channel::OneWay ); | 349 | assert( sendType == ThreadUtil::Channel::OneWay ); |
348 | handleXineEvent( msg->type(), msg->data(), msg->msg() ); | 350 | handleXineEvent( msg->type(), msg->data(), msg->msg() ); |