M4READER_3gpCom.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 M4READER_3gpCom.h 20 * @brief Generic encapsulation of the core 3gp reader 21 * @note This file declares the generic shell interface retrieving function 22 * of the 3GP reader 23 ************************************************************************ 24*/ 25 26#ifndef __M4READER_3GPCOM_H__ 27#define __M4READER_3GPCOM_H__ 28 29#include "NXPSW_CompilerSwitches.h" 30 31#include "M4OSA_Types.h" 32#include "M4OSA_Error.h" 33#include "M4READER_Common.h" 34 35#ifdef __cplusplus 36extern "C" { 37#endif 38 39/** 40 * Error: Function M4READER_Com3GP_getNextStreamHandler must be called before. 41 */ 42#define M4ERR_NO_VIDEO_STREAM_RETRIEVED_YET M4OSA_ERR_CREATE(M4_ERR, M4READER_3GP, 0x000001) 43 44/** 45 * Error: No video stream H263 in file. 46 */ 47#define M4ERR_VIDEO_NOT_H263 M4OSA_ERR_CREATE(M4_ERR, M4READER_3GP, 0x000002) 48 49/** 50 * There has been a problem with the decoder configuration information, seems to be invalid */ 51#define M4ERR_READER3GP_DECODER_CONFIG_ERROR M4OSA_ERR_CREATE(M4_ERR, M4READER_3GP, 0x000003) 52 53#define M4READER_COM3GP_MAXVIDEOSTREAM 5 54#define M4READER_COM3GP_MAXAUDIOSTREAM 5 55#define M4READER_COM3GP_MAXTEXTSTREAM 5 56 57typedef struct 58{ 59 M4OSA_Context m_pFFContext; /**< core file format context */ 60 61 M4_StreamHandler* m_AudioStreams[M4READER_COM3GP_MAXAUDIOSTREAM]; 62 M4_StreamHandler* m_pAudioStream; /**< pointer to the current allocated audio 63 stream handler */ 64 65 M4_StreamHandler* m_VideoStreams[M4READER_COM3GP_MAXVIDEOSTREAM]; 66 M4_StreamHandler* m_pVideoStream; /**< pointer to the current allocated video 67 stream handler */ 68 69#ifdef M4VPS_SUPPORT_TTEXT 70 M4_StreamHandler* m_TextStreams[M4READER_COM3GP_MAXTEXTSTREAM]; 71 M4_StreamHandler* m_pTextStream; /**< pointer to the current allocated text 72 stream handler */ 73#endif /*M4VPS_SUPPORT_TTEXT*/ 74 75} M4READER_Com3GP_Context; 76 77/** 78 ************************************************************************ 79 * structure M4READER_3GP_Buffer (but nothing specific to 3GP, nor to a reader !) 80 * @brief This structure defines a buffer that can be used to exchange data (should be in OSAL) 81 ************************************************************************ 82*/ 83typedef struct 84{ 85 M4OSA_UInt32 size; /**< the size in bytes of the buffer */ 86 M4OSA_MemAddr8 dataAddress; /**< the pointer to the buffer */ 87} M4READER_3GP_Buffer; 88 89/** 90 ************************************************************************ 91 * enum M4READER_3GP_OptionID 92 * @brief This enum defines the reader options specific to the 3GP format. 93 * @note These options can be read from or written to a 3GP reader via M4READER_3GP_getOption. 94 ************************************************************************ 95*/ 96typedef enum 97{ 98 /** 99 * Get the DecoderConfigInfo for H263, 100 * option value must be a pointer to M4READER_3GP_H263Properties allocated by caller */ 101 M4READER_3GP_kOptionID_H263Properties = M4OSA_OPTION_ID_CREATE(M4_READ, M4READER_3GP, 0x01), 102 103 /** 104 * Get the Purple Labs drm information */ 105 M4READER_3GP_kOptionID_PurpleLabsDrm = M4OSA_OPTION_ID_CREATE(M4_READ, M4READER_3GP, 0x02), 106 107 /** 108 * Set the Fast open mode (Only the first AU of each stream will be parsed -> less CPU, 109 less RAM). */ 110 M4READER_3GP_kOptionID_FastOpenMode = M4OSA_OPTION_ID_CREATE(M4_WRITE, M4READER_3GP, 0x03), 111 112 /** 113 * Set the Audio only mode (the video stream won't be opened) */ 114 M4READER_3GP_kOptionID_AudioOnly = M4OSA_OPTION_ID_CREATE(M4_WRITE, M4READER_3GP, 0x04), 115 116 /** 117 * Set the Video only mode (the audio stream won't be opened) */ 118 M4READER_3GP_kOptionID_VideoOnly = M4OSA_OPTION_ID_CREATE(M4_WRITE, M4READER_3GP, 0x05), 119 120 /** 121 * Get the next video CTS */ 122 M4READER_3GP_kOptionID_getNextVideoCTS = M4OSA_OPTION_ID_CREATE(M4_READ, M4READER_3GP, 0x06) 123 124} M4READER_3GP_OptionID; 125 126 127/** 128 ************************************************************************ 129 * struct M4READER_3GP_H263Properties 130 * @brief Contains info about H263 stream read from the 3GP file. 131 ************************************************************************ 132*/ 133typedef struct 134{ 135 /**< the profile as defined in the Visual Object Sequence header, if present */ 136 M4OSA_UInt8 uiProfile; 137 /**< the level as defined in the Visual Object Sequence header, if present */ 138 M4OSA_UInt8 uiLevel; 139 140} M4READER_3GP_H263Properties; 141 142/** 143 ************************************************************************ 144 * @brief Get the next stream found in the 3gp file 145 * @note 146 * @param pContext: (IN) Context of the reader 147 * @param pMediaFamily: (OUT) Pointer to a user allocated M4READER_MediaFamily that will 148 * be filled with the media family of the found stream 149 * @param pStreamHandler: (OUT) Pointer to a stream handler that will be allocated and 150 * filled with the found stream description 151 * @return M4NO_ERROR There is no error 152 * @return M4ERR_PARAMETER At least one parameter is not properly set 153 * @return M4WAR_NO_MORE_STREAM No more available stream in the media (all streams found) 154 ************************************************************************ 155*/ 156M4OSA_ERR M4READER_Com3GP_getNextStreamHandler(M4OSA_Context context, 157 M4READER_MediaFamily *pMediaFamily, 158 M4_StreamHandler **pStreamHandler); 159 160/** 161 ************************************************************************ 162 * @brief Prepare the access unit (AU) 163 * @note An AU is the smallest possible amount of data to be decoded by a decoder. 164 * @param pContext: (IN) Context of the reader 165 * @param pStreamHandler (IN) The stream handler of the stream to make jump 166 * @param pAccessUnit (IN/OUT) Pointer to an access unit to fill with read data 167 * (the au structure is allocated by the user, and must 168 * be initialized by calling M4READER_fillAuStruct_fct 169 * after creation) 170 * @return M4NO_ERROR There is no error 171 * @return M4ERR_PARAMETER At least one parameter is not properly set 172 * @returns M4ERR_ALLOC Memory allocation failed 173 ************************************************************************ 174*/ 175M4OSA_ERR M4READER_Com3GP_fillAuStruct(M4OSA_Context context, M4_StreamHandler *pStreamHandler, 176 M4_AccessUnit *pAccessUnit); 177 178/** 179 ************************************************************************ 180 * @brief Cleans up the stream handler 181 * @param pContext: (IN/OUT) Context of the reader shell 182 * @param pStreamHandler: (IN/OUT) Stream handler 183 * @return M4ERR_PARAMETER: The context is null 184 * @return M4NO_ERROR: No error 185 ************************************************************************ 186*/ 187M4OSA_ERR M4READER_Com3GP_cleanUpHandler(M4_StreamHandler* pStreamHandler); 188 189#ifdef __cplusplus 190} 191#endif /* __cplusplus */ 192 193#endif /* __M4READER_3GPCOM_H__ */ 194 195