size_t fpos;
int32_t track;
struct mp4ff *mp4ff;
- mp4AudioSpecificConfig masc;
struct mp4ff_callback cb;
};
return 0;
}
-static int32_t aac_afh_get_track(struct mp4ff *mp4ff, mp4AudioSpecificConfig *masc)
+static int32_t aac_afh_get_track(struct mp4ff *mp4ff)
{
int32_t i, rc, num_tracks = mp4ff_total_tracks(mp4ff);
mp4ff_get_decoder_config(mp4ff, i, &buf, &buf_size);
if (buf) {
- rc = NeAACDecAudioSpecificConfig(buf, buf_size, masc);
+ mp4AudioSpecificConfig masc;
+ rc = NeAACDecAudioSpecificConfig(buf, buf_size, &masc);
free(buf);
if (rc < 0)
continue;
c->mp4ff = mp4ff_open_read(&c->cb);
if (!c->mp4ff)
goto free_ctx;
- c->track = aac_afh_get_track(c->mp4ff, &c->masc);
+ c->track = aac_afh_get_track(c->mp4ff);
ret = -E_MP4FF_TRACK;
if (c->track < 0)
goto close_mp4ff;
int ret;
int32_t rv;
struct aac_afh_context *c;
- int64_t tmp;
+ uint64_t milliseconds;
const char *buf;
uint32_t n, len;
break;
afhi->max_chunk_size = PARA_MAX(afhi->max_chunk_size, len);
}
-
- tmp = c->masc.sbr_present_flag == 1? 2048 : 1024;
- afhi->seconds_total = tmp * afhi->chunks_total / afhi->frequency;
- ms2tv(1000 * tmp / afhi->frequency, &afhi->chunk_tv);
-
+ milliseconds = mp4ff_get_duration(c->mp4ff, c->track);
+ afhi->seconds_total = milliseconds / 1000;
+ ms2tv(milliseconds / afhi->chunks_total, &afhi->chunk_tv);
if (aac_afh_get_chunk(0, c, &buf, &len) >= 0)
numbytes -= buf - map;
afhi->bitrate = 8 * numbytes / afhi->seconds_total / 1000;