This should result in more idiomatic output that is less confusing to marginal implementations. --- libavformat/movenc.c | 16 ++++++++++++++-- 1 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/libavformat/movenc.c b/libavformat/movenc.c index b79bbe8..066dae0 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -381,6 +381,18 @@ static int mov_write_glbl_tag(AVIOContext *pb, MOVTrack *track) return 8+track->vosLen; } +static int mov_write_extradata(AVIOContext *pb, MOVTrack *track) +{ + if (track->vosLen >= 8 && + AV_RB32(track->vosData+4) == MKBETAG('f','i','e','l')) { + avio_wb32(pb, track->vosLen); + avio_write(pb, track->vosData+4, track->vosLen-4); + return track->vosLen; + } else { + return mov_write_glbl_tag(pb, track); + } +} + /** * Compute flags for 'lpcm' tag. * See CoreAudioTypes and AudioStreamBasicDescription at Apple. @@ -498,7 +510,7 @@ static int mov_write_audio_tag(AVIOContext *pb, MOVTrack *track) else if(track->enc->codec_id == CODEC_ID_ALAC) mov_write_extradata_tag(pb, track); else if(track->vosLen > 0) - mov_write_glbl_tag(pb, track); + mov_write_extradata(pb, track); return updateSize(pb, pos); } @@ -861,7 +873,7 @@ static int mov_write_video_tag(AVIOContext *pb, MOVTrack *track) if(track->mode == MODE_IPOD) mov_write_uuid_tag_ipod(pb); } else if(track->vosLen > 0) - mov_write_glbl_tag(pb, track); + mov_write_extradata(pb, track); if (track->enc->sample_aspect_ratio.den && track->enc->sample_aspect_ratio.num && track->enc->sample_aspect_ratio.den != track->enc->sample_aspect_ratio.num) { -- 1.7.3.1 _______________________________________________ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel