summaryrefslogtreecommitdiffstats
path: root/player
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2016-02-29 20:55:44 +0100
committerwm4 <wm4@nowhere>2016-02-29 20:56:08 +0100
commit0a1e926670a5563df788f9c732a93e3230d86182 (patch)
tree1ca336f3893859fdd40aff32597484fcd136ed8c /player
parent041c9f1782cbed4abf7793f4e72b8b29b2fd9b1b (diff)
downloadmpv-0a1e926670a5563df788f9c732a93e3230d86182.tar.bz2
mpv-0a1e926670a5563df788f9c732a93e3230d86182.tar.xz
command: export more information under track-list
Export a number of container fields, which may or may not be useful in some scenarios. They are explicitly marked as originating from the demuxer, in order to make it explicit that they might be unreliable. I'd actually like to remove all other cases where container information is exported, but those numerous cases are going to be somewhat hard to deprecate. Also, not directly related, export the description of the currently active decoder. (This has been requested before.)
Diffstat (limited to 'player')
-rw-r--r--player/command.c24
1 files changed, 21 insertions, 3 deletions
diff --git a/player/command.c b/player/command.c
index 642330e34f..421f001573 100644
--- a/player/command.c
+++ b/player/command.c
@@ -1944,7 +1944,14 @@ static int get_track_entry(int item, int action, void *arg, void *ctx)
struct MPContext *mpctx = ctx;
struct track *track = mpctx->tracks[item];
- const char *codec = track->stream ? track->stream->codec->codec : NULL;
+ struct mp_codec_params p =
+ track->stream ? *track->stream->codec : (struct mp_codec_params){0};
+
+ const char *decoder_desc = NULL;
+ if (track->d_video)
+ decoder_desc = track->d_video->decoder_desc;
+ if (track->d_audio)
+ decoder_desc = track->d_audio->decoder_desc;
struct m_sub_property props[] = {
{"id", SUB_PROP_INT(track->user_tid)},
@@ -1965,9 +1972,20 @@ static int get_track_entry(int item, int action, void *arg, void *ctx)
{"selected", SUB_PROP_FLAG(track->selected)},
{"external-filename", SUB_PROP_STR(track->external_filename),
.unavailable = !track->external_filename},
- {"codec", SUB_PROP_STR(codec),
- .unavailable = !codec},
{"ff-index", SUB_PROP_INT(track->ff_index)},
+ {"decoder-desc", SUB_PROP_STR(decoder_desc),
+ .unavailable = !decoder_desc},
+ {"codec", SUB_PROP_STR(p.codec),
+ .unavailable = !p.codec},
+ {"demux-w", SUB_PROP_INT(p.disp_w), .unavailable = !p.disp_w},
+ {"demux-h", SUB_PROP_INT(p.disp_h), .unavailable = !p.disp_h},
+ {"demux-channel-count", SUB_PROP_INT(p.channels.num),
+ .unavailable = !p.channels.num},
+ {"demux-channels", SUB_PROP_STR(mp_chmap_to_str(&p.channels)),
+ .unavailable = !p.channels.num},
+ {"demux-samplerate", SUB_PROP_INT(p.samplerate),
+ .unavailable = !p.samplerate},
+ {"demux-fps", SUB_PROP_DOUBLE(p.fps), .unavailable = p.fps <= 0},
{0}
};