Home | History | Annotate | Download | only in include
      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 SampleDescriptionAtom Class                      */
     21 /*     -------------------------------------------------------------------       */
     22 /*********************************************************************************/
     23 /*
     24     This SampleDescriptionAtom Class gives detailed information about the coding
     25     type used, and any initialization information needed for coding.
     26 */
     27 
     28 
     29 #ifndef SAMPLEDESCRIPTIONATOM_H_INCLUDED
     30 #define SAMPLEDESCRIPTIONATOM_H_INCLUDED
     31 
     32 #ifndef OSCL_FILE_IO_H_INCLUDED
     33 #include "oscl_file_io.h"
     34 #endif
     35 
     36 #ifndef FULLATOM_H_INCLUDED
     37 #include "fullatom.h"
     38 #endif
     39 
     40 #ifndef SAMPLEENTRY_H_INCLUDED
     41 #include "sampleentry.h"
     42 #endif
     43 
     44 #ifndef ESDESCRIPTOR_H_INCLUDED
     45 #include "esdescriptor.h"
     46 #endif
     47 
     48 #ifndef DECODERSPECIFICINFO_H_INCLUDED
     49 #include "decoderspecificinfo.h"
     50 #endif
     51 
     52 #ifndef AMRSAMPLEENTRY_H_INCLUDED
     53 #include "amrsampleentry.h"
     54 #endif
     55 
     56 #ifndef H263SAMPLEENTRY_H_INCLUDED
     57 #include "h263sampleentry.h"
     58 #endif
     59 
     60 #ifndef AVCSAMPLEENTRY_H_INCLUDED
     61 #include "avcsampleentry.h"
     62 #endif
     63 
     64 #ifndef AVCSUBSEQDESCRIPTIONENTRY_H_INCLUDED
     65 #include "avcsubseqdescriptionentry.h"
     66 #endif
     67 
     68 #ifndef AVCLAYERDESCRIPTIONENTRY_H_INCLUDED
     69 #include "avclayerentry.h"
     70 #endif
     71 
     72 
     73 class ProtectionSchemeInformationBox;
     74 
     75 class SampleDescriptionAtom : public FullAtom
     76 {
     77 
     78     public:
     79         SampleDescriptionAtom(MP4_FF_FILE *fp,
     80                               uint32 mediaType,
     81                               uint32 size,
     82                               uint32 type);
     83 
     84         virtual ~SampleDescriptionAtom();
     85 
     86         // Member gets and sets
     87         uint32 getEntryCount() const
     88         {
     89             return _entryCount;
     90         }
     91         uint32 getHandlerType() const
     92         {
     93             return _handlerType;
     94         }
     95 
     96         const SampleEntry* getSampleEntryAt(int32 index) const;
     97         SampleEntry* getMutableSampleEntryAt(int32 index);
     98 
     99         uint32 getNumSampleEntries()
    100         {
    101             if (_psampleEntryVec != NULL)
    102             {
    103                 return _psampleEntryVec->size();
    104             }
    105             else
    106             {
    107                 return 0;
    108             }
    109         }
    110 
    111         // Getting and setting the Mpeg4 VOL header
    112         DecoderSpecificInfo *getDecoderSpecificInfo(uint32 index);
    113 
    114         void getMIMEType(OSCL_String& aMimeType);//Move to SampleDescription.cpp
    115 
    116         uint8  getObjectTypeIndication();
    117 
    118         uint32 getMaxBufferSizeDB();    // Get the max size buffer needed to retrieve the media samples
    119         int32  getAverageBitrate();
    120         int32  getMaxBitrate();
    121 
    122         uint32 getHspacing();
    123         uint32 getVspacing();
    124 
    125         // Return the ESID for the track - undefined if a HINT track
    126         uint32 getESID(uint32 index);
    127 
    128         // Return the first ESDescriptor for the track - undefined if a HINT track
    129         const ESDescriptor *getESDescriptor(uint32 index);
    130 
    131         // Get the type of SampleEntry atom (i.e. MPEG_SAMPLE_ENTRY, ... '<protocol>', etc.)
    132         uint32 getSampleProtocol(uint32 index);
    133 
    134         uint32 getMediaType()
    135         {
    136             return  _pMediaType;
    137         }
    138 
    139         AMRSampleEntry *getAMRSampleEntry()
    140         {
    141             return _pAMRSampleEntryAtom;
    142         }
    143 
    144         H263SampleEntry *getH263SampleEntry()
    145         {
    146             return _pH263SampleEntryAtom;
    147         }
    148 
    149         bool Is3GPPAMR()
    150         {
    151             if (_o3GPPAMR)
    152             {
    153                 return true;
    154             }
    155             else
    156             {
    157                 return false;
    158             }
    159         }
    160 
    161         AVCSampleEntry* getAVCSampleEntry(uint32 index)
    162         {
    163             return (*_pAVCSampleEntryVec)[index];
    164         }
    165 
    166         uint32 getNumAVCSampleEntries()
    167         {
    168             if (_pAVCSampleEntryVec != NULL)
    169                 return _pAVCSampleEntryVec->size();
    170             else
    171                 return 0;
    172         }
    173 
    174         SampleEntry *getTextSampleEntryAt(uint32 index);
    175 
    176         uint32 getAVCNALLengthSize(uint32 index)
    177         {
    178             if (_oAVC)
    179             {
    180                 return (((*_pAVCSampleEntryVec)[index])->getNALLengthSize());
    181             }
    182             return 0;
    183         }
    184 
    185         uint32 getTrackLevelOMA2DRMInfoSize();
    186         uint8* getTrackLevelOMA2DRMInfo();
    187 
    188         int32 getHeight();
    189         int32 getWidth();
    190     private:
    191         uint32 _entryCount;
    192         uint32 _handlerType;
    193         Oscl_Vector<SampleEntry*, OsclMemAllocator> *_psampleEntryVec;
    194 
    195         uint32 _pMediaType;
    196 
    197         AMRSampleEntry  *_pAMRSampleEntryAtom;
    198         H263SampleEntry *_pH263SampleEntryAtom;
    199         Oscl_Vector<AVCSampleEntry*, OsclMemAllocator> *_pAVCSampleEntryVec;
    200         AVCSubSequenceEntry *_pavcSubSequenceEntry;
    201         AVCLayerDescEntry *_pavcLayerDescEntry;
    202 
    203         bool _o3GPPAMR;
    204         bool _o3GPPH263;
    205         bool _o3GPPWBAMR;
    206         bool _oAVC;
    207 
    208         ProtectionSchemeInformationBox* _pProtectionSchemeInformationBox;
    209 };
    210 
    211 
    212 #endif // SAMPLEDESCRIPTIONATOM_H_INCLUDED
    213