]> git.sesse.net Git - ffmpeg/blobdiff - tests/api/api-flac-test.c
avformat/smacker: Don't allocate arrays separately
[ffmpeg] / tests / api / api-flac-test.c
index e8e8cbf1e7c8abd9c81f653387b8ffd58f3dd26d..3fea3258f319bff6756beec9e9e24071f6aca62e 100644 (file)
@@ -126,7 +126,7 @@ static int run_test(AVCodec *enc, AVCodec *dec, AVCodecContext *enc_ctx,
     in_frame->nb_samples = enc_ctx->frame_size;
     in_frame->format = enc_ctx->sample_fmt;
     in_frame->channel_layout = enc_ctx->channel_layout;
-    if (av_frame_get_buffer(in_frame, 32) != 0) {
+    if (av_frame_get_buffer(in_frame, 0) != 0) {
         av_log(NULL, AV_LOG_ERROR, "Can't allocate a buffer for input frame\n");
         return AVERROR(ENOMEM);
     }
@@ -223,20 +223,6 @@ static int run_test(AVCodec *enc, AVCodec *dec, AVCodecContext *enc_ctx,
     return 0;
 }
 
-static int close_encoder(AVCodecContext **enc_ctx)
-{
-    avcodec_close(*enc_ctx);
-    av_freep(enc_ctx);
-    return 0;
-}
-
-static int close_decoder(AVCodecContext **dec_ctx)
-{
-    avcodec_close(*dec_ctx);
-    av_freep(dec_ctx);
-    return 0;
-}
-
 int main(void)
 {
     AVCodec *enc = NULL, *dec = NULL;
@@ -265,8 +251,8 @@ int main(void)
                 return 1;
             if (run_test(enc, dec, enc_ctx, dec_ctx) != 0)
                 return 1;
-            close_encoder(&enc_ctx);
-            close_decoder(&dec_ctx);
+            avcodec_free_context(&enc_ctx);
+            avcodec_free_context(&dec_ctx);
         }
     }