[FFmpeg-devel] [PATCH v2 32/32] avcodec: Switch AVCPBProperties to 64bits

Andreas Rheinhardt andreas.rheinhardt at outlook.com
Mon Apr 19 17:37:05 EEST 2021


From: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>

Announced in 2e8b0446c6798947dac77fee4a06f9c4e8131ab5.
Two FATE-tests needed to be updated because the checksums of
side data containing an AVCPBProperties struct changed.

buffer_size has also been switched to 64bits because it is a bitsize.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
---
Now also switching buffer_size to 64bits. This has the intended
side-effect of fixing the framecrc checksums for non-x64 arches.

 libavcodec/avcodec.h                 | 14 +-------------
 libavcodec/version.h                 |  3 ---
 libavformat/dump.c                   |  4 ----
 tests/ref/fate/mxf-d10-user-comments |  2 +-
 tests/ref/fate/ts-demux              |  2 +-
 5 files changed, 3 insertions(+), 22 deletions(-)

diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 43b83ac348..684602f22f 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -455,35 +455,23 @@ typedef struct AVCPBProperties {
      * Maximum bitrate of the stream, in bits per second.
      * Zero if unknown or unspecified.
      */
-#if FF_API_UNSANITIZED_BITRATES
-    int max_bitrate;
-#else
     int64_t max_bitrate;
-#endif
     /**
      * Minimum bitrate of the stream, in bits per second.
      * Zero if unknown or unspecified.
      */
-#if FF_API_UNSANITIZED_BITRATES
-    int min_bitrate;
-#else
     int64_t min_bitrate;
-#endif
     /**
      * Average bitrate of the stream, in bits per second.
      * Zero if unknown or unspecified.
      */
-#if FF_API_UNSANITIZED_BITRATES
-    int avg_bitrate;
-#else
     int64_t avg_bitrate;
-#endif
 
     /**
      * The size of the buffer to which the ratecontrol is applied, in bits.
      * Zero if unknown or unspecified.
      */
-    int buffer_size;
+    int64_t buffer_size;
 
     /**
      * The delay between the time the packet this structure is associated with
diff --git a/libavcodec/version.h b/libavcodec/version.h
index 17cd17c327..0830acf8b2 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -54,9 +54,6 @@
 #ifndef FF_API_CODED_FRAME
 #define FF_API_CODED_FRAME       (LIBAVCODEC_VERSION_MAJOR < 59)
 #endif
-#ifndef FF_API_UNSANITIZED_BITRATES
-#define FF_API_UNSANITIZED_BITRATES (LIBAVCODEC_VERSION_MAJOR < 59)
-#endif
 #ifndef FF_API_OPENH264_SLICE_MODE
 #define FF_API_OPENH264_SLICE_MODE (LIBAVCODEC_VERSION_MAJOR < 59)
 #endif
diff --git a/libavformat/dump.c b/libavformat/dump.c
index 62ef5e9852..2b6ed1ed1f 100644
--- a/libavformat/dump.c
+++ b/libavformat/dump.c
@@ -322,11 +322,7 @@ static void dump_cpb(void *ctx, const AVPacketSideData *sd)
     }
 
     av_log(ctx, AV_LOG_INFO,
-#if FF_API_UNSANITIZED_BITRATES
-           "bitrate max/min/avg: %d/%d/%d buffer size: %d ",
-#else
            "bitrate max/min/avg: %"PRId64"/%"PRId64"/%"PRId64" buffer size: %d ",
-#endif
            cpb->max_bitrate, cpb->min_bitrate, cpb->avg_bitrate,
            cpb->buffer_size);
     if (cpb->vbv_delay == UINT64_MAX)
diff --git a/tests/ref/fate/mxf-d10-user-comments b/tests/ref/fate/mxf-d10-user-comments
index 13761fb0ce..609271ac05 100644
--- a/tests/ref/fate/mxf-d10-user-comments
+++ b/tests/ref/fate/mxf-d10-user-comments
@@ -6,7 +6,7 @@
 #codec_id 0: mpeg2video
 #dimensions 0: 1280x720
 #sar 0: 3/4
-0,         -1,          0,        1,   150000, 0x0547870d, S=1,       24, 0x5aa90ad0
+0,         -1,          0,        1,   150000, 0x0547870d, S=1,       40, 0x7ea50ad0
 0,          0,          1,        1,   150000, 0xe80a1612, F=0x0
 0,          1,          2,        1,   150000, 0xc5c50e2f, F=0x0
 0,          2,          3,        1,   150000, 0x51e28a04, F=0x0
diff --git a/tests/ref/fate/ts-demux b/tests/ref/fate/ts-demux
index cdf34d6af0..c20364483b 100644
--- a/tests/ref/fate/ts-demux
+++ b/tests/ref/fate/ts-demux
@@ -15,7 +15,7 @@
 1,       5760,       5760,     2880,     1536, 0xbab5129c
 1,       8640,       8640,     2880,     1536, 0x602f034b, S=1,        1, 0x00bd00bd
 1,      11520,      11520,     2880,      906, 0x69cdcbcd
-0,      32037,      36541,     1501,   114336, 0x37a215a8, S=2,        1, 0x00e000e0,       24, 0x663d0b52
+0,      32037,      36541,     1501,   114336, 0x37a215a8, S=2,        1, 0x00e000e0,       40, 0x91e10b52
 0,      33538,      33538,     1501,    12560, 0xb559a3d4, F=0x0, S=1,        1, 0x00e000e0
 0,      35040,      35040,     1501,    12704, 0x2614adf4, F=0x0, S=1,        1, 0x00e000e0
 0,      36541,      41046,     1501,    51976, 0x9ff1dbfe, F=0x0, S=1,        1, 0x00e000e0
-- 
2.27.0



More information about the ffmpeg-devel mailing list