summaryrefslogtreecommitdiff
path: root/tests/api
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2020-05-27 09:30:46 +0200
committerAnton Khirnov <anton@khirnov.net>2020-06-10 11:31:16 +0200
commit0d6b4351c64664d8c2f56d0ddb5e38b800ed8751 (patch)
tree8e90e756ec588f3a34b740284f5ec8da315bd5c8 /tests/api
parent9dfb19baeb86a8bb02c53a441682c6e9a6e104cc (diff)
Remove unnecessary use of avcodec_close().
Replace it with avcodec_free_context() or drop it completely as appropriate.
Diffstat (limited to 'tests/api')
-rw-r--r--tests/api/api-band-test.c1
-rw-r--r--tests/api/api-flac-test.c18
-rw-r--r--tests/api/api-h264-test.c1
-rw-r--r--tests/api/api-seek-test.c1
4 files changed, 2 insertions, 19 deletions
diff --git a/tests/api/api-band-test.c b/tests/api/api-band-test.c
index a84f6b7e55..257e741694 100644
--- a/tests/api/api-band-test.c
+++ b/tests/api/api-band-test.c
@@ -198,7 +198,6 @@ static int video_decode(const char *input_filename)
av_packet_unref(&pkt);
av_frame_free(&fr);
- avcodec_close(ctx);
avformat_close_input(&fmt_ctx);
avcodec_free_context(&ctx);
av_freep(&byte_buffer);
diff --git a/tests/api/api-flac-test.c b/tests/api/api-flac-test.c
index ae6a9316d8..3fea3258f3 100644
--- a/tests/api/api-flac-test.c
+++ b/tests/api/api-flac-test.c
@@ -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);
}
}
diff --git a/tests/api/api-h264-test.c b/tests/api/api-h264-test.c
index 60a3ae5ef4..678a1ea166 100644
--- a/tests/api/api-h264-test.c
+++ b/tests/api/api-h264-test.c
@@ -144,7 +144,6 @@ static int video_decode_example(const char *input_filename)
av_packet_unref(&pkt);
av_frame_free(&fr);
- avcodec_close(ctx);
avformat_close_input(&fmt_ctx);
avcodec_free_context(&ctx);
av_freep(&byte_buffer);
diff --git a/tests/api/api-seek-test.c b/tests/api/api-seek-test.c
index d0531a2f73..ae33581244 100644
--- a/tests/api/api-seek-test.c
+++ b/tests/api/api-seek-test.c
@@ -266,7 +266,6 @@ end:
av_freep(&crc_array);
av_freep(&pts_array);
av_frame_free(&fr);
- avcodec_close(ctx);
avformat_close_input(&fmt_ctx);
avcodec_free_context(&ctx);
return result;