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:
deuiore
2015-07-03 02:33:54 +02:00
committed by wm4
parent fb8d158366
commit 7984fde8de
3 changed files with 14 additions and 0 deletions

View File

@@ -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)},