[FFmpeg-devel] [PATCHv2 3/3] avformat/mov: read start_pad from edit list start time if codec is aac

Marton Balint cus at passwd.hu
Tue Mar 8 21:29:53 CET 2016


Related to ticket #2324, #2325.

Stream duration still need to be fixed...

Signed-off-by: Marton Balint <cus at passwd.hu>
---
 libavformat/mov.c                 |  3 +++
 tests/ref/fate/gapless2-ipod-aac1 | 36 ++++++++++++++++++------------------
 tests/ref/fate/gapless2-ipod-aac2 | 36 ++++++++++++++++++------------------
 tests/ref/fate/gapless2-mov-aac   | 36 ++++++++++++++++++------------------
 4 files changed, 57 insertions(+), 54 deletions(-)

diff --git a/libavformat/mov.c b/libavformat/mov.c
index 752bc12..73e3f30 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -2688,6 +2688,9 @@ static void mov_build_index(MOVContext *mov, AVStream *st)
                 st->codec->has_b_frames = 1;
             }
         }
+
+        if (!unsupported && st->codec->codec_id == AV_CODEC_ID_AAC && start_time > 0)
+            sc->start_pad = start_time;
     }
 
     /* only use old uncompressed audio chunk demuxing when stts specifies it */
diff --git a/tests/ref/fate/gapless2-ipod-aac1 b/tests/ref/fate/gapless2-ipod-aac1
index ee7f126..890b617 100644
--- a/tests/ref/fate/gapless2-ipod-aac1
+++ b/tests/ref/fate/gapless2-ipod-aac1
@@ -44,12 +44,12 @@ source|1262|frame|pkt_pts=1293312|pkt_dts=1293312|best_effort_timestamp=1293312|
 target|[STREAM]
 target|index=0
 target|codec_name=aac
-target|start_pts=-1024
+target|start_pts=0
 target|duration_ts=1293248
 target|[/STREAM]
 target|[FORMAT]
 target|format_name=mov,mp4,m4a,3gp,3g2,mj2
-target|start_time=-0.023220
+target|start_time=0.000000
 target|duration=29.326000
 target|[/FORMAT]
 target|1|packet|pts=-1024|dts=-1024|duration=1024
@@ -68,19 +68,19 @@ target|1260|packet|pts=1288192|dts=1288192|duration=1024
 target|1261|packet|pts=1289216|dts=1289216|duration=1024
 target|1262|packet|pts=1290240|dts=1290240|duration=1024
 target|1263|packet|pts=1291264|dts=1291264|duration=1984
-target|1|frame|pkt_pts=-1024|pkt_dts=-1024|best_effort_timestamp=-1024|pkt_duration=1024|nb_samples=1024
-target|2|frame|pkt_pts=0|pkt_dts=0|best_effort_timestamp=0|pkt_duration=1024|nb_samples=1024
-target|3|frame|pkt_pts=1024|pkt_dts=1024|best_effort_timestamp=1024|pkt_duration=1024|nb_samples=1024
-target|4|frame|pkt_pts=2048|pkt_dts=2048|best_effort_timestamp=2048|pkt_duration=1024|nb_samples=1024
-target|5|frame|pkt_pts=3072|pkt_dts=3072|best_effort_timestamp=3072|pkt_duration=1024|nb_samples=1024
-target|6|frame|pkt_pts=4096|pkt_dts=4096|best_effort_timestamp=4096|pkt_duration=1024|nb_samples=1024
-target|7|frame|pkt_pts=5120|pkt_dts=5120|best_effort_timestamp=5120|pkt_duration=1024|nb_samples=1024
-target|8|frame|pkt_pts=6144|pkt_dts=6144|best_effort_timestamp=6144|pkt_duration=1024|nb_samples=1024
-target|1256|frame|pkt_pts=1284096|pkt_dts=1284096|best_effort_timestamp=1284096|pkt_duration=1024|nb_samples=1024
-target|1257|frame|pkt_pts=1285120|pkt_dts=1285120|best_effort_timestamp=1285120|pkt_duration=1024|nb_samples=1024
-target|1258|frame|pkt_pts=1286144|pkt_dts=1286144|best_effort_timestamp=1286144|pkt_duration=1024|nb_samples=1024
-target|1259|frame|pkt_pts=1287168|pkt_dts=1287168|best_effort_timestamp=1287168|pkt_duration=1024|nb_samples=1024
-target|1260|frame|pkt_pts=1288192|pkt_dts=1288192|best_effort_timestamp=1288192|pkt_duration=1024|nb_samples=1024
-target|1261|frame|pkt_pts=1289216|pkt_dts=1289216|best_effort_timestamp=1289216|pkt_duration=1024|nb_samples=1024
-target|1262|frame|pkt_pts=1290240|pkt_dts=1290240|best_effort_timestamp=1290240|pkt_duration=1024|nb_samples=1024
-target|1263|frame|pkt_pts=1291264|pkt_dts=1291264|best_effort_timestamp=1291264|pkt_duration=1984|nb_samples=1024
+target|1|frame|pkt_pts=0|pkt_dts=0|best_effort_timestamp=0|pkt_duration=1024|nb_samples=1024
+target|2|frame|pkt_pts=1024|pkt_dts=1024|best_effort_timestamp=1024|pkt_duration=1024|nb_samples=1024
+target|3|frame|pkt_pts=2048|pkt_dts=2048|best_effort_timestamp=2048|pkt_duration=1024|nb_samples=1024
+target|4|frame|pkt_pts=3072|pkt_dts=3072|best_effort_timestamp=3072|pkt_duration=1024|nb_samples=1024
+target|5|frame|pkt_pts=4096|pkt_dts=4096|best_effort_timestamp=4096|pkt_duration=1024|nb_samples=1024
+target|6|frame|pkt_pts=5120|pkt_dts=5120|best_effort_timestamp=5120|pkt_duration=1024|nb_samples=1024
+target|7|frame|pkt_pts=6144|pkt_dts=6144|best_effort_timestamp=6144|pkt_duration=1024|nb_samples=1024
+target|8|frame|pkt_pts=7168|pkt_dts=7168|best_effort_timestamp=7168|pkt_duration=1024|nb_samples=1024
+target|1255|frame|pkt_pts=1284096|pkt_dts=1284096|best_effort_timestamp=1284096|pkt_duration=1024|nb_samples=1024
+target|1256|frame|pkt_pts=1285120|pkt_dts=1285120|best_effort_timestamp=1285120|pkt_duration=1024|nb_samples=1024
+target|1257|frame|pkt_pts=1286144|pkt_dts=1286144|best_effort_timestamp=1286144|pkt_duration=1024|nb_samples=1024
+target|1258|frame|pkt_pts=1287168|pkt_dts=1287168|best_effort_timestamp=1287168|pkt_duration=1024|nb_samples=1024
+target|1259|frame|pkt_pts=1288192|pkt_dts=1288192|best_effort_timestamp=1288192|pkt_duration=1024|nb_samples=1024
+target|1260|frame|pkt_pts=1289216|pkt_dts=1289216|best_effort_timestamp=1289216|pkt_duration=1024|nb_samples=1024
+target|1261|frame|pkt_pts=1290240|pkt_dts=1290240|best_effort_timestamp=1290240|pkt_duration=1024|nb_samples=1024
+target|1262|frame|pkt_pts=1291264|pkt_dts=1291264|best_effort_timestamp=1291264|pkt_duration=1984|nb_samples=1024
diff --git a/tests/ref/fate/gapless2-ipod-aac2 b/tests/ref/fate/gapless2-ipod-aac2
index 83d7a3f..d653b16 100644
--- a/tests/ref/fate/gapless2-ipod-aac2
+++ b/tests/ref/fate/gapless2-ipod-aac2
@@ -44,12 +44,12 @@ source|101|frame|pkt_pts=104448|pkt_dts=104448|best_effort_timestamp=104448|pkt_
 target|[STREAM]
 target|index=0
 target|codec_name=aac
-target|start_pts=-1024
+target|start_pts=0
 target|duration_ts=104384
 target|[/STREAM]
 target|[FORMAT]
 target|format_name=mov,mp4,m4a,3gp,3g2,mj2
-target|start_time=-0.023220
+target|start_time=0.000000
 target|duration=2.367000
 target|[/FORMAT]
 target|1|packet|pts=-1024|dts=-1024|duration=1024
@@ -68,19 +68,19 @@ target|99|packet|pts=99328|dts=99328|duration=1024
 target|100|packet|pts=100352|dts=100352|duration=1024
 target|101|packet|pts=101376|dts=101376|duration=1024
 target|102|packet|pts=102400|dts=102400|duration=1984
-target|1|frame|pkt_pts=-1024|pkt_dts=-1024|best_effort_timestamp=-1024|pkt_duration=1024|nb_samples=1024
-target|2|frame|pkt_pts=0|pkt_dts=0|best_effort_timestamp=0|pkt_duration=1024|nb_samples=1024
-target|3|frame|pkt_pts=1024|pkt_dts=1024|best_effort_timestamp=1024|pkt_duration=1024|nb_samples=1024
-target|4|frame|pkt_pts=2048|pkt_dts=2048|best_effort_timestamp=2048|pkt_duration=1024|nb_samples=1024
-target|5|frame|pkt_pts=3072|pkt_dts=3072|best_effort_timestamp=3072|pkt_duration=1024|nb_samples=1024
-target|6|frame|pkt_pts=4096|pkt_dts=4096|best_effort_timestamp=4096|pkt_duration=1024|nb_samples=1024
-target|7|frame|pkt_pts=5120|pkt_dts=5120|best_effort_timestamp=5120|pkt_duration=1024|nb_samples=1024
-target|8|frame|pkt_pts=6144|pkt_dts=6144|best_effort_timestamp=6144|pkt_duration=1024|nb_samples=1024
-target|95|frame|pkt_pts=95232|pkt_dts=95232|best_effort_timestamp=95232|pkt_duration=1024|nb_samples=1024
-target|96|frame|pkt_pts=96256|pkt_dts=96256|best_effort_timestamp=96256|pkt_duration=1024|nb_samples=1024
-target|97|frame|pkt_pts=97280|pkt_dts=97280|best_effort_timestamp=97280|pkt_duration=1024|nb_samples=1024
-target|98|frame|pkt_pts=98304|pkt_dts=98304|best_effort_timestamp=98304|pkt_duration=1024|nb_samples=1024
-target|99|frame|pkt_pts=99328|pkt_dts=99328|best_effort_timestamp=99328|pkt_duration=1024|nb_samples=1024
-target|100|frame|pkt_pts=100352|pkt_dts=100352|best_effort_timestamp=100352|pkt_duration=1024|nb_samples=1024
-target|101|frame|pkt_pts=101376|pkt_dts=101376|best_effort_timestamp=101376|pkt_duration=1024|nb_samples=1024
-target|102|frame|pkt_pts=102400|pkt_dts=102400|best_effort_timestamp=102400|pkt_duration=1984|nb_samples=1024
+target|1|frame|pkt_pts=0|pkt_dts=0|best_effort_timestamp=0|pkt_duration=1024|nb_samples=1024
+target|2|frame|pkt_pts=1024|pkt_dts=1024|best_effort_timestamp=1024|pkt_duration=1024|nb_samples=1024
+target|3|frame|pkt_pts=2048|pkt_dts=2048|best_effort_timestamp=2048|pkt_duration=1024|nb_samples=1024
+target|4|frame|pkt_pts=3072|pkt_dts=3072|best_effort_timestamp=3072|pkt_duration=1024|nb_samples=1024
+target|5|frame|pkt_pts=4096|pkt_dts=4096|best_effort_timestamp=4096|pkt_duration=1024|nb_samples=1024
+target|6|frame|pkt_pts=5120|pkt_dts=5120|best_effort_timestamp=5120|pkt_duration=1024|nb_samples=1024
+target|7|frame|pkt_pts=6144|pkt_dts=6144|best_effort_timestamp=6144|pkt_duration=1024|nb_samples=1024
+target|8|frame|pkt_pts=7168|pkt_dts=7168|best_effort_timestamp=7168|pkt_duration=1024|nb_samples=1024
+target|94|frame|pkt_pts=95232|pkt_dts=95232|best_effort_timestamp=95232|pkt_duration=1024|nb_samples=1024
+target|95|frame|pkt_pts=96256|pkt_dts=96256|best_effort_timestamp=96256|pkt_duration=1024|nb_samples=1024
+target|96|frame|pkt_pts=97280|pkt_dts=97280|best_effort_timestamp=97280|pkt_duration=1024|nb_samples=1024
+target|97|frame|pkt_pts=98304|pkt_dts=98304|best_effort_timestamp=98304|pkt_duration=1024|nb_samples=1024
+target|98|frame|pkt_pts=99328|pkt_dts=99328|best_effort_timestamp=99328|pkt_duration=1024|nb_samples=1024
+target|99|frame|pkt_pts=100352|pkt_dts=100352|best_effort_timestamp=100352|pkt_duration=1024|nb_samples=1024
+target|100|frame|pkt_pts=101376|pkt_dts=101376|best_effort_timestamp=101376|pkt_duration=1024|nb_samples=1024
+target|101|frame|pkt_pts=102400|pkt_dts=102400|best_effort_timestamp=102400|pkt_duration=1984|nb_samples=1024
diff --git a/tests/ref/fate/gapless2-mov-aac b/tests/ref/fate/gapless2-mov-aac
index b26cd8d..44e73f3 100644
--- a/tests/ref/fate/gapless2-mov-aac
+++ b/tests/ref/fate/gapless2-mov-aac
@@ -44,12 +44,12 @@ source|517|frame|pkt_pts=528384|pkt_dts=528384|best_effort_timestamp=528384|pkt_
 target|[STREAM]
 target|index=0
 target|codec_name=aac
-target|start_pts=-1024
+target|start_pts=0
 target|duration_ts=530224
 target|[/STREAM]
 target|[FORMAT]
 target|format_name=mov,mp4,m4a,3gp,3g2,mj2
-target|start_time=-0.023220
+target|start_time=0.000000
 target|duration=12.024000
 target|[/FORMAT]
 target|1|packet|pts=-1024|dts=-1024|duration=1024
@@ -68,19 +68,19 @@ target|515|packet|pts=525312|dts=525312|duration=1024
 target|516|packet|pts=526336|dts=526336|duration=1024
 target|517|packet|pts=527360|dts=527360|duration=1024
 target|518|packet|pts=528384|dts=528384|duration=1840
-target|1|frame|pkt_pts=-1024|pkt_dts=-1024|best_effort_timestamp=-1024|pkt_duration=1024|nb_samples=1024
-target|2|frame|pkt_pts=0|pkt_dts=0|best_effort_timestamp=0|pkt_duration=1024|nb_samples=1024
-target|3|frame|pkt_pts=1024|pkt_dts=1024|best_effort_timestamp=1024|pkt_duration=1024|nb_samples=1024
-target|4|frame|pkt_pts=2048|pkt_dts=2048|best_effort_timestamp=2048|pkt_duration=1024|nb_samples=1024
-target|5|frame|pkt_pts=3072|pkt_dts=3072|best_effort_timestamp=3072|pkt_duration=1024|nb_samples=1024
-target|6|frame|pkt_pts=4096|pkt_dts=4096|best_effort_timestamp=4096|pkt_duration=1024|nb_samples=1024
-target|7|frame|pkt_pts=5120|pkt_dts=5120|best_effort_timestamp=5120|pkt_duration=1024|nb_samples=1024
-target|8|frame|pkt_pts=6144|pkt_dts=6144|best_effort_timestamp=6144|pkt_duration=1024|nb_samples=1024
-target|511|frame|pkt_pts=521216|pkt_dts=521216|best_effort_timestamp=521216|pkt_duration=1024|nb_samples=1024
-target|512|frame|pkt_pts=522240|pkt_dts=522240|best_effort_timestamp=522240|pkt_duration=1024|nb_samples=1024
-target|513|frame|pkt_pts=523264|pkt_dts=523264|best_effort_timestamp=523264|pkt_duration=1024|nb_samples=1024
-target|514|frame|pkt_pts=524288|pkt_dts=524288|best_effort_timestamp=524288|pkt_duration=1024|nb_samples=1024
-target|515|frame|pkt_pts=525312|pkt_dts=525312|best_effort_timestamp=525312|pkt_duration=1024|nb_samples=1024
-target|516|frame|pkt_pts=526336|pkt_dts=526336|best_effort_timestamp=526336|pkt_duration=1024|nb_samples=1024
-target|517|frame|pkt_pts=527360|pkt_dts=527360|best_effort_timestamp=527360|pkt_duration=1024|nb_samples=1024
-target|518|frame|pkt_pts=528384|pkt_dts=528384|best_effort_timestamp=528384|pkt_duration=1840|nb_samples=1024
+target|1|frame|pkt_pts=0|pkt_dts=0|best_effort_timestamp=0|pkt_duration=1024|nb_samples=1024
+target|2|frame|pkt_pts=1024|pkt_dts=1024|best_effort_timestamp=1024|pkt_duration=1024|nb_samples=1024
+target|3|frame|pkt_pts=2048|pkt_dts=2048|best_effort_timestamp=2048|pkt_duration=1024|nb_samples=1024
+target|4|frame|pkt_pts=3072|pkt_dts=3072|best_effort_timestamp=3072|pkt_duration=1024|nb_samples=1024
+target|5|frame|pkt_pts=4096|pkt_dts=4096|best_effort_timestamp=4096|pkt_duration=1024|nb_samples=1024
+target|6|frame|pkt_pts=5120|pkt_dts=5120|best_effort_timestamp=5120|pkt_duration=1024|nb_samples=1024
+target|7|frame|pkt_pts=6144|pkt_dts=6144|best_effort_timestamp=6144|pkt_duration=1024|nb_samples=1024
+target|8|frame|pkt_pts=7168|pkt_dts=7168|best_effort_timestamp=7168|pkt_duration=1024|nb_samples=1024
+target|510|frame|pkt_pts=521216|pkt_dts=521216|best_effort_timestamp=521216|pkt_duration=1024|nb_samples=1024
+target|511|frame|pkt_pts=522240|pkt_dts=522240|best_effort_timestamp=522240|pkt_duration=1024|nb_samples=1024
+target|512|frame|pkt_pts=523264|pkt_dts=523264|best_effort_timestamp=523264|pkt_duration=1024|nb_samples=1024
+target|513|frame|pkt_pts=524288|pkt_dts=524288|best_effort_timestamp=524288|pkt_duration=1024|nb_samples=1024
+target|514|frame|pkt_pts=525312|pkt_dts=525312|best_effort_timestamp=525312|pkt_duration=1024|nb_samples=1024
+target|515|frame|pkt_pts=526336|pkt_dts=526336|best_effort_timestamp=526336|pkt_duration=1024|nb_samples=1024
+target|516|frame|pkt_pts=527360|pkt_dts=527360|best_effort_timestamp=527360|pkt_duration=1024|nb_samples=1024
+target|517|frame|pkt_pts=528384|pkt_dts=528384|best_effort_timestamp=528384|pkt_duration=1840|nb_samples=1024
-- 
2.6.2



More information about the ffmpeg-devel mailing list