summaryrefslogtreecommitdiffstats
path: root/libhb/decavcodec.c
diff options
context:
space:
mode:
authorjstebbins <[email protected]>2008-12-12 18:54:36 +0000
committerjstebbins <[email protected]>2008-12-12 18:54:36 +0000
commit47b9304671876792e9a2364e867c9601d0432076 (patch)
tree7db84f17a253b6767552495b92ed6341000af62c /libhb/decavcodec.c
parentcec83b5d831f2c988e5544ddc16602bda903a225 (diff)
fix a threading issue with avcodec_open/close
these functions can not be called from 2 threads simultaneosly. made a wrapper function that holds a lock while making the call git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2023 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'libhb/decavcodec.c')
-rw-r--r--libhb/decavcodec.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/libhb/decavcodec.c b/libhb/decavcodec.c
index d443b4ac0..12c9802bb 100644
--- a/libhb/decavcodec.c
+++ b/libhb/decavcodec.c
@@ -197,7 +197,7 @@ static int decavcodecInit( hb_work_object_t * w, hb_job_t * job )
pv->parser = av_parser_init( codec_id );
pv->context = avcodec_alloc_context();
- avcodec_open( pv->context, codec );
+ hb_avcodec_open( pv->context, codec );
return 0;
}
@@ -229,7 +229,7 @@ static void decavcodecClose( hb_work_object_t * w )
}
if ( pv->context && pv->context->codec )
{
- avcodec_close( pv->context );
+ hb_avcodec_close( pv->context );
}
if ( pv->list )
{
@@ -798,9 +798,9 @@ static int decavcodecvWork( hb_work_object_t * w, hb_buffer_t ** buf_in,
// There's a mis-feature in ffmpeg that causes the context to be
// incorrectly initialized the 1st time avcodec_open is called.
// If you close it and open a 2nd time, it finishes the job.
- avcodec_open( pv->context, codec );
- avcodec_close( pv->context );
- avcodec_open( pv->context, codec );
+ hb_avcodec_open( pv->context, codec );
+ hb_avcodec_close( pv->context );
+ hb_avcodec_open( pv->context, codec );
}
if( in->start >= 0 )
@@ -902,7 +902,7 @@ static void init_ffmpeg_context( hb_work_object_t *w )
if ( ! pv->context->codec )
{
AVCodec *codec = avcodec_find_decoder( pv->context->codec_id );
- avcodec_open( pv->context, codec );
+ hb_avcodec_open( pv->context, codec );
}
// set up our best guess at the frame duration.
// the frame rate in the codec is usually bogus but it's sometimes