mirror of
https://github.com/game-stop/veejay.git
synced 2025-12-21 23:30:00 +01:00
revert hwaccel=auto via ffmpeg
This commit is contained in:
@@ -306,17 +306,17 @@ void *avhelper_get_mjpeg_decoder(VJFrame *output) {
|
|||||||
x->codec_ctx->thread_type = FF_THREAD_FRAME;
|
x->codec_ctx->thread_type = FF_THREAD_FRAME;
|
||||||
}
|
}
|
||||||
|
|
||||||
AVDictionary *options = NULL;
|
//AVDictionary *options = NULL;
|
||||||
av_dict_set(&options, "hwaccel", "auto", 0);
|
//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
|
#else
|
||||||
x->codec_ctx = avcodec_alloc_context();
|
x->codec_ctx = avcodec_alloc_context();
|
||||||
if ( avcodec_open( x->codec_ctx, x->codec ) < 0 )
|
if ( avcodec_open( x->codec_ctx, x->codec ) < 0 )
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
free(x);
|
free(x);
|
||||||
av_dict_free(&options);
|
//av_dict_free(&options);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -324,9 +324,9 @@ void *avhelper_get_mjpeg_decoder(VJFrame *output) {
|
|||||||
x->frames[1] = avhelper_alloc_frame();
|
x->frames[1] = avhelper_alloc_frame();
|
||||||
|
|
||||||
x->output = yuv_yuv_template( NULL,NULL,NULL, output->width, output->height, alpha_fmt_to_yuv(output->format) );
|
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;
|
return (void*) x;
|
||||||
}
|
}
|
||||||
@@ -571,17 +571,17 @@ further:
|
|||||||
x->codec_ctx->thread_type = FF_THREAD_FRAME;
|
x->codec_ctx->thread_type = FF_THREAD_FRAME;
|
||||||
}
|
}
|
||||||
|
|
||||||
AVDictionary *options = NULL;
|
//AVDictionary *options = NULL;
|
||||||
av_dict_set(&options, "hwaccel", "auto", 0);
|
//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
|
#else
|
||||||
if ( avcodec_open( x->codec_ctx, x->codec ) < 0 )
|
if ( avcodec_open( x->codec_ctx, x->codec ) < 0 )
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
avhelper_close_input_file( x->avformat_ctx );
|
avhelper_close_input_file( x->avformat_ctx );
|
||||||
free(x);
|
free(x);
|
||||||
av_dict_free(&options);
|
//av_dict_free(&options);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -607,7 +607,7 @@ further:
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
av_free(f);
|
av_free(f);
|
||||||
av_dict_free(&options);
|
//av_dict_free(&options);
|
||||||
|
|
||||||
if(!got_picture) {
|
if(!got_picture) {
|
||||||
veejay_msg(VEEJAY_MSG_ERROR, "FFmpeg: Unable to get whole picture from %s", filename );
|
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->frames[1] = avhelper_alloc_frame();
|
||||||
x->input = yuv_yuv_template( NULL,NULL,NULL, x->codec_ctx->width,x->codec_ctx->height, x->pixfmt );
|
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;
|
return (void*) x;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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 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,
|
int vj_avcodec_encode_frame(void *encoder, long nframe,int format, uint8_t *src[4], uint8_t *buf, int buf_len,
|
||||||
|
|||||||
@@ -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) {
|
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);
|
vj_tag *tag = vj_tag_get(t1);
|
||||||
int buf_len = 0;
|
int ret = 0;
|
||||||
if(!tag) return -1;
|
if(!tag) return -1;
|
||||||
|
|
||||||
if(!tag->encoder_active) return -1;
|
if(!tag->encoder_active) return -1;
|
||||||
|
|
||||||
long nframe = tag->encoder_frames_recorded;
|
long nframe = tag->encoder_frames_recorded;
|
||||||
|
|
||||||
uint8_t *dst = vj_avcodec_get_buf(tag->encoder);
|
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 ) {
|
||||||
buf_len = vj_avcodec_encode_frame( tag->encoder, nframe, tag->encoder_format, buffer,dst, tag->encoder_max_size, pixel_format);
|
|
||||||
if(buf_len <= 0 ) {
|
|
||||||
veejay_msg(VEEJAY_MSG_ERROR, "Unable to encode frame" );
|
veejay_msg(VEEJAY_MSG_ERROR, "Unable to encode frame" );
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(tag->encoder_file ) {
|
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());
|
veejay_msg(VEEJAY_MSG_ERROR, "%s", lav_strerror());
|
||||||
if( tag->encoder_frames_recorded > 1 ) {
|
if( tag->encoder_frames_recorded > 1 ) {
|
||||||
|
|||||||
Reference in New Issue
Block a user