diff options
Diffstat (limited to 'core')
-rw-r--r-- | core/command.c | 8 | ||||
-rw-r--r-- | core/mplayer.c | 57 | ||||
-rw-r--r-- | core/options.c | 13 | ||||
-rw-r--r-- | core/options.h | 1 | ||||
-rw-r--r-- | core/timeline/tl_cue.c | 12 | ||||
-rw-r--r-- | core/timeline/tl_edl.c | 3 | ||||
-rw-r--r-- | core/timeline/tl_matroska.c | 3 |
7 files changed, 33 insertions, 64 deletions
diff --git a/core/command.c b/core/command.c index 6056596d04..5a68a228bc 100644 --- a/core/command.c +++ b/core/command.c @@ -566,13 +566,13 @@ static int mp_property_angle(m_option_t *prop, int action, void *arg, case M_PROPERTY_SET: angle = demuxer_set_angle(demuxer, *(int *)arg); if (angle >= 0) { - struct sh_video *sh_video = demuxer->video->sh; + struct sh_stream *sh_video = demuxer->video->gsh; if (sh_video) - resync_video_stream(sh_video); + resync_video_stream(sh_video->video); - struct sh_audio *sh_audio = demuxer->audio->sh; + struct sh_stream *sh_audio = demuxer->audio->gsh; if (sh_audio) - resync_audio_stream(sh_audio); + resync_audio_stream(sh_audio->audio); } return M_PROPERTY_OK; case M_PROPERTY_GET_TYPE: { diff --git a/core/mplayer.c b/core/mplayer.c index 79626fdc80..019d37081d 100644 --- a/core/mplayer.c +++ b/core/mplayer.c @@ -375,7 +375,7 @@ static double get_main_demux_pts(struct MPContext *mpctx) if (mpctx->demuxer) { for (int type = 0; type < STREAM_TYPE_COUNT; type++) { struct demux_stream *ds = mpctx->demuxer->ds[type]; - if (ds->sh && main_new_pos == MP_NOPTS_VALUE) { + if (ds->gsh && main_new_pos == MP_NOPTS_VALUE) { demux_fill_buffer(mpctx->demuxer, ds); if (ds->first) main_new_pos = ds->first->pts; @@ -445,11 +445,11 @@ static void preselect_demux_streams(struct MPContext *mpctx) static void uninit_subs(struct demuxer *demuxer) { - for (int i = 0; i < MAX_S_STREAMS; i++) { - struct sh_sub *sh = demuxer->s_streams[i]; - if (sh) { - sub_destroy(sh->dec_sub); - sh->dec_sub = NULL; + for (int i = 0; i < demuxer->num_streams; i++) { + struct sh_stream *sh = demuxer->streams[i]; + if (sh->sub) { + sub_destroy(sh->sub->dec_sub); + sh->sub->dec_sub = NULL; } } } @@ -1938,9 +1938,6 @@ static void reinit_subs(struct MPContext *mpctx) // which makes the demuxer create the sh_stream, and contains the first // subtitle event. - // demux_mpg - maps IDs directly to the logical stream number - track->demuxer->sub->id = track->demuxer_id; - // demux_lavf - IDs are essentially random, have to use MPEG IDs int id = map_id_to_demuxer(track->demuxer, track->type, track->demuxer_id); @@ -2357,25 +2354,20 @@ int reinit_video_chain(struct MPContext *mpctx) goto no_video; } - if (!video_read_properties(mpctx->sh_video)) { - mp_tmsg(MSGT_CPLAYER, MSGL_ERR, "Video: Cannot read properties.\n"); - goto err_out; - } else { - mp_tmsg(MSGT_CPLAYER, MSGL_V, "[V] filefmt:%d fourcc:0x%X " - "size:%dx%d fps:%5.3f ftime:=%6.4f\n", - mpctx->master_demuxer->file_format, mpctx->sh_video->format, - mpctx->sh_video->disp_w, mpctx->sh_video->disp_h, - mpctx->sh_video->fps, mpctx->sh_video->frametime); - if (opts->force_fps) { - mpctx->sh_video->fps = opts->force_fps; - mpctx->sh_video->frametime = 1.0f / mpctx->sh_video->fps; - } - update_fps(mpctx); + mp_tmsg(MSGT_CPLAYER, MSGL_V, "[V] filefmt:%d fourcc:0x%X " + "size:%dx%d fps:%5.3f ftime:=%6.4f\n", + mpctx->master_demuxer->file_format, mpctx->sh_video->format, + mpctx->sh_video->disp_w, mpctx->sh_video->disp_h, + mpctx->sh_video->fps, mpctx->sh_video->frametime); + if (opts->force_fps) { + mpctx->sh_video->fps = opts->force_fps; + mpctx->sh_video->frametime = 1.0f / mpctx->sh_video->fps; + } + update_fps(mpctx); - if (!mpctx->sh_video->fps && !opts->force_fps && !opts->correct_pts) { - mp_tmsg(MSGT_CPLAYER, MSGL_ERR, "FPS not specified in the " - "header or invalid, use the -fps option.\n"); - } + if (!mpctx->sh_video->fps && !opts->force_fps && !opts->correct_pts) { + mp_tmsg(MSGT_CPLAYER, MSGL_ERR, "FPS not specified in the " + "header or invalid, use the -fps option.\n"); } double ar = -1.0; @@ -3898,20 +3890,12 @@ static struct track *open_external_file(struct MPContext *mpctx, char *filename, stream_enable_cache_percent(&stream, stream_cache, opts->stream_cache_min_percent, opts->stream_cache_seek_min_percent); - // deal with broken demuxers: preselect streams - int vs = -2, as = -2, ss = -2; - switch (filter) { - case STREAM_VIDEO: vs = -1; break; - case STREAM_AUDIO: as = -1; break; - case STREAM_SUB: ss = -1; break; - } - vs = -1; // avi can't go without video struct demuxer_params params = { .ass_library = mpctx->ass_library, // demux_libass requires it }; struct demuxer *demuxer = demux_open_withparams(&mpctx->opts, stream, format, demuxer_name, - as, vs, ss, filename, ¶ms); + filename, ¶ms); if (!demuxer) { free_stream(stream); goto err_out; @@ -4227,7 +4211,6 @@ goto_reopen_demuxer: ; mpctx->audio_delay = opts->audio_delay; mpctx->demuxer = demux_open(opts, mpctx->stream, file_format, - opts->audio_id, opts->video_id, opts->sub_id, mpctx->filename); mpctx->master_demuxer = mpctx->demuxer; diff --git a/core/options.c b/core/options.c index b00f79c003..c0e64b0dcd 100644 --- a/core/options.c +++ b/core/options.c @@ -25,6 +25,7 @@ #include <stddef.h> #include <sys/types.h> +#include <limits.h> #include "core/options.h" #include "config.h" @@ -369,12 +370,9 @@ const m_option_t mp_opts[] = { OPT_FLAG("pause", pause, 0), OPT_FLAG("keep-open", keep_open, 0), - // AVI specific: force non-interleaved mode - {"avi-ni", &force_ni, CONF_TYPE_FLAG, 0, 0, 1, NULL}, - // AVI and Ogg only: (re)build index at startup - {"idx", &index_mode, CONF_TYPE_FLAG, 0, -1, 1, NULL}, - {"forceidx", &index_mode, CONF_TYPE_FLAG, 0, -1, 2, NULL}, + OPT_FLAG_CONSTANTS("idx", index_mode, 0, -1, 1), + OPT_FLAG_STORE("forceidx", index_mode, 0, 2), // select audio/video/subtitle stream OPT_TRACKCHOICE("aid", audio_id), @@ -419,9 +417,6 @@ const m_option_t mp_opts[] = { // ------------------------- a-v sync options -------------------- - // AVI specific: A-V sync mode (bps vs. interleaving) - {"bps", &pts_from_bps, CONF_TYPE_FLAG, 0, 0, 1, NULL}, - // set A-V sync correction speed (0=disables it): OPT_FLOATRANGE("mc", default_max_pts_correction, 0, 0, 100), @@ -804,6 +799,8 @@ const struct MPOpts mp_default_opts = { .hwdec_codecs = "all", + .index_mode = -1, + .ad_lavc_param = { .ac3drc = 1., .downmix = 1, diff --git a/core/options.h b/core/options.h index 1eb111e33e..f7be4adb02 100644 --- a/core/options.h +++ b/core/options.h @@ -160,6 +160,7 @@ typedef struct MPOpts { char *screenshot_template; double force_fps; + int index_mode; // -1=untouched 0=don't use index 1=use (generate) index struct mp_chmap audio_output_channels; int audio_output_format; diff --git a/core/timeline/tl_cue.c b/core/timeline/tl_cue.c index d9160e0b8e..a965cfd877 100644 --- a/core/timeline/tl_cue.c +++ b/core/timeline/tl_cue.c @@ -192,11 +192,7 @@ static bool try_open(struct MPContext *mpctx, char *filename) struct stream *s = open_stream(filename, &mpctx->opts, &format); if (!s) return false; - struct demuxer *d = demux_open(&mpctx->opts, s, format, - mpctx->opts.audio_id, - mpctx->opts.video_id, - mpctx->opts.sub_id, - filename); + struct demuxer *d = demux_open(&mpctx->opts, s, format, filename); // Since .bin files are raw PCM data with no headers, we have to explicitly // open them. Also, try to avoid to open files that are most likely not .bin // files, as that would only play noise. Checking the file extension is @@ -205,11 +201,7 @@ static bool try_open(struct MPContext *mpctx, char *filename) // CD sector size (2352 bytes) if (!d && bstr_case_endswith(bfilename, bstr0(".bin"))) { mp_msg(MSGT_CPLAYER, MSGL_WARN, "CUE: Opening as BIN file!\n"); - d = demux_open(&mpctx->opts, s, DEMUXER_TYPE_RAWAUDIO, - mpctx->opts.audio_id, - mpctx->opts.video_id, - mpctx->opts.sub_id, - filename); + d = demux_open(&mpctx->opts, s, DEMUXER_TYPE_RAWAUDIO, filename); } if (d) { add_source(mpctx, d); diff --git a/core/timeline/tl_edl.c b/core/timeline/tl_edl.c index 5ec04ac716..0303956513 100644 --- a/core/timeline/tl_edl.c +++ b/core/timeline/tl_edl.c @@ -360,9 +360,6 @@ void build_edl_timeline(struct MPContext *mpctx) if (!s) goto openfail; struct demuxer *d = demux_open(&mpctx->opts, s, format, - mpctx->opts.audio_id, - mpctx->opts.video_id, - mpctx->opts.sub_id, edl_ids[i].filename); if (!d) { free_stream(s); diff --git a/core/timeline/tl_matroska.c b/core/timeline/tl_matroska.c index 11fcc67583..6752b5ff4c 100644 --- a/core/timeline/tl_matroska.c +++ b/core/timeline/tl_matroska.c @@ -117,8 +117,7 @@ static struct demuxer *open_demuxer(struct stream *stream, struct MPContext *mpctx, char *filename, struct demuxer_params *params) { return demux_open_withparams(&mpctx->opts, stream, - DEMUXER_TYPE_MATROSKA, NULL, mpctx->opts.audio_id, - mpctx->opts.video_id, mpctx->opts.sub_id, filename, params); + DEMUXER_TYPE_MATROSKA, NULL, filename, params); } static int enable_cache(struct MPContext *mpctx, struct stream **stream, |