/*---------------------------------------------------------------------- | AP4_IsmaTrackEncrypter::ProcessTrack +---------------------------------------------------------------------*/ AP4_Result AP4_IsmaTrackEncrypter::ProcessTrack() { // sinf container AP4_ContainerAtom* sinf = new AP4_ContainerAtom(AP4_ATOM_TYPE_SINF); // original format AP4_FrmaAtom* frma = new AP4_FrmaAtom(m_SampleEntry->GetType()); // scheme AP4_SchmAtom* schm = new AP4_SchmAtom(AP4_ISMACRYP_SCHEME_TYPE_IAEC, 1); // scheme info AP4_ContainerAtom* schi = new AP4_ContainerAtom(AP4_ATOM_TYPE_SCHI); AP4_IkmsAtom* ikms = new AP4_IkmsAtom(m_KmsUri.c_str()); AP4_IsfmAtom* isfm = new AP4_IsfmAtom(false, 0, 4); // populate the schi container schi->AddChild(ikms); schi->AddChild(isfm); // populate the sinf container sinf->AddChild(frma); sinf->AddChild(schm); sinf->AddChild(schi); // add the sinf atom to the sample description m_SampleEntry->AddChild(sinf); // change the atom type of the sample description m_SampleEntry->SetType(m_Format); return AP4_SUCCESS; }
/*---------------------------------------------------------------------- | AP4_IsmaTrackDecrypter::ProcessTrack +---------------------------------------------------------------------*/ AP4_Result AP4_IsmaTrackDecrypter::ProcessTrack() { m_SampleEntry->SetType(m_OriginalFormat); m_SampleEntry->DeleteChild(AP4_ATOM_TYPE_SINF); return AP4_SUCCESS; }
/*---------------------------------------------------------------------- | AP4_OmaDcfTrackEncrypter::ProcessTrack +---------------------------------------------------------------------*/ AP4_Result AP4_OmaDcfTrackEncrypter::ProcessTrack() { // original format AP4_FrmaAtom* frma = new AP4_FrmaAtom(m_SampleEntry->GetType()); // scheme info AP4_OdafAtom* odaf = new AP4_OdafAtom(true, 0, AP4_CIPHER_BLOCK_SIZE); AP4_OhdrAtom* ohdr = new AP4_OhdrAtom(m_CipherMode, m_CipherPadding, 0, m_ContentId.GetChars(), m_RightsIssuerUrl.GetChars(), m_TextualHeaders.GetData(), m_TextualHeaders.GetDataSize()); AP4_SchmAtom* schm = new AP4_SchmAtom(AP4_PROTECTION_SCHEME_TYPE_OMA, AP4_PROTECTION_SCHEME_VERSION_OMA_20); // populate the odkm container AP4_ContainerAtom* odkm = new AP4_ContainerAtom(AP4_ATOM_TYPE_ODKM, (AP4_UI32)0, (AP4_UI32)0); odkm->AddChild(odaf); odkm->AddChild(ohdr); // populate the schi container AP4_ContainerAtom* schi = new AP4_ContainerAtom(AP4_ATOM_TYPE_SCHI); schi->AddChild(odkm); // populate the sinf container AP4_ContainerAtom* sinf = new AP4_ContainerAtom(AP4_ATOM_TYPE_SINF); sinf->AddChild(frma); sinf->AddChild(schm); sinf->AddChild(schi); // add the sinf atom to the sample description m_SampleEntry->AddChild(sinf); // change the atom type of the sample description m_SampleEntry->SetType(m_Format); return AP4_SUCCESS; }