]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/os2thread.c
VP3: Do not ignore error from read_huffman_tree().
[ffmpeg] / libavcodec / os2thread.c
index 21e867b25a7ec0a107e51036c27a4b9522dde824..edebc9a6c8e95c2b96f50fe25a838f8269b5f051 100644 (file)
  *
  * You should have received a copy of the GNU Lesser General Public
  * License along with FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
- *
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 //#define DEBUG
 
 // Ported by Vlad Stelmahovsky
 
 #include "avcodec.h"
-#include "common.h"
-
-#ifdef HAVE_THREADS
 
 #define INCL_DOS
 #define INCL_DOSERRORS
@@ -43,7 +39,7 @@ typedef struct ThreadContext{
 }ThreadContext;
 
 
-void thread_func(void *v){
+void attribute_align_arg thread_func(void *v){
     ThreadContext *c= v;
 
     for(;;){
@@ -65,7 +61,7 @@ void thread_func(void *v){
 
 /**
  * free what has been allocated by avcodec_thread_init().
- * must be called after decoding has finished, especially dont call while avcodec_thread_execute() is running
+ * must be called after decoding has finished, especially do not call while avcodec_thread_execute() is running
  */
 void avcodec_thread_free(AVCodecContext *s){
     ThreadContext *c= s->thread_opaque;
@@ -85,7 +81,7 @@ void avcodec_thread_free(AVCodecContext *s){
     av_freep(&s->thread_opaque);
 }
 
-int avcodec_thread_execute(AVCodecContext *s, int (*func)(AVCodecContext *c2, void *arg2),void **arg, int *ret, int count){
+int avcodec_thread_execute(AVCodecContext *s, int (*func)(AVCodecContext *c2, void *arg2),void *arg, int *ret, int count, int size){
     ThreadContext *c= s->thread_opaque;
     int i;
 
@@ -96,7 +92,7 @@ int avcodec_thread_execute(AVCodecContext *s, int (*func)(AVCodecContext *c2, vo
 
     for(i=0; i<count; i++){
 
-        c[i].arg= arg[i];
+        c[i].arg= (char*)arg + i*size;
         c[i].func= func;
         c[i].ret= 12345;
 
@@ -147,4 +143,3 @@ fail:
     avcodec_thread_free(s);
     return -1;
 }
-#endif