This commit is contained in:
veejay
2023-09-17 03:25:07 +02:00
parent aae4b90ee7
commit 659626854e
2 changed files with 16 additions and 1 deletions

View File

@@ -229,9 +229,16 @@ static vj_encoder *vj_avcodec_new_encoder( int id, VJFrame *frame, char *filenam
e->context->pix_fmt = get_ffmpeg_pixfmt( out_pixel_format );
pf = e->context->pix_fmt;
char *descr = vj_avcodec_get_codec_name( id );
#if LIBAVCODEC_BUILD > 5400
int n_threads = avhelper_set_num_decoders();
if( n_threads > 0 ) {
e->context->thread_count = n_threads;
e->context->thread_type = FF_THREAD_FRAME;
}
if ( avcodec_open2( e->context, e->codec, NULL ) )
#else
if ( avcodec_open( e->context, e->codec ) < 0 )

View File

@@ -617,6 +617,14 @@ static int v4l2_setup_avcodec_capture( v4l2info *v, int wid, int hei, int codec_
v->c->flags |= CODEC_FLAG_TRUNCATED;
#if LIBAVCODEC_BUILD > 5400
int n_threads = avhelper_set_num_decoders();
if( n_threads > 0 ) {
e->context->thread_count = n_threads;
e->context->thread_type = FF_THREAD_FRAME;
}
if( avcodec_open2( v->c, v->codec, NULL ) < 0 )
#else
if( avcodec_open( v->c, v->codec ) < 0 )