[FFmpeg-devel] [PATCH 2/3] avcodec/utils: make codec_parameters_reset() a shared function

James Almer jamrial at gmail.com
Mon Aug 10 21:06:14 EEST 2020


It will be useful in the next commit.

Signed-off-by: James Almer <jamrial at gmail.com>
---
 libavcodec/internal.h |  2 ++
 libavcodec/utils.c    | 10 +++++-----
 2 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/libavcodec/internal.h b/libavcodec/internal.h
index 0a1c0a17ec..a302cb24eb 100644
--- a/libavcodec/internal.h
+++ b/libavcodec/internal.h
@@ -413,6 +413,8 @@ int ff_int_from_list_or_default(void *ctx, const char * val_name, int val,
 
 void ff_dvdsub_parse_palette(uint32_t *palette, const char *p);
 
+void ff_codec_parameters_reset(AVCodecParameters *par);
+
 #if defined(_WIN32) && CONFIG_SHARED && !defined(BUILDING_avcodec)
 #    define av_export_avcodec __declspec(dllimport)
 #else
diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index 5a2a90b030..3fda7c51d7 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -2031,7 +2031,7 @@ AVCPBProperties *ff_add_cpb_side_data(AVCodecContext *avctx)
     return props;
 }
 
-static void codec_parameters_reset(AVCodecParameters *par)
+void ff_codec_parameters_reset(AVCodecParameters *par)
 {
     av_freep(&par->extradata);
 
@@ -2057,7 +2057,7 @@ AVCodecParameters *avcodec_parameters_alloc(void)
 
     if (!par)
         return NULL;
-    codec_parameters_reset(par);
+    ff_codec_parameters_reset(par);
     return par;
 }
 
@@ -2067,14 +2067,14 @@ void avcodec_parameters_free(AVCodecParameters **ppar)
 
     if (!par)
         return;
-    codec_parameters_reset(par);
+    ff_codec_parameters_reset(par);
 
     av_freep(ppar);
 }
 
 int avcodec_parameters_copy(AVCodecParameters *dst, const AVCodecParameters *src)
 {
-    codec_parameters_reset(dst);
+    ff_codec_parameters_reset(dst);
     memcpy(dst, src, sizeof(*dst));
 
     dst->extradata      = NULL;
@@ -2093,7 +2093,7 @@ int avcodec_parameters_copy(AVCodecParameters *dst, const AVCodecParameters *src
 int avcodec_parameters_from_context(AVCodecParameters *par,
                                     const AVCodecContext *codec)
 {
-    codec_parameters_reset(par);
+    ff_codec_parameters_reset(par);
 
     par->codec_type = codec->codec_type;
     par->codec_id   = codec->codec_id;
-- 
2.27.0



More information about the ffmpeg-devel mailing list