comparison stream/stream_dvdnav.c @ 19443:6e618d1fbb23

implemented seeking to chapter
author nicodvb
date Sat, 19 Aug 2006 11:49:04 +0000
parents ab8d6b6deb63
children 0ceeedf7f04d
comparison
equal deleted inserted replaced
19442:ab91d0304070 19443:6e618d1fbb23
343 } 343 }
344 mp_msg(MSGT_STREAM,MSGL_DBG2,"DVDNAV fill_buffer len: %d\n",len); 344 mp_msg(MSGT_STREAM,MSGL_DBG2,"DVDNAV fill_buffer len: %d\n",len);
345 return len; 345 return len;
346 } 346 }
347 347
348 static int control(stream_t *stream, int cmd, void* arg) {
349 dvdnav_priv_t* dvdnav_priv=stream->priv;
350 int tit, part;
351
352 switch(cmd)
353 {
354 case STREAM_CTRL_SEEK_TO_CHAPTER:
355 {
356 int chap = *((unsigned int *)arg)+1;
357
358 if(chap < 1 || dvdnav_current_title_info(dvdnav_priv->dvdnav, &tit, &part) != DVDNAV_STATUS_OK)
359 break;
360 if(dvdnav_part_play(dvdnav_priv->dvdnav, tit, chap) != DVDNAV_STATUS_OK)
361 break;
362 return 1;
363 }
364 case STREAM_CTRL_GET_CURRENT_CHAPTER:
365 {
366 if(dvdnav_current_title_info(dvdnav_priv->dvdnav, &tit, &part) != DVDNAV_STATUS_OK)
367 break;
368 *((unsigned int *)arg) = part - 1;
369 return 1;
370 }
371 }
372
373 return STREAM_UNSUPORTED;
374 }
375
348 static int open_s(stream_t *stream,int mode, void* opts, int* file_format) { 376 static int open_s(stream_t *stream,int mode, void* opts, int* file_format) {
349 struct stream_priv_s* p = (struct stream_priv_s*)opts; 377 struct stream_priv_s* p = (struct stream_priv_s*)opts;
350 char *filename; 378 char *filename;
351 int event,len,tmplen=0; 379 int event,len,tmplen=0;
352 uint32_t pos, l2; 380 uint32_t pos, l2;
370 398
371 stream->sector_size = 2048; 399 stream->sector_size = 2048;
372 stream->flags = STREAM_READ | STREAM_SEEK; 400 stream->flags = STREAM_READ | STREAM_SEEK;
373 stream->fill_buffer = fill_buffer; 401 stream->fill_buffer = fill_buffer;
374 stream->seek = seek; 402 stream->seek = seek;
403 stream->control = control;
375 stream->close = stream_dvdnav_close; 404 stream->close = stream_dvdnav_close;
376 stream->type = STREAMTYPE_DVDNAV; 405 stream->type = STREAMTYPE_DVDNAV;
377 stream->priv=(void*)dvdnav_priv; 406 stream->priv=(void*)dvdnav_priv;
378 *file_format = DEMUXER_TYPE_MPEG_PS; 407 *file_format = DEMUXER_TYPE_MPEG_PS;
379 408