From fb7d9f3857cc935050174f4a77093d8c7cb5e1b4 Mon Sep 17 00:00:00 2001 From: Jinkun Jang Date: Sat, 16 Mar 2013 01:12:21 +0900 Subject: [PATCH] merge with master --- include/video_util_private.h | 1 + packaging/capi-media-video-util.spec | 4 ++-- src/video_util.c | 17 ++++++++++++++++- test/video_util_test.c | 12 +++++++++--- 4 files changed, 28 insertions(+), 6 deletions(-) diff --git a/include/video_util_private.h b/include/video_util_private.h index 9bed25b..9dc5c29 100755 --- a/include/video_util_private.h +++ b/include/video_util_private.h @@ -40,6 +40,7 @@ typedef struct typedef struct { void *user_data; + video_util_transcoding_progress_cb transcode_progress_cb; video_util_transcoding_completed_cb transcode_completed_cb; }video_util_cb_s; diff --git a/packaging/capi-media-video-util.spec b/packaging/capi-media-video-util.spec index e244301..65cf7fc 100755 --- a/packaging/capi-media-video-util.spec +++ b/packaging/capi-media-video-util.spec @@ -1,7 +1,7 @@ Name: capi-media-video-util Summary: A Video Utility library in Tizen Native API -Version: 0.1.5 -Release: 0 +Version: 0.1.6 +Release: 2 Group: System/Libraries License: Apache License, Version 2.0 Source0: %{name}-%{version}.tar.gz diff --git a/src/video_util.c b/src/video_util.c index 903f362..94acc84 100755 --- a/src/video_util.c +++ b/src/video_util.c @@ -49,6 +49,7 @@ static bool __video_util_check_resolution(int width, int height); static bool __video_util_check_duration(int duration); static bool __video_util_check_fps(int fps); static video_util_error_e __video_util_error_convert(int error); +static void __video_util_transcode_progress_cb(unsigned long current_position, unsigned long duration, void *user_data); static void __video_util_transcode_completed_cb(int error, void *user_data); static bool __video_util_type_callback(int codec_type, void *user_data); static int __video_util_foreach_supported_type(video_util_type_e type, video_util_supported_type_cb callback, void *user_data); @@ -227,6 +228,19 @@ static video_util_error_e __video_util_error_convert(int error) } } +static void __video_util_transcode_progress_cb(unsigned long current_position, unsigned long duration, void *user_data) +{ + int error_value = VIDEO_UTIL_ERROR_NONE; + video_util_cb_s *_util_cb = (video_util_cb_s *)user_data; + + if((_util_cb != NULL) && (_util_cb->transcode_progress_cb != NULL)) + { + _util_cb->transcode_progress_cb(current_position, duration, _util_cb->user_data); + } + + return; +} + static void __video_util_transcode_completed_cb(int error, void *user_data) { int error_value = VIDEO_UTIL_ERROR_NONE; @@ -729,13 +743,14 @@ int video_util_start_transcoding(video_util_h handle, unsigned long start, unsig video_util_cb_s *_util_cb = (video_util_cb_s*)calloc(1, sizeof(video_util_cb_s)); _util_cb->user_data = user_data; _util_cb->transcode_completed_cb = completed_cb; + _util_cb->transcode_progress_cb = progress_cb; if(_handle->accurate_mode) accurate_mode = MM_SEEK_ACCURATE; else accurate_mode = MM_SEEK_INACCURATE; - 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); + ret = mm_transcode(_handle->transcode_h, _handle->width, _handle->height, _handle->fps, start, duration, accurate_mode, out_path, (mm_transcode_progress_callback)__video_util_transcode_progress_cb, (mm_transcode_completed_callback)__video_util_transcode_completed_cb, (void *)_util_cb); if(ret != MM_ERROR_NONE) { diff --git a/test/video_util_test.c b/test/video_util_test.c index 6290212..9b4f984 100755 --- a/test/video_util_test.c +++ b/test/video_util_test.c @@ -122,7 +122,7 @@ static int test_transcode_do(test_util_s *util_s) char test_output_file_path[128] = {0, }; memset(test_output_file_path, 0x00, sizeof(test_output_file_path)); - snprintf(test_output_file_path, sizeof(test_output_file_path), "/opt/media/Videos/transcode_test_%d.mp4", util_s->idx); + snprintf(test_output_file_path, sizeof(test_output_file_path), "/opt/usr/media/Videos/transcode_test_%d.mp4", util_s->idx); printf("g_start_time[%d] duration[%d] [%s]\n", util_s->start_time, util_s->duration, test_output_file_path); @@ -142,7 +142,13 @@ int main(int argc, char *argv[]) int ret = VIDEO_UTIL_ERROR_NONE; video_util_h video_h = NULL; test_util_s *_util_s = NULL; - char * test_video_file_path = "/opt/usr/media/Videos/Color.mp4"; + int cnt = argc -1; + + if(cnt < 1) + { + printf("type file path plz. [%d]\n", cnt); + return 0; + } ret = video_util_create(&video_h); if(ret != VIDEO_UTIL_ERROR_NONE) @@ -154,7 +160,7 @@ int main(int argc, char *argv[]) supported_spec_check(video_h); #endif - ret = video_util_set_file_path(video_h, test_video_file_path); + ret = video_util_set_file_path(video_h, argv[1]); ret = video_util_set_file_format(video_h, VIDEO_UTIL_FILE_FORMAT_3GP); ret = video_util_set_video_codec(video_h, VIDEO_UTIL_VIDEO_CODEC_MPEG4); ret = video_util_set_audio_codec(video_h, VIDEO_UTIL_AUDIO_CODEC_AAC); -- 2.7.4