From 2c693a47328a4faa9581a792c24448407629279b Mon Sep 17 00:00:00 2001 From: wm4 Date: Tue, 25 Mar 2014 01:38:18 +0100 Subject: stream: remove old chapter handling code Stream-level chapters (like DVD etc.) did potentially not have timestamps for each chapter, so STREAM_CTRL_SEEK_TO_CHAPTER and STREAM_CTRL_GET_CURRENT_CHAPTER were needed to navigate chapters. We've switched everything to use timestamps and that seems to work, so we can simplify the code and remove this old mechanism. --- stream/stream_dvd.c | 56 ----------------------------------------------------- 1 file changed, 56 deletions(-) (limited to 'stream/stream_dvd.c') diff --git a/stream/stream_dvd.c b/stream/stream_dvd.c index 93c9420086..3d6e3b3cb2 100644 --- a/stream/stream_dvd.c +++ b/stream/stream_dvd.c @@ -427,49 +427,6 @@ static int get_num_chapter(ifo_handle_t *vts_file, tt_srpt_t *tt_srpt, int title return vts_file->vts_ptt_srpt->title[title_no].nr_of_ptts; } -static int seek_to_chapter(stream_t *stream, ifo_handle_t *vts_file, tt_srpt_t *tt_srpt, int title_no, int chapter) -{ - dvd_priv_t *d = stream->priv; - ptt_info_t ptt; - pgc_t *pgc; - int64_t pos; - - if(!vts_file || !tt_srpt) - return 0; - - if(title_no < 0 || title_no >= tt_srpt->nr_of_srpts) - return 0; - - // map global title to vts title - title_no = tt_srpt->title[title_no].vts_ttn - 1; - - if(title_no < 0 || title_no >= vts_file->vts_ptt_srpt->nr_of_srpts) - return 0; - - if(chapter < 0 || chapter > vts_file->vts_ptt_srpt->title[title_no].nr_of_ptts-1) //no such chapter - return 0; - - ptt = vts_file->vts_ptt_srpt->title[title_no].ptt[chapter]; - pgc = vts_file->vts_pgcit->pgci_srp[ptt.pgcn-1].pgc; - - d->cur_cell = pgc->program_map[ptt.pgn - 1] - 1; - if(pgc->cell_playback[d->cur_cell].block_type == BLOCK_TYPE_ANGLE_BLOCK) - d->cur_cell += dvd_angle-1; - d->cur_pack = pgc->cell_playback[d->cur_cell].first_sector; - d->cell_last_pack = pgc->cell_playback[d->cur_cell].last_sector; - - d->packs_left = -1; - d->angle_seek = 0; - - pos = (int64_t) d->cur_pack * 2048; - stream_seek(stream, pos); - - MP_VERBOSE(stream, "\r\nSTREAM_DVD, seeked to chapter: %d, cell: %u, pos: %"PRIu64"\n", - chapter, d->cur_pack, pos); - - return chapter; -} - // p: in=chapter number, out=PTS static int get_chapter_time(ifo_handle_t *vts_file, tt_srpt_t *tt_srpt, int title_no, double *p) { @@ -642,24 +599,11 @@ static int control(stream_t *stream,int cmd,void* arg) if(! r) return STREAM_UNSUPPORTED; return 1; } - case STREAM_CTRL_SEEK_TO_CHAPTER: - { - int r; - r = seek_to_chapter(stream, d->vts_file, d->tt_srpt, d->cur_title, *((unsigned int *)arg)); - if(! r) return STREAM_UNSUPPORTED; - - return 1; - } case STREAM_CTRL_GET_CURRENT_TITLE: { *((unsigned int *)arg) = d->cur_title; return 1; } - case STREAM_CTRL_GET_CURRENT_CHAPTER: - { - *((unsigned int *)arg) = dvd_chapter_from_cell(d, d->cur_title, d->cur_cell); - return 1; - } case STREAM_CTRL_GET_CURRENT_TIME: { double tm; -- cgit v1.2.3