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

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Sep 14 18:28:25 CDT 2007


Author: rizzo
Date: Fri Sep 14 18:28:25 2007
New Revision: 82483

URL: http://svn.digium.com/view/asterisk?view=rev&rev=82483
Log:
add support to set the video bitrate


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=82483&r1=82482&r2=82483
==============================================================================
--- team/rizzo/video_v2/channels/chan_oss.c (original)
+++ team/rizzo/video_v2/channels/chan_oss.c Fri Sep 14 18:28:25 2007
@@ -1553,6 +1553,7 @@
 		M_UINT("videowidth", o->env.w)
 		M_UINT("videoheight", o->env.h)
 		M_UINT("fps", o->env.fps)
+		M_UINT("bitrate", o->env.bitrate)
 
 		M_END(/* */);
 	}

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=82483&r1=82482&r2=82483
==============================================================================
--- team/rizzo/video_v2/channels/console_video.c (original)
+++ team/rizzo/video_v2/channels/console_video.c Fri Sep 14 18:28:25 2007
@@ -17,6 +17,7 @@
 	int 	w;
 	int 	h;
 	int 	fps;
+	int 	bitrate;
 	char videodevice[64];
 };
 #define CONSOLE_FORMAT_VIDEO	0
@@ -99,6 +100,7 @@
 	AVFrame		*frame;
 	int		lasttxframe;	/* XXX - useless: RTP overwrite seqno */
 	int		fps;
+	int		bitrate;
 	struct dbuf_t	decbuf;
 	struct timeval	ts;
 	struct timeval	msts;
@@ -124,6 +126,7 @@
 	int 	w;
 	int 	h;
 	int 	fps;
+	int 	bitrate;
 	char videodevice[64];
 
 	struct video_in_desc in;
@@ -185,6 +188,11 @@
 		ast_log(LOG_WARNING, "fps unset, forcing to 5\n");
 		v->fps = env->fps = 5;
 	}
+	if (env->bitrate == 0) {
+		ast_log(LOG_WARNING, "bitrate unset, forcing to 65000\n");
+		env->bitrate = 65000;
+	}
+	v->bitrate = env->bitrate;
 
 	if (v->buf.data)	/* buffer allocated means device already open */
 		return v->fd;
@@ -417,7 +425,7 @@
 	v->context->flags|=CODEC_FLAG_H263P_UMV;
 	v->context->flags|=CODEC_FLAG_AC_PRED;
 	v->context->flags|=CODEC_FLAG_H263P_SLICE_STRUCT;
-	v->context->bit_rate = 80000;
+	v->context->bit_rate = v->bitrate;
 	v->context->gop_size = (int) v->fps*5; // emit I frame every 5 seconds
  
 	fprintf(stderr, "w: %d...h: %d...fps: %d...", v->w, v->h, v->fps);
@@ -500,6 +508,7 @@
 		env->w = x.w;
 		env->h = x.h;
 		env->fps = x.fps;
+		env->bitrate = x.bitrate;
 	}
 	ast_mutex_destroy(&env->lock);
 }
@@ -643,6 +652,7 @@
 		env->bmp[0] = SDL_CreateYUVOverlay(w, h, SDL_YV12_OVERLAY, env->screen);
 	if(!env->bmp[1])
 		env->bmp[1] = SDL_CreateYUVOverlay(w, h, SDL_YV12_OVERLAY, env->screen);
+	ast_mutex_unlock(&env->lock);
 
 	bmp = env->bmp[out];
 	SDL_LockYUVOverlay(bmp);
@@ -693,7 +703,6 @@
 	rect.w = w;
 	rect.h = h;
 	SDL_DisplayYUVOverlay(bmp, &rect);
-	ast_mutex_unlock(&env->lock);
 }
 
 /*




More information about the asterisk-commits mailing list