M4DA_Types.h revision e9eec0e0975c57c0dac91eb5b4cbb052b7dd011a
14199c54c527330ac01699b176e7bca186a3aa3a4Daisuke Miyakawa/*
24199c54c527330ac01699b176e7bca186a3aa3a4Daisuke Miyakawa * Copyright (C) 2011 The Android Open Source Project
34199c54c527330ac01699b176e7bca186a3aa3a4Daisuke Miyakawa *
44199c54c527330ac01699b176e7bca186a3aa3a4Daisuke Miyakawa * Licensed under the Apache License, Version 2.0 (the "License");
54199c54c527330ac01699b176e7bca186a3aa3a4Daisuke Miyakawa * you may not use this file except in compliance with the License.
64199c54c527330ac01699b176e7bca186a3aa3a4Daisuke Miyakawa * You may obtain a copy of the License at
74199c54c527330ac01699b176e7bca186a3aa3a4Daisuke Miyakawa *
84199c54c527330ac01699b176e7bca186a3aa3a4Daisuke Miyakawa *      http://www.apache.org/licenses/LICENSE-2.0
94199c54c527330ac01699b176e7bca186a3aa3a4Daisuke Miyakawa *
104199c54c527330ac01699b176e7bca186a3aa3a4Daisuke Miyakawa * Unless required by applicable law or agreed to in writing, software
114199c54c527330ac01699b176e7bca186a3aa3a4Daisuke Miyakawa * distributed under the License is distributed on an "AS IS" BASIS,
124199c54c527330ac01699b176e7bca186a3aa3a4Daisuke Miyakawa * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
134199c54c527330ac01699b176e7bca186a3aa3a4Daisuke Miyakawa * See the License for the specific language governing permissions and
144199c54c527330ac01699b176e7bca186a3aa3a4Daisuke Miyakawa * limitations under the License.
154199c54c527330ac01699b176e7bca186a3aa3a4Daisuke Miyakawa */
164199c54c527330ac01699b176e7bca186a3aa3a4Daisuke Miyakawa/**
174199c54c527330ac01699b176e7bca186a3aa3a4Daisuke Miyakawa ************************************************************************
184199c54c527330ac01699b176e7bca186a3aa3a4Daisuke Miyakawa * @file    M4DA_Types.h
194199c54c527330ac01699b176e7bca186a3aa3a4Daisuke Miyakawa * @brief    Data access type definition
204199c54c527330ac01699b176e7bca186a3aa3a4Daisuke Miyakawa * @note    This file implements media specific types
214199c54c527330ac01699b176e7bca186a3aa3a4Daisuke Miyakawa ************************************************************************
224199c54c527330ac01699b176e7bca186a3aa3a4Daisuke Miyakawa*/
234199c54c527330ac01699b176e7bca186a3aa3a4Daisuke Miyakawa
244199c54c527330ac01699b176e7bca186a3aa3a4Daisuke Miyakawa#ifndef __M4DA_TYPES_H__
254199c54c527330ac01699b176e7bca186a3aa3a4Daisuke Miyakawa#define __M4DA_TYPES_H__
264199c54c527330ac01699b176e7bca186a3aa3a4Daisuke Miyakawa
274199c54c527330ac01699b176e7bca186a3aa3a4Daisuke Miyakawa#include "NXPSW_CompilerSwitches.h"
284199c54c527330ac01699b176e7bca186a3aa3a4Daisuke Miyakawa
294199c54c527330ac01699b176e7bca186a3aa3a4Daisuke Miyakawa#include "M4OSA_Types.h"
304199c54c527330ac01699b176e7bca186a3aa3a4Daisuke Miyakawa#include "M4OSA_Memory.h"
314199c54c527330ac01699b176e7bca186a3aa3a4Daisuke Miyakawa
324199c54c527330ac01699b176e7bca186a3aa3a4Daisuke Miyakawa#ifdef __cplusplus
334199c54c527330ac01699b176e7bca186a3aa3a4Daisuke Miyakawaextern "C" {
3448dd8e86a81d2ab40eb762975c8211c225002bf0Daisuke Miyakawa#endif /*__cplusplus*/
3548dd8e86a81d2ab40eb762975c8211c225002bf0Daisuke Miyakawa
3648dd8e86a81d2ab40eb762975c8211c225002bf0Daisuke Miyakawa/**
3748dd8e86a81d2ab40eb762975c8211c225002bf0Daisuke Miyakawa ************************************************************************
3848dd8e86a81d2ab40eb762975c8211c225002bf0Daisuke Miyakawa * enumeration    M4_StreamType
3948dd8e86a81d2ab40eb762975c8211c225002bf0Daisuke Miyakawa * @brief        Type used to describe a stream (audio or video data flow).
4048dd8e86a81d2ab40eb762975c8211c225002bf0Daisuke Miyakawa ************************************************************************
4148dd8e86a81d2ab40eb762975c8211c225002bf0Daisuke Miyakawa*/
4248dd8e86a81d2ab40eb762975c8211c225002bf0Daisuke Miyakawatypedef enum
4348dd8e86a81d2ab40eb762975c8211c225002bf0Daisuke Miyakawa{
4448dd8e86a81d2ab40eb762975c8211c225002bf0Daisuke Miyakawa    M4DA_StreamTypeUnknown                = -1,    /**< Unknow type */
4548dd8e86a81d2ab40eb762975c8211c225002bf0Daisuke Miyakawa    M4DA_StreamTypeVideoMpeg4            = 0,    /**< MPEG-4 video */
4648dd8e86a81d2ab40eb762975c8211c225002bf0Daisuke Miyakawa    M4DA_StreamTypeVideoH263            = 1,    /**< H263 video */
474199c54c527330ac01699b176e7bca186a3aa3a4Daisuke Miyakawa    M4DA_StreamTypeAudioAmrNarrowBand    = 2,    /**< Amr narrow band audio */
484199c54c527330ac01699b176e7bca186a3aa3a4Daisuke Miyakawa    M4DA_StreamTypeAudioAmrWideBand        = 3,    /**< Amr wide band audio */
494199c54c527330ac01699b176e7bca186a3aa3a4Daisuke Miyakawa    M4DA_StreamTypeAudioAac                = 4,    /**< AAC audio */
504199c54c527330ac01699b176e7bca186a3aa3a4Daisuke Miyakawa    M4DA_StreamTypeAudioMp3                = 5,    /**< MP3 audio */
514199c54c527330ac01699b176e7bca186a3aa3a4Daisuke Miyakawa    M4DA_StreamTypeVideoMJpeg            = 6,    /**< MJPEG video */
524199c54c527330ac01699b176e7bca186a3aa3a4Daisuke Miyakawa    M4DA_StreamTypeAudioPcm                = 7,    /**< Wav audio */
534199c54c527330ac01699b176e7bca186a3aa3a4Daisuke Miyakawa    M4DA_StreamTypeAudioMidi            = 8,    /**< Midi audio */
544199c54c527330ac01699b176e7bca186a3aa3a4Daisuke Miyakawa    M4DA_StreamTypeVideoMpeg4Avc        = 9,    /**< MPEG-4 AVC video (h264) */
554199c54c527330ac01699b176e7bca186a3aa3a4Daisuke Miyakawa    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*/
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_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*/
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_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*/
131typedef 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*/
150typedef 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*/
186typedef 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