Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
BC
public
liblinphone
Commits
9eacaae8
Commit
9eacaae8
authored
Apr 13, 2016
by
Sylvain Berfini
🎩
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added linphone_core_take_preview_snapshot method
parent
6f48b415
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
47 additions
and
1 deletion
+47
-1
coreapi/linphonecore.c
coreapi/linphonecore.c
+37
-0
coreapi/linphonecore.h
coreapi/linphonecore.h
+9
-0
mediastreamer2
mediastreamer2
+1
-1
No files found.
coreapi/linphonecore.c
View file @
9eacaae8
...
...
@@ -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
...
...
coreapi/linphonecore.h
View file @
9eacaae8
...
...
@@ -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
);
...
...
mediastreamer2
@
6921d874
Subproject commit 6
4c7fbaa469825f81baf1afe5c3e569483b987c2
Subproject commit 6
921d8748f9f1002f7da24922569a5e2b120376d
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment