[Datatype-cvs] mp4/filewriter mp4sm.cpp, 1.3.2.2, 1.3.2.3 mp4sm.h, 1.2.2.2, 1.2.2.3
pbasic at helixcommunity.org pbasic at helixcommunity.orgUpdate of /cvsroot/datatype/mp4/filewriter
In directory cvs.internal.helixcommunity.org:/tmp/cvs-serv497
Modified Files:
Tag: hxclient_3_1_0_atlas
mp4sm.cpp mp4sm.h
Log Message:
Changed MP4StreamMixer to place ID32 boxes depending on the origin of ID32 tag (FileHeader -> moov, StreamHeader -> trak).
Index: mp4sm.cpp
===================================================================
RCS file: /cvsroot/datatype/mp4/filewriter/mp4sm.cpp,v
retrieving revision 1.3.2.2
retrieving revision 1.3.2.3
diff -u -d -r1.3.2.2 -r1.3.2.3
--- mp4sm.cpp 28 Apr 2008 02:07:31 -0000 1.3.2.2
+++ mp4sm.cpp 6 May 2008 10:08:13 -0000 1.3.2.3
@@ -1129,6 +1129,7 @@
// trak
// tkhd
// mdia
+ // meta
CMP4Atom_mdia* pMdia;
@@ -1167,6 +1168,20 @@
pTrak->AddChild( pMdia );
}
}
+
+ // meta (3GP flavor only)
+ if( SUCCEEDED( retVal ) && m_eMetaFlavor == META_3GP)
+ {
+ // ID32, setup box hierarchy: trak/meta/[hdlr, ID32]
+ CMP4Atom_meta* pMeta = NULL;
+ retVal = Build3GPMetaDataID32(m_pStreamInfo[usStreamNum].m_pStreamHeader, &pMeta);
+
+ if( SUCCEEDED( retVal ) && pMeta )
+ {
+ retVal = HXR_OK;
+ pTrak->AddChild( pMeta );
+ }
+ }
}
// Set up pMdia children
@@ -2108,39 +2123,70 @@
}
}
- // ID32, we'll setup box hierarchy: file/moov/meta/[hdlr, ID32]
- CMP4Atom_meta* pMeta = new CMP4Atom_meta();
- CMP4Atom_hdlr* pHdlr = new CMP4Atom_hdlr();
- C3GPAtom_ID32* pID32 = new C3GPAtom_ID32();
+ // ID32, setup box hierarchy: file/moov/meta/[hdlr, ID32]
+ CMP4Atom_meta* pMeta = NULL;
+ if(SUCCEEDED(retVal))
+ {
+ retVal = Build3GPMetaDataID32(m_pFileHeader, &pMeta);
+ if(SUCCEEDED(retVal) && pMeta)
+ {
+ pMoov->AddChild(pMeta);
+ }
+ }
- if( !(pMeta && pHdlr && pID32) )
+ return retVal;
+}
+
+HX_RESULT CMP4StreamMixer::Build3GPMetaDataID32( IHXValues* pHeader, CMP4Atom_meta** ppMeta )
+{
+ if(!ppMeta)
{
- retVal = HXR_OUTOFMEMORY;
+ return HXR_POINTER;
}
- if( SUCCEEDED(retVal) )
+ if(!pHeader)
{
- IHXBuffer* pBlobID32 = 0;
- retVal = m_pFileHeader->GetPropertyBuffer(_3GPP_META_INFO_ID32_BLOB_KEY, pBlobID32);
- if(SUCCEEDED(retVal))
+ return HXR_INVALID_PARAMETER;
+ }
+
+ *ppMeta = NULL;
+
+ IHXBuffer* pBlobID32 = NULL;
+ HX_RESULT retVal = HXR_OK;
+
+ if(SUCCEEDED(pHeader->GetPropertyBuffer(_3GPP_META_INFO_ID32_BLOB_KEY, pBlobID32)))
+ {
+ retVal = HXR_OUTOFMEMORY;
+
+ // setup box hierarchy: meta/[hdlr, ID32]
+ CMP4Atom_meta* pMeta = new CMP4Atom_meta();
+ CMP4Atom_hdlr* pHdlr = new CMP4Atom_hdlr();
+ C3GPAtom_ID32* pID32 = new C3GPAtom_ID32();
+
+ if(pMeta && pHdlr && pID32)
{
// 'hdlr' must be the first child of 'meta'
- pMoov->AddChild(pMeta);
-
pHdlr->SetHandlerType("ID32");
pMeta->AddChild(pHdlr);
Meta3GP_SetLanguageEncoding(pID32);
pID32->SetBlob((UCHAR*)pBlobID32->GetBuffer(), pBlobID32->GetSize());
pMeta->AddChild(pID32);
+
+ retVal = HXR_OK;
+ }
+
+ if(SUCCEEDED(retVal))
+ {
+ *ppMeta = pMeta;
+ }
+ else
+ {
+ HX_DELETE(pMeta);
+ HX_DELETE(pHdlr);
+ HX_DELETE(pID32);
}
- HX_RELEASE(pBlobID32);
- }
- if(FAILED(retVal))
- {
- HX_DELETE(pMeta);
- HX_DELETE(pHdlr);
- HX_DELETE(pID32);
}
+ HX_RELEASE(pBlobID32);
return retVal;
}
Index: mp4sm.h
===================================================================
RCS file: /cvsroot/datatype/mp4/filewriter/mp4sm.h,v
retrieving revision 1.2.2.2
retrieving revision 1.2.2.3
diff -u -d -r1.2.2.2 -r1.2.2.3
--- mp4sm.h 28 Apr 2008 02:07:31 -0000 1.2.2.2
+++ mp4sm.h 6 May 2008 10:08:13 -0000 1.2.2.3
@@ -47,6 +47,7 @@
class CMP4Atom_tkhd;
class CMP4Atom_mdhd;
class CMP4Atom_stsd;
+class CMP4Atom_meta;
class CMP4Archiver;
class CMP4VersionedAtom;
@@ -90,6 +91,7 @@
HX_RESULT BuildIPODMetaData( CMP4Atom* pUdta );
HX_RESULT BuildPSPMetaData( CMP4Atom* pUsmt );
HX_RESULT Build3GPMetaData( CMP4Atom* pUdta, CMP4Atom* pMoov );
+ HX_RESULT Build3GPMetaDataID32( IHXValues* pHeader, CMP4Atom_meta** ppMeta );
// Build the trak subtree
HX_RESULT BuildTrack( UINT16 usStreamNum, CMP4Atom* pTrak );