- if( h->scaler && h->cur_width == frame->EncodedWidth && h->cur_height == frame->EncodedHeight &&
- h->cur_pix_fmt == frame->EncodedPixelFormat )
- return 0;
- if( h->scaler )
- {
- sws_freeContext( h->scaler );
- fprintf( stderr, "ffms [warning]: stream properties changed to %dx%d, %s at frame %d \n", frame->EncodedWidth,
- frame->EncodedHeight, avcodec_get_pix_fmt_name( frame->EncodedPixelFormat ), i_frame );
- h->cur_width = frame->EncodedWidth;
- h->cur_height = frame->EncodedHeight;
- h->cur_pix_fmt = frame->EncodedPixelFormat;
- }
- h->scaler = sws_getContext( h->cur_width, h->cur_height, h->cur_pix_fmt, h->init_width, h->init_height,
- PIX_FMT_YUV420P, SWS_BICUBIC, NULL, NULL, NULL );
- if( !h->scaler )
- {
- fprintf( stderr, "ffms [error]: could not open swscale context\n" );
+ if( x264_cli_pic_alloc( pic, X264_CSP_NONE, width, height ) )