From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id 90F47430BE for ; Sun, 19 Jun 2022 21:53:58 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id C247168B5B5; Mon, 20 Jun 2022 00:53:56 +0300 (EEST) Received: from iq.passwd.hu (iq.passwd.hu [217.27.212.140]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id BF5B868B44E for ; Mon, 20 Jun 2022 00:53:50 +0300 (EEST) Received: from localhost (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id 1B624E73AD; Sun, 19 Jun 2022 23:53:51 +0200 (CEST) X-Virus-Scanned: amavisd-new at passwd.hu Received: from iq.passwd.hu ([127.0.0.1]) by localhost (iq.passwd.hu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id UEijsuNPcbjs; Sun, 19 Jun 2022 23:53:49 +0200 (CEST) Received: from bluegene.passwd.hu (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id BCEBCE73A6; Sun, 19 Jun 2022 23:53:48 +0200 (CEST) From: Marton Balint To: ffmpeg-devel@ffmpeg.org Date: Sun, 19 Jun 2022 23:53:39 +0200 Message-Id: <20220619215340.9508-1-cus@passwd.hu> X-Mailer: git-send-email 2.35.3 In-Reply-To: References: MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 1/2] avformat/mov: factorize setting little endian PCM streams X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: Marton Balint Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: Signed-off-by: Marton Balint --- 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; } -- 2.35.3 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".