mirror of https://github.com/odrling/Aegisub
FFMS2: Improve LAVF audio seeking in weird files
Originally committed to SVN as r2994.
This commit is contained in:
parent
eaecf59d91
commit
6542dd416d
|
@ -156,7 +156,8 @@ FFLAVFAudio::FFLAVFAudio(const char *SourceFile, int Track, FFIndex *Index, char
|
||||||
Free(true);
|
Free(true);
|
||||||
throw ErrorMsg;
|
throw ErrorMsg;
|
||||||
}
|
}
|
||||||
av_seek_frame(FormatContext, AudioTrack, Frames[0].DTS, AVSEEK_FLAG_BACKWARD);
|
if (av_seek_frame(FormatContext, AudioTrack, Frames[0].DTS, AVSEEK_FLAG_BACKWARD) < 0)
|
||||||
|
av_seek_frame(FormatContext, AudioTrack, Frames[0].DTS, AVSEEK_FLAG_BACKWARD | AVSEEK_FLAG_ANY);
|
||||||
avcodec_flush_buffers(CodecContext);
|
avcodec_flush_buffers(CodecContext);
|
||||||
|
|
||||||
FillAP(AP, CodecContext, Frames);
|
FillAP(AP, CodecContext, Frames);
|
||||||
|
@ -232,7 +233,11 @@ int FFLAVFAudio::GetAudio(void *Buf, int64_t Start, int64_t Count, char *ErrorMs
|
||||||
if (CurrentSample != CacheEnd) {
|
if (CurrentSample != CacheEnd) {
|
||||||
PreDecBlocks = 15;
|
PreDecBlocks = 15;
|
||||||
CurrentAudioBlock = FFMAX((int64_t)Frames.FindClosestAudioKeyFrame(CacheEnd) - PreDecBlocks - 20, (int64_t)0);
|
CurrentAudioBlock = FFMAX((int64_t)Frames.FindClosestAudioKeyFrame(CacheEnd) - PreDecBlocks - 20, (int64_t)0);
|
||||||
av_seek_frame(FormatContext, AudioTrack, Frames[CurrentAudioBlock].DTS, AVSEEK_FLAG_BACKWARD);
|
|
||||||
|
// Did the seeking fail?
|
||||||
|
if (av_seek_frame(FormatContext, AudioTrack, Frames[CurrentAudioBlock].DTS, AVSEEK_FLAG_BACKWARD) < 0)
|
||||||
|
av_seek_frame(FormatContext, AudioTrack, Frames[CurrentAudioBlock].DTS, AVSEEK_FLAG_BACKWARD | AVSEEK_FLAG_ANY);
|
||||||
|
|
||||||
avcodec_flush_buffers(CodecContext);
|
avcodec_flush_buffers(CodecContext);
|
||||||
|
|
||||||
AVPacket Packet;
|
AVPacket Packet;
|
||||||
|
|
|
@ -255,6 +255,10 @@ Note that --enable-w32threads or --enable-pthreads is required for multithreaded
|
||||||
|
|
||||||
<h2>Changes</h2>
|
<h2>Changes</h2>
|
||||||
<ul>
|
<ul>
|
||||||
|
<li>2.00 beta 10<ul>
|
||||||
|
<li>Now checks for failed seeking when LAVF is used and retries with more aggressive seeking options before failing</li>
|
||||||
|
</ul></li>
|
||||||
|
|
||||||
<li>2.00 beta 9<ul>
|
<li>2.00 beta 9<ul>
|
||||||
<li>Dumping audio now actually implies indexing too in FFIndex, previously nothing would be done if the index mask wasn't set as well</li>
|
<li>Dumping audio now actually implies indexing too in FFIndex, previously nothing would be done if the index mask wasn't set as well</li>
|
||||||
<li>FFAudioSource will now first load the index and returns the first indexed audio track with track=-1, if no audio tracks are indexed or the chosen track isn't indexed the equivalent of FFIndex(indexmask = -1, overwrite = cache) is executed first</li>
|
<li>FFAudioSource will now first load the index and returns the first indexed audio track with track=-1, if no audio tracks are indexed or the chosen track isn't indexed the equivalent of FFIndex(indexmask = -1, overwrite = cache) is executed first</li>
|
||||||
|
|
Loading…
Reference in New Issue