Fixed: ffmpeg deocde getLength function was placeholder

--HG--
branch : develop
feature/pipeline-tools
Nimetu 6 years ago
parent 838dd14d15
commit 3a5bb966a8

@ -287,18 +287,7 @@ bool CAudioDecoderFfmpeg::getInfo(NLMISC::IStream *stream, std::string &artist,
} }
} }
if (ffmpeg._FormatContext->duration != AV_NOPTS_VALUE) length = ffmpeg.getLength();
{
length = ffmpeg._FormatContext->duration * av_q2d(AV_TIME_BASE_Q);
}
else if (ffmpeg._FormatContext->streams[ffmpeg._AudioStreamIndex]->duration != AV_NOPTS_VALUE)
{
length = ffmpeg._FormatContext->streams[ffmpeg._AudioStreamIndex]->duration * av_q2d(ffmpeg._FormatContext->streams[ffmpeg._AudioStreamIndex]->time_base);
}
else
{
length = 0.f;
}
return true; return true;
} }
@ -420,9 +409,16 @@ bool CAudioDecoderFfmpeg::isMusicEnded()
float CAudioDecoderFfmpeg::getLength() float CAudioDecoderFfmpeg::getLength()
{ {
printf(">> CAudioDecoderFfmpeg::getLength\n"); float length = 0.f;
// TODO: return (float)ov_time_total(&_OggVorbisFile, -1); if (_FormatContext->duration != AV_NOPTS_VALUE)
return 0.f; {
length = _FormatContext->duration * av_q2d(AV_TIME_BASE_Q);
}
else if (_FormatContext->streams[_AudioStreamIndex]->duration != AV_NOPTS_VALUE)
{
length = _FormatContext->streams[_AudioStreamIndex]->duration * av_q2d(_FormatContext->streams[_AudioStreamIndex]->time_base);
}
return length;
} }
void CAudioDecoderFfmpeg::setLooping(bool loop) void CAudioDecoderFfmpeg::setLooping(bool loop)

Loading…
Cancel
Save