changeset 3764:0195894e279f

added support for I420 input (used by TV V4L) in lavc encoder
author alex
date Wed, 26 Dec 2001 13:32:00 +0000
parents 81d84039dd17
children 1f9e0e08b3d7
files mencoder.c
diffstat 1 files changed, 11 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/mencoder.c	Wed Dec 26 13:22:03 2001 +0000
+++ b/mencoder.c	Wed Dec 26 13:32:00 2001 +0000
@@ -883,7 +883,7 @@
     }
 
 #if 1
-    if (out_fmt != IMGFMT_YV12)
+    if (out_fmt != IMGFMT_YV12 && out_fmt != IMGFMT_I420)
     {
         printf("Not supported image format! (%s)\n",
     	    vo_format_name(out_fmt));
@@ -896,8 +896,16 @@
 	int size = lavc_venc_context.width * lavc_venc_context.height;
 
 /* Y */	lavc_venc_picture.data[0] = vo_image_ptr;
-/* U */	lavc_venc_picture.data[2] = lavc_venc_picture.data[0] + size;
-/* V */	lavc_venc_picture.data[1] = lavc_venc_picture.data[2] + size/4;
+	if (out_fmt == IMGFMT_YV12)
+	{
+/* U */		lavc_venc_picture.data[2] = lavc_venc_picture.data[0] + size;
+/* V */		lavc_venc_picture.data[1] = lavc_venc_picture.data[2] + size/4;
+	}
+	else /* IMGFMT_I420 */
+	{
+/* U */		lavc_venc_picture.data[1] = lavc_venc_picture.data[0] + size;
+/* V */		lavc_venc_picture.data[2] = lavc_venc_picture.data[1] + size/4;
+	}
 	lavc_venc_picture.linesize[0] = lavc_venc_context.width;
 	lavc_venc_picture.linesize[1] = lavc_venc_context.width / 2;
 	lavc_venc_picture.linesize[2] = lavc_venc_context.width / 2;