context->flags |= CODEC_FLAG_GRAY;
}
- if( job->pass )
+ if( job->pass != 0 && job->pass != -1 )
{
char filename[1024]; memset( filename, 0, 1024 );
hb_get_tempory_filename( job->h, filename, "ffmpeg.log" );
if( pv->context )
{
hb_log( "encavcodec: closing libavcodec" );
+ avcodec_flush_buffers( pv->context );
avcodec_close( pv->context );
}
if( pv->file )
{
fclose( pv->file );
}
+ free( pv );
+ w->private_data = NULL;
}
/***********************************************************************
AVFrame * frame;
hb_buffer_t * in = *buf_in, * buf;
+ if(!in->data)
+ {
+ *buf_out = NULL;
+ return HB_WORK_DONE;
+ }
+
frame = avcodec_alloc_frame();
frame->data[0] = in->data;
frame->data[1] = frame->data[0] + job->width * job->height;
frame );
buf->start = in->start;
buf->stop = in->stop;
- buf->key = pv->context->coded_frame->key_frame;
+ buf->frametype = pv->context->coded_frame->key_frame ? HB_FRAME_KEY : HB_FRAME_REF;
av_free( frame );