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

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Sat Sep 29 12:55:27 CDT 2007


Author: rizzo
Date: Sat Sep 29 12:55:26 2007
New Revision: 84128

URL: http://svn.digium.com/view/asterisk?view=rev&rev=84128
Log:
introduce the "camera_format = WxH" config/cli command
so you can set the geometry of your source differently
from the default geometry used for codec and display.

also default 'sendvideo' to on because it is more convenient.


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=84128&r1=84127&r2=84128
==============================================================================
--- team/rizzo/video_v2/channels/console_video.c (original)
+++ team/rizzo/video_v2/channels/console_video.c Sat Sep 29 12:55:26 2007
@@ -624,7 +624,7 @@
 	} else {
 		v->enc_ctx->flags |=CODEC_FLAG_H263P_UMV;
 		v->enc_ctx->flags |=CODEC_FLAG_AC_PRED;
-		v->enc_ctx->flags|=CODEC_FLAG_H263P_SLICE_STRUCT;
+		v->enc_ctx->flags |=CODEC_FLAG_H263P_SLICE_STRUCT;
 	}
 	v->enc_ctx->bit_rate = v->bitrate;
 	v->enc_ctx->gop_size = (int) v->fps*5; // emit I frame every 5 seconds
@@ -1123,7 +1123,7 @@
 	if (cur)
 		cur->subclass |= 1; // RTP Marker
 
-	// ast_log(LOG_WARNING, "done, totlen %d frags %d\n", totlen, frags);
+	//ast_log(LOG_WARNING, "done, totlen %d frags %d\n", totlen, frags);
 	return first;
 }
 
@@ -1221,8 +1221,12 @@
 	ei->pix_fmt = PIX_FMT_YUV420P;	/* encoder input */
 	ld->pix_fmt = rd->pix_fmt = PIX_FMT_YUV420P; /* sdl format */
 	/* all size default to the same value */
-	c->w = ei->w = ld->w = rd->w = env->w;
-	c->h = ei->h = ld->h = rd->h = env->h;
+	if (c->w == 0)
+		c->w = env->w;
+	if (c->h == 0)
+		c->h = env->h;
+	ei->w = ld->w = rd->w = env->w;
+	ei->h = ld->h = rd->h = env->h;
 }
 
 /*!
@@ -1243,8 +1247,6 @@
 	if (owner == NULL)	/* nothing to do if we don't have a channel */
 		return;
 	env->owner = owner;
-	bzero(&env->in, sizeof(env->in));
-	bzero(&env->out, sizeof(env->out));
 	init_env(env);
 
 	/*
@@ -1344,6 +1346,11 @@
 #define M_STR(tag, dst)         M_F(tag, ast_copy_string(dst, __val, sizeof(dst)
 #endif
 
+static int video_geom(struct fbuf_t *b, const char *s)
+{
+	return sscanf(s, "%dx%d", &b->w, &b->h);
+}
+
 /*! parse config command for video support */
 static int console_video_config(struct video_desc **penv,
 	const char *var, const char *val)
@@ -1355,16 +1362,20 @@
 		ast_log(LOG_WARNING, "bad argument penv=NULL\n");
 		return 1;	/* error */
 	}
-	if (*penv == NULL)
-		*penv = ast_calloc(1, sizeof(struct video_desc));
-	if (*penv == NULL) {
-		ast_log(LOG_WARNING, "fail to allocate video_desc\n");
-		return 1;	/* error */
-	}
 	env = *penv;
+	if (env == NULL) {
+		env = *penv = ast_calloc(1, sizeof(struct video_desc));
+		if (env == NULL) {
+			ast_log(LOG_WARNING, "fail to allocate video_desc\n");
+			return 1;	/* error */
+		
+		}
+		env->out.sendvideo = 1;
+	}
         M_STR("videodevice", env->videodevice)
         M_BOOL("sendvideo", env->out.sendvideo)
         M_UINT("videowidth", env->w)
+        M_F("camera_format", video_geom(&env->out.loc_src, val))
         M_UINT("videoheight", env->h)
         M_UINT("fps", env->fps)
         M_UINT("bitrate", env->bitrate)




More information about the asterisk-commits mailing list