diff options
author | jbrjake <[email protected]> | 2007-10-16 18:29:11 +0000 |
---|---|---|
committer | jbrjake <[email protected]> | 2007-10-16 18:29:11 +0000 |
commit | 8047f1a203cc9a6f915becef26e52518b64b09fb (patch) | |
tree | 5f1ae1b1fcc9bc4356653cde79321d43bd6d7537 /libhb/muxmp4.c | |
parent | 6a429d65ab6a3fd1fddb87b206d410e2004b5411 (diff) |
This patch from superdump lets muxmp4.c set a Height Ratio for the QuickTime transformation matrix. This makes it possible to scale up 4:3 material to 720*540 on playback, instead of displaying it scaled down to 640*480. In other words: true anamorphic 4:3.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1027 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'libhb/muxmp4.c')
-rw-r--r-- | libhb/muxmp4.c | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/libhb/muxmp4.c b/libhb/muxmp4.c index 4f7c4ebc2..2f375e832 100644 --- a/libhb/muxmp4.c +++ b/libhb/muxmp4.c @@ -252,21 +252,34 @@ static int MP4Init( hb_mux_object_t * m ) 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; + uint32_t pixelRatioInt; + if (width >= height) + { + pixelRatioInt = (uint32_t)((width / height) * 0x10000); #ifdef WORDS_BIGENDIAN - ptr32[0] = widthRatioInt; + ptr32[0] = pixelRatioInt; #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); + /* we need to switch the endianness, as the file format expects big endian */ + ptr32[0] = ((pixelRatioInt & 0x000000FF) << 24) + ((pixelRatioInt & 0x0000FF00) << 8) + ((pixelRatioInt & 0x00FF0000) >> 8) + ((pixelRatioInt & 0xFF000000) >> 24); #endif + } + else + { + pixelRatioInt = (uint32_t)((height / width) * 0x10000); +#ifdef WORDS_BIGENDIAN + ptr32[4] = pixelRatioInt; +#else + /* we need to switch the endianness, as the file format expects big endian */ + ptr32[4] = ((pixelRatioInt & 0x000000FF) << 24) + ((pixelRatioInt & 0x0000FF00) << 8) + ((pixelRatioInt & 0x00FF0000) >> 8) + ((pixelRatioInt & 0xFF000000) >> 24); +#endif + } + + if(!MP4SetBytesProperty(m->file, "moov.trak.tkhd.reserved3", nval, size)) { hb_log("Problem setting transform matrix"); } |