Index: pjproject/branches/projects/2.0-dev/pjsip-apps/src/pjsua/pjsua_app.c
===================================================================
--- pjproject/branches/projects/2.0-dev/pjsip-apps/src/pjsua/pjsua_app.c	(revision 3457)
+++ pjproject/branches/projects/2.0-dev/pjsip-apps/src/pjsua/pjsua_app.c	(revision 3472)
@@ -125,4 +125,5 @@
     pjmedia_port	   *ring_port;
 
+    int			    vcapture_dev, vrender_dev;
 } app_config;
 
@@ -304,7 +305,11 @@
     puts  ("  --extra-audio       Add one more audio stream");
 
+#if PJMEDIA_HAS_VIDEO
     puts  ("");
     puts  ("Video Options:");
     puts  ("  --video             Enable video");
+    puts  ("  --vcapture-dev=id   Video capture device ID (default=-1)");
+    puts  ("  --vrender-dev=id    Video render device ID (default=-1)");
+#endif
 
     puts  ("");
@@ -381,4 +386,7 @@
     for (i=0; i<PJ_ARRAY_SIZE(cfg->buddy_cfg); ++i)
 	pjsua_buddy_config_default(&cfg->buddy_cfg[i]);
+
+    cfg->vcapture_dev = PJSUA_INVALID_ID;
+    cfg->vrender_dev = PJSUA_INVALID_ID;
 }
 
@@ -547,5 +555,6 @@
 	   OPT_NO_FORCE_LR,
 	   OPT_TIMER, OPT_TIMER_SE, OPT_TIMER_MIN_SE,
-	   OPT_VIDEO, OPT_EXTRA_AUDIO
+	   OPT_VIDEO, OPT_EXTRA_AUDIO,
+	   OPT_VCAPTURE_DEV, OPT_VRENDER_DEV,
     };
     struct pj_getopt_option long_options[] = {
@@ -668,4 +677,6 @@
 	{ "video",	0, 0, OPT_VIDEO},
 	{ "extra-audio",0, 0, OPT_EXTRA_AUDIO},
+	{ "vcapture-dev", 1, 0, OPT_VCAPTURE_DEV},
+	{ "vrender-dev",  1, 0, OPT_VRENDER_DEV},
 	{ NULL, 0, 0, 0}
     };
@@ -1431,4 +1442,13 @@
 	    ++cur_acc->max_audio_cnt;
 	    break;
+
+	case OPT_VCAPTURE_DEV:
+	    cfg->vcapture_dev = atoi(pj_optarg);
+	    break;
+
+	case OPT_VRENDER_DEV:
+	    cfg->vrender_dev = atoi(pj_optarg);
+	    break;
+
 	default:
 	    PJ_LOG(1,(THIS_FILE, 
@@ -2007,4 +2027,12 @@
     }
 
+    if (config->vcapture_dev != PJSUA_INVALID_ID) {
+	pj_ansi_sprintf(line, "--vcapture-dev %d\n", config->vcapture_dev);
+	pj_strcat2(&cfg, line);
+    }
+    if (config->vrender_dev != PJSUA_INVALID_ID) {
+	pj_ansi_sprintf(line, "--vrender-dev %d\n", config->vrender_dev);
+	pj_strcat2(&cfg, line);
+    }
 
     /* ptime */
@@ -3215,5 +3243,5 @@
     puts("| dq  Dump curr. call quality  | cd  Disconnect port      | dc  Dump config   |");
     puts("|                              |  V  Adjust audio Volume  |  f  Save config   |");
-    puts("|  S  Send arbitrary REQUEST   | Cp  Codec priorities     |  f  Save config   |");
+    puts("|  S  Send arbitrary REQUEST   | Cp  Codec priorities     |                   |");
     puts("+------------------------------+--------------------------+-------------------+");
     puts("|  q  QUIT   L  ReLoad   sleep MS   echo [0|1|txt]     n: detect NAT type     |");
@@ -3503,6 +3531,5 @@
     pj_status_t status;
 
-    printf("List of codecs:\n");
-
+    printf("List of audio codecs:\n");
     pjsua_enum_codecs(c, &count);
     for (i=0; i<count; ++i) {
@@ -3511,7 +3538,17 @@
     }
 
+#if PJMEDIA_HAS_VIDEO
     puts("");
-    puts("Enter codec id and its new priority "
-	 "(e.g. \"speex/16000 200\"), empty to cancel:");
+    printf("List of video codecs:\n");
+    pjsua_vid_enum_codecs(c, &count);
+    for (i=0; i<count; ++i) {
+	printf("  %d\t%.*s\n", c[i].priority, (int)c[i].codec_id.slen,
+			       c[i].codec_id.ptr);
+    }
+#endif
+
+    puts("");
+    puts("Enter codec id and its new priority (e.g. \"speex/16000 200\", ""\"H263 200\"),");
+    puts("or empty to cancel.");
 
     printf("Codec name (\"*\" for all) and priority: ");
@@ -3539,4 +3576,10 @@
     status = pjsua_codec_set_priority(pj_cstr(&id, codec), 
 				      (pj_uint8_t)new_prio);
+#if PJMEDIA_HAS_VIDEO
+    if (status != PJ_SUCCESS) {
+	status = pjsua_vid_codec_set_priority(pj_cstr(&id, codec), 
+					      (pj_uint8_t)new_prio);
+    }
+#endif
     if (status != PJ_SUCCESS)
 	pjsua_perror(THIS_FILE, "Error setting codec priority", status);
@@ -4970,4 +5013,7 @@
     for (i=0; i<app_config.codec_dis_cnt; ++i) {
 	pjsua_codec_set_priority(&app_config.codec_dis[i],PJMEDIA_CODEC_PRIO_DISABLED);
+#if PJMEDIA_HAS_VIDEO
+	pjsua_vid_codec_set_priority(&app_config.codec_dis[i],PJMEDIA_CODEC_PRIO_DISABLED);
+#endif
     }
 
@@ -4976,4 +5022,8 @@
 	pjsua_codec_set_priority(&app_config.codec_arg[i],
 				 (pj_uint8_t)(PJMEDIA_CODEC_PRIO_NORMAL+i+9));
+#if PJMEDIA_HAS_VIDEO
+	pjsua_vid_codec_set_priority(&app_config.codec_arg[i],
+				     (pj_uint8_t)(PJMEDIA_CODEC_PRIO_NORMAL+i+9));
+#endif
     }
 
@@ -5010,4 +5060,15 @@
 	    goto on_error;
     }
+
+#if PJMEDIA_HAS_VIDEO
+    if (app_config.vcapture_dev != PJSUA_INVALID_ID ||
+        app_config.vrender_dev  != PJSUA_INVALID_ID) 
+    {
+	status = pjsua_vid_set_dev(app_config.vcapture_dev, 
+				   app_config.vrender_dev);
+	if (status != PJ_SUCCESS)
+	    goto on_error;
+    }
+#endif
 
     return PJ_SUCCESS;
