summaryrefslogtreecommitdiffstats
path: root/libvo
diff options
context:
space:
mode:
Diffstat (limited to 'libvo')
-rw-r--r--libvo/img_format.h54
-rw-r--r--libvo/video_out.h14
-rw-r--r--libvo/vo_sdl.c35
-rw-r--r--libvo/vo_xv.c66
4 files changed, 125 insertions, 44 deletions
diff --git a/libvo/img_format.h b/libvo/img_format.h
new file mode 100644
index 0000000000..7d5b9c6a30
--- /dev/null
+++ b/libvo/img_format.h
@@ -0,0 +1,54 @@
+
+#ifndef __IMG_FORMAT_H
+#define __IMG_FORMAT_H
+
+/* RGB/BGR Formats */
+
+#define IMGFMT_RGB_MASK 0xFFFFFF00
+#define IMGFMT_RGB (('R'<<24)|('G'<<16)|('B'<<8))
+#define IMGFMT_RGB8 (IMGFMT_RGB|8)
+#define IMGFMT_RGB15 (IMGFMT_RGB|15)
+#define IMGFMT_RGB16 (IMGFMT_RGB|16)
+#define IMGFMT_RGB24 (IMGFMT_RGB|24)
+#define IMGFMT_RGB32 (IMGFMT_RGB|32)
+
+#define IMGFMT_BGR_MASK 0xFFFFFF00
+#define IMGFMT_BGR (('B'<<24)|('G'<<16)|('R'<<8))
+#define IMGFMT_BGR8 (IMGFMT_BGR|8)
+#define IMGFMT_BGR15 (IMGFMT_BGR|15)
+#define IMGFMT_BGR16 (IMGFMT_BGR|16)
+#define IMGFMT_BGR24 (IMGFMT_BGR|24)
+#define IMGFMT_BGR32 (IMGFMT_BGR|32)
+
+
+/* Planar YUV Formats */
+
+#define IMGFMT_YVU9 0x39555659
+#define IMGFMT_IF09 0x39304649
+#define IMGFMT_YV12 0x32315659
+#define IMGFMT_I420 0x30323449
+#define IMGFMT_IYUV 0x56555949
+#define IMGFMT_CLPL 0x4C504C43
+
+/* Packed YUV Formats */
+
+#define IMGFMT_IYU1 0x31555949
+#define IMGFMT_IYU2 0x32555949
+#define IMGFMT_UYVY 0x59565955
+#define IMGFMT_UYNV 0x564E5955
+#define IMGFMT_cyuv 0x76757963
+#define IMGFMT_YUY2 0x32595559
+#define IMGFMT_YUNV 0x564E5559
+#define IMGFMT_YVYU 0x55595659
+#define IMGFMT_Y41P 0x50313459
+#define IMGFMT_Y211 0x31313259
+#define IMGFMT_Y41T 0x54313459
+#define IMGFMT_Y42T 0x54323459
+#define IMGFMT_V422 0x32323456
+#define IMGFMT_V655 0x35353656
+#define IMGFMT_CLJR 0x524A4C43
+#define IMGFMT_YUVP 0x50565559
+#define IMGFMT_UYVP 0x50565955
+
+
+#endif
diff --git a/libvo/video_out.h b/libvo/video_out.h
index 0eb6cbacee..c6bbcb9303 100644
--- a/libvo/video_out.h
+++ b/libvo/video_out.h
@@ -9,19 +9,7 @@
#include <inttypes.h>
#include "font_load.h"
-
-#define IMGFMT_YV12 0x32315659
-//#define IMGFMT_YUY2 (('Y'<<24)|('U'<<16)|('Y'<<8)|'2')
-#define IMGFMT_YUY2 (('2'<<24)|('Y'<<16)|('U'<<8)|'Y')
-
-#define IMGFMT_RGB_MASK 0xFFFFFF00
-#define IMGFMT_RGB (('R'<<24)|('G'<<16)|('B'<<8))
-#define IMGFMT_BGR_MASK 0xFFFFFF00
-#define IMGFMT_BGR (('B'<<24)|('G'<<16)|('R'<<8))
-#define IMGFMT_RGB15 (IMGFMT_RGB|15)
-#define IMGFMT_RGB16 (IMGFMT_RGB|16)
-#define IMGFMT_RGB24 (IMGFMT_RGB|24)
-#define IMGFMT_RGB32 (IMGFMT_RGB|32)
+#include "img_format.h"
#define VO_EVENT_EXPOSE 1
#define VO_EVENT_RESIZE 2
diff --git a/libvo/vo_sdl.c b/libvo/vo_sdl.c
index 3b41322d11..1b757a5c3b 100644
--- a/libvo/vo_sdl.c
+++ b/libvo/vo_sdl.c
@@ -146,14 +146,21 @@ static struct sdl_priv_s {
//void vo_draw_alpha_yuy2(int w,int h, unsigned char* src, unsigned char *srca, int srcstride, unsigned char* dstbase,int dststride);
static void draw_alpha(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride){
- struct sdl_priv_s *priv = &sdl_priv;
- int x,y;
+ struct sdl_priv_s *priv = &sdl_priv;
+ int x,y;
- if (priv->format==IMGFMT_YV12)
- vo_draw_alpha_yv12(w,h,src,srca,stride,((uint8_t *) *(priv->overlay->pixels))+priv->width*y0+x0,priv->width);
- else
- vo_draw_alpha_yuy2(w,h,src,srca,stride,((uint8_t *) *(priv->overlay->pixels))+2*(priv->width*y0+x0),2*priv->width);
-
+ switch(priv->format) {
+ case IMGFMT_YV12:
+ case IMGFMT_I420:
+ case IMGFMT_IYUV:
+ vo_draw_alpha_yv12(w,h,src,srca,stride,((uint8_t *) *(priv->overlay->pixels))+priv->width*y0+x0,priv->width);
+ break;
+ case IMGFMT_YUY2:
+ case IMGFMT_UYVY:
+ case IMGFMT_YVYU:
+ vo_draw_alpha_yuy2(w,h,src,srca,stride,((uint8_t *) *(priv->overlay->pixels))+2*(priv->width*y0+x0),2*priv->width);
+ break;
+ }
}
@@ -380,6 +387,10 @@ init(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uint3
sdl_format=SDL_YUY2_OVERLAY;
printf("SDL: Using YUY2 image format\n");
break;
+ case IMGFMT_UYVY:
+ sdl_format=SDL_UYVY_OVERLAY;
+ printf("SDL: Using UYVY image format\n");
+ break;
default:
printf("SDL: Unsupported image format (0x%X)\n",format);
return -1;
@@ -472,6 +483,8 @@ static uint32_t draw_frame(uint8_t *src[])
switch(priv->format){
case IMGFMT_YV12:
+ case IMGFMT_I420:
+ case IMGFMT_IYUV:
dst = (uint8_t *) *(priv->overlay->pixels);
memcpy (dst, src[0], priv->framePlaneY);
dst += priv->framePlaneY;
@@ -479,14 +492,16 @@ static uint32_t draw_frame(uint8_t *src[])
dst += priv->framePlaneUV;
memcpy (dst, src[1], priv->framePlaneUV);
break;
+
case IMGFMT_YUY2:
+ case IMGFMT_UYVY:
+ case IMGFMT_YVYU:
dst = (uint8_t *) *(priv->overlay->pixels);
memcpy (dst, src[0], priv->width*priv->height*2);
break;
}
SDL_UnlockYUVOverlay (priv->overlay);
-
return 0;
}
@@ -711,7 +726,11 @@ query_format(uint32_t format)
{
switch(format){
case IMGFMT_YV12:
+ case IMGFMT_I420:
+ case IMGFMT_IYUV:
case IMGFMT_YUY2:
+ case IMGFMT_UYVY:
+ case IMGFMT_YVYU:
// case IMGFMT_RGB|24:
// case IMGFMT_BGR|24:
return 1;
diff --git a/libvo/vo_xv.c b/libvo/vo_xv.c
index 422ef6f06a..31f9e24416 100644
--- a/libvo/vo_xv.c
+++ b/libvo/vo_xv.c
@@ -265,10 +265,18 @@ static void check_events(void)
static void draw_alpha(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride){
int x,y;
- if (xv_format==IMGFMT_YV12)
- vo_draw_alpha_yv12(w,h,src,srca,stride,xvimage[0]->data+image_width*y0+x0,image_width);
- else
- vo_draw_alpha_yuy2(w,h,src,srca,stride,xvimage[0]->data+2*(image_width*y0+x0),2*image_width);
+ switch (xv_format) {
+ case IMGFMT_YV12:
+ case IMGFMT_I420:
+ case IMGFMT_IYUV:
+ vo_draw_alpha_yv12(w,h,src,srca,stride,xvimage[0]->data+image_width*y0+x0,image_width);
+ break;
+ case IMGFMT_YUY2:
+ case IMGFMT_UYVY:
+ case IMGFMT_YVYU:
+ vo_draw_alpha_yuy2(w,h,src,srca,stride,xvimage[0]->data+2*(image_width*y0+x0),2*image_width);
+ break;
+ }
}
@@ -332,43 +340,55 @@ static uint32_t draw_frame(uint8_t *src[])
{
int foo;
- if(xv_format==IMGFMT_YUY2)
- {
- // YUY2 packed, flipped
+ switch (xv_format) {
+ case IMGFMT_YUY2:
+ case IMGFMT_UYVY:
+ case IMGFMT_YVYU:
+
+ // YUY2 packed, flipped
#if 0
- int i;
- unsigned short *s=(unsigned short *)src[0];
- unsigned short *d=(unsigned short *)xvimage[0]->data;
- s+=image_width*image_height;
- for(i=0;i<image_height;i++)
- {
- s-=image_width;
- memcpy(d,s,image_width*2);
- d+=image_width;
- }
+ int i;
+ unsigned short *s=(unsigned short *)src[0];
+ unsigned short *d=(unsigned short *)xvimage[0]->data;
+ s+=image_width*image_height;
+ for(i=0;i<image_height;i++) {
+ s-=image_width;
+ memcpy(d,s,image_width*2);
+ d+=image_width;
+ }
#else
- memcpy(xvimage[0]->data,src[0],image_width*image_height*2);
+ memcpy(xvimage[0]->data,src[0],image_width*image_height*2);
#endif
- }
- else
- {
+ break;
+
+ case IMGFMT_YV12:
+ case IMGFMT_I420:
+ case IMGFMT_IYUV:
+
// YV12 planar
memcpy(xvimage[0]->data,src[0],image_width*image_height);
memcpy(xvimage[0]->data+image_width*image_height,src[2],image_width*image_height/4);
memcpy(xvimage[0]->data+image_width*image_height*5/4,src[1],image_width*image_height/4);
- }
+ break;
+ }
return 0;
}
static uint32_t query_format(uint32_t format)
{
+
+// umm, this is a kludge, we need to ask the server.. (see init function above)
+ return 1;
+/*
switch(format)
{
case IMGFMT_YV12:
- case IMGFMT_YUY2: return 1;
+ case IMGFMT_YUY2:
+ return 1;
}
return 0;
+*/
}
static void uninit(void) {