X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavcodec%2Fmsvideo1enc.c;h=971cce35e634c3d6a2ef4694c76e99e1818b4079;hb=7a1723086a9cc72c2f3e1e682b002ed3d81990d3;hp=837fca5ea4a4c21a29d3707e57caa09d7be71540;hpb=707138593af5c4783035d0b9cc2d7c8cb2137dfa;p=ffmpeg diff --git a/libavcodec/msvideo1enc.c b/libavcodec/msvideo1enc.c index 837fca5ea4a..971cce35e63 100644 --- a/libavcodec/msvideo1enc.c +++ b/libavcodec/msvideo1enc.c @@ -243,7 +243,7 @@ static int encode_frame(AVCodecContext *avctx, uint8_t *buf, int buf_size, void c->keyint = 0; else c->keyint++; - p->pict_type= keyframe ? FF_I_TYPE : FF_P_TYPE; + p->pict_type= keyframe ? AV_PICTURE_TYPE_I : AV_PICTURE_TYPE_P; p->key_frame= keyframe; return dst - buf; @@ -261,6 +261,10 @@ static av_cold int encode_init(AVCodecContext *avctx) if (av_image_check_size(avctx->width, avctx->height, 0, avctx) < 0) { return -1; } + if((avctx->width&3) || (avctx->height&3)){ + av_log(avctx, AV_LOG_ERROR, "width and height must be multiplies of 4\n"); + return -1; + } avcodec_get_frame_defaults(&c->pic); avctx->coded_frame = (AVFrame*)&c->pic; @@ -286,13 +290,13 @@ static av_cold int encode_end(AVCodecContext *avctx) } AVCodec ff_msvideo1_encoder = { - "msvideo1", - AVMEDIA_TYPE_VIDEO, - CODEC_ID_MSVIDEO1, - sizeof(Msvideo1EncContext), - encode_init, - encode_frame, - encode_end, + .name = "msvideo1", + .type = AVMEDIA_TYPE_VIDEO, + .id = CODEC_ID_MSVIDEO1, + .priv_data_size = sizeof(Msvideo1EncContext), + .init = encode_init, + .encode = encode_frame, + .close = encode_end, .pix_fmts = (const enum PixelFormat[]){PIX_FMT_RGB555, PIX_FMT_NONE}, .long_name = NULL_IF_CONFIG_SMALL("Microsoft Video-1"), };