Browse Source

Unbreak avcodec_thread_init

avcodec_thread_init currently doesn't do anything at all with pthreads enabled.
tags/n0.8
Reimar Döffinger 14 years ago
parent
commit
46027c7286
4 changed files with 8 additions and 8 deletions
  1. +1
    -1
      libavcodec/pthread.c
  2. +1
    -1
      libavcodec/thread.h
  3. +5
    -4
      libavcodec/utils.c
  4. +1
    -2
      libavcodec/w32thread.c

+ 1
- 1
libavcodec/pthread.c View File

@@ -880,7 +880,7 @@ static void validate_thread_parameters(AVCodecContext *avctx)
} }
} }


int ff_thread_init(AVCodecContext *avctx, int thread_count)
int ff_thread_init(AVCodecContext *avctx)
{ {
if (avctx->thread_opaque) { if (avctx->thread_opaque) {
av_log(avctx, AV_LOG_ERROR, "avcodec_thread_init is ignored after avcodec_open\n"); av_log(avctx, AV_LOG_ERROR, "avcodec_thread_init is ignored after avcodec_open\n");


+ 1
- 1
libavcodec/thread.h View File

@@ -108,7 +108,7 @@ int ff_thread_get_buffer(AVCodecContext *avctx, AVFrame *f);
*/ */
void ff_thread_release_buffer(AVCodecContext *avctx, AVFrame *f); void ff_thread_release_buffer(AVCodecContext *avctx, AVFrame *f);


int ff_thread_init(AVCodecContext *s, int thread_count);
int ff_thread_init(AVCodecContext *s);
void ff_thread_free(AVCodecContext *s); void ff_thread_free(AVCodecContext *s);


#endif /* AVCODEC_THREAD_H */ #endif /* AVCODEC_THREAD_H */

+ 5
- 4
libavcodec/utils.c View File

@@ -541,7 +541,7 @@ int attribute_align_arg avcodec_open(AVCodecContext *avctx, AVCodec *codec)
avctx->frame_number = 0; avctx->frame_number = 0;


if (HAVE_THREADS && !avctx->thread_opaque) { if (HAVE_THREADS && !avctx->thread_opaque) {
ret = ff_thread_init(avctx, avctx->thread_count);
ret = ff_thread_init(avctx);
if (ret < 0) { if (ret < 0) {
goto free_and_end; goto free_and_end;
} }
@@ -1193,8 +1193,7 @@ int av_get_bits_per_sample_format(enum AVSampleFormat sample_fmt) {
#endif #endif


#if !HAVE_THREADS #if !HAVE_THREADS
int ff_thread_init(AVCodecContext *s, int thread_count){
s->thread_count = thread_count;
int ff_thread_init(AVCodecContext *s){
return -1; return -1;
} }
#endif #endif
@@ -1337,7 +1336,9 @@ void ff_thread_await_progress(AVFrame *f, int progress, int field)


int avcodec_thread_init(AVCodecContext *s, int thread_count) int avcodec_thread_init(AVCodecContext *s, int thread_count)
{ {
return ff_thread_init(s, thread_count);
s->thread_count = thread_count;
s->thread_type = FF_THREAD_FRAME | FF_THREAD_SLICE;
return ff_thread_init(s);
} }


void avcodec_thread_free(AVCodecContext *s) void avcodec_thread_free(AVCodecContext *s)


+ 1
- 2
libavcodec/w32thread.c View File

@@ -125,7 +125,7 @@ static int avcodec_thread_execute2(AVCodecContext *s, int (*func)(AVCodecContext
avcodec_thread_execute(s, NULL, arg, ret, count, 0); avcodec_thread_execute(s, NULL, arg, ret, count, 0);
} }


int ff_thread_init(AVCodecContext *s, int thread_count){
int ff_thread_init(AVCodecContext *s){
int i; int i;
ThreadContext *c; ThreadContext *c;
uint32_t threadid; uint32_t threadid;
@@ -135,7 +135,6 @@ int ff_thread_init(AVCodecContext *s, int thread_count){
return 0; return 0;
} }


s->thread_count= thread_count;
s->active_thread_type= FF_THREAD_SLICE; s->active_thread_type= FF_THREAD_SLICE;


if (thread_count <= 1) if (thread_count <= 1)


Loading…
Cancel
Save