[FFmpeg-devel] [PATCH 2/6] Deprecate avcodec_thread_init()

Alexander Strange astrange
Fri Jan 21 12:31:35 CET 2011


On Jan 21, 2011, at 6:09 AM, Alexander Strange wrote:

> 
> On Wed, Dec 1, 2010 at 11:51 AM, Michael Niedermayer <michaelni at gmx.at> wrote:
>> On Mon, Nov 15, 2010 at 08:37:02AM -0500, Alexander Strange wrote:
>>> 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() will be removed from avcodec.h at the same time; there
>>> is no need to mark it deprecated as clients already had no reason to call it.
>> [...]
>>> @@ -3544,8 +3544,14 @@ int avcodec_check_dimensions(void *av_log_ctx, unsigned int w, unsigned int h);
>>> 
>>> enum PixelFormat avcodec_default_get_format(struct AVCodecContext *s, const enum PixelFormat * fmt);
>>> 
>>> +#if LIBAVCODEC_VERSION_MAJOR < 53
>>> +/**
>>> + * @deprecated Set s->thread_count before calling avcodec_open() instead of calling this.
>>> + */
>>> +attribute_deprecated
>>> int avcodec_thread_init(AVCodecContext *s, int thread_count);
>>> void avcodec_thread_free(AVCodecContext *s);
>>> +#endif
>> 
>> missing a 2nd attribute_deprecated
> 
> The problem is that avcodec_thread_free is never called outside lavc, it's just declared in a public header anyway.
> Adding attribute_deprecated causes a new warning inside lavc but doesn't help any clients.
> 
> I could do it anyway and ignore that.
> 
>>> 
>>> int avcodec_default_execute(AVCodecContext *c, int (*func)(AVCodecContext *c2, void *arg2),void *arg, int *ret, int count, int size);
>>> int avcodec_default_execute2(AVCodecContext *c, int (*func)(AVCodecContext *c2, void *arg2, int, int),void *arg, int *ret, int count);
>>> //FIXME func typedef
>>> diff --git a/libavcodec/thread.h b/libavcodec/thread.h
>>> index ac370bd..0267c6f 100644
>>> --- a/libavcodec/thread.h
>>> +++ b/libavcodec/thread.h
>>> @@ -95,4 +95,9 @@ int ff_thread_get_buffer(AVCodecContext *avctx, AVFrame *f);
>>>  */
>>> void ff_thread_release_buffer(AVCodecContext *avctx, AVFrame *f);
>>> 
>>> +#if LIBAVCODEC_VERSION_MAJOR >= 53
>>> +int avcodec_thread_init(AVCodecContext *s, int thread_count);
>>> +void avcodec_thread_free(AVCodecContext *s);
>>> +#endif
>> 
>> they should be renamed to ff_ and wrapers removed once the major ver is bumped
> 
> Done.

Completing my attempt at working past 4am, a version that compiles with --disable-pthreads.

The rest of this patch series is unchanged.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0003-Deprecate-avcodec_thread_init.patch
Type: application/octet-stream
Size: 8767 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20110121/a930318a/attachment.obj>



More information about the ffmpeg-devel mailing list