M4VSS3GPP_Extended_API.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#ifndef __M4VSS3GPP_EXTENDED_API_H__
19#define __M4VSS3GPP_EXTENDED_API_H__
20
21/**
22 ******************************************************************************
23 * @file    M4VSS3GPP_Extended_API.h
24 * @brief    API of xVSS
25 * @note
26 ******************************************************************************
27*/
28
29#ifndef M4VSS_SUPPORT_EXTENDED_FEATURES
30#error "*** the flag M4VSS_SUPPORT_EXTENDED_FEATURES should be activated in CompilerSwitches\
31             for VideoStudio ***"
32#endif
33
34/**
35 ******************************************************************************
36 * prototype    M4xVSS_getTextRgbBufferFct
37 * @brief        External text to RGB buffer functions implemented by the integrator
38 *                must match this prototype.
39 * @note        The function is provided with the renderingData, the text buffer and
40 *                its size. It must build the output RGB image plane containing the text.
41 *
42 * @param   pRenderingData    (IN) The data given by the user in M4xVSS_EffectSettings
43 * @param    pTextBuffer        (IN) Text buffer given by the user in M4xVSS_EffectSettings
44 * @param    textBufferSize    (IN) Text buffer size given by the user in M4xVSS_EffectSettings
45 * @param    pOutputPlane    (IN/OUT) Output RGB565 image
46 * @return    M4NO_ERROR:            No error
47 * @return    M4ERR_PARAMETER:    At least one parameter is M4OSA_NULL (debug only)
48 ******************************************************************************
49*/
50typedef M4OSA_ERR (*M4xVSS_getTextRgbBufferFct)
51(
52    M4OSA_Void *pRenderingData,
53    M4OSA_Void *pTextBuffer,
54    M4OSA_UInt32 textBufferSize,
55    M4VIFI_ImagePlane **pOutputPlane
56);
57
58/**
59 ******************************************************************************
60 * struct    M4xVSS_BGMSettings
61 * @brief    This structure gathers all the information needed to add Background music to 3gp file
62 ******************************************************************************
63*/
64typedef struct
65{
66    M4OSA_Void                  *pFile;         /**< Input file path */
67    M4VIDEOEDITING_FileType     FileType;       /**< .3gp, .amr, .mp3     */
68    M4OSA_UInt32                uiAddCts;       /**< Time, in milliseconds, at which the added
69                                                      audio track is inserted */
70    M4OSA_UInt32                uiAddVolume;     /**< Volume, in percentage, of the added audio track */
71    M4OSA_UInt32                uiBeginLoop;    /**< Describes in milli-second the start time
72                                                     of the loop */
73    M4OSA_UInt32                uiEndLoop;      /**< Describes in milli-second the end time of the
74                                                     loop (0 means no loop) */
75    M4OSA_Bool                  b_DuckingNeedeed;
76    M4OSA_Int32                 InDucking_threshold;  /**< Threshold value at which background
77                                                            music shall duck */
78    M4OSA_Float                 lowVolume;       /**< lower the background track to this factor
79                                                 and increase the primary track to inverse of this factor */
80    M4OSA_Bool                  bLoop;
81    M4OSA_UInt32                uiSamplingFrequency;
82    M4OSA_UInt32                uiNumChannels;
83} M4xVSS_BGMSettings;
84
85
86/**
87 ******************************************************************************
88 * enum     M4VSS3GPP_VideoEffectType
89 * @brief   This enumeration defines the video effect types of the VSS3GPP
90 ******************************************************************************
91*/
92typedef enum
93{
94    M4VSS3GPP_kRGB888           = 0,  /**< RGB888 data type */
95    M4VSS3GPP_kRGB565           = 1  /**< RGB565 data type */
96
97} M4VSS3GPP_RGBType;
98
99/**
100 ******************************************************************************
101 * struct   M4xVSS_EffectSettings
102 * @brief   This structure defines an audio/video effect for the edition.
103 ******************************************************************************
104*/
105typedef struct
106{
107    /**< In percent of the cut clip duration */
108    M4OSA_UInt32               uiStartPercent;
109    /**< In percent of the ((clip duration) - (effect starttime)) */
110    M4OSA_UInt32               uiDurationPercent;
111    /**< Framing file path (GIF/PNG file), used only if VideoEffectType == framing */
112    M4OSA_Void                 *pFramingFilePath;
113    /**< Framing RGB565 buffer,  used only if VideoEffectType == framing */
114    M4VIFI_ImagePlane          *pFramingBuffer;
115    /**<RGB Buffer type,used only if VideoEffectType == framing */
116    M4VSS3GPP_RGBType          rgbType;
117    /**< The top-left X coordinate in the output picture where the added frame will be displayed.
118     Used only if VideoEffectType == framing || VideoEffectType == text */
119    M4OSA_UInt32               topleft_x;
120    /**< The top-left Y coordinate in the output picture where the added frame will be displayed.
121     Used only if VideoEffectType == framing || VideoEffectType == text */
122    M4OSA_UInt32               topleft_y;
123    /**< Does framing image is resized to output video size.
124     Used only if VideoEffectType == framing */
125    M4OSA_Bool                 bResize;
126    M4VIDEOEDITING_VideoFrameSize framingScaledSize;
127/**< Size to which the the framing file needs to be resized */
128    /**< Text buffer. Used only if VideoEffectType == text */
129    M4OSA_Void*                pTextBuffer;
130    /**< Text buffer size. Used only if VideoEffectType == text */
131    M4OSA_UInt32               textBufferSize;
132    /**< Pointer containing specific data used by the font engine (size, color...) */
133    M4OSA_Void*                pRenderingData;
134    /**< Text plane width. Used only if VideoEffectType == text */
135    M4OSA_UInt32               uiTextBufferWidth;
136    /**< Text plane height. Used only if VideoEffectType == text */
137    M4OSA_UInt32               uiTextBufferHeight;
138    /**< Processing rate of the effect added when using the Fifties effect */
139    M4OSA_UInt32               uiFiftiesOutFrameRate;
140    /**< RGB16 input color of the effect added when using the rgb16 color effect */
141    M4OSA_UInt16               uiRgb16InputColor;
142
143    M4OSA_UInt8                uialphaBlendingStart;       /*Start percentage of Alpha blending*/
144    M4OSA_UInt8                uialphaBlendingMiddle;      /*Middle percentage of Alpha blending*/
145    M4OSA_UInt8                uialphaBlendingEnd;         /*End percentage of Alpha blending*/
146    M4OSA_UInt8                uialphaBlendingFadeInTime;  /*Duration, in percentage of
147                                                            effect duration, of the FadeIn phase*/
148    M4OSA_UInt8                uialphaBlendingFadeOutTime;   /*Duration, in percentage of effect
149                                                                duration, of the FadeOut phase*/
150    M4OSA_UInt32                width;   /*width of the ARGB8888 clip .
151                                            Used only if video effect is framming */
152    M4OSA_UInt32                height; /*height of the ARGB8888 clip .
153                                            Used only if video effect is framming */
154} M4xVSS_EffectSettings;
155
156/**
157 ******************************************************************************
158 * struct    M4xVSS_AlphaMagicSettings
159 * @brief    This structure defines the alpha magic transition settings
160 ******************************************************************************
161*/
162typedef struct
163{
164    M4OSA_Void*            pAlphaFilePath;        /**< Alpha file path (JPG file)  */
165    M4OSA_Int32            blendingPercent;    /**< Blending Percentage between 0 and 100 */
166    M4OSA_Bool             isreverse;            /**< direct effect or reverse */
167    /*To support ARGB8888 : get the width and height */
168    M4OSA_UInt32            width;
169    M4OSA_UInt32            height;
170} M4xVSS_AlphaMagicSettings;
171
172/**
173 ******************************************************************************
174 * enum        M4xVSS_SlideTransition_Direction
175 * @brief    Defines directions for the slide transition
176 ******************************************************************************
177*/
178
179typedef enum {
180    M4xVSS_SlideTransition_RightOutLeftIn,
181    M4xVSS_SlideTransition_LeftOutRightIn,
182    M4xVSS_SlideTransition_TopOutBottomIn,
183    M4xVSS_SlideTransition_BottomOutTopIn
184} M4xVSS_SlideTransition_Direction;
185
186/**
187 ******************************************************************************
188 * struct    M4xVSS_AlphaMagicSettings
189 * @brief    This structure defines the slide transition settings
190 ******************************************************************************
191*/
192
193typedef struct
194{
195    M4xVSS_SlideTransition_Direction direction; /* direction of the slide */
196} M4xVSS_SlideTransitionSettings;
197
198/**
199 ******************************************************************************
200 * struct   M4xVSS_TransitionSettings
201 * @brief   This structure defines additional transition settings specific to
202 *            xVSS, which are appended to the VSS3GPP transition settings
203 *            structure.
204 ******************************************************************************
205*/
206typedef struct
207{
208    /* Anything xVSS-specific, but common to all transitions, would go here,
209    before the union. */
210    union {
211        /**< AlphaMagic settings, used only if VideoTransitionType ==
212            M4xVSS_kVideoTransitionType_AlphaMagic */
213        M4xVSS_AlphaMagicSettings        *pAlphaMagicSettings;
214        /* only in case of slide transition. */
215        M4xVSS_SlideTransitionSettings    *pSlideTransitionSettings;
216    } transitionSpecific;
217} M4xVSS_TransitionSettings;
218
219
220/**
221 ******************************************************************************
222 * enum        M4xVSS_MediaRendering
223 * @brief    This enum defines different media rendering using exif orientation
224 ******************************************************************************
225*/
226typedef enum
227{
228    M4xVSS_kResizing = 0,        /*The picture is resized, the aspect ratio can be different
229                                    from the original one. All of the picture is rendered*/
230    M4xVSS_kCropping,            /*The picture is cropped, the aspect ratio is the same as
231                                    the original one. The picture is not rendered entirely*/
232    M4xVSS_kBlackBorders        /*Black borders are rendered in order to keep the original
233                                    aspect ratio. All the picture is rendered*/
234
235} M4xVSS_MediaRendering;
236
237
238/**
239 ******************************************************************************
240 * struct   M4xVSS_ClipSettings
241 * @brief   This structure defines an input clip for the edition.
242 * @note    It also contains the settings for the cut and begin/end effects applied to the clip.
243 ******************************************************************************
244*/
245typedef struct
246{
247    M4OSA_UInt32                    uiBeginCutPercent;    /**< Begin cut time, in percent of clip
248                                                                duration (only for 3GPP clip !) */
249    M4OSA_UInt32                    uiEndCutPercent;    /**< End cut time, in percent of clip
250                                                             duration (only for 3GPP clip !) */
251    M4OSA_UInt32                    uiDuration;            /**< Duration of the clip, if different
252                                                                from 0, has priority on
253                                                                uiEndCutTime or uiEndCutPercent */
254    M4OSA_Bool                        isPanZoom;            /**< RC: Boolean used to know if the
255                                                                 pan and zoom mode is enabled */
256    M4OSA_UInt16                    PanZoomXa;            /**< RC */
257    M4OSA_UInt16                    PanZoomTopleftXa;    /**< RC */
258    M4OSA_UInt16                    PanZoomTopleftYa;    /**< RC */
259    M4OSA_UInt16                    PanZoomXb;            /**< RC */
260    M4OSA_UInt16                    PanZoomTopleftXb;    /**< RC */
261    M4OSA_UInt16                    PanZoomTopleftYb;    /**< RC */
262    M4xVSS_MediaRendering            MediaRendering;        /**< FB only used with JPEG: to crop,
263                                                                 resize, or render black borders*/
264
265} M4xVSS_ClipSettings;
266
267/**
268 ******************************************************************************
269 * struct   M4xVSS_EditSettings
270 * @brief   This structure gathers all the information needed to define a complete
271 *          edition operation
272 ******************************************************************************
273*/
274typedef struct
275{
276    /**< Output video size */
277    M4VIDEOEDITING_VideoFrameSize             outputVideoSize;
278    /**< Output video format (MPEG4 / H263) */
279    M4VIDEOEDITING_VideoFormat                outputVideoFormat;
280    /**< Output audio format (AAC, AMRNB ...) */
281    M4VIDEOEDITING_AudioFormat                outputAudioFormat;
282    /**< Output audio sampling freq (8000Hz,...) */
283    M4VIDEOEDITING_AudioSamplingFrequency     outputAudioSamplFreq;
284    /**< Maximum output file size in BYTES (if set to 0, no limit */
285    M4OSA_UInt32                              outputFileSize;
286    /**< Is output audio must be Mono ? Valid only for AAC */
287    M4OSA_Bool                                bAudioMono;
288    /**< Output video bitrate*/
289    M4OSA_UInt32                              outputVideoBitrate;
290    /**< Output audio bitrate*/
291    M4OSA_UInt32                              outputAudioBitrate;
292    /**< Background music track settings */
293    M4xVSS_BGMSettings                        *pBGMtrack;
294    /**< Function pointer on text rendering engine, if not used, must be set to NULL !! */
295    M4xVSS_getTextRgbBufferFct                pTextRenderingFct;
296
297} M4xVSS_EditSettings;
298
299#endif /* __M4VSS3GPP_EXTENDED_API_H__ */
300
301