Mercurial > mplayer.hg
annotate libmpcodecs/vd_cinepak.c @ 9583:e442209e6241
Fix small memleak in control().
author | ranma |
---|---|
date | Fri, 14 Mar 2003 17:19:19 +0000 |
parents | 28677d779205 |
children |
rev | line source |
---|---|
4882 | 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 "Cinepak Video decoder", | |
11 "cinepak", | |
12 "A'rpi", | |
13 "Dr. Tim Ferguson, http://www.csse.monash.edu.au/~timf/videocodec.html", | |
14 "native codec" | |
15 }; | |
16 | |
17 LIBVD_EXTERN(cinepak) | |
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 *decode_cinepak_init(void); | |
25 | |
26 // init driver | |
27 static int init(sh_video_t *sh){ | |
28 sh->context = decode_cinepak_init(); | |
5124 | 29 return mpcodecs_config_vo(sh,sh->disp_w,sh->disp_h,IMGFMT_YUY2); |
4882 | 30 } |
31 | |
32 // uninit driver | |
33 static void uninit(sh_video_t *sh){ | |
34 } | |
35 | |
36 //mp_image_t* mpcodecs_get_image(sh_video_t *sh, int mp_imgtype, int mp_imgflag, int w, int h); | |
37 | |
4946 | 38 //void decode_cinepak(void *context, unsigned char *buf, int size, unsigned char *frame, int width, int height, int bit_per_pixel, int stride_); |
39 void decode_cinepak(void *context, unsigned char *buf, int size, mp_image_t* mpi); | |
4882 | 40 |
41 // decode a frame | |
42 static mp_image_t* decode(sh_video_t *sh,void* data,int len,int flags){ | |
43 mp_image_t* mpi; | |
44 if(len<=0) return NULL; // skipped frame | |
45 | |
4954
43fc27b873ca
order of #includes changed - shouldn't include local things before config.h
arpi
parents:
4946
diff
changeset
|
46 mpi=mpcodecs_get_image(sh, MP_IMGTYPE_STATIC, MP_IMGFLAG_PRESERVE | MP_IMGFLAG_ACCEPT_STRIDE, |
43fc27b873ca
order of #includes changed - shouldn't include local things before config.h
arpi
parents:
4946
diff
changeset
|
47 (sh->disp_w+3)&(~3), |
43fc27b873ca
order of #includes changed - shouldn't include local things before config.h
arpi
parents:
4946
diff
changeset
|
48 (sh->disp_h+3)&(~3)); |
4882 | 49 |
50 if(!mpi){ // temporary! | |
51 printf("couldn't allocate image for cinepak codec\n"); | |
52 return NULL; | |
53 } | |
4955 | 54 |
55 #if 0 | |
4954
43fc27b873ca
order of #includes changed - shouldn't include local things before config.h
arpi
parents:
4946
diff
changeset
|
56 printf("mpi: %p/%d %p/%d %p/%d (%d) (%d) \n", |
43fc27b873ca
order of #includes changed - shouldn't include local things before config.h
arpi
parents:
4946
diff
changeset
|
57 mpi->planes[0], mpi->stride[0], |
43fc27b873ca
order of #includes changed - shouldn't include local things before config.h
arpi
parents:
4946
diff
changeset
|
58 mpi->planes[1], mpi->stride[1], |
43fc27b873ca
order of #includes changed - shouldn't include local things before config.h
arpi
parents:
4946
diff
changeset
|
59 mpi->planes[2], mpi->stride[2], |
43fc27b873ca
order of #includes changed - shouldn't include local things before config.h
arpi
parents:
4946
diff
changeset
|
60 mpi->planes[1]-mpi->planes[0], |
43fc27b873ca
order of #includes changed - shouldn't include local things before config.h
arpi
parents:
4946
diff
changeset
|
61 mpi->planes[2]-mpi->planes[1]); |
4955 | 62 #endif |
63 | |
4946 | 64 // decode_cinepak(sh->context, data, len, mpi->planes[0], sh->disp_w, sh->disp_h, |
65 // (mpi->flags&MP_IMGFLAG_YUV)?16:(mpi->imgfmt&255), mpi->stride[0]); | |
66 | |
67 decode_cinepak(sh->context, data, len, mpi); | |
4882 | 68 |
69 return mpi; | |
70 } | |
71 |