All pastes #1047072 Raw Edit

someone

public text v1 · immutable
#1047072 ·published 2008-06-13 20:01 UTC
rendered paste body
Index: libhb/muxmp4.c===================================================================--- libhb/muxmp4.c	(revision 1510)+++ libhb/muxmp4.c	(working copy)@@ -247,6 +247,8 @@         }     } +    MP4AddColr(m->file, mux_data->track, 6, 1, 6);+     if( job->pixel_ratio )     {         /* PASP atom for anamorphic video */Index: contrib/Jamfile===================================================================--- contrib/Jamfile	(revision 1510)+++ contrib/Jamfile	(working copy)@@ -247,6 +247,7 @@     LIBMP4V2_PATCH += "$(PATCH) -p1 < ../patch-mpeg4ip.patch && " ;     LIBMP4V2_PATCH += "$(PATCH) -p1 < ../patch-mpeg4ip-nasm-2.00-configure.patch && " ;     LIBMP4V2_PATCH += "$(PATCH) -p1 < ../patch-mpeg4ip-ac3.patch && " ;+    LIBMP4V2_PATCH += "$(PATCH) -p1 < ../patch-mpeg4ip-colr.patch && " ;     Depends $(<) : $(>) ;     Depends lib  : $(<) ; }--- /dev/null	2008-06-13 12:57:41.000000000 -0700+++ contrib/patch-mpeg4ip-colr.patch	2008-06-13 11:50:54.000000000 -0700@@ -0,0 +1,208 @@+diff -Nur -x Makefile -x config.log -x config.status -x libtool mpeg4ip-orig/lib/mp4v2/Makefile.am mpeg4ip/lib/mp4v2/Makefile.am+--- mpeg4ip-orig/lib/mp4v2/Makefile.am	2008-06-13 11:22:55.000000000 -0700++++ mpeg4ip/lib/mp4v2/Makefile.am	2008-06-13 11:39:48.000000000 -0700+@@ -14,6 +14,7 @@+ 	atom_amr.cpp \+ 	atom_avc1.cpp \+ 	atom_avcC.cpp \++	atom_colr.cpp \+ 	atom_d263.cpp \+ 	atom_damr.cpp \+ 	atom_dref.cpp \+diff -Nur -x Makefile -x config.log -x config.status -x libtool mpeg4ip-orig/lib/mp4v2/Makefile.in mpeg4ip/lib/mp4v2/Makefile.in+--- mpeg4ip-orig/lib/mp4v2/Makefile.in	2008-06-13 11:22:55.000000000 -0700++++ mpeg4ip/lib/mp4v2/Makefile.in	2008-06-13 11:39:48.000000000 -0700+@@ -53,7 +53,7 @@+ LTLIBRARIES = $(lib_LTLIBRARIES)+ libmp4v2_la_LIBADD =+ am_libmp4v2_la_OBJECTS = 3gp.lo atom_amr.lo atom_avc1.lo atom_avcC.lo \+-	atom_d263.lo atom_damr.lo atom_dref.lo atom_elst.lo \++	atom_colr.lo atom_d263.lo atom_damr.lo atom_dref.lo atom_elst.lo \+ 	atom_enca.lo atom_encv.lo atom_free.lo atom_ftyp.lo \+ 	atom_gmin.lo atom_text.lo atom_ac3.lo \+ 	atom_hdlr.lo atom_hinf.lo atom_hnti.lo atom_href.lo \+@@ -76,6 +76,7 @@+ @AMDEP_TRUE@	./$(DEPDIR)/atom_ac3.Plo \+ @AMDEP_TRUE@	./$(DEPDIR)/atom_avc1.Plo \+ @AMDEP_TRUE@	./$(DEPDIR)/atom_avcC.Plo \++@AMDEP_TRUE@	./$(DEPDIR)/atom_colr.Plo \+ @AMDEP_TRUE@	./$(DEPDIR)/atom_d263.Plo \+ @AMDEP_TRUE@	./$(DEPDIR)/atom_damr.Plo \+ @AMDEP_TRUE@	./$(DEPDIR)/atom_dref.Plo \+@@ -347,6 +348,7 @@+ 	atom_amr.cpp \+ 	atom_avc1.cpp \+ 	atom_avcC.cpp \++	atom_colr.cpp \+ 	atom_d263.cpp \+ 	atom_damr.cpp \+ 	atom_dref.cpp \+@@ -503,6 +505,7 @@+ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_amr.Plo@am__quote@+ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_avc1.Plo@am__quote@+ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_avcC.Plo@am__quote@++@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_colr.Plo@am__quote@+ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_d263.Plo@am__quote@+ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_damr.Plo@am__quote@+ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atom_dref.Plo@am__quote@+diff -Nur -x Makefile -x config.log -x config.status -x libtool mpeg4ip-orig/lib/mp4v2/atom_colr.cpp mpeg4ip/lib/mp4v2/atom_colr.cpp+--- mpeg4ip-orig/lib/mp4v2/atom_colr.cpp	1969-12-31 16:00:00.000000000 -0800++++ mpeg4ip/lib/mp4v2/atom_colr.cpp	2008-06-13 11:39:48.000000000 -0700+@@ -0,0 +1,47 @@++/*++ * The contents of this file are subject to the Mozilla Public++ * License Version 1.1 (the "License"); you may not use this file++ * except in compliance with the License. You may obtain a copy of++ * the License at http://www.mozilla.org/MPL/++ * ++ * Software distributed under the License is distributed on an "AS++ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or++ * implied. See the License for the specific language governing++ * rights and limitations under the License.++ * ++ * The Original Code is MPEG4IP.++ * ++ * Contributer has declined to give copyright information, and gives++ * it freely to the world.++ * ++ * Contributor(s): ++ */++++#include "mp4common.h"++++MP4ColrAtom::MP4ColrAtom() ++	: MP4Atom("colr") ++{++    MP4StringProperty* cpt = new MP4StringProperty("colorParameterType");++    cpt->SetFixedLength(4);++    AddProperty(cpt); /* 0 */++++	AddProperty( /* 1 */ new MP4Integer16Property("primariesIndex"));++++	AddProperty( /* 2 */ new MP4Integer16Property("transferFunctionIndex")); ++++	AddProperty( /* 3 */ new MP4Integer16Property("matrixIndex")); ++++	//AddProperty( /* 4 */ new MP4Integer32Property("reserved")); ++}++++void MP4ColrAtom::Generate()++{++	MP4Atom::Generate();++++	((MP4StringProperty*)m_pProperties[0])->SetValue("nclc");++	((MP4Integer16Property*)m_pProperties[1])->SetValue(6);++	((MP4Integer16Property*)m_pProperties[2])->SetValue(1);++	((MP4Integer16Property*)m_pProperties[3])->SetValue(6);++	//((MP4Integer32Property*)m_pProperties[4])->SetValue(0);++}+diff -Nur -x Makefile -x config.log -x config.status -x libtool mpeg4ip-orig/lib/mp4v2/atom_stsd.cpp mpeg4ip/lib/mp4v2/atom_stsd.cpp+--- mpeg4ip-orig/lib/mp4v2/atom_stsd.cpp	2008-06-13 11:22:55.000000000 -0700++++ mpeg4ip/lib/mp4v2/atom_stsd.cpp	2008-06-13 11:39:48.000000000 -0700+@@ -52,6 +52,7 @@+ 	ExpectChildAtom("text", Optional, Many);+ 	ExpectChildAtom("pasp", Optional, Many);+ 	ExpectChildAtom("ac-3", Optional, Many);++	ExpectChildAtom("colr", Optional, Many);+ }+ + void MP4StsdAtom::Read() +diff -Nur -x Makefile -x config.log -x config.status -x libtool mpeg4ip-orig/lib/mp4v2/atoms.h mpeg4ip/lib/mp4v2/atoms.h+--- mpeg4ip-orig/lib/mp4v2/atoms.h	2008-06-13 11:22:55.000000000 -0700++++ mpeg4ip/lib/mp4v2/atoms.h	2008-06-13 11:39:48.000000000 -0700+@@ -406,4 +406,10 @@+     void Generate();+ };+ ++class MP4ColrAtom : public MP4Atom {++ public:++    MP4ColrAtom();++    void Generate();++};+++ #endif /* __MP4_ATOMS_INCLUDED__ */+diff -Nur -x Makefile -x config.log -x config.status -x libtool mpeg4ip-orig/lib/mp4v2/mp4.cpp mpeg4ip/lib/mp4v2/mp4.cpp+--- mpeg4ip-orig/lib/mp4v2/mp4.cpp	2008-06-13 11:22:55.000000000 -0700++++ mpeg4ip/lib/mp4v2/mp4.cpp	2008-06-13 11:46:50.000000000 -0700+@@ -1003,6 +1003,21 @@+ 	return MP4_INVALID_TRACK_ID;+ }+ ++extern "C" MP4TrackId MP4AddColr(++	MP4FileHandle hFile, MP4TrackId refTrackId, u_int16_t pri, u_int16_t tran, u_int16_t mat)++{++	if (MP4_IS_VALID_FILE_HANDLE(hFile)) {++		try {++			return ((MP4File*)hFile)->AddColr(refTrackId, pri, tran, mat);++		}++		catch (MP4Error* e) {++			PRINT_ERROR(e);++			delete e;++		}++	}++	return MP4_INVALID_TRACK_ID;++}+++ + extern "C" MP4TrackId MP4CloneTrack(+ 	MP4FileHandle srcFile, +diff -Nur -x Makefile -x config.log -x config.status -x libtool mpeg4ip-orig/lib/mp4v2/mp4atom.cpp mpeg4ip/lib/mp4v2/mp4atom.cpp+--- mpeg4ip-orig/lib/mp4v2/mp4atom.cpp	2008-06-13 11:22:55.000000000 -0700++++ mpeg4ip/lib/mp4v2/mp4atom.cpp	2008-06-13 11:39:48.000000000 -0700+@@ -90,6 +90,8 @@+     case 'c':+       if (ATOMID(type) == ATOMID("chap")) {+ 	pAtom = new MP4TrefTypeAtom(type);++      } else if (ATOMID(type) == ATOMID("colr")) {++	pAtom = new MP4ColrAtom();+ 	  }+ 	  break;+ +diff -Nur -x Makefile -x config.log -x config.status -x libtool mpeg4ip-orig/lib/mp4v2/mp4file.cpp mpeg4ip/lib/mp4v2/mp4file.cpp+--- mpeg4ip-orig/lib/mp4v2/mp4file.cpp	2008-06-13 11:22:55.000000000 -0700++++ mpeg4ip/lib/mp4v2/mp4file.cpp	2008-06-13 11:39:48.000000000 -0700+@@ -2000,6 +2000,33 @@+ 	return trackId;+ }+ ++MP4TrackId MP4File::AddColr(MP4TrackId trackId,++                            u_int16_t primariesIndex,++                            u_int16_t transferFunctionIndex,++                            u_int16_t matrixIndex)++{++	// validate reference track id++  (void)FindTrackIndex(trackId);++    const char *format = GetTrackMediaDataName (trackId);++    ++    if (!strcasecmp(format, "avc1"))++    {++        AddChildAtom(MakeTrackName(trackId, "mdia.minf.stbl.stsd.avc1"), "colr");++        SetTrackIntegerProperty(trackId, "mdia.minf.stbl.stsd.avc1.colr.primariesIndex", primariesIndex);++        SetTrackIntegerProperty(trackId, "mdia.minf.stbl.stsd.avc1.colr.transferFunctionIndex", transferFunctionIndex);++        SetTrackIntegerProperty(trackId, "mdia.minf.stbl.stsd.avc1.colr.matrixIndex", matrixIndex);++    }++    else if (!strcasecmp(format, "mp4v"))++    {++        AddChildAtom(MakeTrackName(trackId, "mdia.minf.stbl.stsd.mp4v"), "colr");++        SetTrackIntegerProperty(trackId, "mdia.minf.stbl.stsd.mp4v.colr.primariesIndex", primariesIndex);++        SetTrackIntegerProperty(trackId, "mdia.minf.stbl.stsd.mp4v.colr.transferFunctionIndex", transferFunctionIndex);++        SetTrackIntegerProperty(trackId, "mdia.minf.stbl.stsd.mp4v.colr.matrixIndex", matrixIndex);++    }++++	return trackId;++}+++ void MP4File::DeleteTrack(MP4TrackId trackId)+ {+ 	ProtectWriteOperation("MP4DeleteTrack");+diff -Nur -x Makefile -x config.log -x config.status -x libtool mpeg4ip-orig/lib/mp4v2/mp4file.h mpeg4ip/lib/mp4v2/mp4file.h+--- mpeg4ip-orig/lib/mp4v2/mp4file.h	2008-06-13 11:22:55.000000000 -0700++++ mpeg4ip/lib/mp4v2/mp4file.h	2008-06-13 11:39:48.000000000 -0700+@@ -305,6 +305,7 @@+ 	MP4TrackId AddChapterTextTrack(MP4TrackId refTrackId);+ + 	MP4TrackId AddPixelAspectRatio(MP4TrackId trackId, u_int32_t hSpacing, u_int32_t vSpacing);++	MP4TrackId AddColr(MP4TrackId trackId, u_int16_t pri, u_int16_t tran, u_int16_t mat);+ + 	MP4SampleId GetTrackNumberOfSamples(MP4TrackId trackId);+