From Nick Black, "Hey there! avcodec_open() has been deprecated for some time, and indeed has

been removed in the most recent versions of libavcodec/ffmpeg. You're
already using avcodec_open2() elsewhere, but one appears to have been
missed. The change is trivial:

[skynet](0) $ svn diff
Index: src/osgPlugins/ffmpeg/FFmpegDecoderAudio.cpp
===================================================================
--- src/osgPlugins/ffmpeg/FFmpegDecoderAudio.cpp        (revision 13355)
+++ src/osgPlugins/ffmpeg/FFmpegDecoderAudio.cpp        (working copy)
@@ -109,7 +109,7 @@
         //    m_context->flags |= CODEC_FLAG_TRUNCATED;

         // Open codec
-        if (avcodec_open(m_context, p_codec) < 0)
+        if (avcodec_open2(m_context, p_codec, NULL) < 0)
             throw std::runtime_error("avcodec_open() failed");
     }

[skynet](0) $

I've applied similar changes this year to many other packages, including
cheese, blender, linphone, ad nauseam. It's been tested by verifying that
with my patch, OSG builds against the newest libavcodec and ffmpeg, whereas
otherwise it does not.

The modified src/osgPlugins/ffmpeg/FFmpegDecoderAudio.cpp is attached. It
originates in svn trunk revision 13355. Thanks!"
This commit is contained in:
Robert Osfield
2013-06-24 09:12:58 +00:00
parent 48020eed9e
commit 70ae69648d

View File

@@ -109,7 +109,7 @@ void FFmpegDecoderAudio::open(AVStream * const stream)
// m_context->flags |= CODEC_FLAG_TRUNCATED;
// Open codec
if (avcodec_open(m_context, p_codec) < 0)
if (avcodec_open2(m_context, p_codec, NULL) < 0)
throw std::runtime_error("avcodec_open() failed");
}