diff mbox series

[FFmpeg-devel,2/6] apc: Read duration from file

Message ID a898ddbcc9710ddb09d6bae5229eba7b0b7b5bef.camel@haerdin.se
State New
Headers show
Series [FFmpeg-devel,1/6] doc/general_contents.texi: Add missing ADPCM IMA APC entry | expand

Checks

Context Check Description
yinshiyou/configure_loongarch64 warning Failed to apply patch
andriy/configure_x86 warning Failed to apply patch

Commit Message

Tomas Härdin Dec. 26, 2023, 3:52 p.m. UTC

diff mbox series

Patch

From b3756e6258d18139fb2b67e3d9bc795bafd1b065 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Tomas=20H=C3=A4rdin?= <git@haerdin.se>
Date: Tue, 26 Dec 2023 14:31:59 +0100
Subject: [PATCH 2/6] apc: Read duration from file

---
 libavformat/apc.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/libavformat/apc.c b/libavformat/apc.c
index b8b18c966c..7765c53088 100644
--- a/libavformat/apc.c
+++ b/libavformat/apc.c
@@ -24,6 +24,7 @@ 
 #include "libavutil/channel_layout.h"
 #include "avformat.h"
 #include "demux.h"
+#include "internal.h"
 
 static int apc_probe(const AVProbeData *p)
 {
@@ -51,8 +52,9 @@  static int apc_read_header(AVFormatContext *s)
     st->codecpar->codec_type = AVMEDIA_TYPE_AUDIO;
     st->codecpar->codec_id = AV_CODEC_ID_ADPCM_IMA_APC;
 
-    avio_rl32(pb); /* number of samples */
+    st->duration = avio_rl32(pb); /* number of samples */
     st->codecpar->sample_rate = avio_rl32(pb);
+    avpriv_set_pts_info(st, 64, 1, st->codecpar->sample_rate);
 
     /* initial predictor values for adpcm decoder */
     if ((ret = ff_get_extradata(s, st->codecpar, pb, 2 * 4)) < 0)
-- 
2.39.2