[FFmpeg-devel] [PATCH V4 5/6] lavf/isom: use side data to save max bit rate for esds box
Jun Zhao
mypopydev at gmail.com
Sat Nov 24 05:31:16 EET 2018
Use AV_PKT_DATA_CPB_PROPERTIES to save max bit rate for esds box,
and update fate at the same time.
Signed-off-by: Jun Zhao <mypopydev at gmail.com>
---
libavformat/isom.c | 19 ++++++++++++-------
tests/ref/fate/adtstoasc_ticket3715 | 2 +-
tests/ref/fate/copy-psp | 4 ++--
tests/ref/fate/gaplessenc-itunes-to-ipod-aac | 10 ++++++----
tests/ref/fate/gaplessenc-pcm-to-mov-aac | 10 ++++++----
tests/ref/fate/gaplessinfo-itunes1 | 10 ++++++----
tests/ref/fate/gaplessinfo-itunes2 | 10 ++++++----
tests/ref/fate/mov-mp3-demux | 2 +-
8 files changed, 40 insertions(+), 27 deletions(-)
diff --git a/libavformat/isom.c b/libavformat/isom.c
index ca9d22e..1780490 100644
--- a/libavformat/isom.c
+++ b/libavformat/isom.c
@@ -508,18 +508,23 @@ int ff_mp4_read_dec_config_descr(AVFormatContext *fc, AVStream *st, AVIOContext
int len, tag;
int ret;
int object_type_id = avio_r8(pb);
+ AVCPBProperties *props = NULL;
+
avio_r8(pb); /* stream type */
avio_rb24(pb); /* buffer size db */
v = avio_rb32(pb);
- // TODO: fix this with codecpar
-#if FF_API_LAVF_AVCTX
-FF_DISABLE_DEPRECATION_WARNINGS
- if (v < INT32_MAX)
- st->codec->rc_max_rate = v;
-FF_ENABLE_DEPRECATION_WARNINGS
-#endif
+ if (v < INT32_MAX) {
+ props = (AVCPBProperties *)av_stream_new_side_data(
+ st,
+ AV_PKT_DATA_CPB_PROPERTIES,
+ sizeof(*props));
+ if (!props)
+ return AVERROR(ENOMEM);
+ memset(props, 0, sizeof(*props));
+ props->max_bitrate = v; /* max bitrate */
+ }
st->codecpar->bit_rate = avio_rb32(pb); /* avg bitrate */
diff --git a/tests/ref/fate/adtstoasc_ticket3715 b/tests/ref/fate/adtstoasc_ticket3715
index c5f03e4..6f6e8b9 100644
--- a/tests/ref/fate/adtstoasc_ticket3715
+++ b/tests/ref/fate/adtstoasc_ticket3715
@@ -7,7 +7,7 @@
#sample_rate 0: 44100
#channel_layout 0: 3
#channel_layout_name 0: stereo
-0, 0, 0, 1024, 371, 0x14b11a4f
+0, 0, 0, 1024, 371, 0x14b11a4f, S=1, 24, 0x1f170156
0, 1024, 1024, 1024, 402, 0x2f00c487
0, 2048, 2048, 1024, 403, 0x1959c0d4
0, 3072, 3072, 1024, 396, 0x98a9c134
diff --git a/tests/ref/fate/copy-psp b/tests/ref/fate/copy-psp
index 44ec461..a4683ab 100644
--- a/tests/ref/fate/copy-psp
+++ b/tests/ref/fate/copy-psp
@@ -1,4 +1,4 @@
-65a177552e03123c9a62ddb942970d05 *tests/data/fate/copy-psp.psp
+3bc37a07647197c6fbd55a3585f532ab *tests/data/fate/copy-psp.psp
2041445 tests/data/fate/copy-psp.psp
#extradata 0: 51, 0xaf6d1012
#extradata 1: 2, 0x00b200a1
@@ -14,7 +14,7 @@
#channel_layout 1: 3
#channel_layout_name 1: stereo
0, 0, 0, 3003, 37084, 0x021a0d3f
-1, 0, 0, 1024, 10, 0x0e270398
+1, 0, 0, 1024, 10, 0x0e270398, S=1, 24, 0x163600f1
1, 1024, 1024, 1025, 10, 0x0f4703b8
0, 3003, 3003, 3003, 6925, 0x011b3822, F=0x0
1, 2049, 2049, 1023, 334, 0x2675a55f
diff --git a/tests/ref/fate/gaplessenc-itunes-to-ipod-aac b/tests/ref/fate/gaplessenc-itunes-to-ipod-aac
index 76cbf22..1ef4e9b 100644
--- a/tests/ref/fate/gaplessenc-itunes-to-ipod-aac
+++ b/tests/ref/fate/gaplessenc-itunes-to-ipod-aac
@@ -2,6 +2,8 @@
index=0
start_pts=0
duration_ts=103326
+[SIDE_DATA]
+[/SIDE_DATA]
[/STREAM]
[FORMAT]
start_time=0.000000
@@ -15,7 +17,6 @@ packet|pts=2048|dts=2048|duration=1024|flags=K_
packet|pts=3072|dts=3072|duration=1024|flags=K_
packet|pts=4096|dts=4096|duration=1024|flags=K_
packet|pts=5120|dts=5120|duration=1024|flags=K_
-packet|pts=95232|dts=95232|duration=1024|flags=K_
packet|pts=96256|dts=96256|duration=1024|flags=K_
packet|pts=97280|dts=97280|duration=1024|flags=K_
packet|pts=98304|dts=98304|duration=1024|flags=K_
@@ -23,7 +24,8 @@ packet|pts=99328|dts=99328|duration=1024|flags=K_
packet|pts=100352|dts=100352|duration=1024|flags=K_
packet|pts=101376|dts=101376|duration=1024|flags=K_
packet|pts=102400|dts=102400|duration=926|flags=K_
-stream|nb_read_packets=102
+stream|nb_read_packets=102side_data|
+
frame|pkt_pts=0|pkt_dts=0|best_effort_timestamp=0|pkt_duration=1024|nb_samples=1024
frame|pkt_pts=1024|pkt_dts=1024|best_effort_timestamp=1024|pkt_duration=1024|nb_samples=1024
frame|pkt_pts=2048|pkt_dts=2048|best_effort_timestamp=2048|pkt_duration=1024|nb_samples=1024
@@ -32,7 +34,6 @@ frame|pkt_pts=4096|pkt_dts=4096|best_effort_timestamp=4096|pkt_duration=1024|nb_
frame|pkt_pts=5120|pkt_dts=5120|best_effort_timestamp=5120|pkt_duration=1024|nb_samples=1024
frame|pkt_pts=6144|pkt_dts=6144|best_effort_timestamp=6144|pkt_duration=1024|nb_samples=1024
frame|pkt_pts=7168|pkt_dts=7168|best_effort_timestamp=7168|pkt_duration=1024|nb_samples=1024
-frame|pkt_pts=95232|pkt_dts=95232|best_effort_timestamp=95232|pkt_duration=1024|nb_samples=1024
frame|pkt_pts=96256|pkt_dts=96256|best_effort_timestamp=96256|pkt_duration=1024|nb_samples=1024
frame|pkt_pts=97280|pkt_dts=97280|best_effort_timestamp=97280|pkt_duration=1024|nb_samples=1024
frame|pkt_pts=98304|pkt_dts=98304|best_effort_timestamp=98304|pkt_duration=1024|nb_samples=1024
@@ -40,4 +41,5 @@ frame|pkt_pts=99328|pkt_dts=99328|best_effort_timestamp=99328|pkt_duration=1024|
frame|pkt_pts=100352|pkt_dts=100352|best_effort_timestamp=100352|pkt_duration=1024|nb_samples=1024
frame|pkt_pts=101376|pkt_dts=101376|best_effort_timestamp=101376|pkt_duration=1024|nb_samples=1024
frame|pkt_pts=102400|pkt_dts=102400|best_effort_timestamp=102400|pkt_duration=926|nb_samples=1024
-stream|nb_read_frames=101
+stream|nb_read_frames=101side_data|
+
diff --git a/tests/ref/fate/gaplessenc-pcm-to-mov-aac b/tests/ref/fate/gaplessenc-pcm-to-mov-aac
index 2b17956..a9092e7 100644
--- a/tests/ref/fate/gaplessenc-pcm-to-mov-aac
+++ b/tests/ref/fate/gaplessenc-pcm-to-mov-aac
@@ -2,6 +2,8 @@
index=0
start_pts=0
duration_ts=529200
+[SIDE_DATA]
+[/SIDE_DATA]
[/STREAM]
[FORMAT]
start_time=0.000000
@@ -15,7 +17,6 @@ packet|pts=2048|dts=2048|duration=1024|flags=K_
packet|pts=3072|dts=3072|duration=1024|flags=K_
packet|pts=4096|dts=4096|duration=1024|flags=K_
packet|pts=5120|dts=5120|duration=1024|flags=K_
-packet|pts=521216|dts=521216|duration=1024|flags=K_
packet|pts=522240|dts=522240|duration=1024|flags=K_
packet|pts=523264|dts=523264|duration=1024|flags=K_
packet|pts=524288|dts=524288|duration=1024|flags=K_
@@ -23,7 +24,8 @@ packet|pts=525312|dts=525312|duration=1024|flags=K_
packet|pts=526336|dts=526336|duration=1024|flags=K_
packet|pts=527360|dts=527360|duration=1024|flags=K_
packet|pts=528384|dts=528384|duration=816|flags=K_
-stream|nb_read_packets=518
+stream|nb_read_packets=518side_data|
+
frame|pkt_pts=0|pkt_dts=0|best_effort_timestamp=0|pkt_duration=1024|nb_samples=1024
frame|pkt_pts=1024|pkt_dts=1024|best_effort_timestamp=1024|pkt_duration=1024|nb_samples=1024
frame|pkt_pts=2048|pkt_dts=2048|best_effort_timestamp=2048|pkt_duration=1024|nb_samples=1024
@@ -32,7 +34,6 @@ frame|pkt_pts=4096|pkt_dts=4096|best_effort_timestamp=4096|pkt_duration=1024|nb_
frame|pkt_pts=5120|pkt_dts=5120|best_effort_timestamp=5120|pkt_duration=1024|nb_samples=1024
frame|pkt_pts=6144|pkt_dts=6144|best_effort_timestamp=6144|pkt_duration=1024|nb_samples=1024
frame|pkt_pts=7168|pkt_dts=7168|best_effort_timestamp=7168|pkt_duration=1024|nb_samples=1024
-frame|pkt_pts=521216|pkt_dts=521216|best_effort_timestamp=521216|pkt_duration=1024|nb_samples=1024
frame|pkt_pts=522240|pkt_dts=522240|best_effort_timestamp=522240|pkt_duration=1024|nb_samples=1024
frame|pkt_pts=523264|pkt_dts=523264|best_effort_timestamp=523264|pkt_duration=1024|nb_samples=1024
frame|pkt_pts=524288|pkt_dts=524288|best_effort_timestamp=524288|pkt_duration=1024|nb_samples=1024
@@ -40,4 +41,5 @@ frame|pkt_pts=525312|pkt_dts=525312|best_effort_timestamp=525312|pkt_duration=10
frame|pkt_pts=526336|pkt_dts=526336|best_effort_timestamp=526336|pkt_duration=1024|nb_samples=1024
frame|pkt_pts=527360|pkt_dts=527360|best_effort_timestamp=527360|pkt_duration=1024|nb_samples=1024
frame|pkt_pts=528384|pkt_dts=528384|best_effort_timestamp=528384|pkt_duration=816|nb_samples=1024
-stream|nb_read_frames=517
+stream|nb_read_frames=517side_data|
+
diff --git a/tests/ref/fate/gaplessinfo-itunes1 b/tests/ref/fate/gaplessinfo-itunes1
index bb5c09a..b7d14ea 100644
--- a/tests/ref/fate/gaplessinfo-itunes1
+++ b/tests/ref/fate/gaplessinfo-itunes1
@@ -2,6 +2,8 @@
index=0
start_pts=2112
duration_ts=1294336
+[SIDE_DATA]
+[/SIDE_DATA]
[/STREAM]
[FORMAT]
start_time=0.047889
@@ -15,7 +17,6 @@ packet|pts=3072|dts=3072|duration=1024|flags=K_
packet|pts=4096|dts=4096|duration=1024|flags=K_
packet|pts=5120|dts=5120|duration=1024|flags=K_
packet|pts=6144|dts=6144|duration=1024|flags=K_
-packet|pts=1286144|dts=1286144|duration=1024|flags=K_
packet|pts=1287168|dts=1287168|duration=1024|flags=K_
packet|pts=1288192|dts=1288192|duration=1024|flags=K_
packet|pts=1289216|dts=1289216|duration=1024|flags=K_
@@ -23,7 +24,8 @@ packet|pts=1290240|dts=1290240|duration=1024|flags=K_
packet|pts=1291264|dts=1291264|duration=1024|flags=K_
packet|pts=1292288|dts=1292288|duration=1024|flags=K_
packet|pts=1293312|dts=1293312|duration=1024|flags=K_
-stream|nb_read_packets=1264
+stream|nb_read_packets=1264side_data|
+
frame|pkt_pts=2112|pkt_dts=2112|best_effort_timestamp=2048|pkt_duration=960|nb_samples=960
frame|pkt_pts=3072|pkt_dts=3072|best_effort_timestamp=3072|pkt_duration=1024|nb_samples=1024
frame|pkt_pts=4096|pkt_dts=4096|best_effort_timestamp=4096|pkt_duration=1024|nb_samples=1024
@@ -32,7 +34,6 @@ frame|pkt_pts=6144|pkt_dts=6144|best_effort_timestamp=6144|pkt_duration=1024|nb_
frame|pkt_pts=7168|pkt_dts=7168|best_effort_timestamp=7168|pkt_duration=1024|nb_samples=1024
frame|pkt_pts=8192|pkt_dts=8192|best_effort_timestamp=8192|pkt_duration=1024|nb_samples=1024
frame|pkt_pts=9216|pkt_dts=9216|best_effort_timestamp=9216|pkt_duration=1024|nb_samples=1024
-frame|pkt_pts=1286144|pkt_dts=1286144|best_effort_timestamp=1286144|pkt_duration=1024|nb_samples=1024
frame|pkt_pts=1287168|pkt_dts=1287168|best_effort_timestamp=1287168|pkt_duration=1024|nb_samples=1024
frame|pkt_pts=1288192|pkt_dts=1288192|best_effort_timestamp=1288192|pkt_duration=1024|nb_samples=1024
frame|pkt_pts=1289216|pkt_dts=1289216|best_effort_timestamp=1289216|pkt_duration=1024|nb_samples=1024
@@ -40,4 +41,5 @@ frame|pkt_pts=1290240|pkt_dts=1290240|best_effort_timestamp=1290240|pkt_duration
frame|pkt_pts=1291264|pkt_dts=1291264|best_effort_timestamp=1291264|pkt_duration=1024|nb_samples=1024
frame|pkt_pts=1292288|pkt_dts=1292288|best_effort_timestamp=1292288|pkt_duration=1024|nb_samples=1024
frame|pkt_pts=1293312|pkt_dts=1293312|best_effort_timestamp=1293312|pkt_duration=1024|nb_samples=1024
-stream|nb_read_frames=1262
+stream|nb_read_frames=1262side_data|
+
diff --git a/tests/ref/fate/gaplessinfo-itunes2 b/tests/ref/fate/gaplessinfo-itunes2
index 0603ba8..3226835 100644
--- a/tests/ref/fate/gaplessinfo-itunes2
+++ b/tests/ref/fate/gaplessinfo-itunes2
@@ -2,6 +2,8 @@
index=0
start_pts=2112
duration_ts=105472
+[SIDE_DATA]
+[/SIDE_DATA]
[/STREAM]
[FORMAT]
start_time=0.047891
@@ -15,7 +17,6 @@ packet|pts=3072|dts=3072|duration=1024|flags=K_
packet|pts=4096|dts=4096|duration=1024|flags=K_
packet|pts=5120|dts=5120|duration=1024|flags=K_
packet|pts=6144|dts=6144|duration=1024|flags=K_
-packet|pts=97280|dts=97280|duration=1024|flags=K_
packet|pts=98304|dts=98304|duration=1024|flags=K_
packet|pts=99328|dts=99328|duration=1024|flags=K_
packet|pts=100352|dts=100352|duration=1024|flags=K_
@@ -23,7 +24,8 @@ packet|pts=101376|dts=101376|duration=1024|flags=K_
packet|pts=102400|dts=102400|duration=1024|flags=K_
packet|pts=103424|dts=103424|duration=1024|flags=K_
packet|pts=104448|dts=104448|duration=1024|flags=K_
-stream|nb_read_packets=103
+stream|nb_read_packets=103side_data|
+
frame|pkt_pts=2112|pkt_dts=2112|best_effort_timestamp=2048|pkt_duration=960|nb_samples=960
frame|pkt_pts=3072|pkt_dts=3072|best_effort_timestamp=3072|pkt_duration=1024|nb_samples=1024
frame|pkt_pts=4096|pkt_dts=4096|best_effort_timestamp=4096|pkt_duration=1024|nb_samples=1024
@@ -32,7 +34,6 @@ frame|pkt_pts=6144|pkt_dts=6144|best_effort_timestamp=6144|pkt_duration=1024|nb_
frame|pkt_pts=7168|pkt_dts=7168|best_effort_timestamp=7168|pkt_duration=1024|nb_samples=1024
frame|pkt_pts=8192|pkt_dts=8192|best_effort_timestamp=8192|pkt_duration=1024|nb_samples=1024
frame|pkt_pts=9216|pkt_dts=9216|best_effort_timestamp=9216|pkt_duration=1024|nb_samples=1024
-frame|pkt_pts=97280|pkt_dts=97280|best_effort_timestamp=97280|pkt_duration=1024|nb_samples=1024
frame|pkt_pts=98304|pkt_dts=98304|best_effort_timestamp=98304|pkt_duration=1024|nb_samples=1024
frame|pkt_pts=99328|pkt_dts=99328|best_effort_timestamp=99328|pkt_duration=1024|nb_samples=1024
frame|pkt_pts=100352|pkt_dts=100352|best_effort_timestamp=100352|pkt_duration=1024|nb_samples=1024
@@ -40,4 +41,5 @@ frame|pkt_pts=101376|pkt_dts=101376|best_effort_timestamp=101376|pkt_duration=10
frame|pkt_pts=102400|pkt_dts=102400|best_effort_timestamp=102400|pkt_duration=1024|nb_samples=1024
frame|pkt_pts=103424|pkt_dts=103424|best_effort_timestamp=103424|pkt_duration=1024|nb_samples=1024
frame|pkt_pts=104448|pkt_dts=104448|best_effort_timestamp=104448|pkt_duration=1024|nb_samples=1024
-stream|nb_read_frames=101
+stream|nb_read_frames=101side_data|
+
diff --git a/tests/ref/fate/mov-mp3-demux b/tests/ref/fate/mov-mp3-demux
index 1930960..4654245 100644
--- a/tests/ref/fate/mov-mp3-demux
+++ b/tests/ref/fate/mov-mp3-demux
@@ -4,7 +4,7 @@
#sample_rate 0: 44100
#channel_layout 0: 3
#channel_layout_name 0: stereo
-0, 0, 0, 1152, 36, 0x8e260589
+0, 0, 0, 1152, 36, 0x8e260589, S=1, 24, 0x1d5b0143
0, 1152, 1152, 1152, 36, 0x8e260589
0, 2304, 2304, 1152, 36, 0x8e260589
0, 3456, 3456, 1152, 36, 0x8e260589
--
1.7.1
More information about the ffmpeg-devel
mailing list