1
0
mirror of https://github.com/mpv-player/mpv synced 2024-12-27 17:42:17 +00:00

command: add a video-dec-params property

This is the actual decoder output, with no overrides applied. (Maybe
video-params shouldn't contain the overrides in the first place, but
damage done.)
This commit is contained in:
wm4 2016-09-20 15:40:44 +02:00
parent 23639e5b0e
commit 89674854ce
4 changed files with 27 additions and 2 deletions

View File

@ -1438,6 +1438,9 @@ Property list
These have the same values as ``video-out-params/dw`` and
``video-out-params/dh``.
``video-dec-params``
Exactly like ``video-params``, but no overrides applied.
``video-out-params``
Same as ``video-params``, but after video filters have been applied. If
there are no video filters in use, this will contain the same values as

View File

@ -2615,6 +2615,19 @@ static int mp_property_vo_imgparams(void *ctx, struct m_property *prop,
return property_imgparams(get_video_out_params(ctx), action, arg);
}
static int mp_property_dec_imgparams(void *ctx, struct m_property *prop,
int action, void *arg)
{
MPContext *mpctx = ctx;
struct mp_image_params p = {0};
struct vo_chain *vo_c = mpctx->vo_chain;
if (vo_c && vo_c->video_src)
video_get_dec_params(vo_c->video_src, &p);
if (!p.imgfmt)
return M_PROPERTY_UNAVAILABLE;
return property_imgparams(p, action, arg);
}
static int mp_property_vd_imgparams(void *ctx, struct m_property *prop,
int action, void *arg)
{
@ -3855,6 +3868,7 @@ static const struct m_property mp_properties_base[] = {
{"video-output-levels", mp_property_video_color,
.priv = (void *)"output-levels"},
{"video-out-params", mp_property_vo_imgparams},
{"video-dec-params", mp_property_dec_imgparams},
{"video-params", mp_property_vd_imgparams},
{"video-format", mp_property_video_format},
{"video-frame-info", mp_property_video_frame_info},
@ -3992,7 +4006,8 @@ static const char *const *const mp_event_property_change[] = {
"video-format", "video-codec", "video-bitrate", "dwidth", "dheight",
"width", "height", "fps", "aspect", "vo-configured", "current-vo",
"detected-hwdec", "colormatrix", "colormatrix-input-range",
"colormatrix-output-range", "colormatrix-primaries", "video-aspect"),
"colormatrix-output-range", "colormatrix-primaries", "video-aspect",
"video-dec-params"),
E(MPV_EVENT_AUDIO_RECONFIG, "audio-format", "audio-codec", "audio-bitrate",
"samplerate", "channels", "audio", "volume", "mute", "balance",
"current-ao", "audio-codec-name", "audio-params",

View File

@ -192,6 +192,7 @@ static void fix_image_params(struct dec_video *d_video,
struct mp_codec_params *c = d_video->codec;
MP_VERBOSE(d_video, "Decoder format: %s\n", mp_image_params_to_str(params));
d_video->dec_format = *params;
// While mp_image_params normally always have to have d_w/d_h set, the
// decoder signals unknown bitstream aspect ratio with both set to 0.
@ -353,6 +354,11 @@ void video_reset_params(struct dec_video *d_video)
d_video->last_format = (struct mp_image_params){0};
}
void video_get_dec_params(struct dec_video *d_video, struct mp_image_params *p)
{
*p = d_video->dec_format;
}
void video_set_framedrop(struct dec_video *d_video, bool enabled)
{
d_video->framedrop_enabled = enabled;

View File

@ -65,7 +65,7 @@ struct dec_video {
// Final PTS of previously decoded image
double decoded_pts;
struct mp_image_params last_format, fixed_format;
struct mp_image_params dec_format, last_format, fixed_format;
float initial_decoder_aspect;
double start_pts;
@ -92,5 +92,6 @@ void video_set_start(struct dec_video *d_video, double start_pts);
int video_vd_control(struct dec_video *d_video, int cmd, void *arg);
void video_reset(struct dec_video *d_video);
void video_reset_params(struct dec_video *d_video);
void video_get_dec_params(struct dec_video *d_video, struct mp_image_params *p);
#endif /* MPLAYER_DEC_VIDEO_H */