---
libavformat/movenc.c | 30 +++++++++++++++++++-----------
1 files changed, 19 insertions(+), 11 deletions(-)
diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index b79bbe8..77db99f 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -1401,21 +1401,28 @@ static int mov_write_trak_tag(AVIOContext *pb, MOVTrack
*track, AVStream *st)
return updateSize(pb, pos);
}
-#if 0
-/* TODO: Not sorted out, but not necessary either */
static int mov_write_iods_tag(AVIOContext *pb, MOVMuxContext *mov)
{
- avio_wb32(pb, 0x15); /* size */
+ int i, has_audio = 0, has_video = 0;
+ int64_t pos = avio_tell(pb);
+ for (i = 0; i < mov->nb_streams; i++) {
+ if(mov->tracks[i].entry > 0) {
+ has_audio |= mov->tracks[i].enc->codec_type == AVMEDIA_TYPE_AUDIO;
+ has_video |= mov->tracks[i].enc->codec_type == AVMEDIA_TYPE_VIDEO;
+ }
+ }
+ avio_wb32(pb, 0x0); /* size */
ffio_wfourcc(pb, "iods");
avio_wb32(pb, 0); /* version & flags */
- avio_wb16(pb, 0x1007);
- avio_w8(pb, 0);
- avio_wb16(pb, 0x4fff);
- avio_wb16(pb, 0xfffe);
- avio_wb16(pb, 0x01ff);
- return 0x15;
+ putDescr(pb, 0x10, 7);
+ avio_wb16(pb, 0x004f);
+ avio_w8(pb, 0xff);
+ avio_w8(pb, 0xff);
+ avio_w8(pb, 0xff - has_audio);
+ avio_w8(pb, 0xff - has_video);
+ avio_w8(pb, 0xff);
+ return updateSize(pb, pos);
}
-#endif
static int mov_write_mvhd_tag(AVIOContext *pb, MOVMuxContext *mov)
{
@@ -1823,7 +1830,8 @@ static int mov_write_moov_tag(AVIOContext *pb,
MOVMuxContext *mov,
}
mov_write_mvhd_tag(pb, mov);
- //mov_write_iods_tag(pb, mov);
+ if (mov->mode != MODE_MOV)
+ mov_write_iods_tag(pb, mov);
for (i=0; i<mov->nb_streams; i++) {
if(mov->tracks[i].entry > 0) {
mov_write_trak_tag(pb, &(mov->tracks[i]), i < s->nb_streams ?
s->streams[i] : NULL);
--
1.7.3.1
IODs is for most practical purposes, useless. Whether or not it is required in
various brands is a constant point of debate. Some old software (recent AAC
reference software and very old version of QuickTime) panics if no
IODs atom is present but nothing modern seems to care about it. This
implementation doesn't try to sniff profiles and levels on only indicates "no
audio/video profile specified" or "no audio/video capability required".
I can't say with confidence if specifying "no profile specified" will break
some marginal software that was happy with an absent IODs.
From 14496-3:
"NOTE — Usage of the value 0xFE indicates that the content described by this
InitialObjectDescriptor does not comply to any audio profile specified in
ISO/IEC 14496-3.
Usage of the value 0xFF indicates that none of the audio profile capabilities
are required for
this content."
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel