]> git.sesse.net Git - ffmpeg/commitdiff
avformat/movenc: utilize bit rate helper function in ISML writing
authorJan Ekström <jeebjp@gmail.com>
Sun, 20 Sep 2020 12:01:29 +0000 (15:01 +0300)
committerJan Ekström <jeebjp@gmail.com>
Mon, 21 Sep 2020 16:19:52 +0000 (19:19 +0300)
This way we have a single location in movenc which utilizes the
CPB properties.

libavformat/movenc.c

index 5888d107703a590c71bf1c4211bf7eed3b0f8b21..a4ec4d05c9d48cd395a83f1afb4f374dd6b59326 100644 (file)
@@ -4160,7 +4160,6 @@ static int mov_write_isml_manifest(AVIOContext *pb, MOVMuxContext *mov, AVFormat
     int64_t pos = avio_tell(pb);
     int i;
     int64_t manifest_bit_rate = 0;
-    AVCPBProperties *props = NULL;
 
     static const uint8_t uuid[] = {
         0xa5, 0xd4, 0x0b, 0x30, 0xe8, 0x14, 0x11, 0xdd,
@@ -4186,6 +4185,8 @@ static int mov_write_isml_manifest(AVIOContext *pb, MOVMuxContext *mov, AVFormat
 
     for (i = 0; i < mov->nb_streams; i++) {
         MOVTrack *track = &mov->tracks[i];
+        struct mpeg4_bit_rate_values bit_rates =
+            calculate_mpeg4_bit_rates(track);
         const char *type;
         int track_id = track->track_id;
         char track_name_buf[32] = { 0 };
@@ -4201,12 +4202,10 @@ static int mov_write_isml_manifest(AVIOContext *pb, MOVMuxContext *mov, AVFormat
             continue;
         }
 
-        props = (AVCPBProperties*)av_stream_get_side_data(track->st, AV_PKT_DATA_CPB_PROPERTIES, NULL);
-
         if (track->par->bit_rate) {
             manifest_bit_rate = track->par->bit_rate;
-        } else if (props) {
-            manifest_bit_rate = props->max_bitrate;
+        } else {
+            manifest_bit_rate = bit_rates.max_bit_rate;
         }
 
         avio_printf(pb, "<%s systemBitrate=\"%"PRId64"\">\n", type,