From 5053f4cc3f48538c3d9a3ba13dc98442f3302052 Mon Sep 17 00:00:00 2001 From: wm4 Date: Mon, 18 Jan 2016 20:10:28 +0100 Subject: command: fix NULL pointer deref in "video-codec" property Fixes #2729. --- player/command.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'player/command.c') diff --git a/player/command.c b/player/command.c index 3c7cfb282d..413349dce3 100644 --- a/player/command.c +++ b/player/command.c @@ -2438,7 +2438,7 @@ static int mp_property_video_codec(void *ctx, struct m_property *prop, { MPContext *mpctx = ctx; struct track *track = mpctx->current_track[0][STREAM_VIDEO]; - const char *c = track->d_video ? track->d_video->decoder_desc : NULL; + const char *c = track && track->d_video ? track->d_video->decoder_desc : NULL; return m_property_strdup_ro(action, arg, c); } -- cgit v1.2.3 From fef8b7984be5a6244612d346bd60d2badd4a2e63 Mon Sep 17 00:00:00 2001 From: wm4 Date: Thu, 21 Jan 2016 22:10:15 +0100 Subject: audio: refactor: work towards unentangling audio decoding and filtering Similar to the video path. dec_audio.c now handles decoding only. It also looks very similar to dec_video.c, and actually contains some of the rewritten code from it. (A further goal might be unifying the decoders, I guess.) High potential for regressions. --- player/command.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'player/command.c') diff --git a/player/command.c b/player/command.c index 413349dce3..52f0b1830f 100644 --- a/player/command.c +++ b/player/command.c @@ -1242,9 +1242,9 @@ static int mp_property_filter_metadata(void *ctx, struct m_property *prop, struct vf_chain *vf = mpctx->vo_chain->vf; res = vf_control_by_label(vf, VFCTRL_GET_METADATA, &metadata, key); } else if (strcmp(type, "af") == 0) { - if (!(mpctx->d_audio && mpctx->d_audio->afilter)) + if (!(mpctx->ao_chain && mpctx->ao_chain->af)) return M_PROPERTY_UNAVAILABLE; - struct af_stream *af = mpctx->d_audio->afilter; + struct af_stream *af = mpctx->ao_chain->af; res = af_control_by_label(af, AF_CONTROL_GET_METADATA, &metadata, key); } switch (res) { @@ -1751,8 +1751,8 @@ static int mp_property_audio_params(void *ctx, struct m_property *prop, { MPContext *mpctx = ctx; struct mp_audio fmt = {0}; - if (mpctx->d_audio) - fmt = mpctx->d_audio->decode_format; + if (mpctx->ao_chain) + fmt = mpctx->ao_chain->input_format; return property_audiofmt(fmt, action, arg); } -- cgit v1.2.3 From 7bb9203f7fec1ad4e40a7ae58d68b604c0a4565e Mon Sep 17 00:00:00 2001 From: wm4 Date: Thu, 21 Jan 2016 22:24:20 +0100 Subject: player: refactor: eliminate MPContext.d_audio --- player/command.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'player/command.c') diff --git a/player/command.c b/player/command.c index 52f0b1830f..5be8c2d120 100644 --- a/player/command.c +++ b/player/command.c @@ -536,7 +536,7 @@ static int mp_property_avsync(void *ctx, struct m_property *prop, int action, void *arg) { MPContext *mpctx = ctx; - if (!mpctx->d_audio || !mpctx->vo_chain) + if (!mpctx->ao_chain || !mpctx->vo_chain) return M_PROPERTY_UNAVAILABLE; if (action == M_PROPERTY_PRINT) { *(char **)arg = talloc_asprintf(NULL, "%7.3f", mpctx->last_av_difference); @@ -549,7 +549,7 @@ static int mp_property_total_avsync_change(void *ctx, struct m_property *prop, int action, void *arg) { MPContext *mpctx = ctx; - if (!mpctx->d_audio || !mpctx->vo_chain) + if (!mpctx->ao_chain || !mpctx->vo_chain) return M_PROPERTY_UNAVAILABLE; if (mpctx->total_avsync_change == MP_NOPTS_VALUE) return M_PROPERTY_UNAVAILABLE; @@ -1696,7 +1696,7 @@ static int mp_property_audio_delay(void *ctx, struct m_property *prop, int action, void *arg) { MPContext *mpctx = ctx; - if (!(mpctx->d_audio && mpctx->vo_chain)) + if (!(mpctx->ao_chain && mpctx->vo_chain)) return M_PROPERTY_UNAVAILABLE; float delay = mpctx->opts->audio_delay; switch (action) { @@ -1716,7 +1716,8 @@ static int mp_property_audio_codec_name(void *ctx, struct m_property *prop, int action, void *arg) { MPContext *mpctx = ctx; - const char *c = mpctx->d_audio ? mpctx->d_audio->header->codec->codec : NULL; + struct track *track = mpctx->current_track[0][STREAM_AUDIO]; + const char *c = track && track->stream ? track->stream->codec->codec : NULL; return m_property_strdup_ro(action, arg, c); } @@ -1725,7 +1726,8 @@ static int mp_property_audio_codec(void *ctx, struct m_property *prop, int action, void *arg) { MPContext *mpctx = ctx; - const char *c = mpctx->d_audio ? mpctx->d_audio->decoder_desc : NULL; + struct track *track = mpctx->current_track[0][STREAM_AUDIO]; + const char *c = track && track->d_audio ? track->d_audio->decoder_desc : NULL; return m_property_strdup_ro(action, arg, c); } -- cgit v1.2.3 From 135a7217b92c0b1c29ea40ab405566e72d23ae4b Mon Sep 17 00:00:00 2001 From: wm4 Date: Fri, 22 Jan 2016 16:18:28 +0100 Subject: command: add vf-command command --- player/command.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'player/command.c') diff --git a/player/command.c b/player/command.c index 5be8c2d120..7bcdffc1c4 100644 --- a/player/command.c +++ b/player/command.c @@ -4931,6 +4931,12 @@ int run_command(struct MPContext *mpctx, struct mp_cmd *cmd, struct mpv_node *re return edit_filters_osd(mpctx, STREAM_VIDEO, cmd->args[0].v.s, cmd->args[1].v.s, msg_osd); + case MP_CMD_VF_COMMAND: + if (!mpctx->vo_chain) + return -1; + return vf_send_command(mpctx->vo_chain->vf, cmd->args[0].v.s, + cmd->args[1].v.s, cmd->args[2].v.s); + case MP_CMD_SCRIPT_BINDING: { mpv_event_client_message event = {0}; char *name = cmd->args[0].v.s; -- cgit v1.2.3 From f176104ed5c7be37f4f0756b7244cbb90c4fe1fe Mon Sep 17 00:00:00 2001 From: wm4 Date: Fri, 22 Jan 2016 20:36:54 +0100 Subject: command: add af-command command Similar to vf-command. Requested. Untested. --- player/command.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'player/command.c') diff --git a/player/command.c b/player/command.c index 7bcdffc1c4..d5cccd2474 100644 --- a/player/command.c +++ b/player/command.c @@ -4937,6 +4937,12 @@ int run_command(struct MPContext *mpctx, struct mp_cmd *cmd, struct mpv_node *re return vf_send_command(mpctx->vo_chain->vf, cmd->args[0].v.s, cmd->args[1].v.s, cmd->args[2].v.s); + case MP_CMD_AF_COMMAND: + if (!mpctx->ao_chain) + return -1; + return af_send_command(mpctx->ao_chain->af, cmd->args[0].v.s, + cmd->args[1].v.s, cmd->args[2].v.s); + case MP_CMD_SCRIPT_BINDING: { mpv_event_client_message event = {0}; char *name = cmd->args[0].v.s; -- cgit v1.2.3 From d8aeeaa4b15e9adbbd021614848c40d4ff264124 Mon Sep 17 00:00:00 2001 From: wm4 Date: Tue, 26 Jan 2016 15:12:42 +0100 Subject: command: always allow setting volume/mute properties This seems generally easier when using libmpv (and was already requested and implemented before: see commit 327a779a; it was reverted some time later). With the weird internal logic we have to deal with, in particular the --softvol=no case (using system volume), and using the audio API's mixer (--softvol=auto on some systems), we still can't avoid all glitches and corner cases that complicate this issue so much. The API user is either recommended to use --softvol=yes or auto, or to watch the new mixer-active property, and assume the volume/mute properties have significant values if the mixer is active. Remaining glitches: - changing the volume/mute properties has no effect if no internal mixer is used (--softvol=no) and the mixer is not active; the actual mixer controls do not change, only the property values - --volume/--mute do not have an effect on the volume/mute properties before mixer initialization (the options strictly are only applied during mixer init) - volume-max is 100 while the mixer is not active --- player/command.c | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) (limited to 'player/command.c') diff --git a/player/command.c b/player/command.c index d5cccd2474..848905da32 100644 --- a/player/command.c +++ b/player/command.c @@ -1538,13 +1538,18 @@ static int mp_property_partially_seekable(void *ctx, struct m_property *prop, return m_property_flag_ro(action, arg, mpctx->demuxer->partially_seekable); } +static int mp_property_mixer_active(void *ctx, struct m_property *prop, + int action, void *arg) +{ + MPContext *mpctx = ctx; + return m_property_flag_ro(action, arg, mixer_audio_initialized(mpctx->mixer)); +} + /// Volume (RW) static int mp_property_volume(void *ctx, struct m_property *prop, int action, void *arg) { MPContext *mpctx = ctx; - if (!mixer_audio_initialized(mpctx->mixer)) - return M_PROPERTY_UNAVAILABLE; switch (action) { case M_PROPERTY_GET: mixer_getbothvolume(mpctx->mixer, arg); @@ -1578,13 +1583,18 @@ static int mp_property_volume(void *ctx, struct m_property *prop, return M_PROPERTY_NOT_IMPLEMENTED; } +static int mp_property_volume_max(void *ctx, struct m_property *prop, + int action, void *arg) +{ + MPContext *mpctx = ctx; + return m_property_float_ro(action, arg, mixer_getmaxvolume(mpctx->mixer)); +} + /// Mute (RW) static int mp_property_mute(void *ctx, struct m_property *prop, int action, void *arg) { MPContext *mpctx = ctx; - if (!mixer_audio_initialized(mpctx->mixer)) - return M_PROPERTY_ERROR; switch (action) { case M_PROPERTY_SET: mixer_setmute(mpctx->mixer, *(int *) arg); @@ -3553,7 +3563,9 @@ static const struct m_property mp_properties[] = { M_PROPERTY_ALIAS("playlist-count", "playlist/count"), // Audio + {"mixer-active", mp_property_mixer_active}, {"volume", mp_property_volume}, + {"volume-max", mp_property_volume_max}, {"mute", mp_property_mute}, {"audio-delay", mp_property_audio_delay}, {"audio-codec-name", mp_property_audio_codec_name}, @@ -3734,7 +3746,7 @@ static const char *const *const mp_event_property_change[] = { E(MPV_EVENT_AUDIO_RECONFIG, "audio-format", "audio-codec", "audio-bitrate", "samplerate", "channels", "audio", "volume", "mute", "balance", "volume-restore-data", "current-ao", "audio-codec-name", "audio-params", - "audio-out-params"), + "audio-out-params", "volume-max", "mixer-active"), E(MPV_EVENT_SEEK, "seeking", "core-idle", "eof-reached"), E(MPV_EVENT_PLAYBACK_RESTART, "seeking", "core-idle", "eof-reached"), E(MPV_EVENT_METADATA_UPDATE, "metadata", "filtered-metadata", "media-title"), -- cgit v1.2.3 From a8dd0abb6d72e271384b2dde3026bb545a12b730 Mon Sep 17 00:00:00 2001 From: wm4 Date: Fri, 29 Jan 2016 22:47:27 +0100 Subject: vd_lavc: allow switching between hw/sw decoding any time We just need to provide an entrypoint for it, and move the main init code to a separate function. This gets rid of the messy video chain full reinit in command.c, which completely destroyed and recreated the video state for the purpose of mid-stream hw/sw switching. --- player/command.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'player/command.c') diff --git a/player/command.c b/player/command.c index 848905da32..fd793c87c9 100644 --- a/player/command.c +++ b/player/command.c @@ -2131,9 +2131,8 @@ static int mp_property_hwdec(void *ctx, struct m_property *prop, int current = -2; video_vd_control(vd, VDCTRL_GET_HWDEC, ¤t); if (current != opts->hwdec_api) { + video_vd_control(vd, VDCTRL_REINIT, NULL); double last_pts = mpctx->last_vo_pts; - uninit_video_chain(mpctx); - reinit_video_chain(mpctx); if (last_pts != MP_NOPTS_VALUE) queue_seek(mpctx, MPSEEK_ABSOLUTE, last_pts, MPSEEK_EXACT, true); } -- cgit v1.2.3 From a0804329927904fdeb70d9712ff23baaab161bb4 Mon Sep 17 00:00:00 2001 From: wm4 Date: Mon, 1 Feb 2016 22:28:47 +0100 Subject: player: refactor: reduce some dependencies on current_track Don't mind me. --- player/command.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'player/command.c') diff --git a/player/command.c b/player/command.c index fd793c87c9..c753a42c97 100644 --- a/player/command.c +++ b/player/command.c @@ -1831,11 +1831,7 @@ static struct track* track_next(struct MPContext *mpctx, int order, struct track *cur = mpctx->tracks[n]; // One track can be selected only one time - pretend already selected // tracks don't exist. - for (int r = 0; r < NUM_PTRACKS; r++) { - if (r != order && mpctx->current_track[r][type] == cur) - cur = NULL; - } - if (!cur) + if (cur->selected) continue; if (cur->type == type) { if (cur == track) { @@ -2518,9 +2514,9 @@ static int mp_property_vd_imgparams(void *ctx, struct m_property *prop, { MPContext *mpctx = ctx; struct vo_chain *vo_c = mpctx->vo_chain; - struct track *track = mpctx->current_track[0][STREAM_VIDEO]; - if (!vo_c || !track) + if (!vo_c) return M_PROPERTY_UNAVAILABLE; + struct track *track = mpctx->current_track[0][STREAM_VIDEO]; struct mp_codec_params *c = track && track->stream ? track->stream->codec : NULL; if (vo_c->vf->input_params.imgfmt) { -- cgit v1.2.3 From 5d949774775f0daa270e67d53def647877494fa7 Mon Sep 17 00:00:00 2001 From: wm4 Date: Tue, 2 Feb 2016 22:12:24 +0100 Subject: command: show original aspect in video-aspect property too Basically, just make it append " (original)" if the original aspect ratio is selected. --- player/command.c | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) (limited to 'player/command.c') diff --git a/player/command.c b/player/command.c index c753a42c97..aff1b578e7 100644 --- a/player/command.c +++ b/player/command.c @@ -2772,10 +2772,27 @@ static int mp_property_aspect(void *ctx, struct m_property *prop, int action, void *arg) { MPContext *mpctx = ctx; + + float aspect = mpctx->opts->movie_aspect; + if (mpctx->vo_chain && aspect <= 0) { + struct mp_image_params *params = &mpctx->vo_chain->vf->input_params; + if (params && params->p_w > 0 && params->p_h > 0) { + int d_w, d_h; + mp_image_params_get_dsize(params, &d_w, &d_h); + aspect = (float)d_w / d_h; + } + } + struct track *track = mpctx->current_track[0][STREAM_VIDEO]; + if (track && track->d_video && aspect <= 0) { + struct dec_video *d_video = track->d_video; + struct mp_codec_params *c = d_video->header->codec; + if (c->disp_w && c->disp_h) + aspect = (float)c->disp_w / c->disp_h; + } + switch (action) { case M_PROPERTY_SET: { mpctx->opts->movie_aspect = *(float *)arg; - struct track *track = mpctx->current_track[0][STREAM_VIDEO]; if (track && track->d_video) { video_reset_aspect(track->d_video); mp_force_video_refresh(mpctx); @@ -2784,26 +2801,12 @@ static int mp_property_aspect(void *ctx, struct m_property *prop, } case M_PROPERTY_PRINT: { if (mpctx->opts->movie_aspect <= 0) { - *(char **)arg = talloc_strdup(NULL, "(original)"); + *(char **)arg = talloc_asprintf(NULL, "%.3f (original)", aspect); return M_PROPERTY_OK; } break; } case M_PROPERTY_GET: { - float aspect = mpctx->opts->movie_aspect; - struct track *track = mpctx->current_track[0][STREAM_VIDEO]; - if (track && track->d_video && mpctx->vo_chain && aspect <= 0) { - struct dec_video *d_video = track->d_video; - struct mp_codec_params *c = d_video->header->codec; - struct mp_image_params *params = &mpctx->vo_chain->vf->input_params; - if (params && params->p_w > 0 && params->p_h > 0) { - int d_w, d_h; - mp_image_params_get_dsize(params, &d_w, &d_h); - aspect = (float)d_w / d_h; - } else if (c->disp_w && c->disp_h) { - aspect = (float)c->disp_w / c->disp_h; - } - } *(float *)arg = aspect; return M_PROPERTY_OK; } -- cgit v1.2.3 From 35bdb63952b50b634121ee49446294861766e72d Mon Sep 17 00:00:00 2001 From: wm4 Date: Wed, 3 Feb 2016 09:05:05 +0100 Subject: command: fix track cycling logic Also remove the unused function argument. Fixes #2784. --- player/command.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) (limited to 'player/command.c') diff --git a/player/command.c b/player/command.c index aff1b578e7..52718d60ae 100644 --- a/player/command.c +++ b/player/command.c @@ -1820,23 +1820,18 @@ static int mp_property_balance(void *ctx, struct m_property *prop, return M_PROPERTY_NOT_IMPLEMENTED; } -static struct track* track_next(struct MPContext *mpctx, int order, - enum stream_type type, int direction, - struct track *track) +static struct track* track_next(struct MPContext *mpctx, enum stream_type type, + int direction, struct track *track) { assert(direction == -1 || direction == +1); struct track *prev = NULL, *next = NULL; bool seen = track == NULL; for (int n = 0; n < mpctx->num_tracks; n++) { struct track *cur = mpctx->tracks[n]; - // One track can be selected only one time - pretend already selected - // tracks don't exist. - if (cur->selected) - continue; if (cur->type == type) { if (cur == track) { seen = true; - } else { + } else if (!cur->selected) { if (seen && !next) { next = cur; } @@ -1885,7 +1880,7 @@ static int property_switch_track(struct m_property *prop, int action, void *arg, return M_PROPERTY_ERROR; struct m_property_switch_arg *sarg = arg; mp_switch_track_n(mpctx, order, type, - track_next(mpctx, order, type, sarg->inc >= 0 ? +1 : -1, track), + track_next(mpctx, type, sarg->inc >= 0 ? +1 : -1, track), FLAG_MARK_SELECTION); print_track_list(mpctx, "Track switched:"); return M_PROPERTY_OK; -- cgit v1.2.3 From 155f7fac9dd8d756656a05376da9495e1348daad Mon Sep 17 00:00:00 2001 From: wm4 Date: Thu, 4 Feb 2016 22:44:18 +0100 Subject: sub: implement "sub-seek 0" For bitmap subs, implement it properly. For libass, you need newest git master. Fixes #2791. --- player/command.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'player/command.c') diff --git a/player/command.c b/player/command.c index 52718d60ae..c95e7d1315 100644 --- a/player/command.c +++ b/player/command.c @@ -4588,7 +4588,7 @@ int run_command(struct MPContext *mpctx, struct mp_cmd *cmd, struct mpv_node *re // frame which actually shows the sub first (because video // frame PTS and sub PTS rarely match exactly). Add some // rounding for the mess of it. - a[0] += 0.01 * (a[1] > 0 ? 1 : -1); + a[0] += 0.01 * (a[1] >= 0 ? 1 : -1); mark_seek(mpctx); queue_seek(mpctx, MPSEEK_RELATIVE, a[0], MPSEEK_EXACT, false); set_osd_function(mpctx, (a[0] > 0) ? OSD_FFW : OSD_REW); -- cgit v1.2.3 From b4f63cbbec563e46ef01899b7292e301e961ec1d Mon Sep 17 00:00:00 2001 From: wm4 Date: Thu, 4 Feb 2016 23:01:15 +0100 Subject: input: ignore --input-cursor for events injected by input commands Apparently useful for window embedding. Fixes #2750. --- player/command.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'player/command.c') diff --git a/player/command.c b/player/command.c index c95e7d1315..997d60591c 100644 --- a/player/command.c +++ b/player/command.c @@ -5046,7 +5046,7 @@ int run_command(struct MPContext *mpctx, struct mp_cmd *cmd, struct mpv_node *re const int x = cmd->args[0].v.i, y = cmd->args[1].v.i; int button = cmd->args[2].v.i; if (button == -1) {// no button - mp_input_set_mouse_pos(mpctx->input, x, y); + mp_input_set_mouse_pos_artificial(mpctx->input, x, y); break; } if (button < 0 || button >= 20) {// invalid button @@ -5055,8 +5055,8 @@ int run_command(struct MPContext *mpctx, struct mp_cmd *cmd, struct mpv_node *re } const bool dbc = cmd->args[3].v.i; button += dbc ? MP_MOUSE_BASE_DBL : MP_MOUSE_BASE; - mp_input_set_mouse_pos(mpctx->input, x, y); - mp_input_put_key(mpctx->input, button); + mp_input_set_mouse_pos_artificial(mpctx->input, x, y); + mp_input_put_key_artificial(mpctx->input, button); break; } @@ -5071,21 +5071,21 @@ int run_command(struct MPContext *mpctx, struct mp_cmd *cmd, struct mpv_node *re if (cmd->id == MP_CMD_KEYDOWN) code |= MP_KEY_STATE_DOWN; - mp_input_put_key(mpctx->input, code); + mp_input_put_key_artificial(mpctx->input, code); break; } case MP_CMD_KEYUP: { const char *key_name = cmd->args[0].v.s; if (key_name[0] == '\0') { - mp_input_put_key(mpctx->input, MP_INPUT_RELEASE_ALL); + mp_input_put_key_artificial(mpctx->input, MP_INPUT_RELEASE_ALL); } else { int code = mp_input_get_key_from_name(key_name); if (code < 0) { MP_ERR(mpctx, "%s is not a valid input name.\n", key_name); return -1; } - mp_input_put_key(mpctx->input, code | MP_KEY_STATE_UP); + mp_input_put_key_artificial(mpctx->input, code | MP_KEY_STATE_UP); } break; } -- cgit v1.2.3 From b7f6dfc19ad1a051a8365c055c2a9629cb2341b4 Mon Sep 17 00:00:00 2001 From: wm4 Date: Tue, 9 Feb 2016 22:19:01 +0100 Subject: player: force refresh seek when changing audio filters Unfortunately I see no better solution. The refresh seek is skipped if the amount of buffered audio is not overly huge. Unfortunately softvol af_volume insertion still can cause this issue, because it's outside of the normal dynamic filter chain changing code. Move the video refresh call to reinit_video_filters() to make it more uniform along with the audio code. --- player/command.c | 3 --- 1 file changed, 3 deletions(-) (limited to 'player/command.c') diff --git a/player/command.c b/player/command.c index 997d60591c..96f9dd0819 100644 --- a/player/command.c +++ b/player/command.c @@ -4044,9 +4044,6 @@ static int set_filters(struct MPContext *mpctx, enum stream_type mediatype, reinit_filters(mpctx, mediatype); } - if (mediatype == STREAM_VIDEO) - mp_force_video_refresh(mpctx); - return success ? 0 : -1; } -- cgit v1.2.3 From ae55896f42329b29619bcf4ade6bb83c6940a0f8 Mon Sep 17 00:00:00 2001 From: wm4 Date: Mon, 15 Feb 2016 21:03:51 +0100 Subject: player: remove old timeline/ordered chapters support --- player/command.c | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) (limited to 'player/command.c') diff --git a/player/command.c b/player/command.c index 96f9dd0819..c6ba268dbf 100644 --- a/player/command.c +++ b/player/command.c @@ -390,14 +390,14 @@ static int mp_property_media_title(void *ctx, struct m_property *prop, name = mpctx->opts->media_title; if (name && name[0]) return m_property_strdup_ro(action, arg, name); - if (mpctx->master_demuxer) { - name = mp_tags_get_str(mpctx->master_demuxer->metadata, "service_name"); + if (mpctx->demuxer) { + name = mp_tags_get_str(mpctx->demuxer->metadata, "service_name"); if (name && name[0]) return m_property_strdup_ro(action, arg, name); - name = mp_tags_get_str(mpctx->master_demuxer->metadata, "title"); + name = mp_tags_get_str(mpctx->demuxer->metadata, "title"); if (name && name[0]) return m_property_strdup_ro(action, arg, name); - name = mp_tags_get_str(mpctx->master_demuxer->metadata, "icy-title"); + name = mp_tags_get_str(mpctx->demuxer->metadata, "icy-title"); if (name && name[0]) return m_property_strdup_ro(action, arg, name); } @@ -439,7 +439,7 @@ static int mp_property_demuxer(void *ctx, struct m_property *prop, int action, void *arg) { MPContext *mpctx = ctx; - struct demuxer *demuxer = mpctx->master_demuxer; + struct demuxer *demuxer = mpctx->demuxer; if (!demuxer) return M_PROPERTY_UNAVAILABLE; return m_property_strdup_ro(action, arg, demuxer->desc->name); @@ -449,7 +449,7 @@ static int mp_property_file_format(void *ctx, struct m_property *prop, int action, void *arg) { MPContext *mpctx = ctx; - struct demuxer *demuxer = mpctx->master_demuxer; + struct demuxer *demuxer = mpctx->demuxer; if (!demuxer) return M_PROPERTY_UNAVAILABLE; const char *name = demuxer->filetype ? demuxer->filetype : demuxer->desc->name; @@ -734,7 +734,7 @@ static int mp_property_disc_title(void *ctx, struct m_property *prop, int action, void *arg) { MPContext *mpctx = ctx; - struct demuxer *d = mpctx->master_demuxer; + struct demuxer *d = mpctx->demuxer; if (!d) return M_PROPERTY_UNAVAILABLE; unsigned int title = -1; @@ -887,7 +887,7 @@ static int mp_property_edition(void *ctx, struct m_property *prop, { MPContext *mpctx = ctx; struct MPOpts *opts = mpctx->opts; - struct demuxer *demuxer = mpctx->master_demuxer; + struct demuxer *demuxer = mpctx->demuxer; if (!demuxer) return M_PROPERTY_UNAVAILABLE; if (demuxer->num_editions <= 0) @@ -926,7 +926,7 @@ static int get_edition_entry(int item, int action, void *arg, void *ctx) { struct MPContext *mpctx = ctx; - struct demuxer *demuxer = mpctx->master_demuxer; + struct demuxer *demuxer = mpctx->demuxer; struct demux_edition *ed = &demuxer->editions[item]; char *title = mp_tags_get_str(ed->metadata, "title"); @@ -946,7 +946,7 @@ static int property_list_editions(void *ctx, struct m_property *prop, int action, void *arg) { MPContext *mpctx = ctx; - struct demuxer *demuxer = mpctx->master_demuxer; + struct demuxer *demuxer = mpctx->demuxer; if (!demuxer) return M_PROPERTY_UNAVAILABLE; @@ -987,7 +987,7 @@ static int mp_property_disc_titles(void *ctx, struct m_property *prop, int action, void *arg) { MPContext *mpctx = ctx; - struct demuxer *demuxer = mpctx->master_demuxer; + struct demuxer *demuxer = mpctx->demuxer; unsigned int num_titles; if (!demuxer || demux_stream_control(demuxer, STREAM_CTRL_GET_NUM_TITLES, &num_titles) < 1) @@ -998,7 +998,7 @@ static int mp_property_disc_titles(void *ctx, struct m_property *prop, static int get_disc_title_entry(int item, int action, void *arg, void *ctx) { struct MPContext *mpctx = ctx; - struct demuxer *demuxer = mpctx->master_demuxer; + struct demuxer *demuxer = mpctx->demuxer; double len = item; if (demux_stream_control(demuxer, STREAM_CTRL_GET_TITLE_LENGTH, &len) < 1) @@ -1018,7 +1018,7 @@ static int mp_property_list_disc_titles(void *ctx, struct m_property *prop, int action, void *arg) { MPContext *mpctx = ctx; - struct demuxer *demuxer = mpctx->master_demuxer; + struct demuxer *demuxer = mpctx->demuxer; unsigned int num_titles; if (!demuxer || demux_stream_control(demuxer, STREAM_CTRL_GET_NUM_TITLES, &num_titles) < 1) @@ -1042,7 +1042,7 @@ static int mp_property_editions(void *ctx, struct m_property *prop, int action, void *arg) { MPContext *mpctx = ctx; - struct demuxer *demuxer = mpctx->master_demuxer; + struct demuxer *demuxer = mpctx->demuxer; if (!demuxer) return M_PROPERTY_UNAVAILABLE; if (demuxer->num_editions <= 0) @@ -1055,7 +1055,7 @@ static int mp_property_angle(void *ctx, struct m_property *prop, int action, void *arg) { MPContext *mpctx = ctx; - struct demuxer *demuxer = mpctx->master_demuxer; + struct demuxer *demuxer = mpctx->demuxer; if (!demuxer) return M_PROPERTY_UNAVAILABLE; @@ -1196,7 +1196,7 @@ static int mp_property_metadata(void *ctx, struct m_property *prop, int action, void *arg) { MPContext *mpctx = ctx; - struct demuxer *demuxer = mpctx->master_demuxer; + struct demuxer *demuxer = mpctx->demuxer; if (!demuxer) return M_PROPERTY_UNAVAILABLE; @@ -2016,7 +2016,7 @@ static int property_list_tracks(void *ctx, struct m_property *prop, res = talloc_asprintf_append(res, "\n"); } - struct demuxer *demuxer = mpctx->master_demuxer; + struct demuxer *demuxer = mpctx->demuxer; if (demuxer && demuxer->num_editions > 1) res = talloc_asprintf_append(res, "\nEdition: %d of %d\n", demuxer->edition + 1, @@ -2061,7 +2061,7 @@ static int mp_property_program(void *ctx, struct m_property *prop, MPContext *mpctx = ctx; demux_program_t prog; - struct demuxer *demuxer = mpctx->master_demuxer; + struct demuxer *demuxer = mpctx->demuxer; if (!demuxer) return M_PROPERTY_UNAVAILABLE; -- cgit v1.2.3 From b5f620ae75f964c01e5c0fc983e6d5af9f452750 Mon Sep 17 00:00:00 2001 From: wm4 Date: Tue, 23 Feb 2016 22:15:10 +0100 Subject: player: remove unused MPContext.stream field It was just dead code. Also fixes the stream-open-filename property, which is supposed to be read-only if a file was already opened. --- player/command.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'player/command.c') diff --git a/player/command.c b/player/command.c index c6ba268dbf..642330e34f 100644 --- a/player/command.c +++ b/player/command.c @@ -350,7 +350,7 @@ static int mp_property_stream_open_filename(void *ctx, struct m_property *prop, return M_PROPERTY_UNAVAILABLE; switch (action) { case M_PROPERTY_SET: { - if (mpctx->stream) + if (mpctx->demuxer) return M_PROPERTY_ERROR; mpctx->stream_open_filename = talloc_strdup(mpctx->stream_open_filename, *(char **)arg); -- cgit v1.2.3