annotate libmpcodecs/vd_fli.c @ 8180:4ba9aed295f2

Fixing segfault bug and addnig support for lrintf() in format conversion
author anders
date Wed, 13 Nov 2002 09:09:50 +0000
parents 28677d779205
children
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 "A'rpi",
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
13 "Mike Melanson",
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
14 "native codec"
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
15 };
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
16
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
17 LIBVD_EXTERN(fli)
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
18
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
19 // to set/get/query special features/parameters
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
20 static int control(sh_video_t *sh,int cmd,void* arg,...){
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
21 return CONTROL_UNKNOWN;
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
22 }
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
23
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
24 void *init_fli_decoder(int width, int height);
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
25
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
26 void decode_fli_frame(
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
27 unsigned char *encoded,
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
28 int encoded_size,
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
29 unsigned char *decoded,
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
30 int width,
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
31 int height,
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
32 int bytes_per_pixel,
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
33 void *context);
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
34
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
35 // init driver
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
36 static int init(sh_video_t *sh){
5124
3dcbf67c0de0 handle error from mpcodecs_config_vo()
arpi
parents: 4987
diff changeset
37 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
38 sh->context = init_fli_decoder(sh->disp_w, sh->disp_h);
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
39 return 1;
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
40 }
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
41
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
42 // uninit driver
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
43 static void uninit(sh_video_t *sh){
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
44 }
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
45
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
46 //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
47
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
48 // decode a frame
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
49 static mp_image_t* decode(sh_video_t *sh,void* data,int len,int flags){
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
50 mp_image_t* mpi;
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
51 if(len<=0) return NULL; // skipped frame
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
52
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
53 mpi=mpcodecs_get_image(sh, MP_IMGTYPE_STATIC, MP_IMGFLAG_PRESERVE,
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
54 sh->disp_w, sh->disp_h);
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
55 if(!mpi) return NULL;
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
56
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
57 decode_fli_frame(
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
58 data, len, mpi->planes[0],
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
59 sh->disp_w, sh->disp_h,
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
60 mpi->bpp/8,
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
61 sh->context);
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
62
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
63 return mpi;
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
64 }