diff options
Diffstat (limited to 'core/mplayer.c')
-rw-r--r-- | core/mplayer.c | 39 |
1 files changed, 18 insertions, 21 deletions
diff --git a/core/mplayer.c b/core/mplayer.c index d38363b9ce..86260a0598 100644 --- a/core/mplayer.c +++ b/core/mplayer.c @@ -108,7 +108,6 @@ #ifdef CONFIG_DVBIN #include "stream/dvbin.h" #endif -#include "stream/cache2.h" //**************************************************************************// // Playtree @@ -137,10 +136,6 @@ #include "demux/demux.h" #include "demux/stheader.h" -#ifdef CONFIG_DVDREAD -#include "stream/stream_dvd.h" -#endif - #include "audio/filter/af.h" #include "audio/decode/dec_audio.h" #include "video/decode/dec_video.h" @@ -938,13 +933,13 @@ static int find_new_tid(struct MPContext *mpctx, enum stream_type t) // 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->type == STREAMTYPE_DVD && type == STREAM_SUB) + if (d->stream->uncached_type == STREAMTYPE_DVD && type == STREAM_SUB) id = id & 0x1F; return id; } static int map_id_to_demuxer(struct demuxer *d, enum stream_type type, int id) { - if (d->stream->type == STREAMTYPE_DVD && type == STREAM_SUB) + if (d->stream->uncached_type == STREAMTYPE_DVD && type == STREAM_SUB) id = id | 0x20; return id; } @@ -1013,9 +1008,9 @@ static void add_dvd_tracks(struct MPContext *mpctx) #ifdef CONFIG_DVDREAD struct demuxer *demuxer = mpctx->demuxer; struct stream *stream = demuxer->stream; - if (stream->type == STREAMTYPE_DVD) { - int n_subs = dvd_number_of_subs(stream); - for (int n = 0; n < n_subs; n++) { + struct stream_dvd_info_req info; + 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, @@ -1963,7 +1958,11 @@ static void set_dvdsub_fake_extradata(struct dec_sub *dec_sub, struct stream *st int width, int height) { #ifdef CONFIG_DVDREAD - if (st->type != STREAMTYPE_DVD) + if (!st) + return; + + struct stream_dvd_info_req info; + if (stream_control(st, STREAM_CTRL_GET_DVD_INFO, &info) < 0) return; struct mp_csp_params csp = MP_CSP_PARAMS_DEFAULTS; @@ -1972,8 +1971,6 @@ static void set_dvdsub_fake_extradata(struct dec_sub *dec_sub, struct stream *st float cmatrix[3][4]; mp_get_yuv2rgb_coeffs(&csp, cmatrix); - int *palette = ((dvd_priv_t *)st->priv)->cur_pgc->palette; - if (width == 0 || height == 0) { width = 720; height = 480; @@ -1983,7 +1980,7 @@ static void set_dvdsub_fake_extradata(struct dec_sub *dec_sub, struct stream *st s = talloc_asprintf_append(s, "size: %dx%d\n", width, height); s = talloc_asprintf_append(s, "palette: "); for (int i = 0; i < 16; i++) { - int color = palette[i]; + int color = info.palette[i]; int c[3] = {(color >> 16) & 0xff, (color >> 8) & 0xff, color & 0xff}; mp_map_int_color(cmatrix, 8, c); color = (c[2] << 16) | (c[1] << 8) | c[0]; @@ -3942,7 +3939,7 @@ static struct track *open_external_file(struct MPContext *mpctx, char *filename, struct stream *stream = open_stream(filename, &mpctx->opts, &format); if (!stream) goto err_out; - stream_enable_cache_percent(stream, stream_cache, + stream_enable_cache_percent(&stream, stream_cache, opts->stream_cache_min_percent, opts->stream_cache_seek_min_percent); // deal with broken demuxers: preselect streams @@ -4225,10 +4222,7 @@ static void play_current_file(struct MPContext *mpctx) } // CACHE2: initial prefill: 20% later: 5% (should be set by -cacheopts) -#ifdef CONFIG_DVBIN -goto_enable_cache: ; -#endif - int res = stream_enable_cache_percent(mpctx->stream, + int res = stream_enable_cache_percent(&mpctx->stream, opts->stream_cache_size, opts->stream_cache_min_percent, opts->stream_cache_seek_min_percent); @@ -4238,6 +4232,10 @@ goto_enable_cache: ; stream_set_capture_file(mpctx->stream, opts->stream_capture); +#ifdef CONFIG_DVBIN +goto_reopen_demuxer: ; +#endif + //============ Open DEMUXERS --- DETECT file type ======================= mpctx->audio_delay = opts->audio_delay; @@ -4424,9 +4422,8 @@ goto_enable_cache: ; if (mpctx->dvbin_reopen) { mpctx->stop_play = 0; uninit_player(mpctx, INITIALIZED_ALL - (INITIALIZED_STREAM | INITIALIZED_GETCH2 | (opts->fixed_vo ? INITIALIZED_VO : 0))); - cache_uninit(mpctx->stream); mpctx->dvbin_reopen = 0; - goto goto_enable_cache; + goto goto_reopen_demuxer; } #endif |