mirror of
https://github.com/scottlamb/moonfire-nvr.git
synced 2025-07-16 04:11:54 -04:00
address av_lockmgr_register deprecation
This commit is contained in:
parent
2ab7dbc9fb
commit
7179ea04e3
@ -54,6 +54,20 @@ const int moonfire_ffmpeg_av_codec_id_h264 = AV_CODEC_ID_H264;
|
|||||||
|
|
||||||
const int moonfire_ffmpeg_averror_eof = AVERROR_EOF;
|
const int moonfire_ffmpeg_averror_eof = AVERROR_EOF;
|
||||||
|
|
||||||
|
// Prior to libavcodec 58.9.100, multithreaded callers were expected to supply
|
||||||
|
// a lock callback. That release deprecated this API. It also introduced a
|
||||||
|
// FF_API_LOCKMGR #define to track its removal:
|
||||||
|
//
|
||||||
|
// * older builds (in which the lock callback is needed) don't define it.
|
||||||
|
// * middle builds (in which the callback is deprecated) define it as 1.
|
||||||
|
// value of 1.
|
||||||
|
// * future builds (in which the callback removed) will define
|
||||||
|
// it as 0.
|
||||||
|
//
|
||||||
|
// so (counterintuitively) use the lock manager when FF_API_LOCKMGR is
|
||||||
|
// undefined.
|
||||||
|
|
||||||
|
#ifndef FF_API_LOCKMGR
|
||||||
static int lock_callback(void **mutex, enum AVLockOp op) {
|
static int lock_callback(void **mutex, enum AVLockOp op) {
|
||||||
switch (op) {
|
switch (op) {
|
||||||
case AV_LOCK_CREATE:
|
case AV_LOCK_CREATE:
|
||||||
@ -82,11 +96,14 @@ static int lock_callback(void **mutex, enum AVLockOp op) {
|
|||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void moonfire_ffmpeg_init(void) {
|
void moonfire_ffmpeg_init(void) {
|
||||||
|
#ifndef FF_API_LOCKMGR
|
||||||
if (av_lockmgr_register(&lock_callback) < 0) {
|
if (av_lockmgr_register(&lock_callback) < 0) {
|
||||||
abort();
|
abort();
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
struct moonfire_ffmpeg_streams {
|
struct moonfire_ffmpeg_streams {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user