libschroedingerenc: use the AVFrame API properly.
authorAnton Khirnov <anton@khirnov.net>
Sat, 9 Nov 2013 09:14:46 +0000 (10:14 +0100)
committerAnton Khirnov <anton@khirnov.net>
Sat, 16 Nov 2013 16:49:31 +0000 (17:49 +0100)
libavcodec/libschroedingerenc.c

index e4789ee..11cc0eb 100644 (file)
@@ -49,9 +49,6 @@ typedef struct SchroEncoderParams {
     /** Schroedinger frame format */
     SchroFrameFormat frame_format;
 
-    /** frame being encoded */
-    AVFrame picture;
-
     /** frame size */
     int frame_size;
 
@@ -164,7 +161,9 @@ static av_cold int libschroedinger_encode_init(AVCodecContext *avctx)
                                                     avctx->width,
                                                     avctx->height);
 
-    avctx->coded_frame = &p_schro_params->picture;
+    avctx->coded_frame = av_frame_alloc();
+    if (!avctx->coded_frame)
+        return AVERROR(ENOMEM);
 
     if (!avctx->gop_size) {
         schro_encoder_setting_set_double(p_schro_params->encoder,
@@ -432,6 +431,8 @@ static int libschroedinger_encode_close(AVCodecContext *avctx)
     /* Free the video format structure. */
     av_freep(&p_schro_params->format);
 
+    av_frame_free(&avctx->coded_frame);
+
     return 0;
 }