Diffstat (limited to 'noncore/multimedia/opieplayer2') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/multimedia/opieplayer2/lib.cpp | 30 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/om3u.cpp | 141 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/threadutil.cpp | 17 |
3 files changed, 94 insertions, 94 deletions
diff --git a/noncore/multimedia/opieplayer2/lib.cpp b/noncore/multimedia/opieplayer2/lib.cpp index 84d28ce..5f281b7 100644 --- a/noncore/multimedia/opieplayer2/lib.cpp +++ b/noncore/multimedia/opieplayer2/lib.cpp | |||
@@ -1,477 +1,479 @@ | |||
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 "lib.h" | 35 | #include "lib.h" |
36 | 36 | ||
37 | /* OPIE */ | 37 | /* OPIE */ |
38 | #include <opie2/odebug.h> | 38 | #include <opie2/odebug.h> |
39 | #include <qpe/global.h> | 39 | #include <qpe/global.h> |
40 | 40 | ||
41 | /* QT */ | 41 | /* QT */ |
42 | #include <qtextstream.h> | 42 | #include <qtextstream.h> |
43 | #include <qdir.h> | 43 | #include <qdir.h> |
44 | #include <qgfx_qws.h> | 44 | #include <qgfx_qws.h> |
45 | 45 | ||
46 | /* STD */ | 46 | /* STD */ |
47 | #include <assert.h> | 47 | #include <assert.h> |
48 | #include <unistd.h> | 48 | #include <unistd.h> |
49 | 49 | ||
50 | typedef void (*display_xine_frame_t) (void *user_data, uint8_t* frame, | 50 | typedef void (*display_xine_frame_t) (void *user_data, uint8_t* frame, |
51 | int width, int height,int bytes ); | 51 | int width, int height,int bytes ); |
52 | typedef void (*vo_scale_cb) (void*, int, int, double, | 52 | typedef void (*vo_scale_cb) (void*, int, int, double, |
53 | int*, int*, int*, int*, double*, int*, int* ); | 53 | int*, int*, int*, int*, double*, int*, int* ); |
54 | typedef void (*dest_size_cb) (void*, int, int, double, int*, int*, double*); | 54 | typedef void (*dest_size_cb) (void*, int, int, double, int*, int*, double*); |
55 | 55 | ||
56 | 56 | ||
57 | extern "C" { | 57 | extern "C" { |
58 | xine_vo_driver_t* init_video_out_plugin( xine_t *xine, void* video, display_xine_frame_t, void *, vo_scale_cb, dest_size_cb ); | 58 | xine_vo_driver_t* init_video_out_plugin( xine_t *xine, void* video, display_xine_frame_t, void *, vo_scale_cb, dest_size_cb ); |
59 | int null_is_showing_video( const xine_vo_driver_t* self ); | 59 | int null_is_showing_video( const xine_vo_driver_t* self ); |
60 | void null_set_show_video( const xine_vo_driver_t* self, int show ); | 60 | void null_set_show_video( const xine_vo_driver_t* self, int show ); |
61 | void null_set_mode( const xine_vo_driver_t* self, int depth, int rgb ); | 61 | void null_set_mode( const xine_vo_driver_t* self, int depth, int rgb ); |
62 | void null_display_handler( const xine_vo_driver_t* self, display_xine_frame_t t, void* user_data ); | 62 | void null_display_handler( const xine_vo_driver_t* self, display_xine_frame_t t, void* user_data ); |
63 | } | 63 | } |
64 | 64 | ||
65 | using namespace XINE; | 65 | using namespace XINE; |
66 | 66 | ||
67 | Lib::Lib( InitializationMode initMode, XineVideoWidget* widget ) | 67 | Lib::Lib( InitializationMode initMode, XineVideoWidget* widget ) |
68 | { | 68 | { |
69 | m_initialized = false; | 69 | m_initialized = false; |
70 | m_duringInitialization = false; | 70 | m_duringInitialization = false; |
71 | m_video = false; | 71 | m_video = false; |
72 | m_wid = widget; | 72 | m_wid = widget; |
73 | printf("Lib"); | 73 | printf("Lib"); |
74 | QString configPath = QDir::homeDirPath() + "/Settings/opiexine.cf"; | 74 | QString configPath = QDir::homeDirPath() + "/Settings/opiexine.cf"; |
75 | // get the configuration | 75 | // get the configuration |
76 | 76 | ||
77 | // not really OO, should be an extra class, later | 77 | // not really OO, should be an extra class, later |
78 | if ( !QFile::exists(configPath) ) { | 78 | if ( !QFile::exists(configPath) ) { |
79 | QFile f(configPath); | 79 | QFile f(configPath); |
80 | f.open(IO_WriteOnly); | 80 | if (f.open(IO_WriteOnly)) { |
81 | QTextStream ts( &f ); | 81 | QTextStream ts( &f ); |
82 | ts << "misc.memcpy_method:glibc\n"; | 82 | ts << "misc.memcpy_method:glibc\n"; |
83 | ts << "# uncomment if you experience double speed audio \n #audio.oss_sync_method:softsync\n"; | 83 | ts << "# uncomment if you experience double speed audio \n #audio.oss_sync_method:softsync\n"; |
84 | ts << "codec.ffmpeg_pp_quality:3\n"; | 84 | ts << "codec.ffmpeg_pp_quality:3\n"; |
85 | ts << "audio.num_buffers:50\n"; | 85 | ts << "audio.num_buffers:50\n"; |
86 | ts << "audio.size_buffers:4096\n"; | 86 | ts << "audio.size_buffers:4096\n"; |
87 | ts << "video.num_buffers:20\n"; | 87 | ts << "video.num_buffers:20\n"; |
88 | ts << "video.size_buffers:4096\n"; | 88 | ts << "video.size_buffers:4096\n"; |
89 | ts << "audio.out_num_audio_buf:16\n"; | 89 | ts << "audio.out_num_audio_buf:16\n"; |
90 | ts << "audio.out_size_audio_buf:8096\n"; | 90 | ts << "audio.out_size_audio_buf:8096\n"; |
91 | ts << "audio.out_size_zero_buf:1024\n"; | 91 | ts << "audio.out_size_zero_buf:1024\n"; |
92 | ts << "audio.passthrough_offset:0\n"; | 92 | ts << "audio.passthrough_offset:0\n"; |
93 | f.close(); | 93 | f.close(); |
94 | } else | ||
95 | owarn << "Failed to open " f.name() << oendl; | ||
94 | } | 96 | } |
95 | 97 | ||
96 | if ( initMode == InitializeImmediately ) { | 98 | if ( initMode == InitializeImmediately ) { |
97 | initialize(); | 99 | initialize(); |
98 | m_initialized = true; | 100 | m_initialized = true; |
99 | } | 101 | } |
100 | else | 102 | else |
101 | start(); | 103 | start(); |
102 | } | 104 | } |
103 | 105 | ||
104 | void Lib::run() | 106 | void Lib::run() |
105 | { | 107 | { |
106 | odebug << "Lib::run() started" << oendl; | 108 | odebug << "Lib::run() started" << oendl; |
107 | initialize(); | 109 | initialize(); |
108 | m_initialized = true; | 110 | m_initialized = true; |
109 | odebug << "Lib::run() finished" << oendl; | 111 | odebug << "Lib::run() finished" << oendl; |
110 | } | 112 | } |
111 | 113 | ||
112 | void Lib::initialize() | 114 | void Lib::initialize() |
113 | { | 115 | { |
114 | m_duringInitialization = true; | 116 | m_duringInitialization = true; |
115 | m_xine = xine_new( ); | 117 | m_xine = xine_new( ); |
116 | 118 | ||
117 | QString configPath = QDir::homeDirPath() + "/Settings/opiexine.cf"; | 119 | QString configPath = QDir::homeDirPath() + "/Settings/opiexine.cf"; |
118 | xine_config_load( m_xine, QFile::encodeName( configPath ) ); | 120 | xine_config_load( m_xine, QFile::encodeName( configPath ) ); |
119 | 121 | ||
120 | xine_init( m_xine ); | 122 | xine_init( m_xine ); |
121 | 123 | ||
122 | // allocate oss for sound | 124 | // allocate oss for sound |
123 | // and fb for framebuffer | 125 | // and fb for framebuffer |
124 | m_audioOutput = xine_open_audio_driver( m_xine, "oss", NULL ); | 126 | m_audioOutput = xine_open_audio_driver( m_xine, "oss", NULL ); |
125 | m_videoOutput = ::init_video_out_plugin( m_xine, NULL, | 127 | m_videoOutput = ::init_video_out_plugin( m_xine, NULL, |
126 | xine_display_frame, this, | 128 | xine_display_frame, this, |
127 | xine_vo_scale_cb, | 129 | xine_vo_scale_cb, |
128 | xine_dest_cb ); | 130 | xine_dest_cb ); |
129 | 131 | ||
130 | m_stream = xine_stream_new (m_xine, m_audioOutput, m_videoOutput ); | 132 | m_stream = xine_stream_new (m_xine, m_audioOutput, m_videoOutput ); |
131 | xine_set_param( m_stream, XINE_PARAM_AUDIO_CLOSE_DEVICE, 1); | 133 | xine_set_param( m_stream, XINE_PARAM_AUDIO_CLOSE_DEVICE, 1); |
132 | 134 | ||
133 | if (m_wid != 0 ) | 135 | if (m_wid != 0 ) |
134 | setWidget( m_wid ); | 136 | setWidget( m_wid ); |
135 | 137 | ||
136 | 138 | ||
137 | m_queue = xine_event_new_queue (m_stream); | 139 | m_queue = xine_event_new_queue (m_stream); |
138 | xine_event_create_listener_thread (m_queue, xine_event_handler, this); | 140 | xine_event_create_listener_thread (m_queue, xine_event_handler, this); |
139 | 141 | ||
140 | m_duringInitialization = false; | 142 | m_duringInitialization = false; |
141 | } | 143 | } |
142 | 144 | ||
143 | Lib::~Lib() { | 145 | Lib::~Lib() { |
144 | assert( isRunning() == false ); | 146 | assert( isRunning() == false ); |
145 | assert( m_initialized ); | 147 | assert( m_initialized ); |
146 | 148 | ||
147 | // free( m_config ); | 149 | // free( m_config ); |
148 | 150 | ||
149 | xine_close( m_stream ); | 151 | xine_close( m_stream ); |
150 | xine_event_dispose_queue( m_queue ); | 152 | xine_event_dispose_queue( m_queue ); |
151 | xine_dispose( m_stream ); | 153 | xine_dispose( m_stream ); |
152 | xine_close_audio_driver(m_xine,m_audioOutput); | 154 | xine_close_audio_driver(m_xine,m_audioOutput); |
153 | xine_close_video_driver(m_xine,m_videoOutput); | 155 | xine_close_video_driver(m_xine,m_videoOutput); |
154 | xine_exit( m_xine ); | 156 | xine_exit( m_xine ); |
155 | 157 | ||
156 | /* FIXME either free or delete but valgrind bitches against both */ | 158 | /* FIXME either free or delete but valgrind bitches against both */ |
157 | //free( m_videoOutput ); | 159 | //free( m_videoOutput ); |
158 | //delete m_audioOutput; | 160 | //delete m_audioOutput; |
159 | } | 161 | } |
160 | 162 | ||
161 | void Lib::resize ( const QSize &s ) { | 163 | void Lib::resize ( const QSize &s ) { |
162 | assert( m_initialized || m_duringInitialization ); | 164 | assert( m_initialized || m_duringInitialization ); |
163 | 165 | ||
164 | if ( s. width ( ) && s. height ( ) ) | 166 | if ( s. width ( ) && s. height ( ) ) |
165 | m_videoSize = s; | 167 | m_videoSize = s; |
166 | } | 168 | } |
167 | 169 | ||
168 | int Lib::majorVersion() { | 170 | int Lib::majorVersion() { |
169 | int major, minor, sub; | 171 | int major, minor, sub; |
170 | xine_get_version ( &major, &minor, &sub ); | 172 | xine_get_version ( &major, &minor, &sub ); |
171 | return major; | 173 | return major; |
172 | } | 174 | } |
173 | 175 | ||
174 | int Lib::minorVersion() { | 176 | int Lib::minorVersion() { |
175 | int major, minor, sub; | 177 | int major, minor, sub; |
176 | xine_get_version ( &major, &minor, &sub ); | 178 | xine_get_version ( &major, &minor, &sub ); |
177 | return minor; | 179 | return minor; |
178 | } | 180 | } |
179 | 181 | ||
180 | int Lib::subVersion() { | 182 | int Lib::subVersion() { |
181 | int major, minor, sub; | 183 | int major, minor, sub; |
182 | xine_get_version ( &major, &minor, &sub ); | 184 | xine_get_version ( &major, &minor, &sub ); |
183 | return sub; | 185 | return sub; |
184 | } | 186 | } |
185 | 187 | ||
186 | int Lib::setfile(const QString& fileName) | 188 | int Lib::setfile(const QString& fileName) |
187 | { | 189 | { |
188 | QString str = fileName.stripWhiteSpace(); | 190 | QString str = fileName.stripWhiteSpace(); |
189 | 191 | ||
190 | 192 | ||
191 | if ( !xine_open( m_stream, str.utf8().data() ) ) { | 193 | if ( !xine_open( m_stream, str.utf8().data() ) ) { |
192 | return 0; | 194 | return 0; |
193 | } | 195 | } |
194 | return 1; | 196 | return 1; |
195 | } | 197 | } |
196 | 198 | ||
197 | int Lib::play( const QString& fileName, int startPos, int start_time ) { | 199 | int Lib::play( const QString& fileName, int startPos, int start_time ) { |
198 | assert( m_initialized ); | 200 | assert( m_initialized ); |
199 | 201 | ||
200 | QString str = fileName.stripWhiteSpace(); | 202 | QString str = fileName.stripWhiteSpace(); |
201 | 203 | ||
202 | 204 | ||
203 | if ( !xine_open( m_stream, str.utf8().data() ) ) { | 205 | if ( !xine_open( m_stream, str.utf8().data() ) ) { |
204 | return 0; | 206 | return 0; |
205 | } | 207 | } |
206 | return xine_play( m_stream, startPos, start_time); | 208 | return xine_play( m_stream, startPos, start_time); |
207 | } | 209 | } |
208 | 210 | ||
209 | void Lib::stop() { | 211 | void Lib::stop() { |
210 | assert( m_initialized ); | 212 | assert( m_initialized ); |
211 | xine_stop( m_stream ); | 213 | xine_stop( m_stream ); |
212 | xine_set_param( m_stream, XINE_PARAM_AUDIO_CLOSE_DEVICE, 1); | 214 | xine_set_param( m_stream, XINE_PARAM_AUDIO_CLOSE_DEVICE, 1); |
213 | } | 215 | } |
214 | 216 | ||
215 | void Lib::pause( bool toggle ) { | 217 | void Lib::pause( bool toggle ) { |
216 | assert( m_initialized ); | 218 | assert( m_initialized ); |
217 | 219 | ||
218 | if ( toggle ) { | 220 | if ( toggle ) { |
219 | xine_set_param( m_stream, XINE_PARAM_SPEED, XINE_SPEED_PAUSE ); | 221 | xine_set_param( m_stream, XINE_PARAM_SPEED, XINE_SPEED_PAUSE ); |
220 | xine_set_param( m_stream, XINE_PARAM_AUDIO_CLOSE_DEVICE, 1); | 222 | xine_set_param( m_stream, XINE_PARAM_AUDIO_CLOSE_DEVICE, 1); |
221 | } | 223 | } |
222 | 224 | ||
223 | else { | 225 | else { |
224 | xine_set_param( m_stream, XINE_PARAM_SPEED, XINE_SPEED_NORMAL ); | 226 | xine_set_param( m_stream, XINE_PARAM_SPEED, XINE_SPEED_NORMAL ); |
225 | } | 227 | } |
226 | } | 228 | } |
227 | 229 | ||
228 | int Lib::speed() const { | 230 | int Lib::speed() const { |
229 | assert( m_initialized ); | 231 | assert( m_initialized ); |
230 | 232 | ||
231 | return xine_get_param ( m_stream, XINE_PARAM_SPEED ); | 233 | return xine_get_param ( m_stream, XINE_PARAM_SPEED ); |
232 | } | 234 | } |
233 | 235 | ||
234 | void Lib::setSpeed( int speed ) { | 236 | void Lib::setSpeed( int speed ) { |
235 | assert( m_initialized ); | 237 | assert( m_initialized ); |
236 | 238 | ||
237 | xine_set_param ( m_stream, XINE_PARAM_SPEED, speed ); | 239 | xine_set_param ( m_stream, XINE_PARAM_SPEED, speed ); |
238 | } | 240 | } |
239 | 241 | ||
240 | int Lib::status() const { | 242 | int Lib::status() const { |
241 | assert( m_initialized ); | 243 | assert( m_initialized ); |
242 | 244 | ||
243 | return xine_get_status( m_stream ); | 245 | return xine_get_status( m_stream ); |
244 | } | 246 | } |
245 | 247 | ||
246 | int Lib::currentPosition() const { | 248 | int Lib::currentPosition() const { |
247 | assert( m_initialized ); | 249 | assert( m_initialized ); |
248 | 250 | ||
249 | int pos, time, length; | 251 | int pos, time, length; |
250 | xine_get_pos_length( m_stream, &pos, &time, &length ); | 252 | xine_get_pos_length( m_stream, &pos, &time, &length ); |
251 | return pos; | 253 | return pos; |
252 | } | 254 | } |
253 | 255 | ||
254 | int Lib::currentTime() const { | 256 | int Lib::currentTime() const { |
255 | assert( m_initialized ); | 257 | assert( m_initialized ); |
256 | 258 | ||
257 | int pos, time, length; | 259 | int pos, time, length; |
258 | pos = time = length = 0; | 260 | pos = time = length = 0; |
259 | 261 | ||
260 | if ( xine_get_pos_length( m_stream, &pos, &time, &length ) ) | 262 | if ( xine_get_pos_length( m_stream, &pos, &time, &length ) ) |
261 | return time/1000; | 263 | return time/1000; |
262 | else | 264 | else |
263 | return 0; | 265 | return 0; |
264 | } | 266 | } |
265 | 267 | ||
266 | int Lib::length() const { | 268 | int Lib::length() const { |
267 | assert( m_initialized ); | 269 | assert( m_initialized ); |
268 | 270 | ||
269 | int pos, time, length; | 271 | int pos, time, length; |
270 | /* dilb: patch to solve the wrong stream length reported to the GUI*/ | 272 | /* dilb: patch to solve the wrong stream length reported to the GUI*/ |
271 | int iRetVal=0, iTestLoop=0; | 273 | int iRetVal=0, iTestLoop=0; |
272 | 274 | ||
273 | do | 275 | do |
274 | { | 276 | { |
275 | iRetVal = xine_get_pos_length( m_stream, &pos, &time, &length ); | 277 | iRetVal = xine_get_pos_length( m_stream, &pos, &time, &length ); |
276 | if (iRetVal) | 278 | if (iRetVal) |
277 | {/* if the function didn't return 0, then pos, time and length are valid.*/ | 279 | {/* if the function didn't return 0, then pos, time and length are valid.*/ |
278 | return length/1000; | 280 | return length/1000; |
279 | } | 281 | } |
280 | /*don't poll too much*/ | 282 | /*don't poll too much*/ |
281 | usleep(100000); | 283 | usleep(100000); |
282 | iTestLoop++; | 284 | iTestLoop++; |
283 | } | 285 | } |
284 | while ( iTestLoop < 10 ); /* if after 1s, we still don't have any | 286 | while ( iTestLoop < 10 ); /* if after 1s, we still don't have any |
285 | valid stream, then return -1 (this value could be used to make the stream | 287 | valid stream, then return -1 (this value could be used to make the stream |
286 | unseekable, but it should never occur!! Mr. Murphy ? :) ) */ | 288 | unseekable, but it should never occur!! Mr. Murphy ? :) ) */ |
287 | 289 | ||
288 | return -1; | 290 | return -1; |
289 | } | 291 | } |
290 | 292 | ||
291 | /* info about current stream */ | 293 | /* info about current stream */ |
292 | QSize Lib::videoSize()const | 294 | QSize Lib::videoSize()const |
293 | { | 295 | { |
294 | if (!m_initialized||!hasVideo()) return QSize(0,0); | 296 | if (!m_initialized||!hasVideo()) return QSize(0,0); |
295 | int width = xine_get_stream_info(m_stream,XINE_STREAM_INFO_VIDEO_WIDTH); | 297 | int width = xine_get_stream_info(m_stream,XINE_STREAM_INFO_VIDEO_WIDTH); |
296 | int height = xine_get_stream_info(m_stream,XINE_STREAM_INFO_VIDEO_HEIGHT); | 298 | int height = xine_get_stream_info(m_stream,XINE_STREAM_INFO_VIDEO_HEIGHT); |
297 | return QSize(width,height); | 299 | return QSize(width,height); |
298 | } | 300 | } |
299 | 301 | ||
300 | 302 | ||
301 | bool Lib::isSeekable() const { | 303 | bool Lib::isSeekable() const { |
302 | assert( m_initialized ); | 304 | assert( m_initialized ); |
303 | 305 | ||
304 | return xine_get_stream_info( m_stream, XINE_STREAM_INFO_SEEKABLE ); | 306 | return xine_get_stream_info( m_stream, XINE_STREAM_INFO_SEEKABLE ); |
305 | } | 307 | } |
306 | 308 | ||
307 | bool Lib::hasVideo() const { | 309 | bool Lib::hasVideo() const { |
308 | assert( m_initialized ); | 310 | assert( m_initialized ); |
309 | 311 | ||
310 | return xine_get_stream_info( m_stream, XINE_STREAM_INFO_HAS_VIDEO); | 312 | return xine_get_stream_info( m_stream, XINE_STREAM_INFO_HAS_VIDEO); |
311 | } | 313 | } |
312 | 314 | ||
313 | int Lib::audioBitrate()const | 315 | int Lib::audioBitrate()const |
314 | { | 316 | { |
315 | if (!m_initialized) return 0; | 317 | if (!m_initialized) return 0; |
316 | return xine_get_stream_info( m_stream, XINE_STREAM_INFO_AUDIO_BITRATE); | 318 | return xine_get_stream_info( m_stream, XINE_STREAM_INFO_AUDIO_BITRATE); |
317 | } | 319 | } |
318 | int Lib::videoBitrate()const | 320 | int Lib::videoBitrate()const |
319 | { | 321 | { |
320 | if (!m_initialized||!hasVideo()) return 0; | 322 | if (!m_initialized||!hasVideo()) return 0; |
321 | return xine_get_stream_info( m_stream, XINE_STREAM_INFO_VIDEO_BITRATE); | 323 | return xine_get_stream_info( m_stream, XINE_STREAM_INFO_VIDEO_BITRATE); |
322 | } | 324 | } |
323 | /* end info block */ | 325 | /* end info block */ |
324 | 326 | ||
325 | void Lib::seekTo( int time ) { | 327 | void Lib::seekTo( int time ) { |
326 | assert( m_initialized ); | 328 | assert( m_initialized ); |
327 | 329 | ||
328 | odebug << "Seeking to second " << time << oendl; | 330 | odebug << "Seeking to second " << time << oendl; |
329 | //Keep it paused if it was in that state | 331 | //Keep it paused if it was in that state |
330 | if ( xine_get_param( m_stream, XINE_PARAM_SPEED ) ) { | 332 | if ( xine_get_param( m_stream, XINE_PARAM_SPEED ) ) { |
331 | xine_play( m_stream, 0, time*1000 ); | 333 | xine_play( m_stream, 0, time*1000 ); |
332 | } | 334 | } |
333 | 335 | ||
334 | else { | 336 | else { |
335 | xine_play( m_stream, 0, time*1000 ); | 337 | xine_play( m_stream, 0, time*1000 ); |
336 | xine_set_param( m_stream, XINE_PARAM_SPEED, XINE_SPEED_PAUSE ); | 338 | xine_set_param( m_stream, XINE_PARAM_SPEED, XINE_SPEED_PAUSE ); |
337 | } | 339 | } |
338 | 340 | ||
339 | } | 341 | } |
340 | 342 | ||
341 | 343 | ||
342 | QString Lib::metaInfo( int number) const { | 344 | QString Lib::metaInfo( int number) const { |
343 | assert( m_initialized ); | 345 | assert( m_initialized ); |
344 | 346 | ||
345 | return xine_get_meta_info( m_stream, number ); | 347 | return xine_get_meta_info( m_stream, number ); |
346 | } | 348 | } |
347 | 349 | ||
348 | int Lib::error() const { | 350 | int Lib::error() const { |
349 | assert( m_initialized ); | 351 | assert( m_initialized ); |
350 | 352 | ||
351 | return xine_get_error( m_stream ); | 353 | return xine_get_error( m_stream ); |
352 | }; | 354 | }; |
353 | 355 | ||
354 | void Lib::ensureInitialized() | 356 | void Lib::ensureInitialized() |
355 | { | 357 | { |
356 | if ( m_initialized ) | 358 | if ( m_initialized ) |
357 | return; | 359 | return; |
358 | 360 | ||
359 | odebug << "waiting for initialization thread to finish" << oendl; | 361 | odebug << "waiting for initialization thread to finish" << oendl; |
360 | wait(); | 362 | wait(); |
361 | odebug << "initialization thread finished!" << oendl; | 363 | odebug << "initialization thread finished!" << oendl; |
362 | } | 364 | } |
363 | 365 | ||
364 | void Lib::setWidget( XineVideoWidget *widget ) | 366 | void Lib::setWidget( XineVideoWidget *widget ) |
365 | { | 367 | { |
366 | m_wid = widget; | 368 | m_wid = widget; |
367 | if (m_wid) { | 369 | if (m_wid) { |
368 | resize ( m_wid-> size ( ) ); | 370 | resize ( m_wid-> size ( ) ); |
369 | ::null_set_mode( m_videoOutput, qt_screen->depth(), qt_screen->pixelType() ); | 371 | ::null_set_mode( m_videoOutput, qt_screen->depth(), qt_screen->pixelType() ); |
370 | } | 372 | } |
371 | } | 373 | } |
372 | 374 | ||
373 | void Lib::receiveMessage( ThreadUtil::ChannelMessage *msg, SendType sendType ) | 375 | void Lib::receiveMessage( ThreadUtil::ChannelMessage *msg, SendType sendType ) |
374 | { | 376 | { |
375 | assert( sendType == ThreadUtil::Channel::OneWay ); | 377 | assert( sendType == ThreadUtil::Channel::OneWay ); |
376 | handleXineEvent( msg->type(), msg->data(), msg->msg() ); | 378 | handleXineEvent( msg->type(), msg->data(), msg->msg() ); |
377 | delete msg; | 379 | delete msg; |
378 | } | 380 | } |
379 | 381 | ||
380 | void Lib::handleXineEvent( const xine_event_t* t ) { | 382 | void Lib::handleXineEvent( const xine_event_t* t ) { |
381 | int prog = -1; const char* name = 0; | 383 | int prog = -1; const char* name = 0; |
382 | if ( t->type == XINE_EVENT_PROGRESS ) { | 384 | if ( t->type == XINE_EVENT_PROGRESS ) { |
383 | xine_progress_data_t *pt = static_cast<xine_progress_data_t*>( t->data ); | 385 | xine_progress_data_t *pt = static_cast<xine_progress_data_t*>( t->data ); |
384 | prog = pt->percent; | 386 | prog = pt->percent; |
385 | name = pt->description; | 387 | name = pt->description; |
386 | } | 388 | } |
387 | 389 | ||
388 | send( new ThreadUtil::ChannelMessage( t->type, prog, name ), OneWay ); | 390 | send( new ThreadUtil::ChannelMessage( t->type, prog, name ), OneWay ); |
389 | } | 391 | } |
390 | 392 | ||
391 | void Lib::handleXineEvent( int type, int data, const char* name ) { | 393 | void Lib::handleXineEvent( int type, int data, const char* name ) { |
392 | assert( m_initialized ); | 394 | assert( m_initialized ); |
393 | 395 | ||
394 | if ( type == XINE_EVENT_UI_PLAYBACK_FINISHED ) { | 396 | if ( type == XINE_EVENT_UI_PLAYBACK_FINISHED ) { |
395 | emit stopped(); | 397 | emit stopped(); |
396 | }else if ( type == XINE_EVENT_PROGRESS ) { | 398 | }else if ( type == XINE_EVENT_PROGRESS ) { |
397 | QString str = name == 0 ? QString::null : QString::fromUtf8( name ); | 399 | QString str = name == 0 ? QString::null : QString::fromUtf8( name ); |
398 | Global::statusMessage( tr( "Progress: %1 %2" ).arg( name, data ) );; | 400 | Global::statusMessage( tr( "Progress: %1 %2" ).arg( name, data ) );; |
399 | } | 401 | } |
400 | } | 402 | } |
401 | 403 | ||
402 | 404 | ||
403 | void Lib::setShowVideo( bool video ) { | 405 | void Lib::setShowVideo( bool video ) { |
404 | assert( m_initialized ); | 406 | assert( m_initialized ); |
405 | 407 | ||
406 | m_video = video; | 408 | m_video = video; |
407 | ::null_set_show_video( m_videoOutput, video ); | 409 | ::null_set_show_video( m_videoOutput, video ); |
408 | } | 410 | } |
409 | 411 | ||
410 | bool Lib::isShowingVideo() const { | 412 | bool Lib::isShowingVideo() const { |
411 | assert( m_initialized ); | 413 | assert( m_initialized ); |
412 | 414 | ||
413 | return ::null_is_showing_video( m_videoOutput ); | 415 | return ::null_is_showing_video( m_videoOutput ); |
414 | } | 416 | } |
415 | 417 | ||
416 | void Lib::showVideoFullScreen( bool fullScreen ) { | 418 | void Lib::showVideoFullScreen( bool fullScreen ) { |
417 | assert( m_initialized ); | 419 | assert( m_initialized ); |
418 | 420 | ||
419 | #warning use xine | 421 | #warning use xine |
420 | } | 422 | } |
421 | 423 | ||
422 | bool Lib::isVideoFullScreen() const { | 424 | bool Lib::isVideoFullScreen() const { |
423 | assert( m_initialized ); | 425 | assert( m_initialized ); |
424 | 426 | ||
425 | #warning use xine | 427 | #warning use xine |
426 | return false; | 428 | return false; |
427 | } | 429 | } |
428 | 430 | ||
429 | void Lib::setScaling( bool scale ) { | 431 | void Lib::setScaling( bool scale ) { |
430 | assert( m_initialized ); | 432 | assert( m_initialized ); |
431 | 433 | ||
432 | xine_set_param( m_stream, XINE_PARAM_VO_ASPECT_RATIO, | 434 | xine_set_param( m_stream, XINE_PARAM_VO_ASPECT_RATIO, |
433 | scale ? XINE_VO_ASPECT_AUTO : XINE_VO_ASPECT_SQUARE ); | 435 | scale ? XINE_VO_ASPECT_AUTO : XINE_VO_ASPECT_SQUARE ); |
434 | } | 436 | } |
435 | 437 | ||
436 | void Lib::setGamma( int value ) { | 438 | void Lib::setGamma( int value ) { |
437 | assert( m_initialized ); | 439 | assert( m_initialized ); |
438 | xine_set_param( m_stream, XINE_PARAM_VO_BRIGHTNESS, value ); | 440 | xine_set_param( m_stream, XINE_PARAM_VO_BRIGHTNESS, value ); |
439 | } | 441 | } |
440 | 442 | ||
441 | bool Lib::isScaling() const { | 443 | bool Lib::isScaling() const { |
442 | assert( m_initialized ); | 444 | assert( m_initialized ); |
443 | 445 | ||
444 | int aratio = xine_get_param( m_stream, XINE_PARAM_VO_ASPECT_RATIO ); | 446 | int aratio = xine_get_param( m_stream, XINE_PARAM_VO_ASPECT_RATIO ); |
445 | return aratio == XINE_VO_ASPECT_AUTO; | 447 | return aratio == XINE_VO_ASPECT_AUTO; |
446 | } | 448 | } |
447 | 449 | ||
448 | void Lib::xine_event_handler( void* user_data, const xine_event_t* t ) { | 450 | void Lib::xine_event_handler( void* user_data, const xine_event_t* t ) { |
449 | ( (Lib*)user_data)->handleXineEvent( t ); | 451 | ( (Lib*)user_data)->handleXineEvent( t ); |
450 | } | 452 | } |
451 | 453 | ||
452 | void Lib::xine_display_frame( void* user_data, uint8_t *frame, | 454 | void Lib::xine_display_frame( void* user_data, uint8_t *frame, |
453 | int width, int height, int bytes ) { | 455 | int width, int height, int bytes ) { |
454 | ( (Lib*)user_data)->drawFrame( frame, width, height, bytes ); | 456 | ( (Lib*)user_data)->drawFrame( frame, width, height, bytes ); |
455 | } | 457 | } |
456 | 458 | ||
457 | void Lib::xine_vo_scale_cb( void *user_data, int video_with, int video_height, | 459 | void Lib::xine_vo_scale_cb( void *user_data, int video_with, int video_height, |
458 | double video_pixel_aspect, | 460 | double video_pixel_aspect, |
459 | int *dest_x, int *dest_y, int *dest_width, | 461 | int *dest_x, int *dest_y, int *dest_width, |
460 | int *dest_height, double *dest_pixel_aspect, | 462 | int *dest_height, double *dest_pixel_aspect, |
461 | int *win_x, int *win_y ) { | 463 | int *win_x, int *win_y ) { |
462 | QSize size = ((Lib*)user_data)->m_videoSize; | 464 | QSize size = ((Lib*)user_data)->m_videoSize; |
463 | if (!size.isValid()) | 465 | if (!size.isValid()) |
464 | return; | 466 | return; |
465 | 467 | ||
466 | *dest_x = 0; | 468 | *dest_x = 0; |
467 | *dest_y = 0; | 469 | *dest_y = 0; |
468 | *dest_width = size.width(); | 470 | *dest_width = size.width(); |
469 | *dest_height = size.height(); | 471 | *dest_height = size.height(); |
470 | *win_x = 0; | 472 | *win_x = 0; |
471 | *win_y = 0; | 473 | *win_y = 0; |
472 | } | 474 | } |
473 | 475 | ||
474 | void Lib::xine_dest_cb( void* user_data, int, int, double, | 476 | void Lib::xine_dest_cb( void* user_data, int, int, double, |
475 | int *dest_width, int* dest_height, double* ) { | 477 | int *dest_width, int* dest_height, double* ) { |
476 | QSize size = ((Lib*)user_data)->m_videoSize; | 478 | QSize size = ((Lib*)user_data)->m_videoSize; |
477 | if ( !size.isValid() ) | 479 | if ( !size.isValid() ) |
diff --git a/noncore/multimedia/opieplayer2/om3u.cpp b/noncore/multimedia/opieplayer2/om3u.cpp index 790fa09..f2a01d3 100644 --- a/noncore/multimedia/opieplayer2/om3u.cpp +++ b/noncore/multimedia/opieplayer2/om3u.cpp | |||
@@ -1,152 +1,145 @@ | |||
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 L. Potter <ljp@llornkcor.com> | 4 | Copyright (c) 2002 L. Potter <ljp@llornkcor.com> |
5 | =. | 5 | =. |
6 | .=l. | 6 | .=l. |
7 | .>+-= | 7 | .>+-= |
8 | _;:, .> :=|. This program is free software; you can | 8 | _;:, .> :=|. This program is free software; you can |
9 | .> <`_, > . <= redistribute it and/or modify it under | 9 | .> <`_, > . <= redistribute it and/or modify it under |
10 | :`=1 )Y*s>-.-- : the terms of the GNU General Public | 10 | :`=1 )Y*s>-.-- : the terms of the GNU General Public |
11 | .="- .-=="i, .._ License as published by the Free Software | 11 | .="- .-=="i, .._ License as published by the Free Software |
12 | - . .-<_> .<> Foundation; either version 2 of the License, | 12 | - . .-<_> .<> Foundation; either version 2 of the License, |
13 | ._= =} : or (at your option) any later version. | 13 | ._= =} : or (at your option) any later version. |
14 | .%`+i> _;_. | 14 | .%`+i> _;_. |
15 | .i_,=:_. -<s. This program is distributed in the hope that | 15 | .i_,=:_. -<s. This program is distributed in the hope that |
16 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 16 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
17 | : .. .:, . . . without even the implied warranty of | 17 | : .. .:, . . . without even the implied warranty of |
18 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 18 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
19 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 19 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
20 | ..}^=.= = ; General Public License for more | 20 | ..}^=.= = ; General Public License for more |
21 | ++= -. .` .: details. | 21 | ++= -. .` .: details. |
22 | : = ...= . :.=- | 22 | : = ...= . :.=- |
23 | -. .:....=;==+<; You should have received a copy of the GNU | 23 | -. .:....=;==+<; You should have received a copy of the GNU |
24 | -_. . . )=. = General Public License along with | 24 | -_. . . )=. = General Public License along with |
25 | -- :-=` this library; see the file COPYING.LIB. | 25 | -- :-=` this library; see the file COPYING.LIB. |
26 | If not, write to the Free Software Foundation, | 26 | If not, write to the Free Software Foundation, |
27 | Inc., 59 Temple Place - Suite 330, | 27 | Inc., 59 Temple Place - Suite 330, |
28 | Boston, MA 02111-1307, USA. | 28 | Boston, MA 02111-1307, USA. |
29 | 29 | ||
30 | */ | 30 | */ |
31 | 31 | ||
32 | #include "om3u.h" | 32 | #include "om3u.h" |
33 | 33 | ||
34 | /* OPIE */ | 34 | /* OPIE */ |
35 | #include <opie2/odebug.h> | 35 | #include <opie2/odebug.h> |
36 | using namespace Opie::Core; | 36 | using namespace Opie::Core; |
37 | 37 | ||
38 | //extern PlayListWidget *playList; | 38 | //extern PlayListWidget *playList; |
39 | 39 | ||
40 | Om3u::Om3u( const QString &filePath, int mode) | 40 | Om3u::Om3u( const QString &filePath, int mode) |
41 | : QStringList (){ | 41 | : QStringList () |
42 | odebug << "<<<<<<<new m3u "+filePath << oendl; | 42 | { |
43 | f.setName(filePath); | 43 | odebug << "<<<<<<<new m3u "+filePath << oendl; |
44 | f.open(mode); | 44 | f.setName(filePath); |
45 | if (!f.open(mode)) { | ||
46 | owarn << "Unable to open file " << f.name() << oendl; | ||
47 | } | ||
45 | } | 48 | } |
46 | 49 | ||
47 | Om3u::~Om3u(){} | 50 | Om3u::~Om3u(){} |
48 | 51 | ||
49 | void Om3u::readM3u() { | 52 | void Om3u::readM3u() { |
50 | // odebug << "<<<<<<reading m3u "+f.name() << oendl; | 53 | // odebug << "<<<<<<reading m3u "+f.name() << oendl; |
51 | QTextStream t(&f); | 54 | QTextStream t(&f); |
52 | t.setEncoding(QTextStream::UnicodeUTF8); | 55 | t.setEncoding(QTextStream::UnicodeUTF8); |
53 | QString s; | 56 | QString s; |
54 | while ( !t.atEnd() ) { | 57 | while ( !t.atEnd() ) { |
55 | s=t.readLine(); | 58 | s=t.readLine(); |
56 | // odebug << s << oendl; | 59 | // odebug << s << oendl; |
57 | if( s.find( "#", 0, TRUE) == -1 ) { | 60 | if( s.find( "#", 0, TRUE) == -1 ) { |
58 | if( s.left(2) == "E:" || s.left(2) == "P:" ) { | 61 | if( s.left(2) == "E:" || s.left(2) == "P:" ) { |
59 | s = s.right( s.length() -2 ); | 62 | s = s.right( s.length() -2 ); |
60 | QFileInfo f( s ); | 63 | QFileInfo f( s ); |
61 | QString name = f.baseName(); | 64 | QString name = f.baseName(); |
62 | name = name.right( name.length() - name.findRev( "\\", -1, TRUE ) -1 ); | 65 | name = name.right( name.length() - name.findRev( "\\", -1, TRUE ) -1 ); |
63 | s=s.replace( QRegExp( "\\" ), "/" ); | 66 | s=s.replace( QRegExp( "\\" ), "/" ); |
64 | append(s); | 67 | append(s); |
65 | // odebug << s << oendl; | 68 | // odebug << s << oendl; |
66 | } else { // is url | 69 | } else { // is url |
67 | QString name; | 70 | QString name; |
68 | name = s; | 71 | name = s; |
69 | append(name); | 72 | append(name); |
70 | } | 73 | } |
71 | } | 74 | } |
72 | } | 75 | } |
73 | } | 76 | } |
74 | 77 | ||
75 | void Om3u::readPls() { //it's a pls file | 78 | void Om3u::readPls() { //it's a pls file |
76 | QTextStream t( &f ); | 79 | QTextStream t( &f ); |
77 | t.setEncoding(QTextStream::UnicodeUTF8); | 80 | t.setEncoding(QTextStream::UnicodeUTF8); |
78 | QString s; | 81 | QString s; |
79 | while ( !t.atEnd() ) { | 82 | while ( !t.atEnd() ) { |
80 | s = t.readLine(); | 83 | s = t.readLine(); |
81 | if( s.left(4) == "File" ) { | 84 | if( s.left(4) == "File" ) { |
82 | s = s.right( s.length() - s.find("=",0,true)-1 ); | 85 | s = s.right( s.length() - s.find("=",0,true)-1 ); |
83 | s = s.stripWhiteSpace(); | 86 | s = s.stripWhiteSpace(); |
84 | s.replace( QRegExp( "%20" )," "); | 87 | s.replace( QRegExp( "%20" )," "); |
85 | // odebug << "adding " + s + " to playlist" << oendl; | 88 | // odebug << "adding " + s + " to playlist" << oendl; |
86 | // numberofentries=2 | 89 | s = s.replace( QRegExp( "\\" ), "/" ); |
87 | // File1=http | 90 | QFileInfo f( s ); |
88 | // Title | 91 | QString name = f.baseName(); |
89 | // Length | 92 | if( name.left( 4 ) == "http" ) { |
90 | // Version | 93 | name = s.right( s.length() - 7); |
91 | // File2=http | 94 | } else { |
92 | s = s.replace( QRegExp( "\\" ), "/" ); | 95 | name = s; |
93 | QFileInfo f( s ); | 96 | } |
94 | QString name = f.baseName(); | 97 | name = name.right( name.length() - name.findRev( "\\", -1, TRUE) - 1 ); |
95 | if( name.left( 4 ) == "http" ) { | 98 | if( s.at( s.length() - 4) == '.') // if this is probably a file |
96 | name = s.right( s.length() - 7); | 99 | append(s); |
97 | } else { | 100 | else { //if its a url |
98 | name = s; | ||
99 | } | ||
100 | name = name.right( name.length() - name.findRev( "\\", -1, TRUE) - 1 ); | ||
101 | if( s.at( s.length() - 4) == '.') // if this is probably a file | ||
102 | append(s); | 101 | append(s); |
103 | else { //if its a url | ||
104 | // if( name.right( 1 ).find( '/' ) == -1) { | ||
105 | // s += "/"; | ||
106 | // } | ||
107 | append(s); | ||
108 | } | ||
109 | } | 102 | } |
110 | } | 103 | } |
104 | } | ||
111 | } | 105 | } |
112 | 106 | ||
113 | void Om3u::write() { //writes list to m3u file | 107 | void Om3u::write() { //writes list to m3u file |
114 | QString list; | 108 | QString list; |
115 | QTextStream t(&f); | 109 | QTextStream t(&f); |
116 | t.setEncoding(QTextStream::UnicodeUTF8); | 110 | t.setEncoding(QTextStream::UnicodeUTF8); |
117 | if(count()>0) { | 111 | if(count()>0) { |
118 | for ( QStringList::ConstIterator it = begin(); it != end(); ++it ) { | 112 | for ( QStringList::ConstIterator it = begin(); it != end(); ++it ) { |
119 | // odebug << *it << oendl; | 113 | // odebug << *it << oendl; |
120 | t << *it << "\n"; | 114 | t << *it << "\n"; |
115 | } | ||
121 | } | 116 | } |
122 | } | ||
123 | // f.close(); | ||
124 | } | 117 | } |
125 | 118 | ||
126 | void Om3u::add(const QString &filePath) { //adds to m3u file | 119 | void Om3u::add(const QString &filePath) { //adds to m3u file |
127 | append(filePath); | 120 | append(filePath); |
128 | } | 121 | } |
129 | 122 | ||
130 | void Om3u::remove(const QString &filePath) { //removes from m3u list | 123 | void Om3u::remove(const QString &filePath) { //removes from m3u list |
131 | QString list, currentFile; | 124 | QString list, currentFile; |
132 | if(count()>0) { | 125 | if(count()>0) { |
133 | for ( QStringList::ConstIterator it = begin(); it != end(); ++it ) { | 126 | for ( QStringList::ConstIterator it = begin(); it != end(); ++it ) { |
134 | currentFile=*it; | 127 | currentFile=*it; |
135 | // odebug << *it << oendl; | 128 | // odebug << *it << oendl; |
136 | 129 | ||
137 | if( filePath != currentFile) | 130 | if( filePath != currentFile) |
138 | list += currentFile+"\n"; | 131 | list += currentFile+"\n"; |
132 | } | ||
133 | f.writeBlock( list, list.length() ); | ||
139 | } | 134 | } |
140 | f.writeBlock( list, list.length() ); | ||
141 | } | ||
142 | } | 135 | } |
143 | 136 | ||
144 | void Om3u::deleteFile(const QString &/*filePath*/) {//deletes m3u file | 137 | void Om3u::deleteFile(const QString &/*filePath*/) {//deletes m3u file |
145 | f.close(); | 138 | f.close(); |
146 | f.remove(); | 139 | f.remove(); |
147 | 140 | ||
148 | } | 141 | } |
149 | 142 | ||
150 | void Om3u::close() { //closes m3u file | 143 | void Om3u::close() { //closes m3u file |
151 | f.close(); | 144 | f.close(); |
152 | } | 145 | } |
diff --git a/noncore/multimedia/opieplayer2/threadutil.cpp b/noncore/multimedia/opieplayer2/threadutil.cpp index b5cac61..5fc8a0b 100644 --- a/noncore/multimedia/opieplayer2/threadutil.cpp +++ b/noncore/multimedia/opieplayer2/threadutil.cpp | |||
@@ -1,394 +1,399 @@ | |||
1 | /* This file is part of the KDE project | 1 | /* This file is part of the KDE project |
2 | Copyright (C) 2002 Simon Hausmann <hausmann@kde.org> | 2 | Copyright (C) 2002 Simon Hausmann <hausmann@kde.org> |
3 | 3 | ||
4 | This library is free software; you can redistribute it and/or | 4 | This library is free software; you can redistribute it and/or |
5 | modify it under the terms of the GNU Library General Public | 5 | modify it under the terms of the GNU Library General Public |
6 | License as published by the Free Software Foundation; either | 6 | License as published by the Free Software Foundation; either |
7 | version 2 of the License, or (at your option) any later version. | 7 | version 2 of the License, or (at your option) any later version. |
8 | 8 | ||
9 | This library is distributed in the hope that it will be useful, | 9 | This library is distributed in the hope that it will be useful, |
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
12 | Library General Public License for more details. | 12 | Library General Public License for more details. |
13 | 13 | ||
14 | You should have received a copy of the GNU Library General Public License | 14 | You should have received a copy of the GNU Library General Public License |
15 | along with this library; see the file COPYING.LIB. If not, write to | 15 | along with this library; see the file COPYING.LIB. If not, write to |
16 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 16 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
17 | Boston, MA 02111-1307, USA. | 17 | Boston, MA 02111-1307, USA. |
18 | */ | 18 | */ |
19 | 19 | ||
20 | #include "threadutil.h" | 20 | #include "threadutil.h" |
21 | 21 | ||
22 | #include <opie2/odebug.h> | 22 | #include <opie2/odebug.h> |
23 | #include <qsocketnotifier.h> | 23 | #include <qsocketnotifier.h> |
24 | 24 | ||
25 | #include <pthread.h> | 25 | #include <pthread.h> |
26 | #include <assert.h> | 26 | #include <assert.h> |
27 | #include <unistd.h> | 27 | #include <unistd.h> |
28 | #include <errno.h> | 28 | #include <errno.h> |
29 | 29 | ||
30 | using namespace ThreadUtil; | 30 | using namespace ThreadUtil; |
31 | 31 | ||
32 | struct Mutex::Data | 32 | struct Mutex::Data |
33 | { | 33 | { |
34 | Data() | 34 | Data() |
35 | { | 35 | { |
36 | pthread_mutex_init( &mutex, 0 ); | 36 | pthread_mutex_init( &mutex, 0 ); |
37 | } | 37 | } |
38 | ~Data() | 38 | ~Data() |
39 | { | 39 | { |
40 | pthread_mutex_destroy( &mutex ); | 40 | pthread_mutex_destroy( &mutex ); |
41 | } | 41 | } |
42 | 42 | ||
43 | pthread_mutex_t mutex; | 43 | pthread_mutex_t mutex; |
44 | }; | 44 | }; |
45 | 45 | ||
46 | Mutex::Mutex() | 46 | Mutex::Mutex() |
47 | : d( new Data ) | 47 | : d( new Data ) |
48 | { | 48 | { |
49 | } | 49 | } |
50 | 50 | ||
51 | Mutex::~Mutex() | 51 | Mutex::~Mutex() |
52 | { | 52 | { |
53 | delete d; | 53 | delete d; |
54 | } | 54 | } |
55 | 55 | ||
56 | void Mutex::lock() | 56 | void Mutex::lock() |
57 | { | 57 | { |
58 | pthread_mutex_lock( &d->mutex ); | 58 | pthread_mutex_lock( &d->mutex ); |
59 | } | 59 | } |
60 | 60 | ||
61 | void Mutex::unlock() | 61 | void Mutex::unlock() |
62 | { | 62 | { |
63 | pthread_mutex_unlock( &d->mutex ); | 63 | pthread_mutex_unlock( &d->mutex ); |
64 | } | 64 | } |
65 | 65 | ||
66 | bool Mutex::tryLock() | 66 | bool Mutex::tryLock() |
67 | { | 67 | { |
68 | return pthread_mutex_trylock( &d->mutex ) == 0; | 68 | return pthread_mutex_trylock( &d->mutex ) == 0; |
69 | } | 69 | } |
70 | 70 | ||
71 | bool Mutex::isLocked() | 71 | bool Mutex::isLocked() |
72 | { | 72 | { |
73 | if ( !tryLock() ) | 73 | if ( !tryLock() ) |
74 | return true; | 74 | return true; |
75 | 75 | ||
76 | unlock(); | 76 | unlock(); |
77 | return false; | 77 | return false; |
78 | } | 78 | } |
79 | 79 | ||
80 | struct WaitCondition::Data | 80 | struct WaitCondition::Data |
81 | { | 81 | { |
82 | Data() | 82 | Data() |
83 | { | 83 | { |
84 | int result = pthread_cond_init( &waitCondition, 0 ); | 84 | int result = pthread_cond_init( &waitCondition, 0 ); |
85 | assert( result == 0 ); | 85 | assert( result == 0 ); |
86 | } | 86 | } |
87 | ~Data() | 87 | ~Data() |
88 | { | 88 | { |
89 | pthread_cond_destroy( &waitCondition ); | 89 | pthread_cond_destroy( &waitCondition ); |
90 | } | 90 | } |
91 | 91 | ||
92 | pthread_cond_t waitCondition; | 92 | pthread_cond_t waitCondition; |
93 | }; | 93 | }; |
94 | 94 | ||
95 | WaitCondition::WaitCondition() | 95 | WaitCondition::WaitCondition() |
96 | : d( new Data ) | 96 | : d( new Data ) |
97 | { | 97 | { |
98 | } | 98 | } |
99 | 99 | ||
100 | WaitCondition::~WaitCondition() | 100 | WaitCondition::~WaitCondition() |
101 | { | 101 | { |
102 | delete d; | 102 | delete d; |
103 | } | 103 | } |
104 | 104 | ||
105 | bool WaitCondition::wait() | 105 | bool WaitCondition::wait() |
106 | { | 106 | { |
107 | Mutex m; | 107 | Mutex m; |
108 | m.lock(); | 108 | m.lock(); |
109 | return wait( m ); | 109 | return wait( m ); |
110 | } | 110 | } |
111 | 111 | ||
112 | bool WaitCondition::wait( Mutex &mutex ) | 112 | bool WaitCondition::wait( Mutex &mutex ) |
113 | { | 113 | { |
114 | return pthread_cond_wait( &d->waitCondition, &mutex.d->mutex ); | 114 | return pthread_cond_wait( &d->waitCondition, &mutex.d->mutex ); |
115 | } | 115 | } |
116 | 116 | ||
117 | void WaitCondition::wakeOne() | 117 | void WaitCondition::wakeOne() |
118 | { | 118 | { |
119 | pthread_cond_signal( &d->waitCondition ); | 119 | pthread_cond_signal( &d->waitCondition ); |
120 | } | 120 | } |
121 | 121 | ||
122 | void WaitCondition::wakeAll() | 122 | void WaitCondition::wakeAll() |
123 | { | 123 | { |
124 | pthread_cond_broadcast( &d->waitCondition ); | 124 | pthread_cond_broadcast( &d->waitCondition ); |
125 | } | 125 | } |
126 | 126 | ||
127 | struct Thread::Data | 127 | struct Thread::Data |
128 | { | 128 | { |
129 | Data() : isRunning( false ) | 129 | Data() : isRunning( false ) |
130 | {} | 130 | {} |
131 | 131 | ||
132 | pthread_t self; | 132 | pthread_t self; |
133 | Mutex guard; | 133 | Mutex guard; |
134 | bool isRunning; | 134 | bool isRunning; |
135 | 135 | ||
136 | WaitCondition finishCondition; | 136 | WaitCondition finishCondition; |
137 | 137 | ||
138 | Thread *thr; | 138 | Thread *thr; |
139 | 139 | ||
140 | void run() { thr->run(); } | 140 | void run() { thr->run(); } |
141 | }; | 141 | }; |
142 | 142 | ||
143 | extern "C" | 143 | extern "C" |
144 | { | 144 | { |
145 | 145 | ||
146 | static void terminate_thread( void *arg ) | 146 | static void terminate_thread( void *arg ) |
147 | { | 147 | { |
148 | Thread::Data *data = ( Thread::Data* )arg; | 148 | Thread::Data *data = ( Thread::Data* )arg; |
149 | 149 | ||
150 | assert( data ); | 150 | assert( data ); |
151 | 151 | ||
152 | AutoLock locker( data->guard ); | 152 | AutoLock locker( data->guard ); |
153 | data->isRunning = false; | 153 | data->isRunning = false; |
154 | data->finishCondition.wakeAll(); | 154 | data->finishCondition.wakeAll(); |
155 | } | 155 | } |
156 | 156 | ||
157 | static void *start_thread( void *arg ) | 157 | static void *start_thread( void *arg ) |
158 | { | 158 | { |
159 | Thread::Data *data = ( Thread::Data* )arg; | 159 | Thread::Data *data = ( Thread::Data* )arg; |
160 | 160 | ||
161 | pthread_cleanup_push( terminate_thread, data ); | 161 | pthread_cleanup_push( terminate_thread, data ); |
162 | 162 | ||
163 | data->isRunning = true; | 163 | data->isRunning = true; |
164 | data->run(); | 164 | data->run(); |
165 | 165 | ||
166 | pthread_cleanup_pop( true ); | 166 | pthread_cleanup_pop( true ); |
167 | 167 | ||
168 | Thread::exit(); | 168 | Thread::exit(); |
169 | return 0; // never reached | 169 | return 0; // never reached |
170 | } | 170 | } |
171 | 171 | ||
172 | } | 172 | } |
173 | 173 | ||
174 | Thread::Thread() | 174 | Thread::Thread() |
175 | : d( new Data ) | 175 | : d( new Data ) |
176 | { | 176 | { |
177 | d->thr = this; | 177 | d->thr = this; |
178 | } | 178 | } |
179 | 179 | ||
180 | Thread::~Thread() | 180 | Thread::~Thread() |
181 | { | 181 | { |
182 | assert( d->isRunning == false ); | 182 | assert( d->isRunning == false ); |
183 | delete d; | 183 | delete d; |
184 | } | 184 | } |
185 | 185 | ||
186 | void Thread::start() | 186 | void Thread::start() |
187 | { | 187 | { |
188 | AutoLock lock( d->guard ); | 188 | AutoLock lock( d->guard ); |
189 | 189 | ||
190 | if ( d->isRunning ) { | 190 | if ( d->isRunning ) { |
191 | odebug << "ThreadUtil::Thread::start() called for running thread." << oendl; | 191 | odebug << "ThreadUtil::Thread::start() called for running thread." << oendl; |
192 | return; | 192 | return; |
193 | } | 193 | } |
194 | 194 | ||
195 | pthread_attr_t attributes; | 195 | pthread_attr_t attributes; |
196 | pthread_attr_init( &attributes ); | 196 | pthread_attr_init( &attributes ); |
197 | pthread_attr_setscope( &attributes, PTHREAD_SCOPE_SYSTEM ); | 197 | pthread_attr_setscope( &attributes, PTHREAD_SCOPE_SYSTEM ); |
198 | int err = pthread_create( &d->self, &attributes, start_thread, ( void* )d ); | 198 | int err = pthread_create( &d->self, &attributes, start_thread, ( void* )d ); |
199 | if ( err != 0 ) { | 199 | if ( err != 0 ) { |
200 | odebug << "ThreadUtil::Thread::start() : can't create thread: " << strerror( err ) << "" << oendl; | 200 | odebug << "ThreadUtil::Thread::start() : can't create thread: " << strerror( err ) << "" << oendl; |
201 | pthread_attr_destroy( &attributes ); | 201 | pthread_attr_destroy( &attributes ); |
202 | return; | 202 | return; |
203 | } | 203 | } |
204 | pthread_attr_destroy( &attributes ); | 204 | pthread_attr_destroy( &attributes ); |
205 | } | 205 | } |
206 | 206 | ||
207 | void Thread::terminate() | 207 | void Thread::terminate() |
208 | { | 208 | { |
209 | AutoLock lock( d->guard ); | 209 | AutoLock lock( d->guard ); |
210 | if ( !d->isRunning ) | 210 | if ( !d->isRunning ) |
211 | return; | 211 | return; |
212 | 212 | ||
213 | pthread_cancel( d->self ); | 213 | pthread_cancel( d->self ); |
214 | } | 214 | } |
215 | 215 | ||
216 | bool Thread::wait() | 216 | bool Thread::wait() |
217 | { | 217 | { |
218 | AutoLock lock( d->guard ); | 218 | AutoLock lock( d->guard ); |
219 | if ( !d->isRunning ) | 219 | if ( !d->isRunning ) |
220 | return true; | 220 | return true; |
221 | 221 | ||
222 | return d->finishCondition.wait( d->guard ); | 222 | return d->finishCondition.wait( d->guard ); |
223 | } | 223 | } |
224 | 224 | ||
225 | bool Thread::isRunning() const | 225 | bool Thread::isRunning() const |
226 | { | 226 | { |
227 | AutoLock lock( d->guard ); | 227 | AutoLock lock( d->guard ); |
228 | return d->isRunning; | 228 | return d->isRunning; |
229 | } | 229 | } |
230 | 230 | ||
231 | void Thread::exit() | 231 | void Thread::exit() |
232 | { | 232 | { |
233 | pthread_exit( 0 ); | 233 | pthread_exit( 0 ); |
234 | } | 234 | } |
235 | 235 | ||
236 | OnewayNotifier::OnewayNotifier() | 236 | OnewayNotifier::OnewayNotifier() : |
237 | { | 237 | m_readFd(-1), |
238 | int fds[ 2 ]; | 238 | m_writeFd(-1) |
239 | pipe( fds ); | 239 | { |
240 | m_readFd = fds[ 0 ]; | 240 | int fds[ 2 ] = { -1, -1 }; |
241 | m_writeFd = fds[ 1 ]; | 241 | if (pipe( fds ) == 0) { |
242 | m_readFd = fds[ 0 ]; | ||
243 | m_writeFd = fds[ 1 ]; | ||
244 | } else { | ||
245 | owarn << "Call to pipe() failed" << oendl; | ||
246 | } | ||
242 | 247 | ||
243 | m_notifier = new QSocketNotifier( m_readFd, QSocketNotifier::Read ); | 248 | m_notifier = new QSocketNotifier( m_readFd, QSocketNotifier::Read ); |
244 | connect( m_notifier, SIGNAL( activated(int) ), | 249 | connect( m_notifier, SIGNAL( activated(int) ), |
245 | this, SLOT( wakeUp() ) ); | 250 | this, SLOT( wakeUp() ) ); |
246 | } | 251 | } |
247 | 252 | ||
248 | OnewayNotifier::~OnewayNotifier() | 253 | OnewayNotifier::~OnewayNotifier() |
249 | { | 254 | { |
250 | delete m_notifier; | 255 | delete m_notifier; |
251 | 256 | ||
252 | ::close( m_readFd ); | 257 | ::close( m_readFd ); |
253 | ::close( m_writeFd ); | 258 | ::close( m_writeFd ); |
254 | } | 259 | } |
255 | 260 | ||
256 | void OnewayNotifier::notify() | 261 | void OnewayNotifier::notify() |
257 | { | 262 | { |
258 | const char c = 42; | 263 | const char c = 42; |
259 | ::write( m_writeFd, &c, 1 ); | 264 | ::write( m_writeFd, &c, 1 ); |
260 | } | 265 | } |
261 | 266 | ||
262 | void OnewayNotifier::wakeUp() | 267 | void OnewayNotifier::wakeUp() |
263 | { | 268 | { |
264 | char c = 0; | 269 | char c = 0; |
265 | 270 | ||
266 | if ( ::read( m_readFd, &c, 1 ) != 1 ) | 271 | if ( ::read( m_readFd, &c, 1 ) != 1 ) |
267 | return; | 272 | return; |
268 | 273 | ||
269 | emit awake(); | 274 | emit awake(); |
270 | } | 275 | } |
271 | 276 | ||
272 | ChannelMessage::ChannelMessage( int type, int data, const char* msg ) | 277 | ChannelMessage::ChannelMessage( int type, int data, const char* msg ) |
273 | : m_type( type ), m_data( data ), m_msg( msg ), | 278 | : m_type( type ), m_data( data ), m_msg( msg ), |
274 | m_isCall( false ), m_replied( false ), m_inEventHandler( false ) | 279 | m_isCall( false ), m_replied( false ), m_inEventHandler( false ) |
275 | {} | 280 | {} |
276 | 281 | ||
277 | ChannelMessage::~ChannelMessage() | 282 | ChannelMessage::~ChannelMessage() |
278 | { | 283 | { |
279 | if ( m_guard.isLocked() ) | 284 | if ( m_guard.isLocked() ) |
280 | m_guard.unlock(); | 285 | m_guard.unlock(); |
281 | } | 286 | } |
282 | 287 | ||
283 | void ChannelMessage::reply() | 288 | void ChannelMessage::reply() |
284 | { | 289 | { |
285 | if ( !m_isCall ) | 290 | if ( !m_isCall ) |
286 | { | 291 | { |
287 | odebug << "ChannelMessage::reply() - can't reply oneway message!" << oendl; | 292 | odebug << "ChannelMessage::reply() - can't reply oneway message!" << oendl; |
288 | return; | 293 | return; |
289 | } | 294 | } |
290 | 295 | ||
291 | if ( m_inEventHandler ) | 296 | if ( m_inEventHandler ) |
292 | { | 297 | { |
293 | m_replied = true; | 298 | m_replied = true; |
294 | return; | 299 | return; |
295 | } | 300 | } |
296 | 301 | ||
297 | m_condition.wakeOne(); | 302 | m_condition.wakeOne(); |
298 | m_guard.unlock(); | 303 | m_guard.unlock(); |
299 | } | 304 | } |
300 | 305 | ||
301 | struct Channel::Private | 306 | struct Channel::Private |
302 | { | 307 | { |
303 | Private() | 308 | Private() |
304 | { | 309 | { |
305 | ownerThread = pthread_self(); | 310 | ownerThread = pthread_self(); |
306 | } | 311 | } |
307 | 312 | ||
308 | pthread_t ownerThread; | 313 | pthread_t ownerThread; |
309 | }; | 314 | }; |
310 | 315 | ||
311 | Channel::Channel( QObject *parent, const char *name ) | 316 | Channel::Channel( QObject *parent, const char *name ) |
312 | : QObject( parent, name ), d( new Private ) | 317 | : QObject( parent, name ), d( new Private ) |
313 | { | 318 | { |
314 | connect( &m_notifier, SIGNAL( awake() ), | 319 | connect( &m_notifier, SIGNAL( awake() ), |
315 | this, SLOT( deliver() ) ); | 320 | this, SLOT( deliver() ) ); |
316 | } | 321 | } |
317 | 322 | ||
318 | Channel::~Channel() | 323 | Channel::~Channel() |
319 | { | 324 | { |
320 | delete d; | 325 | delete d; |
321 | } | 326 | } |
322 | 327 | ||
323 | void Channel::send( ChannelMessage *message, SendType type ) | 328 | void Channel::send( ChannelMessage *message, SendType type ) |
324 | { | 329 | { |
325 | if ( type == WaitForReply ) | 330 | if ( type == WaitForReply ) |
326 | { | 331 | { |
327 | message->m_guard.lock(); | 332 | message->m_guard.lock(); |
328 | message->m_isCall = true; | 333 | message->m_isCall = true; |
329 | } | 334 | } |
330 | 335 | ||
331 | m_pendingMessagesGuard.lock(); | 336 | m_pendingMessagesGuard.lock(); |
332 | m_pendingMessages << MsgEnvelope( type, message ); | 337 | m_pendingMessages << MsgEnvelope( type, message ); |
333 | m_pendingMessagesGuard.unlock(); | 338 | m_pendingMessagesGuard.unlock(); |
334 | 339 | ||
335 | if ( d->ownerThread == pthread_self() ) { | 340 | if ( d->ownerThread == pthread_self() ) { |
336 | assert( type != WaitForReply ); | 341 | assert( type != WaitForReply ); |
337 | 342 | ||
338 | deliver(); | 343 | deliver(); |
339 | } | 344 | } |
340 | else | 345 | else |
341 | m_notifier.notify(); | 346 | m_notifier.notify(); |
342 | //QThread::postEvent( this, new QCustomEvent( QEvent::User, envelope ) ); | 347 | //QThread::postEvent( this, new QCustomEvent( QEvent::User, envelope ) ); |
343 | 348 | ||
344 | if ( type == WaitForReply ) | 349 | if ( type == WaitForReply ) |
345 | { | 350 | { |
346 | message->m_condition.wait( message->m_guard ); | 351 | message->m_condition.wait( message->m_guard ); |
347 | message->m_guard.unlock(); | 352 | message->m_guard.unlock(); |
348 | } | 353 | } |
349 | } | 354 | } |
350 | 355 | ||
351 | void Channel::deliver() | 356 | void Channel::deliver() |
352 | { | 357 | { |
353 | AutoLock lock( m_pendingMessagesGuard ); | 358 | AutoLock lock( m_pendingMessagesGuard ); |
354 | 359 | ||
355 | while ( !m_pendingMessages.isEmpty() ) { | 360 | while ( !m_pendingMessages.isEmpty() ) { |
356 | MsgEnvelope envelope = m_pendingMessages.first(); | 361 | MsgEnvelope envelope = m_pendingMessages.first(); |
357 | 362 | ||
358 | m_pendingMessages.remove( m_pendingMessages.begin() ); | 363 | m_pendingMessages.remove( m_pendingMessages.begin() ); |
359 | 364 | ||
360 | m_pendingMessagesGuard.unlock(); | 365 | m_pendingMessagesGuard.unlock(); |
361 | deliverOne( envelope ); | 366 | deliverOne( envelope ); |
362 | m_pendingMessagesGuard.lock(); | 367 | m_pendingMessagesGuard.lock(); |
363 | } | 368 | } |
364 | } | 369 | } |
365 | 370 | ||
366 | void Channel::deliverOne( const MsgEnvelope &envelope ) | 371 | void Channel::deliverOne( const MsgEnvelope &envelope ) |
367 | { | 372 | { |
368 | ChannelMessage *msg = envelope.msg; | 373 | ChannelMessage *msg = envelope.msg; |
369 | 374 | ||
370 | assert( msg ); | 375 | assert( msg ); |
371 | 376 | ||
372 | if ( envelope.type == WaitForReply ) | 377 | if ( envelope.type == WaitForReply ) |
373 | { | 378 | { |
374 | msg->m_guard.lock(); | 379 | msg->m_guard.lock(); |
375 | msg->m_inEventHandler = true; | 380 | msg->m_inEventHandler = true; |
376 | } | 381 | } |
377 | 382 | ||
378 | receiveMessage( msg, envelope.type ); | 383 | receiveMessage( msg, envelope.type ); |
379 | 384 | ||
380 | if ( envelope.type == WaitForReply ) | 385 | if ( envelope.type == WaitForReply ) |
381 | { | 386 | { |
382 | msg->m_inEventHandler = false; | 387 | msg->m_inEventHandler = false; |
383 | if ( msg->m_replied ) | 388 | if ( msg->m_replied ) |
384 | { | 389 | { |
385 | msg->m_condition.wakeOne(); | 390 | msg->m_condition.wakeOne(); |
386 | // this is a bit tricky. we unlock only when we reply. | 391 | // this is a bit tricky. we unlock only when we reply. |
387 | // reply() does an unlock as well. | 392 | // reply() does an unlock as well. |
388 | msg->m_guard.unlock(); | 393 | msg->m_guard.unlock(); |
389 | } | 394 | } |
390 | } | 395 | } |
391 | } | 396 | } |
392 | 397 | ||
393 | /* vim: et sw=4 ts=4 | 398 | /* vim: et sw=4 ts=4 |
394 | */ | 399 | */ |