diff -Naur mpeg4ip/lib/mp4v2/atom_tkhd.cpp mpeg4ip_patched/lib/mp4v2/atom_tkhd.cpp
---- mpeg4ip/lib/mp4v2/atom_tkhd.cpp 2003-11-20 00:46:11.000000000 +0100
-+++ mpeg4ip_patched/lib/mp4v2/atom_tkhd.cpp 2007-02-15 15:23:51.000000000 +0100
+--- mpeg4ip/lib/mp4v2/atom_tkhd.cpp 2003-11-19 23:46:11.000000000 +0000
++++ mpeg4ip_patched/lib/mp4v2/atom_tkhd.cpp 2007-02-15 15:58:06.000000000 +0000
@@ -61,7 +61,8 @@
pProp->SetFixed16Format();
AddProperty(pProp); /* 8 */
- AddReserved("reserved3", 38); /* 9 */
-+ // maurj patch to allow PAR to work in QT
-+ // AddReserved("reserved3", 38); /* 9 */
++ /* patched by maurj to enable us to set the matrix for anamorphic display */
++ AddProperty(new MP4BytesProperty("reserved3", 38)); /* 9 */
pProp = new MP4Float32Property("width");
pProp->SetFixed32Format();
+@@ -106,7 +107,8 @@
+ m_pProperties[9]->SetReadOnly(false);
+ ((MP4BytesProperty*)m_pProperties[9])->
+ SetValue(reserved3, sizeof(reserved3));
+- m_pProperties[9]->SetReadOnly(true);
++ /* patched by maurj to enable us to set the matrix for anamorphic display */
++ /* m_pProperties[9]->SetReadOnly(true);*/
+ }
+
+ void MP4TkhdAtom::Read()
and have turned on the "preserve 5.1" flag */
pv->flags_out = A52_3F2R | A52_LFE;
} else if (job->channelsused == 1) {
- /* we're going to be encoding to AAC,
+ /* we're going to be encoding to AAC, */
/* and want to keep the mono-ness of the source audio */
pv->flags_out = A52_MONO;
} else if (job->channelsused == 2 && job->channels == 5 && job->lfechannels == 1) {
MP4AddH264PictureParameterSet( m->file, mux_data->track,
job->config.h264.pps, job->config.h264.pps_length );
- if( job->h264_level == 30)
- {
- hb_log("About to add iPod atom");
- AddIPodUUID(m->file, mux_data->track);
- }
+ if( job->h264_level == 30)
+ {
+ hb_log("About to add iPod atom");
+ AddIPodUUID(m->file, mux_data->track);
+ }
+
}
else /* FFmpeg or XviD */
{
job->config.mpeg4.bytes, job->config.mpeg4.length );
}
+ /* apply the anamorphic transformation matrix if needed */
+
+ if( job->pixel_ratio ) {
+
+ uint8_t* val;
+ uint8_t nval[38];
+ uint32_t *ptr32 = (uint32_t*) (nval + 2);
+ uint32_t size;
+
+ MP4GetBytesProperty(m->file, "moov.trak.tkhd.reserved3", &val, &size);
+
+ if (size == 38) {
+
+ memcpy(nval, val, size);
+
+ float width, height;
+ float widthRatio;
+ width = job->pixel_aspect_width;
+ height = job->pixel_aspect_height;
+ widthRatio = (width / height) * 0x10000;
+
+ uint32_t widthRatioInt;
+ widthRatioInt = (uint32_t)widthRatio;
+
+#ifdef WORDS_BIGENDIAN
+ ptr32[0] = widthRatioInt;
+#else
+ /* we need to switch the endianness, as the file format expects big endian */
+ ptr32[0] = ((widthRatioInt & 0x000000FF) << 24) + ((widthRatioInt & 0x0000FF00) << 8) + ((widthRatioInt & 0x00FF0000) >> 8) + ((widthRatioInt & 0xFF000000) >> 24);
+#endif
+
+ if(!MP4SetBytesProperty(m->file, "moov.trak.tkhd.reserved3", nval, size)) {
+ hb_log("Problem setting transform matrix");
+ }
+
+ }
+
+ }
+
+ /* end of transformation matrix */
+
+
for( i = 0; i < hb_list_count( title->list_audio ); i++ )
{
audio = hb_list_item( title->list_audio, i );