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

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Sat Sep 29 11:28:30 CDT 2007


Author: rizzo
Date: Sat Sep 29 11:28:29 2007
New Revision: 84124

URL: http://svn.digium.com/view/asterisk?view=rev&rev=84124
Log:
add a 'console sendvideo' config+cli option to control sending video

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

Modified: team/rizzo/video_v2/channels/chan_oss.c
URL: http://svn.digium.com/view/asterisk/team/rizzo/video_v2/channels/chan_oss.c?view=diff&rev=84124&r1=84123&r2=84124
==============================================================================
--- team/rizzo/video_v2/channels/chan_oss.c (original)
+++ team/rizzo/video_v2/channels/chan_oss.c Sat Sep 29 11:28:29 2007
@@ -1120,7 +1120,7 @@
 
 	switch (cmd) {
 	case CLI_INIT:
-		e->command = "console [device|videodevice|fps|bitrate|videowidth|videoheight]";
+		e->command = "console [sendvideo|device|videodevice|fps|bitrate|videowidth|videoheight]";
 		e->usage =
 			"Usage: console ...\n"
 			"       Generic handler for console commands.\n";

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=84124&r1=84123&r2=84124
==============================================================================
--- team/rizzo/video_v2/channels/console_video.c (original)
+++ team/rizzo/video_v2/channels/console_video.c Sat Sep 29 11:28:29 2007
@@ -184,6 +184,8 @@
 	int 		h;
 	int		fps;
 	int		bitrate;
+
+	int sendvideo;
 
 	struct fbuf_t	loc_src;	/* local source buffer */
 	struct fbuf_t	enc_in;		/* encoder input buffer */
@@ -596,6 +598,7 @@
 		return video_out_uninit(v);
 	}
 
+	/* allocate the input buffer for encoding */
 	enc_in = &v->enc_in;
 	enc_in->size = (enc_in->w * enc_in->h * 3)/2;	/* yuv411 */
 	enc_in->data = ast_calloc(1, enc_in->size);
@@ -779,10 +782,10 @@
  * proper frames. After that, if we have a valid frame, we decode it
  * until the entire frame is processed.
  */
-static int decode_video(struct video_in_desc *v)
-{
-	uint8_t *src = v->dec_in.data;
-	int srclen = v->dec_in.used;
+static int decode_video(struct video_in_desc *v, struct fbuf_t *b)
+{
+	uint8_t *src = b->data;
+	int srclen = b->used;
 
 	if (!srclen)
 		return 0;
@@ -894,7 +897,6 @@
 		return;
 
 	if (out) {	/* webcam/x11 to sdl */
-		b_in = &env->out.loc_src;
 		b_in = &env->out.enc_in;
 		b_out = &env->out.loc_dpy;
 		p_in = NULL;
@@ -1027,7 +1029,7 @@
 	v->dec_in.used += len;
 	v->dec_in.data[v->dec_in.used] = '\0';
 	if (f->subclass & 0x01) {	// RTP Marker
-		if (decode_video(v)) {
+		if (decode_video(v, &v->dec_in)) {
 			show_frame(env, 0);
 			v->completed = 0;
 			v->dec_in.used = 0;
@@ -1130,7 +1132,6 @@
  */
 static struct ast_frame *get_video_frames(struct video_desc *env)
 {
-	int buflen;
 	struct video_out_desc *v = &env->out;
 	struct fbuf_t *b = &v->enc_out;
 
@@ -1149,9 +1150,10 @@
 		ast_log(LOG_WARNING, "fail, no encbuf\n");
 		return NULL;
 	}
-
-	buflen = avcodec_encode_video(v->enc_ctx, b->data, b->size, v->frame);
-	return split_frame(v, buflen);
+	if (!v->sendvideo)
+		return NULL;
+	b->used = avcodec_encode_video(v->enc_ctx, b->data, b->size, v->frame);
+	return split_frame(v, b->used);
 }
 
 /*
@@ -1360,6 +1362,7 @@
 	}
 	env = *penv;
         M_STR("videodevice", env->videodevice)
+        M_BOOL("sendvideo", env->out.sendvideo)
         M_UINT("videowidth", env->w)
         M_UINT("videoheight", env->h)
         M_UINT("fps", env->fps)




More information about the asterisk-commits mailing list