4969
|
1 #include <stdio.h>
|
|
2 #include <stdlib.h>
|
|
3
|
|
4 #include "config.h"
|
|
5 #ifdef USE_XANIM
|
|
6
|
|
7 #include "mp_msg.h"
|
|
8
|
|
9 #include "vd_internal.h"
|
|
10
|
|
11 static vd_info_t info = {
|
|
12 "XAnim codecs",
|
|
13 "xanim",
|
|
14 VFM_XANIM,
|
|
15 "A'rpi & Alex",
|
|
16 "XAnim... TODO: name+url here",
|
|
17 "binary codec plugins"
|
|
18 };
|
|
19
|
|
20 LIBVD_EXTERN(xanim)
|
|
21
|
|
22 #include "xacodec.h"
|
|
23
|
|
24 // to set/get/query special features/parameters
|
|
25 static int control(sh_video_t *sh,int cmd,void* arg,...){
|
|
26 return CONTROL_UNKNOWN;
|
|
27 }
|
|
28
|
|
29 // init driver
|
|
30 static int init(sh_video_t *sh){
|
|
31 mpcodecs_config_vo(sh,sh->disp_w,sh->disp_h,sh->format);
|
|
32 return xacodec_init_video(sh,sh->codec->outfmt[sh->outfmtidx]);
|
|
33 }
|
|
34
|
|
35 // uninit driver
|
|
36 static void uninit(sh_video_t *sh){
|
|
37 xacodec_exit();
|
|
38 }
|
|
39
|
|
40 //mp_image_t* mpcodecs_get_image(sh_video_t *sh, int mp_imgtype, int mp_imgflag, int w, int h);
|
|
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 xacodec_image_t* image;
|
|
46
|
|
47 if(len<=0) return NULL; // skipped frame
|
|
48
|
|
49 image=xacodec_decode_frame(data,len,(flags&3)?1:0);
|
|
50 if(!image) return NULL;
|
|
51
|
|
52 mpi=mpcodecs_get_image(sh, MP_IMGTYPE_EXPORT, MP_IMGFLAG_PRESERVE,
|
|
53 sh->disp_w, sh->disp_h);
|
|
54 if(!mpi) return NULL;
|
|
55
|
|
56 mpi->planes[0]=image->planes[0];
|
|
57 mpi->planes[1]=image->planes[1];
|
|
58 mpi->planes[2]=image->planes[2];
|
|
59 mpi->stride[0]=image->stride[0];
|
|
60 mpi->stride[1]=image->stride[1];
|
|
61 mpi->stride[2]=image->stride[2];
|
|
62
|
|
63 return mpi;
|
|
64 }
|
|
65
|
|
66 #endif
|