[FFmpeg-cvslog] avformat: remove deprecated FF_API_AVIO_WRITE_NONCONST

James Almer git at videolan.org
Thu Mar 7 16:42:00 EET 2024


ffmpeg | branch: master | James Almer <jamrial at gmail.com> | Thu Jan 25 11:37:30 2024 -0300| [02aea61d69d8f81bc285e2131bf25f96a3e27feb] | committer: James Almer

avformat: remove deprecated FF_API_AVIO_WRITE_NONCONST

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

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

 libavformat/avio.c               |  4 ----
 libavformat/avio.h               | 13 -------------
 libavformat/avio_internal.h      |  4 ----
 libavformat/aviobuf.c            | 28 ----------------------------
 libavformat/hdsenc.c             |  4 ----
 libavformat/smoothstreamingenc.c |  4 ----
 libavformat/url.h                |  8 --------
 libavformat/version_major.h      |  1 -
 8 files changed, 66 deletions(-)

diff --git a/libavformat/avio.c b/libavformat/avio.c
index 1486f555aa..0503b22786 100644
--- a/libavformat/avio.c
+++ b/libavformat/avio.c
@@ -560,11 +560,7 @@ int ffurl_read_complete(URLContext *h, unsigned char *buf, int size)
     return retry_transfer_wrapper(h, buf, NULL, size, size, 1);
 }
 
-#if FF_API_AVIO_WRITE_NONCONST
-int ffurl_write2(void *urlcontext, uint8_t *buf, int size)
-#else
 int ffurl_write2(void *urlcontext, const uint8_t *buf, int size)
-#endif
 {
     URLContext *h = urlcontext;
 
diff --git a/libavformat/avio.h b/libavformat/avio.h
index 2241e3484b..ebf611187d 100644
--- a/libavformat/avio.h
+++ b/libavformat/avio.h
@@ -232,11 +232,7 @@ typedef struct AVIOContext {
     void *opaque;           /**< A private pointer, passed to the read/write/seek/...
                                  functions. */
     int (*read_packet)(void *opaque, uint8_t *buf, int buf_size);
-#if FF_API_AVIO_WRITE_NONCONST
-    int (*write_packet)(void *opaque, uint8_t *buf, int buf_size);
-#else
     int (*write_packet)(void *opaque, const uint8_t *buf, int buf_size);
-#endif
     int64_t (*seek)(void *opaque, int64_t offset, int whence);
     int64_t pos;            /**< position in the file of the current buffer */
     int eof_reached;        /**< true if was unable to read due to error or eof */
@@ -284,13 +280,8 @@ typedef struct AVIOContext {
     /**
      * A callback that is used instead of write_packet.
      */
-#if FF_API_AVIO_WRITE_NONCONST
-    int (*write_data_type)(void *opaque, uint8_t *buf, int buf_size,
-                           enum AVIODataMarkerType type, int64_t time);
-#else
     int (*write_data_type)(void *opaque, const uint8_t *buf, int buf_size,
                            enum AVIODataMarkerType type, int64_t time);
-#endif
     /**
      * If set, don't call write_data_type separately for AVIO_DATA_MARKER_BOUNDARY_POINT,
      * but ignore them and treat them as AVIO_DATA_MARKER_UNKNOWN (to avoid needlessly
@@ -410,11 +401,7 @@ AVIOContext *avio_alloc_context(
                   int write_flag,
                   void *opaque,
                   int (*read_packet)(void *opaque, uint8_t *buf, int buf_size),
-#if FF_API_AVIO_WRITE_NONCONST
-                  int (*write_packet)(void *opaque, uint8_t *buf, int buf_size),
-#else
                   int (*write_packet)(void *opaque, const uint8_t *buf, int buf_size),
-#endif
                   int64_t (*seek)(void *opaque, int64_t offset, int whence));
 
 /**
diff --git a/libavformat/avio_internal.h b/libavformat/avio_internal.h
index 16cf6ce016..7d4756db0c 100644
--- a/libavformat/avio_internal.h
+++ b/libavformat/avio_internal.h
@@ -89,11 +89,7 @@ void ffio_init_context(FFIOContext *s,
                   int write_flag,
                   void *opaque,
                   int (*read_packet)(void *opaque, uint8_t *buf, int buf_size),
-#if FF_API_AVIO_WRITE_NONCONST
-                  int (*write_packet)(void *opaque, uint8_t *buf, int buf_size),
-#else
                   int (*write_packet)(void *opaque, const uint8_t *buf, int buf_size),
-#endif
                   int64_t (*seek)(void *opaque, int64_t offset, int whence));
 
 /**
diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c
index 8dfed22622..3609960907 100644
--- a/libavformat/aviobuf.c
+++ b/libavformat/aviobuf.c
@@ -52,11 +52,7 @@ void ffio_init_context(FFIOContext *ctx,
                   int write_flag,
                   void *opaque,
                   int (*read_packet)(void *opaque, uint8_t *buf, int buf_size),
-#if FF_API_AVIO_WRITE_NONCONST
-                  int (*write_packet)(void *opaque, uint8_t *buf, int buf_size),
-#else
                   int (*write_packet)(void *opaque, const uint8_t *buf, int buf_size),
-#endif
                   int64_t (*seek)(void *opaque, int64_t offset, int whence))
 {
     AVIOContext *const s = &ctx->pub;
@@ -115,11 +111,7 @@ AVIOContext *avio_alloc_context(
                   int write_flag,
                   void *opaque,
                   int (*read_packet)(void *opaque, uint8_t *buf, int buf_size),
-#if FF_API_AVIO_WRITE_NONCONST
-                  int (*write_packet)(void *opaque, uint8_t *buf, int buf_size),
-#else
                   int (*write_packet)(void *opaque, const uint8_t *buf, int buf_size),
-#endif
                   int64_t (*seek)(void *opaque, int64_t offset, int whence))
 {
     FFIOContext *s = av_malloc(sizeof(*s));
@@ -141,20 +133,12 @@ static void writeout(AVIOContext *s, const uint8_t *data, int len)
     if (!s->error) {
         int ret = 0;
         if (s->write_data_type)
-#if FF_API_AVIO_WRITE_NONCONST
-            ret = s->write_data_type(s->opaque, (uint8_t *)data,
-#else
             ret = s->write_data_type(s->opaque, data,
-#endif
                                      len,
                                      ctx->current_type,
                                      ctx->last_time);
         else if (s->write_packet)
-#if FF_API_AVIO_WRITE_NONCONST
-            ret = s->write_packet(s->opaque, (uint8_t *)data, len);
-#else
             ret = s->write_packet(s->opaque, data, len);
-#endif
         if (ret < 0) {
             s->error = ret;
         } else {
@@ -1290,11 +1274,7 @@ typedef struct DynBuffer {
     uint8_t io_buffer[1];
 } DynBuffer;
 
-#if FF_API_AVIO_WRITE_NONCONST
-static int dyn_buf_write(void *opaque, uint8_t *buf, int buf_size)
-#else
 static int dyn_buf_write(void *opaque, const uint8_t *buf, int buf_size)
-#endif
 {
     DynBuffer *d = opaque;
     unsigned new_size;
@@ -1326,11 +1306,7 @@ static int dyn_buf_write(void *opaque, const uint8_t *buf, int buf_size)
     return buf_size;
 }
 
-#if FF_API_AVIO_WRITE_NONCONST
-static int dyn_packet_buf_write(void *opaque, uint8_t *buf, int buf_size)
-#else
 static int dyn_packet_buf_write(void *opaque, const uint8_t *buf, int buf_size)
-#endif
 {
     unsigned char buf1[4];
     int ret;
@@ -1467,11 +1443,7 @@ void ffio_free_dyn_buf(AVIOContext **s)
     avio_context_free(s);
 }
 
-#if FF_API_AVIO_WRITE_NONCONST
-static int null_buf_write(void *opaque, uint8_t *buf, int buf_size)
-#else
 static int null_buf_write(void *opaque, const uint8_t *buf, int buf_size)
-#endif
 {
     DynBuffer *d = opaque;
 
diff --git a/libavformat/hdsenc.c b/libavformat/hdsenc.c
index 7062441b70..17fa0c807f 100644
--- a/libavformat/hdsenc.c
+++ b/libavformat/hdsenc.c
@@ -112,11 +112,7 @@ static int parse_header(OutputStream *os, const uint8_t *buf, int buf_size)
     return 0;
 }
 
-#if FF_API_AVIO_WRITE_NONCONST
-static int hds_write(void *opaque, uint8_t *buf, int buf_size)
-#else
 static int hds_write(void *opaque, const uint8_t *buf, int buf_size)
-#endif
 {
     OutputStream *os = opaque;
     if (os->out) {
diff --git a/libavformat/smoothstreamingenc.c b/libavformat/smoothstreamingenc.c
index 0379e9a079..e9c9f5d59f 100644
--- a/libavformat/smoothstreamingenc.c
+++ b/libavformat/smoothstreamingenc.c
@@ -75,11 +75,7 @@ typedef struct SmoothStreamingContext {
     int nb_fragments;
 } SmoothStreamingContext;
 
-#if FF_API_AVIO_WRITE_NONCONST
-static int ism_write(void *opaque, uint8_t *buf, int buf_size)
-#else
 static int ism_write(void *opaque, const uint8_t *buf, int buf_size)
-#endif
 {
     OutputStream *os = opaque;
     if (os->out)
diff --git a/libavformat/url.h b/libavformat/url.h
index f62afedb78..0784d77b64 100644
--- a/libavformat/url.h
+++ b/libavformat/url.h
@@ -192,11 +192,7 @@ static inline int ffurl_read(URLContext *h, uint8_t *buf, int size)
  */
 int ffurl_read_complete(URLContext *h, unsigned char *buf, int size);
 
-#if FF_API_AVIO_WRITE_NONCONST
-int ffurl_write2(void *urlcontext, uint8_t *buf, int size);
-#else
 int ffurl_write2(void *urlcontext, const uint8_t *buf, int size);
-#endif
 /**
  * Write size bytes from buf to the resource accessed by h.
  *
@@ -205,11 +201,7 @@ int ffurl_write2(void *urlcontext, const uint8_t *buf, int size);
  */
 static inline int ffurl_write(URLContext *h, const uint8_t *buf, int size)
 {
-#if FF_API_AVIO_WRITE_NONCONST
-    return ffurl_write2(h, (uint8_t*)buf, size);
-#else
     return ffurl_write2(h, buf, size);
-#endif
 }
 
 int64_t ffurl_seek2(void *urlcontext, int64_t pos, int whence);
diff --git a/libavformat/version_major.h b/libavformat/version_major.h
index 5449a99599..333b9bd836 100644
--- a/libavformat/version_major.h
+++ b/libavformat/version_major.h
@@ -42,7 +42,6 @@
  *
  */
 #define FF_API_COMPUTE_PKT_FIELDS2      (LIBAVFORMAT_VERSION_MAJOR < 61)
-#define FF_API_AVIO_WRITE_NONCONST      (LIBAVFORMAT_VERSION_MAJOR < 61)
 #define FF_API_LAVF_SHORTEST            (LIBAVFORMAT_VERSION_MAJOR < 61)
 #define FF_API_ALLOW_FLUSH              (LIBAVFORMAT_VERSION_MAJOR < 61)
 #define FF_API_AVSTREAM_SIDE_DATA       (LIBAVFORMAT_VERSION_MAJOR < 61)



More information about the ffmpeg-cvslog mailing list