[FFmpeg] Deduce the length from the container
Determine the length of the file from the container, rather than the individual audio stream. The former is more likely to be set than the latter is. Signed-off-by: Christopher Snowhill <kode54@gmail.com>
This commit is contained in:
parent
a6b6c8120b
commit
43c709cd9f
1 changed files with 1 additions and 1 deletions
|
@ -424,7 +424,7 @@ static uint8_t reverse_bits[0x100];
|
|||
|
||||
// totalFrames = codecCtx->sample_rate * ((float)formatCtx->duration/AV_TIME_BASE);
|
||||
AVRational tb = { .num = 1, .den = codecCtx->sample_rate };
|
||||
totalFrames = isStream ? 0 : av_rescale_q(stream->duration, stream->time_base, tb);
|
||||
totalFrames = isStream ? 0 : av_rescale_q(formatCtx->duration, AV_TIME_BASE_Q, tb);
|
||||
bitrate = (int)((codecCtx->bit_rate) / 1000);
|
||||
framesRead = 0;
|
||||
endOfStream = NO;
|
||||
|
|
Loading…
Reference in a new issue