diff options
author | Dudemanguy <random342@airmail.cc> | 2023-10-28 00:41:57 -0500 |
---|---|---|
committer | Dudemanguy <random342@airmail.cc> | 2024-03-17 14:59:40 +0000 |
commit | ccafd40ccce83d9857e61361126bd474d4b712e8 (patch) | |
tree | 0592f299b39c78c332ec4924b9d6aeb9cc0b03b1 /demux | |
parent | 8a9749b8a563f258342450160c98e9c02ebedc96 (diff) | |
download | mpv-ccafd40ccce83d9857e61361126bd474d4b712e8.tar.bz2 mpv-ccafd40ccce83d9857e61361126bd474d4b712e8.tar.xz |
demux: add a format-name property
It can be useful to know the underlying format of any entry in the
track list. Only applicable to the lavf demuxer.
Diffstat (limited to 'demux')
-rw-r--r-- | demux/demux_lavf.c | 11 | ||||
-rw-r--r-- | demux/stheader.h | 1 |
2 files changed, 8 insertions, 4 deletions
diff --git a/demux/demux_lavf.c b/demux/demux_lavf.c index bb7b38f9a8..fa9fd5cee8 100644 --- a/demux/demux_lavf.c +++ b/demux/demux_lavf.c @@ -29,14 +29,15 @@ #include <libavformat/avformat.h> #include <libavformat/avio.h> + #include <libavutil/avutil.h> #include <libavutil/avstring.h> -#include <libavutil/mathematics.h> -#include <libavutil/replaygain.h> #include <libavutil/display.h> -#include <libavutil/opt.h> - #include <libavutil/dovi_meta.h> +#include <libavutil/mathematics.h> +#include <libavutil/opt.h> +#include <libavutil/pixdesc.h> +#include <libavutil/replaygain.h> #include "audio/chmap_avchannel.h" @@ -726,6 +727,7 @@ static void handle_new_stream(demuxer_t *demuxer, int i) sh->codec->samplerate = codec->sample_rate; sh->codec->bitrate = codec->bit_rate; + sh->codec->format_name = talloc_strdup(sh, av_get_sample_fmt_name(codec->format)); double delay = 0; if (codec->sample_rate > 0) @@ -764,6 +766,7 @@ static void handle_new_stream(demuxer_t *demuxer, int i) sh->codec->disp_w = codec->width; sh->codec->disp_h = codec->height; + sh->codec->format_name = talloc_strdup(sh, av_get_pix_fmt_name(codec->format)); if (st->avg_frame_rate.num) sh->codec->fps = av_q2d(st->avg_frame_rate); if (is_image(st, sh->attached_picture, priv->avif)) { diff --git a/demux/stheader.h b/demux/stheader.h index cb6cc3e579..438ef7db41 100644 --- a/demux/stheader.h +++ b/demux/stheader.h @@ -111,6 +111,7 @@ struct mp_codec_params { // STREAM_VIDEO + STREAM_AUDIO int bits_per_coded_sample; + char *format_name; // pixel format (video) or sample format (audio) // STREAM_SUB double frame_based; // timestamps are frame-based (and this is the |