M4MP4W_Utils.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 ****************************************************************************** 20 * @file M4MP4W_Utils.h 21 * @brief Utilities and private functions declaration for the MP4 writer 22 ****************************************************************************** 23 */ 24 25#ifndef M4MP4W_UTILS_H 26#define M4MP4W_UTILS_H 27 28#ifdef __cplusplus 29extern "C" { 30#endif /* __cplusplus */ 31 32#include "NXPSW_CompilerSwitches.h" 33 34#ifndef _M4MP4W_USE_CST_MEMORY_WRITER 35 36/* includes */ 37#include "M4OSA_Types.h" 38#include "M4OSA_FileWriter.h" 39 40 41/** 42 ****************************************************************************** 43 * Utility functions to write data in big endian 44 ****************************************************************************** 45 */ 46M4OSA_ERR M4MP4W_putByte(M4OSA_UChar c, M4OSA_FileWriterPointer* fileFunction, 47 M4OSA_Context context); 48M4OSA_ERR M4MP4W_putBE16(M4OSA_UInt32 val, M4OSA_FileWriterPointer* fileFunction, 49 M4OSA_Context context); 50M4OSA_ERR M4MP4W_putBE24(M4OSA_UInt32 val, M4OSA_FileWriterPointer* fileFunction, 51 M4OSA_Context context); 52M4OSA_ERR M4MP4W_putBE32(M4OSA_UInt32 val, M4OSA_FileWriterPointer* fileFunction, 53 M4OSA_Context context); 54 55/** 56 ****************************************************************************** 57 * Write a bulk of data into the specified file, size is given in bytes 58 ****************************************************************************** 59 */ 60M4OSA_ERR M4MP4W_putBlock(const M4OSA_UChar* Block, M4OSA_UInt32 size, 61 M4OSA_FileWriterPointer* fileFunction, M4OSA_Context context); 62 63/** 64 ****************************************************************************** 65 * Convert the 'nb' unsigned integers in 'tab' table from LE into BE 66 ****************************************************************************** 67 */ 68void M4MP4W_table32ToBE(M4OSA_UInt32* tab, M4OSA_UInt32 nb); 69 70/** 71 ****************************************************************************** 72 * Convert an unsigned 32 bits integer from LE into BE 73 ****************************************************************************** 74 */ 75void M4MP4W_convertInt32BE(M4OSA_UInt32* valPtr); 76 77/** 78 ****************************************************************************** 79 * Re-allocation function 80 ****************************************************************************** 81 */ 82void* M4MP4W_realloc(M4OSA_MemAddr32 ptr, M4OSA_UInt32 oldSize, M4OSA_UInt32 newSize); 83 84/** 85 ****************************************************************************** 86 * De-allocate the context 87 * This method is no longer in the writer external interface, but is called from 88 * the function M4MP4W_closeWrite 89 ****************************************************************************** 90 */ 91M4OSA_ERR M4MP4W_freeContext(M4OSA_Context context); 92 93 94#ifdef _M4MP4W_OPTIMIZE_FOR_PHONE 95/** 96 ****************************************************************************** 97 * Put Hi and Lo u16 part in a u32 variable 98 ****************************************************************************** 99 */ 100M4OSA_Void M4MP4W_put32_Hi(M4OSA_UInt32* tab, M4OSA_UInt16 Hi); 101M4OSA_Void M4MP4W_put32_Lo(M4OSA_UInt32* tab, M4OSA_UInt16 Lo); 102M4OSA_UInt16 M4MP4W_get32_Hi(M4OSA_UInt32* tab); 103M4OSA_UInt16 M4MP4W_get32_Lo(M4OSA_UInt32* tab); 104#endif 105 106#endif /* _M4MP4W_USE_CST_MEMORY_WRITER */ 107 108#ifdef __cplusplus 109} 110#endif /* __cplusplus */ 111 112#endif /*M4MP4W_UTILS_H*/ 113 114