M4DA_Types.h revision 7c9d8018755adf1857571125ba1b3598c96ea506
1/*
2 * Copyright (C) 2004-2011 NXP Software
3 * Copyright (C) 2011 The Android Open Source Project
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 *      http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17/**
18 ************************************************************************
19 * @file    M4DA_Types.h
20 * @brief    Data access type definition
21 * @note    This file implements media specific types
22 ************************************************************************
23*/
24
25#ifndef __M4DA_TYPES_H__
26#define __M4DA_TYPES_H__
27
28#include "NXPSW_CompilerSwitches.h"
29
30#include "M4OSA_Types.h"
31#include "M4OSA_Memory.h"
32
33#ifdef __cplusplus
34extern "C" {
35#endif /*__cplusplus*/
36
37/**
38 ************************************************************************
39 * enumeration    M4_StreamType
40 * @brief        Type used to describe a stream (audio or video data flow).
41 ************************************************************************
42*/
43typedef enum
44{
45    M4DA_StreamTypeUnknown                = -1,    /**< Unknow type */
46    M4DA_StreamTypeVideoMpeg4            = 0,    /**< MPEG-4 video */
47    M4DA_StreamTypeVideoH263            = 1,    /**< H263 video */
48    M4DA_StreamTypeAudioAmrNarrowBand    = 2,    /**< Amr narrow band audio */
49    M4DA_StreamTypeAudioAmrWideBand        = 3,    /**< Amr wide band audio */
50    M4DA_StreamTypeAudioAac                = 4,    /**< AAC audio */
51    M4DA_StreamTypeAudioMp3                = 5,    /**< MP3 audio */
52    M4DA_StreamTypeVideoMJpeg            = 6,    /**< MJPEG video */
53    M4DA_StreamTypeAudioPcm                = 7,    /**< Wav audio */
54    M4DA_StreamTypeAudioMidi            = 8,    /**< Midi audio */
55    M4DA_StreamTypeVideoMpeg4Avc        = 9,    /**< MPEG-4 AVC video (h264) */
56    M4DA_StreamTypeAudioAacADTS            = 10,    /**< AAC ADTS audio */
57    M4DA_StreamTypeAudioAacADIF            = 11,    /**< AAC ADIF audio */
58    M4DA_StreamTypeAudioWma                = 12,    /**< WMA audio */
59    M4DA_StreamTypeVideoWmv                = 13,    /**< WMV video */
60    M4DA_StreamTypeAudioReal            = 14,   /**< REAL audio */
61    M4DA_StreamTypeVideoReal            = 15,   /**< REAL video */
62    M4DA_StreamTypeAudioEvrc            = 16,   /**< Evrc audio */
63    M4DA_StreamTypeTimedText            = 20,    /**< Timed Text */
64    M4DA_StreamTypeAudioBba                = 21,    /**< Beat Brew audio fomat */
65    M4DA_StreamTypeAudioSmaf            = 22,    /**< SMAF audio */
66    M4DA_StreamTypeAudioImelody            = 23,    /**< IMELODY audio*/
67    M4DA_StreamTypeAudioXmf                = 24,    /**< XMF audio */
68    M4DA_StreamTypeAudioBpc                = 25,    /**< BPC audio */
69
70    /* ADPCM */
71    M4DA_StreamTypeAudioADPcm            = 26    /**< ADPCM */
72
73} M4_StreamType;
74
75/**
76 ************************************************************************
77 * structure    M4_StreamHandler
78 * @brief        Base structure to describe a stream.
79 ************************************************************************
80*/
81typedef struct
82{
83    M4_StreamType    m_streamType;                /**< Stream type */
84    M4OSA_UInt32    m_streamId;                    /**< Stream Id (unique number definning
85                                                        the stream) */
86    M4OSA_Int64        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*/
114typedef 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_UInt32        m_structSize;            /**< Size of the structure in bytes */
122} M4_VideoStreamHandler;
123
124/**
125 ************************************************************************
126 * structure    M4_AudioStreamHandler
127 * @brief        Extended structure to describe an audio stream.
128 ************************************************************************
129*/
130typedef struct
131{
132    M4_StreamHandler    m_basicProperties;        /**< Audio-Video stream common parameters */
133    M4OSA_UInt32        m_nbChannels;            /**< Number of channels in the audio stream
134                                                        (1-mono, 2-stereo) */
135    M4OSA_UInt32        m_byteFrameLength;        /**< Size of frame samples in bytes */
136    M4OSA_UInt32        m_byteSampleSize;        /**< Number of bytes per sample */
137    M4OSA_UInt32        m_samplingFrequency;    /**< Sample frequency in kHz */
138    M4OSA_UInt32        m_structSize;            /**< Size of the structure in bytes */
139} M4_AudioStreamHandler;
140
141#ifdef M4VPS_SUPPORT_TTEXT
142
143/**
144 ************************************************************************
145 * structure    M4_TextStreamHandler
146 * @brief        Extended structure to describe a text stream.
147 ************************************************************************
148*/
149typedef struct
150{
151    M4_StreamHandler    m_basicProperties;    /**< Audio-Video stream common parameters */
152    M4OSA_UInt32        m_trackWidth;        /**< Width of the video in the stream */
153    M4OSA_UInt32        m_trackHeight;        /**< Height of the video in the stream */
154    M4OSA_UInt32        m_trackXpos;        /**< X position of the text track in video area */
155    M4OSA_UInt32        m_trackYpos;        /**< Y position of the text track in video area */
156    M4OSA_UInt8            back_col_rgba[4];    /**< the background color in RGBA */
157    M4OSA_UInt16        uiLenght;            /**< the string lenght in bytes */
158    M4OSA_UInt32        disp_flag;            /**< the way text will be displayed */
159    M4OSA_UInt8            horiz_justif;        /**< the horizontal justification of the text */
160    M4OSA_UInt8            verti_justif;        /**< the vertical justification of the text */
161    /* style */
162    M4OSA_UInt16        styl_start_char;    /**< the first character impacted by style */
163    M4OSA_UInt16        styl_end_char;        /**< the last character impacted by style */
164    M4OSA_UInt16        fontID;                /**< ID of the font */
165    M4OSA_UInt8            face_style;            /**< the text face-style: bold, italic,
166                                                         underlined, plain(default) */
167    M4OSA_UInt8            font_size;            /**< size in pixel of font */
168    M4OSA_UInt8            text_col_rgba[4];    /**< the text color in RGBA */
169    /* box */
170    M4OSA_UInt16        box_top;         /**< the top position of text box in the track area */
171    M4OSA_UInt16        box_left;        /**< the left position of text box in the track area */
172    M4OSA_UInt16        box_bottom;      /**< the bottom position of text box in the track area */
173    M4OSA_UInt16        box_right;       /**< the right position of text box in the track area */
174    M4OSA_UInt32        m_structSize;    /**< Size of the structure in bytes */
175} M4_TextStreamHandler;
176
177#endif /*M4VPS_SUPPORT_TTEXT*/
178
179/**
180 ************************************************************************
181 * structure    M4_AccessUnit
182 * @brief        Structure to describe an access unit.
183 ************************************************************************
184*/
185typedef struct
186{
187  M4OSA_UInt32            m_streamID;       /**< Id of the stream to get an AU from */
188  M4OSA_MemAddr8        m_dataAddress;      /**< Pointer to a memory area with the encoded data */
189  M4OSA_UInt32            m_size;           /**< Size of the dataAdress area */
190  M4OSA_Double            m_CTS;            /**< Composition Time Stamp for the Access Unit */
191  M4OSA_Double            m_DTS ;           /**< Decoded Time Stamp for the Access Unit */
192  M4OSA_UInt8            m_attribute;       /**< RAP information & AU corrupted */
193  M4OSA_UInt32            m_maxsize;        /**< Maximum size of the AU */
194  M4OSA_UInt32            m_structSize;     /**< Structure size */
195} M4_AccessUnit;
196
197#ifdef __cplusplus
198}
199#endif /*__cplusplus*/
200
201#endif /* __M4DA_TYPES_H__ */
202
203