ffmpeg plugin: when decoded stream duration is unavailable, attempt fallback to container duration (fix MusicPlayerDaemon/MPD#110)
This commit is contained in:
parent
ca7b4df812
commit
b253a6b71e
2
NEWS
2
NEWS
|
@ -1,6 +1,8 @@
|
|||
ver 0.20.11 (not yet released)
|
||||
* storage
|
||||
- curl: support Content-Type application/xml
|
||||
* decoder
|
||||
- ffmpeg: more reliable song duration
|
||||
|
||||
ver 0.20.10 (2017/08/24)
|
||||
* decoder
|
||||
|
|
|
@ -712,7 +712,9 @@ FfmpegDecode(DecoderClient &client, InputStream &input,
|
|||
#endif
|
||||
|
||||
const SignedSongTime total_time =
|
||||
FromFfmpegTimeChecked(av_stream.duration, av_stream.time_base);
|
||||
av_stream.duration != (int64_t)AV_NOPTS_VALUE
|
||||
? FromFfmpegTimeChecked(av_stream.duration, av_stream.time_base)
|
||||
: FromFfmpegTimeChecked(format_context.duration, AV_TIME_BASE_Q);
|
||||
|
||||
client.Ready(audio_format, input.IsSeekable(), total_time);
|
||||
|
||||
|
@ -842,6 +844,10 @@ FfmpegScanStream(AVFormatContext &format_context,
|
|||
tag_handler_invoke_duration(handler, handler_ctx,
|
||||
FromFfmpegTime(stream.duration,
|
||||
stream.time_base));
|
||||
else if (format_context.duration != (int64_t)AV_NOPTS_VALUE)
|
||||
tag_handler_invoke_duration(handler, handler_ctx,
|
||||
FromFfmpegTime(format_context.duration,
|
||||
AV_TIME_BASE_Q));
|
||||
|
||||
FfmpegScanMetadata(format_context, audio_stream, handler, handler_ctx);
|
||||
|
||||
|
|
Loading…
Reference in New Issue