It can be useful to know the underlying format of any entry in the track list. Only applicable to the lavf demuxer.
Unified · Split
| @@ -3089,6 +3089,11 @@ Property list · 3088 unmodified lines | |||
| 3089 | ``track-list/N/demux-par`` | 3089 | ``track-list/N/demux-par`` |
| 3090 | Pixel aspect ratio. | 3090 | Pixel aspect ratio. |
| 3091 | 3091 | ||
| 3092 | ``track-list/N/format-name`` | ||
| 3093 | Short name for format from ffmpeg. If the track is audio, this will be | ||
| 3094 | the name of the sample format. If the track is video, this will be the | ||
| 3095 | name of the pixel format. | ||
| 3096 | |||
| 3092 | ``track-list/N/audio-channels`` (deprecated) | 3097 | ``track-list/N/audio-channels`` (deprecated) |
| 3093 | Deprecated alias for ``track-list/N/demux-channel-count``. | 3098 | Deprecated alias for ``track-list/N/demux-channel-count``. |
| 3094 | 3099 | ||
| @@ -29,14 +29,15 @@ · 28 unmodified lines | |||
| 29 | 29 | ||
| 30 | #include <libavformat/avformat.h> | 30 | #include <libavformat/avformat.h> |
| 31 | #include <libavformat/avio.h> | 31 | #include <libavformat/avio.h> |
| 32 | |||
| 32 | #include <libavutil/avutil.h> | 33 | #include <libavutil/avutil.h> |
| 33 | #include <libavutil/avstring.h> | 34 | #include <libavutil/avstring.h> |
| 34 | #include <libavutil/mathematics.h> | ||
| 35 | #include <libavutil/replaygain.h> | ||
| 36 | #include <libavutil/display.h> | 35 | #include <libavutil/display.h> |
| 37 | #include <libavutil/opt.h> | ||
| 38 | |||
| 39 | #include <libavutil/dovi_meta.h> | 36 | #include <libavutil/dovi_meta.h> |
| 37 | #include <libavutil/mathematics.h> | ||
| 38 | #include <libavutil/opt.h> | ||
| 39 | #include <libavutil/pixdesc.h> | ||
| 40 | #include <libavutil/replaygain.h> | ||
| 40 | 41 | ||
| 41 | #include "audio/chmap_avchannel.h" | 42 | #include "audio/chmap_avchannel.h" |
| 42 | 43 | ||
| @@ -726,6 +727,7 @@ static void handle_new_stream(demuxer_t *demuxer, int i) · 683 unmodified lines | |||
| 726 | 727 | ||
| 727 | sh->codec->samplerate = codec->sample_rate; | 728 | sh->codec->samplerate = codec->sample_rate; |
| 728 | sh->codec->bitrate = codec->bit_rate; | 729 | sh->codec->bitrate = codec->bit_rate; |
| 730 | sh->codec->format_name = talloc_strdup(sh, av_get_sample_fmt_name(codec->format)); | ||
| 729 | 731 | ||
| 730 | double delay = 0; | 732 | double delay = 0; |
| 731 | if (codec->sample_rate > 0) | 733 | if (codec->sample_rate > 0) |
| @@ -764,6 +766,7 @@ static void handle_new_stream(demuxer_t *demuxer, int i) · 32 unmodified lines | |||
| 764 | 766 | ||
| 765 | sh->codec->disp_w = codec->width; | 767 | sh->codec->disp_w = codec->width; |
| 766 | sh->codec->disp_h = codec->height; | 768 | sh->codec->disp_h = codec->height; |
| 769 | sh->codec->format_name = talloc_strdup(sh, av_get_pix_fmt_name(codec->format)); | ||
| 767 | if (st->avg_frame_rate.num) | 770 | if (st->avg_frame_rate.num) |
| 768 | sh->codec->fps = av_q2d(st->avg_frame_rate); | 771 | sh->codec->fps = av_q2d(st->avg_frame_rate); |
| 769 | if (is_image(st, sh->attached_picture, priv->avif)) { | 772 | if (is_image(st, sh->attached_picture, priv->avif)) { |
| @@ -111,6 +111,7 @@ struct mp_codec_params { · 110 unmodified lines | |||
| 111 | 111 | ||
| 112 | // STREAM_VIDEO + STREAM_AUDIO | 112 | // STREAM_VIDEO + STREAM_AUDIO |
| 113 | int bits_per_coded_sample; | 113 | int bits_per_coded_sample; |
| 114 | char *format_name; // pixel format (video) or sample format (audio) | ||
| 114 | 115 | ||
| 115 | // STREAM_SUB | 116 | // STREAM_SUB |
| 116 | double frame_based; // timestamps are frame-based (and this is the | 117 | double frame_based; // timestamps are frame-based (and this is the |
| @@ -2063,6 +2063,7 @@ static int get_track_entry(int item, int action, void *arg, void *ctx) · 2062 unmodified lines | |||
| 2063 | {"demux-bitrate", SUB_PROP_INT(p.bitrate), .unavailable = p.bitrate <= 0}, | 2063 | {"demux-bitrate", SUB_PROP_INT(p.bitrate), .unavailable = p.bitrate <= 0}, |
| 2064 | {"demux-rotation", SUB_PROP_INT(p.rotate), .unavailable = p.rotate <= 0}, | 2064 | {"demux-rotation", SUB_PROP_INT(p.rotate), .unavailable = p.rotate <= 0}, |
| 2065 | {"demux-par", SUB_PROP_DOUBLE(par), .unavailable = par <= 0}, | 2065 | {"demux-par", SUB_PROP_DOUBLE(par), .unavailable = par <= 0}, |
| 2066 | {"format-name", SUB_PROP_STR(p.format_name), .unavailable = !p.format_name}, | ||
| 2066 | {"replaygain-track-peak", SUB_PROP_FLOAT(rg.track_peak), | 2067 | {"replaygain-track-peak", SUB_PROP_FLOAT(rg.track_peak), |
| 2067 | .unavailable = !has_rg}, | 2068 | .unavailable = !has_rg}, |
| 2068 | {"replaygain-track-gain", SUB_PROP_FLOAT(rg.track_gain), | 2069 | {"replaygain-track-gain", SUB_PROP_FLOAT(rg.track_gain), |