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 "A'rpi & Alex",
|
5272
|
15 "Xanim (http://xanim.va.pubnix.com/)",
|
4969
|
16 "binary codec plugins"
|
|
17 };
|
|
18
|
|
19 LIBVD_EXTERN(xanim)
|
|
20
|
|
21 #include "xacodec.h"
|
|
22
|
|
23 // to set/get/query special features/parameters
|
|
24 static int control(sh_video_t *sh,int cmd,void* arg,...){
|
|
25 return CONTROL_UNKNOWN;
|
|
26 }
|
|
27
|
|
28 // init driver
|
|
29 static int init(sh_video_t *sh){
|
6525
|
30 if(!mpcodecs_config_vo(sh,sh->disp_w,sh->disp_h,IMGFMT_YV12)) return 0;
|
4969
|
31 return xacodec_init_video(sh,sh->codec->outfmt[sh->outfmtidx]);
|
|
32 }
|
|
33
|
|
34 // uninit driver
|
|
35 static void uninit(sh_video_t *sh){
|
|
36 xacodec_exit();
|
|
37 }
|
|
38
|
|
39 //mp_image_t* mpcodecs_get_image(sh_video_t *sh, int mp_imgtype, int mp_imgflag, int w, int h);
|
|
40
|
|
41 // decode a frame
|
|
42 static mp_image_t* decode(sh_video_t *sh,void* data,int len,int flags){
|
|
43 mp_image_t* mpi;
|
|
44 xacodec_image_t* image;
|
|
45
|
|
46 if(len<=0) return NULL; // skipped frame
|
|
47
|
|
48 image=xacodec_decode_frame(data,len,(flags&3)?1:0);
|
|
49 if(!image) return NULL;
|
|
50
|
|
51 mpi=mpcodecs_get_image(sh, MP_IMGTYPE_EXPORT, MP_IMGFLAG_PRESERVE,
|
|
52 sh->disp_w, sh->disp_h);
|
|
53 if(!mpi) return NULL;
|
|
54
|
|
55 mpi->planes[0]=image->planes[0];
|
|
56 mpi->planes[1]=image->planes[1];
|
|
57 mpi->planes[2]=image->planes[2];
|
|
58 mpi->stride[0]=image->stride[0];
|
|
59 mpi->stride[1]=image->stride[1];
|
|
60 mpi->stride[2]=image->stride[2];
|
|
61
|
|
62 return mpi;
|
|
63 }
|
|
64
|
|
65 #endif
|