int ff_lock_avcodec(AVCodecContext *log_ctx, const AVCodec *codec);
int ff_unlock_avcodec(const AVCodec *codec);
-int avpriv_lock_avformat(void);
-int avpriv_unlock_avformat(void);
-
/**
* Maximum size in bytes of extradata.
* This value was chosen such that every bit of the buffer is
volatile int ff_avcodec_locked;
static atomic_int entangled_thread_counter = ATOMIC_VAR_INIT(0);
static AVMutex codec_mutex = AV_MUTEX_INITIALIZER;
-static AVMutex avformat_mutex = AV_MUTEX_INITIALIZER;
void av_fast_padded_malloc(void *ptr, unsigned int *size, size_t min_size)
{
return 0;
}
-int avpriv_lock_avformat(void)
-{
- return ff_mutex_lock(&avformat_mutex) ? -1 : 0;
-}
-
-int avpriv_unlock_avformat(void)
-{
- return ff_mutex_unlock(&avformat_mutex) ? -1 : 0;
-}
-
unsigned int avpriv_toupper4(unsigned int x)
{
return av_toupper(x & 0xFF) +
int ret;
// Calling library must implement a lock for thread-safe opens.
- if (ret = avpriv_lock_avformat())
+ if (ret = ff_lock_avformat())
return ret;
if (ret = avisynth_open_file(s)) {
- avpriv_unlock_avformat();
+ ff_unlock_avformat();
return ret;
}
- avpriv_unlock_avformat();
+ ff_unlock_avformat();
return 0;
}
static av_cold int avisynth_read_close(AVFormatContext *s)
{
- if (avpriv_lock_avformat())
+ if (ff_lock_avformat())
return AVERROR_UNKNOWN;
avisynth_context_destroy(s->priv_data);
- avpriv_unlock_avformat();
+ ff_unlock_avformat();
return 0;
}
*/
#include "avformat.h"
+#include "internal.h"
#include "libavutil/opt.h"
#include "libavcodec/internal.h"
#include <chromaprint.h>
static void cleanup(ChromaprintMuxContext *cpr)
{
if (cpr->ctx) {
- avpriv_lock_avformat();
+ ff_lock_avformat();
chromaprint_free(cpr->ctx);
- avpriv_unlock_avformat();
+ ff_unlock_avformat();
}
}
ChromaprintMuxContext *cpr = s->priv_data;
AVStream *st;
- avpriv_lock_avformat();
+ ff_lock_avformat();
cpr->ctx = chromaprint_new(cpr->algorithm);
- avpriv_unlock_avformat();
+ ff_unlock_avformat();
if (!cpr->ctx) {
av_log(s, AV_LOG_ERROR, "Failed to create chromaprint context.\n");
int ff_interleaved_peek(AVFormatContext *s, int stream,
AVPacket *pkt, int add_offset);
+
+int ff_lock_avformat(void);
+int ff_unlock_avformat(void);
+
#endif /* AVFORMAT_INTERNAL_H */
void ff_gnutls_init(void)
{
- avpriv_lock_avformat();
+ ff_lock_avformat();
#if HAVE_THREADS && GNUTLS_VERSION_NUMBER < 0x020b00
if (gcry_control(GCRYCTL_ANY_INITIALIZATION_P) == 0)
gcry_control(GCRYCTL_SET_THREAD_CBS, &gcry_threads_pthread);
#endif
gnutls_global_init();
- avpriv_unlock_avformat();
+ ff_unlock_avformat();
}
void ff_gnutls_deinit(void)
{
- avpriv_lock_avformat();
+ ff_lock_avformat();
gnutls_global_deinit();
- avpriv_unlock_avformat();
+ ff_unlock_avformat();
}
static int print_tls_error(URLContext *h, int ret)
int ff_openssl_init(void)
{
- avpriv_lock_avformat();
+ ff_lock_avformat();
if (!openssl_init) {
SSL_library_init();
SSL_load_error_strings();
int i;
openssl_mutexes = av_malloc_array(sizeof(pthread_mutex_t), CRYPTO_num_locks());
if (!openssl_mutexes) {
- avpriv_unlock_avformat();
+ ff_unlock_avformat();
return AVERROR(ENOMEM);
}
#endif
}
openssl_init++;
- avpriv_unlock_avformat();
+ ff_unlock_avformat();
return 0;
}
void ff_openssl_deinit(void)
{
- avpriv_lock_avformat();
+ ff_lock_avformat();
openssl_init--;
if (!openssl_init) {
#if HAVE_THREADS
}
#endif
}
- avpriv_unlock_avformat();
+ ff_unlock_avformat();
}
static int print_tls_error(URLContext *h, int ret)
#include "libavutil/opt.h"
#include "libavutil/parseutils.h"
#include "libavutil/pixdesc.h"
+#include "libavutil/thread.h"
#include "libavutil/time.h"
#include "libavutil/time_internal.h"
#include "libavutil/timestamp.h"
#include "libavutil/ffversion.h"
const char av_format_ffversion[] = "FFmpeg version " FFMPEG_VERSION;
+static AVMutex avformat_mutex = AV_MUTEX_INITIALIZER;
+
/**
* @file
* various utility functions for use within FFmpeg
return LICENSE_PREFIX FFMPEG_LICENSE + sizeof(LICENSE_PREFIX) - 1;
}
+int ff_lock_avformat(void)
+{
+ return ff_mutex_lock(&avformat_mutex) ? -1 : 0;
+}
+
+int ff_unlock_avformat(void)
+{
+ return ff_mutex_unlock(&avformat_mutex) ? -1 : 0;
+}
+
#define RELATIVE_TS_BASE (INT64_MAX - (1LL<<48))
static int is_relative(int64_t ts) {