Index: /pjproject/trunk/pjmedia/src/pjmedia-codec/ffmpeg_codecs.c
===================================================================
--- /pjproject/trunk/pjmedia/src/pjmedia-codec/ffmpeg_codecs.c	(revision 3666)
+++ /pjproject/trunk/pjmedia/src/pjmedia-codec/ffmpeg_codecs.c	(revision 3667)
@@ -32,7 +32,9 @@
 
 /*
- * Only build this file if PJMEDIA_HAS_FFMPEG_CODEC != 0
- */
-#if defined(PJMEDIA_HAS_FFMPEG_CODEC) && PJMEDIA_HAS_FFMPEG_CODEC != 0
+ * Only build this file if PJMEDIA_HAS_FFMPEG_CODEC != 0 and 
+ * PJMEDIA_HAS_VIDEO != 0
+ */
+#if defined(PJMEDIA_HAS_FFMPEG_CODEC) && PJMEDIA_HAS_FFMPEG_CODEC != 0 && \
+    defined(PJMEDIA_HAS_VIDEO) && (PJMEDIA_HAS_VIDEO != 0)
 
 #define THIS_FILE   "ffmpeg_codecs.c"
Index: /pjproject/trunk/pjmedia/src/pjmedia-codec/h263_packetizer.c
===================================================================
--- /pjproject/trunk/pjmedia/src/pjmedia-codec/h263_packetizer.c	(revision 3666)
+++ /pjproject/trunk/pjmedia/src/pjmedia-codec/h263_packetizer.c	(revision 3667)
@@ -22,4 +22,8 @@
 #include <pj/errno.h>
 #include <pj/string.h>
+
+
+#if defined(PJMEDIA_HAS_VIDEO) && (PJMEDIA_HAS_VIDEO != 0)
+
 
 #define THIS_FILE	"h263_packetizer.c"
@@ -286,2 +290,5 @@
     return PJ_SUCCESS;
 }
+
+
+#endif /* PJMEDIA_HAS_VIDEO */
Index: /pjproject/trunk/pjmedia/src/pjmedia-codec/h264_packetizer.c
===================================================================
--- /pjproject/trunk/pjmedia/src/pjmedia-codec/h264_packetizer.c	(revision 3666)
+++ /pjproject/trunk/pjmedia/src/pjmedia-codec/h264_packetizer.c	(revision 3667)
@@ -25,4 +25,8 @@
 #include <pj/string.h>
 
+
+#if defined(PJMEDIA_HAS_VIDEO) && (PJMEDIA_HAS_VIDEO != 0)
+
+
 #define THIS_FILE		"h264_packetizer.c"
 
@@ -529,2 +533,5 @@
     return PJ_SUCCESS;
 }
+
+
+#endif /* PJMEDIA_HAS_VIDEO */
Index: /pjproject/trunk/pjmedia/src/pjmedia-videodev/colorbar_dev.c
===================================================================
--- /pjproject/trunk/pjmedia/src/pjmedia-videodev/colorbar_dev.c	(revision 3666)
+++ /pjproject/trunk/pjmedia/src/pjmedia-videodev/colorbar_dev.c	(revision 3667)
@@ -23,5 +23,8 @@
 #include <pj/rand.h>
 
-#if PJMEDIA_VIDEO_DEV_HAS_CBAR_SRC
+
+#if defined(PJMEDIA_VIDEO_DEV_HAS_CBAR_SRC) && \
+    PJMEDIA_VIDEO_DEV_HAS_CBAR_SRC != 0
+
 
 #define THIS_FILE		"colorbar_dev.c"
Index: /pjproject/trunk/pjmedia/src/pjmedia-videodev/dshow_dev.c
===================================================================
--- /pjproject/trunk/pjmedia/src/pjmedia-videodev/dshow_dev.c	(revision 3666)
+++ /pjproject/trunk/pjmedia/src/pjmedia-videodev/dshow_dev.c	(revision 3667)
@@ -23,5 +23,7 @@
 #include <pj/unicode.h>
 
-#if PJMEDIA_VIDEO_DEV_HAS_DSHOW
+
+#if defined(PJMEDIA_VIDEO_DEV_HAS_DSHOW) && PJMEDIA_VIDEO_DEV_HAS_DSHOW != 0
+
 
 #ifdef _MSC_VER
Index: /pjproject/trunk/pjmedia/src/pjmedia-videodev/dshowclasses.cpp
===================================================================
--- /pjproject/trunk/pjmedia/src/pjmedia-videodev/dshowclasses.cpp	(revision 3666)
+++ /pjproject/trunk/pjmedia/src/pjmedia-videodev/dshowclasses.cpp	(revision 3667)
@@ -20,5 +20,7 @@
 #include <pjmedia-videodev/config.h>
 
-#if PJMEDIA_VIDEO_DEV_HAS_DSHOW
+
+#if defined(PJMEDIA_VIDEO_DEV_HAS_DSHOW) && PJMEDIA_VIDEO_DEV_HAS_DSHOW != 0
+
 
 #include <assert.h>
@@ -243,3 +245,4 @@
 }
 
+
 #endif	/* PJMEDIA_VIDEO_DEV_HAS_DSHOW */
Index: /pjproject/trunk/pjmedia/src/pjmedia-videodev/errno.c
===================================================================
--- /pjproject/trunk/pjmedia/src/pjmedia-videodev/errno.c	(revision 3666)
+++ /pjproject/trunk/pjmedia/src/pjmedia-videodev/errno.c	(revision 3667)
@@ -25,4 +25,8 @@
  * Message must be limited to 64 chars!
  */
+
+
+#if defined(PJMEDIA_HAS_VIDEO) && (PJMEDIA_HAS_VIDEO != 0)
+
 
 #if defined(PJ_HAS_ERROR_STRING) && (PJ_HAS_ERROR_STRING != 0)
@@ -111,2 +115,5 @@
     return errstr;
 }
+
+
+#endif /* PJMEDIA_HAS_VIDEO */
Index: /pjproject/trunk/pjmedia/src/pjmedia-videodev/ffmpeg_dev.c
===================================================================
--- /pjproject/trunk/pjmedia/src/pjmedia-videodev/ffmpeg_dev.c	(revision 3666)
+++ /pjproject/trunk/pjmedia/src/pjmedia-videodev/ffmpeg_dev.c	(revision 3667)
@@ -38,5 +38,7 @@
 #include <pj/unicode.h>
 
-#if PJMEDIA_VIDEO_DEV_HAS_FFMPEG
+
+#if defined(PJMEDIA_VIDEO_DEV_HAS_FFMPEG) && PJMEDIA_VIDEO_DEV_HAS_FFMPEG != 0
+
 
 #define THIS_FILE		"ffmpeg.c"
@@ -512,3 +514,4 @@
 #endif
 
+
 #endif	/* PJMEDIA_VIDEO_DEV_HAS_FFMPEG */
Index: /pjproject/trunk/pjmedia/src/pjmedia-videodev/sdl_dev.c
===================================================================
--- /pjproject/trunk/pjmedia/src/pjmedia-videodev/sdl_dev.c	(revision 3666)
+++ /pjproject/trunk/pjmedia/src/pjmedia-videodev/sdl_dev.c	(revision 3667)
@@ -23,5 +23,7 @@
 #include <pj/os.h>
 
-#if PJMEDIA_VIDEO_DEV_HAS_SDL
+
+#if defined(PJMEDIA_VIDEO_DEV_HAS_SDL) && PJMEDIA_VIDEO_DEV_HAS_SDL != 0
+
 
 #if defined(PJ_DARWINOS) && PJ_DARWINOS!=0
@@ -1289,3 +1291,4 @@
 #endif
 
+
 #endif	/* PJMEDIA_VIDEO_DEV_HAS_SDL */
Index: /pjproject/trunk/pjmedia/src/pjmedia-videodev/videodev.c
===================================================================
--- /pjproject/trunk/pjmedia/src/pjmedia-videodev/videodev.c	(revision 3666)
+++ /pjproject/trunk/pjmedia/src/pjmedia-videodev/videodev.c	(revision 3667)
@@ -24,4 +24,8 @@
 #include <pj/string.h>
 
+
+#if defined(PJMEDIA_HAS_VIDEO) && (PJMEDIA_HAS_VIDEO != 0)
+
+
 #define THIS_FILE   "videodev.c"
 
@@ -805,2 +809,5 @@
     return strm->op->destroy(strm);
 }
+
+
+#endif /* PJMEDIA_HAS_VIDEO */
Index: /pjproject/trunk/pjmedia/src/pjmedia/avi_player.c
===================================================================
--- /pjproject/trunk/pjmedia/src/pjmedia/avi_player.c	(revision 3666)
+++ /pjproject/trunk/pjmedia/src/pjmedia/avi_player.c	(revision 3667)
@@ -31,4 +31,7 @@
 #include <pj/pool.h>
 #include <pj/string.h>
+
+
+#if defined(PJMEDIA_HAS_VIDEO) && (PJMEDIA_HAS_VIDEO != 0)
 
 
@@ -710,2 +713,5 @@
     return PJ_SUCCESS;
 }
+
+
+#endif /* PJMEDIA_HAS_VIDEO */
Index: /pjproject/trunk/pjmedia/src/pjmedia/endpoint.c
===================================================================
--- /pjproject/trunk/pjmedia/src/pjmedia/endpoint.c	(revision 3666)
+++ /pjproject/trunk/pjmedia/src/pjmedia/endpoint.c	(revision 3667)
@@ -524,4 +524,7 @@
 }
 
+
+#if defined(PJMEDIA_HAS_VIDEO) && (PJMEDIA_HAS_VIDEO != 0)
+
 /* Create m=video SDP media line */
 PJ_DEF(pj_status_t) pjmedia_endpt_create_video_sdp(pjmedia_endpt *endpt,
@@ -531,4 +534,6 @@
                                                    pjmedia_sdp_media **p_m)
 {
+
+
     const pj_str_t STR_VIDEO = { "video", 5 };
     pjmedia_sdp_media *m;
@@ -662,4 +667,6 @@
 }
 
+#endif /* PJMEDIA_HAS_VIDEO */
+
 
 /**
@@ -730,5 +737,4 @@
     pjmedia_sdp_session *sdp;
     pjmedia_sdp_media *m;
-    unsigned i;
     pj_status_t status;
 
@@ -751,12 +757,18 @@
     sdp->media[sdp->media_count++] = m;
 
-    /* The remaining stream, if any, are videos (by convention as well) */
-    for (i=1; i<stream_cnt; ++i) {
-	status = pjmedia_endpt_create_video_sdp(endpt, pool,
-	                                        &sock_info[i], 0, &m);
-	if (status != PJ_SUCCESS)
-	    return status;
-	sdp->media[sdp->media_count++] = m;
-    }
+#if defined(PJMEDIA_HAS_VIDEO) && (PJMEDIA_HAS_VIDEO != 0)
+    {
+	unsigned i;
+
+	/* The remaining stream, if any, are videos (by convention as well) */
+	for (i=1; i<stream_cnt; ++i) {
+	    status = pjmedia_endpt_create_video_sdp(endpt, pool,
+						    &sock_info[i], 0, &m);
+	    if (status != PJ_SUCCESS)
+		return status;
+	    sdp->media[sdp->media_count++] = m;
+	}
+    }
+#endif
 
     /* Done */
Index: /pjproject/trunk/pjmedia/src/pjmedia/format.c
===================================================================
--- /pjproject/trunk/pjmedia/src/pjmedia/format.c	(revision 3666)
+++ /pjproject/trunk/pjmedia/src/pjmedia/format.c	(revision 3667)
@@ -24,4 +24,50 @@
 #include <pj/string.h>
 
+
+PJ_DEF(void) pjmedia_format_init_audio( pjmedia_format *fmt,
+				        pj_uint32_t fmt_id,
+					unsigned clock_rate,
+					unsigned channel_count,
+					unsigned bits_per_sample,
+					unsigned frame_time_usec,
+					pj_uint32_t avg_bps,
+					pj_uint32_t max_bps)
+{
+    fmt->id = fmt_id;
+    fmt->type = PJMEDIA_TYPE_AUDIO;
+    fmt->detail_type = PJMEDIA_FORMAT_DETAIL_AUDIO;
+
+    fmt->det.aud.clock_rate = clock_rate;
+    fmt->det.aud.channel_count = channel_count;
+    fmt->det.aud.bits_per_sample = bits_per_sample;
+    fmt->det.aud.frame_time_usec = frame_time_usec;
+    fmt->det.aud.avg_bps = avg_bps;
+    fmt->det.aud.max_bps = max_bps;
+}
+
+
+PJ_DEF(pjmedia_audio_format_detail*)
+pjmedia_format_get_audio_format_detail(const pjmedia_format *fmt,
+				       pj_bool_t assert_valid)
+{
+    if (fmt->detail_type==PJMEDIA_FORMAT_DETAIL_AUDIO) {
+	return (pjmedia_audio_format_detail*) &fmt->det.aud;
+    } else {
+	pj_assert(!assert_valid || !"Invalid audio format detail");
+	return NULL;
+    }
+}
+
+
+PJ_DEF(pjmedia_format*) pjmedia_format_copy(pjmedia_format *dst,
+					    const pjmedia_format *src)
+{
+    return (pjmedia_format*)pj_memcpy(dst, src, sizeof(*src));
+}
+
+
+#if defined(PJMEDIA_HAS_VIDEO) && (PJMEDIA_HAS_VIDEO != 0)
+
+
 static pj_status_t apply_packed_fmt(const pjmedia_video_format_info *fi,
 	                            pjmedia_video_apply_fmt_param *aparam);
@@ -57,26 +103,4 @@
 };
 
-
-PJ_DEF(void) pjmedia_format_init_audio( pjmedia_format *fmt,
-				        pj_uint32_t fmt_id,
-					unsigned clock_rate,
-					unsigned channel_count,
-					unsigned bits_per_sample,
-					unsigned frame_time_usec,
-					pj_uint32_t avg_bps,
-					pj_uint32_t max_bps)
-{
-    fmt->id = fmt_id;
-    fmt->type = PJMEDIA_TYPE_AUDIO;
-    fmt->detail_type = PJMEDIA_FORMAT_DETAIL_AUDIO;
-
-    fmt->det.aud.clock_rate = clock_rate;
-    fmt->det.aud.channel_count = channel_count;
-    fmt->det.aud.bits_per_sample = bits_per_sample;
-    fmt->det.aud.frame_time_usec = frame_time_usec;
-    fmt->det.aud.avg_bps = avg_bps;
-    fmt->det.aud.max_bps = max_bps;
-}
-
 PJ_DEF(void) pjmedia_format_init_video( pjmedia_format *fmt,
 					pj_uint32_t fmt_id,
@@ -113,16 +137,4 @@
 }
 
-PJ_DEF(pjmedia_audio_format_detail*)
-pjmedia_format_get_audio_format_detail(const pjmedia_format *fmt,
-				       pj_bool_t assert_valid)
-{
-    if (fmt->detail_type==PJMEDIA_FORMAT_DETAIL_AUDIO) {
-	return (pjmedia_audio_format_detail*) &fmt->det.aud;
-    } else {
-	pj_assert(!assert_valid || !"Invalid audio format detail");
-	return NULL;
-    }
-}
-
 PJ_DEF(pjmedia_video_format_detail*)
 pjmedia_format_get_video_format_detail(const pjmedia_format *fmt,
@@ -135,10 +147,4 @@
 	return NULL;
     }
-}
-
-PJ_DEF(pjmedia_format*) pjmedia_format_copy(pjmedia_format *dst,
-					    const pjmedia_format *src)
-{
-    return (pjmedia_format*)pj_memcpy(dst, src, sizeof(*src));
 }
 
@@ -365,2 +371,3 @@
 }
 
+#endif /* PJMEDIA_HAS_VIDEO */
Index: /pjproject/trunk/pjmedia/src/pjmedia/vid_codec.c
===================================================================
--- /pjproject/trunk/pjmedia/src/pjmedia/vid_codec.c	(revision 3666)
+++ /pjproject/trunk/pjmedia/src/pjmedia/vid_codec.c	(revision 3667)
@@ -25,4 +25,8 @@
 #include <pj/string.h>
 
+
+#if defined(PJMEDIA_HAS_VIDEO) && (PJMEDIA_HAS_VIDEO != 0)
+
+
 #define THIS_FILE   "vid_codec.c"
 
@@ -730,2 +734,4 @@
 }
 
+
+#endif /* PJMEDIA_HAS_VIDEO */
Index: /pjproject/trunk/pjmedia/src/pjmedia/vid_codec_util.c
===================================================================
--- /pjproject/trunk/pjmedia/src/pjmedia/vid_codec_util.c	(revision 3666)
+++ /pjproject/trunk/pjmedia/src/pjmedia/vid_codec_util.c	(revision 3667)
@@ -24,4 +24,8 @@
 #include <pj/ctype.h>
 #include <pj/math.h>
+
+
+#if defined(PJMEDIA_HAS_VIDEO) && (PJMEDIA_HAS_VIDEO != 0)
+
 
 #define THIS_FILE   "vid_codec_util.c"
@@ -618,2 +622,5 @@
     return PJ_SUCCESS;
 }
+
+
+#endif /* PJMEDIA_HAS_VIDEO */
Index: /pjproject/trunk/pjmedia/src/pjmedia/vid_port.c
===================================================================
--- /pjproject/trunk/pjmedia/src/pjmedia/vid_port.c	(revision 3666)
+++ /pjproject/trunk/pjmedia/src/pjmedia/vid_port.c	(revision 3667)
@@ -25,4 +25,8 @@
 #include <pj/log.h>
 #include <pj/pool.h>
+
+
+#if defined(PJMEDIA_HAS_VIDEO) && (PJMEDIA_HAS_VIDEO != 0)
+
 
 #define SIGNATURE	PJMEDIA_SIG_VID_PORT
@@ -947,2 +951,5 @@
     return status;
 }
+
+
+#endif /* PJMEDIA_HAS_VIDEO */
Index: /pjproject/trunk/pjmedia/src/pjmedia/vid_stream.c
===================================================================
--- /pjproject/trunk/pjmedia/src/pjmedia/vid_stream.c	(revision 3666)
+++ /pjproject/trunk/pjmedia/src/pjmedia/vid_stream.c	(revision 3667)
@@ -39,4 +39,7 @@
 
 
+#if defined(PJMEDIA_HAS_VIDEO) && (PJMEDIA_HAS_VIDEO != 0)
+
+
 #define THIS_FILE			"vid_stream.c"
 #define ERRLEVEL			1
@@ -1939,2 +1942,3 @@
 }
 
+#endif /* PJMEDIA_HAS_VIDEO */
Index: /pjproject/trunk/pjmedia/src/pjmedia/vid_tee.c
===================================================================
--- /pjproject/trunk/pjmedia/src/pjmedia/vid_tee.c	(revision 3666)
+++ /pjproject/trunk/pjmedia/src/pjmedia/vid_tee.c	(revision 3667)
@@ -24,4 +24,8 @@
 #include <pj/pool.h>
 
+
+#if defined(PJMEDIA_HAS_VIDEO) && (PJMEDIA_HAS_VIDEO != 0)
+
+
 #define TEE_PORT_NAME	"vid_tee"
 #define TEE_PORT_SIGN	PJMEDIA_SIG_PORT_VID_TEE
@@ -383,2 +387,5 @@
     return PJ_SUCCESS;
 }
+
+
+#endif /* PJMEDIA_HAS_VIDEO */
Index: /pjproject/trunk/pjmedia/src/test/test.c
===================================================================
--- /pjproject/trunk/pjmedia/src/test/test.c	(revision 3666)
+++ /pjproject/trunk/pjmedia/src/test/test.c	(revision 3667)
@@ -59,7 +59,9 @@
     mem = &caching_pool.factory;
 
+#if defined(PJMEDIA_HAS_VIDEO) && (PJMEDIA_HAS_VIDEO != 0)
     pjmedia_video_format_mgr_create(pool, 64, 0, NULL);
     pjmedia_converter_mgr_create(pool, NULL);
     pjmedia_vid_codec_mgr_create(pool, NULL);
+#endif
 
 #if HAS_VID_PORT_TEST
@@ -100,8 +102,10 @@
     }
 
+#if defined(PJMEDIA_HAS_VIDEO) && (PJMEDIA_HAS_VIDEO != 0)
     pjmedia_video_format_mgr_destroy(pjmedia_video_format_mgr_instance());
     pjmedia_converter_mgr_destroy(pjmedia_converter_mgr_instance());
     pjmedia_vid_codec_mgr_destroy(pjmedia_vid_codec_mgr_instance());
-    
+#endif
+
     pj_pool_release(pool);
     pj_caching_pool_destroy(&caching_pool);
Index: /pjproject/trunk/pjmedia/src/test/test.h
===================================================================
--- /pjproject/trunk/pjmedia/src/test/test.h	(revision 3666)
+++ /pjproject/trunk/pjmedia/src/test/test.h	(revision 3667)
@@ -24,7 +24,7 @@
 #include <pjlib.h>
 
-#define HAS_VID_DEV_TEST	1
-#define HAS_VID_PORT_TEST	0
-#define HAS_VID_CODEC_TEST	1
+#define HAS_VID_DEV_TEST	PJMEDIA_HAS_VIDEO
+#define HAS_VID_PORT_TEST	PJMEDIA_HAS_VIDEO
+#define HAS_VID_CODEC_TEST	PJMEDIA_HAS_VIDEO
 #define HAS_SDP_NEG_TEST	1
 #define HAS_JBUF_TEST		1
Index: /pjproject/trunk/pjmedia/src/test/vid_codec_test.c
===================================================================
--- /pjproject/trunk/pjmedia/src/test/vid_codec_test.c	(revision 3666)
+++ /pjproject/trunk/pjmedia/src/test/vid_codec_test.c	(revision 3667)
@@ -4,4 +4,8 @@
 #include <pjmedia/vid_codec.h>
 #include <pjmedia/port.h>
+
+
+#if defined(PJMEDIA_HAS_VIDEO) && (PJMEDIA_HAS_VIDEO != 0)
+
 
 #define THIS_FILE "vid_codec.c"
@@ -466,2 +470,3 @@
 
 
+#endif /* PJMEDIA_HAS_VIDEO */
Index: /pjproject/trunk/pjmedia/src/test/vid_dev_test.c
===================================================================
--- /pjproject/trunk/pjmedia/src/test/vid_dev_test.c	(revision 3666)
+++ /pjproject/trunk/pjmedia/src/test/vid_dev_test.c	(revision 3667)
@@ -24,4 +24,8 @@
 #include <pjmedia_videodev.h>
 
+
+#if defined(PJMEDIA_HAS_VIDEO) && (PJMEDIA_HAS_VIDEO != 0)
+
+
 #define THIS_FILE 	"vid_dev_test.c"
 #define LOOP_DURATION	10
@@ -293,2 +297,5 @@
     return rc;
 }
+
+
+#endif /* PJMEDIA_HAS_VIDEO */
Index: /pjproject/trunk/pjmedia/src/test/vid_port_test.c
===================================================================
--- /pjproject/trunk/pjmedia/src/test/vid_port_test.c	(revision 3666)
+++ /pjproject/trunk/pjmedia/src/test/vid_port_test.c	(revision 3667)
@@ -24,4 +24,8 @@
 #include <pjmedia_videodev.h>
 
+
+#if defined(PJMEDIA_HAS_VIDEO) && (PJMEDIA_HAS_VIDEO != 0)
+
+
 #define THIS_FILE 	"vid_dev_test.c"
 #define LOOP_DURATION	6
@@ -240,2 +244,5 @@
     return rc;
 }
+
+
+#endif /* PJMEDIA_HAS_VIDEO */
Index: /pjproject/trunk/pjsip-apps/src/samples/aviplay.c
===================================================================
--- /pjproject/trunk/pjsip-apps/src/samples/aviplay.c	(revision 3666)
+++ /pjproject/trunk/pjsip-apps/src/samples/aviplay.c	(revision 3667)
@@ -53,4 +53,7 @@
  *  aviplay FILE.AVI
  */
+
+
+#if defined(PJMEDIA_HAS_VIDEO) && (PJMEDIA_HAS_VIDEO != 0)
 
 
@@ -530,2 +533,14 @@
     return pj_run_app(&main_func, argc, argv, 0);
 }
+
+#else
+
+int main(int argc, char *argv[])
+{
+    PJ_UNUSED_ARG(argc);
+    PJ_UNUSED_ARG(argv);
+    puts("Error: this sample requires video capability (PJMEDIA_HAS_VIDEO == 1)");
+    return -1;
+}
+
+#endif /* PJMEDIA_HAS_VIDEO */
Index: /pjproject/trunk/pjsip-apps/src/samples/simpleua.c
===================================================================
--- /pjproject/trunk/pjsip-apps/src/samples/simpleua.c	(revision 3666)
+++ /pjproject/trunk/pjsip-apps/src/samples/simpleua.c	(revision 3667)
@@ -104,5 +104,5 @@
 static pjmedia_snd_port	    *g_snd_port;    /* Sound device.		*/
 
-#if PJMEDIA_HAS_VIDEO
+#if defined(PJMEDIA_HAS_VIDEO) && (PJMEDIA_HAS_VIDEO != 0)
 static pjmedia_vid_stream   *g_med_vstream; /* Call's video stream.	*/
 static pjmedia_vid_port	    *g_vid_capturer;/* Call's video capturer.	*/
@@ -374,6 +374,6 @@
 
 
+#if defined(PJMEDIA_HAS_VIDEO) && (PJMEDIA_HAS_VIDEO != 0)
     /* Init video subsystem */
-#if PJMEDIA_HAS_VIDEO
     pool = pjmedia_endpt_create_pool(g_med_endpt, "Video subsystem", 512, 512);
     status = pjmedia_video_format_mgr_create(pool, 64, 0, NULL);
@@ -386,5 +386,5 @@
     PJ_ASSERT_RETURN(status == PJ_SUCCESS, 1);
 
-#  if PJMEDIA_HAS_FFMPEG_CODEC
+#  if defined(PJMEDIA_HAS_FFMPEG_CODEC) && PJMEDIA_HAS_FFMPEG_CODEC!=0
     /* Init ffmpeg video codecs */
     status = pjmedia_codec_ffmpeg_init(NULL, &cp.factory);
@@ -558,6 +558,6 @@
 	pjmedia_snd_port_destroy(g_snd_port);
 
+#if defined(PJMEDIA_HAS_VIDEO) && (PJMEDIA_HAS_VIDEO != 0)
     /* Destroy video ports */
-#if PJMEDIA_HAS_VIDEO
     if (g_vid_capturer)
 	pjmedia_vid_port_destroy(g_vid_capturer);
@@ -569,7 +569,13 @@
     if (g_med_stream)
 	pjmedia_stream_destroy(g_med_stream);
-#if PJMEDIA_HAS_VIDEO
+#if defined(PJMEDIA_HAS_VIDEO) && (PJMEDIA_HAS_VIDEO != 0)
     if (g_med_vstream)
 	pjmedia_vid_stream_destroy(g_med_vstream);
+
+    /* Deinit ffmpeg codec */
+#   if defined(PJMEDIA_HAS_FFMPEG_CODEC) && PJMEDIA_HAS_FFMPEG_CODEC!=0
+    pjmedia_codec_ffmpeg_deinit();
+#   endif
+
 #endif
 
@@ -579,9 +585,4 @@
 	    pjmedia_transport_close(g_med_transport[i]);
     }
-
-    /* Deinit ffmpeg codec */
-#if PJMEDIA_HAS_FFMPEG_CODEC
-    pjmedia_codec_ffmpeg_deinit();
-#endif
 
     /* Deinit pjmedia endpoint */
@@ -886,5 +887,5 @@
      * the port directly to a renderer/capture video device.
      */
-#if PJMEDIA_HAS_VIDEO
+#if defined(PJMEDIA_HAS_VIDEO) && (PJMEDIA_HAS_VIDEO != 0)
     if (local_sdp->media_count > 1) {
 	pjmedia_vid_stream_info vstream_info;
Index: /pjproject/trunk/pjsip-apps/src/samples/vid_streamutil.c
===================================================================
--- /pjproject/trunk/pjsip-apps/src/samples/vid_streamutil.c	(revision 3666)
+++ /pjproject/trunk/pjsip-apps/src/samples/vid_streamutil.c	(revision 3667)
@@ -35,4 +35,8 @@
 #include <pjmedia-codec.h>
 #include <pjmedia/transport_srtp.h>
+
+
+#if defined(PJMEDIA_HAS_VIDEO) && (PJMEDIA_HAS_VIDEO != 0)
+
 
 #include <stdlib.h>	/* atoi() */
@@ -928,2 +932,15 @@
     return (status == PJ_SUCCESS) ? 0 : 1;
 }
+
+
+#else
+
+int main(int argc, char *argv[])
+{
+    PJ_UNUSED_ARG(argc);
+    PJ_UNUSED_ARG(argv);
+    puts("Error: this sample requires video capability (PJMEDIA_HAS_VIDEO == 1)");
+    return -1;
+}
+
+#endif /* PJMEDIA_HAS_VIDEO */
Index: /pjproject/trunk/pjsip/src/pjsua-lib/pjsua_acc.c
===================================================================
--- /pjproject/trunk/pjsip/src/pjsua-lib/pjsua_acc.c	(revision 3666)
+++ /pjproject/trunk/pjsip/src/pjsua-lib/pjsua_acc.c	(revision 3667)
@@ -383,4 +383,11 @@
     PJ_ASSERT_RETURN(pjsua_var.tpdata[0].data.ptr != NULL, PJ_EINVALIDOP);
 
+    /* Verify media count */
+#if !defined(PJMEDIA_HAS_VIDEO) || (PJMEDIA_HAS_VIDEO == 0)
+    PJ_ASSERT_RETURN(cfg->max_video_cnt == 0, PJ_EINVAL);
+#endif
+    PJ_ASSERT_RETURN(cfg->max_audio_cnt + cfg->max_video_cnt <= 
+		     PJSUA_MAX_CALL_MEDIA, PJ_ETOOMANY);
+
     PJSUA_LOCK();
 
@@ -641,4 +648,12 @@
     PJ_ASSERT_RETURN(acc_id>=0 && acc_id<(int)PJ_ARRAY_SIZE(pjsua_var.acc),
 		     PJ_EINVAL);
+
+    /* Verify media count */
+#if !defined(PJMEDIA_HAS_VIDEO) || (PJMEDIA_HAS_VIDEO == 0)
+    PJ_ASSERT_RETURN(cfg->max_video_cnt == 0, PJ_EINVAL);
+#endif
+    PJ_ASSERT_RETURN(cfg->max_audio_cnt + cfg->max_video_cnt <= 
+		     PJSUA_MAX_CALL_MEDIA, PJ_ETOOMANY);
+
 
     PJSUA_LOCK();
Index: /pjproject/trunk/pjsip/src/pjsua-lib/pjsua_call.c
===================================================================
--- /pjproject/trunk/pjsip/src/pjsua-lib/pjsua_call.c	(revision 3666)
+++ /pjproject/trunk/pjsip/src/pjsua-lib/pjsua_call.c	(revision 3667)
@@ -1466,8 +1466,10 @@
 					 &psi->info.aud);
 	break;
+#if defined(PJMEDIA_HAS_VIDEO) && (PJMEDIA_HAS_VIDEO != 0)
     case PJMEDIA_TYPE_VIDEO:
 	status = pjmedia_vid_stream_get_info(call_med->strm.v.stream,
 					     &psi->info.vid);
 	break;
+#endif
     default:
 	status = PJMEDIA_EINVALIMEDIATYPE;
@@ -1513,4 +1515,5 @@
 						  &stat->jbuf);
 	break;
+#if defined(PJMEDIA_HAS_VIDEO) && (PJMEDIA_HAS_VIDEO != 0)
     case PJMEDIA_TYPE_VIDEO:
 	status = pjmedia_vid_stream_get_stat(call_med->strm.v.stream,
@@ -1520,4 +1523,5 @@
 						  &stat->jbuf);
 	break;
+#endif
     default:
 	status = PJMEDIA_EINVALIMEDIATYPE;
Index: /pjproject/trunk/pjsip/src/pjsua-lib/pjsua_dump.c
===================================================================
--- /pjproject/trunk/pjsip/src/pjsua-lib/pjsua_dump.c	(revision 3666)
+++ /pjproject/trunk/pjsip/src/pjsua-lib/pjsua_dump.c	(revision 3667)
@@ -313,4 +313,6 @@
 			     info.param->setting.frm_per_pkt*
 			     info.param->info.frm_ptime);
+
+#if defined(PJMEDIA_HAS_VIDEO) && (PJMEDIA_HAS_VIDEO != 0)
 	} else if (call_med->type == PJMEDIA_TYPE_VIDEO) {
 	    pjmedia_vid_stream *stream = call_med->strm.v.stream;
@@ -344,4 +346,6 @@
 				 vfd->fps.num*1.0/vfd->fps.denum);
 	    }
+#endif /* PJMEDIA_HAS_VIDEO */
+
 	} else {
 	    has_stat = PJ_FALSE;
Index: /pjproject/trunk/pjsip/src/pjsua-lib/pjsua_media.c
===================================================================
--- /pjproject/trunk/pjsip/src/pjsua-lib/pjsua_media.c	(revision 3666)
+++ /pjproject/trunk/pjsip/src/pjsua-lib/pjsua_media.c	(revision 3667)
@@ -1248,4 +1248,5 @@
 	call_med->tp_st = PJSUA_MED_TP_IDLE;
 
+#if defined(PJMEDIA_HAS_VIDEO) && (PJMEDIA_HAS_VIDEO != 0)
 	/* While in initial call, set default video devices */
 	if (type == PJMEDIA_TYPE_VIDEO) {
@@ -1263,4 +1264,6 @@
 	    }
 	}
+#endif
+
     } else if (call_med->tp_st == PJSUA_MED_TP_DISABLED) {
 	/* Media is being reenabled. */
@@ -1651,8 +1654,10 @@
                                                     &tpinfo.sock_info, 0, &m);
 	    break;
+#if defined(PJMEDIA_HAS_VIDEO) && (PJMEDIA_HAS_VIDEO != 0)
 	case PJMEDIA_TYPE_VIDEO:
 	    status = pjmedia_endpt_create_video_sdp(pjsua_var.med_endpt, pool,
 	                                            &tpinfo.sock_info, 0, &m);
 	    break;
+#endif
 	default:
 	    pj_assert(!"Invalid call_med media type");
@@ -2125,5 +2130,5 @@
 	    }
 	    break;
-#if PJMEDIA_HAS_VIDEO
+#if defined(PJMEDIA_HAS_VIDEO) && (PJMEDIA_HAS_VIDEO != 0)
 	case PJMEDIA_TYPE_VIDEO:
 	    status = video_channel_update(call_med, tmp_pool,
