Merge remote-tracking branch 'qatar/master'

* qatar/master:
  movenc: Make tkhd "enabled" flag QuickTime compatible

Conflicts:
	libavformat/movenc.c
	tests/ref/acodec/alac
	tests/ref/acodec/pcm-s16be
	tests/ref/acodec/pcm-s24be
	tests/ref/acodec/pcm-s32be
	tests/ref/acodec/pcm-s8
	tests/ref/lavf/mov
	tests/ref/vsynth/vsynth1-dnxhd-1080i
	tests/ref/vsynth/vsynth1-mpeg4
	tests/ref/vsynth/vsynth1-prores
	tests/ref/vsynth/vsynth1-qtrle
	tests/ref/vsynth/vsynth1-svq1
	tests/ref/vsynth/vsynth2-dnxhd-1080i
	tests/ref/vsynth/vsynth2-mpeg4
	tests/ref/vsynth/vsynth2-prores
	tests/ref/vsynth/vsynth2-qtrle
	tests/ref/vsynth/vsynth2-svq1

Merged-by: Michael Niedermayer <michaelni@gmx.at>
pull/37/head
Michael Niedermayer 11 years ago
commit 800ea20cad
  1. 64
      libavformat/movenc.c
  2. 2
      libavformat/movenc.h
  3. 2
      tests/ref/acodec/alac
  4. 2
      tests/ref/acodec/pcm-s16be
  5. 2
      tests/ref/acodec/pcm-s24be
  6. 2
      tests/ref/acodec/pcm-s32be
  7. 2
      tests/ref/acodec/pcm-s8
  8. 2
      tests/ref/fate/sub-movtextenc
  9. 6
      tests/ref/lavf/ismv
  10. 8
      tests/ref/lavf/mov
  11. 2
      tests/ref/vsynth/vsynth1-avui
  12. 2
      tests/ref/vsynth/vsynth1-dnxhd-1080i
  13. 2
      tests/ref/vsynth/vsynth1-mpeg4
  14. 2
      tests/ref/vsynth/vsynth1-prores
  15. 2
      tests/ref/vsynth/vsynth1-prores_ks
  16. 2
      tests/ref/vsynth/vsynth1-qtrle
  17. 2
      tests/ref/vsynth/vsynth1-qtrlegray
  18. 2
      tests/ref/vsynth/vsynth1-svq1
  19. 2
      tests/ref/vsynth/vsynth2-avui
  20. 2
      tests/ref/vsynth/vsynth2-dnxhd-1080i
  21. 2
      tests/ref/vsynth/vsynth2-mpeg4
  22. 2
      tests/ref/vsynth/vsynth2-prores
  23. 2
      tests/ref/vsynth/vsynth2-prores_ks
  24. 2
      tests/ref/vsynth/vsynth2-qtrle
  25. 2
      tests/ref/vsynth/vsynth2-qtrlegray
  26. 2
      tests/ref/vsynth/vsynth2-svq1

@ -1600,7 +1600,9 @@ static int mov_write_tkhd_tag(AVIOContext *pb, MOVTrack *track, AVStream *st)
(version == 1) ? avio_wb32(pb, 104) : avio_wb32(pb, 92); /* size */
ffio_wfourcc(pb, "tkhd");
avio_w8(pb, version);
avio_wb24(pb, track->secondary ? 0x2 : 0xf); /* flags (first track enabled) */
avio_wb24(pb, (track->flags & MOV_TRACK_ENABLED) ?
MOV_TKHD_FLAG_ENABLED | MOV_TKHD_FLAG_IN_MOVIE :
MOV_TKHD_FLAG_IN_MOVIE);
if (version == 1) {
avio_wb64(pb, track->time);
avio_wb64(pb, track->time);
@ -2331,7 +2333,6 @@ static int mov_write_moov_tag(AVIOContext *pb, MOVMuxContext *mov,
{
int i;
int64_t pos = avio_tell(pb);
int not_first[AVMEDIA_TYPE_NB]={0};
avio_wb32(pb, 0); /* size placeholder*/
ffio_wfourcc(pb, "moov");
@ -2372,13 +2373,6 @@ static int mov_write_moov_tag(AVIOContext *pb, MOVMuxContext *mov,
mov_write_iods_tag(pb, mov);
for (i = 0; i < mov->nb_streams; i++) {
if (mov->tracks[i].entry > 0 || mov->flags & FF_MOV_FLAG_FRAGMENT) {
if (i < s->nb_streams){
int codec_type= s->streams[i]->codec->codec_type;
if (codec_type==AVMEDIA_TYPE_AUDIO || codec_type==AVMEDIA_TYPE_SUBTITLE){
mov->tracks[i].secondary= not_first[codec_type];
not_first[codec_type]= 1;
}
}
mov_write_trak_tag(pb, mov, &(mov->tracks[i]), i < s->nb_streams ? s->streams[i] : NULL);
}
}
@ -3510,6 +3504,56 @@ static int mov_create_timecode_track(AVFormatContext *s, int index, int src_inde
return ret;
}
/*
* st->disposition controls the "enabled" flag in the tkhd tag.
* QuickTime will not play a track if it is not enabled. So make sure
* that one track of each type (audio, video, subtitle) is enabled.
*
* Subtitles are special. For audio and video, setting "enabled" also
* makes the track "default" (i.e. it is rendered when played). For
* subtitles, an "enabled" subtitle is not rendered by default, but
* if no subtitle is enabled, the subtitle menu in QuickTime will be
* empty!
*/
static void enable_tracks(AVFormatContext *s)
{
MOVMuxContext *mov = s->priv_data;
int i;
uint8_t enabled[AVMEDIA_TYPE_NB];
int first[AVMEDIA_TYPE_NB];
for (i = 0; i < AVMEDIA_TYPE_NB; i++) {
enabled[i] = 0;
first[i] = -1;
}
for (i = 0; i < s->nb_streams; i++) {
AVStream *st = s->streams[i];
if (st->codec->codec_type <= AVMEDIA_TYPE_UNKNOWN ||
st->codec->codec_type >= AVMEDIA_TYPE_NB)
continue;
if (first[st->codec->codec_type] < 0)
first[st->codec->codec_type] = i;
if (st->disposition & AV_DISPOSITION_DEFAULT) {
mov->tracks[i].flags |= MOV_TRACK_ENABLED;
enabled[st->codec->codec_type] = 1;
}
}
for (i = 0; i < AVMEDIA_TYPE_NB; i++) {
switch (i) {
case AVMEDIA_TYPE_VIDEO:
case AVMEDIA_TYPE_AUDIO:
case AVMEDIA_TYPE_SUBTITLE:
if (!enabled[i] && first[i] >= 0)
mov->tracks[first[i]].flags |= MOV_TRACK_ENABLED;
break;
}
}
}
static int mov_write_header(AVFormatContext *s)
{
AVIOContext *pb = s->pb;
@ -3720,6 +3764,8 @@ static int mov_write_header(AVFormatContext *s)
}
}
enable_tracks(s);
if (mov->mode == MODE_ISM) {
/* If no fragmentation options have been set, set a default. */
if (!(mov->flags & (FF_MOV_FLAG_FRAG_KEYFRAME |

@ -89,13 +89,13 @@ typedef struct MOVTrack {
int has_keyframes;
#define MOV_TRACK_CTTS 0x0001
#define MOV_TRACK_STPS 0x0002
#define MOV_TRACK_ENABLED 0x0004
uint32_t flags;
#define MOV_TIMECODE_FLAG_DROPFRAME 0x0001
#define MOV_TIMECODE_FLAG_24HOURSMAX 0x0002
#define MOV_TIMECODE_FLAG_ALLOWNEGATIVE 0x0004
uint32_t timecode_flags;
int language;
int secondary;
int track_id;
int tag; ///< stsd fourcc
AVCodecContext *enc;

@ -1,4 +1,4 @@
f01f453dd13c4e88266409cddf2a7177 *tests/data/fate/acodec-alac.mov
8d9fb9f5433962e7880b666e6e2e428e *tests/data/fate/acodec-alac.mov
389018 tests/data/fate/acodec-alac.mov
64151e4bcc2b717aa5a8454d424d6a1f *tests/data/fate/acodec-alac.out.wav
stddev: 0.00 PSNR:999.99 MAXDIFF: 0 bytes: 1058400/ 1058400

@ -1,4 +1,4 @@
d00ca427a66be2e33ca8d63bcde41316 *tests/data/fate/acodec-pcm-s16be.mov
d2515f35266ae6dba525c700bb76d893 *tests/data/fate/acodec-pcm-s16be.mov
1059069 tests/data/fate/acodec-pcm-s16be.mov
64151e4bcc2b717aa5a8454d424d6a1f *tests/data/fate/acodec-pcm-s16be.out.wav
stddev: 0.00 PSNR:999.99 MAXDIFF: 0 bytes: 1058400/ 1058400

@ -1,4 +1,4 @@
f65a7ae3b70ca53ffa354b1e7ff3a33d *tests/data/fate/acodec-pcm-s24be.mov
0f4a37a77619124f486f656f03c53d33 *tests/data/fate/acodec-pcm-s24be.mov
1588323 tests/data/fate/acodec-pcm-s24be.mov
64151e4bcc2b717aa5a8454d424d6a1f *tests/data/fate/acodec-pcm-s24be.out.wav
stddev: 0.00 PSNR:999.99 MAXDIFF: 0 bytes: 1058400/ 1058400

@ -1,4 +1,4 @@
f9e16fafeefb2285e943f53133e9cfd5 *tests/data/fate/acodec-pcm-s32be.mov
d6380bf54ac3e452c190ce302c264bf0 *tests/data/fate/acodec-pcm-s32be.mov
2117527 tests/data/fate/acodec-pcm-s32be.mov
64151e4bcc2b717aa5a8454d424d6a1f *tests/data/fate/acodec-pcm-s32be.out.wav
stddev: 0.00 PSNR:999.99 MAXDIFF: 0 bytes: 1058400/ 1058400

@ -1,4 +1,4 @@
d931dc4fffa2d3398e0f31f97e7d6c3a *tests/data/fate/acodec-pcm-s8.mov
00a9d90e06e8ecb79e5dd4c6c8460836 *tests/data/fate/acodec-pcm-s8.mov
529853 tests/data/fate/acodec-pcm-s8.mov
651d4eb8d98dfcdda96ae6c43d8f156b *tests/data/fate/acodec-pcm-s8.out.wav
stddev: 147.89 PSNR: 52.93 MAXDIFF: 255 bytes: 1058400/ 1058400

@ -1 +1 @@
0435265a76ab2f6e66627089d76845f4
8cb21f3632e1c86358429fb9402d19d4

@ -1,9 +1,9 @@
3a2563358cc91017fc96f9e690f26b85 *./tests/data/lavf/lavf.ismv
1efcfb3f09a9802ba63f6f592601281e *./tests/data/lavf/lavf.ismv
312255 ./tests/data/lavf/lavf.ismv
./tests/data/lavf/lavf.ismv CRC=0x9d9a638a
77dec1248e2c4d3b2b44dfe6bd27149a *./tests/data/lavf/lavf.ismv
95a3553714bb603f6b0e2bc0fc3fb319 *./tests/data/lavf/lavf.ismv
321181 ./tests/data/lavf/lavf.ismv
./tests/data/lavf/lavf.ismv CRC=0xe8130120
3a2563358cc91017fc96f9e690f26b85 *./tests/data/lavf/lavf.ismv
1efcfb3f09a9802ba63f6f592601281e *./tests/data/lavf/lavf.ismv
312255 ./tests/data/lavf/lavf.ismv
./tests/data/lavf/lavf.ismv CRC=0x9d9a638a

@ -1,12 +1,12 @@
673de726034d2a44be176fa8166df376 *./tests/data/lavf/lavf.mov
65ba2cff95100a4914b2ff507eb42818 *./tests/data/lavf/lavf.mov
366421 ./tests/data/lavf/lavf.mov
./tests/data/lavf/lavf.mov CRC=0xbb2b949b
e833d2e258ee20ef7c13470be8ea293b *./tests/data/lavf/lavf.mov
b9b988b23b5e5aff8760d0475908f837 *./tests/data/lavf/lavf.mov
357511 ./tests/data/lavf/lavf.mov
./tests/data/lavf/lavf.mov CRC=0xbb2b949b
75fd61635a9707a8bed9a32958fe3275 *./tests/data/lavf/lavf.mov
5c5c79e09490763a2692c91c5985b7ea *./tests/data/lavf/lavf.mov
366593 ./tests/data/lavf/lavf.mov
./tests/data/lavf/lavf.mov CRC=0xa9793231
9bcbda2320a1434a3b9470389b45564e *./tests/data/lavf/lavf.mov
c1d4ff07ccad169cb6fca003661f0c12 *./tests/data/lavf/lavf.mov
356893 ./tests/data/lavf/lavf.mov
./tests/data/lavf/lavf.mov CRC=0xbb2b949b

@ -1,4 +1,4 @@
0e71be51f4e0701d91ff7fa4d9ea0533 *tests/data/fate/vsynth1-avui.mov
55af74b378fb938d5ea6e0a37c149f16 *tests/data/fate/vsynth1-avui.mov
42624917 tests/data/fate/vsynth1-avui.mov
c5ccac874dbf808e9088bc3107860042 *tests/data/fate/vsynth1-avui.out.rawvideo
stddev: 0.00 PSNR:999.99 MAXDIFF: 0 bytes: 7603200/ 7603200

@ -1,4 +1,4 @@
124c991ee3ac0caef39a58a45287a762 *tests/data/fate/vsynth1-dnxhd-1080i.mov
8d0f7b3424ada79f87053022bf888797 *tests/data/fate/vsynth1-dnxhd-1080i.mov
3031911 tests/data/fate/vsynth1-dnxhd-1080i.mov
a09132c6db44f415e831dcaa630a351b *tests/data/fate/vsynth1-dnxhd-1080i.out.rawvideo
stddev: 6.29 PSNR: 32.15 MAXDIFF: 64 bytes: 7603200/ 760320

@ -1,4 +1,4 @@
a2acdf772bf7b7641079d8a03ea03ccf *tests/data/fate/vsynth1-mpeg4.mp4
a52ff2ce472737e07462d6b51673a886 *tests/data/fate/vsynth1-mpeg4.mp4
540024 tests/data/fate/vsynth1-mpeg4.mp4
f80ec173d37f2f91add031e95579a220 *tests/data/fate/vsynth1-mpeg4.out.rawvideo
stddev: 7.97 PSNR: 30.10 MAXDIFF: 105 bytes: 7603200/ 7603200

@ -1,4 +1,4 @@
6f7ce83099b35e5af0cf484f2e9f1f4f *tests/data/fate/vsynth1-prores.mov
176b9fa03cc0946c6a41f2dcfad46805 *tests/data/fate/vsynth1-prores.mov
5022821 tests/data/fate/vsynth1-prores.mov
a2e2d1d45341a94ff994d1d92629f778 *tests/data/fate/vsynth1-prores.out.rawvideo
stddev: 2.47 PSNR: 40.27 MAXDIFF: 31 bytes: 7603200/ 7603200

@ -1,4 +1,4 @@
2f760d0e579bbbe24a922e9cbcf3294c *tests/data/fate/vsynth1-prores_ks.mov
1d5522ee2fb507a66d236a09a172dc16 *tests/data/fate/vsynth1-prores_ks.mov
3858911 tests/data/fate/vsynth1-prores_ks.mov
0a4153637d0cc0a88a8bcbf04cfaf8c6 *tests/data/fate/vsynth1-prores_ks.out.rawvideo
stddev: 3.17 PSNR: 38.09 MAXDIFF: 39 bytes: 7603200/ 7603200

@ -1,4 +1,4 @@
4eaa59011403ce3e53f8abb5cf6d26e5 *tests/data/fate/vsynth1-qtrle.mov
d909610eb8ad5250a73f0be4c9c29b82 *tests/data/fate/vsynth1-qtrle.mov
15263158 tests/data/fate/vsynth1-qtrle.mov
93695a27c24a61105076ca7b1f010bbd *tests/data/fate/vsynth1-qtrle.out.rawvideo
stddev: 3.42 PSNR: 37.44 MAXDIFF: 48 bytes: 7603200/ 7603200

@ -1,4 +1,4 @@
052b0956e54dbcaf58984199e8c2e240 *tests/data/fate/vsynth1-qtrlegray.mov
6ef537a90e5295670701bdeaf5eb4ce1 *tests/data/fate/vsynth1-qtrlegray.mov
5113293 tests/data/fate/vsynth1-qtrlegray.mov
cb20af0e5a65aad7cf47002fcb52288e *tests/data/fate/vsynth1-qtrlegray.out.rawvideo
stddev: 25.34 PSNR: 20.05 MAXDIFF: 122 bytes: 7603200/ 7603200

@ -1,4 +1,4 @@
ea441979fa5bf694d1f6cee958d56560 *tests/data/fate/vsynth1-svq1.mov
69afe0f66844ac3edb83d97994099fc0 *tests/data/fate/vsynth1-svq1.mov
1334233 tests/data/fate/vsynth1-svq1.mov
9cc35c54b2c77d36bd7e308b393c1f81 *tests/data/fate/vsynth1-svq1.out.rawvideo
stddev: 9.58 PSNR: 28.50 MAXDIFF: 210 bytes: 7603200/ 7603200

@ -1,4 +1,4 @@
ec8b12fd9f1f7737f7e23419457fe431 *tests/data/fate/vsynth2-avui.mov
ec8425d8916254687ce700c940eb6664 *tests/data/fate/vsynth2-avui.mov
42624917 tests/data/fate/vsynth2-avui.mov
dde5895817ad9d219f79a52d0bdfb001 *tests/data/fate/vsynth2-avui.out.rawvideo
stddev: 0.00 PSNR:999.99 MAXDIFF: 0 bytes: 7603200/ 7603200

@ -1,4 +1,4 @@
5d7ab75ce6e547ed63a7a0eacf18f078 *tests/data/fate/vsynth2-dnxhd-1080i.mov
4bbed3e8b6bc301d9bbdc83859f3a847 *tests/data/fate/vsynth2-dnxhd-1080i.mov
3031911 tests/data/fate/vsynth2-dnxhd-1080i.mov
744ba46da5d4c19a28562ea31061d170 *tests/data/fate/vsynth2-dnxhd-1080i.out.rawvideo
stddev: 1.31 PSNR: 45.77 MAXDIFF: 23 bytes: 7603200/ 760320

@ -1,4 +1,4 @@
04f74c54f4db25e1d454ede9216632c1 *tests/data/fate/vsynth2-mpeg4.mp4
3d99aa9393f2a1a9319580b78df2bf3d *tests/data/fate/vsynth2-mpeg4.mp4
119661 tests/data/fate/vsynth2-mpeg4.mp4
9a1e085d9e488c5ead0c940c9612a37a *tests/data/fate/vsynth2-mpeg4.out.rawvideo
stddev: 5.34 PSNR: 33.57 MAXDIFF: 83 bytes: 7603200/ 7603200

@ -1,4 +1,4 @@
a6351254cccdbc7147600951a798172a *tests/data/fate/vsynth2-prores.mov
af885572d77d28e5ede27932bd68cdde *tests/data/fate/vsynth2-prores.mov
2844076 tests/data/fate/vsynth2-prores.mov
b5844025c0f4c7c37db702c3213db232 *tests/data/fate/vsynth2-prores.out.rawvideo
stddev: 1.31 PSNR: 45.77 MAXDIFF: 11 bytes: 7603200/ 7603200

@ -1,4 +1,4 @@
12c24e7305e131388d5beb2a980293f4 *tests/data/fate/vsynth2-prores_ks.mov
c1c71cf2dbd6e332aacb6ab1c6affa59 *tests/data/fate/vsynth2-prores_ks.mov
3884596 tests/data/fate/vsynth2-prores_ks.mov
ca2f6c1162635dedfa468c90f1fdc0ef *tests/data/fate/vsynth2-prores_ks.out.rawvideo
stddev: 0.92 PSNR: 48.77 MAXDIFF: 10 bytes: 7603200/ 7603200

@ -1,4 +1,4 @@
f2aea57de225cccadb936bba4086a836 *tests/data/fate/vsynth2-qtrle.mov
3172f6a2c63e591048fe3309795f2d7a *tests/data/fate/vsynth2-qtrle.mov
14798345 tests/data/fate/vsynth2-qtrle.mov
98d0e2854731472c5bf13d8638502d0a *tests/data/fate/vsynth2-qtrle.out.rawvideo
stddev: 1.26 PSNR: 46.10 MAXDIFF: 13 bytes: 7603200/ 7603200

@ -1,4 +1,4 @@
ce8a132e4a58748b487c18df2ed83fc1 *tests/data/fate/vsynth2-qtrlegray.mov
5304bbafd31bb8bf3d274f1d01db81f5 *tests/data/fate/vsynth2-qtrlegray.mov
5111283 tests/data/fate/vsynth2-qtrlegray.mov
d7bfbe259af9ae323bb94b09c33570a5 *tests/data/fate/vsynth2-qtrlegray.out.rawvideo
stddev: 18.65 PSNR: 22.72 MAXDIFF: 72 bytes: 7603200/ 7603200

@ -1,4 +1,4 @@
11da7948184b3fee455f66cc5f6f8ca5 *tests/data/fate/vsynth2-svq1.mov
ab9b1f922c4ae1b5d602bdeebc8b185d *tests/data/fate/vsynth2-svq1.mov
766701 tests/data/fate/vsynth2-svq1.mov
aa03471dac3f49455a33a2b19fda1098 *tests/data/fate/vsynth2-svq1.out.rawvideo
stddev: 3.23 PSNR: 37.93 MAXDIFF: 61 bytes: 7603200/ 7603200

Loading…
Cancel
Save