4987
|
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 "Autodesk FLI/FLC Animation decoder",
|
|
11 "fli",
|
|
12 VFM_FLI,
|
|
13 "A'rpi",
|
|
14 "Mike Melanson",
|
|
15 "native codec"
|
|
16 };
|
|
17
|
|
18 LIBVD_EXTERN(fli)
|
|
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 void *init_fli_decoder(int width, int height);
|
|
26
|
|
27 void decode_fli_frame(
|
|
28 unsigned char *encoded,
|
|
29 int encoded_size,
|
|
30 unsigned char *decoded,
|
|
31 int width,
|
|
32 int height,
|
|
33 int bytes_per_pixel,
|
|
34 void *context);
|
|
35
|
|
36 // init driver
|
|
37 static int init(sh_video_t *sh){
|
5124
|
38 if(!mpcodecs_config_vo(sh,sh->disp_w,sh->disp_h,IMGFMT_BGR24)) return 0;
|
4987
|
39 sh->context = init_fli_decoder(sh->disp_w, sh->disp_h);
|
|
40 return 1;
|
|
41 }
|
|
42
|
|
43 // uninit driver
|
|
44 static void uninit(sh_video_t *sh){
|
|
45 }
|
|
46
|
|
47 //mp_image_t* mpcodecs_get_image(sh_video_t *sh, int mp_imgtype, int mp_imgflag, int w, int h);
|
|
48
|
|
49 // decode a frame
|
|
50 static mp_image_t* decode(sh_video_t *sh,void* data,int len,int flags){
|
|
51 mp_image_t* mpi;
|
|
52 if(len<=0) return NULL; // skipped frame
|
|
53
|
|
54 mpi=mpcodecs_get_image(sh, MP_IMGTYPE_STATIC, MP_IMGFLAG_PRESERVE,
|
|
55 sh->disp_w, sh->disp_h);
|
|
56 if(!mpi) return NULL;
|
|
57
|
|
58 decode_fli_frame(
|
|
59 data, len, mpi->planes[0],
|
|
60 sh->disp_w, sh->disp_h,
|
|
61 mpi->bpp/8,
|
|
62 sh->context);
|
|
63
|
|
64 return mpi;
|
|
65 }
|