From 9bec4f777973c066ac12ae5ad2df107be23bdc7b Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Mon, 3 Feb 2014 17:24:25 +0600 Subject: Fix T38455: Blenderplayer is not working Was a regression since avg_frame_rate changes. Didn't find reliable way to get stream duration which will work with both FFmpeg and Libav so added some freaking black magic to distinguish one from another. --- intern/ffmpeg/ffmpeg_compat.h | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'intern/ffmpeg') diff --git a/intern/ffmpeg/ffmpeg_compat.h b/intern/ffmpeg/ffmpeg_compat.h index 6cae957471d..801ab6e659d 100644 --- a/intern/ffmpeg/ffmpeg_compat.h +++ b/intern/ffmpeg/ffmpeg_compat.h @@ -419,4 +419,15 @@ void av_frame_free(AVFrame **frame) } #endif +FFMPEG_INLINE +AVRational av_get_r_frame_rate_compat(const AVStream *stream) +{ + /* Stupid way to distinguish FFmpeg from Libav. */ +#if LIBAVCODEC_VERSION_MICRO >= 100 + return stream->r_frame_rate; +#else + return stream->avg_frame_rate; +#endif +} + #endif -- cgit v1.2.3