[FFmpeg-cvslog] avformat/iamf: remove duplicated function

James Almer git at videolan.org
Thu Feb 29 17:58:34 EET 2024


ffmpeg | branch: master | James Almer <jamrial at gmail.com> | Thu Feb 29 12:57:25 2024 -0300| [ec7937f4a56e2fbd4070660ff19f0e02c039768a] | committer: James Almer

avformat/iamf: remove duplicated function

Signed-off-by: James Almer <jamrial at gmail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=ec7937f4a56e2fbd4070660ff19f0e02c039768a
---

 libavformat/iamf.h        | 14 ++++++++++++++
 libavformat/iamf_reader.c | 18 +-----------------
 libavformat/iamf_writer.h | 14 --------------
 3 files changed, 15 insertions(+), 31 deletions(-)

diff --git a/libavformat/iamf.h b/libavformat/iamf.h
index ae1e46a99e..d8715b7333 100644
--- a/libavformat/iamf.h
+++ b/libavformat/iamf.h
@@ -165,6 +165,20 @@ struct IAMFSoundSystemMap {
 extern const AVChannelLayout ff_iamf_scalable_ch_layouts[10];
 extern const struct IAMFSoundSystemMap ff_iamf_sound_system_map[13];
 
+static inline IAMFParamDefinition *ff_iamf_get_param_definition(const IAMFContext *iamf,
+                                                                unsigned int parameter_id)
+{
+    IAMFParamDefinition *param_definition = NULL;
+
+    for (int i = 0; i < iamf->nb_param_definitions; i++)
+        if (iamf->param_definitions[i]->param->parameter_id == parameter_id) {
+            param_definition = iamf->param_definitions[i];
+            break;
+        }
+
+    return param_definition;
+}
+
 void ff_iamf_free_audio_element(IAMFAudioElement **paudio_element);
 void ff_iamf_free_mix_presentation(IAMFMixPresentation **pmix_presentation);
 void ff_iamf_uninit_context(IAMFContext *c);
diff --git a/libavformat/iamf_reader.c b/libavformat/iamf_reader.c
index f63bd94b61..42d20f1ae6 100644
--- a/libavformat/iamf_reader.c
+++ b/libavformat/iamf_reader.c
@@ -98,22 +98,6 @@ static int audio_frame_obu(AVFormatContext *s, const IAMFDemuxContext *c,
     return 0;
 }
 
-static const IAMFParamDefinition *get_param_definition(AVFormatContext *s,
-                                                       const IAMFDemuxContext *c,
-                                                       unsigned int parameter_id)
-{
-    const IAMFContext *const iamf = &c->iamf;
-    const IAMFParamDefinition *param_definition = NULL;
-
-    for (int i = 0; i < iamf->nb_param_definitions; i++)
-        if (iamf->param_definitions[i]->param->parameter_id == parameter_id) {
-            param_definition = iamf->param_definitions[i];
-            break;
-        }
-
-    return param_definition;
-}
-
 static int parameter_block_obu(AVFormatContext *s, IAMFDemuxContext *c,
                                AVIOContext *pbc, int len)
 {
@@ -144,7 +128,7 @@ static int parameter_block_obu(AVFormatContext *s, IAMFDemuxContext *c,
     pb = &b.pub;
 
     parameter_id = ffio_read_leb(pb);
-    param_definition = get_param_definition(s, c, parameter_id);
+    param_definition = ff_iamf_get_param_definition(&c->iamf, parameter_id);
     if (!param_definition) {
         av_log(s, AV_LOG_VERBOSE, "Non existant parameter_id %d referenced in a parameter block. Ignoring\n",
                parameter_id);
diff --git a/libavformat/iamf_writer.h b/libavformat/iamf_writer.h
index 671d9cc11d..8e2949d8f2 100644
--- a/libavformat/iamf_writer.h
+++ b/libavformat/iamf_writer.h
@@ -29,20 +29,6 @@
 #include "avio.h"
 #include "iamf.h"
 
-static inline IAMFParamDefinition *ff_iamf_get_param_definition(const IAMFContext *iamf,
-                                                                unsigned int parameter_id)
-{
-    IAMFParamDefinition *param_definition = NULL;
-
-    for (int i = 0; i < iamf->nb_param_definitions; i++)
-        if (iamf->param_definitions[i]->param->parameter_id == parameter_id) {
-            param_definition = iamf->param_definitions[i];
-            break;
-        }
-
-    return param_definition;
-}
-
 int ff_iamf_add_audio_element(IAMFContext *iamf, const AVStreamGroup *stg, void *log_ctx);
 int ff_iamf_add_mix_presentation(IAMFContext *iamf, const AVStreamGroup *stg, void *log_ctx);
 



More information about the ffmpeg-cvslog mailing list