[FFmpeg-devel] [PATCH 2/2] avformat/wavenc: skip writing peak-of-peaks position when writing peaks only

Tobias Rapp t.rapp at noa-archive.com
Fri Sep 29 18:08:16 EEST 2017


Signed-off-by: Tobias Rapp <t.rapp at noa-archive.com>
---
 libavformat/wavenc.c         | 5 ++++-
 tests/ref/lavf/wav_peak_only | 2 +-
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/libavformat/wavenc.c b/libavformat/wavenc.c
index adb20cb..7a4acf9 100644
--- a/libavformat/wavenc.c
+++ b/libavformat/wavenc.c
@@ -287,7 +287,10 @@ static int peak_write_chunk(AVFormatContext *s)
     avio_wl32(pb, wav->peak_block_size);        /* frames per value */
     avio_wl32(pb, par->channels);               /* number of channels */
     avio_wl32(pb, wav->peak_num_frames);        /* number of peak frames */
-    avio_wl32(pb, wav->peak_pos_pop);           /* audio sample frame index */
+    if (wav->write_peak == PEAK_ONLY)           /* audio sample frame index */
+        avio_wl32(pb, -1);
+    else
+        avio_wl32(pb, wav->peak_pos_pop);
     avio_wl32(pb, 128);                         /* equal to size of header */
     avio_write(pb, timestamp, 28);              /* ASCII time stamp */
     ffio_fill(pb, 0, 60);
diff --git a/tests/ref/lavf/wav_peak_only b/tests/ref/lavf/wav_peak_only
index dccd0e7..b203d03 100644
--- a/tests/ref/lavf/wav_peak_only
+++ b/tests/ref/lavf/wav_peak_only
@@ -1,2 +1,2 @@
-b609a363e6d490710ed52231a8d09d3c *./tests/data/lavf/lavf.peak_only.wav
+f1a8aeeae8069f3992c4d780436c3d23 *./tests/data/lavf/lavf.peak_only.wav
 832 ./tests/data/lavf/lavf.peak_only.wav
-- 
2.7.4




More information about the ffmpeg-devel mailing list