From 097bf2525f4725cb3977a07472cea62dad2607ec Mon Sep 17 00:00:00 2001 From: veejay <> Date: Mon, 18 Sep 2023 23:51:07 +0200 Subject: [PATCH] revert hwaccel=auto via ffmpeg --- veejay-current/veejay-server/libel/avhelper.c | 24 +++++++++---------- .../veejay-server/libel/vj-avcodec.c | 2 +- .../veejay-server/libstream/vj-tag.c | 10 ++++---- 3 files changed, 17 insertions(+), 19 deletions(-) diff --git a/veejay-current/veejay-server/libel/avhelper.c b/veejay-current/veejay-server/libel/avhelper.c index 99549eb5..96f215a5 100644 --- a/veejay-current/veejay-server/libel/avhelper.c +++ b/veejay-current/veejay-server/libel/avhelper.c @@ -306,17 +306,17 @@ void *avhelper_get_mjpeg_decoder(VJFrame *output) { x->codec_ctx->thread_type = FF_THREAD_FRAME; } - AVDictionary *options = NULL; - av_dict_set(&options, "hwaccel", "auto", 0); + //AVDictionary *options = NULL; + //av_dict_set(&options, "hwaccel", "auto", 0); - if ( avcodec_open2( x->codec_ctx, x->codec, &options ) < 0 ) + if ( avcodec_open2( x->codec_ctx, x->codec, NULL ) < 0 ) #else x->codec_ctx = avcodec_alloc_context(); if ( avcodec_open( x->codec_ctx, x->codec ) < 0 ) #endif { free(x); - av_dict_free(&options); + //av_dict_free(&options); return NULL; } @@ -324,9 +324,9 @@ void *avhelper_get_mjpeg_decoder(VJFrame *output) { x->frames[1] = avhelper_alloc_frame(); x->output = yuv_yuv_template( NULL,NULL,NULL, output->width, output->height, alpha_fmt_to_yuv(output->format) ); - av_dict_free(&options); + //av_dict_free(&options); - avhelper_hwaccel(x->codec_ctx); + //avhelper_hwaccel(x->codec_ctx); return (void*) x; } @@ -571,17 +571,17 @@ further: x->codec_ctx->thread_type = FF_THREAD_FRAME; } - AVDictionary *options = NULL; - av_dict_set(&options, "hwaccel", "auto", 0); + //AVDictionary *options = NULL; + //av_dict_set(&options, "hwaccel", "auto", 0); - if ( avcodec_open2( x->codec_ctx, x->codec, &options ) < 0 ) + if ( avcodec_open2( x->codec_ctx, x->codec, NULL ) < 0 ) #else if ( avcodec_open( x->codec_ctx, x->codec ) < 0 ) #endif { avhelper_close_input_file( x->avformat_ctx ); free(x); - av_dict_free(&options); + //av_dict_free(&options); return NULL; } @@ -607,7 +607,7 @@ further: break; } av_free(f); - av_dict_free(&options); + //av_dict_free(&options); if(!got_picture) { veejay_msg(VEEJAY_MSG_ERROR, "FFmpeg: Unable to get whole picture from %s", filename ); @@ -624,7 +624,7 @@ further: x->frames[1] = avhelper_alloc_frame(); x->input = yuv_yuv_template( NULL,NULL,NULL, x->codec_ctx->width,x->codec_ctx->height, x->pixfmt ); - avhelper_hwaccel(x->codec_ctx); + //avhelper_hwaccel(x->codec_ctx); return (void*) x; } diff --git a/veejay-current/veejay-server/libel/vj-avcodec.c b/veejay-current/veejay-server/libel/vj-avcodec.c index 05e40ce2..cca34a57 100644 --- a/veejay-current/veejay-server/libel/vj-avcodec.c +++ b/veejay-current/veejay-server/libel/vj-avcodec.c @@ -589,7 +589,7 @@ static int vj_avcodec_encode_video( AVCodecContext *ctx, uint8_t *buf, int len, return avcodec_encode_video(ctx,buf,len,frame); } - return 0; + return -1; } int vj_avcodec_encode_frame(void *encoder, long nframe,int format, uint8_t *src[4], uint8_t *buf, int buf_len, diff --git a/veejay-current/veejay-server/libstream/vj-tag.c b/veejay-current/veejay-server/libstream/vj-tag.c index 851b3d97..13adaa63 100644 --- a/veejay-current/veejay-server/libstream/vj-tag.c +++ b/veejay-current/veejay-server/libstream/vj-tag.c @@ -3077,23 +3077,21 @@ int vj_tag_var(int t1, int *type, int *fader, int *fx_sta , int *rec_sta, int *a int vj_tag_record_frame(int t1, uint8_t *buffer[4], uint8_t *abuff, int audio_size,int pixel_format) { vj_tag *tag = vj_tag_get(t1); - int buf_len = 0; + int ret = 0; if(!tag) return -1; if(!tag->encoder_active) return -1; long nframe = tag->encoder_frames_recorded; - uint8_t *dst = vj_avcodec_get_buf(tag->encoder); - - buf_len = vj_avcodec_encode_frame( tag->encoder, nframe, tag->encoder_format, buffer,dst, tag->encoder_max_size, pixel_format); - if(buf_len <= 0 ) { + ret = vj_avcodec_encode_frame( tag->encoder, nframe, tag->encoder_format, buffer,vj_avcodec_get_buf(tag->encoder), tag->encoder_max_size, pixel_format); + if(ret < 0 ) { veejay_msg(VEEJAY_MSG_ERROR, "Unable to encode frame" ); return -1; } if(tag->encoder_file ) { - if(lav_write_frame(tag->encoder_file, vj_avcodec_get_buf(tag->encoder), buf_len,1)) + if(lav_write_frame(tag->encoder_file, vj_avcodec_get_buf(tag->encoder), ret,1)) { veejay_msg(VEEJAY_MSG_ERROR, "%s", lav_strerror()); if( tag->encoder_frames_recorded > 1 ) {