diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index 499cff7cff..3f6ee75661 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -39,6 +39,7 @@ enum CodecType { }; enum PixelFormat { + PIX_FMT_ANY, PIX_FMT_YUV420P, PIX_FMT_YUV422, PIX_FMT_RGB24, @@ -98,7 +99,7 @@ typedef struct AVCodecContext { #define FF_ASPECT_16_9_625 4 #define FF_ASPECT_16_9_525 5 int gop_size; /* 0 = intra only */ - int pix_fmt; /* pixel format, see PIX_FMT_xxx */ + enum PixelFormat pix_fmt; /* pixel format, see PIX_FMT_xxx */ /* if non NULL, 'draw_horiz_band' is called by the libavcodec decoder to draw an horizontal band. It improve cache usage. Not diff --git a/libavcodec/imgconvert.c b/libavcodec/imgconvert.c index d39b6c1e9b..b3f9a367bf 100644 --- a/libavcodec/imgconvert.c +++ b/libavcodec/imgconvert.c @@ -361,6 +361,8 @@ int img_convert(AVPicture *dst, int dst_pix_fmt, { int i; + assert(pix_fmt != PIX_FMT_ANY && dst_pix_fmt != PIX_FMT_ANY); + if (dst_pix_fmt == pix_fmt) { switch(pix_fmt) { case PIX_FMT_YUV420P: diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c index 417c63ea63..778ef76470 100644 --- a/libavcodec/mpegvideo.c +++ b/libavcodec/mpegvideo.c @@ -286,6 +286,8 @@ int MPV_encode_init(AVCodecContext *avctx) MpegEncContext *s = avctx->priv_data; int i; + avctx->pix_fmt = PIX_FMT_YUV420P; + s->bit_rate = avctx->bit_rate; s->bit_rate_tolerance = avctx->bit_rate_tolerance; s->frame_rate = avctx->frame_rate; diff --git a/libavcodec/utils.c b/libavcodec/utils.c index 9a4abaa9ba..815d215757 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -205,6 +205,7 @@ AVCodec *avcodec_find(enum CodecID id) } const char *pix_fmt_str[] = { + "??", "yuv420p", "yuv422", "rgb24", @@ -259,6 +260,9 @@ void avcodec_string(char *buf, int buf_size, AVCodecContext *enc, int encode) enc->width, enc->height, (float)enc->frame_rate / FRAME_RATE_BASE); } + snprintf(buf + strlen(buf), buf_size - strlen(buf), + ", q=%d-%d", enc->qmin, enc->qmax); + bitrate = enc->bit_rate; break; case CODEC_TYPE_AUDIO: