Add support for Apple's yuv2 raw format

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@25210 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
reimar 2007-11-30 11:31:31 +00:00
parent 3ef9fe349d
commit 06c5d53f45
2 changed files with 16 additions and 0 deletions

View File

@ -2213,6 +2213,15 @@ videocodec rawyuy2
fourcc yuy2,YUY2
out YUY2
videocodec rawyuv2
info "RAW YUV2"
status working
driver raw
format 0x0 0x32565559
format 0x20776172 0x32565559
fourcc yuv2,YUV2
out YUY2
videocodec rawuyvy
info "RAW UYVY"
status working

View File

@ -22,6 +22,7 @@ static int control(sh_video_t *sh,int cmd,void* arg,...){
switch(cmd){
case VDCTRL_QUERY_FORMAT:
if (*(int *)arg == format) return CONTROL_TRUE;
if (*(int *)arg == IMGFMT_YUY2 && format == MKTAG('y', 'u', 'v', '2')) return CONTROL_TRUE;
return CONTROL_FALSE;
}
return CONTROL_UNKNOWN;
@ -57,6 +58,7 @@ static void uninit(sh_video_t *sh){
static mp_image_t* decode(sh_video_t *sh,void* data,int len,int flags){
mp_image_t* mpi;
int frame_size;
int format = sh->bih ? sh->bih->biCompression : sh->format;
if(len<=0) return NULL; // skipped frame
@ -104,6 +106,11 @@ static mp_image_t* decode(sh_video_t *sh,void* data,int len,int flags){
#endif
}
frame_size=mpi->stride[0]*mpi->h;
if (format == MKTAG('y', 'u', 'v', '2')) {
int i;
for (i = 1; i < frame_size; i += 2)
mpi->planes[0][i] ^= 128;
}
if(mpi->bpp<8) frame_size=frame_size*mpi->bpp/8;
}