diff options
Diffstat (limited to 'src/media')
-rw-r--r-- | src/media/UAudioDecoder_FFmpeg.pas | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/src/media/UAudioDecoder_FFmpeg.pas b/src/media/UAudioDecoder_FFmpeg.pas index 7ca98885..f7f9c661 100644 --- a/src/media/UAudioDecoder_FFmpeg.pas +++ b/src/media/UAudioDecoder_FFmpeg.pas @@ -812,9 +812,18 @@ begin Exit; end; - // no error -> wait for user input - SDL_Delay(100); - Continue; + // url_feof() does not detect an EOF for some files + // so we have to do it this way. + if ((FormatCtx^.file_size <> 0) and + (ByteIOCtx^.pos >= FormatCtx^.file_size)) then + begin + PacketQueue.PutStatus(PKT_STATUS_FLAG_EOF, nil); + Exit; + end; + + // unknown error occured, exit + PacketQueue.PutStatus(PKT_STATUS_FLAG_ERROR, nil); + Exit; end; if (Packet.stream_index = AudioStreamIndex) then |