ffmpeg update

This commit is contained in:
Joachim Schoeberl 2013-11-07 13:01:37 +00:00
parent ffa8e70e26
commit a446812c6a

View File

@ -2236,7 +2236,7 @@ namespace netgen
double tmp = context->width * context->height * 255.0 * 255.0; double tmp = context->width * context->height * 255.0 * 255.0;
double Ypsnr = psnr( context->coded_frame->error[0] / tmp ); double Ypsnr = psnr( context->coded_frame->error[0] / tmp );
double quality = context->coded_frame->quality/(double)FF_QP2LAMBDA; double quality = context->coded_frame->quality/(double)FF_QP2LAMBDA;
char pict_type = av_get_pict_type_char(context->coded_frame->pict_type); char pict_type = av_get_picture_type_char(context->coded_frame->pict_type);
cout << "video: frame=" << count_frames << " type=" << pict_type; cout << "video: frame=" << count_frames << " type=" << pict_type;
cout << " size=" << bytes << " PSNR(Y)=" << Ypsnr << " dB q=" << (float)quality << endl; cout << " size=" << bytes << " PSNR(Y)=" << Ypsnr << " dB q=" << (float)quality << endl;
} }
@ -2320,7 +2320,8 @@ namespace netgen
// Init codec context etc.: // Init codec context etc.:
//-------------------------- //--------------------------
context = avcodec_alloc_context(); // context = avcodec_alloc_context();
context = avcodec_alloc_context3(codec);
context->bit_rate = bitrate; context->bit_rate = bitrate;
context->width = nx; context->width = nx;
@ -2331,7 +2332,8 @@ namespace netgen
context->pix_fmt = PIX_FMT_YUV420P; context->pix_fmt = PIX_FMT_YUV420P;
context->flags |= CODEC_FLAG_PSNR; context->flags |= CODEC_FLAG_PSNR;
if( avcodec_open( context, codec ) < 0 ) { // if( avcodec_open( context, codec ) < 0 ) {
if( avcodec_open2( context, codec, NULL) < 0 ) {
cout << "can't open codec" << endl; cout << "can't open codec" << endl;
avcodec_close( context ); avcodec_close( context );
av_free( context ); av_free( context );