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 }
|
|
43 mpcodecs_config_vo(sh,sh->disp_w,sh->disp_h,sh->format);
|
|
44 return 1;
|
|
45 }
|
|
46
|
|
47 // uninit driver
|
|
48 static void uninit(sh_video_t *sh){
|
|
49 }
|
|
50
|
|
51 //mp_image_t* mpcodecs_get_image(sh_video_t *sh, int mp_imgtype, int mp_imgflag, int w, int h);
|
|
52
|
|
53 // decode a frame
|
|
54 static mp_image_t* decode(sh_video_t *sh,void* data,int len,int flags){
|
|
55 mp_image_t* mpi;
|
|
56 if(len<=0) return NULL; // skipped frame
|
|
57
|
|
58 mpi=mpcodecs_get_image(sh, MP_IMGTYPE_EXPORT, 0,
|
|
59 sh->disp_w, sh->disp_h);
|
|
60 if(!mpi) return NULL;
|
|
61
|
|
62 if(mpi->flags&MP_IMGFLAG_PLANAR){
|
|
63 // TODO !!!
|
|
64 mpi->planes[0]=data;
|
|
65 mpi->stride[0]=mpi->width;
|
|
66 } else {
|
|
67 mpi->planes[0]=data;
|
|
68 mpi->stride[0]=mpi->width*(mpi->bpp/8);
|
|
69 }
|
|
70
|
|
71 return mpi;
|
|
72 }
|
|
73
|