mirror of
https://github.com/mpv-player/mpv
synced 2025-03-20 18:28:01 +00:00
command: export file format as property
Repurpose demuxer->filetype for this. It used to be used to print a human readable format description; change it to a symbolic format name and export it as property. Unfortunately, libavformat has its own weird conventions, which are reflected through the new property, e.g. the .mp4 case mentioned in the manpage. Fixes #1504.
This commit is contained in:
parent
a0ed62fc1d
commit
9681d42a94
@ -709,6 +709,11 @@ Property list
|
||||
|
||||
Otherwise, return the ``filename`` property.
|
||||
|
||||
``file-format``
|
||||
Symbolic name of the file format. In some cases, this is a comma-separated
|
||||
list of format names, e.g. mp4 is ``mov,mp4,m4a,3gp,3g2,mj2`` (the list
|
||||
may grow future for any format).
|
||||
|
||||
``demuxer``
|
||||
Name of the current demuxer. (This is useless.)
|
||||
|
||||
|
@ -350,9 +350,7 @@ static int lavf_check_file(demuxer_t *demuxer, enum demux_check check)
|
||||
|
||||
success:
|
||||
|
||||
demuxer->filetype = priv->avif->long_name;
|
||||
if (!demuxer->filetype)
|
||||
demuxer->filetype = priv->avif->name;
|
||||
demuxer->filetype = priv->avif->name;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -547,8 +547,8 @@ static bool subreader_autodetect(stream_t *fd, struct MPOpts *opts,
|
||||
{ sub_read_line_subrip, NULL, "subviewer" },
|
||||
{ sub_read_line_subviewer, NULL, "subrip", "subrip" },
|
||||
{ sub_read_line_ssa, NULL, "ssa", "ass-text" },
|
||||
{ sub_read_line_subviewer2, NULL, "subviewer 2.0" },
|
||||
{ sub_read_line_subrip09, NULL, "subrip 0.9" },
|
||||
{ sub_read_line_subviewer2, NULL, "subviewer2" },
|
||||
{ sub_read_line_subrip09, NULL, "subrip9" },
|
||||
{ sub_read_line_mpl2, NULL, "mpl2" }
|
||||
};
|
||||
const struct subreader *srp;
|
||||
|
@ -420,6 +420,17 @@ static int mp_property_demuxer(void *ctx, struct m_property *prop,
|
||||
return m_property_strdup_ro(action, arg, demuxer->desc->name);
|
||||
}
|
||||
|
||||
static int mp_property_file_format(void *ctx, struct m_property *prop,
|
||||
int action, void *arg)
|
||||
{
|
||||
MPContext *mpctx = ctx;
|
||||
struct demuxer *demuxer = mpctx->master_demuxer;
|
||||
if (!demuxer)
|
||||
return M_PROPERTY_UNAVAILABLE;
|
||||
const char *name = demuxer->filetype ? demuxer->filetype : demuxer->desc->name;
|
||||
return m_property_strdup_ro(action, arg, name);
|
||||
}
|
||||
|
||||
/// Position in the stream (RW)
|
||||
static int mp_property_stream_pos(void *ctx, struct m_property *prop,
|
||||
int action, void *arg)
|
||||
@ -3238,6 +3249,7 @@ static const struct m_property mp_properties[] = {
|
||||
{"stream-path", mp_property_stream_path},
|
||||
{"stream-capture", mp_property_stream_capture},
|
||||
{"demuxer", mp_property_demuxer},
|
||||
{"file-format", mp_property_file_format},
|
||||
{"stream-pos", mp_property_stream_pos},
|
||||
{"stream-end", mp_property_stream_end},
|
||||
{"length", mp_property_length},
|
||||
|
Loading…
Reference in New Issue
Block a user