Skip to content

Commit 732dfc7

Browse files
jamrialmichaelni
authored andcommitted
lavf/ape: Fix stream duration calculation
Fixes ticket #1662 Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
1 parent 599a4e0 commit 732dfc7

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

libavformat/ape.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,6 @@
3838
#define MAC_FORMAT_FLAG_HAS_SEEK_ELEMENTS 16 // has the number of seek elements after the peak level
3939
#define MAC_FORMAT_FLAG_CREATE_WAV_HEADER 32 // create the wave header on decompression (not stored)
4040

41-
#define MAC_SUBFRAME_SIZE 4608
42-
4341
#define APE_EXTRADATA_SIZE 6
4442

4543
typedef struct {
@@ -335,8 +333,8 @@ static int ape_read_header(AVFormatContext * s)
335333

336334
st->nb_frames = ape->totalframes;
337335
st->start_time = 0;
338-
st->duration = total_blocks / MAC_SUBFRAME_SIZE;
339-
avpriv_set_pts_info(st, 64, MAC_SUBFRAME_SIZE, ape->samplerate);
336+
st->duration = total_blocks;
337+
avpriv_set_pts_info(st, 64, 1, ape->samplerate);
340338

341339
st->codec->extradata = av_malloc(APE_EXTRADATA_SIZE);
342340
st->codec->extradata_size = APE_EXTRADATA_SIZE;
@@ -348,7 +346,7 @@ static int ape_read_header(AVFormatContext * s)
348346
for (i = 0; i < ape->totalframes; i++) {
349347
ape->frames[i].pts = pts;
350348
av_add_index_entry(st, ape->frames[i].pos, ape->frames[i].pts, 0, 0, AVINDEX_KEYFRAME);
351-
pts += ape->blocksperframe / MAC_SUBFRAME_SIZE;
349+
pts += ape->blocksperframe;
352350
}
353351

354352
/* try to read APE tags */

0 commit comments

Comments
 (0)