]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/r210enc.c
Merge commit 'a67b67944aa9e6e794934d15f9fd9a9cf7173e09'
[ffmpeg] / libavcodec / r210enc.c
index b7d5a07deb5d0ffb9ecd7b428f14bb585aafe195..64aa33f55755b28189aad6d637eb569b2ae3dbcc 100644 (file)
 #include "internal.h"
 #include "bytestream.h"
 
-static av_cold int encode_init(AVCodecContext *avctx)
-{
-    avctx->coded_frame = av_frame_alloc();
-
-    if (!avctx->coded_frame)
-        return AVERROR(ENOMEM);
-
-    return 0;
-}
-
 static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
                         const AVFrame *pic, int *got_packet)
 {
@@ -44,7 +34,7 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
     uint8_t *src_line;
     uint8_t *dst;
 
-    if ((ret = ff_alloc_packet2(avctx, pkt, 4 * aligned_width * avctx->height)) < 0)
+    if ((ret = ff_alloc_packet2(avctx, pkt, 4 * aligned_width * avctx->height, 0)) < 0)
         return ret;
 
     avctx->coded_frame->key_frame = 1;
@@ -78,12 +68,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;
-}
 
 #if CONFIG_R210_ENCODER
 AVCodec ff_r210_encoder = {
@@ -91,9 +75,7 @@ AVCodec ff_r210_encoder = {
     .long_name      = NULL_IF_CONFIG_SMALL("Uncompressed RGB 10-bit"),
     .type           = AVMEDIA_TYPE_VIDEO,
     .id             = AV_CODEC_ID_R210,
-    .init           = encode_init,
     .encode2        = encode_frame,
-    .close          = encode_close,
     .pix_fmts       = (const enum AVPixelFormat[]) { AV_PIX_FMT_RGB48, AV_PIX_FMT_NONE },
 };
 #endif
@@ -103,9 +85,7 @@ AVCodec ff_r10k_encoder = {
     .long_name      = NULL_IF_CONFIG_SMALL("AJA Kona 10-bit RGB Codec"),
     .type           = AVMEDIA_TYPE_VIDEO,
     .id             = AV_CODEC_ID_R10K,
-    .init           = encode_init,
     .encode2        = encode_frame,
-    .close          = encode_close,
     .pix_fmts       = (const enum AVPixelFormat[]) { AV_PIX_FMT_RGB48, AV_PIX_FMT_NONE },
 };
 #endif
@@ -115,9 +95,7 @@ AVCodec ff_avrp_encoder = {
     .long_name      = NULL_IF_CONFIG_SMALL("Avid 1:1 10-bit RGB Packer"),
     .type           = AVMEDIA_TYPE_VIDEO,
     .id             = AV_CODEC_ID_AVRP,
-    .init           = encode_init,
     .encode2        = encode_frame,
-    .close          = encode_close,
     .pix_fmts       = (const enum AVPixelFormat[]) { AV_PIX_FMT_RGB48, AV_PIX_FMT_NONE },
 };
 #endif