• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 #ifndef PV_AVIFILE_STREAMLIST_H_INCLUDED
19 #define PV_AVIFILE_STREAMLIST_H_INCLUDED
20 
21 #ifndef PV_AVIFILE_TYPEDEFS_H_INCLUDED
22 #include "pv_avifile_typedefs.h"
23 #endif
24 
25 #ifndef PV_AVIFILE_PARSER_UTILS_H_INCLUDED
26 #include "pv_avifile_parser_utils.h"
27 #endif
28 
29 
30 //structure to store stream format specific information
31 class PVAviFileStreamFormatStruct
32 {
33 
34     public:
35         //constructor
PVAviFileStreamFormatStruct()36         PVAviFileStreamFormatStruct()
37         {
38             iType = UNKNOWN;
39         }
40 
41         //destructor
~PVAviFileStreamFormatStruct()42         ~PVAviFileStreamFormatStruct()
43         {
44             iType = UNKNOWN;
45         }
46 
47         //Depending on stream type, either iVidBitMapInfo or iAudWaveFormatEx will be valid.
48         StreamType                  iType;
49 
50         union
51         {
52             BitMapInfoStruct    iVidBitMapInfo;     //Video Format Info
53             WaveFormatExStruct  iAudWaveFormatEx;   //Audio Format Info
54         };
55 };
56 
57 
58 
59 //class to parse stream list that contains stream specificinformation
60 class PVAviFileStreamlist: public PVAviFileParserStatus
61 {
62 
63     public:
64 
65         //constructor
66         PVAviFileStreamlist(PVFile *aFp, uint32 aStrListSz);
67 
68         //destructor
~PVAviFileStreamlist()69         ~PVAviFileStreamlist() {};
70 
71         //methods to retrieve PVAviFileStreamHeader info
GetStreamHeaderStruct()72         PVAviFileStreamHeaderStruct GetStreamHeaderStruct()
73         {
74             return iStreamHdr;
75         }
76 
77         OSCL_HeapString<OsclMemAllocator> GetStreamMimeType();
78 
PalletChangeAvailable()79         bool PalletChangeAvailable()
80         {
81             return iStreamHdr.iIsVidPalChangeAvailable;
82         }
83 
ISDisabledByDefault()84         bool ISDisabledByDefault()
85         {
86             return iStreamHdr.iAVISF_Disabled;
87         }
88 
89         bool GetHandlerType(uint8* aHdlr, uint32& aSize);
90 
GetPriority()91         uint16 GetPriority()
92         {
93             return iStreamHdr.iPriority;
94         }
95 
GetLanguage()96         uint16 GetLanguage()
97         {
98             return iStreamHdr.iLanguage;
99         }
100 
GetInitalFrames()101         uint32 GetInitalFrames()
102         {
103             return iStreamHdr.iInitFrames;
104         }
105 
GetScale()106         uint32 GetScale()
107         {
108             return iStreamHdr.iScale;
109         }
110 
GetRate()111         uint32 GetRate()
112         {
113             return iStreamHdr.iRate;
114         }
115 
GetSamplingRate()116         OsclFloat GetSamplingRate()
117         {
118             return iStreamHdr.iSamplingRate;
119         }
120 
GetStartTime()121         uint32 GetStartTime()
122         {
123             return iStreamHdr.iStart;
124         }
125 
GetStreamDuration()126         uint32 GetStreamDuration()
127         {
128             return iStreamHdr.iLength;
129         }
130 
GetStreamSuggestedBufferSize()131         uint32 GetStreamSuggestedBufferSize()
132         {
133             return iStreamHdr.iSugBufSize;
134         }
135 
GetQuality()136         int32 GetQuality()
137         {
138             return iStreamHdr.iQuality;
139         }
140 
141         uint32 GetBitsPerSample();
142 
GetSampleSize()143         uint32 GetSampleSize()
144         {
145             return iStreamHdr.iSampleSize;
146         }
147 
GetRCFrame()148         rcFrameType GetRCFrame()
149         {
150             return iStreamHdr.ircFrame;
151         }
152 
153         //methods to get PVAviFileStreamformat info
GetStreamType()154         uint32 GetStreamType()
155         {
156             return iStreamFmt.iType;
157         }
158 
159         uint32 GetAudioFormat();
160 
161         uint32 GetNumAudioChannels();
162 
163         uint32 GetVideoWidth();
164 
165         uint32 GetVideoHeight(bool& rBottomUp);
166 
167         bool GetFormatSpecificInfo(uint8*& aBuff, uint32& aSize);
168 
169         bool GetCodecSpecificData(uint8*& aBuff, uint32& aSize);
170 
171     private:
172 
173         PV_AVI_FILE_PARSER_ERROR_TYPE   ParseStreamHeader(PVFile *aFp, uint32 aHdrSize);
174         PV_AVI_FILE_PARSER_ERROR_TYPE   ParseStreamFormat(PVFile *aFp, uint32 aHdrSize);
175 
176         uint32                          iStreamListSize;
177         PVAviFileStreamHeaderStruct     iStreamHdr;
178         PVAviFileStreamFormatStruct     iStreamFmt;
179         uint8*                          ipCodecSpecificHdrData;    //strd chunk
180         uint32                          iCodecSpecificHdrDataSize;
181         char                            iStreamName[MAX_STRN_SZ];  //strn chunk
182 };
183 
184 
185 #endif //#ifndef    PV_AVIFILE_STREAMLIST_H_INCLUDED
186 
187