]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/sgienc.c
Merge commit '5d8bea3bb2357bb304f8f771a4107039037c5549'
[ffmpeg] / libavcodec / sgienc.c
index 2f45eb398492b3e82f5b3d01cb4b762f6e702f92..28cec8625fd8c9f0e48da6f73163d891e833bb7d 100644 (file)
@@ -37,10 +37,6 @@ static av_cold int encode_init(AVCodecContext *avctx)
         return AVERROR_INVALIDDATA;
     }
 
-    avctx->coded_frame = av_frame_alloc();
-    if (!avctx->coded_frame)
-        return AVERROR(ENOMEM);
-
     return 0;
 }
 
@@ -54,8 +50,12 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
     unsigned int bytes_per_channel, pixmax, put_be;
     unsigned char *end_buf;
 
+#if FF_API_CODED_FRAME
+FF_DISABLE_DEPRECATION_WARNINGS
     avctx->coded_frame->pict_type = AV_PICTURE_TYPE_I;
     avctx->coded_frame->key_frame = 1;
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
 
     width  = avctx->width;
     height = avctx->height;
@@ -114,7 +114,7 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
     else // assume ff_rl_encode() produces at most 2x size of input
         length += tablesize * 2 + depth * height * (2 * width + 1);
 
-    if ((ret = ff_alloc_packet2(avctx, pkt, bytes_per_channel * length)) < 0)
+    if ((ret = ff_alloc_packet2(avctx, pkt, bytes_per_channel * length, 0)) < 0)
         return ret;
     buf     = pkt->data;
     end_buf = pkt->data + pkt->size;
@@ -206,12 +206,6 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
     return 0;
 }
 
-static av_cold int encode_close(AVCodecContext *avctx)
-{
-    av_frame_free(&avctx->coded_frame);
-    return 0;
-}
-
 AVCodec ff_sgi_encoder = {
     .name      = "sgi",
     .long_name = NULL_IF_CONFIG_SMALL("SGI image"),
@@ -219,7 +213,6 @@ AVCodec ff_sgi_encoder = {
     .id        = AV_CODEC_ID_SGI,
     .init      = encode_init,
     .encode2   = encode_frame,
-    .close     = encode_close,
     .pix_fmts  = (const enum AVPixelFormat[]) {
         AV_PIX_FMT_RGB24, AV_PIX_FMT_RGBA,
         AV_PIX_FMT_RGB48LE, AV_PIX_FMT_RGB48BE,