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