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);
}
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;
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);
}
}