[FFmpeg-cvslog] lavf: Switch bitrate to 64bit unless compatibility with avconv was requested.

Carl Eugen Hoyos git at videolan.org
Tue Sep 15 18:17:43 CEST 2015


ffmpeg | branch: master | Carl Eugen Hoyos <cehoyos at ag.or.at> | Tue Sep 15 17:29:38 2015 +0200| [c311713ca99cb0556609972ba60d3634dc96c7a0] | committer: Carl Eugen Hoyos

lavf: Switch bitrate to 64bit unless compatibility with avconv was requested.

Based on a patch by Steve Swanson, swanysteve at gmail.

Fixes ticket #2089.

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

 doc/APIchanges         |    4 ++++
 libavformat/avformat.h |    4 ++++
 libavformat/dump.c     |    2 +-
 libavformat/g729dec.c  |    2 +-
 libavformat/utils.c    |    6 +++---
 libavformat/version.h  |    2 +-
 6 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/doc/APIchanges b/doc/APIchanges
index e5cd3e4..7cde366 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -15,6 +15,10 @@ libavutil:     2015-08-28
 
 API changes, most recent first:
 
+2015-09-15 - lavf 57.1.100 - avformat.h
+  bit_rate was changed to 64bit, make sure you update any
+  printf() or other type sensitive code
+
 2015-09-15 - lavc 57.2.100 - avcodec.h
   bit_rate/rc_max_rate/rc_min_rate were changed to 64bit, make sure you update
   any printf() or other type sensitive code
diff --git a/libavformat/avformat.h b/libavformat/avformat.h
index b7f18c1..825e636 100644
--- a/libavformat/avformat.h
+++ b/libavformat/avformat.h
@@ -1358,7 +1358,11 @@ typedef struct AVFormatContext {
      * available. Never set it directly if the file_size and the
      * duration are known as FFmpeg can compute it automatically.
      */
+#if AV_HAVE_INCOMPATIBLE_LIBAV_ABI
     int bit_rate;
+#else
+    int64_t bit_rate;
+#endif
 
     unsigned int packet_size;
     int max_delay;
diff --git a/libavformat/dump.c b/libavformat/dump.c
index 705da82..7ed7665 100644
--- a/libavformat/dump.c
+++ b/libavformat/dump.c
@@ -518,7 +518,7 @@ void av_dump_format(AVFormatContext *ic, int index,
         }
         av_log(NULL, AV_LOG_INFO, ", bitrate: ");
         if (ic->bit_rate)
-            av_log(NULL, AV_LOG_INFO, "%d kb/s", ic->bit_rate / 1000);
+            av_log(NULL, AV_LOG_INFO, "%"PRId64" kb/s", (int64_t)ic->bit_rate / 1000);
         else
             av_log(NULL, AV_LOG_INFO, "N/A");
         av_log(NULL, AV_LOG_INFO, "\n");
diff --git a/libavformat/g729dec.c b/libavformat/g729dec.c
index 794558e..349a014 100644
--- a/libavformat/g729dec.c
+++ b/libavformat/g729dec.c
@@ -57,7 +57,7 @@ static int g729_read_header(AVFormatContext *s)
     } else if (s->bit_rate == 8000) {
         st->codec->block_align = 10;
     } else {
-        av_log(s, AV_LOG_ERROR, "Only 8000 b/s and 6400 b/s bitrates are supported. Provided: %d b/s\n", s->bit_rate);
+        av_log(s, AV_LOG_ERROR, "Only 8000 b/s and 6400 b/s bitrates are supported. Provided: %"PRId64" b/s\n", (int64_t)s->bit_rate);
         return AVERROR_INVALIDDATA;
     }
 
diff --git a/libavformat/utils.c b/libavformat/utils.c
index 24eacf3..96a1e86 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -2369,7 +2369,7 @@ static void update_stream_timings(AVFormatContext *ic)
         /* compute the bitrate */
         double bitrate = (double) filesize * 8.0 * AV_TIME_BASE /
                          (double) ic->duration;
-        if (bitrate >= 0 && bitrate <= INT_MAX)
+        if (bitrate >= 0 && (!AV_HAVE_INCOMPATIBLE_LIBAV_ABI || bitrate <= INT_MAX))
             ic->bit_rate = bitrate;
     }
 }
@@ -2614,10 +2614,10 @@ static void estimate_timings(AVFormatContext *ic, int64_t old_offset)
                     (double) st->duration   / AV_TIME_BASE);
         }
         av_log(ic, AV_LOG_TRACE,
-                "stream: start_time: %0.3f duration: %0.3f bitrate=%d kb/s\n",
+                "stream: start_time: %0.3f duration: %0.3f bitrate=%"PRId64" kb/s\n",
                 (double) ic->start_time / AV_TIME_BASE,
                 (double) ic->duration   / AV_TIME_BASE,
-                ic->bit_rate / 1000);
+                (int64_t)ic->bit_rate / 1000);
     }
 }
 
diff --git a/libavformat/version.h b/libavformat/version.h
index 18be8b2..3444908 100644
--- a/libavformat/version.h
+++ b/libavformat/version.h
@@ -30,7 +30,7 @@
 #include "libavutil/version.h"
 
 #define LIBAVFORMAT_VERSION_MAJOR  57
-#define LIBAVFORMAT_VERSION_MINOR   0
+#define LIBAVFORMAT_VERSION_MINOR   1
 #define LIBAVFORMAT_VERSION_MICRO 100
 
 #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \



More information about the ffmpeg-cvslog mailing list