Commit 7132d271 authored by Simon Morlat's avatar Simon Morlat

add video snapshot command to linphonec

parent e4a2f0ff
dnl Process this file with autoconf to produce a configure script. dnl Process this file with autoconf to produce a configure script.
AC_INIT([linphone],[3.3.99.5],[linphone-developers@nongnu.org]) AC_INIT([linphone],[3.3.99.6],[linphone-developers@nongnu.org])
AC_CANONICAL_SYSTEM AC_CANONICAL_SYSTEM
AC_CONFIG_SRCDIR([coreapi/linphonecore.c]) AC_CONFIG_SRCDIR([coreapi/linphonecore.c])
......
...@@ -92,6 +92,7 @@ static int lpc_cmd_rtp_no_xmit_on_audio_mute(LinphoneCore *lc, char *args); ...@@ -92,6 +92,7 @@ static int lpc_cmd_rtp_no_xmit_on_audio_mute(LinphoneCore *lc, char *args);
#ifdef VIDEO_ENABLED #ifdef VIDEO_ENABLED
static int lpc_cmd_camera(LinphoneCore *lc, char *args); static int lpc_cmd_camera(LinphoneCore *lc, char *args);
static int lpc_cmd_video_window(LinphoneCore *lc, char *args); static int lpc_cmd_video_window(LinphoneCore *lc, char *args);
static int lpc_cmd_snapshot(LinphoneCore *lc, char *args);
#endif #endif
static int lpc_cmd_states(LinphoneCore *lc, char *args); static int lpc_cmd_states(LinphoneCore *lc, char *args);
static int lpc_cmd_identify(LinphoneCore *lc, char *args); static int lpc_cmd_identify(LinphoneCore *lc, char *args);
...@@ -124,7 +125,7 @@ static LPC_COMMAND *lpc_find_command(const char *name); ...@@ -124,7 +125,7 @@ static LPC_COMMAND *lpc_find_command(const char *name);
void linphonec_out(const char *fmt,...); void linphonec_out(const char *fmt,...);
VideoParams lpc_video_params={-1,-1,-1,-1,TRUE}; VideoParams lpc_video_params={-1,-1,-1,-1,0,TRUE};
/*************************************************************************** /***************************************************************************
...@@ -275,6 +276,9 @@ static LPC_COMMAND advanced_commands[] = { ...@@ -275,6 +276,9 @@ static LPC_COMMAND advanced_commands[] = {
"'vwindow pos <x> <y>': Moves video window to x,y pixel coordinates\n" "'vwindow pos <x> <y>': Moves video window to x,y pixel coordinates\n"
"'vwindow size <width> <height>': Resizes video window" "'vwindow size <width> <height>': Resizes video window"
}, },
{ "snapshot", lpc_cmd_snapshot, "Take a snapshot of currently received video stream",
"'snapshot <file path>': take a snapshot and records it in jpeg format into the supplied path\n"
},
#endif #endif
{ "states", lpc_cmd_states, "Show internal states of liblinphone, registrations and calls, according to linphonecore.h definitions", { "states", lpc_cmd_states, "Show internal states of liblinphone, registrations and calls, according to linphonecore.h definitions",
"'states global': shows global state of liblinphone \n" "'states global': shows global state of liblinphone \n"
...@@ -2201,6 +2205,8 @@ static int lpc_cmd_video_window(LinphoneCore *lc, char *args){ ...@@ -2201,6 +2205,8 @@ static int lpc_cmd_video_window(LinphoneCore *lc, char *args){
char subcommand[64]; char subcommand[64];
int a,b; int a,b;
int err; int err;
if (!args) return 0;
err=sscanf(args,"%s %i %i",subcommand,&a,&b); err=sscanf(args,"%s %i %i",subcommand,&a,&b);
if (err>=1){ if (err>=1){
if (strcmp(subcommand,"pos")==0){ if (strcmp(subcommand,"pos")==0){
...@@ -2219,9 +2225,18 @@ static int lpc_cmd_video_window(LinphoneCore *lc, char *args){ ...@@ -2219,9 +2225,18 @@ static int lpc_cmd_video_window(LinphoneCore *lc, char *args){
}else if (strcmp(subcommand,"hide")==0){ }else if (strcmp(subcommand,"hide")==0){
lpc_video_params.show=FALSE; lpc_video_params.show=FALSE;
lpc_video_params.refresh=TRUE; lpc_video_params.refresh=TRUE;
}else if (strcmp(subcommand,"id")==0){
char envbuf[128];
if (err == 1){
linphonec_out("vwindow id: 0x%x / SDL_WINDOWID='%s'\n",(unsigned int)lpc_video_params.wid, getenv("SDL_WINDOWID"));
return 1;
} else if (err != 2) return 0;
lpc_video_params.wid=a;
snprintf(envbuf, sizeof(envbuf)-1, "SDL_WINDOWID=0x%x", (unsigned int)lpc_video_params.wid);
err = putenv(envbuf);
linphonec_out("vwindow id: 0x%x / SDL_WNIDOWID='%s'\n",(unsigned int)lpc_video_params.wid, getenv("SDL_WINDOWID"));
}else return 0; }else return 0;
} }
return 1; return 1;
} }
#endif #endif
...@@ -2338,6 +2353,17 @@ static int lpc_cmd_camera(LinphoneCore *lc, char *args){ ...@@ -2338,6 +2353,17 @@ static int lpc_cmd_camera(LinphoneCore *lc, char *args){
return 1; return 1;
} }
static int lpc_cmd_snapshot(LinphoneCore *lc, char *args){
LinphoneCall *call;
if (!args) return 0;
call=linphone_core_get_current_call(lc);
if (call!=NULL){
linphone_call_take_video_snapshot (call,args);
linphonec_out("Taking video snaphot in file %s\n", args);
}else linphonec_out("There is no active call.\n");
return 1;
}
#endif #endif
static int lpc_cmd_identify(LinphoneCore *lc, char *args){ static int lpc_cmd_identify(LinphoneCore *lc, char *args){
......
...@@ -99,6 +99,7 @@ typedef struct { ...@@ -99,6 +99,7 @@ typedef struct {
typedef struct { typedef struct {
int x,y,w,h; int x,y,w,h;
unsigned long wid;
bool_t show; bool_t show;
bool_t refresh; bool_t refresh;
} VideoParams; } VideoParams;
......
...@@ -31,6 +31,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ...@@ -31,6 +31,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "mediastreamer2/msvolume.h" #include "mediastreamer2/msvolume.h"
#include "mediastreamer2/msequalizer.h" #include "mediastreamer2/msequalizer.h"
#include "mediastreamer2/msfileplayer.h" #include "mediastreamer2/msfileplayer.h"
#include "mediastreamer2/msjpegwriter.h"
#ifdef VIDEO_ENABLED #ifdef VIDEO_ENABLED
static MSWebCam *get_nowebcam_device(){ static MSWebCam *get_nowebcam_device(){
...@@ -473,6 +474,20 @@ void linphone_call_enable_camera (LinphoneCall *call, bool_t enable){ ...@@ -473,6 +474,20 @@ void linphone_call_enable_camera (LinphoneCall *call, bool_t enable){
#endif #endif
} }
/**
* Take a photo of currently received video and write it into a jpeg file.
**/
int linphone_call_take_video_snapshot(LinphoneCall *call, const char *file){
#ifdef VIDEO_ENABLED
if (call->videostream!=NULL && call->videostream->jpegwriter!=NULL){
return ms_filter_call_method(call->videostream->jpegwriter,MS_JPEG_WRITER_TAKE_SNAPSHOT,(void*)file);
}
ms_warning("Cannot take snapshot: no currently running video stream on this call.");
return -1;
#endif
return -1;
}
/** /**
* *
**/ **/
......
...@@ -3492,6 +3492,7 @@ void linphone_core_stop_dtmf(LinphoneCore *lc){ ...@@ -3492,6 +3492,7 @@ void linphone_core_stop_dtmf(LinphoneCore *lc){
} }
/** /**
* Retrieves the user pointer that was given to linphone_core_new() * Retrieves the user pointer that was given to linphone_core_new()
* *
......
...@@ -225,6 +225,7 @@ int linphone_call_get_duration(const LinphoneCall *call); ...@@ -225,6 +225,7 @@ int linphone_call_get_duration(const LinphoneCall *call);
const LinphoneCallParams * linphone_call_get_current_params(const LinphoneCall *call); const LinphoneCallParams * linphone_call_get_current_params(const LinphoneCall *call);
void linphone_call_enable_camera(LinphoneCall *lc, bool_t enabled); void linphone_call_enable_camera(LinphoneCall *lc, bool_t enabled);
bool_t linphone_call_camera_enabled(const LinphoneCall *lc); bool_t linphone_call_camera_enabled(const LinphoneCall *lc);
int linphone_call_take_video_snapshot(LinphoneCall *call, const char *file);
LinphoneError linphone_call_get_error(const LinphoneCall *call); LinphoneError linphone_call_get_error(const LinphoneCall *call);
const char *linphone_call_get_remote_user_agent(LinphoneCall *call); const char *linphone_call_get_remote_user_agent(LinphoneCall *call);
void *linphone_call_get_user_pointer(LinphoneCall *call); void *linphone_call_get_user_pointer(LinphoneCall *call);
...@@ -837,7 +838,6 @@ void linphone_core_set_record_file(LinphoneCore *lc, const char *file); ...@@ -837,7 +838,6 @@ void linphone_core_set_record_file(LinphoneCore *lc, const char *file);
void linphone_core_play_dtmf(LinphoneCore *lc, char dtmf, int duration_ms); void linphone_core_play_dtmf(LinphoneCore *lc, char dtmf, int duration_ms);
void linphone_core_stop_dtmf(LinphoneCore *lc); void linphone_core_stop_dtmf(LinphoneCore *lc);
int linphone_core_get_current_call_duration(const LinphoneCore *lc); int linphone_core_get_current_call_duration(const LinphoneCore *lc);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment