mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-05-07 05:53:06 +00:00
merge patch that add new "webcam" command to linphonec + setting of the static picture.
This commit is contained in:
parent
a2f7044f34
commit
5f045a0c4c
5 changed files with 124 additions and 1 deletions
|
|
@ -65,6 +65,8 @@ static int lpc_cmd_stun(LinphoneCore *, char *);
|
|||
static int lpc_cmd_firewall(LinphoneCore *, char *);
|
||||
static int lpc_cmd_friend(LinphoneCore *, char*);
|
||||
static int lpc_cmd_soundcard(LinphoneCore *, char *);
|
||||
static int lpc_cmd_webcam(LinphoneCore *, char *);
|
||||
static int lpc_cmd_staticpic(LinphoneCore *, char *);
|
||||
static int lpc_cmd_play(LinphoneCore *, char *);
|
||||
static int lpc_cmd_record(LinphoneCore *, char *);
|
||||
static int lpc_cmd_register(LinphoneCore *, char *);
|
||||
|
|
@ -144,6 +146,13 @@ LPC_COMMAND commands[] = {
|
|||
"'soundcard use <index>' : select a sound device.\n"
|
||||
"'soundcard use files' : use .wav files instead of soundcard\n"
|
||||
},
|
||||
{ "webcam", lpc_cmd_webcam, "Manage webcams",
|
||||
"'webcam list' : list all known devices.\n"
|
||||
"'webcam use <index>' : select a video device.\n"
|
||||
},
|
||||
{ "staticpic", lpc_cmd_staticpic, "Manage static pictures when nowebcam",
|
||||
"'staticpic set' : Set path to picture that should be used.\n"
|
||||
},
|
||||
{ "ipv6", lpc_cmd_ipv6, "Use IPV6",
|
||||
"'ipv6 status' : show ipv6 usage status.\n"
|
||||
"'ipv6 enable' : enable the use of the ipv6 network.\n"
|
||||
|
|
@ -948,6 +957,79 @@ static int lpc_cmd_soundcard(LinphoneCore *lc, char *args)
|
|||
return 0; /* syntax error */
|
||||
}
|
||||
|
||||
static int lpc_cmd_webcam(LinphoneCore *lc, char *args)
|
||||
{
|
||||
int i, index;
|
||||
const char **dev;
|
||||
char *arg1 = args;
|
||||
char *arg2 = NULL;
|
||||
char *ptr = args;
|
||||
|
||||
if (!args) return 0; /* syntax error */
|
||||
|
||||
/* Isolate first and second arg */
|
||||
while(*ptr && !isspace(*ptr)) ++ptr;
|
||||
if ( *ptr )
|
||||
{
|
||||
*ptr='\0';
|
||||
arg2=ptr+1;
|
||||
while(*arg2 && isspace(*arg2)) ++arg2;
|
||||
}
|
||||
|
||||
if (strcmp(arg1, "list")==0)
|
||||
{
|
||||
dev=linphone_core_get_video_devices(lc);
|
||||
for(i=0; dev[i]!=NULL; ++i){
|
||||
linphonec_out("%i: %s\n",i,dev[i]);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (strcmp(arg1, "use")==0 && arg2)
|
||||
{
|
||||
dev=linphone_core_get_video_devices(lc);
|
||||
index=atoi(arg2); /* FIXME: handle not-a-number */
|
||||
for(i=0;dev[i]!=NULL;i++)
|
||||
{
|
||||
if (i!=index) continue;
|
||||
|
||||
linphone_core_set_video_device(lc, dev[i]);
|
||||
linphonec_out("Using video device %s\n",dev[i]);
|
||||
return 1;
|
||||
}
|
||||
linphonec_out("No such video device\n");
|
||||
return 1;
|
||||
}
|
||||
return 0; /* syntax error */
|
||||
}
|
||||
|
||||
static int
|
||||
lpc_cmd_staticpic(LinphoneCore *lc, char *args)
|
||||
{
|
||||
char *arg1 = args;
|
||||
char *arg2 = NULL;
|
||||
char *ptr = args;
|
||||
|
||||
if (!args) return 0; /* Syntax error */
|
||||
|
||||
/* Isolate first and second arg */
|
||||
while(*ptr && !isspace(*ptr)) ++ptr;
|
||||
if ( *ptr )
|
||||
{
|
||||
*ptr='\0';
|
||||
arg2=ptr+1;
|
||||
while(*arg2 && isspace(*arg2)) ++arg2;
|
||||
}
|
||||
|
||||
if (strcmp(arg1, "set")==0 && arg2) {
|
||||
return linphone_core_set_static_picture(lc, arg2);
|
||||
}
|
||||
|
||||
return 0; /* Syntax error */
|
||||
}
|
||||
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
*
|
||||
* Commands helper functions
|
||||
|
|
|
|||
|
|
@ -513,6 +513,15 @@ char *linphonec_readline(char *prompt){
|
|||
linphonec_idle_call();
|
||||
#ifdef WIN32
|
||||
Sleep(20);
|
||||
/* Following is to get the video window going as it
|
||||
should. Maybe should we only have this on when the option -V
|
||||
or -D is on? */
|
||||
MSG msg;
|
||||
|
||||
if (PeekMessage(&msg, NULL, 0, 0,1)) {
|
||||
TranslateMessage(&msg);
|
||||
DispatchMessage(&msg);
|
||||
}
|
||||
#else
|
||||
usleep(20000);
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -3128,6 +3128,35 @@ const char *linphone_core_get_video_device(const LinphoneCore *lc){
|
|||
return NULL;
|
||||
}
|
||||
|
||||
int linphone_core_set_static_picture(LinphoneCore *lc, const char *path) {
|
||||
struct _VideoStream *vs = NULL;
|
||||
|
||||
/* Select the video stream from the call in the first place */
|
||||
if (lc && lc->videostream) {
|
||||
vs = lc->videostream;
|
||||
}
|
||||
/* If not in call, select the video stream from the preview */
|
||||
if (vs == NULL && lc && lc->previewstream) {
|
||||
vs = lc->previewstream;
|
||||
}
|
||||
|
||||
/* If we have a video stream (either preview, either from call), we
|
||||
have a source and it is using the static picture filter, then
|
||||
force the filter to use that picture. */
|
||||
if (vs && vs->source) {
|
||||
if (ms_filter_get_id(vs->source) == MS_STATIC_IMAGE_ID) {
|
||||
ms_filter_call_method(vs->source, MS_FILTER_SET_IMAGE,
|
||||
(void *)path);
|
||||
}
|
||||
}
|
||||
|
||||
/* Tell the static image filter to use that image from now on so
|
||||
that the image will be used next time it has to be read */
|
||||
ms_static_image_set_default_image(path);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the native window handle of the video window, casted as an unsigned long.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -898,6 +898,9 @@ const char** linphone_core_get_video_devices(const LinphoneCore *lc);
|
|||
int linphone_core_set_video_device(LinphoneCore *lc, const char *id);
|
||||
const char *linphone_core_get_video_device(const LinphoneCore *lc);
|
||||
|
||||
/* Set static picture to be used when "Static picture" is the video device */
|
||||
int linphone_core_set_static_picture(LinphoneCore *lc, const char *path);
|
||||
|
||||
/*function to be used for eventually setting window decorations (icons, title...)*/
|
||||
unsigned long linphone_core_get_native_video_window_id(const LinphoneCore *lc);
|
||||
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
Subproject commit 5bcbcae29d9cf6d22b4f6880489eafa98e100008
|
||||
Subproject commit 705c57139cd2e3a7e2268dbdbe6a1c4e34392663
|
||||
Loading…
Add table
Reference in a new issue