[FFmpeg-devel] libavcodec/pthread.c:138: error: no previous prototype for 'avcodec_thread_execute2'

Benoit Fouet benoit.fouet
Mon Mar 8 16:57:24 CET 2010


On Mon, 08 Mar 2010 14:52:44 +0000 M?ns Rullg?rd wrote:
> Benoit Fouet <benoit.fouet at free.fr> writes:
> 
> > On Mon, 08 Mar 2010 14:17:01 +0000 M?ns Rullg?rd wrote:
> >> Benoit Fouet <benoit.fouet at free.fr> writes:
> >> 
> >> > On Mon, 08 Mar 2010 13:58:49 +0100 Andreas ?man wrote:
> >> >> Georgi Chorbadzhiyski wrote:
> >> >> > Around 03/08/10 12:43, Benoit Fouet scribbled:
> >> >> >> On Mon, 08 Mar 2010 12:28:37 +0200 Georgi Chorbadzhiyski wrote:
> >> >> >>> gf at gf:~/ffmpeg$ make
> >> >> >>> CC      libavcodec/pthread.o
> >> >> >>> libavcodec/pthread.c:138: error: no previous prototype for 'avcodec_thread_execute2'
> >> >> >>> make: *** [libavcodec/pthread.o] Error 1
> >> >> >>>
> >> >> >>> This fixes it but I don't think this is the correct fix. It should not give error
> >> >> >>> here.
> >> >> >> missing prototypes now results in an error.
> >> >> > 
> >> >> > I've missed this. This is a good change.
> >> >> 
> >> >> Fixed, and for w32thread.c as well.
> >> >
> >> > Your fix is not in line with what exists e.g. for avcodec_thread_execute
> >> > I don't know which solution we should aim at, but now we're somewhere
> >> > in between, and IMHO, that needs to be fixed: either make
> >> > avcodec_thread_execute2 part of the API, or remove the other ones from
> >> > the API.
> >> 
> >> Neither of them make sense in the public API.  There is no sensible
> >> way for an application to use them.
> >> 
> >
> > this is fine by me.
> > If my understanding is correct, anyone can add his own thread
> > management, right ? Then I guess we should provide function pointer
> > prototypes, instead of providing these.
> 
> We already have AVCodecContext.execute as a function pointer.
> 

let's drop what's unused in avcodec.h then.
Patch below to do that (I also made thread_func in OS/2 static, though
I can do it in a separate patch if needed, and if correct (maybe there
is some black magic things there preventing that to work correctly)),
does that look ok ?

Index: libavcodec/w32thread.c                  
===================================================================
--- libavcodec/w32thread.c      (revision 22327)                   
+++ libavcodec/w32thread.c      (working copy)                     
@@ -93,7 +93,11 @@ void avcodec_thread_free(AVCodecContext         
     av_freep(&s->thread_opaque);                                  
 }                                                                 
                                                                   
+#if LIBAVCODEC_VERSION_MAJOR < 53                                 
 int avcodec_thread_execute(AVCodecContext *s, int (*func)(AVCodecContext *c2, void *arg2),void *arg, int *ret, int count, int size){
+#else                                                                                                                               
+static int avcodec_thread_execute(AVCodecContext *s, int (*func)(AVCodecContext *c2, void *arg2),void *arg, int *ret, int count, int size){
+#endif                                                                                                                                     
     ThreadContext *c= s->thread_opaque;                                                                                                    
     int i;                                                                                                                                 
     int jobnr = 0;                                                                                                                         
Index: libavcodec/options.c                                                                                                                 
===================================================================                                                                         
--- libavcodec/options.c        (revision 22327)                                                                                            
+++ libavcodec/options.c        (working copy)                                                                                              
@@ -26,6 +26,9 @@                                                                                                                           
                                                                                                                                            
 #include "avcodec.h"                                                                                                                       
 #include "opt.h"                                                                                                                           
+#if LIBAVCODEC_VERSION_MAJOR >= 53                                                                                                         
+#include "internal.h"                                                                                                                      
+#endif                                                                                                                                     
 #include <float.h>              /* FLT_MIN, FLT_MAX */                                                                                     
                                                                                                                                            
 static const char* context_to_name(void* ptr) {                                                                                            
Index: libavcodec/internal.h                                                                                                                
===================================================================                                                                         
--- libavcodec/internal.h       (revision 22327)                                                                                            
+++ libavcodec/internal.h       (working copy)                                                                                              
@@ -48,4 +48,9 @@ AVHWAccel *ff_find_hwaccel(enum CodecID                                                                                   
  */                                                                                                                                        
 int ff_match_2uint16(const uint16_t (*tab)[2], int size, int a, int b);                                                                    
                                                                                                                                            
+#if LIBAVCODEC_VERSION_MAJOR >= 53                                                                                                         
+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);     
+#endif                                                                                                                                     
+                                                                                                                                           
 #endif /* AVCODEC_INTERNAL_H */                                                                                                            
Index: libavcodec/avcodec.h                                                                                                                 
===================================================================                                                                         
--- libavcodec/avcodec.h        (revision 22327)                                                                                            
+++ libavcodec/avcodec.h        (working copy)                                                                                              
@@ -3255,9 +3255,11 @@ enum PixelFormat avcodec_default_get_for                                                                             

 int avcodec_thread_init(AVCodecContext *s, int thread_count);
 void avcodec_thread_free(AVCodecContext *s);
+#if LIBAVCODEC_VERSION_MAJOR < 53
 int avcodec_thread_execute(AVCodecContext *s, int (*func)(AVCodecContext *c2, void *arg2),void *arg, int *ret, int count, int size);
 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);
+#endif
 //FIXME func typedef

 /**
Index: libavcodec/beosthread.c
===================================================================
--- libavcodec/beosthread.c     (revision 22327)
+++ libavcodec/beosthread.c     (working copy)
@@ -92,7 +92,11 @@ void avcodec_thread_free(AVCodecContext
     av_freep(&s->thread_opaque);
 }

+#if LIBAVCODEC_VERSION_MAJOR < 53
 int avcodec_thread_execute(AVCodecContext *s, int (*func)(AVCodecContext *c2, void *arg2),void *arg, int *ret, int count, int size){
+#else
+static int avcodec_thread_execute(AVCodecContext *s, int (*func)(AVCodecContext *c2, void *arg2),void *arg, int *ret, int count, int size){
+#endif
     ThreadContext *c= s->thread_opaque;
     int i;

Index: libavcodec/os2thread.c
===================================================================
--- libavcodec/os2thread.c      (revision 22327)
+++ libavcodec/os2thread.c      (working copy)
@@ -39,7 +39,7 @@ typedef struct ThreadContext{
 }ThreadContext;


-void attribute_align_arg thread_func(void *v){
+static void attribute_align_arg thread_func(void *v){
     ThreadContext *c= v;

     for(;;){
@@ -81,7 +81,11 @@ void avcodec_thread_free(AVCodecContext
     av_freep(&s->thread_opaque);
 }

+#if LIBAVCODEC_VERSION_MAJOR < 53
 int avcodec_thread_execute(AVCodecContext *s, int (*func)(AVCodecContext *c2, void *arg2),void *arg, int *ret, int count, int size){
+#else
+static int avcodec_thread_execute(AVCodecContext *s, int (*func)(AVCodecContext *c2, void *arg2),void *arg, int *ret, int count, int size){
+#endif
     ThreadContext *c= s->thread_opaque;
     int i;

Index: libavcodec/pthread.c
===================================================================
--- libavcodec/pthread.c        (revision 22327)
+++ libavcodec/pthread.c        (working copy)
@@ -104,7 +104,11 @@ void avcodec_thread_free(AVCodecContext
     av_freep(&avctx->thread_opaque);
 }

+#if LIBAVCODEC_VERSION_MAJOR < 53
 int avcodec_thread_execute(AVCodecContext *avctx, action_func* func, void *arg, int *ret, int job_count, int job_size)
+#else
+static int avcodec_thread_execute(AVCodecContext *avctx, action_func* func, void *arg, int *ret, int job_count, int job_size)
+#endif
 {
     ThreadContext *c= avctx->thread_opaque;
     int dummy_ret;



More information about the ffmpeg-devel mailing list