[FFmpeg-cvslog] avformat/mov: factorize setting little endian PCM streams
Marton Balint
git at videolan.org
Mon Jun 27 21:36:29 EEST 2022
ffmpeg | branch: master | Marton Balint <cus at passwd.hu> | Sun Jun 19 23:25:51 2022 +0200| [cd83383f4deab43c8207baaa7e19fde4b8ae9cc6] | committer: Marton Balint
avformat/mov: factorize setting little endian PCM streams
Signed-off-by: Marton Balint <cus at passwd.hu>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=cd83383f4deab43c8207baaa7e19fde4b8ae9cc6
---
libavformat/mov.c | 51 +++++++++++++++++++++++++++------------------------
1 file changed, 27 insertions(+), 24 deletions(-)
diff --git a/libavformat/mov.c b/libavformat/mov.c
index 3ec0ea2361..0660a51492 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -1544,35 +1544,38 @@ static int mov_read_mvhd(MOVContext *c, AVIOContext *pb, MOVAtom atom)
return 0;
}
-static int mov_read_enda(MOVContext *c, AVIOContext *pb, MOVAtom atom)
+static void set_last_stream_little_endian(AVFormatContext *fc)
{
AVStream *st;
- int little_endian;
- if (c->fc->nb_streams < 1)
- return 0;
- st = c->fc->streams[c->fc->nb_streams-1];
+ if (fc->nb_streams < 1)
+ return;
+ st = fc->streams[fc->nb_streams-1];
- little_endian = avio_rb16(pb) & 0xFF;
- av_log(c->fc, AV_LOG_TRACE, "enda %d\n", little_endian);
- if (little_endian == 1) {
- switch (st->codecpar->codec_id) {
- case AV_CODEC_ID_PCM_S24BE:
- st->codecpar->codec_id = AV_CODEC_ID_PCM_S24LE;
- break;
- case AV_CODEC_ID_PCM_S32BE:
- st->codecpar->codec_id = AV_CODEC_ID_PCM_S32LE;
- break;
- case AV_CODEC_ID_PCM_F32BE:
- st->codecpar->codec_id = AV_CODEC_ID_PCM_F32LE;
- break;
- case AV_CODEC_ID_PCM_F64BE:
- st->codecpar->codec_id = AV_CODEC_ID_PCM_F64LE;
- break;
- default:
- break;
- }
+ switch (st->codecpar->codec_id) {
+ case AV_CODEC_ID_PCM_S24BE:
+ st->codecpar->codec_id = AV_CODEC_ID_PCM_S24LE;
+ break;
+ case AV_CODEC_ID_PCM_S32BE:
+ st->codecpar->codec_id = AV_CODEC_ID_PCM_S32LE;
+ break;
+ case AV_CODEC_ID_PCM_F32BE:
+ st->codecpar->codec_id = AV_CODEC_ID_PCM_F32LE;
+ break;
+ case AV_CODEC_ID_PCM_F64BE:
+ st->codecpar->codec_id = AV_CODEC_ID_PCM_F64LE;
+ break;
+ default:
+ break;
}
+}
+
+static int mov_read_enda(MOVContext *c, AVIOContext *pb, MOVAtom atom)
+{
+ int little_endian = avio_rb16(pb) & 0xFF;
+ av_log(c->fc, AV_LOG_TRACE, "enda %d\n", little_endian);
+ if (little_endian == 1)
+ set_last_stream_little_endian(c->fc);
return 0;
}
More information about the ffmpeg-cvslog
mailing list