[FFmpeg-devel] [PATCH 6/7] avformat: add s337m support in mpegts, wav and mxf stereo tracks
ffnicolasg at sfr.fr
ffnicolasg at sfr.fr
Wed Dec 4 16:14:08 EET 2024
From: Nicolas Gaullier <nicolas.gaullier at cji.paris>
Signed-off-by: Nicolas Gaullier <nicolas.gaullier at cji.paris>
---
libavformat/demux.c | 2 ++
libavformat/mxfdec.c | 9 +++++++--
libavformat/wavdec.c | 3 ++-
3 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/libavformat/demux.c b/libavformat/demux.c
index cba1f2e4df..d26d207a46 100644
--- a/libavformat/demux.c
+++ b/libavformat/demux.c
@@ -125,6 +125,8 @@ static int set_codec_from_probe_data(AVFormatContext *s, AVStream *st,
{ "truehd", AV_CODEC_ID_TRUEHD, AVMEDIA_TYPE_AUDIO },
{ "evc", AV_CODEC_ID_EVC, AVMEDIA_TYPE_VIDEO },
{ "vvc", AV_CODEC_ID_VVC, AVMEDIA_TYPE_VIDEO },
+ { "s337m_16", AV_CODEC_ID_S337M_16, AVMEDIA_TYPE_AUDIO },
+ { "s337m_24", AV_CODEC_ID_S337M_24, AVMEDIA_TYPE_AUDIO },
{ 0 }
};
int score;
diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c
index 9ecaa287bb..2eaca7565b 100644
--- a/libavformat/mxfdec.c
+++ b/libavformat/mxfdec.c
@@ -634,7 +634,7 @@ static int mxf_get_d10_aes3_packet(AVIOContext *pb, AVStream *st, AVPacket *pkt,
for (; end_ptr - buf_ptr >= st->codecpar->ch_layout.nb_channels * 4; ) {
for (int i = 0; i < st->codecpar->ch_layout.nb_channels; i++) {
uint32_t sample = bytestream_get_le32(&buf_ptr);
- if (st->codecpar->bits_per_coded_sample == 24)
+ if (av_get_bits_per_sample(st->codecpar->codec_id) == 24)
bytestream_put_le24(&data_ptr, (sample >> 4) & 0xffffff);
else
bytestream_put_le16(&data_ptr, (sample >> 12) & 0xffff);
@@ -3080,7 +3080,12 @@ static int mxf_parse_structural_metadata(MXFContext *mxf)
} else if (st->codecpar->codec_id == AV_CODEC_ID_AAC) {
sti->need_parsing = AVSTREAM_PARSE_FULL;
}
- st->codecpar->bits_per_coded_sample = av_get_bits_per_sample(st->codecpar->codec_id);
+ if (st->codecpar->codec_id == AV_CODEC_ID_PCM_S16LE
+ || st->codecpar->codec_id == AV_CODEC_ID_PCM_S24LE) {
+ FFStream *const sti = ffstream(st);
+ sti->request_probe = AVPROBE_SCORE_EXTENSION;
+ sti->need_parsing = AVSTREAM_PARSE_FULL;
+ }
if (descriptor->channels <= 0 || descriptor->channels >= FF_SANE_NB_CHANNELS) {
av_log(mxf->fc, AV_LOG_ERROR, "Invalid number of channels %d, must be less than %d\n", descriptor->channels, FF_SANE_NB_CHANNELS);
diff --git a/libavformat/wavdec.c b/libavformat/wavdec.c
index 78e37b88d7..c55aa915e6 100644
--- a/libavformat/wavdec.c
+++ b/libavformat/wavdec.c
@@ -176,7 +176,8 @@ static int wav_probe(const AVProbeData *p)
static void handle_stream_probing(AVStream *st)
{
- if (st->codecpar->codec_id == AV_CODEC_ID_PCM_S16LE) {
+ if (st->codecpar->codec_id == AV_CODEC_ID_PCM_S16LE
+ || st->codecpar->codec_id == AV_CODEC_ID_PCM_S24LE) {
FFStream *const sti = ffstream(st);
sti->request_probe = AVPROBE_SCORE_EXTENSION;
sti->probe_packets = FFMIN(sti->probe_packets, 32);
--
2.30.2
More information about the ffmpeg-devel
mailing list