blob: ea73e117bafe691b87e3de526ce3582614e628e6 [file] [log] [blame]
Dharmaray Kundargicd196d32011-01-16 15:47:16 -08001/*
2 * Copyright (C) 2011 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17
18#include <VideoEditorClasses.h>
19#include <VideoEditorJava.h>
20#include <VideoEditorLogging.h>
21#include <VideoEditorOsal.h>
22
23extern "C" {
24#include <M4OSA_Clock.h>
25#include <M4OSA_CharStar.h>
26#include <M4OSA_FileCommon.h>
27#include <M4OSA_FileReader.h>
28#include <M4OSA_FileWriter.h>
29#include <M4OSA_Memory.h>
30#include <M4OSA_Debug.h>
31#include <M4OSA_String.h>
32#include <M4OSA_Thread.h>
33#include <M4VSS3GPP_API.h>
34#include <M4xVSS_API.h>
35#include <M4VSS3GPP_ErrorCodes.h>
36#include <M4MCS_ErrorCodes.h>
37#include <M4READER_Common.h>
38#include <M4WRITER_common.h>
39#include <M4DECODER_Common.h>
40};
41
42#define VIDEOEDIT_PROP_JAVA_RESULT_STRING_MAX (128)
43
44#define VIDEOEDIT_JAVA__RESULT_STRING_MAX (128)
45
46VIDEOEDIT_JAVA_DEFINE_CONSTANTS(AudioEffect)
47{
48 VIDEOEDIT_JAVA_CONSTANT_INIT("NONE", M4VSS3GPP_kAudioEffectType_None),
49 VIDEOEDIT_JAVA_CONSTANT_INIT("FADE_IN", M4VSS3GPP_kAudioEffectType_FadeIn),
50 VIDEOEDIT_JAVA_CONSTANT_INIT("FADE_OUT", M4VSS3GPP_kAudioEffectType_FadeOut)
51};
52
53VIDEOEDIT_JAVA_DEFINE_CONSTANT_CLASS(AudioEffect, AUDIO_EFFECT_CLASS_NAME, M4OSA_NULL, M4OSA_NULL)
54
55
56VIDEOEDIT_JAVA_DEFINE_CONSTANTS(AudioFormat)
57{
58 VIDEOEDIT_JAVA_CONSTANT_INIT("NO_AUDIO", M4VIDEOEDITING_kNoneAudio),
59 VIDEOEDIT_JAVA_CONSTANT_INIT("AMR_NB", M4VIDEOEDITING_kAMR_NB),
60 VIDEOEDIT_JAVA_CONSTANT_INIT("AAC", M4VIDEOEDITING_kAAC),
61 VIDEOEDIT_JAVA_CONSTANT_INIT("AAC_PLUS", M4VIDEOEDITING_kAACplus),
62 VIDEOEDIT_JAVA_CONSTANT_INIT("ENHANCED_AAC_PLUS", M4VIDEOEDITING_keAACplus),
63 VIDEOEDIT_JAVA_CONSTANT_INIT("MP3", M4VIDEOEDITING_kMP3),
64 VIDEOEDIT_JAVA_CONSTANT_INIT("EVRC", M4VIDEOEDITING_kEVRC),
65 VIDEOEDIT_JAVA_CONSTANT_INIT("PCM", M4VIDEOEDITING_kPCM),
66 VIDEOEDIT_JAVA_CONSTANT_INIT("NULL_AUDIO", M4VIDEOEDITING_kNullAudio),
67 VIDEOEDIT_JAVA_CONSTANT_INIT("UNSUPPORTED_AUDIO", M4VIDEOEDITING_kUnsupportedAudio)
68};
69
70VIDEOEDIT_JAVA_DEFINE_CONSTANT_CLASS(AudioFormat, AUDIO_FORMAT_CLASS_NAME, M4OSA_NULL, M4OSA_NULL)
71
72
73VIDEOEDIT_JAVA_DEFINE_CONSTANTS(AudioSamplingFrequency)
74{
75 VIDEOEDIT_JAVA_CONSTANT_INIT("FREQ_DEFAULT", M4VIDEOEDITING_kDefault_ASF),
76 VIDEOEDIT_JAVA_CONSTANT_INIT("FREQ_8000", M4VIDEOEDITING_k8000_ASF),
77 VIDEOEDIT_JAVA_CONSTANT_INIT("FREQ_16000", M4VIDEOEDITING_k16000_ASF),
78 VIDEOEDIT_JAVA_CONSTANT_INIT("FREQ_22050", M4VIDEOEDITING_k22050_ASF),
79 VIDEOEDIT_JAVA_CONSTANT_INIT("FREQ_24000", M4VIDEOEDITING_k24000_ASF),
80 VIDEOEDIT_JAVA_CONSTANT_INIT("FREQ_32000", M4VIDEOEDITING_k32000_ASF),
81 VIDEOEDIT_JAVA_CONSTANT_INIT("FREQ_44100", M4VIDEOEDITING_k44100_ASF),
82 VIDEOEDIT_JAVA_CONSTANT_INIT("FREQ_48000", M4VIDEOEDITING_k48000_ASF)
83};
84
85VIDEOEDIT_JAVA_DEFINE_CONSTANT_CLASS(AudioSamplingFrequency,AUDIO_SAMPLING_FREQUENCY_CLASS_NAME,
86 M4OSA_NULL, M4OSA_NULL)
87
88
89VIDEOEDIT_JAVA_DEFINE_CONSTANTS(AudioTransition)
90{
91 VIDEOEDIT_JAVA_CONSTANT_INIT("NONE", M4VSS3GPP_kAudioTransitionType_None),
92 VIDEOEDIT_JAVA_CONSTANT_INIT("CROSS_FADE", M4VSS3GPP_kAudioTransitionType_CrossFade)
93};
94
95VIDEOEDIT_JAVA_DEFINE_CONSTANT_CLASS(AudioTransition, AUDIO_TRANSITION_CLASS_NAME, M4OSA_NULL,
96 M4OSA_NULL)
97
98
99static const char*
100videoEditClasses_getUnknownBitrateString(int bitrate)
101{
102 static char string[VIDEOEDIT_JAVA__RESULT_STRING_MAX] = "";
103
104 M4OSA_chrSPrintf((M4OSA_Char *)string, sizeof(string) - 1, (M4OSA_Char*)"%d", bitrate);
105
106 // Return the bitrate string.
107 return(string);
108}
109
110VIDEOEDIT_JAVA_DEFINE_CONSTANTS(Bitrate)
111{
112 VIDEOEDIT_JAVA_CONSTANT_INIT("VARIABLE", M4VIDEOEDITING_kVARIABLE_KBPS),
113 VIDEOEDIT_JAVA_CONSTANT_INIT("UNDEFINED", M4VIDEOEDITING_kUndefinedBitrate),
114 VIDEOEDIT_JAVA_CONSTANT_INIT("BR_9_2_KBPS", M4VIDEOEDITING_k9_2_KBPS),
115 VIDEOEDIT_JAVA_CONSTANT_INIT("BR_12_2_KBPS", M4VIDEOEDITING_k12_2_KBPS),
116 VIDEOEDIT_JAVA_CONSTANT_INIT("BR_16_KBPS", M4VIDEOEDITING_k16_KBPS),
117 VIDEOEDIT_JAVA_CONSTANT_INIT("BR_24_KBPS", M4VIDEOEDITING_k24_KBPS),
118 VIDEOEDIT_JAVA_CONSTANT_INIT("BR_32_KBPS", M4VIDEOEDITING_k32_KBPS),
119 VIDEOEDIT_JAVA_CONSTANT_INIT("BR_48_KBPS", M4VIDEOEDITING_k48_KBPS),
120 VIDEOEDIT_JAVA_CONSTANT_INIT("BR_64_KBPS", M4VIDEOEDITING_k64_KBPS),
121 VIDEOEDIT_JAVA_CONSTANT_INIT("BR_96_KBPS", M4VIDEOEDITING_k96_KBPS),
122 VIDEOEDIT_JAVA_CONSTANT_INIT("BR_128_KBPS", M4VIDEOEDITING_k128_KBPS),
123 VIDEOEDIT_JAVA_CONSTANT_INIT("BR_192_KBPS", M4VIDEOEDITING_k192_KBPS),
124 VIDEOEDIT_JAVA_CONSTANT_INIT("BR_256_KBPS", M4VIDEOEDITING_k256_KBPS),
125 VIDEOEDIT_JAVA_CONSTANT_INIT("BR_288_KBPS", M4VIDEOEDITING_k288_KBPS),
126 VIDEOEDIT_JAVA_CONSTANT_INIT("BR_384_KBPS", M4VIDEOEDITING_k384_KBPS),
127 VIDEOEDIT_JAVA_CONSTANT_INIT("BR_512_KBPS", M4VIDEOEDITING_k512_KBPS),
128 VIDEOEDIT_JAVA_CONSTANT_INIT("BR_800_KBPS", M4VIDEOEDITING_k800_KBPS),
129/*+ New Encoder bitrates */
130 VIDEOEDIT_JAVA_CONSTANT_INIT("BR_2_MBPS", M4VIDEOEDITING_k2_MBPS),
131 VIDEOEDIT_JAVA_CONSTANT_INIT("BR_5_MBPS", M4VIDEOEDITING_k5_MBPS),
132 VIDEOEDIT_JAVA_CONSTANT_INIT("BR_8_MBPS", M4VIDEOEDITING_k8_MBPS)
133/*- New Encoder bitrates */
134};
135
136VIDEOEDIT_JAVA_DEFINE_CONSTANT_CLASS(Bitrate, BITRATE_CLASS_NAME,
137 videoEditClasses_getUnknownBitrateString, videoEditClasses_getUnknownBitrateString)
138
139
140VIDEOEDIT_JAVA_DEFINE_CONSTANTS(ClipType)
141{
142 VIDEOEDIT_JAVA_CONSTANT_INIT("THREE_GPP", M4VIDEOEDITING_kFileType_3GPP),
143 VIDEOEDIT_JAVA_CONSTANT_INIT("MP4", M4VIDEOEDITING_kFileType_MP4),
144 VIDEOEDIT_JAVA_CONSTANT_INIT("AMR", M4VIDEOEDITING_kFileType_AMR),
145 VIDEOEDIT_JAVA_CONSTANT_INIT("MP3", M4VIDEOEDITING_kFileType_MP3),
146 VIDEOEDIT_JAVA_CONSTANT_INIT("PCM", M4VIDEOEDITING_kFileType_PCM),
147 VIDEOEDIT_JAVA_CONSTANT_INIT("JPG", M4VIDEOEDITING_kFileType_JPG),
Dharmaray Kundargi4e703202011-01-29 20:48:05 -0800148 VIDEOEDIT_JAVA_CONSTANT_INIT("M4V", M4VIDEOEDITING_kFileType_M4V),
Dharmaray Kundargicd196d32011-01-16 15:47:16 -0800149 VIDEOEDIT_JAVA_CONSTANT_INIT("UNSUPPORTED", M4VIDEOEDITING_kFileType_Unsupported)
150};
151
152VIDEOEDIT_JAVA_DEFINE_CONSTANT_CLASS(ClipType, FILE_TYPE_CLASS_NAME, M4OSA_NULL, M4OSA_NULL)
153
154
155VIDEOEDIT_JAVA_DEFINE_CONSTANTS(Engine)
156{
157 VIDEOEDIT_JAVA_CONSTANT_INIT("TASK_LOADING_SETTINGS", TASK_LOADING_SETTINGS),
158 VIDEOEDIT_JAVA_CONSTANT_INIT("TASK_ENCODING", TASK_ENCODING)
159};
160
161VIDEOEDIT_JAVA_DEFINE_CONSTANT_CLASS(Engine, MANUAL_EDIT_ENGINE_CLASS_NAME, M4OSA_NULL,
162 M4OSA_NULL)
163
164
165static const char*
166videoEditClasses_getUnknownErrorName(int error)
167{
168 static char string[VIDEOEDIT_JAVA__RESULT_STRING_MAX] = "ERR_INTERNAL";
169
170 // Format the unknown error string.
171 M4OSA_chrSPrintf((M4OSA_Char *)string, sizeof(string) - 1, (M4OSA_Char*)"ERR_INTERNAL(%s)",
172 videoEditOsal_getResultString(error));
173
174 // Return the error string.
175 return(string);
176}
177
178static const char*
179videoEditClasses_getUnknownErrorString(int error)
180{
181 // Return the result string.
182 return(videoEditOsal_getResultString(error));
183}
184
185VIDEOEDIT_JAVA_DEFINE_CONSTANTS(Error)
186{
187 // M4OSA_Clock.h
188 VIDEOEDIT_JAVA_CONSTANT_INIT("WAR_TIMESCALE_TOO_BIG", \
189 M4WAR_TIMESCALE_TOO_BIG ),
190 VIDEOEDIT_JAVA_CONSTANT_INIT("ERR_CLOCK_BAD_REF_YEAR", \
191 M4ERR_CLOCK_BAD_REF_YEAR ),
192 VIDEOEDIT_JAVA_CONSTANT_INIT("ERR_FILE_NOT_FOUND", \
193 M4ERR_FILE_NOT_FOUND ),
194 VIDEOEDIT_JAVA_CONSTANT_INIT("WAR_TRANSCODING_NECESSARY", \
195 M4VSS3GPP_WAR_TRANSCODING_NECESSARY ),
196 VIDEOEDIT_JAVA_CONSTANT_INIT("WAR_MAX_OUTPUT_SIZE_EXCEEDED", \
197 M4VSS3GPP_WAR_OUTPUTFILESIZE_EXCEED ),
198 VIDEOEDIT_JAVA_CONSTANT_INIT("ERR_BUFFER_OUT_TOO_SMALL", \
199 M4xVSSWAR_BUFFER_OUT_TOO_SMALL ),
200 VIDEOEDIT_JAVA_CONSTANT_INIT("ERR_NOMORE_SPACE_FOR_FILE", \
201 M4xVSSERR_NO_MORE_SPACE ),
202 VIDEOEDIT_JAVA_CONSTANT_INIT("ERR_INVALID_FILE_TYPE", \
203 M4VSS3GPP_ERR_INVALID_FILE_TYPE ),
204 VIDEOEDIT_JAVA_CONSTANT_INIT("ERR_INVALID_EFFECT_KIND", \
205 M4VSS3GPP_ERR_INVALID_EFFECT_KIND ),
206 VIDEOEDIT_JAVA_CONSTANT_INIT("ERR_INVALID_VIDEO_EFFECT_TYPE", \
207 M4VSS3GPP_ERR_INVALID_VIDEO_EFFECT_TYPE ),
208 VIDEOEDIT_JAVA_CONSTANT_INIT("ERR_INVALID_AUDIO_EFFECT_TYPE", \
209 M4VSS3GPP_ERR_INVALID_AUDIO_EFFECT_TYPE ),
210 VIDEOEDIT_JAVA_CONSTANT_INIT("ERR_INVALID_VIDEO_TRANSITION_TYPE", \
211 M4VSS3GPP_ERR_INVALID_VIDEO_TRANSITION_TYPE ),
212 VIDEOEDIT_JAVA_CONSTANT_INIT("ERR_INVALID_AUDIO_TRANSITION_TYPE", \
213 M4VSS3GPP_ERR_INVALID_AUDIO_TRANSITION_TYPE ),
214 VIDEOEDIT_JAVA_CONSTANT_INIT("ERR_INVALID_VIDEO_ENCODING_FRAME_RATE", \
215 M4VSS3GPP_ERR_INVALID_VIDEO_ENCODING_FRAME_RATE ),
216 VIDEOEDIT_JAVA_CONSTANT_INIT("ERR_EXTERNAL_EFFECT_NULL", \
217 M4VSS3GPP_ERR_EXTERNAL_EFFECT_NULL ),
218 VIDEOEDIT_JAVA_CONSTANT_INIT("ERR_EXTERNAL_TRANSITION_NULL", \
219 M4VSS3GPP_ERR_EXTERNAL_TRANSITION_NULL ),
220 VIDEOEDIT_JAVA_CONSTANT_INIT("ERR_BEGIN_CUT_LARGER_THAN_DURATION", \
221 M4VSS3GPP_ERR_BEGIN_CUT_LARGER_THAN_DURATION ),
222 VIDEOEDIT_JAVA_CONSTANT_INIT("ERR_BEGIN_CUT_LARGER_THAN_END_CUT", \
223 M4VSS3GPP_ERR_BEGIN_CUT_LARGER_THAN_END_CUT ),
224 VIDEOEDIT_JAVA_CONSTANT_INIT("ERR_OVERLAPPING_TRANSITIONS", \
225 M4VSS3GPP_ERR_OVERLAPPING_TRANSITIONS ),
226#ifdef M4VSS3GPP_ERR_ANALYSIS_DATA_SIZE_TOO_SMALL
227 VIDEOEDIT_JAVA_CONSTANT_INIT("ERR_ANALYSIS_DATA_SIZE_TOO_SMALL", \
228 M4VSS3GPP_ERR_ANALYSIS_DATA_SIZE_TOO_SMALL ),
229#endif
230 VIDEOEDIT_JAVA_CONSTANT_INIT("ERR_INVALID_3GPP_FILE", \
231 M4VSS3GPP_ERR_INVALID_3GPP_FILE ),
232 VIDEOEDIT_JAVA_CONSTANT_INIT("ERR_UNSUPPORTED_INPUT_VIDEO_FORMAT", \
233 M4VSS3GPP_ERR_UNSUPPORTED_INPUT_VIDEO_FORMAT ),
234 VIDEOEDIT_JAVA_CONSTANT_INIT("ERR_UNSUPPORTED_INPUT_AUDIO_FORMAT", \
235 M4VSS3GPP_ERR_UNSUPPORTED_INPUT_AUDIO_FORMAT ),
236 VIDEOEDIT_JAVA_CONSTANT_INIT("ERR_AMR_EDITING_UNSUPPORTED", \
237 M4VSS3GPP_ERR_AMR_EDITING_UNSUPPORTED ),
238 VIDEOEDIT_JAVA_CONSTANT_INIT("ERR_INPUT_VIDEO_AU_TOO_LARGE", \
239 M4VSS3GPP_ERR_INPUT_VIDEO_AU_TOO_LARGE ),
240 VIDEOEDIT_JAVA_CONSTANT_INIT("ERR_INPUT_AUDIO_AU_TOO_LARGE", \
241 M4VSS3GPP_ERR_INPUT_AUDIO_AU_TOO_LARGE ),
242 VIDEOEDIT_JAVA_CONSTANT_INIT("ERR_INPUT_AUDIO_CORRUPTED_AU", \
243 M4VSS3GPP_ERR_INPUT_AUDIO_CORRUPTED_AU ),
244#ifdef M4VSS3GPP_ERR_INPUT_AUDIO_CORRUPTED_AMR_AU
245 VIDEOEDIT_JAVA_CONSTANT_INIT("ERR_INPUT_AUDIO_CORRUPTED_AU", \
246 M4VSS3GPP_ERR_INPUT_AUDIO_CORRUPTED_AMR_AU ),
247#endif
248 VIDEOEDIT_JAVA_CONSTANT_INIT("ERR_ENCODER_ACCES_UNIT_ERROR", \
249 M4VSS3GPP_ERR_ENCODER_ACCES_UNIT_ERROR ),
250 VIDEOEDIT_JAVA_CONSTANT_INIT("ERR_EDITING_UNSUPPORTED_VIDEO_FORMAT", \
251 M4VSS3GPP_ERR_EDITING_UNSUPPORTED_VIDEO_FORMAT ),
252 VIDEOEDIT_JAVA_CONSTANT_INIT("ERR_EDITING_UNSUPPORTED_H263_PROFILE", \
253 M4VSS3GPP_ERR_EDITING_UNSUPPORTED_H263_PROFILE ),
254 VIDEOEDIT_JAVA_CONSTANT_INIT("ERR_EDITING_UNSUPPORTED_MPEG4_PROFILE", \
255 M4VSS3GPP_ERR_EDITING_UNSUPPORTED_MPEG4_PROFILE ),
256 VIDEOEDIT_JAVA_CONSTANT_INIT("ERR_EDITING_UNSUPPORTED_MPEG4_RVLC", \
257 M4VSS3GPP_ERR_EDITING_UNSUPPORTED_MPEG4_RVLC ),
258 VIDEOEDIT_JAVA_CONSTANT_INIT("ERR_EDITING_UNSUPPORTED_AUDIO_FORMAT", \
259 M4VSS3GPP_ERR_EDITING_UNSUPPORTED_AUDIO_FORMAT ),
260 VIDEOEDIT_JAVA_CONSTANT_INIT("ERR_EDITING_NO_SUPPORTED_STREAM_IN_FILE", \
261 M4VSS3GPP_ERR_EDITING_NO_SUPPORTED_STREAM_IN_FILE ),
262 VIDEOEDIT_JAVA_CONSTANT_INIT("ERR_EDITING_NO_SUPPORTED_VIDEO_STREAM_IN_FILE",\
263 M4VSS3GPP_ERR_EDITING_NO_SUPPORTED_VIDEO_STREAM_IN_FILE),
264 VIDEOEDIT_JAVA_CONSTANT_INIT("ERR_INVALID_CLIP_ANALYSIS_VERSION", \
265 M4VSS3GPP_ERR_INVALID_CLIP_ANALYSIS_VERSION ),
266#ifdef M4VSS3GPP_ERR_INVALID_CLIP_ANALYSIS_PLATFORM
267 VIDEOEDIT_JAVA_CONSTANT_INIT("ERR_INVALID_CLIP_ANALYSIS_PLATFORM", \
268 M4VSS3GPP_ERR_INVALID_CLIP_ANALYSIS_PLATFORM ),
269#endif
270 VIDEOEDIT_JAVA_CONSTANT_INIT("ERR_INCOMPATIBLE_VIDEO_FORMAT", \
271 M4VSS3GPP_ERR_INCOMPATIBLE_VIDEO_FORMAT ),
272 VIDEOEDIT_JAVA_CONSTANT_INIT("ERR_INCOMPATIBLE_VIDEO_FRAME_SIZE", \
273 M4VSS3GPP_ERR_INCOMPATIBLE_VIDEO_FRAME_SIZE ),
274 VIDEOEDIT_JAVA_CONSTANT_INIT("ERR_INCOMPATIBLE_VIDEO_TIME_SCALE", \
275 M4VSS3GPP_ERR_INCOMPATIBLE_VIDEO_TIME_SCALE ),
276 VIDEOEDIT_JAVA_CONSTANT_INIT("ERR_INCOMPATIBLE_VIDEO_DATA_PARTITIONING", \
277 M4VSS3GPP_ERR_INCOMPATIBLE_VIDEO_DATA_PARTITIONING ),
278 VIDEOEDIT_JAVA_CONSTANT_INIT("ERR_UNSUPPORTED_MP3_ASSEMBLY", \
279 M4VSS3GPP_ERR_UNSUPPORTED_MP3_ASSEMBLY ),
280 VIDEOEDIT_JAVA_CONSTANT_INIT("ERR_NO_SUPPORTED_STREAM_IN_FILE", \
281 M4VSS3GPP_ERR_NO_SUPPORTED_STREAM_IN_FILE ),
282 VIDEOEDIT_JAVA_CONSTANT_INIT("ERR_ADDVOLUME_EQUALS_ZERO", \
283 M4VSS3GPP_ERR_ADDVOLUME_EQUALS_ZERO ),
284 VIDEOEDIT_JAVA_CONSTANT_INIT("ERR_ADDCTS_HIGHER_THAN_VIDEO_DURATION", \
285 M4VSS3GPP_ERR_ADDCTS_HIGHER_THAN_VIDEO_DURATION ),
286 VIDEOEDIT_JAVA_CONSTANT_INIT("ERR_UNDEFINED_AUDIO_TRACK_FILE_FORMAT", \
287 M4VSS3GPP_ERR_UNDEFINED_AUDIO_TRACK_FILE_FORMAT ),
288 VIDEOEDIT_JAVA_CONSTANT_INIT("ERR_UNSUPPORTED_ADDED_AUDIO_STREAM", \
289 M4VSS3GPP_ERR_UNSUPPORTED_ADDED_AUDIO_STREAM ),
290 VIDEOEDIT_JAVA_CONSTANT_INIT("ERR_AUDIO_MIXING_UNSUPPORTED", \
291 M4VSS3GPP_ERR_AUDIO_MIXING_UNSUPPORTED ),
292#ifdef M4VSS3GPP_ERR_AUDIO_MIXING_MP3_UNSUPPORTED
293 VIDEOEDIT_JAVA_CONSTANT_INIT("ERR_AUDIO_MIXING_MP3_UNSUPPORTED", \
294 M4VSS3GPP_ERR_AUDIO_MIXING_MP3_UNSUPPORTED ),
295#endif
296 VIDEOEDIT_JAVA_CONSTANT_INIT("ERR_FEATURE_UNSUPPORTED_WITH_AUDIO_TRACK", \
297 M4VSS3GPP_ERR_FEATURE_UNSUPPORTED_WITH_AUDIO_TRACK ),
298#ifdef M4VSS3GPP_ERR_FEATURE_UNSUPPORTED_WITH_AAC
299 VIDEOEDIT_JAVA_CONSTANT_INIT("ERR_FEATURE_UNSUPPORTED_WITH_AAC", \
300 M4VSS3GPP_ERR_FEATURE_UNSUPPORTED_WITH_AAC ),
301#endif
302 VIDEOEDIT_JAVA_CONSTANT_INIT("ERR_AUDIO_CANNOT_BE_MIXED", \
303 M4VSS3GPP_ERR_AUDIO_CANNOT_BE_MIXED ),
304#ifdef M4VSS3GPP_ERR_ONLY_AMRNB_INPUT_CAN_BE_MIXED
305 VIDEOEDIT_JAVA_CONSTANT_INIT("ERR_ONLY_AMRNB_INPUT_CAN_BE_MIXED", \
306 M4VSS3GPP_ERR_ONLY_AMRNB_INPUT_CAN_BE_MIXED ),
307#endif
308#ifdef M4VSS3GPP_ERR_FEATURE_UNSUPPORTED_WITH_EVRC
309 VIDEOEDIT_JAVA_CONSTANT_INIT("ERR_FEATURE_UNSUPPORTED_WITH_EVRC", \
310 M4VSS3GPP_ERR_FEATURE_UNSUPPORTED_WITH_EVRC ),
311#endif
312 VIDEOEDIT_JAVA_CONSTANT_INIT("ERR_H263_PROFILE_NOT_SUPPORTED", \
313 M4VSS3GPP_ERR_H263_PROFILE_NOT_SUPPORTED ),
314 VIDEOEDIT_JAVA_CONSTANT_INIT("ERR_NO_SUPPORTED_VIDEO_STREAM_IN_FILE", \
315 M4VSS3GPP_ERR_NO_SUPPORTED_VIDEO_STREAM_IN_FILE ),
316 VIDEOEDIT_JAVA_CONSTANT_INIT("ERR_INTERNAL", \
317 M4NO_ERROR ),
318};
319
320VIDEOEDIT_JAVA_DEFINE_CONSTANT_CLASS(Error, ERROR_CLASS_NAME,
321 videoEditClasses_getUnknownErrorName, videoEditClasses_getUnknownErrorString)
322
323
324VIDEOEDIT_JAVA_DEFINE_CONSTANTS(FileType)
325{
326 VIDEOEDIT_JAVA_CONSTANT_INIT("THREE_GPP", VideoEditClasses_kFileType_3GPP),
327 VIDEOEDIT_JAVA_CONSTANT_INIT("MP4", VideoEditClasses_kFileType_MP4),
328 VIDEOEDIT_JAVA_CONSTANT_INIT("AMR", VideoEditClasses_kFileType_AMR),
329 VIDEOEDIT_JAVA_CONSTANT_INIT("MP3", VideoEditClasses_kFileType_MP3),
330 VIDEOEDIT_JAVA_CONSTANT_INIT("PCM", VideoEditClasses_kFileType_PCM),
331 VIDEOEDIT_JAVA_CONSTANT_INIT("JPG", VideoEditClasses_kFileType_JPG),
332 VIDEOEDIT_JAVA_CONSTANT_INIT("GIF", VideoEditClasses_kFileType_GIF),
333 VIDEOEDIT_JAVA_CONSTANT_INIT("PNG", VideoEditClasses_kFileType_PNG),
Dharmaray Kundargi4e703202011-01-29 20:48:05 -0800334 VIDEOEDIT_JAVA_CONSTANT_INIT("M4V", VideoEditClasses_kFileType_M4V),
Dharmaray Kundargicd196d32011-01-16 15:47:16 -0800335 VIDEOEDIT_JAVA_CONSTANT_INIT("UNSUPPORTED", VideoEditClasses_kFileType_Unsupported)
336};
337
338VIDEOEDIT_JAVA_DEFINE_CONSTANT_CLASS(FileType, FILE_TYPE_CLASS_NAME, M4OSA_NULL, M4OSA_NULL)
339
340
341VIDEOEDIT_JAVA_DEFINE_CONSTANTS(MediaRendering)
342{
343 VIDEOEDIT_JAVA_CONSTANT_INIT("RESIZING", M4xVSS_kResizing),
344 VIDEOEDIT_JAVA_CONSTANT_INIT("CROPPING", M4xVSS_kCropping),
345 VIDEOEDIT_JAVA_CONSTANT_INIT("BLACK_BORDERS", M4xVSS_kBlackBorders)
346};
347
348VIDEOEDIT_JAVA_DEFINE_CONSTANT_CLASS(MediaRendering, MEDIA_RENDERING_CLASS_NAME,
349 M4OSA_NULL, M4OSA_NULL)
350
351
352VIDEOEDIT_JAVA_DEFINE_CONSTANTS(SlideDirection)
353{
354 VIDEOEDIT_JAVA_CONSTANT_INIT("RIGHT_OUT_LEFT_IN", M4xVSS_SlideTransition_RightOutLeftIn),
355 VIDEOEDIT_JAVA_CONSTANT_INIT("LEFT_OUT_RIGTH_IN", M4xVSS_SlideTransition_LeftOutRightIn),
356 VIDEOEDIT_JAVA_CONSTANT_INIT("TOP_OUT_BOTTOM_IN", M4xVSS_SlideTransition_TopOutBottomIn),
357 VIDEOEDIT_JAVA_CONSTANT_INIT("BOTTOM_OUT_TOP_IN", M4xVSS_SlideTransition_BottomOutTopIn)
358};
359
360VIDEOEDIT_JAVA_DEFINE_CONSTANT_CLASS(SlideDirection, SLIDE_DIRECTION_CLASS_NAME,
361 M4OSA_NULL, M4OSA_NULL)
362
363
364VIDEOEDIT_JAVA_DEFINE_CONSTANTS(TransitionBehaviour)
365{
366 VIDEOEDIT_JAVA_CONSTANT_INIT("SPEED_UP", M4VSS3GPP_TransitionBehaviour_SpeedUp),
367 VIDEOEDIT_JAVA_CONSTANT_INIT("LINEAR", M4VSS3GPP_TransitionBehaviour_Linear),
368 VIDEOEDIT_JAVA_CONSTANT_INIT("SPEED_DOWN", M4VSS3GPP_TransitionBehaviour_SpeedDown),
369 VIDEOEDIT_JAVA_CONSTANT_INIT("SLOW_MIDDLE", M4VSS3GPP_TransitionBehaviour_SlowMiddle),
370 VIDEOEDIT_JAVA_CONSTANT_INIT("FAST_MIDDLE", M4VSS3GPP_TransitionBehaviour_FastMiddle)
371};
372
373VIDEOEDIT_JAVA_DEFINE_CONSTANT_CLASS(TransitionBehaviour, TRANSITION_BEHAVIOUR_CLASS_NAME,
374 M4OSA_NULL, M4OSA_NULL)
375
376
377VIDEOEDIT_JAVA_DEFINE_CONSTANTS(VideoEffect)
378{
379 VIDEOEDIT_JAVA_CONSTANT_INIT("NONE", M4VSS3GPP_kVideoEffectType_None),
380 VIDEOEDIT_JAVA_CONSTANT_INIT("FADE_FROM_BLACK", M4VSS3GPP_kVideoEffectType_FadeFromBlack),
381 VIDEOEDIT_JAVA_CONSTANT_INIT("CURTAIN_OPENING", M4VSS3GPP_kVideoEffectType_CurtainOpening),
382 VIDEOEDIT_JAVA_CONSTANT_INIT("FADE_TO_BLACK", M4VSS3GPP_kVideoEffectType_FadeToBlack),
383 VIDEOEDIT_JAVA_CONSTANT_INIT("CURTAIN_CLOSING", M4VSS3GPP_kVideoEffectType_CurtainClosing),
384 VIDEOEDIT_JAVA_CONSTANT_INIT("EXTERNAL", M4VSS3GPP_kVideoEffectType_External),
385 VIDEOEDIT_JAVA_CONSTANT_INIT("BLACK_AND_WHITE", M4xVSS_kVideoEffectType_BlackAndWhite),
386 VIDEOEDIT_JAVA_CONSTANT_INIT("PINK", M4xVSS_kVideoEffectType_Pink),
387 VIDEOEDIT_JAVA_CONSTANT_INIT("GREEN", M4xVSS_kVideoEffectType_Green),
388 VIDEOEDIT_JAVA_CONSTANT_INIT("SEPIA", M4xVSS_kVideoEffectType_Sepia),
389 VIDEOEDIT_JAVA_CONSTANT_INIT("NEGATIVE", M4xVSS_kVideoEffectType_Negative),
390 VIDEOEDIT_JAVA_CONSTANT_INIT("FRAMING", M4xVSS_kVideoEffectType_Framing),
391 VIDEOEDIT_JAVA_CONSTANT_INIT("TEXT", M4xVSS_kVideoEffectType_Text),
392 VIDEOEDIT_JAVA_CONSTANT_INIT("ZOOM_IN", M4xVSS_kVideoEffectType_ZoomIn),
393 VIDEOEDIT_JAVA_CONSTANT_INIT("ZOOM_OUT", M4xVSS_kVideoEffectType_ZoomOut),
394 VIDEOEDIT_JAVA_CONSTANT_INIT("FIFTIES", M4xVSS_kVideoEffectType_Fifties),
395 VIDEOEDIT_JAVA_CONSTANT_INIT("COLORRGB16", M4xVSS_kVideoEffectType_ColorRGB16),
396 VIDEOEDIT_JAVA_CONSTANT_INIT("GRADIENT", M4xVSS_kVideoEffectType_Gradient),
397};
398
399VIDEOEDIT_JAVA_DEFINE_CONSTANT_CLASS(VideoEffect, VIDEO_EFFECT_CLASS_NAME, M4OSA_NULL, M4OSA_NULL)
400
401
402VIDEOEDIT_JAVA_DEFINE_CONSTANTS(VideoFormat)
403{
404 VIDEOEDIT_JAVA_CONSTANT_INIT("NO_VIDEO", M4VIDEOEDITING_kNoneVideo),
405 VIDEOEDIT_JAVA_CONSTANT_INIT("H263", M4VIDEOEDITING_kH263),
406 VIDEOEDIT_JAVA_CONSTANT_INIT("MPEG4", M4VIDEOEDITING_kMPEG4),
407 VIDEOEDIT_JAVA_CONSTANT_INIT("MPEG4_EMP", M4VIDEOEDITING_kMPEG4_EMP),
408 VIDEOEDIT_JAVA_CONSTANT_INIT("H264", M4VIDEOEDITING_kH264),
409 VIDEOEDIT_JAVA_CONSTANT_INIT("NULL_VIDEO", M4VIDEOEDITING_kNullVideo),
410 VIDEOEDIT_JAVA_CONSTANT_INIT("UNSUPPORTED", M4VIDEOEDITING_kUnsupportedVideo),
411};
412
413VIDEOEDIT_JAVA_DEFINE_CONSTANT_CLASS(VideoFormat, VIDEO_FORMAT_CLASS_NAME, M4OSA_NULL, M4OSA_NULL)
414
415
416VIDEOEDIT_JAVA_DEFINE_CONSTANTS(VideoFrameRate)
417{
418 VIDEOEDIT_JAVA_CONSTANT_INIT("FR_5_FPS", M4VIDEOEDITING_k5_FPS),
419 VIDEOEDIT_JAVA_CONSTANT_INIT("FR_7_5_FPS", M4VIDEOEDITING_k7_5_FPS),
420 VIDEOEDIT_JAVA_CONSTANT_INIT("FR_10_FPS", M4VIDEOEDITING_k10_FPS),
421 VIDEOEDIT_JAVA_CONSTANT_INIT("FR_12_5_FPS", M4VIDEOEDITING_k12_5_FPS),
422 VIDEOEDIT_JAVA_CONSTANT_INIT("FR_15_FPS", M4VIDEOEDITING_k15_FPS),
423 VIDEOEDIT_JAVA_CONSTANT_INIT("FR_20_FPS", M4VIDEOEDITING_k20_FPS),
424 VIDEOEDIT_JAVA_CONSTANT_INIT("FR_25_FPS", M4VIDEOEDITING_k25_FPS),
425 VIDEOEDIT_JAVA_CONSTANT_INIT("FR_30_FPS", M4VIDEOEDITING_k30_FPS)
426};
427
428VIDEOEDIT_JAVA_DEFINE_CONSTANT_CLASS(VideoFrameRate, VIDEO_FRAME_RATE_CLASS_NAME,
429 M4OSA_NULL, M4OSA_NULL)
430
431
432VIDEOEDIT_JAVA_DEFINE_CONSTANTS(VideoFrameSize)
433{
434 VIDEOEDIT_JAVA_CONSTANT_INIT("SQCIF", M4VIDEOEDITING_kSQCIF),
435 VIDEOEDIT_JAVA_CONSTANT_INIT("QQVGA", M4VIDEOEDITING_kQQVGA),
436 VIDEOEDIT_JAVA_CONSTANT_INIT("QCIF", M4VIDEOEDITING_kQCIF),
437 VIDEOEDIT_JAVA_CONSTANT_INIT("QVGA", M4VIDEOEDITING_kQVGA),
438 VIDEOEDIT_JAVA_CONSTANT_INIT("CIF", M4VIDEOEDITING_kCIF),
439 VIDEOEDIT_JAVA_CONSTANT_INIT("VGA", M4VIDEOEDITING_kVGA),
440 VIDEOEDIT_JAVA_CONSTANT_INIT("WVGA", M4VIDEOEDITING_kWVGA),
441 VIDEOEDIT_JAVA_CONSTANT_INIT("NTSC", M4VIDEOEDITING_kNTSC),
442 VIDEOEDIT_JAVA_CONSTANT_INIT("nHD", M4VIDEOEDITING_k640_360),
443 VIDEOEDIT_JAVA_CONSTANT_INIT("WVGA16x9", M4VIDEOEDITING_k854_480),
444 VIDEOEDIT_JAVA_CONSTANT_INIT("V720p", M4VIDEOEDITING_kHD1280),
445 VIDEOEDIT_JAVA_CONSTANT_INIT("W720p", M4VIDEOEDITING_kHD1080),
446 VIDEOEDIT_JAVA_CONSTANT_INIT("S720p", M4VIDEOEDITING_kHD960)
447};
448
449VIDEOEDIT_JAVA_DEFINE_CONSTANT_CLASS(VideoFrameSize, VIDEO_FRAME_SIZE_CLASS_NAME,
450 M4OSA_NULL, M4OSA_NULL)
451
452
453VIDEOEDIT_JAVA_DEFINE_CONSTANTS(VideoProfile)
454{
455 VIDEOEDIT_JAVA_CONSTANT_INIT("MPEG4_SP_LEVEL_0", \
456 M4VIDEOEDITING_kMPEG4_SP_Level_0),
457 VIDEOEDIT_JAVA_CONSTANT_INIT("MPEG4_SP_LEVEL_0B", \
458 M4VIDEOEDITING_kMPEG4_SP_Level_0b),
459 VIDEOEDIT_JAVA_CONSTANT_INIT("MPEG4_SP_LEVEL_1", \
460 M4VIDEOEDITING_kMPEG4_SP_Level_1),
461 VIDEOEDIT_JAVA_CONSTANT_INIT("MPEG4_SP_LEVEL_2", \
462 M4VIDEOEDITING_kMPEG4_SP_Level_2),
463 VIDEOEDIT_JAVA_CONSTANT_INIT("MPEG4_SP_LEVEL_3", \
464 M4VIDEOEDITING_kMPEG4_SP_Level_3),
465 VIDEOEDIT_JAVA_CONSTANT_INIT("MPEG4_SP_LEVEL_4A", \
466 M4VIDEOEDITING_kMPEG4_SP_Level_4a),
467 VIDEOEDIT_JAVA_CONSTANT_INIT("MPEG4_SP_LEVEL_5", \
468 M4VIDEOEDITING_kMPEG4_SP_Level_5),
469 VIDEOEDIT_JAVA_CONSTANT_INIT("H263_PROFILE_0_LEVEL_10",\
470 M4VIDEOEDITING_kH263_Profile_0_Level_10),
471 VIDEOEDIT_JAVA_CONSTANT_INIT("H263_PROFILE_0_LEVEL_20",\
472 M4VIDEOEDITING_kH263_Profile_0_Level_20),
473 VIDEOEDIT_JAVA_CONSTANT_INIT("H263_PROFILE_0_LEVEL_30",\
474 M4VIDEOEDITING_kH263_Profile_0_Level_30),
475 VIDEOEDIT_JAVA_CONSTANT_INIT("H263_PROFILE_0_LEVEL_40",\
476 M4VIDEOEDITING_kH263_Profile_0_Level_40),
477 VIDEOEDIT_JAVA_CONSTANT_INIT("H263_PROFILE_0_LEVEL_45",\
478 M4VIDEOEDITING_kH263_Profile_0_Level_45),
479 VIDEOEDIT_JAVA_CONSTANT_INIT("H264_PROFILE_0_LEVEL_1", \
480 M4VIDEOEDITING_kH264_Profile_0_Level_1),
481 VIDEOEDIT_JAVA_CONSTANT_INIT("H264_PROFILE_0_LEVEL_1b",\
482 M4VIDEOEDITING_kH264_Profile_0_Level_1b),
483 VIDEOEDIT_JAVA_CONSTANT_INIT("H264_PROFILE_0_LEVEL_1_1",\
484 M4VIDEOEDITING_kH264_Profile_0_Level_1_1),
485 VIDEOEDIT_JAVA_CONSTANT_INIT("H264_PROFILE_0_LEVEL_1_2",\
486 M4VIDEOEDITING_kH264_Profile_0_Level_1_2),
487 VIDEOEDIT_JAVA_CONSTANT_INIT("H264_PROFILE_0_LEVEL_1_3",\
488 M4VIDEOEDITING_kH264_Profile_0_Level_1_3),
489 VIDEOEDIT_JAVA_CONSTANT_INIT("H264_PROFILE_0_LEVEL_2", \
490 M4VIDEOEDITING_kH264_Profile_0_Level_2),
491 VIDEOEDIT_JAVA_CONSTANT_INIT("H264_PROFILE_0_LEVEL_2_1",\
492 M4VIDEOEDITING_kH264_Profile_0_Level_2_1),
493 VIDEOEDIT_JAVA_CONSTANT_INIT("H264_PROFILE_0_LEVEL_2_2",\
494 M4VIDEOEDITING_kH264_Profile_0_Level_2_2),
495 VIDEOEDIT_JAVA_CONSTANT_INIT("H264_PROFILE_0_LEVEL_3", \
496 M4VIDEOEDITING_kH264_Profile_0_Level_3),
497 VIDEOEDIT_JAVA_CONSTANT_INIT("H264_PROFILE_0_LEVEL_3_1",\
498 M4VIDEOEDITING_kH264_Profile_0_Level_3_1),
499 VIDEOEDIT_JAVA_CONSTANT_INIT("H264_PROFILE_0_LEVEL_3_2",\
500 M4VIDEOEDITING_kH264_Profile_0_Level_3_2),
501 VIDEOEDIT_JAVA_CONSTANT_INIT("H264_PROFILE_0_LEVEL_4", \
502 M4VIDEOEDITING_kH264_Profile_0_Level_4),
503 VIDEOEDIT_JAVA_CONSTANT_INIT("H264_PROFILE_0_LEVEL_4_1",\
504 M4VIDEOEDITING_kH264_Profile_0_Level_4_1),
505 VIDEOEDIT_JAVA_CONSTANT_INIT("H264_PROFILE_0_LEVEL_4_2",\
506 M4VIDEOEDITING_kH264_Profile_0_Level_4_2),
507 VIDEOEDIT_JAVA_CONSTANT_INIT("H264_PROFILE_0_LEVEL_5", \
508 M4VIDEOEDITING_kH264_Profile_0_Level_5),
509 VIDEOEDIT_JAVA_CONSTANT_INIT("H264_PROFILE_0_LEVEL_5_1",\
510 M4VIDEOEDITING_kH264_Profile_0_Level_5_1),
511 VIDEOEDIT_JAVA_CONSTANT_INIT("OUT_OF_RANGE", \
512 M4VIDEOEDITING_kProfile_and_Level_Out_Of_Range)
513};
514
515VIDEOEDIT_JAVA_DEFINE_CONSTANT_CLASS(VideoProfile, VIDEO_PROFILE_CLASS_NAME, M4OSA_NULL,
516 M4OSA_NULL)
517
518
519VIDEOEDIT_JAVA_DEFINE_CONSTANTS(VideoTransition)
520{
521 VIDEOEDIT_JAVA_CONSTANT_INIT("NONE", M4VSS3GPP_kVideoTransitionType_None),
522 VIDEOEDIT_JAVA_CONSTANT_INIT("CROSS_FADE", M4VSS3GPP_kVideoTransitionType_CrossFade),
523 VIDEOEDIT_JAVA_CONSTANT_INIT("EXTERNAL", M4VSS3GPP_kVideoTransitionType_External),
524 VIDEOEDIT_JAVA_CONSTANT_INIT("ALPHA_MAGIC", M4xVSS_kVideoTransitionType_AlphaMagic),
525 VIDEOEDIT_JAVA_CONSTANT_INIT("SLIDE_TRANSITION", M4xVSS_kVideoTransitionType_SlideTransition),
526 VIDEOEDIT_JAVA_CONSTANT_INIT("FADE_BLACK", M4xVSS_kVideoTransitionType_FadeBlack)
527};
528
529VIDEOEDIT_JAVA_DEFINE_CONSTANT_CLASS(VideoTransition, VIDEO_TRANSITION_CLASS_NAME,
530 M4OSA_NULL, M4OSA_NULL)
531
532
533VIDEOEDIT_JAVA_DEFINE_FIELDS(AlphaMagic)
534{
535 VIDEOEDIT_JAVA_FIELD_INIT("file", "Ljava/lang/String;"),
536 VIDEOEDIT_JAVA_FIELD_INIT("blendingPercent", "I" ),
537 VIDEOEDIT_JAVA_FIELD_INIT("invertRotation", "Z" ),
538 VIDEOEDIT_JAVA_FIELD_INIT("rgbWidth", "I" ),
539 VIDEOEDIT_JAVA_FIELD_INIT("rgbHeight", "I" )
540};
541
542VIDEOEDIT_JAVA_DEFINE_FIELD_CLASS(AlphaMagic, ALPHA_MAGIC_SETTINGS_CLASS_NAME)
543
544VIDEOEDIT_JAVA_DEFINE_FIELDS(Properties)
545{
546 VIDEOEDIT_JAVA_FIELD_INIT("duration", "I"),
547 VIDEOEDIT_JAVA_FIELD_INIT("fileType", "I"),
548 VIDEOEDIT_JAVA_FIELD_INIT("videoFormat", "I"),
549 VIDEOEDIT_JAVA_FIELD_INIT("videoDuration", "I"),
550 VIDEOEDIT_JAVA_FIELD_INIT("videoBitrate", "I"),
551 VIDEOEDIT_JAVA_FIELD_INIT("width", "I"),
552 VIDEOEDIT_JAVA_FIELD_INIT("height", "I"),
553 VIDEOEDIT_JAVA_FIELD_INIT("averageFrameRate", "F"),
554 VIDEOEDIT_JAVA_FIELD_INIT("profileAndLevel", "I"),
555 VIDEOEDIT_JAVA_FIELD_INIT("audioFormat", "I"),
556 VIDEOEDIT_JAVA_FIELD_INIT("audioDuration", "I"),
557 VIDEOEDIT_JAVA_FIELD_INIT("audioBitrate", "I"),
558 VIDEOEDIT_JAVA_FIELD_INIT("audioChannels", "I"),
559 VIDEOEDIT_JAVA_FIELD_INIT("audioSamplingFrequency", "I")
560};
561
562VIDEOEDIT_JAVA_DEFINE_FIELD_CLASS(Properties, PROPERTIES_CLASS_NAME)
563
564VIDEOEDIT_JAVA_DEFINE_FIELDS(BackgroundMusic)
565{
566 VIDEOEDIT_JAVA_FIELD_INIT("file", "Ljava/lang/String;"),
567 VIDEOEDIT_JAVA_FIELD_INIT("fileType", "I" ),
568 VIDEOEDIT_JAVA_FIELD_INIT("insertionTime", "J" ),
569 VIDEOEDIT_JAVA_FIELD_INIT("volumePercent", "I" ),
570 VIDEOEDIT_JAVA_FIELD_INIT("beginLoop", "J" ),
571 VIDEOEDIT_JAVA_FIELD_INIT("endLoop", "J" ),
572 VIDEOEDIT_JAVA_FIELD_INIT("enableDucking", "Z" ),
573 VIDEOEDIT_JAVA_FIELD_INIT("duckingThreshold","I" ),
574 VIDEOEDIT_JAVA_FIELD_INIT("lowVolume", "I" ),
575 VIDEOEDIT_JAVA_FIELD_INIT("isLooping", "Z" )
576};
577
578VIDEOEDIT_JAVA_DEFINE_FIELD_CLASS(BackgroundMusic, BACKGROUND_MUSIC_SETTINGS_CLASS_NAME)
579
580/*
581VIDEOEDIT_JAVA_DEFINE_FIELDS(BestEditSettings)
582{
583 VIDEOEDIT_JAVA_FIELD_INIT("videoFormat", "I"),
584 VIDEOEDIT_JAVA_FIELD_INIT("videoFrameSize", "I"),
585 VIDEOEDIT_JAVA_FIELD_INIT("audioFormat", "I"),
586 VIDEOEDIT_JAVA_FIELD_INIT("audioChannels", "I")
587};
588
589VIDEOEDIT_JAVA_DEFINE_FIELD_CLASS(BestEditSettings, BEST_EDIT_SETTINGS_CLASS_NAME)
590*/
591
592VIDEOEDIT_JAVA_DEFINE_FIELDS(ClipSettings)
593{
594 VIDEOEDIT_JAVA_FIELD_INIT("clipPath", "Ljava/lang/String;"),
595 VIDEOEDIT_JAVA_FIELD_INIT("fileType", "I" ),
596 VIDEOEDIT_JAVA_FIELD_INIT("beginCutTime", "I" ),
597 VIDEOEDIT_JAVA_FIELD_INIT("endCutTime", "I" ),
598 VIDEOEDIT_JAVA_FIELD_INIT("beginCutPercent", "I" ),
599 VIDEOEDIT_JAVA_FIELD_INIT("endCutPercent", "I" ),
600 VIDEOEDIT_JAVA_FIELD_INIT("panZoomEnabled", "Z" ),
601 VIDEOEDIT_JAVA_FIELD_INIT("panZoomPercentStart", "I" ),
602 VIDEOEDIT_JAVA_FIELD_INIT("panZoomTopLeftXStart", "I" ),
603 VIDEOEDIT_JAVA_FIELD_INIT("panZoomTopLeftYStart", "I" ),
604 VIDEOEDIT_JAVA_FIELD_INIT("panZoomPercentEnd", "I" ),
605 VIDEOEDIT_JAVA_FIELD_INIT("panZoomTopLeftXEnd", "I" ),
606 VIDEOEDIT_JAVA_FIELD_INIT("panZoomTopLeftYEnd", "I" ),
607 VIDEOEDIT_JAVA_FIELD_INIT("mediaRendering", "I" ),
608 VIDEOEDIT_JAVA_FIELD_INIT("rgbWidth", "I" ),
609 VIDEOEDIT_JAVA_FIELD_INIT("rgbHeight", "I" )
610};
611
612VIDEOEDIT_JAVA_DEFINE_FIELD_CLASS(ClipSettings, CLIP_SETTINGS_CLASS_NAME)
613
614
615VIDEOEDIT_JAVA_DEFINE_FIELDS(EditSettings)
616{
617 VIDEOEDIT_JAVA_FIELD_INIT("clipSettingsArray", "[L"CLIP_SETTINGS_CLASS_NAME";" ),
618 VIDEOEDIT_JAVA_FIELD_INIT("transitionSettingsArray", "[L"TRANSITION_SETTINGS_CLASS_NAME";" ),
619 VIDEOEDIT_JAVA_FIELD_INIT("effectSettingsArray", "[L"EFFECT_SETTINGS_CLASS_NAME";" ),
620 VIDEOEDIT_JAVA_FIELD_INIT("videoFrameRate", "I" ),
621 VIDEOEDIT_JAVA_FIELD_INIT("outputFile", "Ljava/lang/String;" ),
622 VIDEOEDIT_JAVA_FIELD_INIT("videoFrameSize", "I" ),
623 VIDEOEDIT_JAVA_FIELD_INIT("videoFormat", "I" ),
624 VIDEOEDIT_JAVA_FIELD_INIT("audioFormat", "I" ),
625 VIDEOEDIT_JAVA_FIELD_INIT("audioSamplingFreq", "I" ),
626 VIDEOEDIT_JAVA_FIELD_INIT("maxFileSize", "I" ),
627 VIDEOEDIT_JAVA_FIELD_INIT("audioChannels", "I" ),
628 VIDEOEDIT_JAVA_FIELD_INIT("videoBitrate", "I" ),
629 VIDEOEDIT_JAVA_FIELD_INIT("audioBitrate", "I" ),
630 VIDEOEDIT_JAVA_FIELD_INIT("backgroundMusicSettings",\
631 "L"BACKGROUND_MUSIC_SETTINGS_CLASS_NAME";"),
632 VIDEOEDIT_JAVA_FIELD_INIT("primaryTrackVolume", "I" )
633};
634
635VIDEOEDIT_JAVA_DEFINE_FIELD_CLASS(EditSettings, EDIT_SETTINGS_CLASS_NAME)
636
637
638VIDEOEDIT_JAVA_DEFINE_FIELDS(EffectSettings)
639{
640 VIDEOEDIT_JAVA_FIELD_INIT("startTime", "I" ),
641 VIDEOEDIT_JAVA_FIELD_INIT("duration", "I" ),
642 VIDEOEDIT_JAVA_FIELD_INIT("videoEffectType", "I" ),
643 VIDEOEDIT_JAVA_FIELD_INIT("audioEffectType", "I" ),
644 VIDEOEDIT_JAVA_FIELD_INIT("startPercent", "I" ),
645 VIDEOEDIT_JAVA_FIELD_INIT("durationPercent", "I" ),
646 VIDEOEDIT_JAVA_FIELD_INIT("framingFile", "Ljava/lang/String;"),
647 VIDEOEDIT_JAVA_FIELD_INIT("framingBuffer", "[I" ),
648 VIDEOEDIT_JAVA_FIELD_INIT("bitmapType", "I" ),
649 VIDEOEDIT_JAVA_FIELD_INIT("width", "I" ),
650 VIDEOEDIT_JAVA_FIELD_INIT("height", "I" ),
651 VIDEOEDIT_JAVA_FIELD_INIT("topLeftX", "I" ),
652 VIDEOEDIT_JAVA_FIELD_INIT("topLeftY", "I" ),
653 VIDEOEDIT_JAVA_FIELD_INIT("framingResize", "Z" ),
654 VIDEOEDIT_JAVA_FIELD_INIT("framingScaledSize", "I" ),
655 VIDEOEDIT_JAVA_FIELD_INIT("text", "Ljava/lang/String;"),
656 VIDEOEDIT_JAVA_FIELD_INIT("textRenderingData", "Ljava/lang/String;"),
657 VIDEOEDIT_JAVA_FIELD_INIT("textBufferWidth", "I" ),
658 VIDEOEDIT_JAVA_FIELD_INIT("textBufferHeight", "I" ),
659 VIDEOEDIT_JAVA_FIELD_INIT("fiftiesFrameRate", "I" ),
660 VIDEOEDIT_JAVA_FIELD_INIT("rgb16InputColor", "I" ),
661 VIDEOEDIT_JAVA_FIELD_INIT("alphaBlendingStartPercent", "I" ),
662 VIDEOEDIT_JAVA_FIELD_INIT("alphaBlendingMiddlePercent", "I" ),
663 VIDEOEDIT_JAVA_FIELD_INIT("alphaBlendingEndPercent", "I" ),
664 VIDEOEDIT_JAVA_FIELD_INIT("alphaBlendingFadeInTimePercent", "I" ),
665 VIDEOEDIT_JAVA_FIELD_INIT("alphaBlendingFadeOutTimePercent", "I" )
666};
667
668VIDEOEDIT_JAVA_DEFINE_FIELD_CLASS(EffectSettings, EFFECT_SETTINGS_CLASS_NAME)
669
670
671VIDEOEDIT_JAVA_DEFINE_FIELDS(Engine)
672{
673 VIDEOEDIT_JAVA_FIELD_INIT("mManualEditContext", "I")
674};
675
676VIDEOEDIT_JAVA_DEFINE_FIELD_CLASS(Engine, MANUAL_EDIT_ENGINE_CLASS_NAME)
677
678
679VIDEOEDIT_JAVA_DEFINE_FIELDS(SlideTransitionSettings)
680{
681 VIDEOEDIT_JAVA_FIELD_INIT("direction", "I")
682};
683
684VIDEOEDIT_JAVA_DEFINE_FIELD_CLASS(SlideTransitionSettings, SLIDE_TRANSITION_SETTINGS_CLASS_NAME)
685
686
687VIDEOEDIT_JAVA_DEFINE_FIELDS(TransitionSettings)
688{
689 VIDEOEDIT_JAVA_FIELD_INIT("duration", "I" ),
690 VIDEOEDIT_JAVA_FIELD_INIT("videoTransitionType", "I" ),
691 VIDEOEDIT_JAVA_FIELD_INIT("audioTransitionType", "I" ),
692 VIDEOEDIT_JAVA_FIELD_INIT("transitionBehaviour", "I" ),
693 VIDEOEDIT_JAVA_FIELD_INIT("alphaSettings", "L"ALPHA_MAGIC_SETTINGS_CLASS_NAME";" ),
694 VIDEOEDIT_JAVA_FIELD_INIT("slideSettings", "L"SLIDE_TRANSITION_SETTINGS_CLASS_NAME";")
695};
696
697VIDEOEDIT_JAVA_DEFINE_FIELD_CLASS(TransitionSettings, TRANSITION_SETTINGS_CLASS_NAME)
698
699
700VIDEOEDIT_JAVA_DEFINE_FIELDS(Version)
701{
702 VIDEOEDIT_JAVA_FIELD_INIT("major", "I"),
703 VIDEOEDIT_JAVA_FIELD_INIT("minor", "I"),
704 VIDEOEDIT_JAVA_FIELD_INIT("revision", "I")
705};
706
707VIDEOEDIT_JAVA_DEFINE_FIELD_CLASS(Version, VERSION_CLASS_NAME)
708
709
710VIDEOEDIT_JAVA_DEFINE_METHODS(Engine)
711{
712 VIDEOEDIT_JAVA_METHOD_INIT("onProgressUpdate", "(II)V")
713};
714
715VIDEOEDIT_JAVA_DEFINE_METHOD_CLASS(Engine, MANUAL_EDIT_ENGINE_CLASS_NAME)
716
717
718static const char*
719videoEditClasses_getBrandString(M4OSA_UInt32 brand)
720{
721 static char brandString[11] = "0x00000000";
722 const char* pBrandString = M4OSA_NULL;
723 M4OSA_UInt8* pBrand = (M4OSA_UInt8*)&brand;
724 M4OSA_UInt32 brandHost = 0;
725
726 // Convert the brand from big endian to host.
727 brandHost = pBrand[0];
728 brandHost = brandHost << 8;
729 brandHost += pBrand[1];
730 brandHost = brandHost << 8;
731 brandHost += pBrand[2];
732 brandHost = brandHost << 8;
733 brandHost += pBrand[3];
734
735 switch (brandHost)
736 {
737 case M4VIDEOEDITING_BRAND_0000:
738 pBrandString = "0000";
739 break;
740 case M4VIDEOEDITING_BRAND_3G2A:
741 pBrandString = "3G2A";
742 break;
743 case M4VIDEOEDITING_BRAND_3GP4:
744 pBrandString = "3GP4";
745 break;
746 case M4VIDEOEDITING_BRAND_3GP5:
747 pBrandString = "3GP5";
748 break;
749 case M4VIDEOEDITING_BRAND_3GP6:
750 pBrandString = "3GP6";
751 break;
752 case M4VIDEOEDITING_BRAND_AVC1:
753 pBrandString = "AVC1";
754 break;
755 case M4VIDEOEDITING_BRAND_EMP:
756 pBrandString = "EMP";
757 break;
758 case M4VIDEOEDITING_BRAND_ISOM:
759 pBrandString = "ISOM";
760 break;
761 case M4VIDEOEDITING_BRAND_MP41:
762 pBrandString = "MP41";
763 break;
764 case M4VIDEOEDITING_BRAND_MP42:
765 pBrandString = "MP42";
766 break;
767 case M4VIDEOEDITING_BRAND_VFJ1:
768 pBrandString = "VFJ1";
769 break;
770 default:
771 M4OSA_chrSPrintf((M4OSA_Char *)brandString,
772 sizeof(brandString) - 1,
773 (M4OSA_Char*)"0x%08X", brandHost);
774 pBrandString = brandString;
775 break;
776 }
777
778 // Return the brand string.
779 return(pBrandString);
780}
781
782#ifdef VIDEOEDIT_LOGGING_ENABLED
783static void
784videoEditClasses_logFtypBox(
785 M4VIDEOEDITING_FtypBox* pBox,
786 int indentation)
787{
788 // Check if memory was allocated for the FtypBox.
789 if (M4OSA_NULL != pBox)
790 {
791 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES",
792 "%*c major_brand: %s", indentation, ' ',
793 videoEditClasses_getBrandString(pBox->major_brand));
794 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES",
795 "%*c minor_version: %08X", indentation, ' ',
796 (unsigned int)pBox->minor_version);
797 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES",
798 "%*c nbCompatibleBrands: %u", indentation, ' ',
799 (unsigned int)pBox->nbCompatibleBrands);
800 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES",
801 "%*c compatible_brands:", indentation, ' ');
802 indentation += VIDEOEDIT_LOG_INDENTATION;
803 for (int i = 0; (i < (int)pBox->nbCompatibleBrands) &&\
804 (i < M4VIDEOEDITING_MAX_COMPATIBLE_BRANDS); i++)
805 {
806 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES",
807 "%*c compatible_brand[%d]: %s", indentation, ' ',
808 i, videoEditClasses_getBrandString(pBox->compatible_brands[i]));
809 }
810 indentation -= VIDEOEDIT_LOG_INDENTATION;
811 }
812 else
813 {
814 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES", "%*c <null>",
815 indentation, ' ');
816 }
817}
818#endif
819
820
821void
822videoEditClasses_init(
823 bool* pResult,
824 JNIEnv* pEnv)
825{
826 // Check if the previous action succeeded.
827 if (*pResult)
828 {
829 // Log the function call.
830 VIDEOEDIT_LOG_FUNCTION(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES",\
831 "videoEditClasses_init()");
832
833 // Initialize the constants.
834 videoEditJava_initAudioEffectConstants(pResult, pEnv);
835 videoEditJava_initAudioFormatConstants(pResult, pEnv);
836 videoEditJava_initAudioSamplingFrequencyConstants(pResult, pEnv);
837 videoEditJava_initAudioTransitionConstants(pResult, pEnv);
838 videoEditJava_initBitrateConstants(pResult, pEnv);
839 videoEditJava_initClipTypeConstants(pResult, pEnv);
840 videoEditJava_initEngineConstants(pResult, pEnv);
841 videoEditJava_initErrorConstants(pResult, pEnv);
842 videoEditJava_initFileTypeConstants(pResult, pEnv);
843 videoEditJava_initMediaRenderingConstants(pResult, pEnv);
844 videoEditJava_initSlideDirectionConstants(pResult, pEnv);
845 videoEditJava_initTransitionBehaviourConstants(pResult, pEnv);
846 videoEditJava_initVideoEffectConstants(pResult, pEnv);
847 videoEditJava_initVideoFormatConstants(pResult, pEnv);
848 videoEditJava_initVideoFrameRateConstants(pResult, pEnv);
849 videoEditJava_initVideoFrameSizeConstants(pResult, pEnv);
850 videoEditJava_initVideoProfileConstants(pResult, pEnv);
851 videoEditJava_initVideoTransitionConstants(pResult, pEnv);
852
853 // Initialize the fields.
854 videoEditJava_initAlphaMagicFields(pResult, pEnv);
855 videoEditJava_initBackgroundMusicFields(pResult, pEnv);
856 videoEditJava_initClipSettingsFields(pResult, pEnv);
857 videoEditJava_initEditSettingsFields(pResult, pEnv);
858 videoEditJava_initEffectSettingsFields(pResult, pEnv);
859 videoEditJava_initEngineFields(pResult, pEnv);
860 videoEditJava_initSlideTransitionSettingsFields(pResult, pEnv);
861 videoEditJava_initTransitionSettingsFields(pResult, pEnv);
862 videoEditJava_initVersionFields(pResult, pEnv);
863 // Initialize the methods.
864 videoEditJava_initEngineMethods(pResult, pEnv);
865 }
866}
867
868void
869videoEditPropClass_init(
870 bool* pResult,
871 JNIEnv* pEnv)
872{
873 // Check if the previous action succeeded.
874 if (*pResult)
875 {
876 // Log the function call.
877 VIDEOEDIT_LOG_FUNCTION(ANDROID_LOG_INFO, "VIDEO_EDITOR_PROP_CLASSES",\
878 "videoEditPropClass_init()");
879
880 // Initialize the constants.
881 videoEditJava_initAudioFormatConstants(pResult, pEnv);
882 videoEditJava_initErrorConstants(pResult, pEnv);
883 videoEditJava_initFileTypeConstants(pResult, pEnv);
884 videoEditJava_initVideoFormatConstants(pResult, pEnv);
885 videoEditJava_initVideoProfileConstants(pResult, pEnv);
886
887 // Initialize the fields.
888 videoEditJava_initPropertiesFields(pResult, pEnv);
889 }
890}
891
892void
893videoEditClasses_getAlphaMagicSettings(
894 bool* pResult,
895 JNIEnv* pEnv,
896 jobject object,
897 M4xVSS_AlphaMagicSettings** ppSettings)
898{
Basavapatna Dattaguru4fad6762011-02-27 21:15:18 -0800899 VideoEditJava_AlphaMagicFieldIds fieldIds;
Dharmaray Kundargicd196d32011-01-16 15:47:16 -0800900 M4xVSS_AlphaMagicSettings* pSettings = M4OSA_NULL;
Basavapatna Dattaguru4fad6762011-02-27 21:15:18 -0800901 memset(&fieldIds, 0, sizeof(VideoEditJava_AlphaMagicFieldIds));
Dharmaray Kundargicd196d32011-01-16 15:47:16 -0800902
903 // Check if the previous action succeeded.
904 if (*pResult)
905 {
906 // Log the function call.
907 VIDEOEDIT_LOG_FUNCTION(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES",
908 "videoEditClasses_getAlphaMagicSettings()");
909
910 // Retrieve the field ids.
911 videoEditJava_getAlphaMagicFieldIds(pResult, pEnv, &fieldIds);
912 }
913
914 // Only validate the AlphaMagicSettings if the fields could be located.
915 if (*pResult)
916 {
917 // Check if the clip is set.
918 videoEditJava_checkAndThrowIllegalArgumentException(pResult, pEnv,
919 (NULL == object),
920 "alphaSettings is null");
921 }
922
923 // Only retrieve the AlphaMagicSettings if the fields could be located and validated.
924 if (*pResult)
925 {
926 // Allocate memory for the AlphaMagicSettings.
927 pSettings = (M4xVSS_AlphaMagicSettings*)videoEditOsal_alloc(pResult, pEnv,
928 sizeof(M4xVSS_AlphaMagicSettings), "AlphaMagicSettings");
929
930 // Check if memory could be allocated for the AlphaMagicSettings.
931 if (*pResult)
932 {
933 // Set the alpha magic file path (JPG file).
934 pSettings->pAlphaFilePath = (M4OSA_Char*)videoEditJava_getString(pResult, pEnv, object,
935 fieldIds.file, M4OSA_NULL);
936
937 // Check if the alpha magic file path is valid.
938 videoEditJava_checkAndThrowIllegalArgumentException(pResult, pEnv,
939 (M4OSA_NULL == pSettings->pAlphaFilePath), "alphaSettings.file is null");
940 }
941
942 // Check if the alpha file path could be retrieved.
943 if (*pResult)
944 {
945 // Set the blending percentage between 0 and 100.
946 pSettings->blendingPercent = (M4OSA_UInt8)pEnv->GetIntField(object,
947 fieldIds.blendingPercent);
948
949 // Set the direct effect or reverse.
950 pSettings->isreverse = (M4OSA_Bool)pEnv->GetBooleanField(object,
951 fieldIds.invertRotation);
952
953 // Get the rgb width
954 pSettings->width = (M4OSA_UInt32) pEnv->GetIntField(object, fieldIds.rgbWidth );
955
956 pSettings->height = (M4OSA_UInt32) pEnv->GetIntField(object, fieldIds.rgbHeight );
957
958 VIDEOEDIT_LOG_FUNCTION(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES",
959 "((((((((((path %s", pSettings->pAlphaFilePath);
960
961 VIDEOEDIT_LOG_FUNCTION(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES",
962 "------- getAlphaMagicSettings width %d", pEnv->GetIntField(object,
963 fieldIds.rgbWidth ));
964 VIDEOEDIT_LOG_FUNCTION(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES",
965 "-------- getAlphaMagicSettings Height %d",
966 pEnv->GetIntField(object, fieldIds.rgbHeight ));
967 }
968
969 // Check if settings could be set.
970 if (*pResult)
971 {
972 // Return the settings.
973 (*ppSettings) = pSettings;
974 }
975 else
976 {
977 // Free the settings.
978 videoEditClasses_freeAlphaMagicSettings(&pSettings);
979 }
980 }
981}
982
983void
984videoEditClasses_freeAlphaMagicSettings(
985 M4xVSS_AlphaMagicSettings** ppSettings)
986{
987 // Check if memory was allocated for the AlphaMagicSettings.
988 if (M4OSA_NULL != (*ppSettings))
989 {
990 // Log the function call.
991 VIDEOEDIT_LOG_FUNCTION(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES",
992 "videoEditClasses_freeAlphaMagicSettings()");
993
994 // Free the alpha file path.
995 videoEditOsal_free((*ppSettings)->pAlphaFilePath);
996 (*ppSettings)->pAlphaFilePath = M4OSA_NULL;
997
998 // Free the settings structure.
999 videoEditOsal_free((*ppSettings));
1000 (*ppSettings) = M4OSA_NULL;
1001 }
1002}
1003
1004#ifdef VIDEOEDIT_LOGGING_ENABLED
1005void
1006videoEditClasses_logAlphaMagicSettings(
1007 M4xVSS_AlphaMagicSettings* pSettings,
1008 int indentation)
1009{
1010 // Check if memory was allocated for the AlphaMagicSettings.
1011 if (M4OSA_NULL != pSettings)
1012 {
1013 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES",
1014 "%*c pAlphaFilePath: %s", indentation, ' ',
1015 (M4OSA_NULL != pSettings->pAlphaFilePath) ? \
1016 (char *)pSettings->pAlphaFilePath : "<null>");
1017 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES",
1018 "%*c blendingPercent: %u %%", indentation, ' ',
1019 (unsigned int)pSettings->blendingPercent);
1020 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES",
1021 "%*c isreverse: %s", indentation, ' ',
1022 pSettings->isreverse ? "true" : "false");
1023 }
1024 else
1025 {
1026 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES",
1027 "%*c <null>", indentation, ' ');
1028 }
1029}
1030#endif
1031
1032
1033void
1034videoEditClasses_getBackgroundMusicSettings(
1035 bool* pResult,
1036 JNIEnv* pEnv,
1037 jobject object,
1038 M4xVSS_BGMSettings** ppSettings)
1039{
Basavapatna Dattaguru4fad6762011-02-27 21:15:18 -08001040 VideoEditJava_BackgroundMusicFieldIds fieldIds;
Dharmaray Kundargicd196d32011-01-16 15:47:16 -08001041 M4xVSS_BGMSettings* pSettings = M4OSA_NULL;
1042 bool converted = true;
Basavapatna Dattaguru4fad6762011-02-27 21:15:18 -08001043 memset(&fieldIds, 0, sizeof(VideoEditJava_BackgroundMusicFieldIds));
Dharmaray Kundargicd196d32011-01-16 15:47:16 -08001044 // Check if the previous action succeeded.
1045 if (*pResult)
1046 {
1047 // Log the function call.
1048 VIDEOEDIT_LOG_FUNCTION(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES",
1049 "videoEditClasses_getBackgroundMusicSettings()");
1050
1051 // Retrieve the field ids.
1052 videoEditJava_getBackgroundMusicFieldIds(pResult, pEnv, &fieldIds);
1053 }
1054
1055 // Only retrieve the BackgroundMusicSettings if the fields could be located.
1056 if (*pResult)
1057 {
1058 // Check if the object is valid.
1059 if (NULL != object)
1060 {
1061 // Allocate memory for the BackgroundMusicSettings.
1062 pSettings = (M4xVSS_BGMSettings*)videoEditOsal_alloc(pResult, pEnv,
1063 sizeof(M4xVSS_BGMSettings), "BackgroundMusicSettings");
1064
1065 // Check if memory could be allocated for the BackgroundMusicSettings.
1066 if (*pResult)
1067 {
1068 // Set the input file path.
1069 pSettings->pFile = (M4OSA_Char*)videoEditJava_getString(pResult, pEnv, object,
1070 fieldIds.file, M4OSA_NULL);
1071
1072 // Check if the input file path is valid.
1073 videoEditJava_checkAndThrowIllegalArgumentException(pResult, pEnv,
1074 (M4OSA_NULL == pSettings->pFile), "backgroundMusicSettings.file is null");
1075 }
1076
1077 // Check if the input file path could be retrieved.
1078 if (*pResult)
1079 {
1080 // Set the file type .3gp, .amr, .mp3.
1081 pSettings->FileType = M4VIDEOEDITING_kFileType_PCM;
1082 /*(M4VIDEOEDITING_FileType)videoEditJava_getClipTypeJavaToC(
1083 &converted, pEnv->GetIntField(object, fieldIds.fileType));*/
1084
1085 // Check if the file type is valid.
1086 videoEditJava_checkAndThrowIllegalArgumentException(pResult, pEnv,
1087 !converted, "backgroundMusicSettings.fileType is invalid");
1088 }
1089
1090 // Check if the file type could be retrieved.
1091 if (*pResult)
1092 {
1093 // Set the time, in milliseconds, at which the added audio track is inserted.
1094 pSettings->uiAddCts = (M4OSA_UInt32)pEnv->GetLongField(object,
1095 fieldIds.insertionTime);
1096
1097 // Set the volume, in percentage (0..100), of the added audio track.
1098 pSettings->uiAddVolume = (M4OSA_UInt32)pEnv->GetIntField(object,
1099 fieldIds.volumePercent);
1100
1101 // Set the start time of the loop in milli seconds.
1102 pSettings->uiBeginLoop = (M4OSA_UInt32)pEnv->GetLongField(object,
1103 fieldIds.beginLoop);
1104
1105 // Set the end time of the loop in milli seconds.
1106 pSettings->uiEndLoop = (M4OSA_UInt32)pEnv->GetLongField(object,
1107 fieldIds.endLoop);
1108 // Set the end time of the loop in milli seconds.
1109 pSettings->b_DuckingNeedeed =
1110 (M4OSA_Bool)pEnv->GetBooleanField(object, fieldIds.enableDucking);
1111
1112 // Set the end time of the loop in milli seconds.
1113 pSettings->InDucking_threshold =
1114 (M4OSA_Int32)pEnv->GetIntField(object, fieldIds.duckingThreshold);
1115
1116 // Set the end time of the loop in milli seconds.
1117 pSettings->lowVolume =
1118 (M4OSA_Float)(((M4OSA_Float)pEnv->GetIntField(object, fieldIds.lowVolume)));
1119
1120 // Set the end time of the loop in milli seconds.
1121 pSettings->bLoop = (M4OSA_Bool)pEnv->GetBooleanField(object, fieldIds.isLooping);
1122
1123 // Set sampling freq and channels
1124 pSettings->uiSamplingFrequency = M4VIDEOEDITING_k32000_ASF;
1125 pSettings->uiNumChannels = 2;
1126 }
1127
1128 // Check if settings could be set.
1129 if (*pResult)
1130 {
1131 // Return the settings.
1132 (*ppSettings) = pSettings;
1133 }
1134 else
1135 {
1136 // Free the settings.
1137 videoEditClasses_freeBackgroundMusicSettings(&pSettings);
1138 }
1139 }
1140 }
1141}
1142
1143void
1144videoEditClasses_freeBackgroundMusicSettings(
1145 M4xVSS_BGMSettings** ppSettings)
1146{
1147 // Check if memory was allocated for the BackgroundMusicSettings.
1148 if (M4OSA_NULL != (*ppSettings))
1149 {
1150 // Log the function call.
1151 VIDEOEDIT_LOG_FUNCTION(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES",
1152 "videoEditClasses_freeBackgroundMusicSettings()");
1153
1154 // Free the input file path.
1155 videoEditOsal_free((*ppSettings)->pFile);
1156 (*ppSettings)->pFile = M4OSA_NULL;
1157
1158 // Free the settings structure.
1159 videoEditOsal_free((*ppSettings));
1160 (*ppSettings) = M4OSA_NULL;
1161 }
1162}
1163
1164#ifdef VIDEOEDIT_LOGGING_ENABLED
1165void
1166videoEditClasses_logBackgroundMusicSettings(
1167 M4xVSS_BGMSettings* pSettings,
1168 int indentation)
1169{
1170 // Check if memory was allocated for the BackgroundMusicSettings.
1171 if (M4OSA_NULL != pSettings)
1172 {
1173 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES", "%*c pFile: %s",
1174 indentation, ' ',
1175 (M4OSA_NULL != pSettings->pFile) ? (char *)pSettings->pFile : "<null>");
1176 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES",
1177 "%*c FileType: %s", indentation, ' ',
1178 videoEditJava_getClipTypeString(pSettings->FileType));
1179
1180 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES", "%*c uiAddCts: %u ms",
1181 indentation, ' ', (unsigned int)pSettings->uiAddCts);
1182 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES", "%*c uiAddVolume: %u %%",
1183 indentation, ' ', (unsigned int)pSettings->uiAddVolume);
1184 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES", "%*c uiBeginLoop: %u ms",
1185 indentation, ' ', (unsigned int)pSettings->uiBeginLoop);
1186 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES", "%*c uiEndLoop: %u ms",
1187 indentation, ' ', (unsigned int)pSettings->uiEndLoop);
1188 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES", "%*c b_DuckingNeedeed:\
1189 %u ", indentation, ' ', (bool)pSettings->b_DuckingNeedeed);
1190 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES", "%*c InDucking_threshold: \
1191 %u ms", indentation, ' ', (unsigned int)pSettings->InDucking_threshold);
1192 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES", "%*c lowVolume: %2.2f ",\
1193 indentation, ' ', (float)pSettings->lowVolume);
1194 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES", "%*c bLoop: %u ms",\
1195 indentation, ' ', (bool)pSettings->bLoop);
1196 }
1197 else
1198 {
1199 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES", "%*c <null>",
1200 indentation, ' ');
1201 }
1202}
1203#endif
1204
1205#ifdef VIDEOEDIT_LOGGING_ENABLED
1206void
1207videoEditClasses_logClipProperties(
1208 M4VIDEOEDITING_ClipProperties* pProperties,
1209 int indentation)
1210{
1211 // Check if memory was allocated for the ClipProperties.
1212 if (M4OSA_NULL != pProperties)
1213 {
1214 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES",
1215 "%*c bAnalysed: %s", indentation, ' ',
1216 pProperties->bAnalysed ? "true" : "false");
1217 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES",
1218 "%*c Version: %d.%d.%d", indentation, ' ',
1219 pProperties->Version[0], pProperties->Version[1], pProperties->Version[2]);
1220 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES",
1221 "%*c uiClipDuration: %u", indentation, ' ',
1222 (unsigned int)pProperties->uiClipDuration);
1223 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES",
1224 "%*c FileType: %s", indentation, ' ',
1225 videoEditJava_getClipTypeString(pProperties->FileType));
1226 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES", "%*c ftyp:",
1227 indentation, ' ');
1228 videoEditClasses_logFtypBox(&pProperties->ftyp, indentation + VIDEOEDIT_LOG_INDENTATION);
1229
1230 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES",
1231 "%*c VideoStreamType: %s", indentation, ' ',
1232 videoEditJava_getVideoFormatString(pProperties->VideoStreamType));
1233 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES",
1234 "%*c uiClipVideoDuration: %u", indentation, ' ',
1235 (unsigned int)pProperties->uiClipVideoDuration);
1236 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES",
1237 "%*c uiVideoBitrate: %s", indentation, ' ',
1238 videoEditJava_getBitrateString(pProperties->uiVideoBitrate));
1239 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES",
1240 "%*c uiVideoMaxAuSize: %u", indentation, ' ',
1241 (unsigned int)pProperties->uiVideoMaxAuSize);
1242 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES",
1243 "%*c uiVideoWidth: %u", indentation, ' ',
1244 (unsigned int)pProperties->uiVideoWidth);
1245 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES",
1246 "%*c uiVideoHeight: %u", indentation, ' ',
1247 (unsigned int)(unsigned int)pProperties->uiVideoHeight);
1248 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES",
1249 "%*c uiVideoTimeScale: %u", indentation, ' ',
1250 (unsigned int)pProperties->uiVideoTimeScale);
1251 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES",
1252 "%*c fAverageFrameRate: %.3f", indentation, ' ',
1253 pProperties->fAverageFrameRate);
1254 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES",
1255 "%*c ProfileAndLevel: %s", indentation, ' ',
1256 videoEditJava_getVideoProfileString(pProperties->ProfileAndLevel));
1257 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES",
1258 "%*c uiH263level: %d", indentation, ' ',
1259 pProperties->uiH263level);
1260 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES",
1261 "%*c uiVideoProfile: %d", indentation, ' ',
1262 pProperties->uiVideoProfile);
1263 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES",
1264 "%*c bMPEG4dataPartition: %s", indentation, ' ',
1265 pProperties->bMPEG4dataPartition ? "true" : "false");
1266 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES",
1267 "%*c bMPEG4rvlc: %s", indentation, ' ',
1268 pProperties->bMPEG4rvlc ? "true" : "false");
1269 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES",
1270 "%*c bMPEG4resynchMarker: %s", indentation, ' ',
1271 pProperties->bMPEG4resynchMarker ? "true" : "false");
1272 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES",
1273 "%*c AudioStreamType: %s", indentation, ' ',
1274 videoEditJava_getAudioFormatString(pProperties->AudioStreamType));
1275 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES",
1276 "%*c uiClipAudioDuration: %u", indentation, ' ',
1277 (unsigned int)pProperties->uiClipAudioDuration);
1278 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES",
1279 "%*c uiAudioBitrate: %s", indentation, ' ',
1280 videoEditJava_getBitrateString(pProperties->uiAudioBitrate));
1281 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES",
1282 "%*c uiAudioMaxAuSize: %u", indentation, ' ',
1283 (unsigned int)pProperties->uiAudioMaxAuSize);
1284 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES",
1285 "%*c uiNbChannels: %u", indentation, ' ',
1286 (unsigned int)pProperties->uiNbChannels);
1287 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES",
1288 "%*c uiSamplingFrequency: %u", indentation, ' ',
1289 (unsigned int)pProperties->uiSamplingFrequency);
1290 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES",
1291 "%*c uiExtendedSamplingFrequency: %u", indentation, ' ',
1292 (unsigned int)pProperties->uiExtendedSamplingFrequency);
1293 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES",
1294 "%*c uiDecodedPcmSize: %u", indentation, ' ',
1295 (unsigned int)pProperties->uiDecodedPcmSize);
1296 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES",
1297 "%*c bVideoIsEditable: %s", indentation, ' ',
1298 pProperties->bVideoIsEditable ? "true" : "false");
1299 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES",
1300 "%*c bAudioIsEditable: %s", indentation, ' ',
1301 pProperties->bAudioIsEditable ? "true" : "false");
1302 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES",
1303 "%*c bVideoIsCompatibleWithMasterClip: %s", indentation, ' ',
1304 pProperties->bVideoIsCompatibleWithMasterClip ? "true" : "false");
1305 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES",
1306 "%*c bAudioIsCompatibleWithMasterClip: %s", indentation, ' ',
1307 pProperties->bAudioIsCompatibleWithMasterClip ? "true" : "false");
1308 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES",
1309 "%*c uiClipAudioVolumePercentage: %d", indentation, ' ',
1310 pProperties->uiClipAudioVolumePercentage);
1311 }
1312 else
1313 {
1314 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES", "%*c <null>",
1315 indentation, ' ');
1316 }
1317}
1318#endif
1319
1320void
1321videoEditClasses_getClipSettings(
1322 bool* pResult,
1323 JNIEnv* pEnv,
1324 jobject object,
1325 M4VSS3GPP_ClipSettings** ppSettings)
1326{
Basavapatna Dattaguru4fad6762011-02-27 21:15:18 -08001327
1328 VideoEditJava_ClipSettingsFieldIds fieldIds;
Dharmaray Kundargicd196d32011-01-16 15:47:16 -08001329 M4VSS3GPP_ClipSettings* pSettings = M4OSA_NULL;
1330 M4OSA_ERR result = M4NO_ERROR;
1331 bool converted = true;
Basavapatna Dattaguru4fad6762011-02-27 21:15:18 -08001332 memset(&fieldIds, 0, sizeof(VideoEditJava_ClipSettingsFieldIds));
Dharmaray Kundargicd196d32011-01-16 15:47:16 -08001333 // Check if the previous action succeeded.
1334 if (*pResult)
1335 {
1336 // Log the function call.
1337 VIDEOEDIT_LOG_FUNCTION(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES",
1338 "videoEditClasses_getClipSettings()");
1339
1340 // Retrieve the field ids.
1341 videoEditJava_getClipSettingsFieldIds(pResult, pEnv, &fieldIds);
1342 }
1343
1344 // Only validate the ClipSettings if the fields could be located.
1345 if (*pResult)
1346 {
1347 // Check if the clip is set.
1348 videoEditJava_checkAndThrowIllegalArgumentException(pResult, pEnv,
1349 (NULL == object),
1350 "clip is null");
1351 }
1352
1353 // Only retrieve the ClipSettings if the fields could be located and validated.
1354 if (*pResult)
1355 {
1356 // Allocate memory for the ClipSettings.
1357 pSettings = (M4VSS3GPP_ClipSettings *)videoEditOsal_alloc(pResult, pEnv,
1358 sizeof(M4VSS3GPP_ClipSettings), "ClipSettings");
1359
1360 // Check if memory could be allocated for the ClipSettings.
1361 if (*pResult)
1362 {
1363 // Log the API call.
1364 VIDEOEDIT_LOG_API(ANDROID_LOG_INFO, "VIDEO_EDITOR", "M4xVSS_CreateClipSettings()");
1365
1366 // Initialize the ClipSettings.
1367 result = M4xVSS_CreateClipSettings(pSettings, NULL, 0, 0);
1368
1369 // Log the result.
1370 VIDEOEDIT_LOG_RESULT(ANDROID_LOG_INFO, "VIDEO_EDITOR",
1371 videoEditOsal_getResultString(result));
1372
1373 // Check if the initialization succeeded.
1374 videoEditJava_checkAndThrowRuntimeException(pResult, pEnv,
1375 (M4NO_ERROR != result), result);
1376 }
1377
1378 // Check if the allocation and initialization succeeded
1379 //(required because pSettings is dereferenced).
1380 if (*pResult)
1381 {
1382 // Set the input file path.
1383 pSettings->pFile = (M4OSA_Char*)videoEditJava_getString(pResult, pEnv, object,
1384 fieldIds.clipPath, &pSettings->filePathSize);
1385
1386 // Check if the file path is valid.
1387 videoEditJava_checkAndThrowIllegalArgumentException(pResult, pEnv,
1388 (M4OSA_NULL == pSettings->pFile), "clip.clipPath is null");
1389 }
1390
1391 // Check if the input file could be retrieved.
1392 if (*pResult)
1393 {
1394 // Set the file type .3gp, .amr, .mp3.
1395 pSettings->FileType = (M4VIDEOEDITING_FileType)videoEditJava_getClipTypeJavaToC(
1396 &converted, pEnv->GetIntField(object, fieldIds.fileType));
1397
1398 if ( pSettings->FileType == M4VIDEOEDITING_kFileType_JPG)
1399 {
1400 pSettings->FileType = M4VIDEOEDITING_kFileType_ARGB8888;
1401 }
1402
1403 // Check if the file type is valid.
1404 videoEditJava_checkAndThrowIllegalArgumentException(pResult, pEnv,
1405 !converted, "clip.fileType is invalid");
1406 }
1407
1408 // Check if the file type could be retrieved.
1409 if (*pResult)
1410 {
1411 // Set the begin cut time, in milliseconds.
1412 pSettings->uiBeginCutTime =
1413 (M4OSA_UInt32)pEnv->GetIntField(object, fieldIds.beginCutTime);
1414
1415 // Set the end cut time, in milliseconds.
1416 pSettings->uiEndCutTime = (M4OSA_UInt32)pEnv->GetIntField(object, fieldIds.endCutTime);
1417
1418 // Set the begin cut time, in percent of clip duration (only for 3GPP clip !).
1419 pSettings->xVSS.uiBeginCutPercent =
1420 (M4OSA_UInt32)pEnv->GetIntField(object, fieldIds.beginCutPercent);
1421
1422 // Set the end cut time, in percent of clip duration (only for 3GPP clip !).
1423 pSettings->xVSS.uiEndCutPercent =
1424 (M4OSA_UInt32)pEnv->GetIntField(object, fieldIds.endCutPercent);
1425
1426 // Set the duration of the clip, if different from 0,
1427 // has priority on uiEndCutTime or uiEndCutPercent.
1428 pSettings->xVSS.uiDuration = 0;
1429
1430 // Set whether or not the pan and zoom mode is enabled.
1431 pSettings->xVSS.isPanZoom =
1432 (M4OSA_Bool)pEnv->GetBooleanField(object, fieldIds.panZoomEnabled);
1433
1434 // Set the pan and zoom start zoom percentage.
1435 pSettings->xVSS.PanZoomXa =
1436 (M4OSA_UInt16)pEnv->GetIntField(object, fieldIds.panZoomPercentStart);
1437
1438 // Set the pan and zoom start x.
1439 pSettings->xVSS.PanZoomTopleftXa =
1440 (M4OSA_UInt16)pEnv->GetIntField(object, fieldIds.panZoomTopLeftXStart);
1441
1442 // Set the pan and zoom start y.
1443 pSettings->xVSS.PanZoomTopleftYa =
1444 (M4OSA_UInt16)pEnv->GetIntField(object, fieldIds.panZoomTopLeftYStart);
1445
1446 // Set the pan and zoom end zoom percentage.
1447 pSettings->xVSS.PanZoomXb =
1448 (M4OSA_UInt16)pEnv->GetIntField(object, fieldIds.panZoomPercentEnd);
1449
1450 // Set the pan and zoom end x.
1451 pSettings->xVSS.PanZoomTopleftXb =
1452 (M4OSA_UInt16)pEnv->GetIntField(object, fieldIds.panZoomTopLeftXEnd);
1453
1454 // Set the pan and zoom end y.
1455 pSettings->xVSS.PanZoomTopleftYb =
1456 (M4OSA_UInt16)pEnv->GetIntField(object, fieldIds.panZoomTopLeftYEnd);
1457
1458 // Set the media rendering mode, only used with JPEG to crop, resize,
1459 // or render black borders.
1460 pSettings->xVSS.MediaRendering =
1461 (M4xVSS_MediaRendering)videoEditJava_getMediaRenderingJavaToC(
1462 &converted, pEnv->GetIntField(object,fieldIds.mediaRendering));
1463
1464 // Check if the media rendering is valid.
1465 videoEditJava_checkAndThrowIllegalArgumentException(pResult, pEnv, !converted,
1466 "clip.mediaRendering is invalid");
1467
1468 // Capture the rgb file width and height
1469 pSettings->ClipProperties.uiStillPicWidth =
1470 (M4OSA_UInt16)pEnv->GetIntField(object, fieldIds.rgbFileWidth);
1471 pSettings->ClipProperties.uiStillPicHeight =
1472 (M4OSA_UInt16)pEnv->GetIntField(object, fieldIds.rgbFileHeight);
1473
1474 VIDEOEDIT_LOG_FUNCTION(ANDROID_LOG_INFO, "VIDEO_EDITOR", \
1475 "getClipSettings-- rgbFileWidth %d ",
1476 pSettings->ClipProperties.uiStillPicWidth);
1477 VIDEOEDIT_LOG_FUNCTION(ANDROID_LOG_INFO, "VIDEO_EDITOR", \
1478 "getClipSettings-- rgbFileHeight %d ",
1479 pSettings->ClipProperties.uiStillPicHeight);
1480 }
1481
1482 // Check if settings could be set.
1483 if (*pResult)
1484 {
1485 // Return the settings.
1486 (*ppSettings) = pSettings;
1487 }
1488 else
1489 {
1490 // Free the settings.
1491 videoEditClasses_freeClipSettings(&pSettings);
1492 }
1493 }
1494}
1495
1496void
1497videoEditClasses_createClipSettings(
1498 bool* pResult,
1499 JNIEnv* pEnv,
1500 M4VSS3GPP_ClipSettings* pSettings,
1501 jobject* pObject)
1502{
Basavapatna Dattaguru4fad6762011-02-27 21:15:18 -08001503 VideoEditJava_ClipSettingsFieldIds fieldIds;
Dharmaray Kundargicd196d32011-01-16 15:47:16 -08001504 jclass clazz = NULL;
1505 jobject object = NULL;
Basavapatna Dattaguru4fad6762011-02-27 21:15:18 -08001506 memset(&fieldIds, 0, sizeof(VideoEditJava_ClipSettingsFieldIds));
Dharmaray Kundargicd196d32011-01-16 15:47:16 -08001507
1508 // Check if the previous action succeeded.
1509 if (*pResult)
1510 {
1511 // Log the function call.
1512 VIDEOEDIT_LOG_FUNCTION(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES",
1513 "videoEditClasses_createClipSettings()");
1514
1515 // Retrieve the class.
1516 videoEditJava_getClipSettingsClass(pResult, pEnv, &clazz);
1517
1518 // Retrieve the field ids.
1519 videoEditJava_getClipSettingsFieldIds(pResult, pEnv, &fieldIds);
1520 }
1521
1522 // Only create an object if the class and fields could be located.
1523 if (*pResult)
1524 {
1525 // Allocate a new object.
1526 object = pEnv->AllocObject(clazz);
1527 if (NULL != object)
1528 {
1529 // Set the clipPath field.
1530 pEnv->SetObjectField(object, fieldIds.clipPath, NULL);
1531
1532 // Set the fileType field.
1533 pEnv->SetIntField(object, fieldIds.fileType, videoEditJava_getClipTypeCToJava(
1534 pSettings->FileType));
1535
1536 // Set the beginCutTime field.
1537 pEnv->SetIntField(object, fieldIds.beginCutTime, pSettings->uiBeginCutTime);
1538
1539 // Set the endCutTime field.
1540 pEnv->SetIntField(object, fieldIds.endCutTime, pSettings->uiEndCutTime);
1541
1542 // Set the beginCutPercent field.
1543 pEnv->SetIntField(object, fieldIds.beginCutPercent, pSettings->xVSS.uiBeginCutPercent);
1544
1545 // Set the endCutPercent field.
1546 pEnv->SetIntField(object, fieldIds.endCutPercent, pSettings->xVSS.uiEndCutPercent);
1547
1548 // Set the panZoomEnabled field.
1549 pEnv->SetBooleanField(object, fieldIds.panZoomEnabled, pSettings->xVSS.isPanZoom);
1550
1551 // Set the panZoomPercentStart field.
1552 pEnv->SetIntField(object, fieldIds.panZoomPercentStart,
Dheeraj Sharma9803b842011-01-30 12:50:23 -08001553 (1000 - pSettings->xVSS.PanZoomXa));
Dharmaray Kundargicd196d32011-01-16 15:47:16 -08001554
1555 // Set the panZoomTopLeftXStart field.
1556 pEnv->SetIntField(object, fieldIds.panZoomTopLeftXStart,
1557 pSettings->xVSS.PanZoomTopleftXa);
1558
1559 // Set the panZoomTopLeftYStart field.
1560 pEnv->SetIntField(object, fieldIds.panZoomTopLeftYStart,
1561 pSettings->xVSS.PanZoomTopleftYa);
1562
1563 // Set the panZoomPercentEnd field.
1564 pEnv->SetIntField(object, fieldIds.panZoomPercentEnd,
Dheeraj Sharma9803b842011-01-30 12:50:23 -08001565 (1000 - pSettings->xVSS.PanZoomXb));
Dharmaray Kundargicd196d32011-01-16 15:47:16 -08001566
1567 // Set the panZoomTopLeftXEnd field.
1568 pEnv->SetIntField(object, fieldIds.panZoomTopLeftXEnd,
1569 pSettings->xVSS.PanZoomTopleftXb);
1570
1571 // Set the panZoomTopLeftYEnd field.
1572 pEnv->SetIntField(object, fieldIds.panZoomTopLeftYEnd,
1573 pSettings->xVSS.PanZoomTopleftYb);
1574
1575 // Set the mediaRendering field.
1576 pEnv->SetIntField(object, fieldIds.mediaRendering,
1577 videoEditJava_getMediaRenderingCToJava(pSettings->xVSS.MediaRendering));
1578
1579 // Set the rgb file width and height
1580 pEnv->SetIntField(object, fieldIds.rgbFileWidth,
1581 pSettings->ClipProperties.uiStillPicWidth );
1582
1583 pEnv->SetIntField(object, fieldIds.rgbFileHeight,
1584 pSettings->ClipProperties.uiStillPicHeight );
1585
1586 VIDEOEDIT_LOG_FUNCTION(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES",
1587 "rgbFileWeight %d rgbFileHeight %d ",
1588 pSettings->ClipProperties.uiStillPicWidth ,
1589 pSettings->ClipProperties.uiStillPicHeight);
1590
1591 // Return the object.
1592 (*pObject) = object;
1593 }
1594 }
1595}
1596void
1597videoEditPropClass_createProperties(
1598 bool* pResult,
1599 JNIEnv* pEnv,
1600 VideoEditPropClass_Properties* pProperties,
1601 jobject* pObject)
1602{
Basavapatna Dattaguru4fad6762011-02-27 21:15:18 -08001603 VideoEditJava_PropertiesFieldIds fieldIds;
Dharmaray Kundargicd196d32011-01-16 15:47:16 -08001604 jclass clazz = NULL;
1605 jobject object = NULL;
Basavapatna Dattaguru4fad6762011-02-27 21:15:18 -08001606 memset(&fieldIds, 0, sizeof(VideoEditJava_PropertiesFieldIds));
Dharmaray Kundargicd196d32011-01-16 15:47:16 -08001607 // Check if the previous action succeeded.
1608 if (*pResult)
1609 {
1610 // Log the function call.
1611 VIDEOEDIT_LOG_FUNCTION(ANDROID_LOG_INFO, "VIDEO_EDITOR_PROP_CLASSES",
1612 "videoEditPropClass_createProperties()");
1613
1614 // Retrieve the class.
1615 videoEditJava_getPropertiesClass(pResult, pEnv, &clazz);
1616
1617 // Retrieve the field ids.
1618 videoEditJava_getPropertiesFieldIds(pResult, pEnv, &fieldIds);
1619 }
1620
1621 // Only create an object if the class and fields could be located.
1622 if (*pResult)
1623 {
1624 // Allocate a new object.
1625 object = pEnv->AllocObject(clazz);
1626 if (NULL != object)
1627 {
1628 // Set the duration field.
1629 pEnv->SetIntField(object, fieldIds.duration, pProperties->uiClipDuration);
1630
1631 // Set the fileType field.
1632 pEnv->SetIntField(object, fieldIds.fileType,
1633 videoEditJava_getFileTypeCToJava(pProperties->FileType));
1634
1635 // Set the videoFormat field.
1636 pEnv->SetIntField(object, fieldIds.videoFormat,
1637 videoEditJava_getVideoFormatCToJava(pProperties->VideoStreamType));
1638
1639 // Set the videoDuration field.
1640 pEnv->SetIntField(object, fieldIds.videoDuration, pProperties->uiClipVideoDuration);
1641
1642 // Set the videoBitrate field.
1643 pEnv->SetIntField(object, fieldIds.videoBitrate, pProperties->uiVideoBitrate);
1644
1645 // Set the width field.
1646 pEnv->SetIntField(object, fieldIds.width, pProperties->uiVideoWidth);
1647
1648 // Set the height field.
1649 pEnv->SetIntField(object, fieldIds.height, pProperties->uiVideoHeight);
1650
1651 // Set the averageFrameRate field.
1652 pEnv->SetFloatField(object, fieldIds.averageFrameRate, pProperties->fAverageFrameRate);
1653
1654 // Set the profileAndLevel field.
1655 pEnv->SetIntField(object, fieldIds.profileAndLevel,
1656 videoEditJava_getVideoProfileCToJava(pProperties->ProfileAndLevel));
1657
1658 // Set the audioFormat field.
1659 pEnv->SetIntField(object, fieldIds.audioFormat,
1660 videoEditJava_getAudioFormatCToJava(pProperties->AudioStreamType));
1661
1662 // Set the audioDuration field.
1663 pEnv->SetIntField(object, fieldIds.audioDuration, pProperties->uiClipAudioDuration);
1664
1665 // Set the audioBitrate field.
1666 pEnv->SetIntField(object, fieldIds.audioBitrate, pProperties->uiAudioBitrate);
1667
1668 // Set the audioChannels field.
1669 pEnv->SetIntField(object, fieldIds.audioChannels, pProperties->uiNbChannels);
1670
1671 // Set the audioSamplingFrequency field.
1672 pEnv->SetIntField(object, fieldIds.audioSamplingFrequency,
1673 pProperties->uiSamplingFrequency);
1674
1675 // Return the object.
1676 (*pObject) = object;
1677 }
1678 }
1679}
1680
1681void
1682videoEditClasses_freeClipSettings(
1683 M4VSS3GPP_ClipSettings** ppSettings)
1684{
1685 // Check if memory was allocated for the ClipSettings.
1686 if (M4OSA_NULL != (*ppSettings))
1687 {
1688 // Log the function call.
1689 VIDEOEDIT_LOG_FUNCTION(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES",
1690 "videoEditClasses_freeClipSettings()");
1691
1692 // Free the input file path.
1693 videoEditOsal_free((*ppSettings)->pFile);
1694 (*ppSettings)->pFile = M4OSA_NULL;
1695 (*ppSettings)->filePathSize = 0;
1696
1697 // Free the clip settings.
1698 M4xVSS_FreeClipSettings((*ppSettings));
1699
1700 // Free the settings structure.
1701 videoEditOsal_free((*ppSettings));
1702 (*ppSettings) = M4OSA_NULL;
1703 }
1704}
1705
1706#ifdef VIDEOEDIT_LOGGING_ENABLED
1707void
1708videoEditClasses_logClipSettings(
1709 M4VSS3GPP_ClipSettings* pSettings,
1710 int indentation)
1711{
1712 // Check if memory was allocated for the ClipSettings.
1713 if (M4OSA_NULL != pSettings)
1714 {
1715 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES",
1716 "%*c pFile: %s", indentation, ' ',
1717 (M4OSA_NULL != pSettings->pFile) ? (char*)pSettings->pFile : "<null>");
1718 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES",
1719 "%*c FileType: %s", indentation, ' ',
1720 videoEditJava_getClipTypeString(pSettings->FileType));
1721 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES",
1722 "%*c filePathSize: %u", indentation, ' ',
1723 (unsigned int)pSettings->filePathSize);
1724 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES",
1725 "%*c ClipProperties:", indentation, ' ');
1726 videoEditClasses_logClipProperties(&pSettings->ClipProperties,
1727 indentation + VIDEOEDIT_LOG_INDENTATION);
1728 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES",
1729 "%*c uiBeginCutTime: %u ms", indentation, ' ',
1730 (unsigned int)pSettings->uiBeginCutTime);
1731 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES",
1732 "%*c uiEndCutTime: %u ms", indentation, ' ',
1733 (unsigned int)pSettings->uiEndCutTime);
1734 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES",
1735 "%*c uiBeginCutPercent: %u %%", indentation, ' ',
1736 (unsigned int)pSettings->xVSS.uiBeginCutPercent);
1737 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES",
1738 "%*c uiEndCutPercent: %u %%", indentation, ' ',
1739 (unsigned int)pSettings->xVSS.uiEndCutPercent);
1740 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES",
1741 "%*c uiDuration: %u ms", indentation, ' ',
1742 (unsigned int)pSettings->xVSS.uiDuration);
1743 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES",
1744 "%*c isPanZoom: %s", indentation, ' ',
1745 pSettings->xVSS.isPanZoom ? "true" : "false");
1746 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES",
1747 "%*c PanZoomXa: %d ms", indentation, ' ',
1748 pSettings->xVSS.PanZoomXa);
1749 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES",
1750 "%*c PanZoomTopleftXa: %d ms", indentation, ' ',
1751 pSettings->xVSS.PanZoomTopleftXa);
1752 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES",
1753 "%*c PanZoomTopleftYa: %d ms", indentation, ' ',
1754 pSettings->xVSS.PanZoomTopleftYa);
1755 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES",
1756 "%*c PanZoomXb: %d ms", indentation, ' ',
1757 pSettings->xVSS.PanZoomXb);
1758 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES",
1759 "%*c PanZoomTopleftXb: %d ms", indentation, ' ',
1760 pSettings->xVSS.PanZoomTopleftXb);
1761 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES",
1762 "%*c PanZoomTopleftYb: %d ms", indentation, ' ',
1763 pSettings->xVSS.PanZoomTopleftYb);
1764 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES",
1765 "%*c MediaRendering: %s", indentation, ' ',
1766 videoEditJava_getMediaRenderingString(pSettings->xVSS.MediaRendering));
1767 }
1768 else
1769 {
1770 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES",
1771 "%*c <null>", indentation, ' ');
1772 }
1773}
1774#endif
1775
1776
1777void
1778videoEditClasses_getEditSettings(
1779 bool* pResult,
1780 JNIEnv* pEnv,
1781 jobject object,
1782 M4VSS3GPP_EditSettings** ppSettings,
1783 bool flag)
1784{
Basavapatna Dattaguru4fad6762011-02-27 21:15:18 -08001785 VideoEditJava_EditSettingsFieldIds fieldIds;
Dharmaray Kundargicd196d32011-01-16 15:47:16 -08001786 jobjectArray clipSettingsArray = NULL;
1787 jsize clipSettingsArraySize = 0;
1788 jobject clipSettings = NULL;
1789 jobjectArray transitionSettingsArray = NULL;
1790 jsize transitionSettingsArraySize = 0;
1791 jobject transitionSettings = NULL;
1792 jobjectArray effectSettingsArray = NULL;
1793 jsize effectSettingsArraySize = 0;
1794 jobject effectSettings = NULL;
1795 jobject backgroundMusicSettings = NULL;
1796 int audioChannels = 0;
1797 M4VSS3GPP_EditSettings* pSettings = M4OSA_NULL;
1798 bool converted = true;
Basavapatna Dattaguru4fad6762011-02-27 21:15:18 -08001799 memset(&fieldIds, 0, sizeof(VideoEditJava_EditSettingsFieldIds));
Dharmaray Kundargicd196d32011-01-16 15:47:16 -08001800 // Check if the previous action succeeded.
1801 if (*pResult)
1802 {
1803 // Log the function call.
1804 VIDEOEDIT_LOG_FUNCTION(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES",
1805 "videoEditClasses_getEditSettings()");
1806
1807 // Retrieve the field ids.
1808 videoEditJava_getEditSettingsFieldIds(pResult, pEnv, &fieldIds);
1809 }
1810
1811 // Only retrieve the EditSettings if the previous action succeeded.
1812 if (*pResult)
1813 {
1814 // Check if the object is valid.
1815 if (NULL != object)
1816 {
1817 // Retrieve the clipSettingsArray.
1818 videoEditJava_getArray(pResult, pEnv, object,
1819 fieldIds.clipSettingsArray,
1820 &clipSettingsArray,
1821 &clipSettingsArraySize);
1822
1823 // Retrieve the transitionSettingsArray.
1824 videoEditJava_getArray(pResult, pEnv, object,
1825 fieldIds.transitionSettingsArray,
1826 &transitionSettingsArray,
1827 &transitionSettingsArraySize);
1828
1829 // Retrieve the effectSettingsArray.
1830 videoEditJava_getArray(pResult, pEnv, object,
1831 fieldIds.effectSettingsArray,
1832 &effectSettingsArray,
1833 &effectSettingsArraySize);
1834
1835 // Retrieve the backgroundMusicSettings.
1836 videoEditJava_getObject(pResult, pEnv, object, fieldIds.backgroundMusicSettings,
1837 &backgroundMusicSettings);
1838
1839 // Check if the arrays and background music settings object could be retrieved.
1840 if (*pResult)
1841 {
1842 // Retrieve the number of channels.
1843 audioChannels = pEnv->GetIntField(object, fieldIds.audioChannels);
1844 }
1845 }
1846 }
1847
1848 // Only validate the EditSettings if the fields could be located.
1849 if (*pResult)
1850 {
1851 // Check if there is at least one clip.
1852 //videoEditJava_checkAndThrowIllegalArgumentException(pResult, pEnv,
1853 // (clipSettingsArraySize < 1),
1854 // "there should be at least one clip");
1855 if(clipSettingsArraySize < 1) {
1856 return;
1857 }
1858 if(flag)
1859 {
1860 // Check if there are clips.
1861 if ((clipSettingsArraySize != 0) || (transitionSettingsArraySize != 0))
1862 {
1863 // The number of transitions must be equal to the number of clips - 1.
1864 videoEditJava_checkAndThrowIllegalArgumentException(pResult, pEnv,
1865 (clipSettingsArraySize != (transitionSettingsArraySize + 1)),
1866 "the number of transitions should be equal to the number of clips - 1");
1867 }
1868 }
1869 }
1870
1871 // Only retrieve the EditSettings if the fields could be located.
1872 if (*pResult)
1873 {
1874 // Check if the object is valid.
1875 if (NULL != object)
1876 {
1877 // Allocate memory for the EditSettings.
1878 pSettings = (M4VSS3GPP_EditSettings*)videoEditOsal_alloc(pResult, pEnv,
1879 sizeof(M4VSS3GPP_EditSettings), "EditSettings");
1880
1881 // Check if memory could be allocated for the EditSettings.
1882 if (*pResult)
1883 {
1884 // Set the number of clips that will be edited.
1885 pSettings->uiClipNumber = clipSettingsArraySize;
1886
1887 // Check if the clip settings array contains items.
1888 if (clipSettingsArraySize > 0)
1889 {
1890 // Allocate memory for the clip settings array.
1891 pSettings->pClipList = (M4VSS3GPP_ClipSettings **)videoEditOsal_alloc(pResult,
1892 pEnv,
1893 clipSettingsArraySize * sizeof(M4VSS3GPP_ClipSettings *),
1894 "ClipSettingsArray");
1895 if (*pResult)
1896 {
1897 // Loop over all clip settings objects.
1898 for (int i = 0; ((*pResult) && (i < clipSettingsArraySize)); i++)
1899 {
1900 // Get the clip settings object.
1901 clipSettings = pEnv->GetObjectArrayElement(clipSettingsArray, i);
1902
1903 // Get the clip settings.
1904 videoEditClasses_getClipSettings(pResult, pEnv, clipSettings,
1905 &pSettings->pClipList[i]);
1906 }
1907 }
1908 }
1909
1910 // Check if the transition settings array contains items.
1911 if (transitionSettingsArraySize > 0)
1912 {
1913 // Allocate memory for the transition settings array.
1914 pSettings->pTransitionList =
1915 (M4VSS3GPP_TransitionSettings **)videoEditOsal_alloc(pResult,
1916 pEnv, transitionSettingsArraySize * sizeof(M4VSS3GPP_TransitionSettings *),
1917 "TransitionSettingsArray");
1918 if (*pResult)
1919 {
1920 // Loop over all transition settings objects.
1921 for (int i = 0; ((*pResult) && (i < transitionSettingsArraySize)); i++)
1922 {
1923 // Get the transition settings object.
1924 transitionSettings =
1925 pEnv->GetObjectArrayElement(transitionSettingsArray, i);
1926
1927 // Get the transition settings.
1928 videoEditClasses_getTransitionSettings(pResult, pEnv,
1929 transitionSettings, &pSettings->pTransitionList[i]);
1930 }
1931 }
1932 }
1933
1934 // Check if the effect settings array contains items.
1935 if (effectSettingsArraySize > 0)
1936 {
1937 // Allocate memory for the effect settings array.
1938 pSettings->Effects = (M4VSS3GPP_EffectSettings*)videoEditOsal_alloc(pResult,
1939 pEnv,
1940 effectSettingsArraySize * sizeof(M4VSS3GPP_EffectSettings),
1941 "EffectSettingsArray");
1942 if (*pResult)
1943 {
1944 // Loop over all effect settings objects.
1945 for (int i = 0; ((*pResult) && (i < effectSettingsArraySize)); i++)
1946 {
1947 // Get the effect settings object.
1948 effectSettings = pEnv->GetObjectArrayElement(effectSettingsArray, i);
1949
1950 // Get the effect settings.
1951 videoEditClasses_getEffectSettings(pResult, pEnv, effectSettings,
1952 &pSettings->Effects[i]);
1953 }
1954 }
1955 }
1956
1957 // Check if the clips, transitions and effects could be set.
1958 if (*pResult)
1959 {
1960 // Set the number of effects in the clip.
1961 pSettings->nbEffects = (M4OSA_UInt8)effectSettingsArraySize;
1962
1963 // Set the frame rate of the output video.
1964 pSettings->videoFrameRate =
1965 (M4VIDEOEDITING_VideoFramerate)videoEditJava_getVideoFrameRateJavaToC(
1966 &converted, pEnv->GetIntField(object, fieldIds.videoFrameRate));
1967
1968 // Check if the frame rate is valid.
1969 videoEditJava_checkAndThrowIllegalArgumentException(pResult, pEnv,
1970 !converted, "editSettings.videoFrameRate is invalid");
1971 }
1972
1973 // Check if the frame rate could be set.
1974 if (*pResult)
1975 {
1976 // Set the path of the output file.
1977 pSettings->pOutputFile = (M4OSA_Char*)videoEditJava_getString(pResult, pEnv,
1978 object, fieldIds.outputFile, &pSettings->uiOutputPathSize);
1979 }
1980
1981 // Check if path of the output file could be set.
1982 if (*pResult)
1983 {
1984 // Set the path of the temporary file produced when using
1985 // the constant memory 3gp writer.
1986 pSettings->pTemporaryFile = M4OSA_NULL;
1987
1988 // Set the output video size.
1989 pSettings->xVSS.outputVideoSize =
1990 (M4VIDEOEDITING_VideoFrameSize)videoEditJava_getVideoFrameSizeJavaToC(
1991 &converted, pEnv->GetIntField(object, fieldIds.videoFrameSize));
1992
1993 // Check if the output video size is valid.
1994 videoEditJava_checkAndThrowIllegalArgumentException(pResult, pEnv,
1995 !converted, "editSettings.videoFrameSize is invalid");
1996 }
1997
1998 // Check if the output video size could be set.
1999 if (*pResult)
2000 {
2001 // Set the output video format.
2002 pSettings->xVSS.outputVideoFormat =
2003 (M4VIDEOEDITING_VideoFormat)videoEditJava_getVideoFormatJavaToC(
2004 &converted, pEnv->GetIntField(object, fieldIds.videoFormat));
2005
2006 // Check if the output video format is valid.
2007 videoEditJava_checkAndThrowIllegalArgumentException(pResult, pEnv,
2008 !converted, "editSettings.videoFormat is invalid");
2009 }
2010
2011 // Check if the output video format could be set.
2012 if (*pResult)
2013 {
2014 // Set the output audio format.
2015 pSettings->xVSS.outputAudioFormat =
2016 (M4VIDEOEDITING_AudioFormat)videoEditJava_getAudioFormatJavaToC(
2017 &converted, pEnv->GetIntField(object, fieldIds.audioFormat));
2018
2019 // Check if the output audio format is valid.
2020 videoEditJava_checkAndThrowIllegalArgumentException(pResult, pEnv,
2021 !converted, "editSettings.audioFormat is invalid");
2022 }
2023
2024 // Check if the output audio format could be set.
2025 if (*pResult)
2026 {
2027 // Set the output audio sampling frequency when not replacing the audio,
2028 // or replacing it with MP3 audio.
2029 pSettings->xVSS.outputAudioSamplFreq =
2030 (M4VIDEOEDITING_AudioSamplingFrequency)\
2031 videoEditJava_getAudioSamplingFrequencyJavaToC(
2032 &converted, pEnv->GetIntField(object, fieldIds.audioSamplingFreq));
2033
2034 // Check if the output audio sampling frequency is valid.
2035 videoEditJava_checkAndThrowIllegalArgumentException(pResult, pEnv,
2036 !converted, "editSettings.audioSamplingFreq is invalid");
2037 }
2038
2039 // Check if the output audio sampling frequency could be set.
2040 if (*pResult)
2041 {
2042 // Check if the number of audio channels is valid.
2043 videoEditJava_checkAndThrowIllegalArgumentException(pResult, pEnv,
2044 ((0 != audioChannels ) ||
2045 ((M4VIDEOEDITING_kNoneAudio != pSettings->xVSS.outputAudioFormat) &&
2046 (M4VIDEOEDITING_kNullAudio != pSettings->xVSS.outputAudioFormat) ) ) &&
2047 (1 != audioChannels ) &&
2048 (2 != audioChannels ),
2049 "editSettings.audioChannels must be set to 0, 1 or 2");
2050 }
2051
2052 // Check if the number of audio channels is valid.
2053 if (*pResult)
2054 {
2055 // Set the maximum output file size (MMS usecase).
2056 pSettings->xVSS.outputFileSize = (M4OSA_UInt32)pEnv->GetIntField(object,
2057 fieldIds.maxFileSize);
2058
2059 // Whether or not the audio is mono, only valid for AAC.
2060 pSettings->xVSS.bAudioMono = (M4OSA_Bool)(1 == audioChannels);
2061
2062 // Set the output video bitrate.
2063 pSettings->xVSS.outputVideoBitrate = (M4OSA_UInt32)pEnv->GetIntField(object,
2064 fieldIds.videoBitrate);
2065
2066 // Set the output audio bitrate.
2067 pSettings->xVSS.outputAudioBitrate = (M4OSA_UInt32)pEnv->GetIntField(object,
2068 fieldIds.audioBitrate);
2069
2070 // Set the background music settings.
2071 videoEditClasses_getBackgroundMusicSettings(pResult, pEnv,
2072 backgroundMusicSettings, &pSettings->xVSS.pBGMtrack);
2073
2074 // Set the text rendering function (will be set elsewhere).
2075 pSettings->xVSS.pTextRenderingFct = M4OSA_NULL;
2076 pSettings->PTVolLevel =
2077 (M4OSA_Float)pEnv->GetIntField(object, fieldIds.primaryTrackVolume);
2078 }
2079 }
2080
2081 // Check if settings could be set.
2082 if (*pResult)
2083 {
2084 // Return the settings.
2085 (*ppSettings) = pSettings;
2086 }
2087 else
2088 {
2089 // Free the settings.
2090 videoEditClasses_freeEditSettings(&pSettings);
2091 }
2092 }
2093 }
2094}
2095
2096void
2097videoEditClasses_freeEditSettings(
2098 M4VSS3GPP_EditSettings** ppSettings)
2099{
2100 // Check if memory was allocated for the EditSettings.
2101 if (M4OSA_NULL != (*ppSettings))
2102 {
2103 // Log the function call.
2104 VIDEOEDIT_LOG_FUNCTION(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES",
2105 "videoEditClasses_freeEditSettings()");
2106
2107 // Free the background music settings.
2108 videoEditClasses_freeBackgroundMusicSettings(&(*ppSettings)->xVSS.pBGMtrack);
2109
2110 // Free the path of the output file.
2111 videoEditOsal_free((*ppSettings)->pOutputFile);
2112 (*ppSettings)->pOutputFile = M4OSA_NULL;
2113 (*ppSettings)->uiOutputPathSize = 0;
2114
2115 // Check if the EffectSettings should be freed.
2116 if (M4OSA_NULL != (*ppSettings)->Effects)
2117 {
2118 // Loop over all effect settings.
2119 for (int i = 0; i < (*ppSettings)->nbEffects; i++)
2120 {
2121 // Free the effect settings.
2122 videoEditClasses_freeEffectSettings(&(*ppSettings)->Effects[i]);
2123 }
2124
2125 // Free the memory for the effect settings array.
2126 videoEditOsal_free((*ppSettings)->Effects);
2127 (*ppSettings)->Effects = M4OSA_NULL;
2128 }
2129
2130 // Reset the number of effects in the clip.
2131 (*ppSettings)->nbEffects = 0;
2132
2133 // Check if there are clips.
2134 if (0 < (*ppSettings)->uiClipNumber)
2135 {
2136 // Check if the TransitionSettings should be freed.
2137 if (M4OSA_NULL != (*ppSettings)->pTransitionList)
2138 {
2139 // Loop over all transition settings.
2140 for (int i = 0; i < ((*ppSettings)->uiClipNumber - 1); i++)
2141 {
2142 // Free the transition settings.
2143 videoEditClasses_freeTransitionSettings(&(*ppSettings)->pTransitionList[i]);
2144 }
2145
2146 // Free the memory for the transition settings array.
2147 videoEditOsal_free((*ppSettings)->pTransitionList);
2148 (*ppSettings)->pTransitionList = M4OSA_NULL;
2149 }
2150
2151 // Check if the ClipSettings should be freed.
2152 if (M4OSA_NULL != (*ppSettings)->pClipList)
2153 {
2154 // Loop over all clip settings.
2155 for (int i = 0; i < (*ppSettings)->uiClipNumber; i++)
2156 {
2157 // Free the clip settings.
2158 videoEditClasses_freeClipSettings(&(*ppSettings)->pClipList[i]);
2159 }
2160
2161 // Free the memory for the clip settings array.
2162 videoEditOsal_free((*ppSettings)->pClipList);
2163 (*ppSettings)->pClipList = M4OSA_NULL;
2164 }
2165 }
2166
2167 // Reset the number of clips.
2168 (*ppSettings)->uiClipNumber = 0;
2169
2170 // Free the settings structure.
2171 videoEditOsal_free((*ppSettings));
2172 (*ppSettings) = M4OSA_NULL;
2173 }
2174}
2175
2176#ifdef VIDEOEDIT_LOGGING_ENABLED
2177void
2178videoEditClasses_logEditSettings(
2179 M4VSS3GPP_EditSettings* pSettings,
2180 int indentation)
2181{
2182 // Check if memory was allocated for the EditSettings.
2183 if (M4OSA_NULL != pSettings)
2184 {
2185 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES",
2186 "%*c uiClipNumber: %d", indentation, ' ',
2187 pSettings->uiClipNumber);
2188 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES",
2189 "%*c uiMasterClip: %d", indentation, ' ',
2190 pSettings->uiMasterClip);
2191 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES",
2192 "%*c pClipList: %s", indentation, ' ',
2193 (M4OSA_NULL != pSettings->pClipList) ? " " : "<null>");
2194 if (M4OSA_NULL != pSettings->pClipList)
2195 {
2196 indentation += VIDEOEDIT_LOG_INDENTATION;
2197 for (int i = 0; i < pSettings->uiClipNumber; i++)
2198 {
2199 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES",
2200 "%*c pClipList[%d]:", indentation, ' ',
2201 i);
2202 videoEditClasses_logClipSettings(pSettings->pClipList[i],
2203 indentation + VIDEOEDIT_LOG_INDENTATION);
2204 }
2205 indentation -= VIDEOEDIT_LOG_INDENTATION;
2206 }
2207 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES",
2208 "%*c pTransitionList: %s", indentation, ' ',
2209 (M4OSA_NULL != pSettings->pTransitionList) ? " " : "<null>");
2210 if (M4OSA_NULL != pSettings->pTransitionList)
2211 {
2212 indentation += VIDEOEDIT_LOG_INDENTATION;
2213 for (int i = 0; i < (pSettings->uiClipNumber - 1); i++)
2214 {
2215 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES",
2216 "%*c pTransitionList[%d]:", indentation, ' ', i);
2217 videoEditClasses_logTransitionSettings(pSettings->pTransitionList[i],
2218 indentation + VIDEOEDIT_LOG_INDENTATION);
2219 }
2220 indentation -= VIDEOEDIT_LOG_INDENTATION;
2221 }
2222 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES",
2223 "%*c Effects: %s", indentation, ' ',
2224 (M4OSA_NULL != pSettings->Effects) ? " " : "<null>");
2225 if (M4OSA_NULL != pSettings->Effects)
2226 {
2227 indentation += VIDEOEDIT_LOG_INDENTATION;
2228 for (int i = 0; i < pSettings->nbEffects; i++)
2229 {
2230 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES",
2231 "%*c Effects[%d]:", indentation, ' ', i);
2232 videoEditClasses_logEffectSettings(&pSettings->Effects[i],
2233 indentation + VIDEOEDIT_LOG_INDENTATION);
2234 }
2235 indentation -= VIDEOEDIT_LOG_INDENTATION;
2236 }
2237 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES",
2238 "%*c nbEffects: %d", indentation, ' ',
2239 pSettings->nbEffects);
2240 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES",
2241 "%*c videoFrameRate: %s", indentation, ' ',
2242 videoEditJava_getVideoFrameRateString(pSettings->videoFrameRate));
2243 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES",
2244 "%*c pOutputFile: %s", indentation, ' ',
2245 (M4OSA_NULL != pSettings->pOutputFile) ? (char*)pSettings->pOutputFile : "<null>");
2246 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES",
2247 "%*c uiOutputPathSize: %u", indentation, ' ',
2248 (unsigned int)pSettings->uiOutputPathSize);
2249 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES",
2250 "%*c pTemporaryFile: %s", indentation, ' ',
2251 (M4OSA_NULL != pSettings->pTemporaryFile) ?\
2252 (char*)pSettings->pTemporaryFile : "<null>");
2253 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES",
2254 "%*c outputVideoSize: %s", indentation, ' ',
2255 videoEditJava_getVideoFrameSizeString(pSettings->xVSS.outputVideoSize));
2256 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES",
2257 "%*c outputVideoFormat: %s", indentation, ' ',
2258 videoEditJava_getVideoFormatString(pSettings->xVSS.outputVideoFormat));
2259 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES",
2260 "%*c outputAudioFormat: %s", indentation, ' ',
2261 videoEditJava_getAudioFormatString(pSettings->xVSS.outputAudioFormat));
2262 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES",
2263 "%*c outputAudioSamplFreq: %s", indentation, ' ',
2264 videoEditJava_getAudioSamplingFrequencyString(pSettings->xVSS.outputAudioSamplFreq));
2265 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES",
2266 "%*c outputFileSize: %u", indentation, ' ',
2267 (unsigned int)pSettings->xVSS.outputFileSize);
2268 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES",
2269 "%*c bAudioMono: %s", indentation, ' ',
2270 pSettings->xVSS.bAudioMono ? "true" : "false");
2271 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES",
2272 "%*c outputVideoBitrate: %s", indentation, ' ',
2273 videoEditJava_getBitrateString(pSettings->xVSS.outputVideoBitrate));
2274 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES",
2275 "%*c outputAudioBitrate: %s", indentation, ' ',
2276 videoEditJava_getBitrateString(pSettings->xVSS.outputAudioBitrate));
2277 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES",
2278 "%*c pBGMtrack:", indentation, ' ');
2279 videoEditClasses_logBackgroundMusicSettings(pSettings->xVSS.pBGMtrack,
2280 indentation + VIDEOEDIT_LOG_INDENTATION);
2281 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES",
2282 "%*c pTextRenderingFct: %s", indentation, ' ',
2283 (M4OSA_NULL != pSettings->xVSS.pTextRenderingFct) ? "set" : "<null>");
2284 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES",
2285 "%*c PTVolLevel: %u", indentation, ' ',
2286 (unsigned int)pSettings->PTVolLevel);
2287 }
2288 else
2289 {
2290 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES",
2291 "%*c <null>", indentation, ' ');
2292 }
2293}
2294#endif
2295
2296
2297void
2298videoEditClasses_getEffectSettings(
2299 bool* pResult,
2300 JNIEnv* pEnv,
2301 jobject object,
2302 M4VSS3GPP_EffectSettings* pSettings)
2303{
Basavapatna Dattaguru4fad6762011-02-27 21:15:18 -08002304
2305 VideoEditJava_EffectSettingsFieldIds fieldIds;
Dharmaray Kundargicd196d32011-01-16 15:47:16 -08002306 bool converted = true;
Basavapatna Dattaguru4fad6762011-02-27 21:15:18 -08002307 memset(&fieldIds, 0, sizeof(VideoEditJava_EffectSettingsFieldIds));
Dharmaray Kundargicd196d32011-01-16 15:47:16 -08002308
2309 // Check if the previous action succeeded.
2310 if (*pResult)
2311 {
2312 // Log the function call.
2313 VIDEOEDIT_LOG_FUNCTION(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES",
2314 "videoEditClasses_getEffectSettings()");
2315
2316 // Retrieve the field ids.
2317 videoEditJava_getEffectSettingsFieldIds(pResult, pEnv, &fieldIds);
2318 }
2319
2320 // Only validate the EffectSettings if the fields could be located.
2321 if (*pResult)
2322 {
2323 // Check if the effect is set.
2324 videoEditJava_checkAndThrowIllegalArgumentException(pResult, pEnv,
2325 (NULL == object),
2326 "effect is null");
2327 }
2328
2329 // Only retrieve the EffectSettings if the fields could be located and validated.
2330 if (*pResult)
2331 {
2332 // Set the start time in milliseconds.
2333 pSettings->uiStartTime = (M4OSA_UInt32)pEnv->GetIntField(object, fieldIds.startTime);
2334
2335 // Set the duration in milliseconds.
2336 pSettings->uiDuration = (M4OSA_UInt32)pEnv->GetIntField(object, fieldIds.duration);
2337
2338 // Set the video effect type, None, FadeIn, FadeOut, etc.
2339 pSettings->VideoEffectType =
2340 (M4VSS3GPP_VideoEffectType)videoEditJava_getVideoEffectJavaToC(
2341 &converted, pEnv->GetIntField(object, fieldIds.videoEffectType));
2342
2343 // Check if the video effect type is valid.
2344 videoEditJava_checkAndThrowIllegalArgumentException(pResult, pEnv,
2345 !converted, "effect.videoEffectType is invalid");
2346 }
2347
2348 // Check if the video effect type could be set.
2349 if (*pResult)
2350 {
2351 // Set the external effect function.
2352 pSettings->ExtVideoEffectFct = M4OSA_NULL;
2353
2354 // Set the context given to the external effect function.
2355 pSettings->pExtVideoEffectFctCtxt = M4OSA_NULL;
2356
2357 // Set the audio effect type, None, FadeIn, FadeOut.
2358 pSettings->AudioEffectType =
2359 (M4VSS3GPP_AudioEffectType)videoEditJava_getAudioEffectJavaToC(
2360 &converted, pEnv->GetIntField(object, fieldIds.audioEffectType));
2361
2362 // Check if the audio effect type is valid.
2363 videoEditJava_checkAndThrowIllegalArgumentException(pResult, pEnv,
2364 !converted, "effect.audioEffectType is invalid");
2365 }
2366
2367 // Check if the audio effect type could be set.
2368 if (*pResult)
2369 {
2370 // Set the start in percentage of the cut clip duration.
2371 pSettings->xVSS.uiStartPercent = (M4OSA_UInt32)pEnv->GetIntField(object,
2372 fieldIds.startPercent);
2373
2374 // Set the duration in percentage of the ((clip duration) - (effect starttime)).
2375 pSettings->xVSS.uiDurationPercent = (M4OSA_UInt32)pEnv->GetIntField(object,
2376 fieldIds.durationPercent);
2377
2378 // Set the framing file path (GIF/PNG file).
2379 pSettings->xVSS.pFramingFilePath = (M4OSA_Char*)videoEditJava_getString(pResult, pEnv,
2380 object, fieldIds.framingFile, M4OSA_NULL);
2381
2382 // Check if this is a framing effect.
2383 if (M4xVSS_kVideoEffectType_Framing == (M4xVSS_VideoEffectType)pSettings->VideoEffectType)
2384 {
2385 // Check if the framing file path is valid.
2386 videoEditJava_checkAndThrowIllegalArgumentException(pResult, pEnv,
2387 (M4OSA_NULL == pSettings->xVSS.pFramingFilePath), "effect.framingFile is null");
2388 }
2389 }
2390
2391 // Check if the framing file path could be retrieved.
2392 if (*pResult)
2393 {
2394 // Set the Framing RGB565 buffer.
2395 pSettings->xVSS.pFramingBuffer = M4OSA_NULL;
2396
2397 // Set the top-left X coordinate in the output picture
2398 // where the added frame will be displayed.
2399 pSettings->xVSS.topleft_x = (M4OSA_UInt32)pEnv->GetIntField(object, fieldIds.topLeftX);
2400
2401 // Set the top-left Y coordinate in the output picture
2402 // where the added frame will be displayed.
2403 pSettings->xVSS.topleft_y = (M4OSA_UInt32)pEnv->GetIntField(object, fieldIds.topLeftY);
2404
2405 // Set whether or not the framing image is resized to output video size.
2406 pSettings->xVSS.bResize =
2407 (M4OSA_Bool)pEnv->GetBooleanField(object, fieldIds.framingResize);
2408
2409 // Set the new size to which framing buffer needs to be resized to
2410 pSettings->xVSS.framingScaledSize =
2411 (M4VIDEOEDITING_VideoFrameSize)pEnv->GetIntField(object, fieldIds.framingScaledSize);
2412
2413 // Set the text buffer.
2414 pSettings->xVSS.pTextBuffer = (M4OSA_Char*)videoEditJava_getString(pResult, pEnv, object,
2415 fieldIds.text, &pSettings->xVSS.textBufferSize);
2416 }
2417
2418 // Check if the text buffer could be retrieved.
2419 if (*pResult)
2420 {
2421 // Set the data used by the font engine (size, color...).
2422 pSettings->xVSS.pRenderingData = (M4OSA_Char*)videoEditJava_getString(pResult, pEnv,
2423 object, fieldIds.textRenderingData, M4OSA_NULL);
2424 }
2425
2426 // Check if the text rendering data could be retrieved.
2427 if (*pResult)
2428 {
2429 // Set the text plane width.
2430 pSettings->xVSS.uiTextBufferWidth = (M4OSA_UInt32)pEnv->GetIntField(object,
2431 fieldIds.textBufferWidth);
2432
2433 // Set the text plane height.
2434 pSettings->xVSS.uiTextBufferHeight = (M4OSA_UInt32)pEnv->GetIntField(object,
2435 fieldIds.textBufferHeight);
2436
2437 // Set the processing rate of the effect added when using the Fifties effect.
2438 pSettings->xVSS.uiFiftiesOutFrameRate = (M4OSA_UInt32)pEnv->GetIntField(object,
2439 fieldIds.fiftiesFrameRate);
2440
2441 // Set the RGB16 input color of the effect added when using the rgb16 color effect.
2442 pSettings->xVSS.uiRgb16InputColor = (M4OSA_UInt16)pEnv->GetIntField(object,
2443 fieldIds.rgb16InputColor);
2444
2445 // Set the start percentage of Alpha blending.
2446 pSettings->xVSS.uialphaBlendingStart = (M4OSA_UInt8)pEnv->GetIntField(object,
2447 fieldIds.alphaBlendingStartPercent);
2448
2449 // Set the middle percentage of Alpha blending.
2450 pSettings->xVSS.uialphaBlendingMiddle = (M4OSA_UInt8)pEnv->GetIntField(object,
2451 fieldIds.alphaBlendingMiddlePercent);
2452
2453 // Set the end percentage of Alpha blending.
2454 pSettings->xVSS.uialphaBlendingEnd = (M4OSA_UInt8)pEnv->GetIntField(object,
2455 fieldIds.alphaBlendingEndPercent);
2456
2457 // Set the duration, in percentage of effect duration, of the FadeIn phase.
2458 pSettings->xVSS.uialphaBlendingFadeInTime = (M4OSA_UInt8)pEnv->GetIntField(object,
2459 fieldIds.alphaBlendingFadeInTimePercent);
2460
2461 // Set the duration, in percentage of effect duration, of the FadeOut phase.
2462 pSettings->xVSS.uialphaBlendingFadeOutTime = (M4OSA_UInt8)pEnv->GetIntField(object,
2463 fieldIds.alphaBlendingFadeOutTimePercent);
2464
2465 if (pSettings->xVSS.pFramingFilePath != M4OSA_NULL)
2466 {
2467 pSettings->xVSS.pFramingBuffer =
2468 (M4VIFI_ImagePlane *)M4OSA_malloc(sizeof(M4VIFI_ImagePlane),
2469 0x00,(M4OSA_Char *)"framing buffer");
2470 }
2471
2472 if (pSettings->xVSS.pFramingBuffer != M4OSA_NULL)
2473 {
2474 // OverFrame height and width
2475 pSettings->xVSS.pFramingBuffer->u_width = pEnv->GetIntField(object,
2476 fieldIds.width);
2477
2478 pSettings->xVSS.pFramingBuffer->u_height = pEnv->GetIntField(object,
2479 fieldIds.height);
2480
2481 pSettings->xVSS.width = pSettings->xVSS.pFramingBuffer->u_width;
2482 pSettings->xVSS.height = pSettings->xVSS.pFramingBuffer->u_height;
Dharmaray Kundargic16ccc12011-01-21 19:20:49 -08002483 pSettings->xVSS.rgbType = M4VSS3GPP_kRGB565;
Dharmaray Kundargicd196d32011-01-16 15:47:16 -08002484
2485 VIDEOEDIT_LOG_FUNCTION(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES",
2486 "pFramingBuffer u_width %d ", pSettings->xVSS.pFramingBuffer->u_width);
2487 VIDEOEDIT_LOG_FUNCTION(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES",
2488 "pFramingBuffer u_height %d", pSettings->xVSS.pFramingBuffer->u_height);
2489
2490 }
2491
2492 // Check if settings could be set.
2493 if (!(*pResult))
2494 {
2495 // Free the settings.
2496 videoEditClasses_freeEffectSettings(pSettings);
2497 }
2498 }
2499}
2500
2501void
2502videoEditClasses_freeEffectSettings(
2503 M4VSS3GPP_EffectSettings* pSettings)
2504{
2505 // Check if memory was allocated for the EffectSettings.
2506 if (M4OSA_NULL != pSettings)
2507 {
2508 // Log the function call.
2509 VIDEOEDIT_LOG_FUNCTION(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES",
2510 "videoEditClasses_freeEffectSettings()");
2511
2512 // Free the data used by the font engine (size, color...).
2513 videoEditOsal_free(pSettings->xVSS.pRenderingData);
2514 pSettings->xVSS.pRenderingData = M4OSA_NULL;
2515
2516 // Free the text buffer.
2517 videoEditOsal_free(pSettings->xVSS.pTextBuffer);
2518 pSettings->xVSS.pTextBuffer = M4OSA_NULL;
2519 pSettings->xVSS.textBufferSize = 0;
2520
2521 // Free the framing file path.
2522 videoEditOsal_free(pSettings->xVSS.pFramingFilePath);
2523 pSettings->xVSS.pFramingFilePath = M4OSA_NULL;
2524 }
2525}
2526
2527#ifdef VIDEOEDIT_LOGGING_ENABLED
2528void
2529videoEditClasses_logEffectSettings(
2530 M4VSS3GPP_EffectSettings* pSettings,
2531 int indentation)
2532{
2533 // Check if memory was allocated for the EffectSettings.
2534 if (M4OSA_NULL != pSettings)
2535 {
2536 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES",
2537 "%*c uiStartTime: %u ms", indentation, ' ',
2538 (unsigned int)pSettings->uiStartTime);
2539 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES",
2540 "%*c uiDuration: %u ms", indentation, ' ',
2541 (unsigned int)pSettings->uiDuration);
2542 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES",
2543 "%*c VideoEffectType: %s", indentation, ' ',
2544 videoEditJava_getVideoEffectString(pSettings->VideoEffectType));
2545 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES",
2546 "%*c ExtVideoEffectFct: %s", indentation, ' ',
2547 (M4OSA_NULL != pSettings->ExtVideoEffectFct) ? "set" : "<null>");
2548 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES",
2549 "%*c pExtVideoEffectFctCtxt: %s", indentation, ' ',
2550 (M4OSA_NULL != pSettings->pExtVideoEffectFctCtxt) ? "set" : "<null>");
2551 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES",
2552 "%*c AudioEffectType: %s", indentation, ' ',
2553 videoEditJava_getAudioEffectString(pSettings->AudioEffectType));
2554 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES",
2555 "%*c uiStartPercent: %u %%", indentation, ' ',
2556 (unsigned int)pSettings->xVSS.uiStartPercent);
2557 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES",
2558 "%*c uiDurationPercent: %u %%", indentation, ' ',
2559 (unsigned int)pSettings->xVSS.uiDurationPercent);
2560 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES",
2561 "%*c pFramingFilePath: %s", indentation, ' ',
2562 (M4OSA_NULL != pSettings->xVSS.pFramingFilePath) ?\
2563 (char*)pSettings->xVSS.pFramingFilePath : "<null>");
2564 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES",
2565 "%*c pFramingBuffer: %s", indentation, ' ',
2566 (M4OSA_NULL != pSettings->xVSS.pFramingBuffer) ? "set" : "<null>");
2567 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES",
2568 "%*c topleft_x: %u", indentation, ' ',
2569 (unsigned int)pSettings->xVSS.topleft_x);
2570 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES",
2571 "%*c topleft_y: %u", indentation, ' ',
2572 (unsigned int)pSettings->xVSS.topleft_y);
2573 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES",
2574 "%*c bResize: %s", indentation, ' ',
2575 pSettings->xVSS.bResize ? "true" : "false");
2576 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES",
2577 "%*c pTextBuffer: %s", indentation, ' ',
2578 (M4OSA_NULL != pSettings->xVSS.pTextBuffer) ?\
2579 (char*)pSettings->xVSS.pTextBuffer : "<null>");
2580 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES",
2581 "%*c textBufferSize: %u", indentation, ' ',
2582 (unsigned int)pSettings->xVSS.textBufferSize);
2583 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES",
2584 "%*c pRenderingData: %s", indentation, ' ',
2585 (M4OSA_NULL != pSettings->xVSS.pRenderingData) ?\
2586 (char*)pSettings->xVSS.pRenderingData : "<null>");
2587 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES",
2588 "%*c uiTextBufferWidth: %u", indentation, ' ',
2589 (unsigned int)pSettings->xVSS.uiTextBufferWidth);
2590 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES",
2591 "%*c uiTextBufferHeight: %u", indentation, ' ',
2592 (unsigned int)pSettings->xVSS.uiTextBufferHeight);
2593 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES",
2594 "%*c uiFiftiesOutFrameRate: %u", indentation, ' ',
2595 (unsigned int)pSettings->xVSS.uiFiftiesOutFrameRate);
2596 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES",
2597 "%*c uiRgb16InputColor: %d", indentation, ' ',
2598 pSettings->xVSS.uiRgb16InputColor);
2599 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES",
2600 "%*c uialphaBlendingStart: %d %%", indentation, ' ',
2601 pSettings->xVSS.uialphaBlendingStart);
2602 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES",
2603 "%*c uialphaBlendingMiddle: %d %%", indentation, ' ',
2604 pSettings->xVSS.uialphaBlendingMiddle);
2605 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES",
2606 "%*c uialphaBlendingEnd: %d %%", indentation, ' ',
2607 pSettings->xVSS.uialphaBlendingEnd);
2608 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES",
2609 "%*c uialphaBlendingFadeInTime: %d %%", indentation, ' ',
2610 pSettings->xVSS.uialphaBlendingFadeInTime);
2611 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES",
2612 "%*c uialphaBlendingFadeOutTime: %d %%", indentation, ' ',
2613 pSettings->xVSS.uialphaBlendingFadeOutTime);
2614 }
2615 else
2616 {
2617 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES",
2618 "%*c <null>", indentation, ' ');
2619 }
2620}
2621#endif
2622
2623
2624void
2625videoEditClasses_getSlideTransitionSettings(
2626 bool* pResult,
2627 JNIEnv* pEnv,
2628 jobject object,
2629 M4xVSS_SlideTransitionSettings** ppSettings)
2630{
2631 VideoEditJava_SlideTransitionSettingsFieldIds fieldIds = {NULL};
2632 M4xVSS_SlideTransitionSettings* pSettings = M4OSA_NULL;
2633 bool converted = true;
2634
2635 // Check if the previous action succeeded.
2636 if (*pResult)
2637 {
2638 // Log the function call.
2639 VIDEOEDIT_LOG_FUNCTION(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES",
2640 "videoEditClasses_getSlideTransitionSettings()");
2641
2642 // Retrieve the field ids.
2643 videoEditJava_getSlideTransitionSettingsFieldIds(pResult, pEnv, &fieldIds);
2644 }
2645
2646
2647 // Only validate the SlideTransitionSettings if the fields could be located.
2648 if (*pResult)
2649 {
2650 // Check if the clip is set.
2651 videoEditJava_checkAndThrowIllegalArgumentException(pResult, pEnv,
2652 (NULL == object),
2653 "slideSettings is null");
2654 }
2655
2656 // Only retrieve the SlideTransitionSettings if the fields could be located and validated.
2657 if (*pResult)
2658 {
2659 // Allocate memory for the SlideTransitionSettings.
2660 pSettings = (M4xVSS_SlideTransitionSettings*)videoEditOsal_alloc(pResult, pEnv,
2661 sizeof(M4xVSS_SlideTransitionSettings), "SlideTransitionSettings");
2662
2663 // Check if memory could be allocated for the SlideTransitionSettings.
2664 if (*pResult)
2665 {
2666 // Set the direction of the slide.
2667 pSettings->direction =
2668 (M4xVSS_SlideTransition_Direction)videoEditJava_getSlideDirectionJavaToC(
2669 &converted, pEnv->GetIntField(object, fieldIds.direction));
2670
2671 // Check if the direction is valid.
2672 videoEditJava_checkAndThrowIllegalArgumentException(pResult, pEnv,
2673 !converted, "slideSettings.direction is invalid");
2674 }
2675
2676 // Check if settings could be set.
2677 if (*pResult)
2678 {
2679 // Return the settings.
2680 (*ppSettings) = pSettings;
2681 }
2682 else
2683 {
2684 // Free the settings.
2685 videoEditClasses_freeSlideTransitionSettings(&pSettings);
2686 }
2687 }
2688}
2689
2690void
2691videoEditClasses_freeSlideTransitionSettings(
2692 M4xVSS_SlideTransitionSettings** ppSettings)
2693{
2694 // Check if memory was allocated for the SlideTransitionSettings.
2695 if (M4OSA_NULL != (*ppSettings))
2696 {
2697 // Log the function call.
2698 VIDEOEDIT_LOG_FUNCTION(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES",
2699 "videoEditClasses_freeSlideTransitionSettings()");
2700
2701 // Free the settings structure.
2702 videoEditOsal_free((*ppSettings));
2703 (*ppSettings) = M4OSA_NULL;
2704 }
2705}
2706
2707#ifdef VIDEOEDIT_LOGGING_ENABLED
2708void
2709videoEditClasses_logSlideTransitionSettings(
2710 M4xVSS_SlideTransitionSettings* pSettings,
2711 int indentation)
2712{
2713 // Check if memory was allocated for the SlideTransitionSettings.
2714 if (M4OSA_NULL != pSettings)
2715 {
2716 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES",
2717 "%*c direction: %s", indentation, ' ',
2718 videoEditJava_getSlideDirectionString(pSettings->direction));
2719 }
2720 else
2721 {
2722 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES",
2723 "%*c <null>", indentation, ' ');
2724 }
2725}
2726#endif
2727
2728
2729void
2730videoEditClasses_getTransitionSettings(
2731 bool* pResult,
2732 JNIEnv* pEnv,
2733 jobject object,
2734 M4VSS3GPP_TransitionSettings** ppSettings)
2735{
Basavapatna Dattaguru4fad6762011-02-27 21:15:18 -08002736
2737 VideoEditJava_TransitionSettingsFieldIds fieldIds;
Dharmaray Kundargicd196d32011-01-16 15:47:16 -08002738 jobject alphaSettings = NULL;
2739 jobject slideSettings = NULL;
2740 M4VSS3GPP_TransitionSettings* pSettings = M4OSA_NULL;
2741 bool converted = true;
Basavapatna Dattaguru4fad6762011-02-27 21:15:18 -08002742 memset(&fieldIds, 0, sizeof(VideoEditJava_TransitionSettingsFieldIds));
Dharmaray Kundargicd196d32011-01-16 15:47:16 -08002743
2744 // Check if the previous action succeeded.
2745 if (*pResult)
2746 {
2747 // Log the function call.
2748 VIDEOEDIT_LOG_FUNCTION(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES",
2749 "videoEditClasses_getTransitionSettings()");
2750
2751 // Retrieve the field ids.
2752 videoEditJava_getTransitionSettingsFieldIds(pResult, pEnv, &fieldIds);
2753 }
2754
2755 // Only validate the TransitionSettings if the fields could be located.
2756 if (*pResult)
2757 {
2758 // Check if the transition is set.
2759 videoEditJava_checkAndThrowIllegalArgumentException(pResult, pEnv,
2760 (NULL == object),
2761 "transition is null");
2762 }
2763
2764 // Check if the field ids could be located and validated.
2765 if (*pResult)
2766 {
2767 // Retrieve the alphaSettings.
2768 videoEditJava_getObject(pResult, pEnv, object, fieldIds.alphaSettings, &alphaSettings);
2769
2770 // Retrieve the slideSettings.
2771 videoEditJava_getObject(pResult, pEnv, object, fieldIds.slideSettings, &slideSettings);
2772 }
2773
2774 // Only retrieve the TransitionSettings if the fields could be located.
2775 if (*pResult)
2776 {
2777 // Allocate memory for the TransitionSettings.
2778 pSettings = (M4VSS3GPP_TransitionSettings*)videoEditOsal_alloc(pResult,
2779 pEnv, sizeof(M4VSS3GPP_TransitionSettings), "TransitionSettings");
2780
2781 // Check if memory could be allocated for the TransitionSettings.
2782 if (*pResult)
2783 {
2784 // Set the duration of the transition, in milliseconds (set to 0 to get no transition).
2785 pSettings->uiTransitionDuration = (M4OSA_UInt32)pEnv->GetIntField(object,
2786 fieldIds.duration);
2787
2788 // Set the type of the video transition.
2789 pSettings->VideoTransitionType =
2790 (M4VSS3GPP_VideoTransitionType)videoEditJava_getVideoTransitionJavaToC(
2791 &converted, pEnv->GetIntField(object, fieldIds.videoTransitionType));
2792
2793 // Check if the video transition type is valid.
2794 videoEditJava_checkAndThrowIllegalArgumentException(pResult, pEnv, !converted,
2795 "transition.videoTransitionType is invalid");
2796 }
2797
2798 // Check if the video transition type could be set.
2799 if (*pResult)
2800 {
2801 // Set the external transition video effect function.
2802 pSettings->ExtVideoTransitionFct = M4OSA_NULL;
2803
2804 // Set the context of the external transition video effect function.
2805 pSettings->pExtVideoTransitionFctCtxt = M4OSA_NULL;
2806
2807 // Set the type of the audio transition.
2808 pSettings->AudioTransitionType =
2809 (M4VSS3GPP_AudioTransitionType)videoEditJava_getAudioTransitionJavaToC(
2810 &converted, pEnv->GetIntField(object, fieldIds.audioTransitionType));
2811
2812 // Check if the audio transition type is valid.
2813 videoEditJava_checkAndThrowIllegalArgumentException(pResult, pEnv, !converted,
2814 "transition.audioTransitionType is invalid");
2815 }
2816
2817 // Check if the audio transition type could be set.
2818 if (*pResult)
2819 {
2820 // Set the transition behaviour.
2821 pSettings->TransitionBehaviour =
2822 (M4VSS3GPP_TransitionBehaviour)videoEditJava_getTransitionBehaviourJavaToC(
2823 &converted, pEnv->GetIntField(object, fieldIds.transitionBehaviour));
2824
2825 // Check if the transition behaviour is valid.
2826 videoEditJava_checkAndThrowIllegalArgumentException(pResult, pEnv, !converted,
2827 "transition.transitionBehaviour is invalid");
2828 }
2829
2830 // Check if the audio transition behaviour could be set.
2831 if (*pResult)
2832 {
2833 // Check if a slide transition or alpha magic setting object is expected.
2834 if ((int)pSettings->VideoTransitionType == M4xVSS_kVideoTransitionType_SlideTransition)
2835 {
2836 // Set the slide transition settings.
2837 videoEditClasses_getSlideTransitionSettings(pResult, pEnv, slideSettings,
2838 &pSettings->xVSS.transitionSpecific.pSlideTransitionSettings);
2839 }
2840 else if ((int)pSettings->VideoTransitionType == M4xVSS_kVideoTransitionType_AlphaMagic)
2841 {
2842 // Set the alpha magic settings.
2843 videoEditClasses_getAlphaMagicSettings(pResult, pEnv, alphaSettings,
2844 &pSettings->xVSS.transitionSpecific.pAlphaMagicSettings);
2845 }
2846 }
2847
2848 // Check if settings could be set.
2849 if (*pResult)
2850 {
2851 // Return the settings.
2852 (*ppSettings) = pSettings;
2853 }
2854 else
2855 {
2856 // Free the settings.
2857 videoEditClasses_freeTransitionSettings(&pSettings);
2858 }
2859 }
2860}
2861
2862void
2863videoEditClasses_freeTransitionSettings(
2864 M4VSS3GPP_TransitionSettings** ppSettings)
2865{
2866 // Check if memory was allocated for the TransitionSettings.
2867 if (M4OSA_NULL != (*ppSettings))
2868 {
2869 // Log the function call.
2870 VIDEOEDIT_LOG_FUNCTION(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES",
2871 "videoEditClasses_freeTransitionSettings()");
2872
2873 // Check if a slide transition or alpha magic setting structure is expected.
2874 if ((int)(*ppSettings)->VideoTransitionType == M4xVSS_kVideoTransitionType_SlideTransition)
2875 {
2876 // Free the slide transition settings.
2877 videoEditClasses_freeSlideTransitionSettings(
2878 &(*ppSettings)->xVSS.transitionSpecific.pSlideTransitionSettings);
2879 }
2880 else
2881 {
2882 // Free the alpha magic settings.
2883 videoEditClasses_freeAlphaMagicSettings(
2884 &(*ppSettings)->xVSS.transitionSpecific.pAlphaMagicSettings);
2885 }
2886
2887 // Free the settings structure.
2888 videoEditOsal_free((*ppSettings));
2889 (*ppSettings) = M4OSA_NULL;
2890 }
2891}
2892
2893#ifdef VIDEOEDIT_LOGGING_ENABLED
2894void
2895videoEditClasses_logTransitionSettings(
2896 M4VSS3GPP_TransitionSettings* pSettings,
2897 int indentation)
2898{
2899 // Check if memory was allocated for the TransitionSettings.
2900 if (M4OSA_NULL != pSettings)
2901 {
2902 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES",
2903 "%*c uiTransitionDuration: %u ms", indentation, ' ',
2904 (unsigned int)pSettings->uiTransitionDuration);
2905 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES",
2906 "%*c VideoTransitionType: %s", indentation, ' ',
2907 videoEditJava_getVideoTransitionString(pSettings->VideoTransitionType));
2908 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES",
2909 "%*c ExtVideoTransitionFct: %s", indentation, ' ',
2910 (M4OSA_NULL != pSettings->ExtVideoTransitionFct) ? "set" : "<null>");
2911 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES",
2912 "%*c pExtVideoTransitionFctCtxt: %s", indentation, ' ',
2913 (M4OSA_NULL != pSettings->pExtVideoTransitionFctCtxt) ? "set" : "<null>");
2914 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES",
2915 "%*c AudioTransitionType: %s", indentation, ' ',
2916 videoEditJava_getAudioTransitionString(pSettings->AudioTransitionType));
2917 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES",
2918 "%*c TransitionBehaviour: %s", indentation, ' ',
2919 videoEditJava_getTransitionBehaviourString(pSettings->TransitionBehaviour));
2920
2921 // Check if a slide transition or alpha magic setting structure is expected.
2922 if ((int)pSettings->VideoTransitionType == M4xVSS_kVideoTransitionType_SlideTransition)
2923 {
2924 // Log the slide transition settings.
2925 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES",
2926 "%*c pSlideTransitionSettings:", indentation, ' ');
2927 videoEditClasses_logSlideTransitionSettings\
2928 (pSettings->xVSS.transitionSpecific.pSlideTransitionSettings,
2929 indentation + VIDEOEDIT_LOG_INDENTATION);
2930 }
2931 else
2932 {
2933 // Log the alpha magic settings.
2934 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES",
2935 "%*c pAlphaMagicSettings:", indentation, ' ');
2936 videoEditClasses_logAlphaMagicSettings\
2937 (pSettings->xVSS.transitionSpecific.pAlphaMagicSettings,
2938 indentation + VIDEOEDIT_LOG_INDENTATION);
2939 }
2940 }
2941 else
2942 {
2943 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES",
2944 "%*c <null>", indentation, ' ');
2945 }
2946}
2947#endif
2948#ifdef VIDEOEDIT_LOGGING_ENABLED
2949void
2950videoEditPropClass_logProperties(
2951 VideoEditPropClass_Properties* pProperties,
2952 int indentation)
2953{
2954 // Check if memory was allocated for the Properties.
2955 if (M4OSA_NULL != pProperties)
2956 {
2957 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_PROP_CLASSES",
2958 "%*c uiClipDuration: %u", indentation, ' ',
2959 (unsigned int)pProperties->uiClipDuration);
2960 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_PROP_CLASSES",
2961 "%*c FileType: %s", indentation, ' ',
2962 videoEditJava_getFileTypeString(pProperties->FileType));
2963
2964 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_PROP_CLASSES",
2965 "%*c VideoStreamType: %s", indentation, ' ',
2966 videoEditJava_getVideoFormatString(pProperties->VideoStreamType));
2967 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_PROP_CLASSES",
2968 "%*c uiClipVideoDuration: %u", indentation, ' ',
2969 (unsigned int)pProperties->uiClipVideoDuration);
2970
2971 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_PROP_CLASSES",
2972 "%*c uiVideoBitrate: %s", indentation, ' ',
2973 videoEditJava_getBitrateString(pProperties->uiVideoBitrate));
2974
2975 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_PROP_CLASSES",
2976 "%*c uiVideoWidth: %u", indentation, ' ',
2977 (unsigned int)pProperties->uiVideoWidth);
2978
2979 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_PROP_CLASSES",
2980 "%*c uiVideoHeight: %u", indentation, ' ',
2981 (unsigned int)(unsigned int)pProperties->uiVideoHeight);
2982
2983 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_PROP_CLASSES",
2984 "%*c fAverageFrameRate: %.3f", indentation, ' ',
2985 pProperties->fAverageFrameRate);
2986
2987 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_PROP_CLASSES",
2988 "%*c ProfileAndLevel: %s", indentation, ' ',
2989 videoEditJava_getVideoProfileString(pProperties->ProfileAndLevel));
2990
2991 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_PROP_CLASSES",
2992 "%*c AudioStreamType: %s", indentation, ' ',
2993 videoEditJava_getAudioFormatString(pProperties->AudioStreamType));
2994
2995 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_PROP_CLASSES",
2996 "%*c uiClipAudioDuration: %u", indentation, ' ',
2997 (unsigned int)pProperties->uiClipAudioDuration);
2998
2999 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_PROP_CLASSES",
3000 "%*c uiAudioBitrate: %s", indentation, ' ',
3001 videoEditJava_getBitrateString(pProperties->uiAudioBitrate));
3002
3003 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_PROP_CLASSES",
3004 "%*c uiNbChannels: %u", indentation, ' ',
3005 (unsigned int)pProperties->uiNbChannels);
3006
3007 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_PROP_CLASSES",
3008 "%*c uiSamplingFrequency: %u", indentation, ' ',
3009 (unsigned int)pProperties->uiSamplingFrequency);
3010 }
3011 else
3012 {
3013 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_PROP_CLASSES",
3014 "%*c <null>", indentation, ' ');
3015 }
3016}
3017#endif
3018
3019
3020void
3021videoEditClasses_createVersion(
3022 bool* pResult,
3023 JNIEnv* pEnv,
3024 M4_VersionInfo* pVersionInfo,
3025 jobject* pObject)
3026{
Basavapatna Dattaguru4fad6762011-02-27 21:15:18 -08003027
3028 VideoEditJava_VersionFieldIds fieldIds;
Dharmaray Kundargicd196d32011-01-16 15:47:16 -08003029 jclass clazz = NULL;
3030 jobject object = NULL;
Basavapatna Dattaguru4fad6762011-02-27 21:15:18 -08003031 memset(&fieldIds, 0, sizeof(VideoEditJava_VersionFieldIds));
Dharmaray Kundargicd196d32011-01-16 15:47:16 -08003032 // Check if the previous action succeeded.
3033 if (*pResult)
3034 {
3035 // Log the function call.
3036 VIDEOEDIT_LOG_FUNCTION(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES",
3037 "videoEditClasses_createVersion()");
3038
3039 // Retrieve the class.
3040 videoEditJava_getVersionClass(pResult, pEnv, &clazz);
3041
3042 // Retrieve the field ids.
3043 videoEditJava_getVersionFieldIds(pResult, pEnv, &fieldIds);
3044 }
3045
3046 // Only create an object if the class and fields could be located.
3047 if (*pResult)
3048 {
3049 // Allocate a new object.
3050 object = pEnv->AllocObject(clazz);
3051
3052 // check if alloc is done
3053 videoEditJava_checkAndThrowRuntimeException(pResult, pEnv,
3054 (NULL == object),
3055 M4ERR_ALLOC);
3056 if (NULL != object)
3057 {
3058 // Set the major field.
3059 pEnv->SetIntField(object, fieldIds.major, pVersionInfo->m_major);
3060
3061 // Set the minor field.
3062 pEnv->SetIntField(object, fieldIds.minor, pVersionInfo->m_minor);
3063
3064 // Set the revision field.
3065 pEnv->SetIntField(object, fieldIds.revision, pVersionInfo->m_revision);
3066
3067 // Return the object.
3068 (*pObject) = object;
3069 }
3070 }
3071}
3072
3073#ifdef VIDEOEDIT_LOGGING_ENABLED
3074void
3075videoEditClasses_logVersion(
3076 M4_VersionInfo* pVersionInfo,
3077 int indentation)
3078{
3079 // Check if memory was allocated for the Version.
3080 if (M4OSA_NULL != pVersionInfo)
3081 {
3082 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES",
3083 "%*c major: %u ms", indentation, ' ',
3084 (unsigned int)pVersionInfo->m_major);
3085 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES",
3086 "%*c minor: %u", indentation, ' ',
3087 (unsigned int)pVersionInfo->m_minor);
3088 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES",
3089 "%*c revision: %u", indentation, ' ',
3090 (unsigned int)pVersionInfo->m_revision);
3091 }
3092 else
3093 {
3094 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES",
3095 "%*c <null>", indentation, ' ');
3096 }
3097}
3098#endif
3099
3100
3101void*
3102videoEditClasses_getContext(
3103 bool* pResult,
3104 JNIEnv* pEnv,
3105 jobject object)
3106{
3107 void* pContext = M4OSA_NULL;
3108 jclass clazz = NULL;
3109 VideoEditJava_EngineFieldIds fieldIds = {NULL};
3110
3111 // Check if the previous action succeeded.
3112 if (*pResult)
3113 {
3114 // Log the function call.
3115 VIDEOEDIT_LOG_FUNCTION(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES",
3116 "videoEditClasses_getContext()");
3117
3118 // Retrieve the class.
3119 videoEditJava_getEngineClass(pResult, pEnv, &clazz);
3120
3121 // Retrieve the field ids.
3122 videoEditJava_getEngineFieldIds(pResult, pEnv, &fieldIds);
3123 }
3124
3125 // Check if the class and field ids could be located.
3126 if (*pResult)
3127 {
3128 // Retrieve the context pointer.
3129 pContext = (void *)pEnv->GetIntField(object, fieldIds.context);
3130 }
3131
3132 // Return the context pointer.
3133 return(pContext);
3134}
3135
3136void
3137videoEditClasses_setContext(
3138 bool* pResult,
3139 JNIEnv* pEnv,
3140 jobject object,
3141 void* pContext)
3142{
3143 jclass clazz = NULL;
3144 VideoEditJava_EngineFieldIds fieldIds = {NULL};
3145
3146 // Check if the previous action succeeded.
3147 if (*pResult)
3148 {
3149 // Log the function call.
3150 VIDEOEDIT_LOG_FUNCTION(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES",
3151 "videoEditClasses_setContext()");
3152
3153 // Retrieve the class.
3154 videoEditJava_getEngineClass(pResult, pEnv, &clazz);
3155
3156 // Retrieve the field ids.
3157 videoEditJava_getEngineFieldIds(pResult, pEnv, &fieldIds);
3158 }
3159
3160 // Check if the class and field ids could be located.
3161 if (*pResult)
3162 {
3163 // Set the context field.
3164 VIDEOEDIT_LOG_FUNCTION(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES",
3165 "The context value from JAVA before setting is = 0x%x",
3166 pEnv->GetIntField(object, fieldIds.context));
3167
3168 pEnv->SetIntField(object, fieldIds.context, (int)pContext);
3169 M4OSA_TRACE1_1("The context value in JNI is = 0x%x",pContext);
3170
3171 VIDEOEDIT_LOG_FUNCTION(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES",
3172 "The context value from JAVA after setting is = 0x%x",
3173 pEnv->GetIntField(object, fieldIds.context));
3174 }
3175}
3176