summaryrefslogtreecommitdiffstats
path: root/player/loadfile.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-07-05 16:57:56 +0200
committerwm4 <wm4@nowhere>2014-07-05 17:07:15 +0200
commit338004bcfc224727d1477d303aa1521bf3ac21be (patch)
tree5066a689bb13f4c00a360d9b33a485d81eb17d72 /player/loadfile.c
parent4d2a4afdef24c343b98e71dddcb3382e85c09c96 (diff)
downloadmpv-338004bcfc224727d1477d303aa1521bf3ac21be.tar.bz2
mpv-338004bcfc224727d1477d303aa1521bf3ac21be.tar.xz
dvd, bluray, cdda: add demux_disc containing all related hacks
DVD and Bluray (and to some extent cdda) require awful hacks all over the codebase to make them work. The main reason is that they act like container, but are entirely implemented on the stream layer. The raw mpeg data resulting from these streams must be "extended" with the container-like metadata transported via STREAM_CTRLs. The result were hacks all over demux.c and some higher-level parts. Add a "disc" pseudo-demuxer, and move all these hacks and special-cases to it.
Diffstat (limited to 'player/loadfile.c')
-rw-r--r--player/loadfile.c68
1 files changed, 0 insertions, 68 deletions
diff --git a/player/loadfile.c b/player/loadfile.c
index bae8f74fe9..c2242ea7c2 100644
--- a/player/loadfile.c
+++ b/player/loadfile.c
@@ -351,14 +351,6 @@ double timeline_set_from_time(struct MPContext *mpctx, double pts, bool *need_re
return -1;
}
-// Map stream number (as used by libdvdread) to MPEG IDs (as used by demuxer).
-static int map_id_from_demuxer(struct demuxer *d, enum stream_type type, int id)
-{
- if (d->stream->uncached_type == STREAMTYPE_DVD && type == STREAM_SUB)
- id = id & 0x1F;
- return id;
-}
-
static int find_new_tid(struct MPContext *mpctx, enum stream_type t)
{
int new_id = 0;
@@ -378,22 +370,6 @@ static struct track *add_stream_track(struct MPContext *mpctx,
struct track *track = mpctx->tracks[i];
if (track->stream == stream)
return track;
- // DVD subtitle track that was added later
- if (stream->type == STREAM_SUB && track->type == STREAM_SUB &&
- map_id_from_demuxer(stream->demuxer, stream->type,
- stream->demuxer_id) == track->demuxer_id
- && !track->stream)
- {
- track->stream = stream;
- track->demuxer_id = stream->demuxer_id;
- // Initialize lazily selected track
- demuxer_select_track(track->demuxer, stream, track->selected);
- if (mpctx->current_track[0][STREAM_SUB] == track)
- reinit_subs(mpctx, 0);
- if (mpctx->current_track[1][STREAM_SUB] == track)
- reinit_subs(mpctx, 1);
- return track;
- }
}
struct track *track = talloc_ptrtype(NULL, track);
@@ -411,21 +387,6 @@ static struct track *add_stream_track(struct MPContext *mpctx,
};
MP_TARRAY_APPEND(mpctx, mpctx->tracks, mpctx->num_tracks, track);
- // Needed for DVD and Blu-ray.
- struct stream *st = track->demuxer->stream;
- if (!track->lang && (st->uncached_type == STREAMTYPE_BLURAY ||
- st->uncached_type == STREAMTYPE_DVD))
- {
- struct stream_lang_req req = {
- .type = track->type,
- .id = map_id_from_demuxer(track->demuxer, track->type,
- track->demuxer_id)
- };
- stream_control(st, STREAM_CTRL_GET_LANG, &req);
- if (req.name[0])
- track->lang = talloc_strdup(track, req.name);
- }
-
demuxer_select_track(track->demuxer, stream, false);
mp_notify(mpctx, MPV_EVENT_TRACKS_CHANGED, NULL);
@@ -439,34 +400,6 @@ void add_demuxer_tracks(struct MPContext *mpctx, struct demuxer *demuxer)
add_stream_track(mpctx, demuxer->streams[n], !!mpctx->timeline);
}
-static void add_dvd_tracks(struct MPContext *mpctx)
-{
- struct demuxer *demuxer = mpctx->demuxer;
- struct stream *stream = demuxer->stream;
- struct stream_dvd_info_req info;
- if (stream->uncached_type != STREAMTYPE_DVD)
- return;
- if (stream_control(stream, STREAM_CTRL_GET_DVD_INFO, &info) > 0) {
- for (int n = 0; n < info.num_subs; n++) {
- struct track *track = talloc_ptrtype(NULL, track);
- *track = (struct track) {
- .type = STREAM_SUB,
- .user_tid = find_new_tid(mpctx, STREAM_SUB),
- .demuxer_id = n,
- .demuxer = mpctx->demuxer,
- };
- MP_TARRAY_APPEND(mpctx, mpctx->tracks, mpctx->num_tracks, track);
-
- struct stream_lang_req req = {.type = STREAM_SUB, .id = n};
- stream_control(stream, STREAM_CTRL_GET_LANG, &req);
- track->lang = talloc_strdup(track, req.name);
-
- mp_notify(mpctx, MPV_EVENT_TRACKS_CHANGED, NULL);
- }
- }
- demuxer_enable_autoselect(demuxer);
-}
-
// Result numerically higher => better match. 0 == no match.
static int match_lang(char **langs, char *lang)
{
@@ -1182,7 +1115,6 @@ goto_reopen_demuxer: ;
mpctx->demuxer = mpctx->timeline[0].source;
main_is_ok: ;
}
- add_dvd_tracks(mpctx);
add_demuxer_tracks(mpctx, mpctx->demuxer);
mpctx->timeline_part = 0;