[asterisk-commits] rizzo: branch rizzo/video_v2 r85511 - /team/rizzo/video_v2/channels/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Oct 12 05:00:24 CDT 2007


Author: rizzo
Date: Fri Oct 12 05:00:22 2007
New Revision: 85511

URL: http://svn.digium.com/view/asterisk?view=rev&rev=85511
Log:
move video camera initialization in the video_thread as it
can be slow.
Use the wm title line as a very crude status line.


Modified:
    team/rizzo/video_v2/channels/console_video.c

Modified: team/rizzo/video_v2/channels/console_video.c
URL: http://svn.digium.com/view/asterisk/team/rizzo/video_v2/channels/console_video.c?view=diff&rev=85511&r1=85510&r2=85511
==============================================================================
--- team/rizzo/video_v2/channels/console_video.c (original)
+++ team/rizzo/video_v2/channels/console_video.c Fri Oct 12 05:00:22 2007
@@ -703,6 +703,7 @@
 		return 0;
 	if (0)
 		check_h261(b);
+	// ast_log(LOG_WARNING, "rx size %d\n", srclen);
 	while (srclen) {
 		uint8_t *data;
 		int datalen, ret, dummy = 0;
@@ -1918,7 +1919,18 @@
 static void *video_thread(void *arg)
 {
 	struct video_desc *env = arg;
-
+	int count = 0;
+
+	if (video_open(&env->out)) {
+		ast_log(LOG_WARNING, "cannot open local video source\n");
+	} else {
+		/* try to register the fd. Unfortunately, if the webcam
+		 * driver does not support select/poll we are out of luck.
+		 */
+		if (env->out.fd >= 0)
+			ast_channel_set_fd(env->owner, 1, env->out.fd);
+		video_out_init(env);
+	}
 	for (;;) {
 		/* XXX 20 times/sec */
 		struct timeval t = { 0, 50000 };
@@ -1931,8 +1943,21 @@
 			ast_log(LOG_WARNING, "video_thread shutting down\n");
 			break;
 		}
+		/* determine if video format changed */
+		if (count++ % 10 == 0) {
+			char buf[160];
+			if (env->out.sendvideo)
+			    sprintf(buf, "%s %s %dx%d @ %dfps %dkbps",
+				env->out.videodevice, env->codec_name,
+				env->out.enc_in.w, env->out.enc_in.h,
+				env->out.fps, env->out.bitrate/1000);
+			else
+			    sprintf(buf, "hold");
+			SDL_WM_SetCaption(buf, NULL);
+		}
 		/* sleep for a while */
 		ast_select(0, NULL, NULL, NULL, &t);
+		
 		f = get_video_frames(env, &p);
 		if (!f)
 			continue;
@@ -2095,16 +2120,6 @@
 		ast_log(LOG_WARNING, "bitrate unset, forcing to %d\n", env->out.bitrate);
 	}
 
-	if (video_open(&env->out)) {
-		ast_log(LOG_WARNING, "cannot open local video source\n");
-	} else {
-		/* try to register the fd. Unfortunately, if the webcam
-		 * driver does not support select/poll we are out of luck.
-		 */
-		if (env->out.fd >= 0)
-			ast_channel_set_fd(owner, 1, env->out.fd);
-		video_out_init(env);
-	}
 	ast_pthread_create_background(&env->vthread, NULL, video_thread, env);
 }
 




More information about the asterisk-commits mailing list