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 "NuppelVideo decoder",
|
|
11 "nuv",
|
|
12 VFM_NUV,
|
|
13 "A'rpi",
|
|
14 "Alex & Panagiotis Issaris <takis@lumumba.luc.ac.be>",
|
|
15 "native codecs"
|
|
16 };
|
|
17
|
|
18 LIBVD_EXTERN(nuv)
|
|
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_I420);
|
|
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_nuv(
|
|
38 unsigned char *encoded,
|
|
39 int encoded_size,
|
|
40 unsigned char *decoded,
|
|
41 int width,
|
|
42 int height);
|
|
43
|
|
44 // decode a frame
|
|
45 static mp_image_t* decode(sh_video_t *sh,void* data,int len,int flags){
|
|
46 mp_image_t* mpi;
|
|
47 if(len<=0) return NULL; // skipped frame
|
|
48
|
|
49 mpi=mpcodecs_get_image(sh, MP_IMGTYPE_TEMP, 0,
|
|
50 sh->disp_w, sh->disp_h);
|
|
51 if(!mpi) return NULL;
|
|
52
|
|
53 decode_nuv(data, len, mpi->planes[0], sh->disp_w, sh->disp_h);
|
|
54
|
|
55 return mpi;
|
|
56 }
|