Refer to transitions in the presence-or-lack-thereof of progressive flags on MPEG...
[HandBrake.git] / contrib / patch-mpeg4ip.patch
blob75f8bbfae960e3d5295486f5675bf6b992f9dd0e
1 diff -Naur mpeg4ip/bootstrap mpeg4ip-patched/bootstrap
2 --- mpeg4ip/bootstrap 2005-10-13 16:09:41.000000000 -0400
3 +++ mpeg4ip-patched/bootstrap 2008-01-17 12:05:42.000000000 -0500
4 @@ -47,9 +47,9 @@
6 if test $target_system = "Linux"; then
7 have_faac=no
8 - if which faac >/dev/null 2>/dev/null; then
9 - have_faac=yes
10 - fi
11 +# if which faac >/dev/null 2>/dev/null; then
12 +# have_faac=yes
13 +# fi
15 if test $have_faac = "yes"; then
16 # we have lame and faac - see if faac is built with mp4 support
17 diff -Naur mpeg4ip/lib/mp4v2/Makefile.am mpeg4ip-patched/lib/mp4v2/Makefile.am
18 --- mpeg4ip/lib/mp4v2/Makefile.am 2005-03-10 13:31:34.000000000 -0500
19 +++ mpeg4ip-patched/lib/mp4v2/Makefile.am 2008-01-17 12:09:56.000000000 -0500
20 @@ -21,6 +21,7 @@
21 atom_encv.cpp \
22 atom_free.cpp \
23 atom_ftyp.cpp \
24 + atom_gmin.cpp \
25 atom_hdlr.cpp \
26 atom_hinf.cpp \
27 atom_hnti.cpp \
28 @@ -32,6 +33,7 @@
29 atom_mp4s.cpp \
30 atom_mp4v.cpp \
31 atom_mvhd.cpp \
32 + atom_pasp.cpp \
33 atom_root.cpp \
34 atom_rtp.cpp \
35 atom_s263.cpp \
36 @@ -45,6 +47,7 @@
37 atom_stsc.cpp \
38 atom_stsd.cpp \
39 atom_stsz.cpp \
40 + atom_text.cpp \
41 atom_tfhd.cpp \
42 atom_tkhd.cpp \
43 atom_treftype.cpp \
44 diff -Naur mpeg4ip/lib/mp4v2/Makefile.in mpeg4ip-patched/lib/mp4v2/Makefile.in
45 --- mpeg4ip/lib/mp4v2/Makefile.in 2005-05-18 18:03:05.000000000 -0400
46 +++ mpeg4ip-patched/lib/mp4v2/Makefile.in 2008-01-17 12:04:09.000000000 -0500
47 @@ -55,6 +55,7 @@
48 am_libmp4v2_la_OBJECTS = 3gp.lo atom_amr.lo atom_avc1.lo atom_avcC.lo \
49 atom_d263.lo atom_damr.lo atom_dref.lo atom_elst.lo \
50 atom_enca.lo atom_encv.lo atom_free.lo atom_ftyp.lo \
51 + atom_gmin.lo atom_text.lo \
52 atom_hdlr.lo atom_hinf.lo atom_hnti.lo atom_href.lo \
53 atom_mdat.lo atom_mdhd.lo atom_meta.lo atom_mp4a.lo \
54 atom_mp4s.lo atom_mp4v.lo atom_mvhd.lo atom_root.lo \
55 @@ -82,6 +83,7 @@
56 @AMDEP_TRUE@ ./$(DEPDIR)/atom_encv.Plo \
57 @AMDEP_TRUE@ ./$(DEPDIR)/atom_free.Plo \
58 @AMDEP_TRUE@ ./$(DEPDIR)/atom_ftyp.Plo \
59 +@AMDEP_TRUE@ ./$(DEPDIR)/atom_gmin.Plo \
60 @AMDEP_TRUE@ ./$(DEPDIR)/atom_hdlr.Plo \
61 @AMDEP_TRUE@ ./$(DEPDIR)/atom_hinf.Plo \
62 @AMDEP_TRUE@ ./$(DEPDIR)/atom_hnti.Plo \
63 @@ -103,6 +105,7 @@
64 @AMDEP_TRUE@ ./$(DEPDIR)/atom_stsc.Plo \
65 @AMDEP_TRUE@ ./$(DEPDIR)/atom_stsd.Plo \
66 @AMDEP_TRUE@ ./$(DEPDIR)/atom_stsz.Plo \
67 +@AMDEP_TRUE@ ./$(DEPDIR)/atom_text.Plo \
68 @AMDEP_TRUE@ ./$(DEPDIR)/atom_tfhd.Plo \
69 @AMDEP_TRUE@ ./$(DEPDIR)/atom_tkhd.Plo \
70 @AMDEP_TRUE@ ./$(DEPDIR)/atom_treftype.Plo \
71 @@ -349,6 +352,7 @@
72 atom_encv.cpp \
73 atom_free.cpp \
74 atom_ftyp.cpp \
75 + atom_gmin.cpp \
76 atom_hdlr.cpp \
77 atom_hinf.cpp \
78 atom_hnti.cpp \
79 @@ -373,6 +377,7 @@
80 atom_stsc.cpp \
81 atom_stsd.cpp \
82 atom_stsz.cpp \
83 + atom_text.cpp \
84 atom_tfhd.cpp \
85 atom_tkhd.cpp \
86 atom_treftype.cpp \
87 @@ -501,6 +506,7 @@
88 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_encv.Plo@am__quote@
89 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_free.Plo@am__quote@
90 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_ftyp.Plo@am__quote@
91 +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_gmin.Plo@am__quote@
92 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_hdlr.Plo@am__quote@
93 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_hinf.Plo@am__quote@
94 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_hnti.Plo@am__quote@
95 @@ -524,6 +530,7 @@
96 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_stsc.Plo@am__quote@
97 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_stsd.Plo@am__quote@
98 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_stsz.Plo@am__quote@
99 +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_text.Plo@am__quote@
100 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_tfhd.Plo@am__quote@
101 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_tkhd.Plo@am__quote@
102 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_treftype.Plo@am__quote@
103 diff -Naur mpeg4ip/lib/mp4v2/atom_avc1.cpp mpeg4ip-patched/lib/mp4v2/atom_avc1.cpp
104 --- mpeg4ip/lib/mp4v2/atom_avc1.cpp 2004-07-13 17:07:50.000000000 -0400
105 +++ mpeg4ip-patched/lib/mp4v2/atom_avc1.cpp 2008-01-17 12:07:00.000000000 -0500
106 @@ -41,7 +41,7 @@
107 MP4StringProperty* pProp =
108 new MP4StringProperty("compressorName");
109 pProp->SetFixedLength(32);
110 - pProp->SetValue("AVC Coding");
111 + pProp->SetValue("");
112 AddProperty(pProp); /* 6 */
114 AddReserved("reserved4", 4); /* 7 */
115 diff -Naur mpeg4ip/lib/mp4v2/atom_gmin.cpp mpeg4ip-patched/lib/mp4v2/atom_gmin.cpp
116 --- mpeg4ip/lib/mp4v2/atom_gmin.cpp 1969-12-31 19:00:00.000000000 -0500
117 +++ mpeg4ip-patched/lib/mp4v2/atom_gmin.cpp 2008-01-17 12:04:09.000000000 -0500
118 @@ -0,0 +1,51 @@
120 + * The contents of this file are subject to the Mozilla Public
121 + * License Version 1.1 (the "License"); you may not use this file
122 + * except in compliance with the License. You may obtain a copy of
123 + * the License at http://www.mozilla.org/MPL/
124 + *
125 + * Software distributed under the License is distributed on an "AS
126 + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
127 + * implied. See the License for the specific language governing
128 + * rights and limitations under the License.
129 + *
130 + * The Original Code is MPEG4IP.
131 + *
132 + * The Initial Developer of the Original Code is Cisco Systems Inc.
133 + * Portions created by Cisco Systems Inc. are
134 + * Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved.
135 + *
136 + * Contributor(s):
137 + * Dave Mackie dmackie@cisco.com
138 + */
140 +#include "mp4common.h"
142 +MP4GminAtom::MP4GminAtom()
143 + : MP4Atom("gmin")
146 + AddVersionAndFlags(); /* 0, 1 */
148 + AddProperty(new MP4Integer16Property("graphicsMode")); /* 2 */
149 + AddProperty(new MP4Integer16Property("opColorRed")); /* 3 */
150 + AddProperty(new MP4Integer16Property("opColorGreen")); /* 4 */
151 + AddProperty(new MP4Integer16Property("opColorBlue")); /* 5 */
152 + AddProperty(new MP4Integer16Property("balance")); /* 6 */
153 + AddReserved("reserved", 2); /* 7 */
157 +void MP4GminAtom::Generate()
160 + MP4Atom::Generate();
162 + ((MP4Integer16Property*)m_pProperties[2])->SetValue(0x0040);
163 + ((MP4Integer16Property*)m_pProperties[3])->SetValue(0x8000);
164 + ((MP4Integer16Property*)m_pProperties[4])->SetValue(0x8000);
165 + ((MP4Integer16Property*)m_pProperties[5])->SetValue(0x8000);
166 + ((MP4Integer16Property*)m_pProperties[6])->SetValue(0x0000);
170 diff -Naur mpeg4ip/lib/mp4v2/atom_mp4a.cpp mpeg4ip-patched/lib/mp4v2/atom_mp4a.cpp
171 --- mpeg4ip/lib/mp4v2/atom_mp4a.cpp 2001-10-02 17:15:39.000000000 -0400
172 +++ mpeg4ip-patched/lib/mp4v2/atom_mp4a.cpp 2008-01-17 12:04:09.000000000 -0500
173 @@ -29,7 +29,10 @@
174 AddProperty( /* 1 */
175 new MP4Integer16Property("dataReferenceIndex"));
177 - AddReserved("reserved2", 16); /* 2 */
178 + /* patched by saintdev to allow us to set correct audio information */
179 +// AddReserved("reserved2", 16); /* 2 */
180 + AddProperty( /* 2 */
181 + new MP4BytesProperty("reserved2", 16));
183 AddProperty( /* 3 */
184 new MP4Integer16Property("timeScale"));
185 @@ -55,5 +58,6 @@
186 m_pProperties[2]->SetReadOnly(false);
187 ((MP4BytesProperty*)m_pProperties[2])->
188 SetValue(reserved2, sizeof(reserved2));
189 - m_pProperties[2]->SetReadOnly(true);
190 + /* patched by saintdev to allow us to set correct audio information */
191 +// m_pProperties[2]->SetReadOnly(true);
193 diff -Naur mpeg4ip/lib/mp4v2/atom_standard.cpp mpeg4ip-patched/lib/mp4v2/atom_standard.cpp
194 --- mpeg4ip/lib/mp4v2/atom_standard.cpp 2004-12-14 16:35:35.000000000 -0500
195 +++ mpeg4ip-patched/lib/mp4v2/atom_standard.cpp 2008-01-17 12:04:09.000000000 -0500
196 @@ -138,6 +138,11 @@
198 * g???
200 + } else if (ATOMID(type) == ATOMID("gmhd")) {
201 + ExpectChildAtom("gmin", Required, OnlyOne);
202 + ExpectChildAtom("tmcd", Optional, OnlyOne);
203 + ExpectChildAtom("text", Optional, OnlyOne);
205 } else if (ATOMID(type) == ATOMID("gnre")) { // Apple iTunes
206 ExpectChildAtom("data", Optional, OnlyOne);
208 @@ -221,6 +226,7 @@
209 ExpectChildAtom("smhd", Optional, OnlyOne);
210 ExpectChildAtom("hmhd", Optional, OnlyOne);
211 ExpectChildAtom("nmhd", Optional, OnlyOne);
212 + ExpectChildAtom("gmhd", Optional, OnlyOne);
213 ExpectChildAtom("dinf", Required, OnlyOne);
214 ExpectChildAtom("stbl", Required, OnlyOne);
216 @@ -366,6 +372,7 @@
217 ExpectChildAtom("ipir", Optional, OnlyOne);
218 ExpectChildAtom("mpod", Optional, OnlyOne);
219 ExpectChildAtom("sync", Optional, OnlyOne);
220 + ExpectChildAtom("chap", Optional, OnlyOne);
222 } else if (ATOMID(type) == ATOMID("trex")) {
223 AddVersionAndFlags(); /* 0, 1 */
224 diff -Naur mpeg4ip/lib/mp4v2/atom_stsd.cpp mpeg4ip-patched/lib/mp4v2/atom_stsd.cpp
225 --- mpeg4ip/lib/mp4v2/atom_stsd.cpp 2004-07-13 17:07:50.000000000 -0400
226 +++ mpeg4ip-patched/lib/mp4v2/atom_stsd.cpp 2008-01-17 12:07:00.000000000 -0500
227 @@ -49,6 +49,8 @@
228 ExpectChildAtom("sawb", Optional, Many); // For AMR-WB
229 ExpectChildAtom("s263", Optional, Many); // For H.263
230 ExpectChildAtom("avc1", Optional, Many);
231 + ExpectChildAtom("text", Optional, Many);
232 + ExpectChildAtom("pasp", Optional, Many);
235 void MP4StsdAtom::Read()
236 diff -Naur mpeg4ip/lib/mp4v2/atom_text.cpp mpeg4ip-patched/lib/mp4v2/atom_text.cpp
237 --- mpeg4ip/lib/mp4v2/atom_text.cpp 1969-12-31 19:00:00.000000000 -0500
238 +++ mpeg4ip-patched/lib/mp4v2/atom_text.cpp 2008-01-17 12:04:09.000000000 -0500
239 @@ -0,0 +1,132 @@
241 + * The contents of this file are subject to the Mozilla Public
242 + * License Version 1.1 (the "License"); you may not use this file
243 + * except in compliance with the License. You may obtain a copy of
244 + * the License at http://www.mozilla.org/MPL/
245 + *
246 + * Software distributed under the License is distributed on an "AS
247 + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
248 + * implied. See the License for the specific language governing
249 + * rights and limitations under the License.
250 + *
251 + * The Original Code is MPEG4IP.
252 + *
253 + * The Initial Developer of the Original Code is Cisco Systems Inc.
254 + * Portions created by Cisco Systems Inc. are
255 + * Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved.
256 + *
257 + * Contributor(s):
258 + * Dave Mackie dmackie@cisco.com
259 + */
261 +#include "mp4common.h"
263 +MP4TextAtom::MP4TextAtom()
264 + : MP4Atom("text")
266 + // The atom type "text" is used in two complete unrelated ways
267 + // i.e. it's real two atoms with the same name
268 + // To handle that we need to postpone property creation until
269 + // we know who our parent atom is (stsd or gmhd) which gives us
270 + // the context info we need to know who we are
273 +void MP4TextAtom::AddPropertiesStsdType()
276 + AddReserved("reserved1", 6); /* 0 */
278 + AddProperty(new MP4Integer16Property("dataReferenceIndex"));/* 1 */
280 + AddProperty(new MP4Integer32Property("displayFlags")); /* 2 */
281 + AddProperty(new MP4Integer32Property("textJustification")); /* 3 */
283 + AddProperty(new MP4Integer16Property("bgColorRed")); /* 4 */
284 + AddProperty(new MP4Integer16Property("bgColorGreen")); /* 5 */
285 + AddProperty(new MP4Integer16Property("bgColorBlue")); /* 6 */
287 + AddProperty(new MP4Integer16Property("defTextBoxTop")); /* 7 */
288 + AddProperty(new MP4Integer16Property("defTextBoxLeft")); /* 8 */
289 + AddProperty(new MP4Integer16Property("defTextBoxBottom")); /* 9 */
290 + AddProperty(new MP4Integer16Property("defTextBoxRight")); /* 10 */
292 + AddReserved("reserved2", 8); /* 11 */
294 + AddProperty(new MP4Integer16Property("fontNumber")); /* 12 */
295 + AddProperty(new MP4Integer16Property("fontFace")); /* 13 */
297 + AddReserved("reserved3", 1); /* 14 */
298 + AddReserved("reserved4", 2); /* 15 */
300 + AddProperty(new MP4Integer16Property("foreColorRed")); /* 16 */
301 + AddProperty(new MP4Integer16Property("foreColorGreen")); /* 17 */
302 + AddProperty(new MP4Integer16Property("foreColorBlue")); /* 18 */
306 +void MP4TextAtom::AddPropertiesGmhdType()
309 + AddProperty(new MP4BytesProperty("textData", 36)); /* 0 */
314 +void MP4TextAtom::Generate()
317 + if (!strcmp(m_pParentAtom->GetType(), "stsd")) {
318 + AddPropertiesStsdType();
319 + GenerateStsdType();
320 + } else if (!strcmp(m_pParentAtom->GetType(), "gmhd")) {
321 + AddPropertiesGmhdType();
322 + GenerateGmhdType();
323 + } else {
324 + VERBOSE_WARNING(m_pFile->GetVerbosity(),
325 + printf("Warning: text atom in unexpected context, can not generate"));
330 +void MP4TextAtom::GenerateStsdType()
332 + // generate children
333 + MP4Atom::Generate();
335 + ((MP4Integer16Property*)m_pProperties[1])->SetValue(1);
337 + ((MP4Integer32Property*)m_pProperties[2])->SetValue(1);
338 + ((MP4Integer32Property*)m_pProperties[3])->SetValue(1);
342 +void MP4TextAtom::GenerateGmhdType()
344 + MP4Atom::Generate();
346 + // property 0 has non-zero fixed values
347 + static u_int8_t textData[36] = {
348 + 0x00, 0x01,
349 + 0x00, 0x00,
350 + 0x00, 0x00,
351 + 0x00, 0x00,
352 + 0x00, 0x00,
353 + 0x00, 0x00,
354 + 0x00, 0x00,
355 + 0x00, 0x00,
356 + 0x00, 0x01,
357 + 0x00, 0x00,
358 + 0x00, 0x00,
359 + 0x00, 0x00,
360 + 0x00, 0x00,
361 + 0x00, 0x00,
362 + 0x00, 0x00,
363 + 0x00, 0x00,
364 + 0x40, 0x00,
365 + 0x00, 0x00,
366 + };
367 + ((MP4BytesProperty*)m_pProperties[0])->SetValue(textData, sizeof(textData));
372 diff -Naur mpeg4ip/lib/mp4v2/atom_tkhd.cpp mpeg4ip-patched/lib/mp4v2/atom_tkhd.cpp
373 --- mpeg4ip/lib/mp4v2/atom_tkhd.cpp 2003-11-20 00:46:11.000000000 +0100
374 +++ mpeg4ip/lib/mp4v2/atom_tkhd.cpp 2008-01-19 12:41:13.000000000 +0100
375 @@ -53,23 +53,29 @@
376 new MP4Integer32Property("duration"));
379 - AddReserved("reserved2", 12); /* 7 */
381 + AddReserved("reserved2", 8); /* 7 */
383 + AddProperty( /* 8 */
384 + new MP4Integer16Property("layer"));
385 + AddProperty( /* 9 */
386 + new MP4Integer16Property("alternate_group"));
388 MP4Float32Property* pProp;
390 pProp = new MP4Float32Property("volume");
391 pProp->SetFixed16Format();
392 - AddProperty(pProp); /* 8 */
393 + AddProperty(pProp); /* 10 */
395 - AddReserved("reserved3", 38); /* 9 */
396 + /* patched by maurj to enable us to set the matrix for anamorphic display */
397 + AddProperty(new MP4BytesProperty("reserved3", 38)); /* 11 */
399 pProp = new MP4Float32Property("width");
400 pProp->SetFixed32Format();
401 - AddProperty(pProp); /* 10 */
402 + AddProperty(pProp); /* 12 */
404 pProp = new MP4Float32Property("height");
405 pProp->SetFixed32Format();
406 - AddProperty(pProp); /* 11 */
407 + AddProperty(pProp); /* 13 */
410 void MP4TkhdAtom::Generate()
411 @@ -103,10 +109,11 @@
412 0x00, 0x00, 0x00, 0x00,
413 0x40, 0x00, 0x00, 0x00,
415 - m_pProperties[9]->SetReadOnly(false);
416 - ((MP4BytesProperty*)m_pProperties[9])->
417 + m_pProperties[11]->SetReadOnly(false);
418 + ((MP4BytesProperty*)m_pProperties[11])->
419 SetValue(reserved3, sizeof(reserved3));
420 - m_pProperties[9]->SetReadOnly(true);
421 + /* patched by maurj to enable us to set the matrix for anamorphic display */
422 + /* m_pProperties[9]->SetReadOnly(true);*/
425 void MP4TkhdAtom::Read()
426 diff -Naur mpeg4ip/lib/mp4v2/atoms.h mpeg4ip-patched/lib/mp4v2/atoms.h
427 --- mpeg4ip/lib/mp4v2/atoms.h 2005-03-10 13:31:34.000000000 -0500
428 +++ mpeg4ip-patched/lib/mp4v2/atoms.h 2008-01-17 12:07:00.000000000 -0500
429 @@ -206,6 +206,12 @@
430 void Read();
433 +class MP4GminAtom : public MP4Atom {
434 +public:
435 + MP4GminAtom();
436 + void Generate();
439 class MP4HdlrAtom : public MP4Atom {
440 public:
441 MP4HdlrAtom();
442 @@ -327,6 +333,19 @@
443 void Write();
446 +class MP4TextAtom : public MP4Atom {
447 +public:
448 + MP4TextAtom();
449 + void Generate();
451 +protected:
452 + void AddPropertiesStsdType();
453 + void AddPropertiesGmhdType();
455 + void GenerateStsdType();
456 + void GenerateGmhdType();
459 class MP4TfhdAtom : public MP4Atom {
460 public:
461 MP4TfhdAtom();
462 @@ -374,4 +393,10 @@
463 void Generate(void);
466 +class MP4PaspAtom : public MP4Atom {
467 + public:
468 + MP4PaspAtom();
469 + void Generate();
472 #endif /* __MP4_ATOMS_INCLUDED__ */
473 diff -Naur mpeg4ip/lib/mp4v2/libmp4v260.dsp mpeg4ip-patched/lib/mp4v2/libmp4v260.dsp
474 --- mpeg4ip/lib/mp4v2/libmp4v260.dsp 2005-03-24 17:14:52.000000000 -0500
475 +++ mpeg4ip-patched/lib/mp4v2/libmp4v260.dsp 2008-01-17 12:07:00.000000000 -0500
476 @@ -134,6 +134,10 @@
477 # End Source File
478 # Begin Source File
480 +SOURCE=.\atom_gmin.cpp
481 +# End Source File
482 +# Begin Source File
484 SOURCE=.\atom_hdlr.cpp
485 # End Source File
486 # Begin Source File
487 @@ -178,6 +182,10 @@
488 # End Source File
489 # Begin Source File
491 +SOURCE=.\atom_pasp.cpp
492 +# End Source File
493 +# Begin Source File
495 SOURCE=.\atom_root.cpp
496 # End Source File
497 # Begin Source File
498 @@ -242,6 +250,10 @@
499 # End Source File
500 # Begin Source File
502 +SOURCE=.\atom_text.cpp
503 +# End Source File
504 +# Begin Source File
506 SOURCE=.\atom_udta.cpp
507 # End Source File
508 # Begin Source File
509 diff -Naur mpeg4ip/lib/mp4v2/libmp4v2_st60.dsp mpeg4ip-patched/lib/mp4v2/libmp4v2_st60.dsp
510 --- mpeg4ip/lib/mp4v2/libmp4v2_st60.dsp 2005-03-24 17:14:52.000000000 -0500
511 +++ mpeg4ip-patched/lib/mp4v2/libmp4v2_st60.dsp 2008-01-17 12:04:09.000000000 -0500
512 @@ -133,6 +133,10 @@
513 # End Source File
514 # Begin Source File
516 +SOURCE=.\atom_gmin.cpp
517 +# End Source File
518 +# Begin Source File
520 SOURCE=.\atom_hdlr.cpp
521 # End Source File
522 # Begin Source File
523 @@ -241,6 +245,10 @@
524 # End Source File
525 # Begin Source File
527 +SOURCE=.\atom_text.cpp
528 +# End Source File
529 +# Begin Source File
531 SOURCE=.\atom_udta.cpp
532 # End Source File
533 # Begin Source File
534 diff -Naur mpeg4ip/lib/mp4v2/mp4.cpp mpeg4ip-patched/lib/mp4v2/mp4.cpp
535 --- mpeg4ip/lib/mp4v2/mp4.cpp 2005-03-30 13:41:58.000000000 -0500
536 +++ mpeg4ip-patched/lib/mp4v2/mp4.cpp 2008-01-17 12:07:00.000000000 -0500
537 @@ -939,6 +939,52 @@
538 return MP4_INVALID_TRACK_ID;
541 +extern "C" MP4TrackId MP4AddTextTrack(
542 + MP4FileHandle hFile, MP4TrackId refTrackId)
544 + if (MP4_IS_VALID_FILE_HANDLE(hFile)) {
545 + try {
546 + return ((MP4File*)hFile)->AddTextTrack(refTrackId);
548 + catch (MP4Error* e) {
549 + PRINT_ERROR(e);
550 + delete e;
553 + return MP4_INVALID_TRACK_ID;
556 +extern "C" MP4TrackId MP4AddChapterTextTrack(
557 + MP4FileHandle hFile, MP4TrackId refTrackId)
559 + if (MP4_IS_VALID_FILE_HANDLE(hFile)) {
560 + try {
561 + return ((MP4File*)hFile)->AddChapterTextTrack(refTrackId);
563 + catch (MP4Error* e) {
564 + PRINT_ERROR(e);
565 + delete e;
568 + return MP4_INVALID_TRACK_ID;
571 +extern "C" MP4TrackId MP4AddPixelAspectRatio(
572 + MP4FileHandle hFile, MP4TrackId refTrackId, u_int32_t hSpacing, u_int32_t vSpacing)
574 + if (MP4_IS_VALID_FILE_HANDLE(hFile)) {
575 + try {
576 + return ((MP4File*)hFile)->AddPixelAspectRatio(refTrackId, hSpacing, vSpacing);
578 + catch (MP4Error* e) {
579 + PRINT_ERROR(e);
580 + delete e;
583 + return MP4_INVALID_TRACK_ID;
587 extern "C" MP4TrackId MP4CloneTrack(
588 MP4FileHandle srcFile,
589 MP4TrackId srcTrackId,
590 diff -Naur mpeg4ip/lib/mp4v2/mp4.h mpeg4ip-patched/lib/mp4v2/mp4.h
591 --- mpeg4ip/lib/mp4v2/mp4.h 2005-03-30 13:41:58.000000000 -0500
592 +++ mpeg4ip-patched/lib/mp4v2/mp4.h 2008-01-17 12:07:00.000000000 -0500
593 @@ -100,6 +100,7 @@
594 #define MP4_VIDEO_TRACK_TYPE "vide"
595 #define MP4_HINT_TRACK_TYPE "hint"
596 #define MP4_CNTL_TRACK_TYPE "cntl"
597 +#define MP4_TEXT_TRACK_TYPE "text"
599 * This second set of track types should be created
600 * via MP4AddSystemsTrack(type)
601 @@ -538,6 +539,20 @@
602 MP4FileHandle hFile,
603 MP4TrackId refTrackId);
605 +MP4TrackId MP4AddTextTrack(
606 + MP4FileHandle hFile,
607 + MP4TrackId refTrackId);
609 +MP4TrackId MP4AddChapterTextTrack(
610 + MP4FileHandle hFile,
611 + MP4TrackId refTrackId);
613 +MP4TrackId MP4AddPixelAspectRatio(
614 + MP4FileHandle hFile,
615 + MP4TrackId refTrackId,
616 + u_int32_t hSpacing,
617 + u_int32_t vSpacing);
619 MP4TrackId MP4CloneTrack(
620 MP4FileHandle srcFile,
621 MP4TrackId srcTrackId,
622 diff -Naur mpeg4ip/lib/mp4v2/mp4atom.cpp mpeg4ip-patched/lib/mp4v2/mp4atom.cpp
623 --- mpeg4ip/lib/mp4v2/mp4atom.cpp 2005-03-10 13:31:34.000000000 -0500
624 +++ mpeg4ip-patched/lib/mp4v2/mp4atom.cpp 2008-01-17 12:11:40.000000000 -0500
625 @@ -84,6 +84,13 @@
626 pAtom = new MP4SoundAtom("alaw");
628 break;
630 + case 'c':
631 + if (ATOMID(type) == ATOMID("chap")) {
632 + pAtom = new MP4TrefTypeAtom(type);
634 + break;
636 case 'd':
637 if (ATOMID(type) == ATOMID("d263")) {
638 pAtom = new MP4D263Atom();
639 @@ -113,6 +120,11 @@
640 pAtom = new MP4FtypAtom();
642 break;
643 + case 'g':
644 + if (ATOMID(type) == ATOMID("gmin")) {
645 + pAtom = new MP4GminAtom();
647 + break;
648 case 'h':
649 if (ATOMID(type) == ATOMID("hdlr")) {
650 pAtom = new MP4HdlrAtom();
651 @@ -200,7 +212,9 @@
653 break;
654 case 't':
655 - if (ATOMID(type) == ATOMID("tkhd")) {
656 + if (ATOMID(type) == ATOMID("text")) {
657 + pAtom = new MP4TextAtom();
658 + } else if (ATOMID(type) == ATOMID("tkhd")) {
659 pAtom = new MP4TkhdAtom();
660 } else if (ATOMID(type) == ATOMID("tfhd")) {
661 pAtom = new MP4TfhdAtom();
662 @@ -238,6 +252,12 @@
663 pAtom = new MP4SmiAtom();
665 break;
666 + case 'p':
667 + if (ATOMID(type) == ATOMID("pasp")) {
668 + pAtom = new MP4PaspAtom();
670 + break;
675 diff -Naur mpeg4ip/lib/mp4v2/mp4file.cpp mpeg4ip-patched/lib/mp4v2/mp4file.cpp
676 --- mpeg4ip/lib/mp4v2/mp4file.cpp 2005-03-30 13:41:58.000000000 -0500
677 +++ mpeg4ip-patched/lib/mp4v2/mp4file.cpp 2008-01-17 12:07:00.000000000 -0500
678 @@ -1869,6 +1869,81 @@
679 return trackId;
682 +MP4TrackId MP4File::AddTextTrack(MP4TrackId refTrackId)
684 + // validate reference track id
685 + FindTrackIndex(refTrackId);
687 + MP4TrackId trackId =
688 + AddTrack(MP4_TEXT_TRACK_TYPE, GetTrackTimeScale(refTrackId));
690 + InsertChildAtom(MakeTrackName(trackId, "mdia.minf"), "gmhd", 0);
692 + AddChildAtom(MakeTrackName(trackId, "mdia.minf.stbl.stsd"), "text");
694 + // stsd is a unique beast in that it has a count of the number
695 + // of child atoms that needs to be incremented after we add the text atom
696 + MP4Integer32Property* pStsdCountProperty;
697 + FindIntegerProperty(
698 + MakeTrackName(trackId, "mdia.minf.stbl.stsd.entryCount"),
699 + (MP4Property**)&pStsdCountProperty);
700 + pStsdCountProperty->IncrementValue();
702 + return trackId;
705 +MP4TrackId MP4File::AddChapterTextTrack(MP4TrackId refTrackId)
707 + // validate reference track id
708 + FindTrackIndex(refTrackId);
710 + MP4TrackId trackId =
711 + AddTrack(MP4_TEXT_TRACK_TYPE, GetTrackTimeScale(refTrackId));
713 + InsertChildAtom(MakeTrackName(trackId, "mdia.minf"), "gmhd", 0);
715 + AddChildAtom(MakeTrackName(trackId, "mdia.minf.stbl.stsd"), "text");
717 + // stsd is a unique beast in that it has a count of the number
718 + // of child atoms that needs to be incremented after we add the text atom
719 + MP4Integer32Property* pStsdCountProperty;
720 + FindIntegerProperty(
721 + MakeTrackName(trackId, "mdia.minf.stbl.stsd.entryCount"),
722 + (MP4Property**)&pStsdCountProperty);
723 + pStsdCountProperty->IncrementValue();
725 + /* add the magic "text" atom to the generic media header */
726 + AddChildAtom(MakeTrackName(trackId, "mdia.minf.gmhd"), "text");
728 + AddDescendantAtoms(MakeTrackName(refTrackId, NULL), "tref.chap");
730 + AddTrackReference(MakeTrackName(refTrackId, "tref.chap"), trackId);
732 + return trackId;
735 +MP4TrackId MP4File::AddPixelAspectRatio(MP4TrackId trackId, u_int32_t hSpacing, u_int32_t vSpacing)
737 + // validate reference track id
738 + (void)FindTrackIndex(trackId);
739 + const char *format = GetTrackMediaDataName (trackId);
741 + if (!strcasecmp(format, "avc1"))
743 + (void)AddChildAtom(MakeTrackName(trackId, "mdia.minf.stbl.stsd.avc1"), "pasp");
744 + SetTrackIntegerProperty(trackId, "mdia.minf.stbl.stsd.avc1.pasp.hSpacing", hSpacing);
745 + SetTrackIntegerProperty(trackId, "mdia.minf.stbl.stsd.avc1.pasp.vSpacing", vSpacing);
747 + else if (!strcasecmp(format, "mp4v"))
749 + (void)AddChildAtom(MakeTrackName(trackId, "mdia.minf.stbl.stsd.mp4v"), "pasp");
750 + SetTrackIntegerProperty(trackId, "mdia.minf.stbl.stsd.mp4v.pasp.hSpacing", hSpacing);
751 + SetTrackIntegerProperty(trackId, "mdia.minf.stbl.stsd.mp4v.pasp.vSpacing", vSpacing);
754 + return trackId;
757 void MP4File::DeleteTrack(MP4TrackId trackId)
759 ProtectWriteOperation("MP4DeleteTrack");
760 diff -Naur mpeg4ip/lib/mp4v2/mp4file.h mpeg4ip-patched/lib/mp4v2/mp4file.h
761 --- mpeg4ip/lib/mp4v2/mp4file.h 2005-03-30 13:41:58.000000000 -0500
762 +++ mpeg4ip-patched/lib/mp4v2/mp4file.h 2008-01-17 12:07:00.000000000 -0500
763 @@ -296,6 +296,10 @@
764 const uint8_t *pPicture,
765 uint16_t pictureLen);
766 MP4TrackId AddHintTrack(MP4TrackId refTrackId);
767 + MP4TrackId AddTextTrack(MP4TrackId refTrackId);
768 + MP4TrackId AddChapterTextTrack(MP4TrackId refTrackId);
770 + MP4TrackId AddPixelAspectRatio(MP4TrackId trackId, u_int32_t hSpacing, u_int32_t vSpacing);
772 MP4SampleId GetTrackNumberOfSamples(MP4TrackId trackId);
774 diff -Naur mpeg4ip/lib/mp4v2/atom_pasp.cpp mpeg4ip-patched/lib/mp4v2/atom_pasp.cpp
775 --- mpeg4ip/lib/mp4v2/atom_pasp.cpp 1969-12-31 19:00:00.000000000 -0500
776 +++ mpeg4ip-patched/lib/mp4v2/atom_pasp.cpp 2008-01-17 12:07:00.000000000 -0500
777 @@ -0,0 +1,42 @@
779 + * The contents of this file are subject to the Mozilla Public
780 + * License Version 1.1 (the "License"); you may not use this file
781 + * except in compliance with the License. You may obtain a copy of
782 + * the License at http://www.mozilla.org/MPL/
783 + *
784 + * Software distributed under the License is distributed on an "AS
785 + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
786 + * implied. See the License for the specific language governing
787 + * rights and limitations under the License.
788 + *
789 + * The Original Code is MPEG4IP.
790 + *
791 + * Contributer has declined to give copyright information, and gives
792 + * it freely to the world.
793 + *
794 + * Contributor(s):
795 + */
797 +#include "mp4common.h"
799 +MP4PaspAtom::MP4PaspAtom()
800 + : MP4Atom("pasp")
803 + AddProperty( /* 0 */
804 + new MP4Integer32Property("hSpacing"));
806 + AddProperty( /* 1 */
807 + new MP4Integer32Property("vSpacing"));
811 +void MP4PaspAtom::Generate()
814 + MP4Atom::Generate();
816 + ((MP4Integer32Property*)m_pProperties[0])->SetValue(1);
817 + ((MP4Integer32Property*)m_pProperties[1])->SetValue(1);
820 diff -Naur mpeg4ip-patched/lib/mp4v2/Makefile.in mpeg4ip/lib/mp4v2/Makefile.in
821 --- mpeg4ip-patched/lib/mp4v2/Makefile.in 2008-01-17 12:04:09.000000000 -0500
822 +++ mpeg4ip/lib/mp4v2/Makefile.in 2008-01-17 13:20:50.000000000 -0500
823 @@ -58,7 +58,7 @@
824 atom_gmin.lo atom_text.lo \
825 atom_hdlr.lo atom_hinf.lo atom_hnti.lo atom_href.lo \
826 atom_mdat.lo atom_mdhd.lo atom_meta.lo atom_mp4a.lo \
827 - atom_mp4s.lo atom_mp4v.lo atom_mvhd.lo atom_root.lo \
828 + atom_mp4s.lo atom_mp4v.lo atom_mvhd.lo atom_pasp.lo atom_root.lo \
829 atom_rtp.lo atom_s263.lo atom_sdp.lo atom_smi.lo atom_sound.lo \
830 atom_standard.lo atom_stbl.lo atom_stdp.lo atom_stsc.lo \
831 atom_stsd.lo atom_stsz.lo atom_tfhd.lo atom_tkhd.lo \
832 @@ -96,6 +96,7 @@
833 @AMDEP_TRUE@ ./$(DEPDIR)/atom_mp4v.Plo \
834 @AMDEP_TRUE@ ./$(DEPDIR)/atom_mvhd.Plo \
835 @AMDEP_TRUE@ ./$(DEPDIR)/atom_root.Plo ./$(DEPDIR)/atom_rtp.Plo \
836 +@AMDEP_TRUE@ ./$(DEPDIR)/atom_pasp.Plo \
837 @AMDEP_TRUE@ ./$(DEPDIR)/atom_s263.Plo ./$(DEPDIR)/atom_sdp.Plo \
838 @AMDEP_TRUE@ ./$(DEPDIR)/atom_smi.Plo \
839 @AMDEP_TRUE@ ./$(DEPDIR)/atom_sound.Plo \
840 @@ -364,6 +365,7 @@
841 atom_mp4s.cpp \
842 atom_mp4v.cpp \
843 atom_mvhd.cpp \
844 + atom_pasp.cpp \
845 atom_root.cpp \
846 atom_rtp.cpp \
847 atom_s263.cpp \
848 @@ -518,6 +520,7 @@
849 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_mp4s.Plo@am__quote@
850 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_mp4v.Plo@am__quote@
851 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_mvhd.Plo@am__quote@
852 +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_pasp.Plo@am__quote@
853 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_root.Plo@am__quote@
854 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_rtp.Plo@am__quote@
855 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_s263.Plo@am__quote@