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