comparison src/psf2/plugin.c @ 2753:be414d015fec

Implement seeking (you can seek forward), it crashes when you seek backwards though :(.
author William Pitcock <nenolod@atheme.org>
date Tue, 01 Jul 2008 00:22:25 -0500
parents cd2d2118fdee
children 2cbc458d8286
comparison
equal deleted inserted replaced
2752:cd2d2118fdee 2753:be414d015fec
176 { 176 {
177 psf2_execute(data); 177 psf2_execute(data);
178 178
179 if (seek) 179 if (seek)
180 { 180 {
181 data->eof = FALSE;
182 data->output->flush(seek);
183
184 psf2_command(COMMAND_RESTART, 0);
185 psf2_seek(seek);
186
181 seek = 0; 187 seek = 0;
182 continue; 188 continue;
183 } 189 }
184 190
185 psf2_stop(); 191 psf2_stop();
228 } 234 }
229 count -= t; 235 count -= t;
230 buffer += t; 236 buffer += t;
231 } 237 }
232 238
233 #if 0 239 if (seek)
234 if (seek) 240 {
235 { 241 if (psf2_seek(seek))
236 if(sexypsf_seek(seek)) 242 {
237 { 243 playback->output->flush(seek);
238 playback->output->flush(seek); 244 seek = 0;
239 seek = 0; 245 }
240 } 246 else
241 else // negative time - must make a C time machine 247 {
242 { 248 playback->eof = TRUE;
243 sexypsf_stop(); 249 return;
244 return; 250 }
245 } 251 }
246 }
247 if (stop)
248 sexypsf_stop();
249 #endif
250 } 252 }
251 253
252 void psf2_Stop(InputPlayback *playback) 254 void psf2_Stop(InputPlayback *playback)
253 { 255 {
254 playback->playing = FALSE; 256 playback->playing = FALSE;
268 return 1; 270 return 1;
269 271
270 return 0; 272 return 0;
271 } 273 }
272 274
275 void psf2_Seek(InputPlayback *playback, int time)
276 {
277 seek = time * 1000;
278 }
279
273 gchar *psf2_fmts[] = { "psf2", "minipsf2", NULL }; 280 gchar *psf2_fmts[] = { "psf2", "minipsf2", NULL };
274 281
275 InputPlugin psf2_ip = 282 InputPlugin psf2_ip =
276 { 283 {
277 .description = "PSF2 Audio Plugin", 284 .description = "PSF2 Audio Plugin",
278 .play_file = psf2_play, 285 .play_file = psf2_play,
279 .stop = psf2_Stop, 286 .stop = psf2_Stop,
280 .pause = psf2_pause, 287 .pause = psf2_pause,
281 #if 0 288 .seek = psf2_Seek,
282 .seek = sexypsf_xmms_seek, 289 .get_song_tuple = psf2_tuple,
283 .get_song_info = sexypsf_xmms_getsonginfo, 290 .is_our_file_from_vfs = psf2_is_our_fd,
284 #endif 291 .vfs_extensions = psf2_fmts,
285 .get_song_tuple = psf2_tuple,
286 .is_our_file_from_vfs = psf2_is_our_fd,
287 .vfs_extensions = psf2_fmts,
288 }; 292 };
289 293
290 InputPlugin *psf2_iplist[] = { &psf2_ip, NULL }; 294 InputPlugin *psf2_iplist[] = { &psf2_ip, NULL };
291 295
292 DECLARE_PLUGIN(psf2, NULL, NULL, psf2_iplist, NULL, NULL, NULL, NULL, NULL); 296 DECLARE_PLUGIN(psf2, NULL, NULL, psf2_iplist, NULL, NULL, NULL, NULL, NULL);