]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/libschroedingerenc.c
mpeg4videodec: move sprite_brightness_change from MpegEncContext to Mpeg4DecContext
[ffmpeg] / libavcodec / libschroedingerenc.c
index e4789ee7c290a42b16c90fd9226e8c577c4147bd..d53d846a43abd3287e624cf5fa1e61e5d96e7ffb 100644 (file)
@@ -27,9 +27,6 @@
 * (http://dirac.sourceforge.net/specification.html).
 */
 
-#undef NDEBUG
-#include <assert.h>
-
 #include <schroedinger/schro.h>
 #include <schroedinger/schrodebug.h>
 #include <schroedinger/schrovideoformat.h>
@@ -49,9 +46,6 @@ typedef struct SchroEncoderParams {
     /** Schroedinger frame format */
     SchroFrameFormat frame_format;
 
-    /** frame being encoded */
-    AVFrame picture;
-
     /** frame size */
     int frame_size;
 
@@ -164,7 +158,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,
@@ -302,8 +298,8 @@ static int libschroedinger_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
         case SCHRO_STATE_HAVE_BUFFER:
         case SCHRO_STATE_END_OF_STREAM:
             enc_buf = schro_encoder_pull(encoder, &presentation_frame);
-            assert(enc_buf->length > 0);
-            assert(enc_buf->length <= buf_size);
+            if (enc_buf->length <= 0)
+                return AVERROR_BUG;
             parse_code = enc_buf->data[4];
 
             /* All non-frame data is prepended to actual frame data to
@@ -432,6 +428,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;
 }