changeset 6502:01ada897cc89

don't require sh->bih (should fix v4l)
author arpi
date Sat, 22 Jun 2002 12:12:42 +0000
parents 827f08ddf044
children 5a2bd4021c8e
files libmpcodecs/vd_raw.c
diffstat 1 files changed, 4 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/libmpcodecs/vd_raw.c	Sat Jun 22 12:10:02 2002 +0000
+++ b/libmpcodecs/vd_raw.c	Sat Jun 22 12:12:42 2002 +0000
@@ -21,7 +21,7 @@
 static int control(sh_video_t *sh,int cmd,void* arg,...){
     switch(cmd){
     case VDCTRL_QUERY_FORMAT:
-	if( (*((int*)arg)) == sh->bih->biCompression ) return CONTROL_TRUE;
+	if( (*((int*)arg)) == (sh->bih ? sh->bih->biCompression : sh->format) ) return CONTROL_TRUE;
 	return CONTROL_FALSE;
     }
     return CONTROL_UNKNOWN;
@@ -29,9 +29,8 @@
 
 // init driver
 static int init(sh_video_t *sh){
-    if(!sh->bih) return 0; // bih is required
     // set format fourcc for raw RGB:
-    if(sh->bih->biCompression==0){	// set based on bit depth
+    if(sh->bih && sh->bih->biCompression==0){	// set based on bit depth
 	switch(sh->bih->biBitCount){
 	case 8:  sh->bih->biCompression=IMGFMT_BGR8; break;
 	case 15: sh->bih->biCompression=IMGFMT_BGR15; break;
@@ -43,7 +42,7 @@
 	    mp_msg(MSGT_DECVIDEO,MSGL_WARN,"RAW: depth %d not supported\n",sh->bih->biBitCount);
 	}
     }
-    return mpcodecs_config_vo(sh,sh->disp_w,sh->disp_h,sh->bih->biCompression);
+    return mpcodecs_config_vo(sh,sh->disp_w,sh->disp_h,sh->bih ? sh->bih->biCompression : sh->format);
 }
 
 // uninit driver
@@ -90,7 +89,7 @@
 	if(sh->format==0 || sh->format==3) mpi->stride[0]=(mpi->stride[0]+3)&(~3);
 	if(mpi->imgfmt==IMGFMT_RGB8 || mpi->imgfmt==IMGFMT_BGR8){
 	    // export palette:
-	    mpi->planes[1]=((unsigned char*)&sh->bih)+40;
+	    mpi->planes[1]=sh->bih ? (((unsigned char*)&sh->bih)+40) : NULL;
 	}
     }