From: Jeongmo Yang Date: Thu, 7 Jan 2016 04:40:19 +0000 (+0900) Subject: [Release version 0.10.27] Remove unused code and dependency X-Git-Tag: accepted/tizen/mobile/20160108.005751^0 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fmultimedia%2Flibmm-camcorder.git;a=commitdiff_plain;h=3e3fcb7eedc07a5c517bc85a74cbd94e961091a7 [Release version 0.10.27] Remove unused code and dependency Change-Id: Ib5f051668ae6c1d4af8d894518ccded60fc0686b Signed-off-by: Jeongmo Yang --- diff --git a/configure.ac b/configure.ac index fc70d0f..72db867 100644 --- a/configure.ac +++ b/configure.ac @@ -94,10 +94,6 @@ PKG_CHECK_MODULES(MMUTIL_JPEG, mmutil-jpeg) AC_SUBST(MMUTIL_JPEG_CFLAGS) AC_SUBST(MMUTIL_JPEG_LIBS) -PKG_CHECK_MODULES(SNDFILE, sndfile) -AC_SUBST(SNDFILE_CFLAGS) -AC_SUBST(SNDFILE_LIBS) - PKG_CHECK_MODULES(VCONF, vconf) AC_SUBST(VCONF_CFLAGS) AC_SUBST(VCONF_LIBS) diff --git a/packaging/libmm-camcorder.spec b/packaging/libmm-camcorder.spec index 179769b..e204b35 100644 --- a/packaging/libmm-camcorder.spec +++ b/packaging/libmm-camcorder.spec @@ -2,7 +2,7 @@ Name: libmm-camcorder Summary: Camera and recorder library -Version: 0.10.26 +Version: 0.10.27 Release: 0 Group: Multimedia/Libraries License: Apache-2.0 @@ -24,7 +24,6 @@ BuildRequires: pkgconfig(gstreamer-app-1.0) BuildRequires: pkgconfig(gstreamer-wayland-1.0) BuildRequires: pkgconfig(wayland-client) %endif -BuildRequires: pkgconfig(sndfile) BuildRequires: pkgconfig(libpulse) BuildRequires: pkgconfig(vconf) BuildRequires: gstreamer-devel diff --git a/src/Makefile.am b/src/Makefile.am index 931c738..8caaa64 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -44,7 +44,6 @@ libmmfcamcorder_la_CFLAGS = -I$(srcdir)/include \ $(EXIF_CFLAGS) \ $(MM_COMMON_CFLAGS) \ $(MMSOUND_CFLAGS) \ - $(SNDFILE_CFLAGS) \ $(VCONF_CFLAGS) \ $(MMUTIL_IMGP_CFLAGS) \ $(MMUTIL_JPEG_CFLAGS) \ @@ -65,7 +64,6 @@ libmmfcamcorder_la_LIBADD = \ $(MM_COMMON_LIBS) \ $(EXIF_LIBS) \ $(MMSOUND_LIBS) \ - $(SNDFILE_LIBS) \ $(VCONF_LIBS) \ $(MMUTIL_IMGP_LIBS) \ $(MMUTIL_JPEG_LIBS) \ diff --git a/src/include/mm_camcorder_internal.h b/src/include/mm_camcorder_internal.h index a5c32fc..37f8ff5 100644 --- a/src/include/mm_camcorder_internal.h +++ b/src/include/mm_camcorder_internal.h @@ -36,7 +36,6 @@ #include #include #include -#include #include #include #include diff --git a/src/include/mm_camcorder_sound.h b/src/include/mm_camcorder_sound.h index 3b148e1..72477a9 100644 --- a/src/include/mm_camcorder_sound.h +++ b/src/include/mm_camcorder_sound.h @@ -63,7 +63,6 @@ typedef enum { */ typedef struct __SOUND_INFO { /* PCM */ - MMSoundPcmHandle_t handle; int volume_type; unsigned int volume_level; @@ -76,20 +75,8 @@ typedef struct __SOUND_INFO { /* pulse audio */ pa_threaded_mainloop *pulse_mainloop; pa_context *pulse_context; - -#ifdef _MMCAMCORDER_UPLOAD_SAMPLE - /* sound file */ - SF_INFO sfinfo; - SNDFILE *infile; - char *filename; - pa_stream *sample_stream; - pa_sample_spec sample_spec; - size_t sample_length; - pa_channel_map channel_map; -#else /* _MMCAMCORDER_UPLOAD_SAMPLE */ pa_stream *sample_stream; pa_sample_spec sample_spec; -#endif /* _MMCAMCORDER_UPLOAD_SAMPLE */ _MMCamcorderSoundState state; } SOUND_INFO; @@ -102,11 +89,7 @@ typedef struct __SOUND_INFO { /*======================================================================================= | GLOBAL FUNCTION PROTOTYPES | ========================================================================================*/ -#ifdef _MMCAMCORDER_UPLOAD_SAMPLE -gboolean _mmcamcorder_sound_init(MMHandleType handle, char *filename); -#else /* _MMCAMCORDER_UPLOAD_SAMPLE */ gboolean _mmcamcorder_sound_init(MMHandleType handle); -#endif /* _MMCAMCORDER_UPLOAD_SAMPLE */ gboolean _mmcamcorder_sound_play(MMHandleType handle, const char *sample_name, gboolean sync_play); gboolean _mmcamcorder_sound_finalize(MMHandleType handle); diff --git a/src/mm_camcorder_sound.c b/src/mm_camcorder_sound.c index c4c89fb..7923f0b 100644 --- a/src/mm_camcorder_sound.c +++ b/src/mm_camcorder_sound.c @@ -99,69 +99,7 @@ static void __pulseaudio_context_state_cb(pa_context *pulse_context, void *user_ return; } -#ifdef _MMCAMCORDER_UPLOAD_SAMPLE -static void __pulseaudio_stream_write_cb(pa_stream *stream, size_t length, void *user_data) -{ - sf_count_t read_length; - short *data; - SOUND_INFO *info = NULL; - - mmf_return_if_fail(user_data); - - info = (SOUND_INFO *)user_data; - - _mmcam_dbg_log("START"); - - data = pa_xmalloc(length); - - read_length = (sf_count_t)(length/pa_frame_size(&(info->sample_spec))); - - if ((sf_readf_short(info->infile, data, read_length)) != read_length) { - pa_xfree(data); - return; - } - - pa_stream_write(stream, data, length, pa_xfree, 0, PA_SEEK_RELATIVE); - - info->sample_length -= length; - - if (info->sample_length <= 0) { - pa_stream_set_write_callback(info->sample_stream, NULL, NULL); - pa_stream_finish_upload(info->sample_stream); - - pa_threaded_mainloop_signal(info->pulse_mainloop, 0); - _mmcam_dbg_log("send signal DONE"); - } - - _mmcam_dbg_log("DONE read_length %d", read_length); - - return; -} - - -static void __pulseaudio_remove_sample_finish_cb(pa_context *pulse_context, int success, void *user_data) -{ - SOUND_INFO *info = NULL; - - mmf_return_if_fail(user_data); - - info = (SOUND_INFO *)user_data; - - _mmcam_dbg_log("START"); - - pa_threaded_mainloop_signal(info->pulse_mainloop, 0); - - _mmcam_dbg_log("DONE"); - - return; -} -#endif /* _MMCAMCORDER_UPLOAD_SAMPLE */ - -#ifdef _MMCAMCORDER_UPLOAD_SAMPLE -gboolean _mmcamcorder_sound_init(MMHandleType handle, char *filename) -#else /* _MMCAMCORDER_UPLOAD_SAMPLE */ gboolean _mmcamcorder_sound_init(MMHandleType handle) -#endif /* _MMCAMCORDER_UPLOAD_SAMPLE */ { int ret = 0; int sound_enable = TRUE; @@ -192,32 +130,9 @@ gboolean _mmcamcorder_sound_init(MMHandleType handle) return TRUE; } -#ifdef _MMCAMCORDER_UPLOAD_SAMPLE - if (info->filename) { - free(info->filename); - info->filename = NULL; - } - - info->filename = strdup(filename); - if (info->filename == NULL) { - _mmcam_dbg_err("strdup failed"); - return FALSE; - } -#endif /* _MMCAMCORDER_UPLOAD_SAMPLE */ - pthread_mutex_init(&(info->play_mutex), NULL); pthread_cond_init(&(info->play_cond), NULL); -#ifdef _MMCAMCORDER_UPLOAD_SAMPLE - /* read sample */ - memset (&(info->sfinfo), 0, sizeof(SF_INFO)); - info->infile = sf_open(info->filename, SFM_READ, &(info->sfinfo)); - if (!(info->infile)) { - _mmcam_dbg_err("Failed to open sound file"); - goto SOUND_INIT_ERROR; - } -#endif /* _MMCAMCORDER_UPLOAD_SAMPLE */ - /** * Init Pulseaudio thread */ @@ -286,44 +201,6 @@ gboolean _mmcamcorder_sound_init(MMHandleType handle) /* unlock pulseaudio thread */ pa_threaded_mainloop_unlock(info->pulse_mainloop); -#ifdef _MMCAMCORDER_UPLOAD_SAMPLE - /** - * Upload sample - */ - if (pa_sndfile_read_sample_spec(info->infile, &(info->sample_spec)) < 0) { - _mmcam_dbg_err("Failed to determine sample specification from file"); - goto SOUND_INIT_ERROR; - } - - info->sample_spec.format = PA_SAMPLE_S16LE; - - if (pa_sndfile_read_channel_map(info->infile, &(info->channel_map)) < 0) { - pa_channel_map_init_extend(&(info->channel_map), info->sample_spec.channels, PA_CHANNEL_MAP_DEFAULT); - - if (info->sample_spec.channels > 2) { - _mmcam_dbg_warn("Failed to determine sample specification from file"); - } - } - - info->sample_length = (size_t)info->sfinfo.frames * pa_frame_size(&(info->sample_spec)); - - pa_threaded_mainloop_lock(info->pulse_mainloop); - - /* prepare uploading */ - info->sample_stream = pa_stream_new(info->pulse_context, SAMPLE_SOUND_NAME, &(info->sample_spec), NULL); - /* set stream write callback */ - pa_stream_set_write_callback(info->sample_stream, __pulseaudio_stream_write_cb, info); - /* upload sample (ASYNC) */ - pa_stream_connect_upload(info->sample_stream, info->sample_length); - /* wait for upload completion */ - pa_threaded_mainloop_wait(info->pulse_mainloop); - - pa_threaded_mainloop_unlock(info->pulse_mainloop); - - /* close sndfile */ - sf_close(info->infile); - info->infile = NULL; -#else /* _MMCAMCORDER_UPLOAD_SAMPLE */ if (info->sample_stream) { pa_stream_connect_playback(info->sample_stream, NULL, NULL, 0, NULL, NULL); @@ -345,7 +222,6 @@ gboolean _mmcamcorder_sound_init(MMHandleType handle) pa_threaded_mainloop_wait(info->pulse_mainloop); } } -#endif /* _MMCAMCORDER_UPLOAD_SAMPLE */ //info->volume_type = PA_TIZEN_AUDIO_VOLUME_TYPE_FIXED; info->volume_level = 0; @@ -359,42 +235,18 @@ gboolean _mmcamcorder_sound_init(MMHandleType handle) return TRUE; SOUND_INIT_ERROR: - -#ifdef _MMCAMCORDER_UPLOAD_SAMPLE - /** - * Release allocated resources - */ - if (info->filename) { - free(info->filename); - info->filename = NULL; - } -#endif /* _MMCAMCORDER_UPLOAD_SAMPLE */ - /* remove pulse mainloop */ if (info->pulse_mainloop) { pa_threaded_mainloop_lock(info->pulse_mainloop); /* remove pulse context */ if (info->pulse_context) { -#ifdef _MMCAMCORDER_UPLOAD_SAMPLE - /* remove uploaded sample */ - if (info->sample_stream) { - pa_threaded_mainloop_lock(info->pulse_mainloop); - - /* Remove sample (ASYNC) */ - pa_operation_unref(pa_context_remove_sample(info->pulse_context, SAMPLE_SOUND_NAME, __pulseaudio_remove_sample_finish_cb, info)); - - /* Wait for async operation */ - pa_threaded_mainloop_wait(info->pulse_mainloop); - } -#else /* _MMCAMCORDER_UPLOAD_SAMPLE */ /* release sample stream */ if (info->sample_stream) { pa_stream_disconnect(info->sample_stream); pa_stream_unref(info->sample_stream); info->sample_stream = NULL; } -#endif /* _MMCAMCORDER_UPLOAD_SAMPLE */ /* Make sure we don't get any further callbacks */ pa_context_set_state_callback(info->pulse_context, NULL, NULL); @@ -424,7 +276,9 @@ SOUND_INIT_ERROR: gboolean _mmcamcorder_sound_play(MMHandleType handle, const char *sample_name, gboolean sync_play) { int sound_enable = TRUE; +/* int gain_type = VOLUME_GAIN_SHUTTER1; +*/ mmf_camcorder_t *hcamcorder = MMF_CAMCORDER(handle); SOUND_INFO *info = NULL; @@ -454,11 +308,13 @@ gboolean _mmcamcorder_sound_play(MMHandleType handle, const char *sample_name, g return FALSE; } +/* if (!strcmp(sample_name, _MMCAMCORDER_SAMPLE_SOUND_NAME_CAPTURE)) { gain_type = VOLUME_GAIN_SHUTTER2; } else if (!strcmp(sample_name, _MMCAMCORDER_SAMPLE_SOUND_NAME_REC_STOP)) { gain_type = VOLUME_GAIN_CAMCORDING; } +*/ _mmcam_dbg_log("Play start - sample name [%s]", sample_name); @@ -526,24 +382,11 @@ gboolean _mmcamcorder_sound_finalize(MMHandleType handle) pa_threaded_mainloop_lock(info->pulse_mainloop); -#ifdef _MMCAMCORDER_UPLOAD_SAMPLE - /** - * Remove sample - */ - _mmcam_dbg_log("remove sample"); - - /* Remove sample (ASYNC) */ - pa_operation_unref(pa_context_remove_sample(info->pulse_context, SAMPLE_SOUND_NAME, __pulseaudio_remove_sample_finish_cb, info)); - - /* Wait for async operation */ - pa_threaded_mainloop_wait(info->pulse_mainloop); -#else /* _MMCAMCORDER_UPLOAD_SAMPLE */ if (info->sample_stream) { pa_stream_disconnect(info->sample_stream); pa_stream_unref(info->sample_stream); info->sample_stream = NULL; } -#endif /* _MMCAMCORDER_UPLOAD_SAMPLE */ /** * Release pulseaudio thread @@ -564,13 +407,6 @@ gboolean _mmcamcorder_sound_finalize(MMHandleType handle) pa_threaded_mainloop_free(info->pulse_mainloop); info->pulse_mainloop = NULL; -#ifdef _MMCAMCORDER_UPLOAD_SAMPLE - if (info->filename) { - free(info->filename); - info->filename = NULL; - } -#endif /* _MMCAMCORDER_UPLOAD_SAMPLE */ - info->state = _MMCAMCORDER_SOUND_STATE_NONE; /* release mutex and cond */ diff --git a/src/mm_camcorder_stillshot.c b/src/mm_camcorder_stillshot.c index d67f67e..da9edc3 100644 --- a/src/mm_camcorder_stillshot.c +++ b/src/mm_camcorder_stillshot.c @@ -335,11 +335,7 @@ int _mmcamcorder_image_cmd_capture(MMHandleType handle) info->multi_shot_stop = FALSE; /* sound init to pause other session */ -#ifdef _MMCAMCORDER_UPLOAD_SAMPLE - _mmcamcorder_sound_init(handle, _MMCAMCORDER_FILEPATH_CAPTURE2_SND); -#else /* _MMCAMCORDER_UPLOAD_SAMPLE */ _mmcamcorder_sound_init(handle); -#endif /* _MMCAMCORDER_UPLOAD_SAMPLE */ } _mmcam_dbg_log("preview(%dx%d,fmt:%d), capture(%dx%d,fmt:%d), count(%d), hdr mode(%d), interval (%d)", diff --git a/src/mm_camcorder_videorec.c b/src/mm_camcorder_videorec.c index d17c89d..69565ab 100644 --- a/src/mm_camcorder_videorec.c +++ b/src/mm_camcorder_videorec.c @@ -1115,11 +1115,7 @@ int _mmcamcorder_video_handle_eos(MMHandleType handle) } else { _mmcam_dbg_warn("Play stop sound through pulseaudio"); -#ifdef _MMCAMCORDER_UPLOAD_SAMPLE - _mmcamcorder_sound_init(handle, _MMCAMCORDER_FILEPATH_REC_STOP_SND); -#else /* _MMCAMCORDER_UPLOAD_SAMPLE */ _mmcamcorder_sound_init(handle); -#endif /* _MMCAMCORDER_UPLOAD_SAMPLE */ _mmcamcorder_sound_play((MMHandleType)hcamcorder, _MMCAMCORDER_SAMPLE_SOUND_NAME_REC_STOP, TRUE);