2 * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
21 #include <mm_transcode.h>
23 #include <video_util.h>
24 #include <video_util_private.h>
30 #define LOG_TAG "CAPI_MEDIA_VIDEO_UTIL"
32 #define UTIL_SAFE_FREE(src) { if(src) {free(src); src = NULL;}}
33 #define UTIL_STRING_VALID(str) \
34 ((str != NULL && strlen(str) > 0) ? true : false)
36 #define VIDEO_UTIL_MINIMUM_WIDTH 128
37 #define VIDEO_UTIL_MINIMUM_HEIGHT 96
38 #define VIDEO_UTIL_MINIMUM_DURATION 1000 /*1 sec*/
39 #define VIDEO_UTIL_MINIMUM_FPS 5
40 #define VIDEO_UTIL_MAXIMUM_FPS 30
42 static int __video_util_create_transcode_handle(video_util_s *handle);
43 static int __video_util_destroy_transcode_handle(video_util_s *handle);
44 static int __video_util_check_transcode_is_busy(video_util_s * handle, bool *is_busy);
45 static bool __video_util_check_video_codec(video_util_video_codec_e video_codec);
46 static bool __video_util_check_audio_codec(video_util_audio_codec_e audio_codec);
47 static bool __video_util_check_file_format(video_util_file_format_e file_format);
48 static bool __video_util_check_resolution(int width, int height);
49 static bool __video_util_check_duration(int duration);
50 static bool __video_util_check_fps(int fps);
51 static video_util_error_e __video_util_error_convert(int error);
52 static void __video_util_transcode_completed_cb(int error, void *user_data);
53 static bool __video_util_type_callback(int codec_type, void *user_data);
54 static int __video_util_foreach_supported_type(video_util_type_e type, video_util_supported_type_cb callback, void *user_data);
56 static int __video_util_create_transcode_handle(video_util_s *handle)
58 int ret = VIDEO_UTIL_ERROR_NONE;
59 MMHandleType transcode_h = 0;
61 ret = mm_transcode_create(&transcode_h);
62 if(ret != MM_ERROR_NONE)
64 if(ret == MM_ERROR_INVALID_ARGUMENT)
66 LOGE("INVALID_PARAMETER(0x%08x)", VIDEO_UTIL_ERROR_INVALID_PARAMETER);
67 return VIDEO_UTIL_ERROR_INVALID_PARAMETER;
71 LOGE("INVALID_OPERATION(0x%08x)", VIDEO_UTIL_ERROR_INVALID_OPERATION);
72 return VIDEO_UTIL_ERROR_INVALID_OPERATION;
76 ret = mm_transcode_prepare(transcode_h, handle->input_path, handle->file_format, handle->video_codec, handle->audio_codec);
77 if(ret != MM_ERROR_NONE)
79 if(ret == MM_ERROR_INVALID_ARGUMENT)
81 LOGE("INVALID_PARAMETER(0x%08x)", VIDEO_UTIL_ERROR_INVALID_PARAMETER);
82 return VIDEO_UTIL_ERROR_INVALID_PARAMETER;
86 LOGE("INVALID_OPERATION(0x%08x)", VIDEO_UTIL_ERROR_INVALID_OPERATION);
87 return VIDEO_UTIL_ERROR_INVALID_OPERATION;
91 handle->transcode_h = transcode_h;
96 //when should make new trandcode handle? input_filepath or file_format or video_codec or audio_codec is modified
97 static int __video_util_destroy_transcode_handle(video_util_s *handle)
99 int ret = VIDEO_UTIL_ERROR_NONE;
101 if(handle->transcode_h)
103 ret = mm_transcode_destroy(handle->transcode_h);
104 LOGI("mm_transcode_destroy [%d]\n", ret);
105 if(ret != MM_ERROR_NONE)
107 LOGE("INVALID_OPERATION(0x%08x)", VIDEO_UTIL_ERROR_INVALID_OPERATION);
108 return VIDEO_UTIL_ERROR_INVALID_OPERATION;
112 handle->transcode_h = 0;
117 int __video_util_check_transcode_is_busy(video_util_s * handle, bool *is_busy)
119 int ret = VIDEO_UTIL_ERROR_NONE;
121 if(handle->transcode_h)
123 ret = mm_transcode_is_busy(handle->transcode_h, is_busy);
124 if(ret != MM_ERROR_NONE)
126 LOGE("INVALID_OPERATION(0x%08x)", VIDEO_UTIL_ERROR_INVALID_OPERATION);
127 return VIDEO_UTIL_ERROR_INVALID_OPERATION;
138 static bool __video_util_check_video_codec(video_util_video_codec_e video_codec)
140 if((video_codec < 0) || (video_codec > VIDEO_UTIL_VIDEO_CODEC_NONE ))
142 LOGE("invalid video_codec [%d]", video_codec);
149 static bool __video_util_check_audio_codec(video_util_audio_codec_e audio_codec)
151 if((audio_codec < 0) || (audio_codec > VIDEO_UTIL_AUDIO_CODEC_NONE ))
153 LOGE("invalid audio_codec [%d]", audio_codec);
160 static bool __video_util_check_file_format(video_util_file_format_e file_format)
162 if((file_format < 0) || (file_format >= VIDEO_UTIL_FILE_FORMAT_MAX ))
164 LOGE("invalid file_format [%d]", file_format);
171 static bool __video_util_check_resolution(int width, int height)
173 if(((width > 0) && (width < VIDEO_UTIL_MINIMUM_WIDTH)) || (width < 0))
175 LOGE("invalid width [%d]", width);
179 if(((height > 0) && (height < VIDEO_UTIL_MINIMUM_HEIGHT)) || (height < 0))
181 LOGE("invalid height [%d]", height);
188 static bool __video_util_check_duration(int duration)
190 if(((duration > 0) && (duration < VIDEO_UTIL_MINIMUM_DURATION)) || (duration < 0))
192 LOGE("invalid duration [%d]", duration);
199 static bool __video_util_check_fps(int fps)
201 if((fps < 0) || ((fps > 0) && (fps < VIDEO_UTIL_MINIMUM_FPS)) || (fps > VIDEO_UTIL_MAXIMUM_FPS))
203 LOGE("invalid fps [%d]", fps);
210 static video_util_error_e __video_util_error_convert(int error)
212 LOGI("error [%d]\n", error);
214 if(error == MM_ERROR_NONE)
216 return VIDEO_UTIL_ERROR_NONE;
218 else if(error == MM_ERROR_INVALID_ARGUMENT)
220 LOGE("INVALID_PARAMETER(0x%08x)", VIDEO_UTIL_ERROR_INVALID_PARAMETER);
221 return VIDEO_UTIL_ERROR_INVALID_PARAMETER;
225 LOGE("INVALID_OPERATION(0x%08x)", VIDEO_UTIL_ERROR_INVALID_OPERATION);
226 return VIDEO_UTIL_ERROR_INVALID_OPERATION;
230 static void __video_util_transcode_completed_cb(int error, void *user_data)
232 int error_value = VIDEO_UTIL_ERROR_NONE;
233 video_util_cb_s *_util_cb = (video_util_cb_s *)user_data;
235 if((_util_cb != NULL) && (_util_cb->transcode_completed_cb != NULL))
237 error_value = __video_util_error_convert(error);
238 _util_cb->transcode_completed_cb(error_value, _util_cb->user_data);
241 UTIL_SAFE_FREE(_util_cb);
246 static bool __video_util_type_callback(int codec_type, void *user_data)
248 video_util_type_cb_s *codec_cb = (video_util_type_cb_s *)user_data;
252 if (codec_cb->supported_type_cb) {
253 codec_cb->supported_type_cb(codec_type, codec_cb->user_data);
260 static int __video_util_foreach_supported_type(video_util_type_e type, video_util_supported_type_cb callback, void *user_data)
262 int ret = VIDEO_UTIL_ERROR_NONE;
264 video_util_type_cb_s *codec_cb = (video_util_type_cb_s*)calloc(1, sizeof(video_util_type_cb_s));
265 codec_cb->user_data = user_data;
266 codec_cb->supported_type_cb = (video_util_supported_type_cb)callback;
268 if(type == VIDEO_UTIL_TYPE_FORMAT)
270 ret = mm_transcode_get_supported_container_format((mm_transcode_support_type_callback)__video_util_type_callback, (void *)codec_cb);
272 else if(type == VIDEO_UTIL_TYPE_VIDEO_ENC)
274 ret = mm_transcode_get_supported_video_encoder((mm_transcode_support_type_callback)__video_util_type_callback, (void *)codec_cb);
276 else if(type == VIDEO_UTIL_TYPE_AUDIO_ENC)
278 ret = mm_transcode_get_supported_audio_encoder((mm_transcode_support_type_callback)__video_util_type_callback, (void *)codec_cb);
282 LOGE("INVALID_PARAMETER(0x%08x)", VIDEO_UTIL_ERROR_INVALID_PARAMETER);
283 return VIDEO_UTIL_ERROR_INVALID_PARAMETER;
286 UTIL_SAFE_FREE(codec_cb);
291 int video_util_create(video_util_h *handle)
293 int ret = VIDEO_UTIL_ERROR_NONE;
299 LOGE("INVALID_PARAMETER(0x%08x)", VIDEO_UTIL_ERROR_INVALID_PARAMETER);
300 return VIDEO_UTIL_ERROR_INVALID_PARAMETER;
303 video_util_s *_handle = (video_util_s*)calloc(1,sizeof(video_util_s));
306 LOGE("OUT_OF_MEMORY(0x%08x)", VIDEO_UTIL_ERROR_INVALID_PARAMETER);
307 return VIDEO_UTIL_ERROR_OUT_OF_MEMORY;
310 _handle->input_path = NULL;
311 _handle->accurate_mode = false;
312 _handle->video_codec = 0;
313 _handle->audio_codec = 0;
314 _handle->file_format = 0;
318 _handle->transcode_h = 0;
320 *handle = (video_util_h)_handle;
327 int video_util_destroy(video_util_h handle)
329 int ret = VIDEO_UTIL_ERROR_NONE;
330 video_util_s *_handle = (video_util_s*)handle;
336 LOGE("INVALID_PARAMETER(0x%08x)", VIDEO_UTIL_ERROR_INVALID_PARAMETER);
337 return VIDEO_UTIL_ERROR_INVALID_PARAMETER;
340 ret = __video_util_destroy_transcode_handle(_handle);
342 UTIL_SAFE_FREE(_handle->input_path);
343 UTIL_SAFE_FREE(_handle);
350 int video_util_set_file_path(video_util_h handle, const char *file_path)
352 int ret = VIDEO_UTIL_ERROR_NONE;
353 video_util_s *_handle = (video_util_s*)handle;
354 bool is_busy = false;
356 if((_handle != NULL) && (UTIL_STRING_VALID(file_path)))
358 LOGI("file_path [%s]\n", file_path);
360 if(_handle->input_path != NULL)
362 ret = __video_util_check_transcode_is_busy(_handle, &is_busy);
363 if(ret != VIDEO_UTIL_ERROR_NONE)
368 LOGE("BUSY!! Transcoding is already running.\n");
369 return VIDEO_UTIL_ERROR_BUSY;
373 ret = __video_util_destroy_transcode_handle(_handle);
374 if(ret != VIDEO_UTIL_ERROR_NONE)
377 UTIL_SAFE_FREE(_handle->input_path);
381 _handle->input_path = strdup(file_path);
382 if(_handle->input_path == NULL)
384 LOGE("OUT_OF_MEMORY(0x%08x)", VIDEO_UTIL_ERROR_INVALID_PARAMETER);
385 return VIDEO_UTIL_ERROR_OUT_OF_MEMORY;
390 LOGE("INVALID_PARAMETER(0x%08x)", VIDEO_UTIL_ERROR_INVALID_PARAMETER);
391 return VIDEO_UTIL_ERROR_INVALID_PARAMETER;
397 int video_util_get_file_path(video_util_h handle, char **file_path)
399 int ret = VIDEO_UTIL_ERROR_NONE;
400 video_util_s *_handle = (video_util_s*)handle;
402 if(_handle && file_path)
404 if(UTIL_STRING_VALID(_handle->input_path))
406 *file_path = strdup(_handle->input_path);
407 if(*file_path == NULL)
409 LOGE("OUT_OF_MEMORY(0x%08x)", VIDEO_UTIL_ERROR_INVALID_PARAMETER);
410 return VIDEO_UTIL_ERROR_OUT_OF_MEMORY;
420 LOGE("INVALID_PARAMETER(0x%08x)", VIDEO_UTIL_ERROR_INVALID_PARAMETER);
421 return VIDEO_UTIL_ERROR_INVALID_PARAMETER;
427 int video_util_set_accurate_mode(video_util_h handle, bool accurate_mode)
429 int ret = VIDEO_UTIL_ERROR_NONE;
430 video_util_s *_handle = (video_util_s*)handle;
432 LOGI("accurate_mode [%d]\n", accurate_mode);
436 _handle->accurate_mode= accurate_mode;
440 LOGE("INVALID_PARAMETER(0x%08x)", VIDEO_UTIL_ERROR_INVALID_PARAMETER);
441 return VIDEO_UTIL_ERROR_INVALID_PARAMETER;
447 int video_util_get_accurate_mode(video_util_h handle, bool *accurate_mode)
449 int ret = VIDEO_UTIL_ERROR_NONE;
450 video_util_s *_handle = (video_util_s*)handle;
452 if(_handle && accurate_mode)
454 *accurate_mode = _handle->accurate_mode;
458 LOGE("INVALID_PARAMETER(0x%08x)", VIDEO_UTIL_ERROR_INVALID_PARAMETER);
459 return VIDEO_UTIL_ERROR_INVALID_PARAMETER;
465 int video_util_set_video_codec(video_util_h handle, video_util_video_codec_e codec)
467 int ret = VIDEO_UTIL_ERROR_NONE;
468 video_util_s *_handle = (video_util_s*)handle;
469 bool is_busy = false;
471 LOGI("video_codec [%d]\n", codec);
473 if((_handle != NULL) && (__video_util_check_video_codec(codec)))
475 ret = __video_util_check_transcode_is_busy(_handle, &is_busy);
476 if(ret != VIDEO_UTIL_ERROR_NONE)
481 LOGE("BUSY!! Transcoding is already running.\n");
482 return VIDEO_UTIL_ERROR_BUSY;
486 ret = __video_util_destroy_transcode_handle(_handle);
487 if(ret != VIDEO_UTIL_ERROR_NONE)
491 _handle->video_codec= codec;
495 LOGE("INVALID_PARAMETER(0x%08x)", VIDEO_UTIL_ERROR_INVALID_PARAMETER);
496 return VIDEO_UTIL_ERROR_INVALID_PARAMETER;
502 int video_util_get_video_codec(video_util_h handle, video_util_video_codec_e *codec)
504 int ret = VIDEO_UTIL_ERROR_NONE;
505 video_util_s *_handle = (video_util_s*)handle;
509 *codec = _handle->video_codec;
513 LOGE("INVALID_PARAMETER(0x%08x)", VIDEO_UTIL_ERROR_INVALID_PARAMETER);
514 return VIDEO_UTIL_ERROR_INVALID_PARAMETER;
520 int video_util_set_audio_codec(video_util_h handle, video_util_audio_codec_e codec)
522 int ret = VIDEO_UTIL_ERROR_NONE;
523 video_util_s *_handle = (video_util_s*)handle;
524 bool is_busy = false;
526 LOGI("audio_codec [%d]\n", codec);
528 if((_handle != NULL) && (__video_util_check_audio_codec(codec)))
530 ret = __video_util_check_transcode_is_busy(_handle, &is_busy);
531 if(ret != VIDEO_UTIL_ERROR_NONE)
536 LOGE("BUSY!! Transcoding is already running.\n");
537 return VIDEO_UTIL_ERROR_BUSY;
541 ret = __video_util_destroy_transcode_handle(_handle);
542 if(ret != VIDEO_UTIL_ERROR_NONE)
546 _handle->audio_codec= codec;
550 LOGE("INVALID_PARAMETER(0x%08x)", VIDEO_UTIL_ERROR_INVALID_PARAMETER);
551 return VIDEO_UTIL_ERROR_INVALID_PARAMETER;
557 int video_util_get_audio_codec(video_util_h handle, video_util_audio_codec_e *codec)
559 int ret = VIDEO_UTIL_ERROR_NONE;
560 video_util_s *_handle = (video_util_s*)handle;
564 *codec = _handle->audio_codec;
568 LOGE("INVALID_PARAMETER(0x%08x)", VIDEO_UTIL_ERROR_INVALID_PARAMETER);
569 return VIDEO_UTIL_ERROR_INVALID_PARAMETER;
575 int video_util_set_file_format(video_util_h handle, video_util_file_format_e format)
577 int ret = VIDEO_UTIL_ERROR_NONE;
578 video_util_s *_handle = (video_util_s*)handle;
579 bool is_busy = false;
581 LOGI("file_format [%d]\n", format);
583 if((_handle != NULL) && (__video_util_check_file_format(format)))
585 ret = __video_util_check_transcode_is_busy(_handle, &is_busy);
586 if(ret != VIDEO_UTIL_ERROR_NONE)
591 LOGE("BUSY!! Transcoding is already running.\n");
592 return VIDEO_UTIL_ERROR_BUSY;
596 ret = __video_util_destroy_transcode_handle(_handle);
597 if(ret != VIDEO_UTIL_ERROR_NONE)
601 _handle->file_format= format;
605 LOGE("INVALID_PARAMETER(0x%08x)", VIDEO_UTIL_ERROR_INVALID_PARAMETER);
606 return VIDEO_UTIL_ERROR_INVALID_PARAMETER;
612 int video_util_get_file_format(video_util_h handle, video_util_file_format_e *format)
614 int ret = VIDEO_UTIL_ERROR_NONE;
615 video_util_s *_handle = (video_util_s*)handle;
617 if(_handle && format)
619 *format = _handle->file_format;
623 LOGE("INVALID_PARAMETER(0x%08x)", VIDEO_UTIL_ERROR_INVALID_PARAMETER);
624 return VIDEO_UTIL_ERROR_INVALID_PARAMETER;
630 int video_util_set_resolution(video_util_h handle, int width, int height)
632 int ret = VIDEO_UTIL_ERROR_NONE;
633 video_util_s *_handle = (video_util_s*)handle;
635 LOGI("width [%d] height [%d]\n", width, height);
637 if((_handle != NULL) && (__video_util_check_resolution(width, height)))
639 _handle->width= width;
640 _handle->height= height;
644 LOGE("INVALID_PARAMETER(0x%08x)", VIDEO_UTIL_ERROR_INVALID_PARAMETER);
645 return VIDEO_UTIL_ERROR_INVALID_PARAMETER;
651 int video_util_get_resolution(video_util_h handle, int *width, int *height)
653 int ret = VIDEO_UTIL_ERROR_NONE;
654 video_util_s *_handle = (video_util_s*)handle;
656 if(_handle && width && height)
658 *width = _handle->width;
659 *height = _handle->height;
663 LOGE("INVALID_PARAMETER(0x%08x)", VIDEO_UTIL_ERROR_INVALID_PARAMETER);
664 return VIDEO_UTIL_ERROR_INVALID_PARAMETER;
670 int video_util_set_fps(video_util_h handle, int fps)
672 int ret = VIDEO_UTIL_ERROR_NONE;
673 video_util_s *_handle = (video_util_s*)handle;
675 if(_handle && __video_util_check_fps(fps))
681 LOGE("INVALID_PARAMETER(0x%08x)", VIDEO_UTIL_ERROR_INVALID_PARAMETER);
682 return VIDEO_UTIL_ERROR_INVALID_PARAMETER;
688 int video_util_start_transcoding(video_util_h handle, unsigned long start, unsigned long duration, const char *out_path, video_util_transcoding_progress_cb progress_cb, video_util_transcoding_completed_cb completed_cb,void *user_data)
690 int ret = VIDEO_UTIL_ERROR_NONE;
691 video_util_s *_handle = (video_util_s*)handle;
692 mm_seek_mode_e accurate_mode = MM_SEEK_NUM;
693 bool is_busy = false;
695 LOGI("start [%d] duration [%d]\n", start, duration);
697 if(_handle && (__video_util_check_duration(duration)) && (UTIL_STRING_VALID(_handle->input_path)) && (UTIL_STRING_VALID(out_path)) && completed_cb)
699 if(!_handle->transcode_h)
701 ret = __video_util_create_transcode_handle(_handle);
702 if(ret != MM_ERROR_NONE)
707 if(!_handle->transcode_h)
709 LOGE("INVALID_OPERATION(0x%08x)", VIDEO_UTIL_ERROR_INVALID_OPERATION);
710 return VIDEO_UTIL_ERROR_INVALID_OPERATION;
715 ret = __video_util_check_transcode_is_busy(_handle, &is_busy);
716 if(ret != VIDEO_UTIL_ERROR_NONE)
721 LOGE("BUSY!! Transcoding is already running.\n");
722 return VIDEO_UTIL_ERROR_BUSY;
726 LOGI("width [%d] height [%d] fps [%d]v_codec [%d] a_codec [%d] file_format [%d] accurate [%d]\n",
727 _handle->width, _handle->height, _handle->fps, _handle->video_codec, _handle->audio_codec, _handle->file_format, _handle->accurate_mode);
729 video_util_cb_s *_util_cb = (video_util_cb_s*)calloc(1, sizeof(video_util_cb_s));
730 _util_cb->user_data = user_data;
731 _util_cb->transcode_completed_cb = completed_cb;
733 if(_handle->accurate_mode)
734 accurate_mode = MM_SEEK_ACCURATE;
736 accurate_mode = MM_SEEK_INACCURATE;
738 ret = mm_transcode(_handle->transcode_h, _handle->width, _handle->height, _handle->fps, start, duration, accurate_mode, out_path, (mm_transcode_progress_callback)progress_cb, (mm_transcode_completed_callback)__video_util_transcode_completed_cb, (void *)_util_cb);
740 if(ret != MM_ERROR_NONE)
742 if(ret == MM_ERROR_INVALID_ARGUMENT)
744 LOGE("INVALID_PARAMETER(0x%08x)", VIDEO_UTIL_ERROR_INVALID_PARAMETER);
745 return VIDEO_UTIL_ERROR_INVALID_PARAMETER;
749 LOGE("INVALID_OPERATION(0x%08x)", VIDEO_UTIL_ERROR_INVALID_OPERATION);
750 return VIDEO_UTIL_ERROR_INVALID_OPERATION;
756 LOGE("INVALID_PARAMETER(0x%08x)", VIDEO_UTIL_ERROR_INVALID_PARAMETER);
757 return VIDEO_UTIL_ERROR_INVALID_PARAMETER;
763 int video_util_cancel_transcoding(video_util_h handle)
765 int ret = VIDEO_UTIL_ERROR_NONE;
766 video_util_s *_handle = (video_util_s*)handle;
768 if(_handle && (_handle->transcode_h))
770 ret = mm_transcode_cancel(_handle->transcode_h);
771 if(ret != MM_ERROR_NONE)
773 LOGE("INVALID_OPERATION(0x%08x)", VIDEO_UTIL_ERROR_INVALID_OPERATION);
774 return VIDEO_UTIL_ERROR_INVALID_OPERATION;
779 LOGE("INVALID_PARAMETER(0x%08x)", VIDEO_UTIL_ERROR_INVALID_PARAMETER);
780 return VIDEO_UTIL_ERROR_INVALID_PARAMETER;
786 int video_util_get_progress_transcoding(video_util_h handle, unsigned long *current_position, unsigned long *duration)
788 int ret = VIDEO_UTIL_ERROR_NONE;
789 video_util_s *_handle = (video_util_s*)handle;
792 if(_handle && current_position && duration)
794 if(_handle->transcode_h)
796 ret = mm_transcode_get_attrs(_handle->transcode_h, (mm_containerformat_e *)&value, (mm_videoencoder_e *)&value, (mm_audioencoder_e *)&value,
797 current_position, duration, (unsigned int *)&value, (unsigned int *)&value);
798 if(ret != MM_ERROR_NONE)
800 LOGE("INVALID_OPERATION(0x%08x)", VIDEO_UTIL_ERROR_INVALID_OPERATION);
801 return VIDEO_UTIL_ERROR_INVALID_OPERATION;
806 LOGE("INVALID_PARAMETER(0x%08x)", VIDEO_UTIL_ERROR_INVALID_PARAMETER);
807 return VIDEO_UTIL_ERROR_INVALID_PARAMETER;
812 LOGE("INVALID_PARAMETER(0x%08x)", VIDEO_UTIL_ERROR_INVALID_PARAMETER);
813 return VIDEO_UTIL_ERROR_INVALID_PARAMETER;
819 int video_util_foreach_supported_file_format(video_util_h handle, video_util_supported_file_format_cb callback, void *user_data)
821 int ret = VIDEO_UTIL_ERROR_NONE;
822 video_util_s *_handle = (video_util_s*)handle;
824 if(_handle && callback)
826 ret = __video_util_foreach_supported_type(VIDEO_UTIL_TYPE_FORMAT, (video_util_supported_type_cb)callback, user_data);
830 LOGE("INVALID_PARAMETER(0x%08x)", VIDEO_UTIL_ERROR_INVALID_PARAMETER);
831 return VIDEO_UTIL_ERROR_INVALID_PARAMETER;
837 int video_util_foreach_supported_video_codec(video_util_h handle, video_util_supported_video_encoder_cb callback, void *user_data)
839 int ret = VIDEO_UTIL_ERROR_NONE;
840 video_util_s *_handle = (video_util_s*)handle;
842 if(_handle && callback)
844 ret = __video_util_foreach_supported_type(VIDEO_UTIL_TYPE_VIDEO_ENC, (video_util_supported_type_cb)callback, user_data);
848 LOGE("INVALID_PARAMETER(0x%08x)", VIDEO_UTIL_ERROR_INVALID_PARAMETER);
849 return VIDEO_UTIL_ERROR_INVALID_PARAMETER;
855 int video_util_foreach_supported_audio_codec(video_util_h handle, video_util_supported_audio_encoder_cb callback, void *user_data)
857 int ret = VIDEO_UTIL_ERROR_NONE;
858 video_util_s *_handle = (video_util_s*)handle;
860 if(_handle && callback)
862 ret = __video_util_foreach_supported_type(VIDEO_UTIL_TYPE_AUDIO_ENC, (video_util_supported_type_cb)callback, user_data);
866 LOGE("INVALID_PARAMETER(0x%08x)", VIDEO_UTIL_ERROR_INVALID_PARAMETER);
867 return VIDEO_UTIL_ERROR_INVALID_PARAMETER;