mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-20 12:38:09 +00:00
Added linphone_core_take_preview_snapshot method
This commit is contained in:
parent
6f48b4151c
commit
9eacaae8a6
3 changed files with 47 additions and 1 deletions
|
|
@ -38,6 +38,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
#include "mediastreamer2/msvolume.h"
|
||||
#include "mediastreamer2/msequalizer.h"
|
||||
#include "mediastreamer2/dtmfgen.h"
|
||||
#include "mediastreamer2/msjpegwriter.h"
|
||||
|
||||
#ifdef INET6
|
||||
#ifndef _WIN32
|
||||
|
|
@ -5356,6 +5357,42 @@ void linphone_core_migrate_logs_from_rc_to_db(LinphoneCore *lc) {
|
|||
* Video related functions *
|
||||
******************************************************************************/
|
||||
|
||||
static void snapshot_taken(void *userdata, struct _MSFilter *f, unsigned int id, void *arg) {
|
||||
if (id == MS_JPEG_WRITER_SNAPSHOT_TAKEN) {
|
||||
LinphoneCore *lc = (LinphoneCore *)userdata;
|
||||
ms_filter_remove_notify_callback(lc->previewstream->local_jpegwriter, snapshot_taken, lc);
|
||||
linphone_core_enable_video_preview(lc, FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
int linphone_core_take_preview_snapshot(LinphoneCore *lc, const char *file) {
|
||||
LinphoneCall *call = linphone_core_get_current_call(lc);
|
||||
|
||||
if (!file) return -1;
|
||||
#ifdef VIDEO_ENABLED
|
||||
if (call) {
|
||||
return linphone_call_take_preview_snapshot(call, file);
|
||||
} else {
|
||||
if (lc->previewstream == NULL) {
|
||||
MSVideoSize vsize=lc->video_conf.preview_vsize.width != 0 ? lc->video_conf.preview_vsize : lc->video_conf.vsize;
|
||||
lc->previewstream = video_preview_new(lc->factory);
|
||||
video_preview_set_size(lc->previewstream, vsize);
|
||||
video_preview_set_display_filter_name(lc->previewstream, NULL);
|
||||
video_preview_set_fps(lc->previewstream,linphone_core_get_preferred_framerate(lc));
|
||||
video_preview_start(lc->previewstream, lc->video_conf.device);
|
||||
lc->previewstream->ms.factory = lc->factory;
|
||||
linphone_core_enable_video_preview(lc, TRUE);
|
||||
|
||||
ms_filter_add_notify_callback(lc->previewstream->local_jpegwriter, snapshot_taken, lc, TRUE);
|
||||
ms_filter_call_method(lc->previewstream->local_jpegwriter, MS_JPEG_WRITER_TAKE_SNAPSHOT, (void*)file);
|
||||
} else {
|
||||
ms_filter_call_method(lc->previewstream->local_jpegwriter, MS_JPEG_WRITER_TAKE_SNAPSHOT, (void*)file);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
return -1;
|
||||
}
|
||||
|
||||
static void toggle_video_preview(LinphoneCore *lc, bool_t val){
|
||||
#ifdef VIDEO_ENABLED
|
||||
|
|
|
|||
|
|
@ -3609,6 +3609,15 @@ LINPHONE_PUBLIC void linphone_core_set_preferred_framerate(LinphoneCore *lc, flo
|
|||
**/
|
||||
LINPHONE_PUBLIC float linphone_core_get_preferred_framerate(LinphoneCore *lc);
|
||||
LINPHONE_PUBLIC void linphone_core_enable_video_preview(LinphoneCore *lc, bool_t val);
|
||||
/**
|
||||
* Take a photo of currently from capture device and write it into a jpeg file.
|
||||
* Note that the snapshot is asynchronous, an application shall not assume that the file is created when the function returns.
|
||||
* @ingroup misc
|
||||
* @param lc the linphone core
|
||||
* @param file a path where to write the jpeg content.
|
||||
* @return 0 if successfull, -1 otherwise (typically if jpeg format is not supported).
|
||||
**/
|
||||
LINPHONE_PUBLIC int linphone_core_take_preview_snapshot(LinphoneCore *lc, const char *file);
|
||||
LINPHONE_PUBLIC bool_t linphone_core_video_preview_enabled(const LinphoneCore *lc);
|
||||
|
||||
LINPHONE_PUBLIC void linphone_core_enable_self_view(LinphoneCore *lc, bool_t val);
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
Subproject commit 64c7fbaa469825f81baf1afe5c3e569483b987c2
|
||||
Subproject commit 6921d8748f9f1002f7da24922569a5e2b120376d
|
||||
Loading…
Add table
Reference in a new issue