0
0
mirror of https://github.com/mpv-player/mpv.git synced 2024-09-19 19:42:24 +02:00

command: add dolby-vision-profile and dolby-vision-level to track-list

This commit is contained in:
Kacper Michajłow 2024-05-08 03:21:42 +02:00
parent c83c273400
commit aa3cf6d57b
6 changed files with 24 additions and 0 deletions

View File

@ -0,0 +1 @@
add `track-list/N/dolby-vision-profile` and `track-list/N/dolby-vision-level`

View File

@ -3185,6 +3185,10 @@ Property list
values currently. It's possible that future mpv versions will make
these properties unavailable instead in this case.
``track-list/N/dolby-vision-profile``, ``track-list/N/dolby-vision-level``
Dolby Vision profile and level. May not be available if the container
does not provide this information.
When querying the property with the client API using ``MPV_FORMAT_NODE``,
or with Lua ``mp.get_property_native``, this will return a mpv_node with
the following contents:
@ -3229,6 +3233,8 @@ Property list
"replaygain-track-gain" MPV_FORMAT_DOUBLE
"replaygain-album-peak" MPV_FORMAT_DOUBLE
"replaygain-album-gain" MPV_FORMAT_DOUBLE
"dolby-vision-profile" MPV_FORMAT_INT64
"dolby-vision-level" MPV_FORMAT_INT64
``current-tracks/...``
This gives access to currently selected tracks. It redirects to the correct

View File

@ -796,6 +796,9 @@ static void handle_new_stream(demuxer_t *demuxer, int i)
MP_VERBOSE(demuxer, "Found Dolby Vision config record: profile "
"%d level %d\n", cfg->dv_profile, cfg->dv_level);
av_format_inject_global_side_data(avfc);
sh->codec->dovi = true;
sh->codec->dv_profile = cfg->dv_profile;
sh->codec->dv_level = cfg->dv_level;
}
// This also applies to vfw-muxed mkv, but we can't detect these easily.

View File

@ -1687,6 +1687,12 @@ static int demux_mkv_open_video(demuxer_t *demuxer, mkv_track_t *track)
sh_v->rotate = rotate;
}
if (track->dovi_config) {
sh_v->dovi = true;
sh_v->dv_level = track->dovi_config->dv_level;
sh_v->dv_profile = track->dovi_config->dv_profile;
}
done:
demux_add_sh_stream(demuxer, sh);

View File

@ -121,6 +121,10 @@ struct mp_codec_params {
struct pl_color_repr repr; // color representaion info where available
struct mp_rect crop; // crop to be applied
bool dovi;
uint8_t dv_profile;
uint8_t dv_level;
// STREAM_VIDEO + STREAM_AUDIO
int bits_per_coded_sample;
char *format_name; // pixel format (video) or sample format (audio)

View File

@ -2079,6 +2079,10 @@ static int get_track_entry(int item, int action, void *arg, void *ctx)
.unavailable = !has_rg},
{"replaygain-album-gain", SUB_PROP_FLOAT(rg.album_gain),
.unavailable = !has_rg},
{"dolby-vision-profile", SUB_PROP_INT(p.dv_profile),
.unavailable = !p.dovi},
{"dolby-vision-level", SUB_PROP_INT(p.dv_level),
.unavailable = !p.dovi},
{0}
};