From a9d83eac40c94f44d19fab7b6955331f10efe301 Mon Sep 17 00:00:00 2001 From: wm4 Date: Fri, 13 Sep 2019 16:48:34 +0200 Subject: Remove optical disc fancification layers This removes anything related to DVD/BD/CD that negatively affected the core code. It includes trying to rewrite timestamps (since DVDs and Blurays do not set packet stream timestamps to playback time, and can even have resets mid-stream), export of chapters, stream languages, export of title/track lists, and all that. Only basic seeking is supported. It is very much possible that seeking completely fails on some discs (on some parts of the timeline), because timestamp rewriting was removed. Note that I don't give a shit about optical media. If you want to watch them, rip them. Keeping some bare support for DVD/BD is the most I'm going to do to appease the type of lazy, obnoxious users who will care. There are other players which are better at optical discs. --- stream/stream_bluray.c | 105 +------------------------------------------------ 1 file changed, 2 insertions(+), 103 deletions(-) (limited to 'stream/stream_bluray.c') diff --git a/stream/stream_bluray.c b/stream/stream_bluray.c index f26420b56d..10562d6af4 100644 --- a/stream/stream_bluray.c +++ b/stream/stream_bluray.c @@ -175,119 +175,19 @@ static int bluray_stream_control(stream_t *s, int cmd, void *arg) struct bluray_priv_s *b = s->priv; switch (cmd) { - case STREAM_CTRL_GET_NUM_CHAPTERS: { - const BLURAY_TITLE_INFO *ti = b->title_info; - if (!ti) - return STREAM_UNSUPPORTED; - *((unsigned int *) arg) = ti->chapter_count; - return STREAM_OK; - } - case STREAM_CTRL_GET_CHAPTER_TIME: { - const BLURAY_TITLE_INFO *ti = b->title_info; - if (!ti) - return STREAM_UNSUPPORTED; - int chapter = *(double *)arg; - double time = MP_NOPTS_VALUE; - if (chapter >= 0 || chapter < ti->chapter_count) - time = BD_TIME_TO_MP(ti->chapters[chapter].start); - if (time == MP_NOPTS_VALUE) - return STREAM_ERROR; - *(double *)arg = time; - return STREAM_OK; - } - case STREAM_CTRL_SET_CURRENT_TITLE: { - const uint32_t title = *((unsigned int*)arg); - if (title >= b->num_titles || !play_title(b, title)) - return STREAM_UNSUPPORTED; - b->current_title = title; - return STREAM_OK; - } - case STREAM_CTRL_GET_CURRENT_TITLE: { - *((unsigned int *) arg) = b->current_title; - return STREAM_OK; - } - case STREAM_CTRL_GET_NUM_TITLES: { - *((unsigned int *)arg) = b->num_titles; - return STREAM_OK; - } - case STREAM_CTRL_GET_TIME_LENGTH: { + case STREAM_CTRL_OPTICAL_CRAP_HACK1: { const BLURAY_TITLE_INFO *ti = b->title_info; if (!ti) return STREAM_UNSUPPORTED; *((double *) arg) = BD_TIME_TO_MP(ti->duration); return STREAM_OK; } - case STREAM_CTRL_GET_CURRENT_TIME: { - *((double *) arg) = BD_TIME_TO_MP(bd_tell_time(b->bd)); - return STREAM_OK; - } - case STREAM_CTRL_SEEK_TO_TIME: { + case STREAM_CTRL_OPTICAL_CRAP_HACK2: { double pts = *((double *) arg); bd_seek_time(b->bd, BD_TIME_FROM_MP(pts)); stream_drop_buffers(s); - // API makes it hard to determine seeking success - return STREAM_OK; - } - case STREAM_CTRL_GET_NUM_ANGLES: { - const BLURAY_TITLE_INFO *ti = b->title_info; - if (!ti) - return STREAM_UNSUPPORTED; - *((int *) arg) = ti->angle_count; - return STREAM_OK; - } - case STREAM_CTRL_GET_ANGLE: { - *((int *) arg) = b->current_angle; - return STREAM_OK; - } - case STREAM_CTRL_SET_ANGLE: { - const BLURAY_TITLE_INFO *ti = b->title_info; - if (!ti) - return STREAM_UNSUPPORTED; - int angle = *((int *) arg); - if (angle < 0 || angle > ti->angle_count) - return STREAM_UNSUPPORTED; - b->current_angle = angle; - bd_seamless_angle_change(b->bd, angle); return STREAM_OK; } - case STREAM_CTRL_GET_LANG: { - const BLURAY_TITLE_INFO *ti = b->title_info; - if (ti && ti->clip_count) { - struct stream_lang_req *req = arg; - BLURAY_STREAM_INFO *si = NULL; - int count = 0; - switch (req->type) { - case STREAM_AUDIO: - count = ti->clips[0].audio_stream_count; - si = ti->clips[0].audio_streams; - break; - case STREAM_SUB: - count = ti->clips[0].pg_stream_count; - si = ti->clips[0].pg_streams; - break; - } - for (int n = 0; n < count; n++) { - BLURAY_STREAM_INFO *i = &si[n]; - if (i->pid == req->id) { - snprintf(req->name, sizeof(req->name), "%.4s", i->lang); - return STREAM_OK; - } - } - } - return STREAM_ERROR; - } - case STREAM_CTRL_GET_DISC_NAME: { - const struct meta_dl *meta = bd_get_meta(b->bd); - if (!meta || !meta->di_name || !meta->di_name[0]) - break; - *(char**)arg = talloc_strdup(NULL, meta->di_name); - return STREAM_OK; - } - case STREAM_CTRL_GET_SIZE: - *(int64_t *)arg = bd_get_title_size(b->bd); - return STREAM_OK; - default: - break; } return STREAM_UNSUPPORTED; @@ -456,7 +356,6 @@ static int bluray_stream_open_internal(stream_t *s) s->control = bluray_stream_control; s->sector_size = BLURAY_SECTOR_SIZE; s->priv = b; - s->demuxer = "+disc"; MP_VERBOSE(s, "Blu-ray successfully opened.\n"); -- cgit v1.2.3