lol
1diff -Naur mp4v2-trunk-r355/include/mp4v2/general.h mp4v2-trunk-r355/include/mp4v2/general.h
2--- mp4v2-trunk-r355/include/mp4v2/general.h 2009-05-23 06:09:58.000000000 -0700
3+++ mp4v2-trunk-r355/include/mp4v2/general.h 2010-05-23 14:22:21.949288657 -0700
4@@ -75,6 +75,7 @@
5 #define MP4_CNTL_TRACK_TYPE "cntl" /**< Constant: control track. */
6 #define MP4_TEXT_TRACK_TYPE "text" /**< Constant: text track. */
7 #define MP4_SUBTITLE_TRACK_TYPE "sbtl" /**< Constant: subtitle track. */
8+#define MP4_SUBPIC_TRACK_TYPE "subp" /**< Constant: subtitle track. */
9 /*
10 * This second set of track types should be created
11 * via MP4AddSystemsTrack(type)
12diff -Naur mp4v2-trunk-r355/include/mp4v2/track.h mp4v2-trunk-r355/include/mp4v2/track.h
13--- mp4v2-trunk-r355/include/mp4v2/track.h 2009-05-23 06:21:49.000000000 -0700
14+++ mp4v2-trunk-r355/include/mp4v2/track.h 2010-05-23 15:43:47.249286008 -0700
15@@ -310,6 +310,13 @@
16 uint16_t height );
17
18 MP4V2_EXPORT
19+MP4TrackId MP4AddSubpicTrack(
20+ MP4FileHandle hFile,
21+ uint32_t timescale,
22+ uint16_t width,
23+ uint16_t height );
24+
25+MP4V2_EXPORT
26 MP4TrackId MP4AddPixelAspectRatio(
27 MP4FileHandle hFile,
28 MP4TrackId refTrackId,
29diff -Naur mp4v2-trunk-r355/src/descriptors.h mp4v2-trunk-r355/src/descriptors.h
30--- mp4v2-trunk-r355/src/descriptors.h 2009-05-20 19:52:32.000000000 -0700
31+++ mp4v2-trunk-r355/src/descriptors.h 2010-05-23 16:29:34.800935677 -0700
32@@ -119,6 +119,7 @@
33 // ES objectTypeId
34 const uint8_t MP4SystemsV1ObjectType = 0x01;
35 const uint8_t MP4SystemsV2ObjectType = 0x02;
36+const uint8_t MP4SubpicObjectType = 0xe0;
37
38 // ES streamType
39 const uint8_t MP4ObjectDescriptionStreamType = 0x01;
40@@ -131,6 +132,7 @@
41 const uint8_t MP4OCIStreamType = 0x08;
42 const uint8_t MP4MPEGJStreamType = 0x09;
43 const uint8_t MP4UserPrivateStreamType = 0x20;
44+const uint8_t MP4NeroSubpicStreamType = 0x38;
45
46 ///////////////////////////////////////////////////////////////////////////////
47
48diff -Naur mp4v2-trunk-r355/src/mp4.cpp mp4v2-trunk-r355/src/mp4.cpp
49--- mp4v2-trunk-r355/src/mp4.cpp 2009-05-23 06:29:37.000000000 -0700
50+++ mp4v2-trunk-r355/src/mp4.cpp 2010-05-23 15:45:28.852222074 -0700
51@@ -1174,6 +1174,23 @@
52 return MP4_INVALID_TRACK_ID;
53 }
54
55+ MP4TrackId MP4AddSubpicTrack(MP4FileHandle hFile,
56+ uint32_t timescale,
57+ uint16_t width,
58+ uint16_t height)
59+ {
60+ if (MP4_IS_VALID_FILE_HANDLE(hFile)) {
61+ try {
62+ return ((MP4File*)hFile)->AddSubpicTrack(timescale, width, height);
63+ }
64+ catch (MP4Error* e) {
65+ PRINT_ERROR(e);
66+ delete e;
67+ }
68+ }
69+ return MP4_INVALID_TRACK_ID;
70+ }
71+
72 MP4TrackId MP4AddChapterTextTrack(
73 MP4FileHandle hFile, MP4TrackId refTrackId, uint32_t timescale)
74 {
75diff -Naur mp4v2-trunk-r355/src/mp4file.cpp mp4v2-trunk-r355/src/mp4file.cpp
76--- mp4v2-trunk-r355/src/mp4file.cpp 2009-05-26 19:34:56.000000000 -0700
77+++ mp4v2-trunk-r355/src/mp4file.cpp 2010-05-23 16:32:52.654220633 -0700
78@@ -2095,6 +2095,50 @@
79 return trackId;
80 }
81
82+MP4TrackId MP4File::AddSubpicTrack(uint32_t timescale,
83+ uint16_t width,
84+ uint16_t height)
85+{
86+ MP4TrackId trackId =
87+ AddTrack(MP4_SUBPIC_TRACK_TYPE, timescale);
88+
89+ InsertChildAtom(MakeTrackName(trackId, "mdia.minf"), "nmhd", 0);
90+
91+ (void)AddChildAtom(MakeTrackName(trackId, "mdia.minf.stbl.stsd"), "mp4s");
92+
93+ SetTrackFloatProperty(trackId, "tkhd.width", width);
94+ SetTrackFloatProperty(trackId, "tkhd.height", height);
95+ SetTrackIntegerProperty(trackId, "tkhd.layer", 0);
96+
97+ // stsd is a unique beast in that it has a count of the number
98+ // of child atoms that needs to be incremented after we add the mp4s atom
99+ MP4Integer32Property* pStsdCountProperty;
100+ FindIntegerProperty(
101+ MakeTrackName(trackId, "mdia.minf.stbl.stsd.entryCount"),
102+ (MP4Property**)&pStsdCountProperty);
103+ pStsdCountProperty->IncrementValue();
104+
105+ SetTrackIntegerProperty(trackId,
106+ "mdia.minf.stbl.stsd.mp4s.esds.ESID",
107+#if 0
108+ // note - for a file, these values need to
109+ // be 0 - wmay - 04/16/2003
110+ trackId
111+#else
112+ 0
113+#endif
114+ );
115+
116+ SetTrackIntegerProperty(trackId,
117+ "mdia.minf.stbl.stsd.mp4s.esds.decConfigDescr.objectTypeId",
118+ MP4SubpicObjectType);
119+
120+ SetTrackIntegerProperty(trackId,
121+ "mdia.minf.stbl.stsd.mp4s.esds.decConfigDescr.streamType",
122+ MP4NeroSubpicStreamType);
123+ return trackId;
124+}
125+
126 MP4TrackId MP4File::AddChapterTextTrack(MP4TrackId refTrackId, uint32_t timescale)
127 {
128 // validate reference track id
129diff -Naur mp4v2-trunk-r355/src/mp4file.h mp4v2-trunk-r355/src/mp4file.h
130--- mp4v2-trunk-r355/src/mp4file.h 2009-05-23 06:29:37.000000000 -0700
131+++ mp4v2-trunk-r355/src/mp4file.h 2010-05-23 15:44:57.568026299 -0700
132@@ -388,6 +388,10 @@
133 uint16_t width,
134 uint16_t height);
135
136+ MP4TrackId AddSubpicTrack(uint32_t timescale,
137+ uint16_t width,
138+ uint16_t height);
139+
140 MP4TrackId AddPixelAspectRatio(MP4TrackId trackId, uint32_t hSpacing, uint32_t vSpacing);
141 MP4TrackId AddColr(MP4TrackId trackId, uint16_t pri, uint16_t tran, uint16_t mat);
142