summaryrefslogtreecommitdiff
path: root/libavformat
diff options
context:
space:
mode:
authorKevin Wheatley <kevin.j.wheatley@gmail.com>2015-02-16 10:40:36 +0000
committerMichael Niedermayer <michaelni@gmx.at>2015-02-20 12:17:14 +0100
commit31c7c0e156975be615479948824c1528952c0731 (patch)
tree9710b5d7fab35cec8dafd1a19e1cbaa80e645e1f /libavformat
parent588361dd26602c6327fc87c89eddcf78b5f5b16e (diff)
avformat/movenc: Move avid DNxHD padding to the correct spot
Outputting DNxHD into .mov containers 'corrupts' following atoms until end of stsd ffmpeg and qtdump could not decode pasp/colr atoms in the files made by ffmpeg, when outputting DNxHD due to the incorrect padding placement. Now we add the padding in the correct place Tidy up FATE changes due to padding changes. Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/movenc.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index 5e172cb917..a72f84e530 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -1077,8 +1077,6 @@ static int mov_write_avid_tag(AVIOContext *pb, MOVTrack *track)
for (i = 0; i < 10; i++)
avio_wb64(pb, 0);
- /* extra padding for stsd needed */
- avio_wb32(pb, 0);
return 0;
}
@@ -1592,6 +1590,7 @@ static int mov_write_video_tag(AVIOContext *pb, MOVMuxContext *mov, MOVTrack *tr
{
int64_t pos = avio_tell(pb);
char compressor_name[32] = { 0 };
+ int avid = 0;
avio_wb32(pb, 0); /* size */
avio_wl32(pb, track->tag); // store it byteswapped
@@ -1640,9 +1639,10 @@ static int mov_write_video_tag(AVIOContext *pb, MOVMuxContext *mov, MOVTrack *tr
track->enc->codec_id == AV_CODEC_ID_SVQ3) {
mov_write_extradata_tag(pb, track);
avio_wb32(pb, 0);
- } else if (track->enc->codec_id == AV_CODEC_ID_DNXHD)
+ } else if (track->enc->codec_id == AV_CODEC_ID_DNXHD) {
mov_write_avid_tag(pb, track);
- else if (track->enc->codec_id == AV_CODEC_ID_HEVC)
+ avid = 1;
+ } else if (track->enc->codec_id == AV_CODEC_ID_HEVC)
mov_write_hvcc_tag(pb, track);
else if (track->enc->codec_id == AV_CODEC_ID_H264 && !TAG_IS_AVCI(track->tag)) {
mov_write_avcc_tag(pb, track);
@@ -1674,6 +1674,11 @@ static int mov_write_video_tag(AVIOContext *pb, MOVMuxContext *mov, MOVTrack *tr
mov_write_pasp_tag(pb, track);
}
+ /* extra padding for avid stsd */
+ /* https://developer.apple.com/library/mac/documentation/QuickTime/QTFF/QTFFChap2/qtff2.html#//apple_ref/doc/uid/TP40000939-CH204-61112 */
+ if (avid)
+ avio_wb32(pb, 0);
+
return update_size(pb, pos);
}