Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarton Balint <cus@passwd.hu>2022-06-20 00:25:51 +0300
committerMarton Balint <cus@passwd.hu>2022-06-27 21:29:47 +0300
commitcd83383f4deab43c8207baaa7e19fde4b8ae9cc6 (patch)
tree1ecf44e2b3de1af46633cf1905b612d367cb0eb6 /libavformat/mov.c
parent2a3640de84975398b1169d29530274cdd38b3939 (diff)
avformat/mov: factorize setting little endian PCM streams
Signed-off-by: Marton Balint <cus@passwd.hu>
Diffstat (limited to 'libavformat/mov.c')
-rw-r--r--libavformat/mov.c51
1 files 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;
}