VideoEditorClasses.cpp revision 2fb605a088d25037c66eae04f5d35ea1fe115390
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_Thread.h> 32#include <M4VSS3GPP_API.h> 33#include <M4xVSS_API.h> 34#include <M4VSS3GPP_ErrorCodes.h> 35#include <M4MCS_ErrorCodes.h> 36#include <M4READER_Common.h> 37#include <M4WRITER_common.h> 38#include <M4DECODER_Common.h> 39}; 40 41#define VIDEOEDIT_PROP_JAVA_RESULT_STRING_MAX (128) 42 43#define VIDEOEDIT_JAVA__RESULT_STRING_MAX (128) 44 45VIDEOEDIT_JAVA_DEFINE_CONSTANTS(AudioEffect) 46{ 47 VIDEOEDIT_JAVA_CONSTANT_INIT("NONE", M4VSS3GPP_kAudioEffectType_None), 48 VIDEOEDIT_JAVA_CONSTANT_INIT("FADE_IN", M4VSS3GPP_kAudioEffectType_FadeIn), 49 VIDEOEDIT_JAVA_CONSTANT_INIT("FADE_OUT", M4VSS3GPP_kAudioEffectType_FadeOut) 50}; 51 52VIDEOEDIT_JAVA_DEFINE_CONSTANT_CLASS(AudioEffect, AUDIO_EFFECT_CLASS_NAME, M4OSA_NULL, M4OSA_NULL) 53 54 55VIDEOEDIT_JAVA_DEFINE_CONSTANTS(AudioFormat) 56{ 57 VIDEOEDIT_JAVA_CONSTANT_INIT("NO_AUDIO", M4VIDEOEDITING_kNoneAudio), 58 VIDEOEDIT_JAVA_CONSTANT_INIT("AMR_NB", M4VIDEOEDITING_kAMR_NB), 59 VIDEOEDIT_JAVA_CONSTANT_INIT("AAC", M4VIDEOEDITING_kAAC), 60 VIDEOEDIT_JAVA_CONSTANT_INIT("AAC_PLUS", M4VIDEOEDITING_kAACplus), 61 VIDEOEDIT_JAVA_CONSTANT_INIT("ENHANCED_AAC_PLUS", M4VIDEOEDITING_keAACplus), 62 VIDEOEDIT_JAVA_CONSTANT_INIT("MP3", M4VIDEOEDITING_kMP3), 63 VIDEOEDIT_JAVA_CONSTANT_INIT("EVRC", M4VIDEOEDITING_kEVRC), 64 VIDEOEDIT_JAVA_CONSTANT_INIT("PCM", M4VIDEOEDITING_kPCM), 65 VIDEOEDIT_JAVA_CONSTANT_INIT("NULL_AUDIO", M4VIDEOEDITING_kNullAudio), 66 VIDEOEDIT_JAVA_CONSTANT_INIT("UNSUPPORTED_AUDIO", M4VIDEOEDITING_kUnsupportedAudio) 67}; 68 69VIDEOEDIT_JAVA_DEFINE_CONSTANT_CLASS(AudioFormat, AUDIO_FORMAT_CLASS_NAME, M4OSA_NULL, M4OSA_NULL) 70 71 72VIDEOEDIT_JAVA_DEFINE_CONSTANTS(AudioSamplingFrequency) 73{ 74 VIDEOEDIT_JAVA_CONSTANT_INIT("FREQ_DEFAULT", M4VIDEOEDITING_kDefault_ASF), 75 VIDEOEDIT_JAVA_CONSTANT_INIT("FREQ_8000", M4VIDEOEDITING_k8000_ASF), 76 VIDEOEDIT_JAVA_CONSTANT_INIT("FREQ_16000", M4VIDEOEDITING_k16000_ASF), 77 VIDEOEDIT_JAVA_CONSTANT_INIT("FREQ_22050", M4VIDEOEDITING_k22050_ASF), 78 VIDEOEDIT_JAVA_CONSTANT_INIT("FREQ_24000", M4VIDEOEDITING_k24000_ASF), 79 VIDEOEDIT_JAVA_CONSTANT_INIT("FREQ_32000", M4VIDEOEDITING_k32000_ASF), 80 VIDEOEDIT_JAVA_CONSTANT_INIT("FREQ_44100", M4VIDEOEDITING_k44100_ASF), 81 VIDEOEDIT_JAVA_CONSTANT_INIT("FREQ_48000", M4VIDEOEDITING_k48000_ASF) 82}; 83 84VIDEOEDIT_JAVA_DEFINE_CONSTANT_CLASS(AudioSamplingFrequency,AUDIO_SAMPLING_FREQUENCY_CLASS_NAME, 85 M4OSA_NULL, M4OSA_NULL) 86 87 88VIDEOEDIT_JAVA_DEFINE_CONSTANTS(AudioTransition) 89{ 90 VIDEOEDIT_JAVA_CONSTANT_INIT("NONE", M4VSS3GPP_kAudioTransitionType_None), 91 VIDEOEDIT_JAVA_CONSTANT_INIT("CROSS_FADE", M4VSS3GPP_kAudioTransitionType_CrossFade) 92}; 93 94VIDEOEDIT_JAVA_DEFINE_CONSTANT_CLASS(AudioTransition, AUDIO_TRANSITION_CLASS_NAME, M4OSA_NULL, 95 M4OSA_NULL) 96 97 98static const char* 99videoEditClasses_getUnknownBitrateString(int bitrate) 100{ 101 static char string[VIDEOEDIT_JAVA__RESULT_STRING_MAX] = ""; 102 103 M4OSA_chrSPrintf((M4OSA_Char *)string, sizeof(string) - 1, (M4OSA_Char*)"%d", bitrate); 104 105 // Return the bitrate string. 106 return(string); 107} 108 109VIDEOEDIT_JAVA_DEFINE_CONSTANTS(Bitrate) 110{ 111 VIDEOEDIT_JAVA_CONSTANT_INIT("VARIABLE", M4VIDEOEDITING_kVARIABLE_KBPS), 112 VIDEOEDIT_JAVA_CONSTANT_INIT("UNDEFINED", M4VIDEOEDITING_kUndefinedBitrate), 113 VIDEOEDIT_JAVA_CONSTANT_INIT("BR_9_2_KBPS", M4VIDEOEDITING_k9_2_KBPS), 114 VIDEOEDIT_JAVA_CONSTANT_INIT("BR_12_2_KBPS", M4VIDEOEDITING_k12_2_KBPS), 115 VIDEOEDIT_JAVA_CONSTANT_INIT("BR_16_KBPS", M4VIDEOEDITING_k16_KBPS), 116 VIDEOEDIT_JAVA_CONSTANT_INIT("BR_24_KBPS", M4VIDEOEDITING_k24_KBPS), 117 VIDEOEDIT_JAVA_CONSTANT_INIT("BR_32_KBPS", M4VIDEOEDITING_k32_KBPS), 118 VIDEOEDIT_JAVA_CONSTANT_INIT("BR_48_KBPS", M4VIDEOEDITING_k48_KBPS), 119 VIDEOEDIT_JAVA_CONSTANT_INIT("BR_64_KBPS", M4VIDEOEDITING_k64_KBPS), 120 VIDEOEDIT_JAVA_CONSTANT_INIT("BR_96_KBPS", M4VIDEOEDITING_k96_KBPS), 121 VIDEOEDIT_JAVA_CONSTANT_INIT("BR_128_KBPS", M4VIDEOEDITING_k128_KBPS), 122 VIDEOEDIT_JAVA_CONSTANT_INIT("BR_192_KBPS", M4VIDEOEDITING_k192_KBPS), 123 VIDEOEDIT_JAVA_CONSTANT_INIT("BR_256_KBPS", M4VIDEOEDITING_k256_KBPS), 124 VIDEOEDIT_JAVA_CONSTANT_INIT("BR_288_KBPS", M4VIDEOEDITING_k288_KBPS), 125 VIDEOEDIT_JAVA_CONSTANT_INIT("BR_384_KBPS", M4VIDEOEDITING_k384_KBPS), 126 VIDEOEDIT_JAVA_CONSTANT_INIT("BR_512_KBPS", M4VIDEOEDITING_k512_KBPS), 127 VIDEOEDIT_JAVA_CONSTANT_INIT("BR_800_KBPS", M4VIDEOEDITING_k800_KBPS), 128/*+ New Encoder bitrates */ 129 VIDEOEDIT_JAVA_CONSTANT_INIT("BR_2_MBPS", M4VIDEOEDITING_k2_MBPS), 130 VIDEOEDIT_JAVA_CONSTANT_INIT("BR_5_MBPS", M4VIDEOEDITING_k5_MBPS), 131 VIDEOEDIT_JAVA_CONSTANT_INIT("BR_8_MBPS", M4VIDEOEDITING_k8_MBPS) 132/*- New Encoder bitrates */ 133}; 134 135VIDEOEDIT_JAVA_DEFINE_CONSTANT_CLASS(Bitrate, BITRATE_CLASS_NAME, 136 videoEditClasses_getUnknownBitrateString, videoEditClasses_getUnknownBitrateString) 137 138 139VIDEOEDIT_JAVA_DEFINE_CONSTANTS(ClipType) 140{ 141 VIDEOEDIT_JAVA_CONSTANT_INIT("THREE_GPP", M4VIDEOEDITING_kFileType_3GPP), 142 VIDEOEDIT_JAVA_CONSTANT_INIT("MP4", M4VIDEOEDITING_kFileType_MP4), 143 VIDEOEDIT_JAVA_CONSTANT_INIT("AMR", M4VIDEOEDITING_kFileType_AMR), 144 VIDEOEDIT_JAVA_CONSTANT_INIT("MP3", M4VIDEOEDITING_kFileType_MP3), 145 VIDEOEDIT_JAVA_CONSTANT_INIT("PCM", M4VIDEOEDITING_kFileType_PCM), 146 VIDEOEDIT_JAVA_CONSTANT_INIT("JPG", M4VIDEOEDITING_kFileType_JPG), 147 VIDEOEDIT_JAVA_CONSTANT_INIT("M4V", M4VIDEOEDITING_kFileType_M4V), 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("M4V", VideoEditClasses_kFileType_M4V), 334 VIDEOEDIT_JAVA_CONSTANT_INIT("UNSUPPORTED", VideoEditClasses_kFileType_Unsupported) 335}; 336 337VIDEOEDIT_JAVA_DEFINE_CONSTANT_CLASS(FileType, FILE_TYPE_CLASS_NAME, M4OSA_NULL, M4OSA_NULL) 338 339 340VIDEOEDIT_JAVA_DEFINE_CONSTANTS(MediaRendering) 341{ 342 VIDEOEDIT_JAVA_CONSTANT_INIT("RESIZING", M4xVSS_kResizing), 343 VIDEOEDIT_JAVA_CONSTANT_INIT("CROPPING", M4xVSS_kCropping), 344 VIDEOEDIT_JAVA_CONSTANT_INIT("BLACK_BORDERS", M4xVSS_kBlackBorders) 345}; 346 347VIDEOEDIT_JAVA_DEFINE_CONSTANT_CLASS(MediaRendering, MEDIA_RENDERING_CLASS_NAME, 348 M4OSA_NULL, M4OSA_NULL) 349 350 351VIDEOEDIT_JAVA_DEFINE_CONSTANTS(SlideDirection) 352{ 353 VIDEOEDIT_JAVA_CONSTANT_INIT("RIGHT_OUT_LEFT_IN", M4xVSS_SlideTransition_RightOutLeftIn), 354 VIDEOEDIT_JAVA_CONSTANT_INIT("LEFT_OUT_RIGTH_IN", M4xVSS_SlideTransition_LeftOutRightIn), 355 VIDEOEDIT_JAVA_CONSTANT_INIT("TOP_OUT_BOTTOM_IN", M4xVSS_SlideTransition_TopOutBottomIn), 356 VIDEOEDIT_JAVA_CONSTANT_INIT("BOTTOM_OUT_TOP_IN", M4xVSS_SlideTransition_BottomOutTopIn) 357}; 358 359VIDEOEDIT_JAVA_DEFINE_CONSTANT_CLASS(SlideDirection, SLIDE_DIRECTION_CLASS_NAME, 360 M4OSA_NULL, M4OSA_NULL) 361 362 363VIDEOEDIT_JAVA_DEFINE_CONSTANTS(TransitionBehaviour) 364{ 365 VIDEOEDIT_JAVA_CONSTANT_INIT("SPEED_UP", M4VSS3GPP_TransitionBehaviour_SpeedUp), 366 VIDEOEDIT_JAVA_CONSTANT_INIT("LINEAR", M4VSS3GPP_TransitionBehaviour_Linear), 367 VIDEOEDIT_JAVA_CONSTANT_INIT("SPEED_DOWN", M4VSS3GPP_TransitionBehaviour_SpeedDown), 368 VIDEOEDIT_JAVA_CONSTANT_INIT("SLOW_MIDDLE", M4VSS3GPP_TransitionBehaviour_SlowMiddle), 369 VIDEOEDIT_JAVA_CONSTANT_INIT("FAST_MIDDLE", M4VSS3GPP_TransitionBehaviour_FastMiddle) 370}; 371 372VIDEOEDIT_JAVA_DEFINE_CONSTANT_CLASS(TransitionBehaviour, TRANSITION_BEHAVIOUR_CLASS_NAME, 373 M4OSA_NULL, M4OSA_NULL) 374 375 376VIDEOEDIT_JAVA_DEFINE_CONSTANTS(VideoEffect) 377{ 378 VIDEOEDIT_JAVA_CONSTANT_INIT("NONE", M4VSS3GPP_kVideoEffectType_None), 379 VIDEOEDIT_JAVA_CONSTANT_INIT("FADE_FROM_BLACK", M4VSS3GPP_kVideoEffectType_FadeFromBlack), 380 VIDEOEDIT_JAVA_CONSTANT_INIT("CURTAIN_OPENING", M4VSS3GPP_kVideoEffectType_CurtainOpening), 381 VIDEOEDIT_JAVA_CONSTANT_INIT("FADE_TO_BLACK", M4VSS3GPP_kVideoEffectType_FadeToBlack), 382 VIDEOEDIT_JAVA_CONSTANT_INIT("CURTAIN_CLOSING", M4VSS3GPP_kVideoEffectType_CurtainClosing), 383 VIDEOEDIT_JAVA_CONSTANT_INIT("EXTERNAL", M4VSS3GPP_kVideoEffectType_External), 384 VIDEOEDIT_JAVA_CONSTANT_INIT("BLACK_AND_WHITE", M4xVSS_kVideoEffectType_BlackAndWhite), 385 VIDEOEDIT_JAVA_CONSTANT_INIT("PINK", M4xVSS_kVideoEffectType_Pink), 386 VIDEOEDIT_JAVA_CONSTANT_INIT("GREEN", M4xVSS_kVideoEffectType_Green), 387 VIDEOEDIT_JAVA_CONSTANT_INIT("SEPIA", M4xVSS_kVideoEffectType_Sepia), 388 VIDEOEDIT_JAVA_CONSTANT_INIT("NEGATIVE", M4xVSS_kVideoEffectType_Negative), 389 VIDEOEDIT_JAVA_CONSTANT_INIT("FRAMING", M4xVSS_kVideoEffectType_Framing), 390 VIDEOEDIT_JAVA_CONSTANT_INIT("TEXT", M4xVSS_kVideoEffectType_Text), 391 VIDEOEDIT_JAVA_CONSTANT_INIT("ZOOM_IN", M4xVSS_kVideoEffectType_ZoomIn), 392 VIDEOEDIT_JAVA_CONSTANT_INIT("ZOOM_OUT", M4xVSS_kVideoEffectType_ZoomOut), 393 VIDEOEDIT_JAVA_CONSTANT_INIT("FIFTIES", M4xVSS_kVideoEffectType_Fifties), 394 VIDEOEDIT_JAVA_CONSTANT_INIT("COLORRGB16", M4xVSS_kVideoEffectType_ColorRGB16), 395 VIDEOEDIT_JAVA_CONSTANT_INIT("GRADIENT", M4xVSS_kVideoEffectType_Gradient), 396}; 397 398VIDEOEDIT_JAVA_DEFINE_CONSTANT_CLASS(VideoEffect, VIDEO_EFFECT_CLASS_NAME, M4OSA_NULL, M4OSA_NULL) 399 400 401VIDEOEDIT_JAVA_DEFINE_CONSTANTS(VideoFormat) 402{ 403 VIDEOEDIT_JAVA_CONSTANT_INIT("NO_VIDEO", M4VIDEOEDITING_kNoneVideo), 404 VIDEOEDIT_JAVA_CONSTANT_INIT("H263", M4VIDEOEDITING_kH263), 405 VIDEOEDIT_JAVA_CONSTANT_INIT("MPEG4", M4VIDEOEDITING_kMPEG4), 406 VIDEOEDIT_JAVA_CONSTANT_INIT("MPEG4_EMP", M4VIDEOEDITING_kMPEG4_EMP), 407 VIDEOEDIT_JAVA_CONSTANT_INIT("H264", M4VIDEOEDITING_kH264), 408 VIDEOEDIT_JAVA_CONSTANT_INIT("NULL_VIDEO", M4VIDEOEDITING_kNullVideo), 409 VIDEOEDIT_JAVA_CONSTANT_INIT("UNSUPPORTED", M4VIDEOEDITING_kUnsupportedVideo), 410}; 411 412VIDEOEDIT_JAVA_DEFINE_CONSTANT_CLASS(VideoFormat, VIDEO_FORMAT_CLASS_NAME, M4OSA_NULL, M4OSA_NULL) 413 414 415VIDEOEDIT_JAVA_DEFINE_CONSTANTS(VideoFrameRate) 416{ 417 VIDEOEDIT_JAVA_CONSTANT_INIT("FR_5_FPS", M4VIDEOEDITING_k5_FPS), 418 VIDEOEDIT_JAVA_CONSTANT_INIT("FR_7_5_FPS", M4VIDEOEDITING_k7_5_FPS), 419 VIDEOEDIT_JAVA_CONSTANT_INIT("FR_10_FPS", M4VIDEOEDITING_k10_FPS), 420 VIDEOEDIT_JAVA_CONSTANT_INIT("FR_12_5_FPS", M4VIDEOEDITING_k12_5_FPS), 421 VIDEOEDIT_JAVA_CONSTANT_INIT("FR_15_FPS", M4VIDEOEDITING_k15_FPS), 422 VIDEOEDIT_JAVA_CONSTANT_INIT("FR_20_FPS", M4VIDEOEDITING_k20_FPS), 423 VIDEOEDIT_JAVA_CONSTANT_INIT("FR_25_FPS", M4VIDEOEDITING_k25_FPS), 424 VIDEOEDIT_JAVA_CONSTANT_INIT("FR_30_FPS", M4VIDEOEDITING_k30_FPS) 425}; 426 427VIDEOEDIT_JAVA_DEFINE_CONSTANT_CLASS(VideoFrameRate, VIDEO_FRAME_RATE_CLASS_NAME, 428 M4OSA_NULL, M4OSA_NULL) 429 430 431VIDEOEDIT_JAVA_DEFINE_CONSTANTS(VideoFrameSize) 432{ 433 VIDEOEDIT_JAVA_CONSTANT_INIT("SQCIF", M4VIDEOEDITING_kSQCIF), 434 VIDEOEDIT_JAVA_CONSTANT_INIT("QQVGA", M4VIDEOEDITING_kQQVGA), 435 VIDEOEDIT_JAVA_CONSTANT_INIT("QCIF", M4VIDEOEDITING_kQCIF), 436 VIDEOEDIT_JAVA_CONSTANT_INIT("QVGA", M4VIDEOEDITING_kQVGA), 437 VIDEOEDIT_JAVA_CONSTANT_INIT("CIF", M4VIDEOEDITING_kCIF), 438 VIDEOEDIT_JAVA_CONSTANT_INIT("VGA", M4VIDEOEDITING_kVGA), 439 VIDEOEDIT_JAVA_CONSTANT_INIT("WVGA", M4VIDEOEDITING_kWVGA), 440 VIDEOEDIT_JAVA_CONSTANT_INIT("NTSC", M4VIDEOEDITING_kNTSC), 441 VIDEOEDIT_JAVA_CONSTANT_INIT("nHD", M4VIDEOEDITING_k640_360), 442 VIDEOEDIT_JAVA_CONSTANT_INIT("WVGA16x9", M4VIDEOEDITING_k854_480), 443 VIDEOEDIT_JAVA_CONSTANT_INIT("V720p", M4VIDEOEDITING_kHD1280), 444 VIDEOEDIT_JAVA_CONSTANT_INIT("W720p", M4VIDEOEDITING_kHD1080), 445 VIDEOEDIT_JAVA_CONSTANT_INIT("S720p", M4VIDEOEDITING_kHD960) 446}; 447 448VIDEOEDIT_JAVA_DEFINE_CONSTANT_CLASS(VideoFrameSize, VIDEO_FRAME_SIZE_CLASS_NAME, 449 M4OSA_NULL, M4OSA_NULL) 450 451 452VIDEOEDIT_JAVA_DEFINE_CONSTANTS(VideoProfile) 453{ 454 VIDEOEDIT_JAVA_CONSTANT_INIT("MPEG4_SP_LEVEL_0", \ 455 M4VIDEOEDITING_kMPEG4_SP_Level_0), 456 VIDEOEDIT_JAVA_CONSTANT_INIT("MPEG4_SP_LEVEL_0B", \ 457 M4VIDEOEDITING_kMPEG4_SP_Level_0b), 458 VIDEOEDIT_JAVA_CONSTANT_INIT("MPEG4_SP_LEVEL_1", \ 459 M4VIDEOEDITING_kMPEG4_SP_Level_1), 460 VIDEOEDIT_JAVA_CONSTANT_INIT("MPEG4_SP_LEVEL_2", \ 461 M4VIDEOEDITING_kMPEG4_SP_Level_2), 462 VIDEOEDIT_JAVA_CONSTANT_INIT("MPEG4_SP_LEVEL_3", \ 463 M4VIDEOEDITING_kMPEG4_SP_Level_3), 464 VIDEOEDIT_JAVA_CONSTANT_INIT("MPEG4_SP_LEVEL_4A", \ 465 M4VIDEOEDITING_kMPEG4_SP_Level_4a), 466 VIDEOEDIT_JAVA_CONSTANT_INIT("MPEG4_SP_LEVEL_5", \ 467 M4VIDEOEDITING_kMPEG4_SP_Level_5), 468 VIDEOEDIT_JAVA_CONSTANT_INIT("H263_PROFILE_0_LEVEL_10",\ 469 M4VIDEOEDITING_kH263_Profile_0_Level_10), 470 VIDEOEDIT_JAVA_CONSTANT_INIT("H263_PROFILE_0_LEVEL_20",\ 471 M4VIDEOEDITING_kH263_Profile_0_Level_20), 472 VIDEOEDIT_JAVA_CONSTANT_INIT("H263_PROFILE_0_LEVEL_30",\ 473 M4VIDEOEDITING_kH263_Profile_0_Level_30), 474 VIDEOEDIT_JAVA_CONSTANT_INIT("H263_PROFILE_0_LEVEL_40",\ 475 M4VIDEOEDITING_kH263_Profile_0_Level_40), 476 VIDEOEDIT_JAVA_CONSTANT_INIT("H263_PROFILE_0_LEVEL_45",\ 477 M4VIDEOEDITING_kH263_Profile_0_Level_45), 478 VIDEOEDIT_JAVA_CONSTANT_INIT("H264_PROFILE_0_LEVEL_1", \ 479 M4VIDEOEDITING_kH264_Profile_0_Level_1), 480 VIDEOEDIT_JAVA_CONSTANT_INIT("H264_PROFILE_0_LEVEL_1b",\ 481 M4VIDEOEDITING_kH264_Profile_0_Level_1b), 482 VIDEOEDIT_JAVA_CONSTANT_INIT("H264_PROFILE_0_LEVEL_1_1",\ 483 M4VIDEOEDITING_kH264_Profile_0_Level_1_1), 484 VIDEOEDIT_JAVA_CONSTANT_INIT("H264_PROFILE_0_LEVEL_1_2",\ 485 M4VIDEOEDITING_kH264_Profile_0_Level_1_2), 486 VIDEOEDIT_JAVA_CONSTANT_INIT("H264_PROFILE_0_LEVEL_1_3",\ 487 M4VIDEOEDITING_kH264_Profile_0_Level_1_3), 488 VIDEOEDIT_JAVA_CONSTANT_INIT("H264_PROFILE_0_LEVEL_2", \ 489 M4VIDEOEDITING_kH264_Profile_0_Level_2), 490 VIDEOEDIT_JAVA_CONSTANT_INIT("H264_PROFILE_0_LEVEL_2_1",\ 491 M4VIDEOEDITING_kH264_Profile_0_Level_2_1), 492 VIDEOEDIT_JAVA_CONSTANT_INIT("H264_PROFILE_0_LEVEL_2_2",\ 493 M4VIDEOEDITING_kH264_Profile_0_Level_2_2), 494 VIDEOEDIT_JAVA_CONSTANT_INIT("H264_PROFILE_0_LEVEL_3", \ 495 M4VIDEOEDITING_kH264_Profile_0_Level_3), 496 VIDEOEDIT_JAVA_CONSTANT_INIT("H264_PROFILE_0_LEVEL_3_1",\ 497 M4VIDEOEDITING_kH264_Profile_0_Level_3_1), 498 VIDEOEDIT_JAVA_CONSTANT_INIT("H264_PROFILE_0_LEVEL_3_2",\ 499 M4VIDEOEDITING_kH264_Profile_0_Level_3_2), 500 VIDEOEDIT_JAVA_CONSTANT_INIT("H264_PROFILE_0_LEVEL_4", \ 501 M4VIDEOEDITING_kH264_Profile_0_Level_4), 502 VIDEOEDIT_JAVA_CONSTANT_INIT("H264_PROFILE_0_LEVEL_4_1",\ 503 M4VIDEOEDITING_kH264_Profile_0_Level_4_1), 504 VIDEOEDIT_JAVA_CONSTANT_INIT("H264_PROFILE_0_LEVEL_4_2",\ 505 M4VIDEOEDITING_kH264_Profile_0_Level_4_2), 506 VIDEOEDIT_JAVA_CONSTANT_INIT("H264_PROFILE_0_LEVEL_5", \ 507 M4VIDEOEDITING_kH264_Profile_0_Level_5), 508 VIDEOEDIT_JAVA_CONSTANT_INIT("H264_PROFILE_0_LEVEL_5_1",\ 509 M4VIDEOEDITING_kH264_Profile_0_Level_5_1), 510 VIDEOEDIT_JAVA_CONSTANT_INIT("OUT_OF_RANGE", \ 511 M4VIDEOEDITING_kProfile_and_Level_Out_Of_Range) 512}; 513 514VIDEOEDIT_JAVA_DEFINE_CONSTANT_CLASS(VideoProfile, VIDEO_PROFILE_CLASS_NAME, M4OSA_NULL, 515 M4OSA_NULL) 516 517 518VIDEOEDIT_JAVA_DEFINE_CONSTANTS(VideoTransition) 519{ 520 VIDEOEDIT_JAVA_CONSTANT_INIT("NONE", M4VSS3GPP_kVideoTransitionType_None), 521 VIDEOEDIT_JAVA_CONSTANT_INIT("CROSS_FADE", M4VSS3GPP_kVideoTransitionType_CrossFade), 522 VIDEOEDIT_JAVA_CONSTANT_INIT("EXTERNAL", M4VSS3GPP_kVideoTransitionType_External), 523 VIDEOEDIT_JAVA_CONSTANT_INIT("ALPHA_MAGIC", M4xVSS_kVideoTransitionType_AlphaMagic), 524 VIDEOEDIT_JAVA_CONSTANT_INIT("SLIDE_TRANSITION", M4xVSS_kVideoTransitionType_SlideTransition), 525 VIDEOEDIT_JAVA_CONSTANT_INIT("FADE_BLACK", M4xVSS_kVideoTransitionType_FadeBlack) 526}; 527 528VIDEOEDIT_JAVA_DEFINE_CONSTANT_CLASS(VideoTransition, VIDEO_TRANSITION_CLASS_NAME, 529 M4OSA_NULL, M4OSA_NULL) 530 531 532VIDEOEDIT_JAVA_DEFINE_FIELDS(AlphaMagic) 533{ 534 VIDEOEDIT_JAVA_FIELD_INIT("file", "Ljava/lang/String;"), 535 VIDEOEDIT_JAVA_FIELD_INIT("blendingPercent", "I" ), 536 VIDEOEDIT_JAVA_FIELD_INIT("invertRotation", "Z" ), 537 VIDEOEDIT_JAVA_FIELD_INIT("rgbWidth", "I" ), 538 VIDEOEDIT_JAVA_FIELD_INIT("rgbHeight", "I" ) 539}; 540 541VIDEOEDIT_JAVA_DEFINE_FIELD_CLASS(AlphaMagic, ALPHA_MAGIC_SETTINGS_CLASS_NAME) 542 543VIDEOEDIT_JAVA_DEFINE_FIELDS(Properties) 544{ 545 VIDEOEDIT_JAVA_FIELD_INIT("duration", "I"), 546 VIDEOEDIT_JAVA_FIELD_INIT("fileType", "I"), 547 VIDEOEDIT_JAVA_FIELD_INIT("videoFormat", "I"), 548 VIDEOEDIT_JAVA_FIELD_INIT("videoDuration", "I"), 549 VIDEOEDIT_JAVA_FIELD_INIT("videoBitrate", "I"), 550 VIDEOEDIT_JAVA_FIELD_INIT("width", "I"), 551 VIDEOEDIT_JAVA_FIELD_INIT("height", "I"), 552 VIDEOEDIT_JAVA_FIELD_INIT("averageFrameRate", "F"), 553 VIDEOEDIT_JAVA_FIELD_INIT("profileAndLevel", "I"), 554 VIDEOEDIT_JAVA_FIELD_INIT("audioFormat", "I"), 555 VIDEOEDIT_JAVA_FIELD_INIT("audioDuration", "I"), 556 VIDEOEDIT_JAVA_FIELD_INIT("audioBitrate", "I"), 557 VIDEOEDIT_JAVA_FIELD_INIT("audioChannels", "I"), 558 VIDEOEDIT_JAVA_FIELD_INIT("audioSamplingFrequency", "I") 559}; 560 561VIDEOEDIT_JAVA_DEFINE_FIELD_CLASS(Properties, PROPERTIES_CLASS_NAME) 562 563VIDEOEDIT_JAVA_DEFINE_FIELDS(BackgroundMusic) 564{ 565 VIDEOEDIT_JAVA_FIELD_INIT("file", "Ljava/lang/String;"), 566 VIDEOEDIT_JAVA_FIELD_INIT("fileType", "I" ), 567 VIDEOEDIT_JAVA_FIELD_INIT("insertionTime", "J" ), 568 VIDEOEDIT_JAVA_FIELD_INIT("volumePercent", "I" ), 569 VIDEOEDIT_JAVA_FIELD_INIT("beginLoop", "J" ), 570 VIDEOEDIT_JAVA_FIELD_INIT("endLoop", "J" ), 571 VIDEOEDIT_JAVA_FIELD_INIT("enableDucking", "Z" ), 572 VIDEOEDIT_JAVA_FIELD_INIT("duckingThreshold","I" ), 573 VIDEOEDIT_JAVA_FIELD_INIT("lowVolume", "I" ), 574 VIDEOEDIT_JAVA_FIELD_INIT("isLooping", "Z" ) 575}; 576 577VIDEOEDIT_JAVA_DEFINE_FIELD_CLASS(BackgroundMusic, BACKGROUND_MUSIC_SETTINGS_CLASS_NAME) 578 579/* 580VIDEOEDIT_JAVA_DEFINE_FIELDS(BestEditSettings) 581{ 582 VIDEOEDIT_JAVA_FIELD_INIT("videoFormat", "I"), 583 VIDEOEDIT_JAVA_FIELD_INIT("videoFrameSize", "I"), 584 VIDEOEDIT_JAVA_FIELD_INIT("audioFormat", "I"), 585 VIDEOEDIT_JAVA_FIELD_INIT("audioChannels", "I") 586}; 587 588VIDEOEDIT_JAVA_DEFINE_FIELD_CLASS(BestEditSettings, BEST_EDIT_SETTINGS_CLASS_NAME) 589*/ 590 591VIDEOEDIT_JAVA_DEFINE_FIELDS(ClipSettings) 592{ 593 VIDEOEDIT_JAVA_FIELD_INIT("clipPath", "Ljava/lang/String;"), 594 VIDEOEDIT_JAVA_FIELD_INIT("fileType", "I" ), 595 VIDEOEDIT_JAVA_FIELD_INIT("beginCutTime", "I" ), 596 VIDEOEDIT_JAVA_FIELD_INIT("endCutTime", "I" ), 597 VIDEOEDIT_JAVA_FIELD_INIT("beginCutPercent", "I" ), 598 VIDEOEDIT_JAVA_FIELD_INIT("endCutPercent", "I" ), 599 VIDEOEDIT_JAVA_FIELD_INIT("panZoomEnabled", "Z" ), 600 VIDEOEDIT_JAVA_FIELD_INIT("panZoomPercentStart", "I" ), 601 VIDEOEDIT_JAVA_FIELD_INIT("panZoomTopLeftXStart", "I" ), 602 VIDEOEDIT_JAVA_FIELD_INIT("panZoomTopLeftYStart", "I" ), 603 VIDEOEDIT_JAVA_FIELD_INIT("panZoomPercentEnd", "I" ), 604 VIDEOEDIT_JAVA_FIELD_INIT("panZoomTopLeftXEnd", "I" ), 605 VIDEOEDIT_JAVA_FIELD_INIT("panZoomTopLeftYEnd", "I" ), 606 VIDEOEDIT_JAVA_FIELD_INIT("mediaRendering", "I" ), 607 VIDEOEDIT_JAVA_FIELD_INIT("rgbWidth", "I" ), 608 VIDEOEDIT_JAVA_FIELD_INIT("rgbHeight", "I" ) 609}; 610 611VIDEOEDIT_JAVA_DEFINE_FIELD_CLASS(ClipSettings, CLIP_SETTINGS_CLASS_NAME) 612 613 614VIDEOEDIT_JAVA_DEFINE_FIELDS(EditSettings) 615{ 616 VIDEOEDIT_JAVA_FIELD_INIT("clipSettingsArray", "[L"CLIP_SETTINGS_CLASS_NAME";" ), 617 VIDEOEDIT_JAVA_FIELD_INIT("transitionSettingsArray", "[L"TRANSITION_SETTINGS_CLASS_NAME";" ), 618 VIDEOEDIT_JAVA_FIELD_INIT("effectSettingsArray", "[L"EFFECT_SETTINGS_CLASS_NAME";" ), 619 VIDEOEDIT_JAVA_FIELD_INIT("videoFrameRate", "I" ), 620 VIDEOEDIT_JAVA_FIELD_INIT("outputFile", "Ljava/lang/String;" ), 621 VIDEOEDIT_JAVA_FIELD_INIT("videoFrameSize", "I" ), 622 VIDEOEDIT_JAVA_FIELD_INIT("videoFormat", "I" ), 623 VIDEOEDIT_JAVA_FIELD_INIT("audioFormat", "I" ), 624 VIDEOEDIT_JAVA_FIELD_INIT("audioSamplingFreq", "I" ), 625 VIDEOEDIT_JAVA_FIELD_INIT("maxFileSize", "I" ), 626 VIDEOEDIT_JAVA_FIELD_INIT("audioChannels", "I" ), 627 VIDEOEDIT_JAVA_FIELD_INIT("videoBitrate", "I" ), 628 VIDEOEDIT_JAVA_FIELD_INIT("audioBitrate", "I" ), 629 VIDEOEDIT_JAVA_FIELD_INIT("backgroundMusicSettings",\ 630 "L"BACKGROUND_MUSIC_SETTINGS_CLASS_NAME";"), 631 VIDEOEDIT_JAVA_FIELD_INIT("primaryTrackVolume", "I" ) 632}; 633 634VIDEOEDIT_JAVA_DEFINE_FIELD_CLASS(EditSettings, EDIT_SETTINGS_CLASS_NAME) 635 636 637VIDEOEDIT_JAVA_DEFINE_FIELDS(EffectSettings) 638{ 639 VIDEOEDIT_JAVA_FIELD_INIT("startTime", "I" ), 640 VIDEOEDIT_JAVA_FIELD_INIT("duration", "I" ), 641 VIDEOEDIT_JAVA_FIELD_INIT("videoEffectType", "I" ), 642 VIDEOEDIT_JAVA_FIELD_INIT("audioEffectType", "I" ), 643 VIDEOEDIT_JAVA_FIELD_INIT("startPercent", "I" ), 644 VIDEOEDIT_JAVA_FIELD_INIT("durationPercent", "I" ), 645 VIDEOEDIT_JAVA_FIELD_INIT("framingFile", "Ljava/lang/String;"), 646 VIDEOEDIT_JAVA_FIELD_INIT("framingBuffer", "[I" ), 647 VIDEOEDIT_JAVA_FIELD_INIT("bitmapType", "I" ), 648 VIDEOEDIT_JAVA_FIELD_INIT("width", "I" ), 649 VIDEOEDIT_JAVA_FIELD_INIT("height", "I" ), 650 VIDEOEDIT_JAVA_FIELD_INIT("topLeftX", "I" ), 651 VIDEOEDIT_JAVA_FIELD_INIT("topLeftY", "I" ), 652 VIDEOEDIT_JAVA_FIELD_INIT("framingResize", "Z" ), 653 VIDEOEDIT_JAVA_FIELD_INIT("framingScaledSize", "I" ), 654 VIDEOEDIT_JAVA_FIELD_INIT("text", "Ljava/lang/String;"), 655 VIDEOEDIT_JAVA_FIELD_INIT("textRenderingData", "Ljava/lang/String;"), 656 VIDEOEDIT_JAVA_FIELD_INIT("textBufferWidth", "I" ), 657 VIDEOEDIT_JAVA_FIELD_INIT("textBufferHeight", "I" ), 658 VIDEOEDIT_JAVA_FIELD_INIT("fiftiesFrameRate", "I" ), 659 VIDEOEDIT_JAVA_FIELD_INIT("rgb16InputColor", "I" ), 660 VIDEOEDIT_JAVA_FIELD_INIT("alphaBlendingStartPercent", "I" ), 661 VIDEOEDIT_JAVA_FIELD_INIT("alphaBlendingMiddlePercent", "I" ), 662 VIDEOEDIT_JAVA_FIELD_INIT("alphaBlendingEndPercent", "I" ), 663 VIDEOEDIT_JAVA_FIELD_INIT("alphaBlendingFadeInTimePercent", "I" ), 664 VIDEOEDIT_JAVA_FIELD_INIT("alphaBlendingFadeOutTimePercent", "I" ) 665}; 666 667VIDEOEDIT_JAVA_DEFINE_FIELD_CLASS(EffectSettings, EFFECT_SETTINGS_CLASS_NAME) 668 669 670VIDEOEDIT_JAVA_DEFINE_FIELDS(Engine) 671{ 672 VIDEOEDIT_JAVA_FIELD_INIT("mManualEditContext", "I") 673}; 674 675VIDEOEDIT_JAVA_DEFINE_FIELD_CLASS(Engine, MANUAL_EDIT_ENGINE_CLASS_NAME) 676 677 678VIDEOEDIT_JAVA_DEFINE_FIELDS(SlideTransitionSettings) 679{ 680 VIDEOEDIT_JAVA_FIELD_INIT("direction", "I") 681}; 682 683VIDEOEDIT_JAVA_DEFINE_FIELD_CLASS(SlideTransitionSettings, SLIDE_TRANSITION_SETTINGS_CLASS_NAME) 684 685 686VIDEOEDIT_JAVA_DEFINE_FIELDS(TransitionSettings) 687{ 688 VIDEOEDIT_JAVA_FIELD_INIT("duration", "I" ), 689 VIDEOEDIT_JAVA_FIELD_INIT("videoTransitionType", "I" ), 690 VIDEOEDIT_JAVA_FIELD_INIT("audioTransitionType", "I" ), 691 VIDEOEDIT_JAVA_FIELD_INIT("transitionBehaviour", "I" ), 692 VIDEOEDIT_JAVA_FIELD_INIT("alphaSettings", "L"ALPHA_MAGIC_SETTINGS_CLASS_NAME";" ), 693 VIDEOEDIT_JAVA_FIELD_INIT("slideSettings", "L"SLIDE_TRANSITION_SETTINGS_CLASS_NAME";") 694}; 695 696VIDEOEDIT_JAVA_DEFINE_FIELD_CLASS(TransitionSettings, TRANSITION_SETTINGS_CLASS_NAME) 697 698 699VIDEOEDIT_JAVA_DEFINE_FIELDS(Version) 700{ 701 VIDEOEDIT_JAVA_FIELD_INIT("major", "I"), 702 VIDEOEDIT_JAVA_FIELD_INIT("minor", "I"), 703 VIDEOEDIT_JAVA_FIELD_INIT("revision", "I") 704}; 705 706VIDEOEDIT_JAVA_DEFINE_FIELD_CLASS(Version, VERSION_CLASS_NAME) 707 708 709VIDEOEDIT_JAVA_DEFINE_METHODS(Engine) 710{ 711 VIDEOEDIT_JAVA_METHOD_INIT("onProgressUpdate", "(II)V") 712}; 713 714VIDEOEDIT_JAVA_DEFINE_METHOD_CLASS(Engine, MANUAL_EDIT_ENGINE_CLASS_NAME) 715 716 717static const char* 718videoEditClasses_getBrandString(M4OSA_UInt32 brand) 719{ 720 static char brandString[11] = "0x00000000"; 721 const char* pBrandString = M4OSA_NULL; 722 M4OSA_UInt8* pBrand = (M4OSA_UInt8*)&brand; 723 M4OSA_UInt32 brandHost = 0; 724 725 // Convert the brand from big endian to host. 726 brandHost = pBrand[0]; 727 brandHost = brandHost << 8; 728 brandHost += pBrand[1]; 729 brandHost = brandHost << 8; 730 brandHost += pBrand[2]; 731 brandHost = brandHost << 8; 732 brandHost += pBrand[3]; 733 734 switch (brandHost) 735 { 736 case M4VIDEOEDITING_BRAND_0000: 737 pBrandString = "0000"; 738 break; 739 case M4VIDEOEDITING_BRAND_3G2A: 740 pBrandString = "3G2A"; 741 break; 742 case M4VIDEOEDITING_BRAND_3GP4: 743 pBrandString = "3GP4"; 744 break; 745 case M4VIDEOEDITING_BRAND_3GP5: 746 pBrandString = "3GP5"; 747 break; 748 case M4VIDEOEDITING_BRAND_3GP6: 749 pBrandString = "3GP6"; 750 break; 751 case M4VIDEOEDITING_BRAND_AVC1: 752 pBrandString = "AVC1"; 753 break; 754 case M4VIDEOEDITING_BRAND_EMP: 755 pBrandString = "EMP"; 756 break; 757 case M4VIDEOEDITING_BRAND_ISOM: 758 pBrandString = "ISOM"; 759 break; 760 case M4VIDEOEDITING_BRAND_MP41: 761 pBrandString = "MP41"; 762 break; 763 case M4VIDEOEDITING_BRAND_MP42: 764 pBrandString = "MP42"; 765 break; 766 case M4VIDEOEDITING_BRAND_VFJ1: 767 pBrandString = "VFJ1"; 768 break; 769 default: 770 M4OSA_chrSPrintf((M4OSA_Char *)brandString, 771 sizeof(brandString) - 1, 772 (M4OSA_Char*)"0x%08X", brandHost); 773 pBrandString = brandString; 774 break; 775 } 776 777 // Return the brand string. 778 return(pBrandString); 779} 780 781#ifdef VIDEOEDIT_LOGGING_ENABLED 782static void 783videoEditClasses_logFtypBox( 784 M4VIDEOEDITING_FtypBox* pBox, 785 int indentation) 786{ 787 // Check if memory was allocated for the FtypBox. 788 if (M4OSA_NULL != pBox) 789 { 790 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES", 791 "%*c major_brand: %s", indentation, ' ', 792 videoEditClasses_getBrandString(pBox->major_brand)); 793 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES", 794 "%*c minor_version: %08X", indentation, ' ', 795 (unsigned int)pBox->minor_version); 796 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES", 797 "%*c nbCompatibleBrands: %u", indentation, ' ', 798 (unsigned int)pBox->nbCompatibleBrands); 799 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES", 800 "%*c compatible_brands:", indentation, ' '); 801 indentation += VIDEOEDIT_LOG_INDENTATION; 802 for (int i = 0; (i < (int)pBox->nbCompatibleBrands) &&\ 803 (i < M4VIDEOEDITING_MAX_COMPATIBLE_BRANDS); i++) 804 { 805 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES", 806 "%*c compatible_brand[%d]: %s", indentation, ' ', 807 i, videoEditClasses_getBrandString(pBox->compatible_brands[i])); 808 } 809 indentation -= VIDEOEDIT_LOG_INDENTATION; 810 } 811 else 812 { 813 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES", "%*c <null>", 814 indentation, ' '); 815 } 816} 817#endif 818 819 820void 821videoEditClasses_init( 822 bool* pResult, 823 JNIEnv* pEnv) 824{ 825 // Check if the previous action succeeded. 826 if (*pResult) 827 { 828 // Log the function call. 829 VIDEOEDIT_LOG_FUNCTION(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES",\ 830 "videoEditClasses_init()"); 831 832 // Initialize the constants. 833 videoEditJava_initAudioEffectConstants(pResult, pEnv); 834 videoEditJava_initAudioFormatConstants(pResult, pEnv); 835 videoEditJava_initAudioSamplingFrequencyConstants(pResult, pEnv); 836 videoEditJava_initAudioTransitionConstants(pResult, pEnv); 837 videoEditJava_initBitrateConstants(pResult, pEnv); 838 videoEditJava_initClipTypeConstants(pResult, pEnv); 839 videoEditJava_initEngineConstants(pResult, pEnv); 840 videoEditJava_initErrorConstants(pResult, pEnv); 841 videoEditJava_initFileTypeConstants(pResult, pEnv); 842 videoEditJava_initMediaRenderingConstants(pResult, pEnv); 843 videoEditJava_initSlideDirectionConstants(pResult, pEnv); 844 videoEditJava_initTransitionBehaviourConstants(pResult, pEnv); 845 videoEditJava_initVideoEffectConstants(pResult, pEnv); 846 videoEditJava_initVideoFormatConstants(pResult, pEnv); 847 videoEditJava_initVideoFrameRateConstants(pResult, pEnv); 848 videoEditJava_initVideoFrameSizeConstants(pResult, pEnv); 849 videoEditJava_initVideoProfileConstants(pResult, pEnv); 850 videoEditJava_initVideoTransitionConstants(pResult, pEnv); 851 852 // Initialize the fields. 853 videoEditJava_initAlphaMagicFields(pResult, pEnv); 854 videoEditJava_initBackgroundMusicFields(pResult, pEnv); 855 videoEditJava_initClipSettingsFields(pResult, pEnv); 856 videoEditJava_initEditSettingsFields(pResult, pEnv); 857 videoEditJava_initEffectSettingsFields(pResult, pEnv); 858 videoEditJava_initEngineFields(pResult, pEnv); 859 videoEditJava_initSlideTransitionSettingsFields(pResult, pEnv); 860 videoEditJava_initTransitionSettingsFields(pResult, pEnv); 861 videoEditJava_initVersionFields(pResult, pEnv); 862 // Initialize the methods. 863 videoEditJava_initEngineMethods(pResult, pEnv); 864 } 865} 866 867void 868videoEditPropClass_init( 869 bool* pResult, 870 JNIEnv* pEnv) 871{ 872 // Check if the previous action succeeded. 873 if (*pResult) 874 { 875 // Log the function call. 876 VIDEOEDIT_LOG_FUNCTION(ANDROID_LOG_INFO, "VIDEO_EDITOR_PROP_CLASSES",\ 877 "videoEditPropClass_init()"); 878 879 // Initialize the constants. 880 videoEditJava_initAudioFormatConstants(pResult, pEnv); 881 videoEditJava_initErrorConstants(pResult, pEnv); 882 videoEditJava_initFileTypeConstants(pResult, pEnv); 883 videoEditJava_initVideoFormatConstants(pResult, pEnv); 884 videoEditJava_initVideoProfileConstants(pResult, pEnv); 885 886 // Initialize the fields. 887 videoEditJava_initPropertiesFields(pResult, pEnv); 888 } 889} 890 891void 892videoEditClasses_getAlphaMagicSettings( 893 bool* pResult, 894 JNIEnv* pEnv, 895 jobject object, 896 M4xVSS_AlphaMagicSettings** ppSettings) 897{ 898 VideoEditJava_AlphaMagicFieldIds fieldIds; 899 M4xVSS_AlphaMagicSettings* pSettings = M4OSA_NULL; 900 memset(&fieldIds, 0, sizeof(VideoEditJava_AlphaMagicFieldIds)); 901 902 // Check if the previous action succeeded. 903 if (*pResult) 904 { 905 // Log the function call. 906 VIDEOEDIT_LOG_FUNCTION(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES", 907 "videoEditClasses_getAlphaMagicSettings()"); 908 909 // Retrieve the field ids. 910 videoEditJava_getAlphaMagicFieldIds(pResult, pEnv, &fieldIds); 911 } 912 913 // Only validate the AlphaMagicSettings if the fields could be located. 914 if (*pResult) 915 { 916 // Check if the clip is set. 917 videoEditJava_checkAndThrowIllegalArgumentException(pResult, pEnv, 918 (NULL == object), 919 "alphaSettings is null"); 920 } 921 922 // Only retrieve the AlphaMagicSettings if the fields could be located and validated. 923 if (*pResult) 924 { 925 // Allocate memory for the AlphaMagicSettings. 926 pSettings = (M4xVSS_AlphaMagicSettings*)videoEditOsal_alloc(pResult, pEnv, 927 sizeof(M4xVSS_AlphaMagicSettings), "AlphaMagicSettings"); 928 929 // Check if memory could be allocated for the AlphaMagicSettings. 930 if (*pResult) 931 { 932 // Set the alpha magic file path (JPG file). 933 pSettings->pAlphaFilePath = (M4OSA_Char*)videoEditJava_getString(pResult, pEnv, object, 934 fieldIds.file, M4OSA_NULL); 935 936 // Check if the alpha magic file path is valid. 937 videoEditJava_checkAndThrowIllegalArgumentException(pResult, pEnv, 938 (M4OSA_NULL == pSettings->pAlphaFilePath), "alphaSettings.file is null"); 939 } 940 941 // Check if the alpha file path could be retrieved. 942 if (*pResult) 943 { 944 // Set the blending percentage between 0 and 100. 945 pSettings->blendingPercent = (M4OSA_UInt8)pEnv->GetIntField(object, 946 fieldIds.blendingPercent); 947 948 // Set the direct effect or reverse. 949 pSettings->isreverse = (M4OSA_Bool)pEnv->GetBooleanField(object, 950 fieldIds.invertRotation); 951 952 // Get the rgb width 953 pSettings->width = (M4OSA_UInt32) pEnv->GetIntField(object, fieldIds.rgbWidth ); 954 955 pSettings->height = (M4OSA_UInt32) pEnv->GetIntField(object, fieldIds.rgbHeight ); 956 957 VIDEOEDIT_LOG_FUNCTION(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES", 958 "((((((((((path %s", pSettings->pAlphaFilePath); 959 960 VIDEOEDIT_LOG_FUNCTION(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES", 961 "------- getAlphaMagicSettings width %d", pEnv->GetIntField(object, 962 fieldIds.rgbWidth )); 963 VIDEOEDIT_LOG_FUNCTION(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES", 964 "-------- getAlphaMagicSettings Height %d", 965 pEnv->GetIntField(object, fieldIds.rgbHeight )); 966 } 967 968 // Check if settings could be set. 969 if (*pResult) 970 { 971 // Return the settings. 972 (*ppSettings) = pSettings; 973 } 974 else 975 { 976 // Free the settings. 977 videoEditClasses_freeAlphaMagicSettings(&pSettings); 978 } 979 } 980} 981 982void 983videoEditClasses_freeAlphaMagicSettings( 984 M4xVSS_AlphaMagicSettings** ppSettings) 985{ 986 // Check if memory was allocated for the AlphaMagicSettings. 987 if (M4OSA_NULL != (*ppSettings)) 988 { 989 // Log the function call. 990 VIDEOEDIT_LOG_FUNCTION(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES", 991 "videoEditClasses_freeAlphaMagicSettings()"); 992 993 // Free the alpha file path. 994 videoEditOsal_free((*ppSettings)->pAlphaFilePath); 995 (*ppSettings)->pAlphaFilePath = M4OSA_NULL; 996 997 // Free the settings structure. 998 videoEditOsal_free((*ppSettings)); 999 (*ppSettings) = M4OSA_NULL; 1000 } 1001} 1002 1003#ifdef VIDEOEDIT_LOGGING_ENABLED 1004void 1005videoEditClasses_logAlphaMagicSettings( 1006 M4xVSS_AlphaMagicSettings* pSettings, 1007 int indentation) 1008{ 1009 // Check if memory was allocated for the AlphaMagicSettings. 1010 if (M4OSA_NULL != pSettings) 1011 { 1012 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES", 1013 "%*c pAlphaFilePath: %s", indentation, ' ', 1014 (M4OSA_NULL != pSettings->pAlphaFilePath) ? \ 1015 (char *)pSettings->pAlphaFilePath : "<null>"); 1016 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES", 1017 "%*c blendingPercent: %u %%", indentation, ' ', 1018 (unsigned int)pSettings->blendingPercent); 1019 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES", 1020 "%*c isreverse: %s", indentation, ' ', 1021 pSettings->isreverse ? "true" : "false"); 1022 } 1023 else 1024 { 1025 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES", 1026 "%*c <null>", indentation, ' '); 1027 } 1028} 1029#endif 1030 1031 1032void 1033videoEditClasses_getBackgroundMusicSettings( 1034 bool* pResult, 1035 JNIEnv* pEnv, 1036 jobject object, 1037 M4xVSS_BGMSettings** ppSettings) 1038{ 1039 VideoEditJava_BackgroundMusicFieldIds fieldIds; 1040 M4xVSS_BGMSettings* pSettings = M4OSA_NULL; 1041 bool converted = true; 1042 memset(&fieldIds, 0, sizeof(VideoEditJava_BackgroundMusicFieldIds)); 1043 // Check if the previous action succeeded. 1044 if (*pResult) 1045 { 1046 // Log the function call. 1047 VIDEOEDIT_LOG_FUNCTION(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES", 1048 "videoEditClasses_getBackgroundMusicSettings()"); 1049 1050 // Retrieve the field ids. 1051 videoEditJava_getBackgroundMusicFieldIds(pResult, pEnv, &fieldIds); 1052 } 1053 1054 // Only retrieve the BackgroundMusicSettings if the fields could be located. 1055 if (*pResult) 1056 { 1057 // Check if the object is valid. 1058 if (NULL != object) 1059 { 1060 // Allocate memory for the BackgroundMusicSettings. 1061 pSettings = (M4xVSS_BGMSettings*)videoEditOsal_alloc(pResult, pEnv, 1062 sizeof(M4xVSS_BGMSettings), "BackgroundMusicSettings"); 1063 1064 // Check if memory could be allocated for the BackgroundMusicSettings. 1065 if (*pResult) 1066 { 1067 // Set the input file path. 1068 pSettings->pFile = (M4OSA_Char*)videoEditJava_getString(pResult, pEnv, object, 1069 fieldIds.file, M4OSA_NULL); 1070 1071 // Check if the input file path is valid. 1072 videoEditJava_checkAndThrowIllegalArgumentException(pResult, pEnv, 1073 (M4OSA_NULL == pSettings->pFile), "backgroundMusicSettings.file is null"); 1074 } 1075 1076 // Check if the input file path could be retrieved. 1077 if (*pResult) 1078 { 1079 // Set the file type .3gp, .amr, .mp3. 1080 pSettings->FileType = M4VIDEOEDITING_kFileType_PCM; 1081 /*(M4VIDEOEDITING_FileType)videoEditJava_getClipTypeJavaToC( 1082 &converted, pEnv->GetIntField(object, fieldIds.fileType));*/ 1083 1084 // Check if the file type is valid. 1085 videoEditJava_checkAndThrowIllegalArgumentException(pResult, pEnv, 1086 !converted, "backgroundMusicSettings.fileType is invalid"); 1087 } 1088 1089 // Check if the file type could be retrieved. 1090 if (*pResult) 1091 { 1092 // Set the time, in milliseconds, at which the added audio track is inserted. 1093 pSettings->uiAddCts = (M4OSA_UInt32)pEnv->GetLongField(object, 1094 fieldIds.insertionTime); 1095 1096 // Set the volume, in percentage (0..100), of the added audio track. 1097 pSettings->uiAddVolume = (M4OSA_UInt32)pEnv->GetIntField(object, 1098 fieldIds.volumePercent); 1099 1100 // Set the start time of the loop in milli seconds. 1101 pSettings->uiBeginLoop = (M4OSA_UInt32)pEnv->GetLongField(object, 1102 fieldIds.beginLoop); 1103 1104 // Set the end time of the loop in milli seconds. 1105 pSettings->uiEndLoop = (M4OSA_UInt32)pEnv->GetLongField(object, 1106 fieldIds.endLoop); 1107 // Set the end time of the loop in milli seconds. 1108 pSettings->b_DuckingNeedeed = 1109 (M4OSA_Bool)pEnv->GetBooleanField(object, fieldIds.enableDucking); 1110 1111 // Set the end time of the loop in milli seconds. 1112 pSettings->InDucking_threshold = 1113 (M4OSA_Int32)pEnv->GetIntField(object, fieldIds.duckingThreshold); 1114 1115 // Set the end time of the loop in milli seconds. 1116 pSettings->lowVolume = 1117 (M4OSA_Float)(((M4OSA_Float)pEnv->GetIntField(object, fieldIds.lowVolume))); 1118 1119 // Set the end time of the loop in milli seconds. 1120 pSettings->bLoop = (M4OSA_Bool)pEnv->GetBooleanField(object, fieldIds.isLooping); 1121 1122 // Set sampling freq and channels 1123 pSettings->uiSamplingFrequency = M4VIDEOEDITING_k32000_ASF; 1124 pSettings->uiNumChannels = 2; 1125 } 1126 1127 // Check if settings could be set. 1128 if (*pResult) 1129 { 1130 // Return the settings. 1131 (*ppSettings) = pSettings; 1132 } 1133 else 1134 { 1135 // Free the settings. 1136 videoEditClasses_freeBackgroundMusicSettings(&pSettings); 1137 } 1138 } 1139 } 1140} 1141 1142void 1143videoEditClasses_freeBackgroundMusicSettings( 1144 M4xVSS_BGMSettings** ppSettings) 1145{ 1146 // Check if memory was allocated for the BackgroundMusicSettings. 1147 if (M4OSA_NULL != (*ppSettings)) 1148 { 1149 // Log the function call. 1150 VIDEOEDIT_LOG_FUNCTION(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES", 1151 "videoEditClasses_freeBackgroundMusicSettings()"); 1152 1153 // Free the input file path. 1154 videoEditOsal_free((*ppSettings)->pFile); 1155 (*ppSettings)->pFile = M4OSA_NULL; 1156 1157 // Free the settings structure. 1158 videoEditOsal_free((*ppSettings)); 1159 (*ppSettings) = M4OSA_NULL; 1160 } 1161} 1162 1163#ifdef VIDEOEDIT_LOGGING_ENABLED 1164void 1165videoEditClasses_logBackgroundMusicSettings( 1166 M4xVSS_BGMSettings* pSettings, 1167 int indentation) 1168{ 1169 // Check if memory was allocated for the BackgroundMusicSettings. 1170 if (M4OSA_NULL != pSettings) 1171 { 1172 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES", "%*c pFile: %s", 1173 indentation, ' ', 1174 (M4OSA_NULL != pSettings->pFile) ? (char *)pSettings->pFile : "<null>"); 1175 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES", 1176 "%*c FileType: %s", indentation, ' ', 1177 videoEditJava_getClipTypeString(pSettings->FileType)); 1178 1179 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES", "%*c uiAddCts: %u ms", 1180 indentation, ' ', (unsigned int)pSettings->uiAddCts); 1181 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES", "%*c uiAddVolume: %u %%", 1182 indentation, ' ', (unsigned int)pSettings->uiAddVolume); 1183 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES", "%*c uiBeginLoop: %u ms", 1184 indentation, ' ', (unsigned int)pSettings->uiBeginLoop); 1185 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES", "%*c uiEndLoop: %u ms", 1186 indentation, ' ', (unsigned int)pSettings->uiEndLoop); 1187 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES", "%*c b_DuckingNeedeed:\ 1188 %u ", indentation, ' ', (bool)pSettings->b_DuckingNeedeed); 1189 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES", "%*c InDucking_threshold: \ 1190 %u ms", indentation, ' ', (unsigned int)pSettings->InDucking_threshold); 1191 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES", "%*c lowVolume: %2.2f ",\ 1192 indentation, ' ', (float)pSettings->lowVolume); 1193 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES", "%*c bLoop: %u ms",\ 1194 indentation, ' ', (bool)pSettings->bLoop); 1195 } 1196 else 1197 { 1198 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES", "%*c <null>", 1199 indentation, ' '); 1200 } 1201} 1202#endif 1203 1204#ifdef VIDEOEDIT_LOGGING_ENABLED 1205void 1206videoEditClasses_logClipProperties( 1207 M4VIDEOEDITING_ClipProperties* pProperties, 1208 int indentation) 1209{ 1210 // Check if memory was allocated for the ClipProperties. 1211 if (M4OSA_NULL != pProperties) 1212 { 1213 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES", 1214 "%*c bAnalysed: %s", indentation, ' ', 1215 pProperties->bAnalysed ? "true" : "false"); 1216 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES", 1217 "%*c Version: %d.%d.%d", indentation, ' ', 1218 pProperties->Version[0], pProperties->Version[1], pProperties->Version[2]); 1219 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES", 1220 "%*c uiClipDuration: %u", indentation, ' ', 1221 (unsigned int)pProperties->uiClipDuration); 1222 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES", 1223 "%*c FileType: %s", indentation, ' ', 1224 videoEditJava_getClipTypeString(pProperties->FileType)); 1225 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES", "%*c ftyp:", 1226 indentation, ' '); 1227 videoEditClasses_logFtypBox(&pProperties->ftyp, indentation + VIDEOEDIT_LOG_INDENTATION); 1228 1229 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES", 1230 "%*c VideoStreamType: %s", indentation, ' ', 1231 videoEditJava_getVideoFormatString(pProperties->VideoStreamType)); 1232 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES", 1233 "%*c uiClipVideoDuration: %u", indentation, ' ', 1234 (unsigned int)pProperties->uiClipVideoDuration); 1235 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES", 1236 "%*c uiVideoBitrate: %s", indentation, ' ', 1237 videoEditJava_getBitrateString(pProperties->uiVideoBitrate)); 1238 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES", 1239 "%*c uiVideoMaxAuSize: %u", indentation, ' ', 1240 (unsigned int)pProperties->uiVideoMaxAuSize); 1241 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES", 1242 "%*c uiVideoWidth: %u", indentation, ' ', 1243 (unsigned int)pProperties->uiVideoWidth); 1244 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES", 1245 "%*c uiVideoHeight: %u", indentation, ' ', 1246 (unsigned int)(unsigned int)pProperties->uiVideoHeight); 1247 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES", 1248 "%*c uiVideoTimeScale: %u", indentation, ' ', 1249 (unsigned int)pProperties->uiVideoTimeScale); 1250 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES", 1251 "%*c fAverageFrameRate: %.3f", indentation, ' ', 1252 pProperties->fAverageFrameRate); 1253 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES", 1254 "%*c ProfileAndLevel: %s", indentation, ' ', 1255 videoEditJava_getVideoProfileString(pProperties->ProfileAndLevel)); 1256 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES", 1257 "%*c uiH263level: %d", indentation, ' ', 1258 pProperties->uiH263level); 1259 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES", 1260 "%*c uiVideoProfile: %d", indentation, ' ', 1261 pProperties->uiVideoProfile); 1262 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES", 1263 "%*c bMPEG4dataPartition: %s", indentation, ' ', 1264 pProperties->bMPEG4dataPartition ? "true" : "false"); 1265 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES", 1266 "%*c bMPEG4rvlc: %s", indentation, ' ', 1267 pProperties->bMPEG4rvlc ? "true" : "false"); 1268 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES", 1269 "%*c bMPEG4resynchMarker: %s", indentation, ' ', 1270 pProperties->bMPEG4resynchMarker ? "true" : "false"); 1271 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES", 1272 "%*c AudioStreamType: %s", indentation, ' ', 1273 videoEditJava_getAudioFormatString(pProperties->AudioStreamType)); 1274 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES", 1275 "%*c uiClipAudioDuration: %u", indentation, ' ', 1276 (unsigned int)pProperties->uiClipAudioDuration); 1277 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES", 1278 "%*c uiAudioBitrate: %s", indentation, ' ', 1279 videoEditJava_getBitrateString(pProperties->uiAudioBitrate)); 1280 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES", 1281 "%*c uiAudioMaxAuSize: %u", indentation, ' ', 1282 (unsigned int)pProperties->uiAudioMaxAuSize); 1283 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES", 1284 "%*c uiNbChannels: %u", indentation, ' ', 1285 (unsigned int)pProperties->uiNbChannels); 1286 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES", 1287 "%*c uiSamplingFrequency: %u", indentation, ' ', 1288 (unsigned int)pProperties->uiSamplingFrequency); 1289 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES", 1290 "%*c uiExtendedSamplingFrequency: %u", indentation, ' ', 1291 (unsigned int)pProperties->uiExtendedSamplingFrequency); 1292 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES", 1293 "%*c uiDecodedPcmSize: %u", indentation, ' ', 1294 (unsigned int)pProperties->uiDecodedPcmSize); 1295 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES", 1296 "%*c bVideoIsEditable: %s", indentation, ' ', 1297 pProperties->bVideoIsEditable ? "true" : "false"); 1298 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES", 1299 "%*c bAudioIsEditable: %s", indentation, ' ', 1300 pProperties->bAudioIsEditable ? "true" : "false"); 1301 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES", 1302 "%*c bVideoIsCompatibleWithMasterClip: %s", indentation, ' ', 1303 pProperties->bVideoIsCompatibleWithMasterClip ? "true" : "false"); 1304 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES", 1305 "%*c bAudioIsCompatibleWithMasterClip: %s", indentation, ' ', 1306 pProperties->bAudioIsCompatibleWithMasterClip ? "true" : "false"); 1307 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES", 1308 "%*c uiClipAudioVolumePercentage: %d", indentation, ' ', 1309 pProperties->uiClipAudioVolumePercentage); 1310 } 1311 else 1312 { 1313 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES", "%*c <null>", 1314 indentation, ' '); 1315 } 1316} 1317#endif 1318 1319void 1320videoEditClasses_getClipSettings( 1321 bool* pResult, 1322 JNIEnv* pEnv, 1323 jobject object, 1324 M4VSS3GPP_ClipSettings** ppSettings) 1325{ 1326 1327 VideoEditJava_ClipSettingsFieldIds fieldIds; 1328 M4VSS3GPP_ClipSettings* pSettings = M4OSA_NULL; 1329 M4OSA_ERR result = M4NO_ERROR; 1330 bool converted = true; 1331 memset(&fieldIds, 0, sizeof(VideoEditJava_ClipSettingsFieldIds)); 1332 // Check if the previous action succeeded. 1333 if (*pResult) 1334 { 1335 // Log the function call. 1336 VIDEOEDIT_LOG_FUNCTION(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES", 1337 "videoEditClasses_getClipSettings()"); 1338 1339 // Retrieve the field ids. 1340 videoEditJava_getClipSettingsFieldIds(pResult, pEnv, &fieldIds); 1341 } 1342 1343 // Only validate the ClipSettings if the fields could be located. 1344 if (*pResult) 1345 { 1346 // Check if the clip is set. 1347 videoEditJava_checkAndThrowIllegalArgumentException(pResult, pEnv, 1348 (NULL == object), 1349 "clip is null"); 1350 } 1351 1352 // Only retrieve the ClipSettings if the fields could be located and validated. 1353 if (*pResult) 1354 { 1355 // Allocate memory for the ClipSettings. 1356 pSettings = (M4VSS3GPP_ClipSettings *)videoEditOsal_alloc(pResult, pEnv, 1357 sizeof(M4VSS3GPP_ClipSettings), "ClipSettings"); 1358 1359 // Check if memory could be allocated for the ClipSettings. 1360 if (*pResult) 1361 { 1362 // Log the API call. 1363 VIDEOEDIT_LOG_API(ANDROID_LOG_INFO, "VIDEO_EDITOR", "M4xVSS_CreateClipSettings()"); 1364 1365 // Initialize the ClipSettings. 1366 result = M4xVSS_CreateClipSettings(pSettings, NULL, 0, 0); 1367 1368 // Log the result. 1369 VIDEOEDIT_LOG_RESULT(ANDROID_LOG_INFO, "VIDEO_EDITOR", 1370 videoEditOsal_getResultString(result)); 1371 1372 // Check if the initialization succeeded. 1373 videoEditJava_checkAndThrowRuntimeException(pResult, pEnv, 1374 (M4NO_ERROR != result), result); 1375 } 1376 1377 // Check if the allocation and initialization succeeded 1378 //(required because pSettings is dereferenced). 1379 if (*pResult) 1380 { 1381 // Set the input file path. 1382 pSettings->pFile = (M4OSA_Char*)videoEditJava_getString(pResult, pEnv, object, 1383 fieldIds.clipPath, &pSettings->filePathSize); 1384 1385 // Check if the file path is valid. 1386 videoEditJava_checkAndThrowIllegalArgumentException(pResult, pEnv, 1387 (M4OSA_NULL == pSettings->pFile), "clip.clipPath is null"); 1388 } 1389 1390 // Check if the input file could be retrieved. 1391 if (*pResult) 1392 { 1393 // Set the file type .3gp, .amr, .mp3. 1394 pSettings->FileType = (M4VIDEOEDITING_FileType)videoEditJava_getClipTypeJavaToC( 1395 &converted, pEnv->GetIntField(object, fieldIds.fileType)); 1396 1397 if ( pSettings->FileType == M4VIDEOEDITING_kFileType_JPG) 1398 { 1399 pSettings->FileType = M4VIDEOEDITING_kFileType_ARGB8888; 1400 } 1401 1402 // Check if the file type is valid. 1403 videoEditJava_checkAndThrowIllegalArgumentException(pResult, pEnv, 1404 !converted, "clip.fileType is invalid"); 1405 } 1406 1407 // Check if the file type could be retrieved. 1408 if (*pResult) 1409 { 1410 // Set the begin cut time, in milliseconds. 1411 pSettings->uiBeginCutTime = 1412 (M4OSA_UInt32)pEnv->GetIntField(object, fieldIds.beginCutTime); 1413 1414 // Set the end cut time, in milliseconds. 1415 pSettings->uiEndCutTime = (M4OSA_UInt32)pEnv->GetIntField(object, fieldIds.endCutTime); 1416 1417 // Set the begin cut time, in percent of clip duration (only for 3GPP clip !). 1418 pSettings->xVSS.uiBeginCutPercent = 1419 (M4OSA_UInt32)pEnv->GetIntField(object, fieldIds.beginCutPercent); 1420 1421 // Set the end cut time, in percent of clip duration (only for 3GPP clip !). 1422 pSettings->xVSS.uiEndCutPercent = 1423 (M4OSA_UInt32)pEnv->GetIntField(object, fieldIds.endCutPercent); 1424 1425 // Set the duration of the clip, if different from 0, 1426 // has priority on uiEndCutTime or uiEndCutPercent. 1427 pSettings->xVSS.uiDuration = 0; 1428 1429 // Set whether or not the pan and zoom mode is enabled. 1430 pSettings->xVSS.isPanZoom = 1431 (M4OSA_Bool)pEnv->GetBooleanField(object, fieldIds.panZoomEnabled); 1432 1433 // Set the pan and zoom start zoom percentage. 1434 pSettings->xVSS.PanZoomXa = 1435 (M4OSA_UInt16)pEnv->GetIntField(object, fieldIds.panZoomPercentStart); 1436 1437 // Set the pan and zoom start x. 1438 pSettings->xVSS.PanZoomTopleftXa = 1439 (M4OSA_UInt16)pEnv->GetIntField(object, fieldIds.panZoomTopLeftXStart); 1440 1441 // Set the pan and zoom start y. 1442 pSettings->xVSS.PanZoomTopleftYa = 1443 (M4OSA_UInt16)pEnv->GetIntField(object, fieldIds.panZoomTopLeftYStart); 1444 1445 // Set the pan and zoom end zoom percentage. 1446 pSettings->xVSS.PanZoomXb = 1447 (M4OSA_UInt16)pEnv->GetIntField(object, fieldIds.panZoomPercentEnd); 1448 1449 // Set the pan and zoom end x. 1450 pSettings->xVSS.PanZoomTopleftXb = 1451 (M4OSA_UInt16)pEnv->GetIntField(object, fieldIds.panZoomTopLeftXEnd); 1452 1453 // Set the pan and zoom end y. 1454 pSettings->xVSS.PanZoomTopleftYb = 1455 (M4OSA_UInt16)pEnv->GetIntField(object, fieldIds.panZoomTopLeftYEnd); 1456 1457 // Set the media rendering mode, only used with JPEG to crop, resize, 1458 // or render black borders. 1459 pSettings->xVSS.MediaRendering = 1460 (M4xVSS_MediaRendering)videoEditJava_getMediaRenderingJavaToC( 1461 &converted, pEnv->GetIntField(object,fieldIds.mediaRendering)); 1462 1463 // Check if the media rendering is valid. 1464 videoEditJava_checkAndThrowIllegalArgumentException(pResult, pEnv, !converted, 1465 "clip.mediaRendering is invalid"); 1466 1467 // Capture the rgb file width and height 1468 pSettings->ClipProperties.uiStillPicWidth = 1469 (M4OSA_UInt16)pEnv->GetIntField(object, fieldIds.rgbFileWidth); 1470 pSettings->ClipProperties.uiStillPicHeight = 1471 (M4OSA_UInt16)pEnv->GetIntField(object, fieldIds.rgbFileHeight); 1472 1473 VIDEOEDIT_LOG_FUNCTION(ANDROID_LOG_INFO, "VIDEO_EDITOR", \ 1474 "getClipSettings-- rgbFileWidth %d ", 1475 pSettings->ClipProperties.uiStillPicWidth); 1476 VIDEOEDIT_LOG_FUNCTION(ANDROID_LOG_INFO, "VIDEO_EDITOR", \ 1477 "getClipSettings-- rgbFileHeight %d ", 1478 pSettings->ClipProperties.uiStillPicHeight); 1479 } 1480 1481 // Check if settings could be set. 1482 if (*pResult) 1483 { 1484 // Return the settings. 1485 (*ppSettings) = pSettings; 1486 } 1487 else 1488 { 1489 // Free the settings. 1490 videoEditClasses_freeClipSettings(&pSettings); 1491 } 1492 } 1493} 1494 1495void 1496videoEditClasses_createClipSettings( 1497 bool* pResult, 1498 JNIEnv* pEnv, 1499 M4VSS3GPP_ClipSettings* pSettings, 1500 jobject* pObject) 1501{ 1502 VideoEditJava_ClipSettingsFieldIds fieldIds; 1503 jclass clazz = NULL; 1504 jobject object = NULL; 1505 memset(&fieldIds, 0, sizeof(VideoEditJava_ClipSettingsFieldIds)); 1506 1507 // Check if the previous action succeeded. 1508 if (*pResult) 1509 { 1510 // Log the function call. 1511 VIDEOEDIT_LOG_FUNCTION(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES", 1512 "videoEditClasses_createClipSettings()"); 1513 1514 // Retrieve the class. 1515 videoEditJava_getClipSettingsClass(pResult, pEnv, &clazz); 1516 1517 // Retrieve the field ids. 1518 videoEditJava_getClipSettingsFieldIds(pResult, pEnv, &fieldIds); 1519 } 1520 1521 // Only create an object if the class and fields could be located. 1522 if (*pResult) 1523 { 1524 // Allocate a new object. 1525 object = pEnv->AllocObject(clazz); 1526 if (NULL != object) 1527 { 1528 // Set the clipPath field. 1529 pEnv->SetObjectField(object, fieldIds.clipPath, NULL); 1530 1531 // Set the fileType field. 1532 pEnv->SetIntField(object, fieldIds.fileType, videoEditJava_getClipTypeCToJava( 1533 pSettings->FileType)); 1534 1535 // Set the beginCutTime field. 1536 pEnv->SetIntField(object, fieldIds.beginCutTime, pSettings->uiBeginCutTime); 1537 1538 // Set the endCutTime field. 1539 pEnv->SetIntField(object, fieldIds.endCutTime, pSettings->uiEndCutTime); 1540 1541 // Set the beginCutPercent field. 1542 pEnv->SetIntField(object, fieldIds.beginCutPercent, pSettings->xVSS.uiBeginCutPercent); 1543 1544 // Set the endCutPercent field. 1545 pEnv->SetIntField(object, fieldIds.endCutPercent, pSettings->xVSS.uiEndCutPercent); 1546 1547 // Set the panZoomEnabled field. 1548 pEnv->SetBooleanField(object, fieldIds.panZoomEnabled, pSettings->xVSS.isPanZoom); 1549 1550 // Set the panZoomPercentStart field. 1551 pEnv->SetIntField(object, fieldIds.panZoomPercentStart, 1552 (1000 - pSettings->xVSS.PanZoomXa)); 1553 1554 // Set the panZoomTopLeftXStart field. 1555 pEnv->SetIntField(object, fieldIds.panZoomTopLeftXStart, 1556 pSettings->xVSS.PanZoomTopleftXa); 1557 1558 // Set the panZoomTopLeftYStart field. 1559 pEnv->SetIntField(object, fieldIds.panZoomTopLeftYStart, 1560 pSettings->xVSS.PanZoomTopleftYa); 1561 1562 // Set the panZoomPercentEnd field. 1563 pEnv->SetIntField(object, fieldIds.panZoomPercentEnd, 1564 (1000 - pSettings->xVSS.PanZoomXb)); 1565 1566 // Set the panZoomTopLeftXEnd field. 1567 pEnv->SetIntField(object, fieldIds.panZoomTopLeftXEnd, 1568 pSettings->xVSS.PanZoomTopleftXb); 1569 1570 // Set the panZoomTopLeftYEnd field. 1571 pEnv->SetIntField(object, fieldIds.panZoomTopLeftYEnd, 1572 pSettings->xVSS.PanZoomTopleftYb); 1573 1574 // Set the mediaRendering field. 1575 pEnv->SetIntField(object, fieldIds.mediaRendering, 1576 videoEditJava_getMediaRenderingCToJava(pSettings->xVSS.MediaRendering)); 1577 1578 // Set the rgb file width and height 1579 pEnv->SetIntField(object, fieldIds.rgbFileWidth, 1580 pSettings->ClipProperties.uiStillPicWidth ); 1581 1582 pEnv->SetIntField(object, fieldIds.rgbFileHeight, 1583 pSettings->ClipProperties.uiStillPicHeight ); 1584 1585 VIDEOEDIT_LOG_FUNCTION(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES", 1586 "rgbFileWeight %d rgbFileHeight %d ", 1587 pSettings->ClipProperties.uiStillPicWidth , 1588 pSettings->ClipProperties.uiStillPicHeight); 1589 1590 // Return the object. 1591 (*pObject) = object; 1592 } 1593 } 1594} 1595void 1596videoEditPropClass_createProperties( 1597 bool* pResult, 1598 JNIEnv* pEnv, 1599 VideoEditPropClass_Properties* pProperties, 1600 jobject* pObject) 1601{ 1602 VideoEditJava_PropertiesFieldIds fieldIds; 1603 jclass clazz = NULL; 1604 jobject object = NULL; 1605 memset(&fieldIds, 0, sizeof(VideoEditJava_PropertiesFieldIds)); 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; 1785 jobjectArray clipSettingsArray = NULL; 1786 jsize clipSettingsArraySize = 0; 1787 jobject clipSettings = NULL; 1788 jobjectArray transitionSettingsArray = NULL; 1789 jsize transitionSettingsArraySize = 0; 1790 jobject transitionSettings = NULL; 1791 jobjectArray effectSettingsArray = NULL; 1792 jsize effectSettingsArraySize = 0; 1793 jobject effectSettings = NULL; 1794 jobject backgroundMusicSettings = NULL; 1795 int audioChannels = 0; 1796 M4VSS3GPP_EditSettings* pSettings = M4OSA_NULL; 1797 bool converted = true; 1798 memset(&fieldIds, 0, sizeof(VideoEditJava_EditSettingsFieldIds)); 1799 // Check if the previous action succeeded. 1800 if (*pResult) 1801 { 1802 // Log the function call. 1803 VIDEOEDIT_LOG_FUNCTION(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES", 1804 "videoEditClasses_getEditSettings()"); 1805 1806 // Retrieve the field ids. 1807 videoEditJava_getEditSettingsFieldIds(pResult, pEnv, &fieldIds); 1808 } 1809 1810 // Only retrieve the EditSettings if the previous action succeeded. 1811 if (*pResult) 1812 { 1813 // Check if the object is valid. 1814 if (NULL != object) 1815 { 1816 // Retrieve the clipSettingsArray. 1817 videoEditJava_getArray(pResult, pEnv, object, 1818 fieldIds.clipSettingsArray, 1819 &clipSettingsArray, 1820 &clipSettingsArraySize); 1821 1822 // Retrieve the transitionSettingsArray. 1823 videoEditJava_getArray(pResult, pEnv, object, 1824 fieldIds.transitionSettingsArray, 1825 &transitionSettingsArray, 1826 &transitionSettingsArraySize); 1827 1828 // Retrieve the effectSettingsArray. 1829 videoEditJava_getArray(pResult, pEnv, object, 1830 fieldIds.effectSettingsArray, 1831 &effectSettingsArray, 1832 &effectSettingsArraySize); 1833 1834 // Retrieve the backgroundMusicSettings. 1835 videoEditJava_getObject(pResult, pEnv, object, fieldIds.backgroundMusicSettings, 1836 &backgroundMusicSettings); 1837 1838 // Check if the arrays and background music settings object could be retrieved. 1839 if (*pResult) 1840 { 1841 // Retrieve the number of channels. 1842 audioChannels = pEnv->GetIntField(object, fieldIds.audioChannels); 1843 } 1844 } 1845 } 1846 1847 // Only validate the EditSettings if the fields could be located. 1848 if (*pResult) 1849 { 1850 // Check if there is at least one clip. 1851 //videoEditJava_checkAndThrowIllegalArgumentException(pResult, pEnv, 1852 // (clipSettingsArraySize < 1), 1853 // "there should be at least one clip"); 1854 if(clipSettingsArraySize < 1) { 1855 return; 1856 } 1857 if(flag) 1858 { 1859 // Check if there are clips. 1860 if ((clipSettingsArraySize != 0) || (transitionSettingsArraySize != 0)) 1861 { 1862 // The number of transitions must be equal to the number of clips - 1. 1863 videoEditJava_checkAndThrowIllegalArgumentException(pResult, pEnv, 1864 (clipSettingsArraySize != (transitionSettingsArraySize + 1)), 1865 "the number of transitions should be equal to the number of clips - 1"); 1866 } 1867 } 1868 } 1869 1870 // Only retrieve the EditSettings if the fields could be located. 1871 if (*pResult) 1872 { 1873 // Check if the object is valid. 1874 if (NULL != object) 1875 { 1876 // Allocate memory for the EditSettings. 1877 pSettings = (M4VSS3GPP_EditSettings*)videoEditOsal_alloc(pResult, pEnv, 1878 sizeof(M4VSS3GPP_EditSettings), "EditSettings"); 1879 1880 // Check if memory could be allocated for the EditSettings. 1881 if (*pResult) 1882 { 1883 // Set the number of clips that will be edited. 1884 pSettings->uiClipNumber = clipSettingsArraySize; 1885 1886 // Check if the clip settings array contains items. 1887 if (clipSettingsArraySize > 0) 1888 { 1889 // Allocate memory for the clip settings array. 1890 pSettings->pClipList = (M4VSS3GPP_ClipSettings **)videoEditOsal_alloc(pResult, 1891 pEnv, 1892 clipSettingsArraySize * sizeof(M4VSS3GPP_ClipSettings *), 1893 "ClipSettingsArray"); 1894 if (*pResult) 1895 { 1896 // Loop over all clip settings objects. 1897 for (int i = 0; ((*pResult) && (i < clipSettingsArraySize)); i++) 1898 { 1899 // Get the clip settings object. 1900 clipSettings = pEnv->GetObjectArrayElement(clipSettingsArray, i); 1901 1902 // Get the clip settings. 1903 videoEditClasses_getClipSettings(pResult, pEnv, clipSettings, 1904 &pSettings->pClipList[i]); 1905 } 1906 } 1907 } 1908 1909 // Check if the transition settings array contains items. 1910 if (transitionSettingsArraySize > 0) 1911 { 1912 // Allocate memory for the transition settings array. 1913 pSettings->pTransitionList = 1914 (M4VSS3GPP_TransitionSettings **)videoEditOsal_alloc(pResult, 1915 pEnv, transitionSettingsArraySize * sizeof(M4VSS3GPP_TransitionSettings *), 1916 "TransitionSettingsArray"); 1917 if (*pResult) 1918 { 1919 // Loop over all transition settings objects. 1920 for (int i = 0; ((*pResult) && (i < transitionSettingsArraySize)); i++) 1921 { 1922 // Get the transition settings object. 1923 transitionSettings = 1924 pEnv->GetObjectArrayElement(transitionSettingsArray, i); 1925 1926 // Get the transition settings. 1927 videoEditClasses_getTransitionSettings(pResult, pEnv, 1928 transitionSettings, &pSettings->pTransitionList[i]); 1929 } 1930 } 1931 } 1932 1933 // Check if the effect settings array contains items. 1934 if (effectSettingsArraySize > 0) 1935 { 1936 // Allocate memory for the effect settings array. 1937 pSettings->Effects = (M4VSS3GPP_EffectSettings*)videoEditOsal_alloc(pResult, 1938 pEnv, 1939 effectSettingsArraySize * sizeof(M4VSS3GPP_EffectSettings), 1940 "EffectSettingsArray"); 1941 if (*pResult) 1942 { 1943 // Loop over all effect settings objects. 1944 for (int i = 0; ((*pResult) && (i < effectSettingsArraySize)); i++) 1945 { 1946 // Get the effect settings object. 1947 effectSettings = pEnv->GetObjectArrayElement(effectSettingsArray, i); 1948 1949 // Get the effect settings. 1950 videoEditClasses_getEffectSettings(pResult, pEnv, effectSettings, 1951 &pSettings->Effects[i]); 1952 } 1953 } 1954 } 1955 1956 // Check if the clips, transitions and effects could be set. 1957 if (*pResult) 1958 { 1959 // Set the number of effects in the clip. 1960 pSettings->nbEffects = (M4OSA_UInt8)effectSettingsArraySize; 1961 1962 // Set the frame rate of the output video. 1963 pSettings->videoFrameRate = 1964 (M4VIDEOEDITING_VideoFramerate)videoEditJava_getVideoFrameRateJavaToC( 1965 &converted, pEnv->GetIntField(object, fieldIds.videoFrameRate)); 1966 1967 // Check if the frame rate is valid. 1968 videoEditJava_checkAndThrowIllegalArgumentException(pResult, pEnv, 1969 !converted, "editSettings.videoFrameRate is invalid"); 1970 } 1971 1972 // Check if the frame rate could be set. 1973 if (*pResult) 1974 { 1975 // Set the path of the output file. 1976 pSettings->pOutputFile = (M4OSA_Char*)videoEditJava_getString(pResult, pEnv, 1977 object, fieldIds.outputFile, &pSettings->uiOutputPathSize); 1978 } 1979 1980 // Check if path of the output file could be set. 1981 if (*pResult) 1982 { 1983 // Set the path of the temporary file produced when using 1984 // the constant memory 3gp writer. 1985 pSettings->pTemporaryFile = M4OSA_NULL; 1986 1987 // Set the output video size. 1988 pSettings->xVSS.outputVideoSize = 1989 (M4VIDEOEDITING_VideoFrameSize)videoEditJava_getVideoFrameSizeJavaToC( 1990 &converted, pEnv->GetIntField(object, fieldIds.videoFrameSize)); 1991 1992 // Check if the output video size is valid. 1993 videoEditJava_checkAndThrowIllegalArgumentException(pResult, pEnv, 1994 !converted, "editSettings.videoFrameSize is invalid"); 1995 } 1996 1997 // Check if the output video size could be set. 1998 if (*pResult) 1999 { 2000 // Set the output video format. 2001 pSettings->xVSS.outputVideoFormat = 2002 (M4VIDEOEDITING_VideoFormat)videoEditJava_getVideoFormatJavaToC( 2003 &converted, pEnv->GetIntField(object, fieldIds.videoFormat)); 2004 2005 // Check if the output video format is valid. 2006 videoEditJava_checkAndThrowIllegalArgumentException(pResult, pEnv, 2007 !converted, "editSettings.videoFormat is invalid"); 2008 } 2009 2010 // Check if the output video format could be set. 2011 if (*pResult) 2012 { 2013 // Set the output audio format. 2014 pSettings->xVSS.outputAudioFormat = 2015 (M4VIDEOEDITING_AudioFormat)videoEditJava_getAudioFormatJavaToC( 2016 &converted, pEnv->GetIntField(object, fieldIds.audioFormat)); 2017 2018 // Check if the output audio format is valid. 2019 videoEditJava_checkAndThrowIllegalArgumentException(pResult, pEnv, 2020 !converted, "editSettings.audioFormat is invalid"); 2021 } 2022 2023 // Check if the output audio format could be set. 2024 if (*pResult) 2025 { 2026 // Set the output audio sampling frequency when not replacing the audio, 2027 // or replacing it with MP3 audio. 2028 pSettings->xVSS.outputAudioSamplFreq = 2029 (M4VIDEOEDITING_AudioSamplingFrequency)\ 2030 videoEditJava_getAudioSamplingFrequencyJavaToC( 2031 &converted, pEnv->GetIntField(object, fieldIds.audioSamplingFreq)); 2032 2033 // Check if the output audio sampling frequency is valid. 2034 videoEditJava_checkAndThrowIllegalArgumentException(pResult, pEnv, 2035 !converted, "editSettings.audioSamplingFreq is invalid"); 2036 } 2037 2038 // Check if the output audio sampling frequency could be set. 2039 if (*pResult) 2040 { 2041 // Check if the number of audio channels is valid. 2042 videoEditJava_checkAndThrowIllegalArgumentException(pResult, pEnv, 2043 ((0 != audioChannels ) || 2044 ((M4VIDEOEDITING_kNoneAudio != pSettings->xVSS.outputAudioFormat) && 2045 (M4VIDEOEDITING_kNullAudio != pSettings->xVSS.outputAudioFormat) ) ) && 2046 (1 != audioChannels ) && 2047 (2 != audioChannels ), 2048 "editSettings.audioChannels must be set to 0, 1 or 2"); 2049 } 2050 2051 // Check if the number of audio channels is valid. 2052 if (*pResult) 2053 { 2054 // Set the maximum output file size (MMS usecase). 2055 pSettings->xVSS.outputFileSize = (M4OSA_UInt32)pEnv->GetIntField(object, 2056 fieldIds.maxFileSize); 2057 2058 // Whether or not the audio is mono, only valid for AAC. 2059 pSettings->xVSS.bAudioMono = (M4OSA_Bool)(1 == audioChannels); 2060 2061 // Set the output video bitrate. 2062 pSettings->xVSS.outputVideoBitrate = (M4OSA_UInt32)pEnv->GetIntField(object, 2063 fieldIds.videoBitrate); 2064 2065 // Set the output audio bitrate. 2066 pSettings->xVSS.outputAudioBitrate = (M4OSA_UInt32)pEnv->GetIntField(object, 2067 fieldIds.audioBitrate); 2068 2069 // Set the background music settings. 2070 videoEditClasses_getBackgroundMusicSettings(pResult, pEnv, 2071 backgroundMusicSettings, &pSettings->xVSS.pBGMtrack); 2072 2073 // Set the text rendering function (will be set elsewhere). 2074 pSettings->xVSS.pTextRenderingFct = M4OSA_NULL; 2075 pSettings->PTVolLevel = 2076 (M4OSA_Float)pEnv->GetIntField(object, fieldIds.primaryTrackVolume); 2077 } 2078 } 2079 2080 // Check if settings could be set. 2081 if (*pResult) 2082 { 2083 // Return the settings. 2084 (*ppSettings) = pSettings; 2085 } 2086 else 2087 { 2088 // Free the settings. 2089 videoEditClasses_freeEditSettings(&pSettings); 2090 } 2091 } 2092 } 2093} 2094 2095void 2096videoEditClasses_freeEditSettings( 2097 M4VSS3GPP_EditSettings** ppSettings) 2098{ 2099 // Check if memory was allocated for the EditSettings. 2100 if (M4OSA_NULL != (*ppSettings)) 2101 { 2102 // Log the function call. 2103 VIDEOEDIT_LOG_FUNCTION(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES", 2104 "videoEditClasses_freeEditSettings()"); 2105 2106 // Free the background music settings. 2107 videoEditClasses_freeBackgroundMusicSettings(&(*ppSettings)->xVSS.pBGMtrack); 2108 2109 // Free the path of the output file. 2110 videoEditOsal_free((*ppSettings)->pOutputFile); 2111 (*ppSettings)->pOutputFile = M4OSA_NULL; 2112 (*ppSettings)->uiOutputPathSize = 0; 2113 2114 // Check if the EffectSettings should be freed. 2115 if (M4OSA_NULL != (*ppSettings)->Effects) 2116 { 2117 // Loop over all effect settings. 2118 for (int i = 0; i < (*ppSettings)->nbEffects; i++) 2119 { 2120 // Free the effect settings. 2121 videoEditClasses_freeEffectSettings(&(*ppSettings)->Effects[i]); 2122 } 2123 2124 // Free the memory for the effect settings array. 2125 videoEditOsal_free((*ppSettings)->Effects); 2126 (*ppSettings)->Effects = M4OSA_NULL; 2127 } 2128 2129 // Reset the number of effects in the clip. 2130 (*ppSettings)->nbEffects = 0; 2131 2132 // Check if there are clips. 2133 if (0 < (*ppSettings)->uiClipNumber) 2134 { 2135 // Check if the TransitionSettings should be freed. 2136 if (M4OSA_NULL != (*ppSettings)->pTransitionList) 2137 { 2138 // Loop over all transition settings. 2139 for (int i = 0; i < ((*ppSettings)->uiClipNumber - 1); i++) 2140 { 2141 // Free the transition settings. 2142 videoEditClasses_freeTransitionSettings(&(*ppSettings)->pTransitionList[i]); 2143 } 2144 2145 // Free the memory for the transition settings array. 2146 videoEditOsal_free((*ppSettings)->pTransitionList); 2147 (*ppSettings)->pTransitionList = M4OSA_NULL; 2148 } 2149 2150 // Check if the ClipSettings should be freed. 2151 if (M4OSA_NULL != (*ppSettings)->pClipList) 2152 { 2153 // Loop over all clip settings. 2154 for (int i = 0; i < (*ppSettings)->uiClipNumber; i++) 2155 { 2156 // Free the clip settings. 2157 videoEditClasses_freeClipSettings(&(*ppSettings)->pClipList[i]); 2158 } 2159 2160 // Free the memory for the clip settings array. 2161 videoEditOsal_free((*ppSettings)->pClipList); 2162 (*ppSettings)->pClipList = M4OSA_NULL; 2163 } 2164 } 2165 2166 // Reset the number of clips. 2167 (*ppSettings)->uiClipNumber = 0; 2168 2169 // Free the settings structure. 2170 videoEditOsal_free((*ppSettings)); 2171 (*ppSettings) = M4OSA_NULL; 2172 } 2173} 2174 2175#ifdef VIDEOEDIT_LOGGING_ENABLED 2176void 2177videoEditClasses_logEditSettings( 2178 M4VSS3GPP_EditSettings* pSettings, 2179 int indentation) 2180{ 2181 // Check if memory was allocated for the EditSettings. 2182 if (M4OSA_NULL != pSettings) 2183 { 2184 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES", 2185 "%*c uiClipNumber: %d", indentation, ' ', 2186 pSettings->uiClipNumber); 2187 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES", 2188 "%*c uiMasterClip: %d", indentation, ' ', 2189 pSettings->uiMasterClip); 2190 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES", 2191 "%*c pClipList: %s", indentation, ' ', 2192 (M4OSA_NULL != pSettings->pClipList) ? " " : "<null>"); 2193 if (M4OSA_NULL != pSettings->pClipList) 2194 { 2195 indentation += VIDEOEDIT_LOG_INDENTATION; 2196 for (int i = 0; i < pSettings->uiClipNumber; i++) 2197 { 2198 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES", 2199 "%*c pClipList[%d]:", indentation, ' ', 2200 i); 2201 videoEditClasses_logClipSettings(pSettings->pClipList[i], 2202 indentation + VIDEOEDIT_LOG_INDENTATION); 2203 } 2204 indentation -= VIDEOEDIT_LOG_INDENTATION; 2205 } 2206 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES", 2207 "%*c pTransitionList: %s", indentation, ' ', 2208 (M4OSA_NULL != pSettings->pTransitionList) ? " " : "<null>"); 2209 if (M4OSA_NULL != pSettings->pTransitionList) 2210 { 2211 indentation += VIDEOEDIT_LOG_INDENTATION; 2212 for (int i = 0; i < (pSettings->uiClipNumber - 1); i++) 2213 { 2214 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES", 2215 "%*c pTransitionList[%d]:", indentation, ' ', i); 2216 videoEditClasses_logTransitionSettings(pSettings->pTransitionList[i], 2217 indentation + VIDEOEDIT_LOG_INDENTATION); 2218 } 2219 indentation -= VIDEOEDIT_LOG_INDENTATION; 2220 } 2221 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES", 2222 "%*c Effects: %s", indentation, ' ', 2223 (M4OSA_NULL != pSettings->Effects) ? " " : "<null>"); 2224 if (M4OSA_NULL != pSettings->Effects) 2225 { 2226 indentation += VIDEOEDIT_LOG_INDENTATION; 2227 for (int i = 0; i < pSettings->nbEffects; i++) 2228 { 2229 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES", 2230 "%*c Effects[%d]:", indentation, ' ', i); 2231 videoEditClasses_logEffectSettings(&pSettings->Effects[i], 2232 indentation + VIDEOEDIT_LOG_INDENTATION); 2233 } 2234 indentation -= VIDEOEDIT_LOG_INDENTATION; 2235 } 2236 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES", 2237 "%*c nbEffects: %d", indentation, ' ', 2238 pSettings->nbEffects); 2239 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES", 2240 "%*c videoFrameRate: %s", indentation, ' ', 2241 videoEditJava_getVideoFrameRateString(pSettings->videoFrameRate)); 2242 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES", 2243 "%*c pOutputFile: %s", indentation, ' ', 2244 (M4OSA_NULL != pSettings->pOutputFile) ? (char*)pSettings->pOutputFile : "<null>"); 2245 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES", 2246 "%*c uiOutputPathSize: %u", indentation, ' ', 2247 (unsigned int)pSettings->uiOutputPathSize); 2248 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES", 2249 "%*c pTemporaryFile: %s", indentation, ' ', 2250 (M4OSA_NULL != pSettings->pTemporaryFile) ?\ 2251 (char*)pSettings->pTemporaryFile : "<null>"); 2252 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES", 2253 "%*c outputVideoSize: %s", indentation, ' ', 2254 videoEditJava_getVideoFrameSizeString(pSettings->xVSS.outputVideoSize)); 2255 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES", 2256 "%*c outputVideoFormat: %s", indentation, ' ', 2257 videoEditJava_getVideoFormatString(pSettings->xVSS.outputVideoFormat)); 2258 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES", 2259 "%*c outputAudioFormat: %s", indentation, ' ', 2260 videoEditJava_getAudioFormatString(pSettings->xVSS.outputAudioFormat)); 2261 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES", 2262 "%*c outputAudioSamplFreq: %s", indentation, ' ', 2263 videoEditJava_getAudioSamplingFrequencyString(pSettings->xVSS.outputAudioSamplFreq)); 2264 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES", 2265 "%*c outputFileSize: %u", indentation, ' ', 2266 (unsigned int)pSettings->xVSS.outputFileSize); 2267 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES", 2268 "%*c bAudioMono: %s", indentation, ' ', 2269 pSettings->xVSS.bAudioMono ? "true" : "false"); 2270 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES", 2271 "%*c outputVideoBitrate: %s", indentation, ' ', 2272 videoEditJava_getBitrateString(pSettings->xVSS.outputVideoBitrate)); 2273 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES", 2274 "%*c outputAudioBitrate: %s", indentation, ' ', 2275 videoEditJava_getBitrateString(pSettings->xVSS.outputAudioBitrate)); 2276 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES", 2277 "%*c pBGMtrack:", indentation, ' '); 2278 videoEditClasses_logBackgroundMusicSettings(pSettings->xVSS.pBGMtrack, 2279 indentation + VIDEOEDIT_LOG_INDENTATION); 2280 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES", 2281 "%*c pTextRenderingFct: %s", indentation, ' ', 2282 (M4OSA_NULL != pSettings->xVSS.pTextRenderingFct) ? "set" : "<null>"); 2283 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES", 2284 "%*c PTVolLevel: %u", indentation, ' ', 2285 (unsigned int)pSettings->PTVolLevel); 2286 } 2287 else 2288 { 2289 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES", 2290 "%*c <null>", indentation, ' '); 2291 } 2292} 2293#endif 2294 2295 2296void 2297videoEditClasses_getEffectSettings( 2298 bool* pResult, 2299 JNIEnv* pEnv, 2300 jobject object, 2301 M4VSS3GPP_EffectSettings* pSettings) 2302{ 2303 2304 VideoEditJava_EffectSettingsFieldIds fieldIds; 2305 bool converted = true; 2306 memset(&fieldIds, 0, sizeof(VideoEditJava_EffectSettingsFieldIds)); 2307 2308 // Check if the previous action succeeded. 2309 if (*pResult) 2310 { 2311 // Log the function call. 2312 VIDEOEDIT_LOG_FUNCTION(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES", 2313 "videoEditClasses_getEffectSettings()"); 2314 2315 // Retrieve the field ids. 2316 videoEditJava_getEffectSettingsFieldIds(pResult, pEnv, &fieldIds); 2317 } 2318 2319 // Only validate the EffectSettings if the fields could be located. 2320 if (*pResult) 2321 { 2322 // Check if the effect is set. 2323 videoEditJava_checkAndThrowIllegalArgumentException(pResult, pEnv, 2324 (NULL == object), 2325 "effect is null"); 2326 } 2327 2328 // Only retrieve the EffectSettings if the fields could be located and validated. 2329 if (*pResult) 2330 { 2331 // Set the start time in milliseconds. 2332 pSettings->uiStartTime = (M4OSA_UInt32)pEnv->GetIntField(object, fieldIds.startTime); 2333 2334 // Set the duration in milliseconds. 2335 pSettings->uiDuration = (M4OSA_UInt32)pEnv->GetIntField(object, fieldIds.duration); 2336 2337 // Set the video effect type, None, FadeIn, FadeOut, etc. 2338 pSettings->VideoEffectType = 2339 (M4VSS3GPP_VideoEffectType)videoEditJava_getVideoEffectJavaToC( 2340 &converted, pEnv->GetIntField(object, fieldIds.videoEffectType)); 2341 2342 // Check if the video effect type is valid. 2343 videoEditJava_checkAndThrowIllegalArgumentException(pResult, pEnv, 2344 !converted, "effect.videoEffectType is invalid"); 2345 } 2346 2347 // Check if the video effect type could be set. 2348 if (*pResult) 2349 { 2350 // Set the external effect function. 2351 pSettings->ExtVideoEffectFct = M4OSA_NULL; 2352 2353 // Set the context given to the external effect function. 2354 pSettings->pExtVideoEffectFctCtxt = M4OSA_NULL; 2355 2356 // Set the audio effect type, None, FadeIn, FadeOut. 2357 pSettings->AudioEffectType = 2358 (M4VSS3GPP_AudioEffectType)videoEditJava_getAudioEffectJavaToC( 2359 &converted, pEnv->GetIntField(object, fieldIds.audioEffectType)); 2360 2361 // Check if the audio effect type is valid. 2362 videoEditJava_checkAndThrowIllegalArgumentException(pResult, pEnv, 2363 !converted, "effect.audioEffectType is invalid"); 2364 } 2365 2366 // Check if the audio effect type could be set. 2367 if (*pResult) 2368 { 2369 // Set the start in percentage of the cut clip duration. 2370 pSettings->xVSS.uiStartPercent = (M4OSA_UInt32)pEnv->GetIntField(object, 2371 fieldIds.startPercent); 2372 2373 // Set the duration in percentage of the ((clip duration) - (effect starttime)). 2374 pSettings->xVSS.uiDurationPercent = (M4OSA_UInt32)pEnv->GetIntField(object, 2375 fieldIds.durationPercent); 2376 2377 // Set the framing file path (GIF/PNG file). 2378 pSettings->xVSS.pFramingFilePath = (M4OSA_Char*)videoEditJava_getString(pResult, pEnv, 2379 object, fieldIds.framingFile, M4OSA_NULL); 2380 2381 // Check if this is a framing effect. 2382 if (M4xVSS_kVideoEffectType_Framing == (M4xVSS_VideoEffectType)pSettings->VideoEffectType) 2383 { 2384 // Check if the framing file path is valid. 2385 videoEditJava_checkAndThrowIllegalArgumentException(pResult, pEnv, 2386 (M4OSA_NULL == pSettings->xVSS.pFramingFilePath), "effect.framingFile is null"); 2387 } 2388 } 2389 2390 // Check if the framing file path could be retrieved. 2391 if (*pResult) 2392 { 2393 // Set the Framing RGB565 buffer. 2394 pSettings->xVSS.pFramingBuffer = M4OSA_NULL; 2395 2396 // Set the top-left X coordinate in the output picture 2397 // where the added frame will be displayed. 2398 pSettings->xVSS.topleft_x = (M4OSA_UInt32)pEnv->GetIntField(object, fieldIds.topLeftX); 2399 2400 // Set the top-left Y coordinate in the output picture 2401 // where the added frame will be displayed. 2402 pSettings->xVSS.topleft_y = (M4OSA_UInt32)pEnv->GetIntField(object, fieldIds.topLeftY); 2403 2404 // Set whether or not the framing image is resized to output video size. 2405 pSettings->xVSS.bResize = 2406 (M4OSA_Bool)pEnv->GetBooleanField(object, fieldIds.framingResize); 2407 2408 // Set the new size to which framing buffer needs to be resized to 2409 pSettings->xVSS.framingScaledSize = 2410 (M4VIDEOEDITING_VideoFrameSize)pEnv->GetIntField(object, fieldIds.framingScaledSize); 2411 2412 // Set the text buffer. 2413 pSettings->xVSS.pTextBuffer = (M4OSA_Char*)videoEditJava_getString(pResult, pEnv, object, 2414 fieldIds.text, &pSettings->xVSS.textBufferSize); 2415 } 2416 2417 // Check if the text buffer could be retrieved. 2418 if (*pResult) 2419 { 2420 // Set the data used by the font engine (size, color...). 2421 pSettings->xVSS.pRenderingData = (M4OSA_Char*)videoEditJava_getString(pResult, pEnv, 2422 object, fieldIds.textRenderingData, M4OSA_NULL); 2423 } 2424 2425 // Check if the text rendering data could be retrieved. 2426 if (*pResult) 2427 { 2428 // Set the text plane width. 2429 pSettings->xVSS.uiTextBufferWidth = (M4OSA_UInt32)pEnv->GetIntField(object, 2430 fieldIds.textBufferWidth); 2431 2432 // Set the text plane height. 2433 pSettings->xVSS.uiTextBufferHeight = (M4OSA_UInt32)pEnv->GetIntField(object, 2434 fieldIds.textBufferHeight); 2435 2436 // Set the processing rate of the effect added when using the Fifties effect. 2437 pSettings->xVSS.uiFiftiesOutFrameRate = (M4OSA_UInt32)pEnv->GetIntField(object, 2438 fieldIds.fiftiesFrameRate); 2439 2440 // Set the RGB16 input color of the effect added when using the rgb16 color effect. 2441 pSettings->xVSS.uiRgb16InputColor = (M4OSA_UInt16)pEnv->GetIntField(object, 2442 fieldIds.rgb16InputColor); 2443 2444 // Set the start percentage of Alpha blending. 2445 pSettings->xVSS.uialphaBlendingStart = (M4OSA_UInt8)pEnv->GetIntField(object, 2446 fieldIds.alphaBlendingStartPercent); 2447 2448 // Set the middle percentage of Alpha blending. 2449 pSettings->xVSS.uialphaBlendingMiddle = (M4OSA_UInt8)pEnv->GetIntField(object, 2450 fieldIds.alphaBlendingMiddlePercent); 2451 2452 // Set the end percentage of Alpha blending. 2453 pSettings->xVSS.uialphaBlendingEnd = (M4OSA_UInt8)pEnv->GetIntField(object, 2454 fieldIds.alphaBlendingEndPercent); 2455 2456 // Set the duration, in percentage of effect duration, of the FadeIn phase. 2457 pSettings->xVSS.uialphaBlendingFadeInTime = (M4OSA_UInt8)pEnv->GetIntField(object, 2458 fieldIds.alphaBlendingFadeInTimePercent); 2459 2460 // Set the duration, in percentage of effect duration, of the FadeOut phase. 2461 pSettings->xVSS.uialphaBlendingFadeOutTime = (M4OSA_UInt8)pEnv->GetIntField(object, 2462 fieldIds.alphaBlendingFadeOutTimePercent); 2463 2464 if (pSettings->xVSS.pFramingFilePath != M4OSA_NULL) 2465 { 2466 pSettings->xVSS.pFramingBuffer = 2467 (M4VIFI_ImagePlane *)M4OSA_32bitAlignedMalloc(sizeof(M4VIFI_ImagePlane), 2468 0x00,(M4OSA_Char *)"framing buffer"); 2469 } 2470 2471 if (pSettings->xVSS.pFramingBuffer != M4OSA_NULL) 2472 { 2473 // OverFrame height and width 2474 pSettings->xVSS.pFramingBuffer->u_width = pEnv->GetIntField(object, 2475 fieldIds.width); 2476 2477 pSettings->xVSS.pFramingBuffer->u_height = pEnv->GetIntField(object, 2478 fieldIds.height); 2479 2480 pSettings->xVSS.width = pSettings->xVSS.pFramingBuffer->u_width; 2481 pSettings->xVSS.height = pSettings->xVSS.pFramingBuffer->u_height; 2482 pSettings->xVSS.rgbType = M4VSS3GPP_kRGB565; 2483 2484 VIDEOEDIT_LOG_FUNCTION(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES", 2485 "pFramingBuffer u_width %d ", pSettings->xVSS.pFramingBuffer->u_width); 2486 VIDEOEDIT_LOG_FUNCTION(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES", 2487 "pFramingBuffer u_height %d", pSettings->xVSS.pFramingBuffer->u_height); 2488 2489 } 2490 2491 // Check if settings could be set. 2492 if (!(*pResult)) 2493 { 2494 // Free the settings. 2495 videoEditClasses_freeEffectSettings(pSettings); 2496 } 2497 } 2498} 2499 2500void 2501videoEditClasses_freeEffectSettings( 2502 M4VSS3GPP_EffectSettings* pSettings) 2503{ 2504 // Check if memory was allocated for the EffectSettings. 2505 if (M4OSA_NULL != pSettings) 2506 { 2507 // Log the function call. 2508 VIDEOEDIT_LOG_FUNCTION(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES", 2509 "videoEditClasses_freeEffectSettings()"); 2510 2511 // Free the data used by the font engine (size, color...). 2512 videoEditOsal_free(pSettings->xVSS.pRenderingData); 2513 pSettings->xVSS.pRenderingData = M4OSA_NULL; 2514 2515 // Free the text buffer. 2516 videoEditOsal_free(pSettings->xVSS.pTextBuffer); 2517 pSettings->xVSS.pTextBuffer = M4OSA_NULL; 2518 pSettings->xVSS.textBufferSize = 0; 2519 2520 // Free the framing file path. 2521 videoEditOsal_free(pSettings->xVSS.pFramingFilePath); 2522 pSettings->xVSS.pFramingFilePath = M4OSA_NULL; 2523 } 2524} 2525 2526#ifdef VIDEOEDIT_LOGGING_ENABLED 2527void 2528videoEditClasses_logEffectSettings( 2529 M4VSS3GPP_EffectSettings* pSettings, 2530 int indentation) 2531{ 2532 // Check if memory was allocated for the EffectSettings. 2533 if (M4OSA_NULL != pSettings) 2534 { 2535 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES", 2536 "%*c uiStartTime: %u ms", indentation, ' ', 2537 (unsigned int)pSettings->uiStartTime); 2538 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES", 2539 "%*c uiDuration: %u ms", indentation, ' ', 2540 (unsigned int)pSettings->uiDuration); 2541 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES", 2542 "%*c VideoEffectType: %s", indentation, ' ', 2543 videoEditJava_getVideoEffectString(pSettings->VideoEffectType)); 2544 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES", 2545 "%*c ExtVideoEffectFct: %s", indentation, ' ', 2546 (M4OSA_NULL != pSettings->ExtVideoEffectFct) ? "set" : "<null>"); 2547 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES", 2548 "%*c pExtVideoEffectFctCtxt: %s", indentation, ' ', 2549 (M4OSA_NULL != pSettings->pExtVideoEffectFctCtxt) ? "set" : "<null>"); 2550 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES", 2551 "%*c AudioEffectType: %s", indentation, ' ', 2552 videoEditJava_getAudioEffectString(pSettings->AudioEffectType)); 2553 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES", 2554 "%*c uiStartPercent: %u %%", indentation, ' ', 2555 (unsigned int)pSettings->xVSS.uiStartPercent); 2556 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES", 2557 "%*c uiDurationPercent: %u %%", indentation, ' ', 2558 (unsigned int)pSettings->xVSS.uiDurationPercent); 2559 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES", 2560 "%*c pFramingFilePath: %s", indentation, ' ', 2561 (M4OSA_NULL != pSettings->xVSS.pFramingFilePath) ?\ 2562 (char*)pSettings->xVSS.pFramingFilePath : "<null>"); 2563 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES", 2564 "%*c pFramingBuffer: %s", indentation, ' ', 2565 (M4OSA_NULL != pSettings->xVSS.pFramingBuffer) ? "set" : "<null>"); 2566 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES", 2567 "%*c topleft_x: %u", indentation, ' ', 2568 (unsigned int)pSettings->xVSS.topleft_x); 2569 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES", 2570 "%*c topleft_y: %u", indentation, ' ', 2571 (unsigned int)pSettings->xVSS.topleft_y); 2572 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES", 2573 "%*c bResize: %s", indentation, ' ', 2574 pSettings->xVSS.bResize ? "true" : "false"); 2575 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES", 2576 "%*c pTextBuffer: %s", indentation, ' ', 2577 (M4OSA_NULL != pSettings->xVSS.pTextBuffer) ?\ 2578 (char*)pSettings->xVSS.pTextBuffer : "<null>"); 2579 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES", 2580 "%*c textBufferSize: %u", indentation, ' ', 2581 (unsigned int)pSettings->xVSS.textBufferSize); 2582 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES", 2583 "%*c pRenderingData: %s", indentation, ' ', 2584 (M4OSA_NULL != pSettings->xVSS.pRenderingData) ?\ 2585 (char*)pSettings->xVSS.pRenderingData : "<null>"); 2586 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES", 2587 "%*c uiTextBufferWidth: %u", indentation, ' ', 2588 (unsigned int)pSettings->xVSS.uiTextBufferWidth); 2589 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES", 2590 "%*c uiTextBufferHeight: %u", indentation, ' ', 2591 (unsigned int)pSettings->xVSS.uiTextBufferHeight); 2592 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES", 2593 "%*c uiFiftiesOutFrameRate: %u", indentation, ' ', 2594 (unsigned int)pSettings->xVSS.uiFiftiesOutFrameRate); 2595 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES", 2596 "%*c uiRgb16InputColor: %d", indentation, ' ', 2597 pSettings->xVSS.uiRgb16InputColor); 2598 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES", 2599 "%*c uialphaBlendingStart: %d %%", indentation, ' ', 2600 pSettings->xVSS.uialphaBlendingStart); 2601 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES", 2602 "%*c uialphaBlendingMiddle: %d %%", indentation, ' ', 2603 pSettings->xVSS.uialphaBlendingMiddle); 2604 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES", 2605 "%*c uialphaBlendingEnd: %d %%", indentation, ' ', 2606 pSettings->xVSS.uialphaBlendingEnd); 2607 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES", 2608 "%*c uialphaBlendingFadeInTime: %d %%", indentation, ' ', 2609 pSettings->xVSS.uialphaBlendingFadeInTime); 2610 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES", 2611 "%*c uialphaBlendingFadeOutTime: %d %%", indentation, ' ', 2612 pSettings->xVSS.uialphaBlendingFadeOutTime); 2613 } 2614 else 2615 { 2616 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES", 2617 "%*c <null>", indentation, ' '); 2618 } 2619} 2620#endif 2621 2622 2623void 2624videoEditClasses_getSlideTransitionSettings( 2625 bool* pResult, 2626 JNIEnv* pEnv, 2627 jobject object, 2628 M4xVSS_SlideTransitionSettings** ppSettings) 2629{ 2630 VideoEditJava_SlideTransitionSettingsFieldIds fieldIds = {NULL}; 2631 M4xVSS_SlideTransitionSettings* pSettings = M4OSA_NULL; 2632 bool converted = true; 2633 2634 // Check if the previous action succeeded. 2635 if (*pResult) 2636 { 2637 // Log the function call. 2638 VIDEOEDIT_LOG_FUNCTION(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES", 2639 "videoEditClasses_getSlideTransitionSettings()"); 2640 2641 // Retrieve the field ids. 2642 videoEditJava_getSlideTransitionSettingsFieldIds(pResult, pEnv, &fieldIds); 2643 } 2644 2645 2646 // Only validate the SlideTransitionSettings if the fields could be located. 2647 if (*pResult) 2648 { 2649 // Check if the clip is set. 2650 videoEditJava_checkAndThrowIllegalArgumentException(pResult, pEnv, 2651 (NULL == object), 2652 "slideSettings is null"); 2653 } 2654 2655 // Only retrieve the SlideTransitionSettings if the fields could be located and validated. 2656 if (*pResult) 2657 { 2658 // Allocate memory for the SlideTransitionSettings. 2659 pSettings = (M4xVSS_SlideTransitionSettings*)videoEditOsal_alloc(pResult, pEnv, 2660 sizeof(M4xVSS_SlideTransitionSettings), "SlideTransitionSettings"); 2661 2662 // Check if memory could be allocated for the SlideTransitionSettings. 2663 if (*pResult) 2664 { 2665 // Set the direction of the slide. 2666 pSettings->direction = 2667 (M4xVSS_SlideTransition_Direction)videoEditJava_getSlideDirectionJavaToC( 2668 &converted, pEnv->GetIntField(object, fieldIds.direction)); 2669 2670 // Check if the direction is valid. 2671 videoEditJava_checkAndThrowIllegalArgumentException(pResult, pEnv, 2672 !converted, "slideSettings.direction is invalid"); 2673 } 2674 2675 // Check if settings could be set. 2676 if (*pResult) 2677 { 2678 // Return the settings. 2679 (*ppSettings) = pSettings; 2680 } 2681 else 2682 { 2683 // Free the settings. 2684 videoEditClasses_freeSlideTransitionSettings(&pSettings); 2685 } 2686 } 2687} 2688 2689void 2690videoEditClasses_freeSlideTransitionSettings( 2691 M4xVSS_SlideTransitionSettings** ppSettings) 2692{ 2693 // Check if memory was allocated for the SlideTransitionSettings. 2694 if (M4OSA_NULL != (*ppSettings)) 2695 { 2696 // Log the function call. 2697 VIDEOEDIT_LOG_FUNCTION(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES", 2698 "videoEditClasses_freeSlideTransitionSettings()"); 2699 2700 // Free the settings structure. 2701 videoEditOsal_free((*ppSettings)); 2702 (*ppSettings) = M4OSA_NULL; 2703 } 2704} 2705 2706#ifdef VIDEOEDIT_LOGGING_ENABLED 2707void 2708videoEditClasses_logSlideTransitionSettings( 2709 M4xVSS_SlideTransitionSettings* pSettings, 2710 int indentation) 2711{ 2712 // Check if memory was allocated for the SlideTransitionSettings. 2713 if (M4OSA_NULL != pSettings) 2714 { 2715 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES", 2716 "%*c direction: %s", indentation, ' ', 2717 videoEditJava_getSlideDirectionString(pSettings->direction)); 2718 } 2719 else 2720 { 2721 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES", 2722 "%*c <null>", indentation, ' '); 2723 } 2724} 2725#endif 2726 2727 2728void 2729videoEditClasses_getTransitionSettings( 2730 bool* pResult, 2731 JNIEnv* pEnv, 2732 jobject object, 2733 M4VSS3GPP_TransitionSettings** ppSettings) 2734{ 2735 2736 VideoEditJava_TransitionSettingsFieldIds fieldIds; 2737 jobject alphaSettings = NULL; 2738 jobject slideSettings = NULL; 2739 M4VSS3GPP_TransitionSettings* pSettings = M4OSA_NULL; 2740 bool converted = true; 2741 memset(&fieldIds, 0, sizeof(VideoEditJava_TransitionSettingsFieldIds)); 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 3027 VideoEditJava_VersionFieldIds fieldIds; 3028 jclass clazz = NULL; 3029 jobject object = NULL; 3030 memset(&fieldIds, 0, sizeof(VideoEditJava_VersionFieldIds)); 3031 // Check if the previous action succeeded. 3032 if (*pResult) 3033 { 3034 // Log the function call. 3035 VIDEOEDIT_LOG_FUNCTION(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES", 3036 "videoEditClasses_createVersion()"); 3037 3038 // Retrieve the class. 3039 videoEditJava_getVersionClass(pResult, pEnv, &clazz); 3040 3041 // Retrieve the field ids. 3042 videoEditJava_getVersionFieldIds(pResult, pEnv, &fieldIds); 3043 } 3044 3045 // Only create an object if the class and fields could be located. 3046 if (*pResult) 3047 { 3048 // Allocate a new object. 3049 object = pEnv->AllocObject(clazz); 3050 3051 // check if alloc is done 3052 videoEditJava_checkAndThrowRuntimeException(pResult, pEnv, 3053 (NULL == object), 3054 M4ERR_ALLOC); 3055 if (NULL != object) 3056 { 3057 // Set the major field. 3058 pEnv->SetIntField(object, fieldIds.major, pVersionInfo->m_major); 3059 3060 // Set the minor field. 3061 pEnv->SetIntField(object, fieldIds.minor, pVersionInfo->m_minor); 3062 3063 // Set the revision field. 3064 pEnv->SetIntField(object, fieldIds.revision, pVersionInfo->m_revision); 3065 3066 // Return the object. 3067 (*pObject) = object; 3068 } 3069 } 3070} 3071 3072#ifdef VIDEOEDIT_LOGGING_ENABLED 3073void 3074videoEditClasses_logVersion( 3075 M4_VersionInfo* pVersionInfo, 3076 int indentation) 3077{ 3078 // Check if memory was allocated for the Version. 3079 if (M4OSA_NULL != pVersionInfo) 3080 { 3081 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES", 3082 "%*c major: %u ms", indentation, ' ', 3083 (unsigned int)pVersionInfo->m_major); 3084 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES", 3085 "%*c minor: %u", indentation, ' ', 3086 (unsigned int)pVersionInfo->m_minor); 3087 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES", 3088 "%*c revision: %u", indentation, ' ', 3089 (unsigned int)pVersionInfo->m_revision); 3090 } 3091 else 3092 { 3093 VIDEOEDIT_LOG_SETTING(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES", 3094 "%*c <null>", indentation, ' '); 3095 } 3096} 3097#endif 3098 3099 3100void* 3101videoEditClasses_getContext( 3102 bool* pResult, 3103 JNIEnv* pEnv, 3104 jobject object) 3105{ 3106 void* pContext = M4OSA_NULL; 3107 jclass clazz = NULL; 3108 VideoEditJava_EngineFieldIds fieldIds = {NULL}; 3109 3110 // Check if the previous action succeeded. 3111 if (*pResult) 3112 { 3113 // Log the function call. 3114 VIDEOEDIT_LOG_FUNCTION(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES", 3115 "videoEditClasses_getContext()"); 3116 3117 // Retrieve the class. 3118 videoEditJava_getEngineClass(pResult, pEnv, &clazz); 3119 3120 // Retrieve the field ids. 3121 videoEditJava_getEngineFieldIds(pResult, pEnv, &fieldIds); 3122 } 3123 3124 // Check if the class and field ids could be located. 3125 if (*pResult) 3126 { 3127 // Retrieve the context pointer. 3128 pContext = (void *)pEnv->GetIntField(object, fieldIds.context); 3129 } 3130 3131 // Return the context pointer. 3132 return(pContext); 3133} 3134 3135void 3136videoEditClasses_setContext( 3137 bool* pResult, 3138 JNIEnv* pEnv, 3139 jobject object, 3140 void* pContext) 3141{ 3142 jclass clazz = NULL; 3143 VideoEditJava_EngineFieldIds fieldIds = {NULL}; 3144 3145 // Check if the previous action succeeded. 3146 if (*pResult) 3147 { 3148 // Log the function call. 3149 VIDEOEDIT_LOG_FUNCTION(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES", 3150 "videoEditClasses_setContext()"); 3151 3152 // Retrieve the class. 3153 videoEditJava_getEngineClass(pResult, pEnv, &clazz); 3154 3155 // Retrieve the field ids. 3156 videoEditJava_getEngineFieldIds(pResult, pEnv, &fieldIds); 3157 } 3158 3159 // Check if the class and field ids could be located. 3160 if (*pResult) 3161 { 3162 // Set the context field. 3163 VIDEOEDIT_LOG_FUNCTION(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES", 3164 "The context value from JAVA before setting is = 0x%x", 3165 pEnv->GetIntField(object, fieldIds.context)); 3166 3167 pEnv->SetIntField(object, fieldIds.context, (int)pContext); 3168 M4OSA_TRACE1_1("The context value in JNI is = 0x%x",pContext); 3169 3170 VIDEOEDIT_LOG_FUNCTION(ANDROID_LOG_INFO, "VIDEO_EDITOR_CLASSES", 3171 "The context value from JAVA after setting is = 0x%x", 3172 pEnv->GetIntField(object, fieldIds.context)); 3173 } 3174} 3175 3176