diff mbox series

[FFmpeg-devel,v2,3/3] avformat/avio{, buf}: deprecate AVIOContext::written

Message ID 20211013211038.13391-4-jeebjp@gmail.com
State New
Headers show
Series introduce public AVIOContext::bytes_{read, written} | expand

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished
andriy/make_ppc success Make finished
andriy/make_fate_ppc success Make fate finished

Commit Message

Jan Ekström Oct. 13, 2021, 9:10 p.m. UTC
Originally added as a private entry in commit
3f75e5116b900f1428aa13041fc7d6301bf1988a, but its grouping with
the comment noting its private state was missed during merging of
the field from Libav (most likely due to an already existing field
in between).

Users should migrate to the public field AVIOContext::bytes_written.
---
 doc/APIchanges        | 9 +++++++++
 libavformat/avio.h    | 6 ++++++
 libavformat/aviobuf.c | 9 +++++++++
 libavformat/version.h | 5 ++++-
 4 files changed, 28 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/doc/APIchanges b/doc/APIchanges
index 806eaf4c83..2fc964d80d 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -14,6 +14,15 @@  libavutil:     2021-04-27
 
 API changes, most recent first:
 
+2021-10-13 - xxxxxxxxxx - lavf 59.8.100 - avio.h
+  Deprecate AVIOContext.written. Originally added as a private entry in
+  commit 3f75e5116b900f1428aa13041fc7d6301bf1988a, but its grouping with
+  the comment noting its private state was missed during merging of the field
+  from Libav (most likely due to an already existing field in between).
+
+  Users should migrate to the public field AVIOContext.bytes_written, which
+  returns the same value.
+
 2021-09-26 - xxxxxxxxxx - lavf 59.7.100 - avio.h
   Introduce public bytes_{read,written} statistic fields to AVIOContext.
 
diff --git a/libavformat/avio.h b/libavformat/avio.h
index 0f9a0f909f..7d33e971cb 100644
--- a/libavformat/avio.h
+++ b/libavformat/avio.h
@@ -290,7 +290,13 @@  typedef struct AVIOContext {
      */
     int ignore_boundary_point;
 
+#if FF_API_AVIOCONTEXT_WRITTEN
+    /**
+     * @deprecated AVIOContext::bytes_written should be utilized instead.
+     */
+    attribute_deprecated
     int64_t written;
+#endif
 
     /**
      * Maximum reached position before a backward seek in the write buffer,
diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c
index 436a264f83..7a0cd27151 100644
--- a/libavformat/aviobuf.c
+++ b/libavformat/aviobuf.c
@@ -22,6 +22,7 @@ 
 #include "libavutil/bprint.h"
 #include "libavutil/crc.h"
 #include "libavutil/dict.h"
+#include "libavutil/internal.h"
 #include "libavutil/intreadwrite.h"
 #include "libavutil/log.h"
 #include "libavutil/opt.h"
@@ -124,7 +125,11 @@  void ffio_init_context(FFIOContext *ctx,
     ctx->current_type        = AVIO_DATA_MARKER_UNKNOWN;
     ctx->last_time           = AV_NOPTS_VALUE;
     ctx->short_seek_get      = NULL;
+#if FF_API_AVIOCONTEXT_WRITTEN
+FF_DISABLE_DEPRECATION_WARNINGS
     s->written               = 0;
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
 }
 
 AVIOContext *avio_alloc_context(
@@ -166,7 +171,11 @@  static void writeout(AVIOContext *s, const uint8_t *data, int len)
         } else {
             if (s->pos + len > ctx->bytes_written) {
                 s->bytes_written = ctx->bytes_written = s->pos + len;
+#if FF_API_AVIOCONTEXT_WRITTEN
+FF_DISABLE_DEPRECATION_WARNINGS
                 s->written = ctx->bytes_written;
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
             }
         }
     }
diff --git a/libavformat/version.h b/libavformat/version.h
index 474640bb78..81ed517609 100644
--- a/libavformat/version.h
+++ b/libavformat/version.h
@@ -32,7 +32,7 @@ 
 // Major bumping may affect Ticket5467, 5421, 5451(compatibility with Chromium)
 // Also please add any ticket numbers that you believe might be affected here
 #define LIBAVFORMAT_VERSION_MAJOR  59
-#define LIBAVFORMAT_VERSION_MINOR   7
+#define LIBAVFORMAT_VERSION_MINOR   8
 #define LIBAVFORMAT_VERSION_MICRO 100
 
 #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
@@ -61,6 +61,9 @@ 
 #ifndef FF_API_COMPUTE_PKT_FIELDS2
 #define FF_API_COMPUTE_PKT_FIELDS2      (LIBAVFORMAT_VERSION_MAJOR < 60)
 #endif
+#ifndef FF_API_AVIOCONTEXT_WRITTEN
+#define FF_API_AVIOCONTEXT_WRITTEN      (LIBAVFORMAT_VERSION_MAJOR < 60)
+#endif
 
 
 #ifndef FF_API_R_FRAME_RATE