aboutsummaryrefslogtreecommitdiffstats
path: root/src/media
diff options
context:
space:
mode:
authork-m_schindler <k-m_schindler@b956fd51-792f-4845-bead-9b4dfca2ff2c>2014-11-22 11:49:39 +0000
committerk-m_schindler <k-m_schindler@b956fd51-792f-4845-bead-9b4dfca2ff2c>2014-11-22 11:49:39 +0000
commit3a42880592166db97707282162b84c97a30cf51f (patch)
treef58b0935fab23e49290d1e033d7c484c98e721e4 /src/media
parente1b891639d0efe89805587aaaf78c953867fd638 (diff)
downloadusdx-3a42880592166db97707282162b84c97a30cf51f.tar.gz
usdx-3a42880592166db97707282162b84c97a30cf51f.tar.xz
usdx-3a42880592166db97707282162b84c97a30cf51f.zip
adding ffmpeg-2.4. compiles, but crashes on Mac OS X.
git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@3083 b956fd51-792f-4845-bead-9b4dfca2ff2c
Diffstat (limited to 'src/media')
-rw-r--r--src/media/UAudioDecoder_FFmpeg.pas35
-rw-r--r--src/media/UVideo.pas4
2 files changed, 23 insertions, 16 deletions
diff --git a/src/media/UAudioDecoder_FFmpeg.pas b/src/media/UAudioDecoder_FFmpeg.pas
index 75bfa75b..bc319546 100644
--- a/src/media/UAudioDecoder_FFmpeg.pas
+++ b/src/media/UAudioDecoder_FFmpeg.pas
@@ -302,7 +302,7 @@ begin
AVResult := FFmpegCore.AVFormatOpenInput(@fFormatCtx, PAnsiChar('ufile:'+FileName.ToUTF8));
{$IFEND}
if (AVResult <> 0) then
- begin
+ begin
Log.LogError('Failed to open file "' + Filename.ToNative + '" ('+FFmpegCore.GetErrorString(AVResult)+')', 'UAudio_FFmpeg');
Exit;
end;
@@ -317,7 +317,7 @@ begin
AVResult := av_find_stream_info(fFormatCtx);
{$IFEND}
if (AVResult < 0) then
- begin
+ begin
Log.LogError('No stream info found: "' + Filename.ToNative + '"', 'UAudio_FFmpeg');
Close();
Exit;
@@ -378,13 +378,13 @@ begin
// set debug options
fCodecCtx^.debug_mv := 0;
fCodecCtx^.debug := 0;
-
+
{$IF FFMPEG_VERSION_INT >= 1001000}
- // request required sample format
- // reference:
- // http://stackoverflow.com/questions/16479662/ffmpeg-1-0-causing-audio-playback-issues
- // without this avcodec_open2 returns AV_SAMPLE_FMT_S16P
- fCodecCtx^.request_sample_fmt := AV_SAMPLE_FMT_S16;
+ // request required sample format
+ // reference:
+ // http://stackoverflow.com/questions/16479662/ffmpeg-1-0-causing-audio-playback-issues
+ // without this avcodec_open2 returns AV_SAMPLE_FMT_S16P
+ fCodecCtx^.request_sample_fmt := AV_SAMPLE_FMT_S16;
{$IFEND}
// detect bug-workarounds automatically
@@ -840,7 +840,11 @@ begin
{$IFEND}
// check for end-of-file (eof is not an error)
+ {$IF (LIBAVFORMAT_VERSION_MAJOR < 56)}
if (url_feof(ByteIOCtx) <> 0) then
+ {$ELSE}
+ if (avio_feof(ByteIOCtx) <> 0) then
+ {$IFEND}
begin
if (GetLoop()) then
begin
@@ -857,12 +861,12 @@ begin
end;
// check for errors
- {$IF (LIBAVFORMAT_VERSION >= 52103000)}
- urlError := ByteIOCtx^.error;
- {$ELSE}
- urlError := url_ferror(ByteIOCtx);
- {$IFEND}
- if (urlError <> 0) then
+ {$IF (LIBAVFORMAT_VERSION >= 52103000)}
+ urlError := ByteIOCtx^.error;
+ {$ELSE}
+ urlError := url_ferror(ByteIOCtx);
+ {$IFEND}
+ if (urlError <> 0) then
begin
// an error occured -> abort and wait for repositioning or termination
fPacketQueue.PutStatus(PKT_STATUS_FLAG_ERROR, nil);
@@ -983,7 +987,7 @@ begin
// {$IF LIBAVCODEC_VERSION >= 53025000} // 53.25.0
// PaketDecodedSize := avcodec_decode_audio4(fCodecCtx, AVFrame,
-// @got_frame_ptr, @fAudioPaket);
+// @got_frame_ptr, @fAudioPaket);
// DataSize := AVFrame.nb_samples;
// Buffer := PByteArray(AVFrame.data[0]);
{$IF LIBAVCODEC_VERSION >= 52122000} // 52.122.0
@@ -1225,7 +1229,6 @@ begin
Result := Stream;
end;
-
initialization
MediaManager.Add(TAudioDecoder_FFmpeg.Create);
diff --git a/src/media/UVideo.pas b/src/media/UVideo.pas
index 5e083b9a..711234fa 100644
--- a/src/media/UVideo.pas
+++ b/src/media/UVideo.pas
@@ -674,7 +674,11 @@ begin
{$IFEND}
// check for end-of-file (EOF is not an error)
+ {$IF (LIBAVFORMAT_VERSION_MAJOR < 56)}
if (url_feof(pbIOCtx) <> 0) then
+ {$ELSE}
+ if (avio_feof(pbIOCtx) <> 0) then
+ {$IFEND}
begin
fEOF := true;
Exit;