]> git.sesse.net Git - ffmpeg/commitdiff
lavc: un-avpriv avpriv_bprint_to_extradata()
authorAnton Khirnov <anton@khirnov.net>
Mon, 26 Oct 2020 13:10:55 +0000 (14:10 +0100)
committerAnton Khirnov <anton@khirnov.net>
Wed, 28 Oct 2020 12:53:23 +0000 (13:53 +0100)
It has not been used outside of lavc since 6f69f7a8bf6.

Also, move it to the only place where it is used.

libavcodec/dvdsubenc.c
libavcodec/internal.h
libavcodec/utils.c

index e54b5f0d7bf1082b8d508352d0f80bb4350bf8bf..9fa9d5b6d708daff1e847a7c3b1ffe4515eac158 100644 (file)
@@ -424,6 +424,29 @@ fail:
     return ret;
 }
 
+static int bprint_to_extradata(AVCodecContext *avctx, struct AVBPrint *buf)
+{
+    int ret;
+    char *str;
+
+    ret = av_bprint_finalize(buf, &str);
+    if (ret < 0)
+        return ret;
+    if (!av_bprint_is_complete(buf)) {
+        av_free(str);
+        return AVERROR(ENOMEM);
+    }
+
+    avctx->extradata = str;
+    /* Note: the string is NUL terminated (so extradata can be read as a
+     * string), but the ending character is not accounted in the size (in
+     * binary formats you are likely not supposed to mux that character). When
+     * extradata is copied, it is also padded with AV_INPUT_BUFFER_PADDING_SIZE
+     * zeros. */
+    avctx->extradata_size = buf->len;
+    return 0;
+}
+
 static int dvdsub_init(AVCodecContext *avctx)
 {
     DVDSubtitleContext *dvdc = avctx->priv_data;
@@ -451,7 +474,7 @@ static int dvdsub_init(AVCodecContext *avctx)
         av_bprintf(&extradata, " %06"PRIx32"%c",
                    dvdc->global_palette[i] & 0xFFFFFF, i < 15 ? ',' : '\n');
 
-    ret = avpriv_bprint_to_extradata(avctx, &extradata);
+    ret = bprint_to_extradata(avctx, &extradata);
     if (ret < 0)
         return ret;
 
index ce4dbbc2b95f14c24d2db5f8678dfae51a402989..17defb9b50ec53935be4c710ef13764793ae0ed4 100644 (file)
@@ -313,11 +313,6 @@ int avpriv_h264_has_num_reorder_frames(AVCodecContext *avctx);
  */
 int ff_codec_open2_recursive(AVCodecContext *avctx, const AVCodec *codec, AVDictionary **options);
 
-/**
- * Finalize buf into extradata and set its size appropriately.
- */
-int avpriv_bprint_to_extradata(AVCodecContext *avctx, struct AVBPrint *buf);
-
 const uint8_t *avpriv_find_start_code(const uint8_t *p,
                                       const uint8_t *end,
                                       uint32_t *state);
index 93ac1cd9f0c5977e6c7b74b011b823c4f4d7ab7a..fb40962c475aa5700a5f1c019766b89f0e40ced8 100644 (file)
@@ -1946,29 +1946,6 @@ int avcodec_is_open(AVCodecContext *s)
     return !!s->internal;
 }
 
-int avpriv_bprint_to_extradata(AVCodecContext *avctx, struct AVBPrint *buf)
-{
-    int ret;
-    char *str;
-
-    ret = av_bprint_finalize(buf, &str);
-    if (ret < 0)
-        return ret;
-    if (!av_bprint_is_complete(buf)) {
-        av_free(str);
-        return AVERROR(ENOMEM);
-    }
-
-    avctx->extradata = str;
-    /* Note: the string is NUL terminated (so extradata can be read as a
-     * string), but the ending character is not accounted in the size (in
-     * binary formats you are likely not supposed to mux that character). When
-     * extradata is copied, it is also padded with AV_INPUT_BUFFER_PADDING_SIZE
-     * zeros. */
-    avctx->extradata_size = buf->len;
-    return 0;
-}
-
 const uint8_t *avpriv_find_start_code(const uint8_t *av_restrict p,
                                       const uint8_t *end,
                                       uint32_t *av_restrict state)