diff mbox series

[FFmpeg-devel,43/44] avformat/utils: Move ff_stream_side_data_copy to avformat.c

Message ID AS8PR01MB794478B3C35FA32EAD5CCA1C8FC49@AS8PR01MB7944.eurprd01.prod.exchangelabs.com
State Accepted
Commit 6aca6146d9a89e4344c13870052214698b40f6fd
Headers show
Series [FFmpeg-devel] lib*/version: Move library version functions into files of their own | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 fail Make failed
andriy/make_x86 fail Make failed

Commit Message

Andreas Rheinhardt May 7, 2022, 11:28 a.m. UTC
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavformat/avformat.c | 30 ++++++++++++++++++++++++++++++
 libavformat/utils.c    | 30 ------------------------------
 2 files changed, 30 insertions(+), 30 deletions(-)
diff mbox series

Patch

diff --git a/libavformat/avformat.c b/libavformat/avformat.c
index 2a919ad89f..3eae41d109 100644
--- a/libavformat/avformat.c
+++ b/libavformat/avformat.c
@@ -204,6 +204,36 @@  uint8_t *av_stream_new_side_data(AVStream *st, enum AVPacketSideDataType type,
     return data;
 }
 
+int ff_stream_side_data_copy(AVStream *dst, const AVStream *src)
+{
+    /* Free existing side data*/
+    for (int i = 0; i < dst->nb_side_data; i++)
+        av_free(dst->side_data[i].data);
+    av_freep(&dst->side_data);
+    dst->nb_side_data = 0;
+
+    /* Copy side data if present */
+    if (src->nb_side_data) {
+        dst->side_data = av_calloc(src->nb_side_data,
+                                   sizeof(*dst->side_data));
+        if (!dst->side_data)
+            return AVERROR(ENOMEM);
+        dst->nb_side_data = src->nb_side_data;
+
+        for (int i = 0; i < src->nb_side_data; i++) {
+            uint8_t *data = av_memdup(src->side_data[i].data,
+                                      src->side_data[i].size);
+            if (!data)
+                return AVERROR(ENOMEM);
+            dst->side_data[i].type = src->side_data[i].type;
+            dst->side_data[i].size = src->side_data[i].size;
+            dst->side_data[i].data = data;
+        }
+    }
+
+    return 0;
+}
+
 AVProgram *av_new_program(AVFormatContext *ac, int id)
 {
     AVProgram *program = NULL;
diff --git a/libavformat/utils.c b/libavformat/utils.c
index 848afa3c35..667ed0c4c5 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -255,36 +255,6 @@  int ff_alloc_extradata(AVCodecParameters *par, int size)
 
 /*******************************************************/
 
-int ff_stream_side_data_copy(AVStream *dst, const AVStream *src)
-{
-    /* Free existing side data*/
-    for (int i = 0; i < dst->nb_side_data; i++)
-        av_free(dst->side_data[i].data);
-    av_freep(&dst->side_data);
-    dst->nb_side_data = 0;
-
-    /* Copy side data if present */
-    if (src->nb_side_data) {
-        dst->side_data = av_calloc(src->nb_side_data,
-                                   sizeof(*dst->side_data));
-        if (!dst->side_data)
-            return AVERROR(ENOMEM);
-        dst->nb_side_data = src->nb_side_data;
-
-        for (int i = 0; i < src->nb_side_data; i++) {
-            uint8_t *data = av_memdup(src->side_data[i].data,
-                                      src->side_data[i].size);
-            if (!data)
-                return AVERROR(ENOMEM);
-            dst->side_data[i].type = src->side_data[i].type;
-            dst->side_data[i].size = src->side_data[i].size;
-            dst->side_data[i].data = data;
-        }
-    }
-
-    return 0;
-}
-
 uint64_t ff_ntp_time(void)
 {
     return (av_gettime() / 1000) * 1000 + NTP_OFFSET_US;