Home | History | Annotate | Download | only in src
      1 /* ------------------------------------------------------------------
      2  * Copyright (C) 1998-2009 PacketVideo
      3  *
      4  * Licensed under the Apache License, Version 2.0 (the "License");
      5  * you may not use this file except in compliance with the License.
      6  * You may obtain a copy of the License at
      7  *
      8  *      http://www.apache.org/licenses/LICENSE-2.0
      9  *
     10  * Unless required by applicable law or agreed to in writing, software
     11  * distributed under the License is distributed on an "AS IS" BASIS,
     12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
     13  * express or implied.
     14  * See the License for the specific language governing permissions
     15  * and limitations under the License.
     16  * -------------------------------------------------------------------
     17  */
     18 /*********************************************************************************/
     19 /*     -------------------------------------------------------------------       */
     20 /*                        MPEG-4 ObjectDescriptorAtom Class                      */
     21 /*     -------------------------------------------------------------------       */
     22 /*********************************************************************************/
     23 /*
     24     This ObjectDescriptorAtom Class contains an ObjectDescriptor or an
     25     InitialObjectDescriptor.
     26 */
     27 
     28 
     29 #define IMPLEMENT_ObjectDescriptorAtom
     30 
     31 #include "objectdescriptoratom.h"
     32 #include "atomutils.h"
     33 #include "atomdefs.h"
     34 
     35 
     36 // Stream-in Constructor
     37 ObjectDescriptorAtom::ObjectDescriptorAtom(MP4_FF_FILE *fp, uint32 size, uint32 type)
     38         : FullAtom(fp, size, type)
     39 {
     40     _pOD = NULL;
     41 
     42     if (_success)
     43     {
     44         _pparent = NULL;
     45 
     46         PV_MP4_FF_NEW(fp->auditCB, InitialObjectDescriptor, (fp), _pOD);
     47 
     48         if (!_pOD->MP4Success())
     49         {
     50             _success = false;
     51             _mp4ErrorCode = _pOD->GetMP4Error();
     52         }
     53 
     54         if (_success)
     55             _pOD->setParent(this);
     56     }
     57     else
     58     {
     59         if (_mp4ErrorCode != ATOM_VERSION_NOT_SUPPORTED)
     60             _mp4ErrorCode = READ_OBJECT_DESCRIPTOR_ATOM_FAILED;
     61     }
     62 
     63 }
     64 
     65 // Destructor
     66 ObjectDescriptorAtom::~ObjectDescriptorAtom()
     67 {
     68     // Cleanup InitialObjectDescriptor
     69     if (_pOD != NULL)
     70     {
     71         PV_MP4_FF_DELETE(NULL, InitialObjectDescriptor, _pOD);
     72     }
     73 }
     74 
     75 
     76