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 *);
"'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"
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
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.
*