summaryrefslogtreecommitdiff
path: root/libavcodec/utils.c
diff options
context:
space:
mode:
authorAlexander Strange <astrange@ithinksw.com>2011-02-07 21:15:45 -0500
committerRonald S. Bultje <rsbultje@gmail.com>2011-02-09 09:17:28 -0500
commitc0b102ca03fe92250f1ce620aec3836f529fc1d6 (patch)
tree1087a645990e02587a8c92c7d4298c25b3c4f55b /libavcodec/utils.c
parent8e8cc52be3b515bc91cd9452daca7a65feaea5ad (diff)
Deprecate avcodec_thread_init()
As a side effect of the last commit, avcodec_open() now calls it automatically, so there is no longer any need for clients to call it. Instead they should set AVCodecContext.thread_count. avcodec_thread_free() is deprecated, and will be removed from avcodec.h at the next MAJOR libavcodec bump. Rename the functions to ff_thread_init/free, since they are now internal. Wrappers are provided to maintain API compatibility. Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
Diffstat (limited to 'libavcodec/utils.c')
-rw-r--r--libavcodec/utils.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index 529369bd2a..eede431e32 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -540,7 +540,7 @@ int attribute_align_arg avcodec_open(AVCodecContext *avctx, AVCodec *codec)
avctx->frame_number = 0;
if (HAVE_THREADS && !avctx->thread_opaque) {
- ret = avcodec_thread_init(avctx, avctx->thread_count);
+ ret = ff_thread_init(avctx, avctx->thread_count);
if (ret < 0) {
goto free_and_end;
}
@@ -777,7 +777,7 @@ av_cold int avcodec_close(AVCodecContext *avctx)
}
if (HAVE_THREADS && avctx->thread_opaque)
- avcodec_thread_free(avctx);
+ ff_thread_free(avctx);
if (avctx->codec && avctx->codec->close)
avctx->codec->close(avctx);
avcodec_default_free_buffers(avctx);
@@ -1138,7 +1138,7 @@ int av_get_bits_per_sample_format(enum AVSampleFormat sample_fmt) {
#endif
#if !HAVE_THREADS
-int avcodec_thread_init(AVCodecContext *s, int thread_count){
+int ff_thread_init(AVCodecContext *s, int thread_count){
s->thread_count = thread_count;
return -1;
}
@@ -1277,3 +1277,17 @@ void ff_thread_await_progress(AVFrame *f, int progress, int field)
}
#endif
+
+#if LIBAVCODEC_VERSION_MAJOR < 53
+
+int avcodec_thread_init(AVCodecContext *s, int thread_count)
+{
+ return ff_thread_init(s, thread_count);
+}
+
+void avcodec_thread_free(AVCodecContext *s)
+{
+ return ff_thread_free(s);
+}
+
+#endif