Files
ports/graphics/openscenegraph/patches/patch-src_osgPlugins_ffmpeg_ReaderWriterFFmpeg_cpp
2024-11-01 09:51:59 +00:00

74 lines
1.8 KiB
Plaintext

Fix building with newer FFmpeg
Index: src/osgPlugins/ffmpeg/ReaderWriterFFmpeg.cpp
--- src/osgPlugins/ffmpeg/ReaderWriterFFmpeg.cpp.orig
+++ src/osgPlugins/ffmpeg/ReaderWriterFFmpeg.cpp
@@ -19,13 +19,6 @@
#include <osgDB/FileNameUtils>
#include <osgDB/FileUtils>
-
-#if LIBAVCODEC_VERSION_MAJOR >= 53 || \
- (LIBAVCODEC_VERSION_MAJOR==52 && LIBAVCODEC_VERSION_MINOR>=30) || \
- (LIBAVCODEC_VERSION_MAJOR==52 && LIBAVCODEC_VERSION_MINOR==20 && LIBAVCODEC_VERSION_MICRO >= 1)
- #define USE_AV_LOCK_MANAGER
-#endif
-
extern "C" {
static void log_to_osg(void* /*ptr*/, int level, const char *fmt, va_list vl)
@@ -113,13 +106,6 @@ class ReaderWriterFFmpeg : public osgDB::ReaderWriter
av_log_set_callback(log_to_osg);
-#ifdef USE_AV_LOCK_MANAGER
- // enable thread locking
- av_lockmgr_register(&lockMgr);
-#endif
- // Register all FFmpeg formats/codecs
- av_register_all();
-
avformat_network_init();
}
@@ -218,39 +204,6 @@ class ReaderWriterFFmpeg : public osgDB::ReaderWriter
}
}
}
-
-#ifdef USE_AV_LOCK_MANAGER
- static int lockMgr(void **mutex, enum AVLockOp op)
- {
- // returns are 0 success
- OpenThreads::Mutex **m=(OpenThreads::Mutex**)mutex;
- if (op==AV_LOCK_CREATE)
- {
- *m=new OpenThreads::Mutex;
- return !*m;
- }
- else if (op==AV_LOCK_DESTROY)
- {
- delete *m;
- return 0;
- }
- else if (op==AV_LOCK_OBTAIN)
- {
- (*m)->lock();
- return 0;
- }
- else if (op==AV_LOCK_RELEASE)
- {
- (*m)->unlock();
- return 0;
- }
- else
- {
- return -1;
- }
- }
-#endif
-
};