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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
4882
2ebd5bed2ce4 cinepak decoder - untested
arpi
parents:
diff changeset
1 #include <stdio.h>
2ebd5bed2ce4 cinepak decoder - untested
arpi
parents:
diff changeset
2 #include <stdlib.h>
2ebd5bed2ce4 cinepak decoder - untested
arpi
parents:
diff changeset
3
2ebd5bed2ce4 cinepak decoder - untested
arpi
parents:
diff changeset
4 #include "config.h"
2ebd5bed2ce4 cinepak decoder - untested
arpi
parents:
diff changeset
5 #include "mp_msg.h"
2ebd5bed2ce4 cinepak decoder - untested
arpi
parents:
diff changeset
6
2ebd5bed2ce4 cinepak decoder - untested
arpi
parents:
diff changeset
7 #include "vd_internal.h"
2ebd5bed2ce4 cinepak decoder - untested
arpi
parents:
diff changeset
8
2ebd5bed2ce4 cinepak decoder - untested
arpi
parents:
diff changeset
9 static vd_info_t info = {
2ebd5bed2ce4 cinepak decoder - untested
arpi
parents:
diff changeset
10 "Cinepak Video decoder",
2ebd5bed2ce4 cinepak decoder - untested
arpi
parents:
diff changeset
11 "cinepak",
2ebd5bed2ce4 cinepak decoder - untested
arpi
parents:
diff changeset
12 "A'rpi",
2ebd5bed2ce4 cinepak decoder - untested
arpi
parents:
diff changeset
13 "Dr. Tim Ferguson, http://www.csse.monash.edu.au/~timf/videocodec.html",
2ebd5bed2ce4 cinepak decoder - untested
arpi
parents:
diff changeset
14 "native codec"
2ebd5bed2ce4 cinepak decoder - untested
arpi
parents:
diff changeset
15 };
2ebd5bed2ce4 cinepak decoder - untested
arpi
parents:
diff changeset
16
2ebd5bed2ce4 cinepak decoder - untested
arpi
parents:
diff changeset
17 LIBVD_EXTERN(cinepak)
2ebd5bed2ce4 cinepak decoder - untested
arpi
parents:
diff changeset
18
2ebd5bed2ce4 cinepak decoder - untested
arpi
parents:
diff changeset
19 // to set/get/query special features/parameters
2ebd5bed2ce4 cinepak decoder - untested
arpi
parents:
diff changeset
20 static int control(sh_video_t *sh,int cmd,void* arg,...){
2ebd5bed2ce4 cinepak decoder - untested
arpi
parents:
diff changeset
21 return CONTROL_UNKNOWN;
2ebd5bed2ce4 cinepak decoder - untested
arpi
parents:
diff changeset
22 }
2ebd5bed2ce4 cinepak decoder - untested
arpi
parents:
diff changeset
23
2ebd5bed2ce4 cinepak decoder - untested
arpi
parents:
diff changeset
24 void *decode_cinepak_init(void);
2ebd5bed2ce4 cinepak decoder - untested
arpi
parents:
diff changeset
25
2ebd5bed2ce4 cinepak decoder - untested
arpi
parents:
diff changeset
26 // init driver
2ebd5bed2ce4 cinepak decoder - untested
arpi
parents:
diff changeset
27 static int init(sh_video_t *sh){
2ebd5bed2ce4 cinepak decoder - untested
arpi
parents:
diff changeset
28 sh->context = decode_cinepak_init();
5124
3dcbf67c0de0 handle error from mpcodecs_config_vo()
arpi
parents: 4986
diff changeset
29 return mpcodecs_config_vo(sh,sh->disp_w,sh->disp_h,IMGFMT_YUY2);
4882
2ebd5bed2ce4 cinepak decoder - untested
arpi
parents:
diff changeset
30 }
2ebd5bed2ce4 cinepak decoder - untested
arpi
parents:
diff changeset
31
2ebd5bed2ce4 cinepak decoder - untested
arpi
parents:
diff changeset
32 // uninit driver
2ebd5bed2ce4 cinepak decoder - untested
arpi
parents:
diff changeset
33 static void uninit(sh_video_t *sh){
2ebd5bed2ce4 cinepak decoder - untested
arpi
parents:
diff changeset
34 }
2ebd5bed2ce4 cinepak decoder - untested
arpi
parents:
diff changeset
35
2ebd5bed2ce4 cinepak decoder - untested
arpi
parents:
diff changeset
36 //mp_image_t* mpcodecs_get_image(sh_video_t *sh, int mp_imgtype, int mp_imgflag, int w, int h);
2ebd5bed2ce4 cinepak decoder - untested
arpi
parents:
diff changeset
37
4946
a55d56509a2c using new cinepak codec api
arpi
parents: 4900
diff changeset
38 //void decode_cinepak(void *context, unsigned char *buf, int size, unsigned char *frame, int width, int height, int bit_per_pixel, int stride_);
a55d56509a2c using new cinepak codec api
arpi
parents: 4900
diff changeset
39 void decode_cinepak(void *context, unsigned char *buf, int size, mp_image_t* mpi);
4882
2ebd5bed2ce4 cinepak decoder - untested
arpi
parents:
diff changeset
40
2ebd5bed2ce4 cinepak decoder - untested
arpi
parents:
diff changeset
41 // decode a frame
2ebd5bed2ce4 cinepak decoder - untested
arpi
parents:
diff changeset
42 static mp_image_t* decode(sh_video_t *sh,void* data,int len,int flags){
2ebd5bed2ce4 cinepak decoder - untested
arpi
parents:
diff changeset
43 mp_image_t* mpi;
2ebd5bed2ce4 cinepak decoder - untested
arpi
parents:
diff changeset
44 if(len<=0) return NULL; // skipped frame
2ebd5bed2ce4 cinepak decoder - untested
arpi
parents:
diff changeset
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
2ebd5bed2ce4 cinepak decoder - untested
arpi
parents:
diff changeset
49
2ebd5bed2ce4 cinepak decoder - untested
arpi
parents:
diff changeset
50 if(!mpi){ // temporary!
2ebd5bed2ce4 cinepak decoder - untested
arpi
parents:
diff changeset
51 printf("couldn't allocate image for cinepak codec\n");
2ebd5bed2ce4 cinepak decoder - untested
arpi
parents:
diff changeset
52 return NULL;
2ebd5bed2ce4 cinepak decoder - untested
arpi
parents:
diff changeset
53 }
4955
arpi
parents: 4954
diff changeset
54
arpi
parents: 4954
diff changeset
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
arpi
parents: 4954
diff changeset
62 #endif
arpi
parents: 4954
diff changeset
63
4946
a55d56509a2c using new cinepak codec api
arpi
parents: 4900
diff changeset
64 // decode_cinepak(sh->context, data, len, mpi->planes[0], sh->disp_w, sh->disp_h,
a55d56509a2c using new cinepak codec api
arpi
parents: 4900
diff changeset
65 // (mpi->flags&MP_IMGFLAG_YUV)?16:(mpi->imgfmt&255), mpi->stride[0]);
a55d56509a2c using new cinepak codec api
arpi
parents: 4900
diff changeset
66
a55d56509a2c using new cinepak codec api
arpi
parents: 4900
diff changeset
67 decode_cinepak(sh->context, data, len, mpi);
4882
2ebd5bed2ce4 cinepak decoder - untested
arpi
parents:
diff changeset
68
2ebd5bed2ce4 cinepak decoder - untested
arpi
parents:
diff changeset
69 return mpi;
2ebd5bed2ce4 cinepak decoder - untested
arpi
parents:
diff changeset
70 }
2ebd5bed2ce4 cinepak decoder - untested
arpi
parents:
diff changeset
71