mirror of
https://github.com/mpv-player/mpv.git
synced 2025-12-28 05:33:14 +00:00
command: add track-list/N/audio-channels property
Signed-off-by: wm4 <wm4@nowhere> (With some heavy modifications from the original patch.)
This commit is contained in:
@@ -1861,6 +1861,12 @@ static int property_switch_track_ff(void *ctx, struct m_property *prop,
|
||||
return mp_property_generic_option(mpctx, prop, action, arg);
|
||||
}
|
||||
|
||||
static int track_channels(struct track *track)
|
||||
{
|
||||
return track->stream && track->stream->audio
|
||||
? track->stream->audio->channels.num : 0;
|
||||
}
|
||||
|
||||
static int get_track_entry(int item, int action, void *arg, void *ctx)
|
||||
{
|
||||
struct MPContext *mpctx = ctx;
|
||||
@@ -1878,6 +1884,8 @@ static int get_track_entry(int item, int action, void *arg, void *ctx)
|
||||
.unavailable = !track->title},
|
||||
{"lang", SUB_PROP_STR(track->lang),
|
||||
.unavailable = !track->lang},
|
||||
{"audio-channels", SUB_PROP_INT(track_channels(track)),
|
||||
.unavailable = track_channels(track) <= 0},
|
||||
{"albumart", SUB_PROP_FLAG(track->attached_picture)},
|
||||
{"default", SUB_PROP_FLAG(track->default_track)},
|
||||
{"forced", SUB_PROP_FLAG(track->forced_track)},
|
||||
|
||||
Reference in New Issue
Block a user