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 "A'rpi",
|
|
13 "Alex & Panagiotis Issaris <takis@lumumba.luc.ac.be>",
|
|
14 "native codecs"
|
|
15 };
|
|
16
|
|
17 LIBVD_EXTERN(nuv)
|
|
18
|
|
19 // to set/get/query special features/parameters
|
|
20 static int control(sh_video_t *sh,int cmd,void* arg,...){
|
|
21 return CONTROL_UNKNOWN;
|
|
22 }
|
|
23
|
|
24 // init driver
|
|
25 static int init(sh_video_t *sh){
|
5124
|
26 return mpcodecs_config_vo(sh,sh->disp_w,sh->disp_h,IMGFMT_I420);
|
4989
|
27 }
|
|
28
|
|
29 // uninit driver
|
|
30 static void uninit(sh_video_t *sh){
|
|
31 }
|
|
32
|
|
33 //mp_image_t* mpcodecs_get_image(sh_video_t *sh, int mp_imgtype, int mp_imgflag, int w, int h);
|
|
34
|
|
35 void decode_nuv(
|
|
36 unsigned char *encoded,
|
|
37 int encoded_size,
|
|
38 unsigned char *decoded,
|
|
39 int width,
|
|
40 int height);
|
|
41
|
|
42 // decode a frame
|
|
43 static mp_image_t* decode(sh_video_t *sh,void* data,int len,int flags){
|
|
44 mp_image_t* mpi;
|
|
45 if(len<=0) return NULL; // skipped frame
|
|
46
|
|
47 mpi=mpcodecs_get_image(sh, MP_IMGTYPE_TEMP, 0,
|
|
48 sh->disp_w, sh->disp_h);
|
|
49 if(!mpi) return NULL;
|
|
50
|
|
51 decode_nuv(data, len, mpi->planes[0], sh->disp_w, sh->disp_h);
|
|
52
|
|
53 return mpi;
|
|
54 }
|