summaryrefslogtreecommitdiffstats
path: root/libvideoeditor/vss/3gpwriter/inc/M4MP4W_Utils.h
blob: fbe7abbf26f886cade24aaa3b17b299f40595e4e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
/*
 * Copyright (C) 2011 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

/**
 ******************************************************************************
 * @file    M4MP4W_Utils.h
 * @brief   Utilities and private functions declaration for the MP4 writer
 ******************************************************************************
 */

#ifndef M4MP4W_UTILS_H
#define M4MP4W_UTILS_H

#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */

#include "NXPSW_CompilerSwitches.h"

#ifndef _M4MP4W_USE_CST_MEMORY_WRITER

/* includes */
#include "M4OSA_Types.h"
#include "M4OSA_FileWriter.h"


/**
 ******************************************************************************
 * Utility functions to write data in big endian
 ******************************************************************************
 */
M4OSA_ERR M4MP4W_putByte(M4OSA_UChar c,    M4OSA_FileWriterPointer* fileFunction,
                         M4OSA_Context context);
M4OSA_ERR M4MP4W_putBE16(M4OSA_UInt32 val, M4OSA_FileWriterPointer* fileFunction,
                         M4OSA_Context context);
M4OSA_ERR M4MP4W_putBE24(M4OSA_UInt32 val, M4OSA_FileWriterPointer* fileFunction,
                         M4OSA_Context context);
M4OSA_ERR M4MP4W_putBE32(M4OSA_UInt32 val, M4OSA_FileWriterPointer* fileFunction,
                         M4OSA_Context context);

/**
 ******************************************************************************
 * Write a bulk of data into the specified file, size is given in bytes
 ******************************************************************************
 */
M4OSA_ERR M4MP4W_putBlock(const M4OSA_UChar* Block, M4OSA_UInt32 size,
                          M4OSA_FileWriterPointer* fileFunction, M4OSA_Context context);

/**
 ******************************************************************************
 * Convert the 'nb' unsigned integers in 'tab' table from LE into BE
 ******************************************************************************
 */
void M4MP4W_table32ToBE(M4OSA_UInt32* tab, M4OSA_UInt32 nb);

/**
 ******************************************************************************
 * Convert an unsigned 32 bits integer from LE into BE
 ******************************************************************************
 */
void M4MP4W_convertInt32BE(M4OSA_UInt32* valPtr);

/**
 ******************************************************************************
 * Re-allocation function
 ******************************************************************************
 */
void* M4MP4W_realloc(M4OSA_MemAddr32 ptr, M4OSA_UInt32 oldSize, M4OSA_UInt32 newSize);

/**
 ******************************************************************************
 * De-allocate the context
 * This method is no longer in the writer external interface, but is called from
 * the function M4MP4W_closeWrite
 ******************************************************************************
 */
M4OSA_ERR M4MP4W_freeContext(M4OSA_Context context);


#ifdef _M4MP4W_OPTIMIZE_FOR_PHONE
/**
 ******************************************************************************
 * Put Hi and Lo u16 part in a u32 variable
 ******************************************************************************
 */
M4OSA_Void M4MP4W_put32_Hi(M4OSA_UInt32* tab, M4OSA_UInt16 Hi);
M4OSA_Void M4MP4W_put32_Lo(M4OSA_UInt32* tab, M4OSA_UInt16 Lo);
M4OSA_UInt16 M4MP4W_get32_Hi(M4OSA_UInt32* tab);
M4OSA_UInt16 M4MP4W_get32_Lo(M4OSA_UInt32* tab);
#endif

#endif /* _M4MP4W_USE_CST_MEMORY_WRITER */

#ifdef __cplusplus
}
#endif /* __cplusplus */

#endif /*M4MP4W_UTILS_H*/