revert hwaccel=auto via ffmpeg

This commit is contained in:
veejay
2023-09-18 23:51:07 +02:00
parent 3b2bb181c3
commit 097bf2525f
3 changed files with 17 additions and 19 deletions

View File

@@ -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;
}

View File

@@ -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,

View File

@@ -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 ) {