Mercurial > mplayer.hg
annotate libmpcodecs/vd_raw.c @ 5849:77a529bfc80e
some fixes
author | arpi |
---|---|
date | Fri, 26 Apr 2002 20:32:03 +0000 |
parents | 81f31373837e |
children | a79f46ea2a6a |
rev | line source |
---|---|
4969 | 1 #include <stdio.h> |
2 #include <stdlib.h> | |
3 | |
4 #include "config.h" | |
5 #include "mp_msg.h" | |
6 | |
7 #include "vd_internal.h" | |
8 | |
9 static vd_info_t info = { | |
10 "RAW Uncompressed Video", | |
11 "raw", | |
12 VFM_RAW, | |
13 "A'rpi", | |
14 "A'rpi & Alex", | |
15 "uncompressed" | |
16 }; | |
17 | |
18 LIBVD_EXTERN(raw) | |
19 | |
20 // to set/get/query special features/parameters | |
21 static int control(sh_video_t *sh,int cmd,void* arg,...){ | |
22 switch(cmd){ | |
23 case VDCTRL_QUERY_FORMAT: | |
24 if( (*((int*)arg)) == sh->format ) return CONTROL_TRUE; | |
25 return CONTROL_FALSE; | |
26 } | |
27 return CONTROL_UNKNOWN; | |
28 } | |
29 | |
30 // init driver | |
31 static int init(sh_video_t *sh){ | |
32 // set format fourcc for raw RGB: | |
33 if(sh->format==0){ | |
34 switch(sh->bih->biBitCount){ | |
35 case 15: | |
36 case 16: sh->format=IMGFMT_BGR15; break; | |
37 case 24: sh->format=IMGFMT_BGR24; break; | |
38 case 32: sh->format=IMGFMT_BGR32; break; | |
39 default: | |
40 mp_msg(MSGT_DECVIDEO,MSGL_WARN,"RAW: depth %d not supported\n",sh->bih->biBitCount); | |
41 } | |
42 } | |
5124 | 43 return mpcodecs_config_vo(sh,sh->disp_w,sh->disp_h,sh->format); |
4969 | 44 } |
45 | |
46 // uninit driver | |
47 static void uninit(sh_video_t *sh){ | |
48 } | |
49 | |
50 //mp_image_t* mpcodecs_get_image(sh_video_t *sh, int mp_imgtype, int mp_imgflag, int w, int h); | |
51 | |
52 // decode a frame | |
53 static mp_image_t* decode(sh_video_t *sh,void* data,int len,int flags){ | |
54 mp_image_t* mpi; | |
55 if(len<=0) return NULL; // skipped frame | |
56 | |
57 mpi=mpcodecs_get_image(sh, MP_IMGTYPE_EXPORT, 0, | |
58 sh->disp_w, sh->disp_h); | |
59 if(!mpi) return NULL; | |
60 | |
61 if(mpi->flags&MP_IMGFLAG_PLANAR){ | |
62 // TODO !!! | |
63 mpi->planes[0]=data; | |
64 mpi->stride[0]=mpi->width; | |
5271
81f31373837e
adding support for 12 bit planar YUV formats (for YUV4MPEG(2))
rik
parents:
5124
diff
changeset
|
65 if(mpi->bpp == 12 && mpi->flags&MP_IMGFLAG_YUV) { |
81f31373837e
adding support for 12 bit planar YUV formats (for YUV4MPEG(2))
rik
parents:
5124
diff
changeset
|
66 // Support for some common Planar YUV formats |
81f31373837e
adding support for 12 bit planar YUV formats (for YUV4MPEG(2))
rik
parents:
5124
diff
changeset
|
67 mpi->planes[2]=data+mpi->width*mpi->height; |
81f31373837e
adding support for 12 bit planar YUV formats (for YUV4MPEG(2))
rik
parents:
5124
diff
changeset
|
68 mpi->stride[2]=mpi->width/2; |
81f31373837e
adding support for 12 bit planar YUV formats (for YUV4MPEG(2))
rik
parents:
5124
diff
changeset
|
69 mpi->planes[1]=data+5*mpi->width*mpi->height/4; |
81f31373837e
adding support for 12 bit planar YUV formats (for YUV4MPEG(2))
rik
parents:
5124
diff
changeset
|
70 mpi->stride[1]=mpi->width/2; |
81f31373837e
adding support for 12 bit planar YUV formats (for YUV4MPEG(2))
rik
parents:
5124
diff
changeset
|
71 } |
4969 | 72 } else { |
73 mpi->planes[0]=data; | |
74 mpi->stride[0]=mpi->width*(mpi->bpp/8); | |
75 } | |
76 | |
77 return mpi; | |
78 } | |
79 |