diff mbox series

[FFmpeg-devel,09/11] avcodec/evc_parse: make freeing EVCParserContext buffers a shared function

Message ID 20230615151836.50535-9-jamrial@gmail.com
State Accepted
Commit 9fc1d9adc8d05056ea53522c34ae4953ccdb7c59
Headers show
Series [FFmpeg-devel,01/11] avformat/evcdec: set the demuxer as AVFMT_NOTIMESTAMPS | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

James Almer June 15, 2023, 3:18 p.m. UTC
Signed-off-by: James Almer <jamrial@gmail.com>
---
 libavcodec/evc_parse.c  |  7 +++++++
 libavcodec/evc_parse.h  |  2 ++
 libavcodec/evc_parser.c | 11 +----------
 3 files changed, 10 insertions(+), 10 deletions(-)
diff mbox series

Patch

diff --git a/libavcodec/evc_parse.c b/libavcodec/evc_parse.c
index 4b9d820d34..703529e9f4 100644
--- a/libavcodec/evc_parse.c
+++ b/libavcodec/evc_parse.c
@@ -765,3 +765,10 @@  int ff_evc_parse_nal_unit(EVCParserContext *ctx, const uint8_t *buf, int buf_siz
     return 0;
 }
 
+void ff_evc_parse_free(EVCParserContext *ctx) {
+    for (int i = 0; i < EVC_MAX_SPS_COUNT; i++)
+        av_freep(&ctx->sps[i]);
+
+    for (int i = 0; i < EVC_MAX_PPS_COUNT; i++)
+        av_freep(&ctx->pps[i]);
+}
diff --git a/libavcodec/evc_parse.h b/libavcodec/evc_parse.h
index 1c1b8ec093..9eabc2f7a4 100644
--- a/libavcodec/evc_parse.h
+++ b/libavcodec/evc_parse.h
@@ -350,4 +350,6 @@  EVCParserPPS *ff_evc_parse_pps(EVCParserContext *ctx, const uint8_t *bs, int bs_
 
 int ff_evc_parse_nal_unit(EVCParserContext *ctx, const uint8_t *buf, int buf_size, void *logctx);
 
+void ff_evc_parse_free(EVCParserContext *ctx);
+
 #endif /* AVCODEC_EVC_PARSE_H */
diff --git a/libavcodec/evc_parser.c b/libavcodec/evc_parser.c
index 072fe41bf1..c85b8f89e7 100644
--- a/libavcodec/evc_parser.c
+++ b/libavcodec/evc_parser.c
@@ -202,16 +202,7 @@  static void evc_parser_close(AVCodecParserContext *s)
 {
     EVCParserContext *ctx = s->priv_data;
 
-    for(int i = 0; i < EVC_MAX_SPS_COUNT; i++) {
-        EVCParserSPS *sps = ctx->sps[i];
-        av_freep(&sps);
-    }
-
-    for(int i = 0; i < EVC_MAX_PPS_COUNT; i++) {
-        EVCParserPPS *pps = ctx->pps[i];
-
-        av_freep(&pps);
-    }
+    ff_evc_parse_free(ctx);
 }
 
 const AVCodecParser ff_evc_parser = {