Commit 732dfc76 authored by jamal's avatar jamal Committed by Michael Niedermayer

lavf/ape: Fix stream duration calculation

Fixes ticket #1662
Reviewed-by: 's avatarPaul B Mahol <onemda@gmail.com>
Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent 599a4e07
...@@ -38,8 +38,6 @@ ...@@ -38,8 +38,6 @@
#define MAC_FORMAT_FLAG_HAS_SEEK_ELEMENTS 16 // has the number of seek elements after the peak level #define MAC_FORMAT_FLAG_HAS_SEEK_ELEMENTS 16 // has the number of seek elements after the peak level
#define MAC_FORMAT_FLAG_CREATE_WAV_HEADER 32 // create the wave header on decompression (not stored) #define MAC_FORMAT_FLAG_CREATE_WAV_HEADER 32 // create the wave header on decompression (not stored)
#define MAC_SUBFRAME_SIZE 4608
#define APE_EXTRADATA_SIZE 6 #define APE_EXTRADATA_SIZE 6
typedef struct { typedef struct {
...@@ -335,8 +333,8 @@ static int ape_read_header(AVFormatContext * s) ...@@ -335,8 +333,8 @@ static int ape_read_header(AVFormatContext * s)
st->nb_frames = ape->totalframes; st->nb_frames = ape->totalframes;
st->start_time = 0; st->start_time = 0;
st->duration = total_blocks / MAC_SUBFRAME_SIZE; st->duration = total_blocks;
avpriv_set_pts_info(st, 64, MAC_SUBFRAME_SIZE, ape->samplerate); avpriv_set_pts_info(st, 64, 1, ape->samplerate);
st->codec->extradata = av_malloc(APE_EXTRADATA_SIZE); st->codec->extradata = av_malloc(APE_EXTRADATA_SIZE);
st->codec->extradata_size = APE_EXTRADATA_SIZE; st->codec->extradata_size = APE_EXTRADATA_SIZE;
...@@ -348,7 +346,7 @@ static int ape_read_header(AVFormatContext * s) ...@@ -348,7 +346,7 @@ static int ape_read_header(AVFormatContext * s)
for (i = 0; i < ape->totalframes; i++) { for (i = 0; i < ape->totalframes; i++) {
ape->frames[i].pts = pts; ape->frames[i].pts = pts;
av_add_index_entry(st, ape->frames[i].pos, ape->frames[i].pts, 0, 0, AVINDEX_KEYFRAME); av_add_index_entry(st, ape->frames[i].pos, ape->frames[i].pts, 0, 0, AVINDEX_KEYFRAME);
pts += ape->blocksperframe / MAC_SUBFRAME_SIZE; pts += ape->blocksperframe;
} }
/* try to read APE tags */ /* try to read APE tags */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment