mirror of
https://github.com/mpv-player/mpv
synced 2025-02-18 05:37:04 +00:00
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.)
This commit is contained in:
parent
041c9f1782
commit
0a1e926670
@ -19,6 +19,9 @@ Interface changes
|
||||
|
||||
::
|
||||
|
||||
--- mpv 0.17.0 ---
|
||||
- deprecate "track-list/N/audio-channels" property (use
|
||||
"track-list/N/demux-channel-count" instead)
|
||||
--- mpv 0.16.0 ---
|
||||
- change --audio-channels default to stereo (use --audio-channels=auto to
|
||||
get the old default)
|
||||
|
@ -1707,10 +1707,6 @@ Property list
|
||||
``track-list/N/lang``
|
||||
Track language as identified by the file. Not always available.
|
||||
|
||||
``track-list/N/audio-channels``
|
||||
For audio tracks, the number of audio channels in the audio stream.
|
||||
Not always accurate (depends on container hints). Not always available.
|
||||
|
||||
``track-list/N/albumart``
|
||||
``yes`` if this is a video track that consists of a single picture,
|
||||
``no`` or unavailable otherwise. This is used for video tracks that are
|
||||
@ -1746,6 +1742,29 @@ Property list
|
||||
match even if the default (builtin) demuxer is used, but there is
|
||||
no hard guarantee.
|
||||
|
||||
``track-list/N/decoder-desc``
|
||||
If this track is being decoded, the human-readable decoder name,
|
||||
|
||||
``track-list/N/demux-w``, ``track-list/N/demux-h``
|
||||
Video size hint as indicated by the container. (Not always accurate.)
|
||||
|
||||
``track-list/N/demux-channel-count``
|
||||
Number of audio channels as indicated by the container. (Not always
|
||||
accurate - in particular, the track could be decoded as a different
|
||||
number of channels.)
|
||||
|
||||
``track-list/N/demux-channels``
|
||||
Channel layout as indicated by the container. (Not always accurate.)
|
||||
|
||||
``track-list/N/demux-samplerate``
|
||||
Audio sample rate as indicated by the container. (Not always accurate.)
|
||||
|
||||
``track-list/N/demux-fps``
|
||||
Video FPS as indicated by the container. (Not always accurate.)
|
||||
|
||||
``track-list/N/audio-channels`` (deprecated)
|
||||
Deprecated alias for ``track-list/N/demux-channel-count``.
|
||||
|
||||
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:
|
||||
@ -1759,13 +1778,20 @@ Property list
|
||||
"src-id" MPV_FORMAT_INT64
|
||||
"title" MPV_FORMAT_STRING
|
||||
"lang" MPV_FORMAT_STRING
|
||||
"audio-channels" MPV_FORMAT_INT64
|
||||
"albumart" MPV_FORMAT_FLAG
|
||||
"default" MPV_FORMAT_FLAG
|
||||
"forced" MPV_FORMAT_FLAG
|
||||
"external" MPV_FORMAT_FLAG
|
||||
"external-filename" MPV_FORMAT_STRING
|
||||
"codec" MPV_FORMAT_STRING
|
||||
"decoder-desc" MPV_FORMAT_STRING
|
||||
"demux-w" MPV_FORMAT_INT64
|
||||
"demux-h" MPV_FORMAT_INT64
|
||||
"demux-channel-count" MPV_FORMAT_INT64
|
||||
"demux-channels" MPV_FORMAT_STRING
|
||||
"demux-samplerate" MPV_FORMAT_INT64
|
||||
"demux-fps" MPV_FORMAT_DOUBLE
|
||||
"audio-channels" MPV_FORMAT_INT64
|
||||
|
||||
``chapter-list``
|
||||
List of chapters, current entry marked. Currently, the raw property value
|
||||
|
@ -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}
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user