diff options
author | wm4 <wm4@nowhere> | 2014-03-25 01:38:18 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2014-03-25 01:38:18 +0100 |
commit | 2c693a47328a4faa9581a792c24448407629279b (patch) | |
tree | 4f98655f55f9213ce6258c81cf6ac55b9be06463 /stream | |
parent | 7bd3f2648152d41db9a9d3f479358d0d8f38b210 (diff) | |
download | mpv-2c693a47328a4faa9581a792c24448407629279b.tar.bz2 mpv-2c693a47328a4faa9581a792c24448407629279b.tar.xz |
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.
Diffstat (limited to 'stream')
-rw-r--r-- | stream/cache.c | 1 | ||||
-rw-r--r-- | stream/stream.h | 2 | ||||
-rw-r--r-- | stream/stream_bluray.c | 27 | ||||
-rw-r--r-- | stream/stream_dvd.c | 56 | ||||
-rw-r--r-- | stream/stream_dvdnav.c | 17 |
5 files changed, 0 insertions, 103 deletions
diff --git a/stream/cache.c b/stream/cache.c index 399013124f..56d9220dfd 100644 --- a/stream/cache.c +++ b/stream/cache.c @@ -407,7 +407,6 @@ static bool control_needs_flush(int stream_ctrl) { switch (stream_ctrl) { case STREAM_CTRL_SEEK_TO_TIME: - case STREAM_CTRL_SEEK_TO_CHAPTER: case STREAM_CTRL_SET_ANGLE: case STREAM_CTRL_SET_CURRENT_TITLE: return true; diff --git a/stream/stream.h b/stream/stream.h index 1c7b277db8..c23d173165 100644 --- a/stream/stream.h +++ b/stream/stream.h @@ -70,8 +70,6 @@ enum streamtype { enum stream_ctrl { STREAM_CTRL_GET_TIME_LENGTH = 1, - STREAM_CTRL_SEEK_TO_CHAPTER, - STREAM_CTRL_GET_CURRENT_CHAPTER, STREAM_CTRL_GET_NUM_CHAPTERS, STREAM_CTRL_GET_CURRENT_TIME, STREAM_CTRL_SEEK_TO_TIME, diff --git a/stream/stream_bluray.c b/stream/stream_bluray.c index 6836da22d0..b0347751d6 100644 --- a/stream/stream_bluray.c +++ b/stream/stream_bluray.c @@ -161,33 +161,6 @@ static int bluray_stream_control(stream_t *s, int cmd, void *arg) return 1; } - case STREAM_CTRL_GET_CURRENT_CHAPTER: { - *((unsigned int *) arg) = bd_get_current_chapter(b->bd); - return 1; - } - - case STREAM_CTRL_SEEK_TO_CHAPTER: { - BLURAY_TITLE_INFO *ti; - int chapter = *((unsigned int *) arg); - int64_t pos; - int r; - - ti = bd_get_title_info(b->bd, b->current_title, b->current_angle); - if (!ti) - return STREAM_UNSUPPORTED; - - if (chapter < 0 || chapter > ti->chapter_count) { - bd_free_title_info(ti); - return STREAM_UNSUPPORTED; - } - - pos = bd_chapter_pos(b->bd, chapter); - r = bluray_stream_seek(s, pos); - bd_free_title_info(ti); - - return r ? 1 : STREAM_UNSUPPORTED; - } - case STREAM_CTRL_GET_TIME_LENGTH: { BLURAY_TITLE_INFO *ti; 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; diff --git a/stream/stream_dvdnav.c b/stream/stream_dvdnav.c index 9cdc3c027b..c632e039d0 100644 --- a/stream/stream_dvdnav.c +++ b/stream/stream_dvdnav.c @@ -466,17 +466,6 @@ static int control(stream_t *stream, int cmd, void *arg) int tit, part; switch (cmd) { - case STREAM_CTRL_SEEK_TO_CHAPTER: { - int chap = *(unsigned int *)arg + 1; - - if (chap < 1) - break; - if (dvdnav_current_title_info(dvdnav, &tit, &part) != DVDNAV_STATUS_OK) - break; - if (dvdnav_part_play(dvdnav, tit, chap) != DVDNAV_STATUS_OK) - break; - return 1; - } case STREAM_CTRL_GET_NUM_CHAPTERS: { if (dvdnav_current_title_info(dvdnav, &tit, &part) != DVDNAV_STATUS_OK) break; @@ -502,12 +491,6 @@ static int control(stream_t *stream, int cmd, void *arg) free(parts); return 1; } - case STREAM_CTRL_GET_CURRENT_CHAPTER: { - if (dvdnav_current_title_info(dvdnav, &tit, &part) != DVDNAV_STATUS_OK) - break; - *(unsigned int *)arg = part - 1; - return 1; - } case STREAM_CTRL_GET_TIME_LENGTH: { if (priv->duration) { *(double *)arg = (double)priv->duration / 1000.0; |