From 6987dd768a14fab5ed9f3f31eccc2575645373bc Mon Sep 17 00:00:00 2001 From: Lukasz Gromanowski Date: Sun, 21 Sep 2014 09:52:31 +0200 Subject: [PATCH 1/3] Removed a warning about comparision between signed and unsigned variable in ffmpeg_decoder. Signed-off-by: Lukasz Gromanowski --- apps/openmw/mwsound/ffmpeg_decoder.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/openmw/mwsound/ffmpeg_decoder.cpp b/apps/openmw/mwsound/ffmpeg_decoder.cpp index 7b6e12576..018b0c863 100644 --- a/apps/openmw/mwsound/ffmpeg_decoder.cpp +++ b/apps/openmw/mwsound/ffmpeg_decoder.cpp @@ -69,7 +69,7 @@ bool FFmpeg_Decoder::getNextPacket() /* Check if the packet belongs to this stream */ if(stream_idx == mPacket.stream_index) { - if((uint64_t)mPacket.pts != AV_NOPTS_VALUE) + if(mPacket.pts != AV_NOPTS_VALUE) mNextPts = av_q2d((*mStream)->time_base)*mPacket.pts; return true; } From 7ad6a94523e9d4fc4b14bc82e85544adad01f4bc Mon Sep 17 00:00:00 2001 From: Lukasz Gromanowski Date: Sun, 21 Sep 2014 16:13:54 +0200 Subject: [PATCH 2/3] Removed a warning about comparision between signed and unsigned variable in ffmpeg_decoder. Added ifdefs because changes in API were introduced in libavc 56.1 and this code doesn't compile with older versions (ie. on Ubuntu, or Debian) Signed-off-by: Lukasz Gromanowski --- apps/openmw/mwsound/ffmpeg_decoder.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/apps/openmw/mwsound/ffmpeg_decoder.cpp b/apps/openmw/mwsound/ffmpeg_decoder.cpp index 018b0c863..671527fe9 100644 --- a/apps/openmw/mwsound/ffmpeg_decoder.cpp +++ b/apps/openmw/mwsound/ffmpeg_decoder.cpp @@ -15,6 +15,14 @@ AVAudioResampleContext * swr_alloc_set_opts( AVAudioResampleContext *avr, int64_ #endif } +#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(56,1,0) +#define IS_NOTEQ_NOPTS_VAL(x) ((uint64_t)x != AV_NOPTS_VALUE) +#define IS_NOTEQ_NOPTS_VAL_PTR(x) (*(uint64_t*)x != AV_NOPTS_VALUE) +#else +#define IS_NOTEQ_NOPTS_VAL(x) ((int64_t)x != AV_NOPTS_VALUE) +#define IS_NOTEQ_NOPTS_VAL_PTR(x) (*(int64_t*)x != AV_NOPTS_VALUE) +#endif /* LIBAVCODEC_VERSION_INT < AV_VERSION_INT(56,1,0) */ + namespace MWSound { @@ -69,7 +77,7 @@ bool FFmpeg_Decoder::getNextPacket() /* Check if the packet belongs to this stream */ if(stream_idx == mPacket.stream_index) { - if(mPacket.pts != AV_NOPTS_VALUE) + if(IS_NOTEQ_NOPTS_VAL(mPacket.pts)) mNextPts = av_q2d((*mStream)->time_base)*mPacket.pts; return true; } From c72369fafeb7df30a270e7e5adc255355c83e551 Mon Sep 17 00:00:00 2001 From: Lukasz Gromanowski Date: Sun, 21 Sep 2014 20:05:46 +0200 Subject: [PATCH 3/3] Simplified casting when comparing to AV_NOPTS_VALUE. AV_NOPTS_VALUE is casted to int64_t when compared with pts, so with libavc >= 56.1 it should be no-op because in that version it's already signed int. Signed-off-by: Lukasz Gromanowski --- apps/openmw/mwsound/ffmpeg_decoder.cpp | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/apps/openmw/mwsound/ffmpeg_decoder.cpp b/apps/openmw/mwsound/ffmpeg_decoder.cpp index 671527fe9..b3f8642fd 100644 --- a/apps/openmw/mwsound/ffmpeg_decoder.cpp +++ b/apps/openmw/mwsound/ffmpeg_decoder.cpp @@ -15,14 +15,6 @@ AVAudioResampleContext * swr_alloc_set_opts( AVAudioResampleContext *avr, int64_ #endif } -#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(56,1,0) -#define IS_NOTEQ_NOPTS_VAL(x) ((uint64_t)x != AV_NOPTS_VALUE) -#define IS_NOTEQ_NOPTS_VAL_PTR(x) (*(uint64_t*)x != AV_NOPTS_VALUE) -#else -#define IS_NOTEQ_NOPTS_VAL(x) ((int64_t)x != AV_NOPTS_VALUE) -#define IS_NOTEQ_NOPTS_VAL_PTR(x) (*(int64_t*)x != AV_NOPTS_VALUE) -#endif /* LIBAVCODEC_VERSION_INT < AV_VERSION_INT(56,1,0) */ - namespace MWSound { @@ -77,7 +69,7 @@ bool FFmpeg_Decoder::getNextPacket() /* Check if the packet belongs to this stream */ if(stream_idx == mPacket.stream_index) { - if(IS_NOTEQ_NOPTS_VAL(mPacket.pts)) + if(mPacket.pts != (int64_t)AV_NOPTS_VALUE) mNextPts = av_q2d((*mStream)->time_base)*mPacket.pts; return true; }