]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/v210enc.c
Extradata length checks for Huffyuv.
[ffmpeg] / libavcodec / v210enc.c
index ccff9728e0352b06b101c9a4ab914bb2899489f1..11e0e0eb7ab26266a06ee04ebb7cdef70e4322e2 100644 (file)
@@ -48,7 +48,8 @@ static av_cold int encode_init(AVCodecContext *avctx)
     return 0;
 }
 
-static int encode_frame(AVCodecContext *avctx, unsigned char *buf, int buf_size, void *data)
+static int encode_frame(AVCodecContext *avctx, unsigned char *buf,
+                        int buf_size, void *data)
 {
     const AVFrame *pic = data;
     int aligned_width = ((avctx->width + 47) / 48) * 48;
@@ -71,7 +72,7 @@ static int encode_frame(AVCodecContext *avctx, unsigned char *buf, int buf_size,
               ((*b++ & 0xFFC0) <<  4);  \
         val|=  (*c++ & 0xFFC0) << 14;   \
         bytestream_put_le32(&p, val);   \
-    } while (0);
+    } while (0)
 
     for (h = 0; h < avctx->height; h++) {
         uint32_t val;
@@ -101,9 +102,9 @@ static int encode_frame(AVCodecContext *avctx, unsigned char *buf, int buf_size,
         pdst += stride;
         memset(p, 0, pdst - p);
         p = pdst;
-        y += pic->linesize[0]/2 - avctx->width;
-        u += pic->linesize[1]/2 - avctx->width/2;
-        v += pic->linesize[2]/2 - avctx->width/2;
+        y += pic->linesize[0] / 2 - avctx->width;
+        u += pic->linesize[1] / 2 - avctx->width / 2;
+        v += pic->linesize[2] / 2 - avctx->width / 2;
     }
 
     return p - buf;
@@ -118,12 +119,12 @@ static av_cold int encode_close(AVCodecContext *avctx)
 
 AVCodec v210_encoder = {
     "v210",
-    CODEC_TYPE_VIDEO,
+    AVMEDIA_TYPE_VIDEO,
     CODEC_ID_V210,
     0,
     encode_init,
     encode_frame,
     encode_close,
-    .pix_fmts = (enum PixelFormat[]){PIX_FMT_YUV422P16, -1},
+    .pix_fmts = (const enum PixelFormat[]){PIX_FMT_YUV422P16, PIX_FMT_NONE},
     .long_name = NULL_IF_CONFIG_SMALL("Uncompressed 4:2:2 10-bit"),
 };