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