[asterisk-commits] rizzo: branch rizzo/astobj2 r77798 - /team/rizzo/astobj2/channels/chan_oss.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Jul 30 15:21:57 CDT 2007


Author: rizzo
Date: Mon Jul 30 15:21:56 2007
New Revision: 77798

URL: http://svn.digium.com/view/asterisk?view=rev&rev=77798
Log:
add a note that we also need videosupport=yes in sip.conf

introduce replacement code (untested) for img_convert since
the former is being deprecated.


Modified:
    team/rizzo/astobj2/channels/chan_oss.c

Modified: team/rizzo/astobj2/channels/chan_oss.c
URL: http://svn.digium.com/view/asterisk/team/rizzo/astobj2/channels/chan_oss.c?view=diff&rev=77798&r1=77797&r2=77798
==============================================================================
--- team/rizzo/astobj2/channels/chan_oss.c (original)
+++ team/rizzo/astobj2/channels/chan_oss.c Mon Jul 30 15:21:56 2007
@@ -41,7 +41,7 @@
 /*
  * experimental support to decode a video session.
  */
-//#define DROP_PACKETS	5	// if set, simulate this percentage of lost video packets
+#define DROP_PACKETS	5	// if set, simulate this percentage of lost video packets
 #define HAVE_V4L	1
 #define HAVE_SDL	1
 #define HAVE_FFMPEG	1
@@ -315,6 +315,7 @@
 Then you need to add to sip.conf:
 	[general](+)
 		allow=h263p
+		videosupport=yes
 
  */
 /*
@@ -323,6 +324,7 @@
  */
 
 #include <ffmpeg/avcodec.h>
+// #include <ffmpeg/swscale.h>
 #include <SDL/SDL.h>
 
 /* Structures for ffmpeg processing */
@@ -335,6 +337,7 @@
 	AVCodec                 *codec;
 	AVFrame                 *frame;
 	AVCodecParserContext    *parser;
+
 	int                     completed;
 	uint8_t                 *data;
 	int                     datalen;
@@ -733,7 +736,6 @@
 			len -= ret;
 		}
 	}
-
 	return 1;
 }
 
@@ -772,9 +774,37 @@
 	pict.linesize[1] = env->bmp->pitches[2];
 	pict.linesize[2] = env->bmp->pitches[1];
 
+#if 1 /* XXX img_convert is deprecated */
 	img_convert(&pict, PIX_FMT_YUV420P,
 		(AVPicture *)env->frame, env->context->pix_fmt,
 		env->context->width, env->context->height);
+#else /* XXX replacement */
+	{
+		struct SwsContext *convert_ctx;
+		AVPicture *pict_in = (AVPicture *)env->frame;
+
+		convert_ctx = sws_getContext(env->context->width,
+			env->context->height,
+			env->context->pix_fmt /* input format */,
+			env->context->width,
+			env->context->height,
+			PIX_FMT_YUV420P /* output format ? */,
+			SWS_BICUBIC, NULL, NULL, NULL);
+		if (convert_ctx == NULL) {
+			ast_log(LOG_ERROR, "FFMPEG::convert_cmodel : swscale context initialization failed");
+			return;
+		}
+
+		sws_scale(convert_ctx,
+			pict_in->data, pict_in->linesize,
+			env->context->width, env->context->height,
+			pict.data, pict.linesize);
+
+		sws_freeContext(convert_ctx);
+
+	}
+#endif /* XXX replacement */
+
 	SDL_UnlockYUVOverlay(env->bmp);
 #if 0	/* more testing, overlay the received image with the local picture */
 	ast_log(LOG_WARNING, "show_frame: linesize %d %d %d\n", pict.linesize[0], pict.linesize[1], pict.linesize[2]);




More information about the asterisk-commits mailing list