aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/chromaprint.c
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2024-05-17 14:53:33 +0200
committerAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2024-05-20 12:28:28 +0200
commit8b48b0adab0d9ad7655eb7746253061edeea58ae (patch)
treebc5705e74f09b9d8c6affd80c92b4325cc8fff06 /libavformat/chromaprint.c
parenta2874c5721eb0913575ee9199df45048d9dd87ae (diff)
downloadffmpeg-8b48b0adab0d9ad7655eb7746253061edeea58ae.tar.gz
avformat/utils: Use static mutexes instead of ff_lock_avformat()
Its existence is a remnant of (libavcodec's) lock-manager API which has been removed in a04c2c707de2ce850f79870e84ac9d7ec7aa9143. There is no need to use the same lock for avisynth, chromaprint or tls, so switch to ordinary static mutexes instead. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Diffstat (limited to 'libavformat/chromaprint.c')
-rw-r--r--libavformat/chromaprint.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/libavformat/chromaprint.c b/libavformat/chromaprint.c
index 1cdca47ea5..eae233a651 100644
--- a/libavformat/chromaprint.c
+++ b/libavformat/chromaprint.c
@@ -20,15 +20,17 @@
*/
#include "avformat.h"
-#include "internal.h"
#include "mux.h"
#include "libavutil/opt.h"
+#include "libavutil/thread.h"
#include <chromaprint.h>
#define CPR_VERSION_INT AV_VERSION_INT(CHROMAPRINT_VERSION_MAJOR, \
CHROMAPRINT_VERSION_MINOR, \
CHROMAPRINT_VERSION_PATCH)
+static AVMutex chromaprint_mutex = AV_MUTEX_INITIALIZER;
+
typedef enum FingerprintFormat {
FINGERPRINT_RAW,
FINGERPRINT_COMPRESSED,
@@ -52,9 +54,9 @@ static void deinit(AVFormatContext *s)
ChromaprintMuxContext *const cpr = s->priv_data;
if (cpr->ctx) {
- ff_lock_avformat();
+ ff_mutex_lock(&chromaprint_mutex);
chromaprint_free(cpr->ctx);
- ff_unlock_avformat();
+ ff_mutex_unlock(&chromaprint_mutex);
}
}
@@ -63,9 +65,9 @@ static av_cold int init(AVFormatContext *s)
ChromaprintMuxContext *cpr = s->priv_data;
AVStream *st;
- ff_lock_avformat();
+ ff_mutex_lock(&chromaprint_mutex);
cpr->ctx = chromaprint_new(cpr->algorithm);
- ff_unlock_avformat();
+ ff_mutex_unlock(&chromaprint_mutex);
if (!cpr->ctx) {
av_log(s, AV_LOG_ERROR, "Failed to create chromaprint context.\n");