1 /* 2 * Copyright (C) 2011 The Android Open Source Project 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 express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 /** 17 ************************************************************************ 18 * @file M4DA_Types.h 19 * @brief Data access type definition 20 * @note This file implements media specific types 21 ************************************************************************ 22 */ 23 24 #ifndef __M4DA_TYPES_H__ 25 #define __M4DA_TYPES_H__ 26 27 #include "NXPSW_CompilerSwitches.h" 28 29 #include "M4OSA_Types.h" 30 #include "M4OSA_Memory.h" 31 32 #ifdef __cplusplus 33 extern "C" { 34 #endif /*__cplusplus*/ 35 36 /** 37 ************************************************************************ 38 * enumeration M4_StreamType 39 * @brief Type used to describe a stream (audio or video data flow). 40 ************************************************************************ 41 */ 42 typedef enum 43 { 44 M4DA_StreamTypeUnknown = -1, /**< Unknow type */ 45 M4DA_StreamTypeVideoMpeg4 = 0, /**< MPEG-4 video */ 46 M4DA_StreamTypeVideoH263 = 1, /**< H263 video */ 47 M4DA_StreamTypeAudioAmrNarrowBand = 2, /**< Amr narrow band audio */ 48 M4DA_StreamTypeAudioAmrWideBand = 3, /**< Amr wide band audio */ 49 M4DA_StreamTypeAudioAac = 4, /**< AAC audio */ 50 M4DA_StreamTypeAudioMp3 = 5, /**< MP3 audio */ 51 M4DA_StreamTypeVideoMJpeg = 6, /**< MJPEG video */ 52 M4DA_StreamTypeAudioPcm = 7, /**< Wav audio */ 53 M4DA_StreamTypeAudioMidi = 8, /**< Midi audio */ 54 M4DA_StreamTypeVideoMpeg4Avc = 9, /**< MPEG-4 AVC video (h264) */ 55 M4DA_StreamTypeAudioAacADTS = 10, /**< AAC ADTS audio */ 56 M4DA_StreamTypeAudioAacADIF = 11, /**< AAC ADIF audio */ 57 M4DA_StreamTypeAudioWma = 12, /**< WMA audio */ 58 M4DA_StreamTypeVideoWmv = 13, /**< WMV video */ 59 M4DA_StreamTypeAudioReal = 14, /**< REAL audio */ 60 M4DA_StreamTypeVideoReal = 15, /**< REAL video */ 61 M4DA_StreamTypeAudioEvrc = 16, /**< Evrc audio */ 62 M4DA_StreamTypeTimedText = 20, /**< Timed Text */ 63 M4DA_StreamTypeAudioBba = 21, /**< Beat Brew audio fomat */ 64 M4DA_StreamTypeAudioSmaf = 22, /**< SMAF audio */ 65 M4DA_StreamTypeAudioImelody = 23, /**< IMELODY audio*/ 66 M4DA_StreamTypeAudioXmf = 24, /**< XMF audio */ 67 M4DA_StreamTypeAudioBpc = 25, /**< BPC audio */ 68 69 /* ADPCM */ 70 M4DA_StreamTypeAudioADPcm = 26, /**< ADPCM */ 71 72 M4DA_StreamTypeVideoARGB8888 = 27 73 } M4_StreamType; 74 75 /** 76 ************************************************************************ 77 * structure M4_StreamHandler 78 * @brief Base structure to describe a stream. 79 ************************************************************************ 80 */ 81 typedef struct 82 { 83 M4_StreamType m_streamType; /**< Stream type */ 84 M4OSA_UInt32 m_streamId; /**< Stream Id (unique number definning 85 the stream) */ 86 M4OSA_Int32 m_duration; /**< Duration of the stream in milli 87 seconds */ 88 M4OSA_UInt32 m_averageBitRate; /**< Average bitrate in kb/s */ 89 M4OSA_UInt32 m_maxAUSize; /**< Maximum size of an Access Unit */ 90 M4OSA_UInt8* m_pDecoderSpecificInfo; /**< Pointer on specific information required 91 to create a decoder */ 92 M4OSA_UInt32 m_decoderSpecificInfoSize; /**< Size of the specific information 93 pointer above */ 94 void* m_pUserData; /**< Pointer on User Data 95 (initialized by the user) */ 96 M4OSA_UInt32 m_structSize; /**< Size of the structure in bytes */ 97 M4OSA_Bool m_bStreamIsOK; /**< Flag to know if stream has no errors after 98 parsing is finished */ 99 M4OSA_UInt8* m_pH264DecoderSpecificInfo; /**< Pointer on specific information 100 required to create a decoder */ 101 M4OSA_UInt32 m_H264decoderSpecificInfoSize; /**< Size of the specific 102 information pointer above */ 103 // MPEG4 & AAC decoders require ESDS info 104 M4OSA_UInt8* m_pESDSInfo; /**< Pointer on MPEG4 or AAC ESDS box */ 105 M4OSA_UInt32 m_ESDSInfoSize; /**< Size of the MPEG4 or AAC ESDS box */ 106 } M4_StreamHandler; 107 108 /** 109 ************************************************************************ 110 * structure M4_VideoStreamHandler 111 * @brief Extended structure to describe a video stream. 112 ************************************************************************ 113 */ 114 typedef struct 115 { 116 M4_StreamHandler m_basicProperties; /**< Audio-Video stream common parameters */ 117 M4OSA_UInt32 m_videoWidth; /**< Width of the video in the stream */ 118 M4OSA_UInt32 m_videoHeight; /**< Height of the video in the stream */ 119 M4OSA_Float m_averageFrameRate; /**< Average frame rate of the video 120 in the stream */ 121 M4OSA_Int32 videoRotationDegrees; /**< Video rotation degree */ 122 M4OSA_UInt32 m_structSize; /**< Size of the structure in bytes */ 123 } M4_VideoStreamHandler; 124 125 /** 126 ************************************************************************ 127 * structure M4_AudioStreamHandler 128 * @brief Extended structure to describe an audio stream. 129 ************************************************************************ 130 */ 131 typedef struct 132 { 133 M4_StreamHandler m_basicProperties; /**< Audio-Video stream common parameters */ 134 M4OSA_UInt32 m_nbChannels; /**< Number of channels in the audio stream 135 (1-mono, 2-stereo) */ 136 M4OSA_UInt32 m_byteFrameLength; /**< Size of frame samples in bytes */ 137 M4OSA_UInt32 m_byteSampleSize; /**< Number of bytes per sample */ 138 M4OSA_UInt32 m_samplingFrequency; /**< Sample frequency in kHz */ 139 M4OSA_UInt32 m_structSize; /**< Size of the structure in bytes */ 140 } M4_AudioStreamHandler; 141 142 #ifdef M4VPS_SUPPORT_TTEXT 143 144 /** 145 ************************************************************************ 146 * structure M4_TextStreamHandler 147 * @brief Extended structure to describe a text stream. 148 ************************************************************************ 149 */ 150 typedef struct 151 { 152 M4_StreamHandler m_basicProperties; /**< Audio-Video stream common parameters */ 153 M4OSA_UInt32 m_trackWidth; /**< Width of the video in the stream */ 154 M4OSA_UInt32 m_trackHeight; /**< Height of the video in the stream */ 155 M4OSA_UInt32 m_trackXpos; /**< X position of the text track in video area */ 156 M4OSA_UInt32 m_trackYpos; /**< Y position of the text track in video area */ 157 M4OSA_UInt8 back_col_rgba[4]; /**< the background color in RGBA */ 158 M4OSA_UInt16 uiLenght; /**< the string lenght in bytes */ 159 M4OSA_UInt32 disp_flag; /**< the way text will be displayed */ 160 M4OSA_UInt8 horiz_justif; /**< the horizontal justification of the text */ 161 M4OSA_UInt8 verti_justif; /**< the vertical justification of the text */ 162 /* style */ 163 M4OSA_UInt16 styl_start_char; /**< the first character impacted by style */ 164 M4OSA_UInt16 styl_end_char; /**< the last character impacted by style */ 165 M4OSA_UInt16 fontID; /**< ID of the font */ 166 M4OSA_UInt8 face_style; /**< the text face-style: bold, italic, 167 underlined, plain(default) */ 168 M4OSA_UInt8 font_size; /**< size in pixel of font */ 169 M4OSA_UInt8 text_col_rgba[4]; /**< the text color in RGBA */ 170 /* box */ 171 M4OSA_UInt16 box_top; /**< the top position of text box in the track area */ 172 M4OSA_UInt16 box_left; /**< the left position of text box in the track area */ 173 M4OSA_UInt16 box_bottom; /**< the bottom position of text box in the track area */ 174 M4OSA_UInt16 box_right; /**< the right position of text box in the track area */ 175 M4OSA_UInt32 m_structSize; /**< Size of the structure in bytes */ 176 } M4_TextStreamHandler; 177 178 #endif /*M4VPS_SUPPORT_TTEXT*/ 179 180 /** 181 ************************************************************************ 182 * structure M4_AccessUnit 183 * @brief Structure to describe an access unit. 184 ************************************************************************ 185 */ 186 typedef struct 187 { 188 M4OSA_UInt32 m_streamID; /**< Id of the stream to get an AU from */ 189 M4OSA_MemAddr8 m_dataAddress; /**< Pointer to a memory area with the encoded data */ 190 M4OSA_UInt32 m_size; /**< Size of the dataAdress area */ 191 M4OSA_Double m_CTS; /**< Composition Time Stamp for the Access Unit */ 192 M4OSA_Double m_DTS ; /**< Decoded Time Stamp for the Access Unit */ 193 M4OSA_UInt8 m_attribute; /**< RAP information & AU corrupted */ 194 M4OSA_UInt32 m_maxsize; /**< Maximum size of the AU */ 195 M4OSA_UInt32 m_structSize; /**< Structure size */ 196 } M4_AccessUnit; 197 198 #ifdef __cplusplus 199 } 200 #endif /*__cplusplus*/ 201 202 #endif /* __M4DA_TYPES_H__ */ 203 204