4989
|
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 "Creative YUV decoder",
|
|
11 "cyuv",
|
|
12 VFM_CYUV,
|
|
13 "A'rpi",
|
|
14 "Dr. Tim Ferguson",
|
|
15 "native codec"
|
|
16 };
|
|
17
|
|
18 LIBVD_EXTERN(cyuv)
|
|
19
|
|
20 // to set/get/query special features/parameters
|
|
21 static int control(sh_video_t *sh,int cmd,void* arg,...){
|
|
22 return CONTROL_UNKNOWN;
|
|
23 }
|
|
24
|
|
25 // init driver
|
|
26 static int init(sh_video_t *sh){
|
|
27 mpcodecs_config_vo(sh,sh->disp_w,sh->disp_h,IMGFMT_UYVY);
|
|
28 return 1;
|
|
29 }
|
|
30
|
|
31 // uninit driver
|
|
32 static void uninit(sh_video_t *sh){
|
|
33 }
|
|
34
|
|
35 //mp_image_t* mpcodecs_get_image(sh_video_t *sh, int mp_imgtype, int mp_imgflag, int w, int h);
|
|
36
|
|
37 void decode_cyuv(
|
|
38 unsigned char *buf,
|
|
39 int size,
|
|
40 unsigned char *frame,
|
|
41 int width,
|
|
42 int height,
|
|
43 int bit_per_pixel);
|
|
44
|
|
45 // decode a frame
|
|
46 static mp_image_t* decode(sh_video_t *sh,void* data,int len,int flags){
|
|
47 mp_image_t* mpi;
|
|
48 if(len<=0) return NULL; // skipped frame
|
|
49
|
|
50 mpi=mpcodecs_get_image(sh, MP_IMGTYPE_TEMP, 0,
|
|
51 sh->disp_w, sh->disp_h);
|
|
52 if(!mpi) return NULL;
|
|
53
|
|
54 decode_cyuv(data, len, mpi->planes[0], sh->disp_w, sh->disp_h, 0);
|
|
55
|
|
56 return mpi;
|
|
57 }
|