From 7d0e3b197c817b307d599a23704a44763ed0bbdd Mon Sep 17 00:00:00 2001 From: Carl Eugen Hoyos Date: Thu, 14 Feb 2013 15:08:37 +0100 Subject: [PATCH] Write the fiel atom to mov files independently of the used video coded. The QuickTime specification does not contain any hint that the atom must not be written in some cases and both the QuickTime and the AVID decoders do not fail if the atom is present. This change allows to signal (visually) interlaced streams with a codec different from uncompressed video. As a side-effect, this fixes ticket #2202 --- libavformat/movenc.c | 7 +++-- tests/ref/lavf/mov | 16 +++++----- tests/ref/seek/lavf-mov | 44 ++++++++++++++-------------- tests/ref/vsynth/vsynth1-avui | 4 +-- tests/ref/vsynth/vsynth1-dnxhd-1080i | 4 +-- tests/ref/vsynth/vsynth1-mpeg4 | 4 +-- tests/ref/vsynth/vsynth2-avui | 4 +-- tests/ref/vsynth/vsynth2-dnxhd-1080i | 4 +-- tests/ref/vsynth/vsynth2-mpeg4 | 4 +-- 9 files changed, 46 insertions(+), 45 deletions(-) diff --git a/libavformat/movenc.c b/libavformat/movenc.c index 08015b545c..df52d49b30 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -1127,13 +1127,14 @@ static int mov_write_video_tag(AVIOContext *pb, MOVTrack *track) mov_write_avcc_tag(pb, track); if(track->mode == MODE_IPOD) mov_write_uuid_tag_ipod(pb); - } else if (track->enc->field_order != AV_FIELD_UNKNOWN) - mov_write_fiel_tag(pb, track); - else if (track->enc->codec_id == AV_CODEC_ID_VC1 && track->vos_len > 0) + } else if (track->enc->codec_id == AV_CODEC_ID_VC1 && track->vos_len > 0) mov_write_dvc1_tag(pb, track); else if (track->vos_len > 0) mov_write_glbl_tag(pb, track); + if (track->enc->field_order != AV_FIELD_UNKNOWN) + mov_write_fiel_tag(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) { mov_write_pasp_tag(pb, track); diff --git a/tests/ref/lavf/mov b/tests/ref/lavf/mov index 2ed8ad02da..8e03b29087 100644 --- a/tests/ref/lavf/mov +++ b/tests/ref/lavf/mov @@ -1,12 +1,12 @@ -fcbe7806047914d9751fd9053009df69 *./tests/data/lavf/lavf.mov -367365 ./tests/data/lavf/lavf.mov +821cbbb6166b1d1117585fa4bb167a8e *./tests/data/lavf/lavf.mov +367375 ./tests/data/lavf/lavf.mov ./tests/data/lavf/lavf.mov CRC=0xb2f59ab4 -72eac0051107a16e41d5263dab640f26 *./tests/data/lavf/lavf.mov -358455 ./tests/data/lavf/lavf.mov +f8e597c1ca2dddd581c82fef7700ae33 *./tests/data/lavf/lavf.mov +358465 ./tests/data/lavf/lavf.mov ./tests/data/lavf/lavf.mov CRC=0xb2f59ab4 -cf6ea2e8d4d16626d9dbd9e3fb802ce6 *./tests/data/lavf/lavf.mov -367549 ./tests/data/lavf/lavf.mov +e77a5f18503c243165295166098d9001 *./tests/data/lavf/lavf.mov +367559 ./tests/data/lavf/lavf.mov ./tests/data/lavf/lavf.mov CRC=0x6e82384a -7c932d24837f46ef57d3e40a61331565 *./tests/data/lavf/lavf.mov -357837 ./tests/data/lavf/lavf.mov +2561698a1e4ba55e03fd9ebdba743bb0 *./tests/data/lavf/lavf.mov +357847 ./tests/data/lavf/lavf.mov ./tests/data/lavf/lavf.mov CRC=0xb2f59ab4 diff --git a/tests/ref/seek/lavf-mov b/tests/ref/seek/lavf-mov index 9563a0d3a5..c7278bd03e 100644 --- a/tests/ref/seek/lavf-mov +++ b/tests/ref/seek/lavf-mov @@ -1,48 +1,48 @@ -ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 1727 size: 27837 +ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 1737 size: 27837 ret: 0 st:-1 flags:0 ts:-1.000000 -ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 1727 size: 27837 +ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 1737 size: 27837 ret: 0 st:-1 flags:1 ts: 1.894167 -ret: 0 st: 1 flags:1 dts: 0.952018 pts: 0.952018 pos: 326931 size: 1024 +ret: 0 st: 1 flags:1 dts: 0.952018 pts: 0.952018 pos: 326941 size: 1024 ret: 0 st: 0 flags:0 ts: 0.788359 -ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 327955 size: 27834 +ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 327965 size: 27834 ret: 0 st: 0 flags:1 ts:-0.317500 -ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 1727 size: 27837 +ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 1737 size: 27837 ret:-1 st: 1 flags:0 ts: 2.576667 ret: 0 st: 1 flags:1 ts: 1.470839 -ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 327955 size: 27834 +ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 327965 size: 27834 ret: 0 st:-1 flags:0 ts: 0.365002 -ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 165209 size: 27925 +ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 165219 size: 27925 ret: 0 st:-1 flags:1 ts:-0.740831 -ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 1727 size: 27837 +ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 1737 size: 27837 ret:-1 st: 0 flags:0 ts: 2.153359 ret: 0 st: 0 flags:1 ts: 1.047500 -ret: 0 st: 1 flags:1 dts: 0.952018 pts: 0.952018 pos: 326931 size: 1024 +ret: 0 st: 1 flags:1 dts: 0.952018 pts: 0.952018 pos: 326941 size: 1024 ret: 0 st: 1 flags:0 ts:-0.058322 -ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 1727 size: 27837 +ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 1737 size: 27837 ret: 0 st: 1 flags:1 ts: 2.835828 -ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 327955 size: 27834 +ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 327965 size: 27834 ret:-1 st:-1 flags:0 ts: 1.730004 ret: 0 st:-1 flags:1 ts: 0.624171 -ret: 0 st: 1 flags:1 dts: 0.464399 pts: 0.464399 pos: 164185 size: 1024 +ret: 0 st: 1 flags:1 dts: 0.464399 pts: 0.464399 pos: 164195 size: 1024 ret: 0 st: 0 flags:0 ts:-0.481641 -ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 1727 size: 27837 +ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 1737 size: 27837 ret: 0 st: 0 flags:1 ts: 2.412500 -ret: 0 st: 1 flags:1 dts: 0.952018 pts: 0.952018 pos: 326931 size: 1024 +ret: 0 st: 1 flags:1 dts: 0.952018 pts: 0.952018 pos: 326941 size: 1024 ret:-1 st: 1 flags:0 ts: 1.306667 ret: 0 st: 1 flags:1 ts: 0.200839 -ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 1727 size: 27837 +ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 1737 size: 27837 ret: 0 st:-1 flags:0 ts:-0.904994 -ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 1727 size: 27837 +ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 1737 size: 27837 ret: 0 st:-1 flags:1 ts: 1.989173 -ret: 0 st: 1 flags:1 dts: 0.952018 pts: 0.952018 pos: 326931 size: 1024 +ret: 0 st: 1 flags:1 dts: 0.952018 pts: 0.952018 pos: 326941 size: 1024 ret: 0 st: 0 flags:0 ts: 0.883359 -ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 327955 size: 27834 +ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 327965 size: 27834 ret: 0 st: 0 flags:1 ts:-0.222500 -ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 1727 size: 27837 +ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 1737 size: 27837 ret:-1 st: 1 flags:0 ts: 2.671678 ret: 0 st: 1 flags:1 ts: 1.565850 -ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 327955 size: 27834 +ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 327965 size: 27834 ret: 0 st:-1 flags:0 ts: 0.460008 -ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 165209 size: 27925 +ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 165219 size: 27925 ret: 0 st:-1 flags:1 ts:-0.645825 -ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 1727 size: 27837 +ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 1737 size: 27837 diff --git a/tests/ref/vsynth/vsynth1-avui b/tests/ref/vsynth/vsynth1-avui index 03f2b31c38..e4434e88d0 100644 --- a/tests/ref/vsynth/vsynth1-avui +++ b/tests/ref/vsynth/vsynth1-avui @@ -1,4 +1,4 @@ -853dad3a1248614c6d61c2f9dc2a999c *tests/data/fate/vsynth1-avui.mov -42624907 tests/data/fate/vsynth1-avui.mov +0e71be51f4e0701d91ff7fa4d9ea0533 *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 diff --git a/tests/ref/vsynth/vsynth1-dnxhd-1080i b/tests/ref/vsynth/vsynth1-dnxhd-1080i index dbe2c371e0..211f366406 100644 --- a/tests/ref/vsynth/vsynth1-dnxhd-1080i +++ b/tests/ref/vsynth/vsynth1-dnxhd-1080i @@ -1,4 +1,4 @@ -124c991ee3ac0caef39a58a45287a762 *tests/data/fate/vsynth1-dnxhd-1080i.mov -3031911 tests/data/fate/vsynth1-dnxhd-1080i.mov +850261d663d64aef9a92418f15a3ee8a *tests/data/fate/vsynth1-dnxhd-1080i.mov +3031921 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 diff --git a/tests/ref/vsynth/vsynth1-mpeg4 b/tests/ref/vsynth/vsynth1-mpeg4 index b6da11cef1..4ed1cd5d10 100644 --- a/tests/ref/vsynth/vsynth1-mpeg4 +++ b/tests/ref/vsynth/vsynth1-mpeg4 @@ -1,4 +1,4 @@ -a2acdf772bf7b7641079d8a03ea03ccf *tests/data/fate/vsynth1-mpeg4.mp4 -540024 tests/data/fate/vsynth1-mpeg4.mp4 +cc2240476d97c7809d461a7d334aa067 *tests/data/fate/vsynth1-mpeg4.mp4 +540034 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 diff --git a/tests/ref/vsynth/vsynth2-avui b/tests/ref/vsynth/vsynth2-avui index 59bac8d604..743c6ffbdb 100644 --- a/tests/ref/vsynth/vsynth2-avui +++ b/tests/ref/vsynth/vsynth2-avui @@ -1,4 +1,4 @@ -d6ed112daf14e73ea50f1c32ecc6d4ce *tests/data/fate/vsynth2-avui.mov -42624907 tests/data/fate/vsynth2-avui.mov +ec8b12fd9f1f7737f7e23419457fe431 *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 diff --git a/tests/ref/vsynth/vsynth2-dnxhd-1080i b/tests/ref/vsynth/vsynth2-dnxhd-1080i index f657eb4c95..80fa5d8218 100644 --- a/tests/ref/vsynth/vsynth2-dnxhd-1080i +++ b/tests/ref/vsynth/vsynth2-dnxhd-1080i @@ -1,4 +1,4 @@ -5d7ab75ce6e547ed63a7a0eacf18f078 *tests/data/fate/vsynth2-dnxhd-1080i.mov -3031911 tests/data/fate/vsynth2-dnxhd-1080i.mov +b50f974586d2d72739eb8e2938425819 *tests/data/fate/vsynth2-dnxhd-1080i.mov +3031921 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 diff --git a/tests/ref/vsynth/vsynth2-mpeg4 b/tests/ref/vsynth/vsynth2-mpeg4 index 399ef58e3f..c6c595e2be 100644 --- a/tests/ref/vsynth/vsynth2-mpeg4 +++ b/tests/ref/vsynth/vsynth2-mpeg4 @@ -1,4 +1,4 @@ -04f74c54f4db25e1d454ede9216632c1 *tests/data/fate/vsynth2-mpeg4.mp4 -119661 tests/data/fate/vsynth2-mpeg4.mp4 +416519c3d814b92fe11401cfac01e3a7 *tests/data/fate/vsynth2-mpeg4.mp4 +119671 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