aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortobigun <tobigun@b956fd51-792f-4845-bead-9b4dfca2ff2c>2010-06-03 15:58:43 +0000
committertobigun <tobigun@b956fd51-792f-4845-bead-9b4dfca2ff2c>2010-06-03 15:58:43 +0000
commit6894d29e66396ef47b246347fcae1132e5daf84e (patch)
treeac7c39ef4358e02cd6caf91c6b3db27290520420
parent649bc453f74b3af59c29ade469f5009a17b93995 (diff)
downloadusdx-6894d29e66396ef47b246347fcae1132e5daf84e.tar.gz
usdx-6894d29e66396ef47b246347fcae1132e5daf84e.tar.xz
usdx-6894d29e66396ef47b246347fcae1132e5daf84e.zip
better EOF handling for FFmpeg audio decoding (EOF handled like it is done in UVideo)
git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@2438 b956fd51-792f-4845-bead-9b4dfca2ff2c
Diffstat (limited to '')
-rw-r--r--src/media/UAudioDecoder_FFmpeg.pas15
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