annotate libmpcodecs/vd_fli.c @ 5340:0f12fb7c1c5d

imported from MPlayerXP, dlopen() hack removed, some bugs fixed, interface functions changed to static, info->author field added
author arpi
date Mon, 25 Mar 2002 21:06:01 +0000
parents 3dcbf67c0de0
children 28677d779205
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
4987
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
1 #include <stdio.h>
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
2 #include <stdlib.h>
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
3
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
4 #include "config.h"
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
5 #include "mp_msg.h"
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
6
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
7 #include "vd_internal.h"
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
8
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
9 static vd_info_t info = {
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
10 "Autodesk FLI/FLC Animation decoder",
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
11 "fli",
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
12 VFM_FLI,
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
13 "A'rpi",
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
14 "Mike Melanson",
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
15 "native codec"
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
16 };
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
17
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
18 LIBVD_EXTERN(fli)
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
19
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
20 // to set/get/query special features/parameters
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
21 static int control(sh_video_t *sh,int cmd,void* arg,...){
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
22 return CONTROL_UNKNOWN;
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
23 }
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
24
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
25 void *init_fli_decoder(int width, int height);
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
26
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
27 void decode_fli_frame(
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
28 unsigned char *encoded,
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
29 int encoded_size,
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
30 unsigned char *decoded,
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
31 int width,
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
32 int height,
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
33 int bytes_per_pixel,
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
34 void *context);
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
35
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
36 // init driver
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
37 static int init(sh_video_t *sh){
5124
3dcbf67c0de0 handle error from mpcodecs_config_vo()
arpi
parents: 4987
diff changeset
38 if(!mpcodecs_config_vo(sh,sh->disp_w,sh->disp_h,IMGFMT_BGR24)) return 0;
4987
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
39 sh->context = init_fli_decoder(sh->disp_w, sh->disp_h);
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
40 return 1;
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
41 }
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
42
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
43 // uninit driver
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
44 static void uninit(sh_video_t *sh){
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
45 }
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
46
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
47 //mp_image_t* mpcodecs_get_image(sh_video_t *sh, int mp_imgtype, int mp_imgflag, int w, int h);
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
48
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
49 // decode a frame
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
50 static mp_image_t* decode(sh_video_t *sh,void* data,int len,int flags){
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
51 mp_image_t* mpi;
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
52 if(len<=0) return NULL; // skipped frame
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
53
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
54 mpi=mpcodecs_get_image(sh, MP_IMGTYPE_STATIC, MP_IMGFLAG_PRESERVE,
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
55 sh->disp_w, sh->disp_h);
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
56 if(!mpi) return NULL;
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
57
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
58 decode_fli_frame(
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
59 data, len, mpi->planes[0],
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
60 sh->disp_w, sh->disp_h,
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
61 mpi->bpp/8,
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
62 sh->context);
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
63
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
64 return mpi;
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
65 }