annotate libmpcodecs/vd_cinepak.c @ 6420:370b50a47a18

Darwin/Mac OS X dvd support. Patch from Joey Parrish <joey@yunamusic.com>
author atmos4
date Thu, 13 Jun 2002 22:39:59 +0000
parents 3dcbf67c0de0
children 28677d779205
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",
4900
260edd600949 10l... forgot to set VFM
arpi
parents: 4882
diff changeset
12 VFM_CINEPAK,
4882
2ebd5bed2ce4 cinepak decoder - untested
arpi
parents:
diff changeset
13 "A'rpi",
2ebd5bed2ce4 cinepak decoder - untested
arpi
parents:
diff changeset
14 "Dr. Tim Ferguson, http://www.csse.monash.edu.au/~timf/videocodec.html",
2ebd5bed2ce4 cinepak decoder - untested
arpi
parents:
diff changeset
15 "native codec"
2ebd5bed2ce4 cinepak decoder - untested
arpi
parents:
diff changeset
16 };
2ebd5bed2ce4 cinepak decoder - untested
arpi
parents:
diff changeset
17
2ebd5bed2ce4 cinepak decoder - untested
arpi
parents:
diff changeset
18 LIBVD_EXTERN(cinepak)
2ebd5bed2ce4 cinepak decoder - untested
arpi
parents:
diff changeset
19
2ebd5bed2ce4 cinepak decoder - untested
arpi
parents:
diff changeset
20 // to set/get/query special features/parameters
2ebd5bed2ce4 cinepak decoder - untested
arpi
parents:
diff changeset
21 static int control(sh_video_t *sh,int cmd,void* arg,...){
2ebd5bed2ce4 cinepak decoder - untested
arpi
parents:
diff changeset
22 return CONTROL_UNKNOWN;
2ebd5bed2ce4 cinepak decoder - untested
arpi
parents:
diff changeset
23 }
2ebd5bed2ce4 cinepak decoder - untested
arpi
parents:
diff changeset
24
2ebd5bed2ce4 cinepak decoder - untested
arpi
parents:
diff changeset
25 void *decode_cinepak_init(void);
2ebd5bed2ce4 cinepak decoder - untested
arpi
parents:
diff changeset
26
2ebd5bed2ce4 cinepak decoder - untested
arpi
parents:
diff changeset
27 // init driver
2ebd5bed2ce4 cinepak decoder - untested
arpi
parents:
diff changeset
28 static int init(sh_video_t *sh){
2ebd5bed2ce4 cinepak decoder - untested
arpi
parents:
diff changeset
29 sh->context = decode_cinepak_init();
5124
3dcbf67c0de0 handle error from mpcodecs_config_vo()
arpi
parents: 4986
diff changeset
30 return mpcodecs_config_vo(sh,sh->disp_w,sh->disp_h,IMGFMT_YUY2);
4882
2ebd5bed2ce4 cinepak decoder - untested
arpi
parents:
diff changeset
31 }
2ebd5bed2ce4 cinepak decoder - untested
arpi
parents:
diff changeset
32
2ebd5bed2ce4 cinepak decoder - untested
arpi
parents:
diff changeset
33 // uninit driver
2ebd5bed2ce4 cinepak decoder - untested
arpi
parents:
diff changeset
34 static void uninit(sh_video_t *sh){
2ebd5bed2ce4 cinepak decoder - untested
arpi
parents:
diff changeset
35 }
2ebd5bed2ce4 cinepak decoder - untested
arpi
parents:
diff changeset
36
2ebd5bed2ce4 cinepak decoder - untested
arpi
parents:
diff changeset
37 //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
38
4946
a55d56509a2c using new cinepak codec api
arpi
parents: 4900
diff changeset
39 //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
40 void decode_cinepak(void *context, unsigned char *buf, int size, mp_image_t* mpi);
4882
2ebd5bed2ce4 cinepak decoder - untested
arpi
parents:
diff changeset
41
2ebd5bed2ce4 cinepak decoder - untested
arpi
parents:
diff changeset
42 // decode a frame
2ebd5bed2ce4 cinepak decoder - untested
arpi
parents:
diff changeset
43 static mp_image_t* decode(sh_video_t *sh,void* data,int len,int flags){
2ebd5bed2ce4 cinepak decoder - untested
arpi
parents:
diff changeset
44 mp_image_t* mpi;
2ebd5bed2ce4 cinepak decoder - untested
arpi
parents:
diff changeset
45 if(len<=0) return NULL; // skipped frame
2ebd5bed2ce4 cinepak decoder - untested
arpi
parents:
diff changeset
46
4954
43fc27b873ca order of #includes changed - shouldn't include local things before config.h
arpi
parents: 4946
diff changeset
47 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
48 (sh->disp_w+3)&(~3),
43fc27b873ca order of #includes changed - shouldn't include local things before config.h
arpi
parents: 4946
diff changeset
49 (sh->disp_h+3)&(~3));
4882
2ebd5bed2ce4 cinepak decoder - untested
arpi
parents:
diff changeset
50
2ebd5bed2ce4 cinepak decoder - untested
arpi
parents:
diff changeset
51 if(!mpi){ // temporary!
2ebd5bed2ce4 cinepak decoder - untested
arpi
parents:
diff changeset
52 printf("couldn't allocate image for cinepak codec\n");
2ebd5bed2ce4 cinepak decoder - untested
arpi
parents:
diff changeset
53 return NULL;
2ebd5bed2ce4 cinepak decoder - untested
arpi
parents:
diff changeset
54 }
4955
arpi
parents: 4954
diff changeset
55
arpi
parents: 4954
diff changeset
56 #if 0
4954
43fc27b873ca order of #includes changed - shouldn't include local things before config.h
arpi
parents: 4946
diff changeset
57 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
58 mpi->planes[0], mpi->stride[0],
43fc27b873ca order of #includes changed - shouldn't include local things before config.h
arpi
parents: 4946
diff changeset
59 mpi->planes[1], mpi->stride[1],
43fc27b873ca order of #includes changed - shouldn't include local things before config.h
arpi
parents: 4946
diff changeset
60 mpi->planes[2], mpi->stride[2],
43fc27b873ca order of #includes changed - shouldn't include local things before config.h
arpi
parents: 4946
diff changeset
61 mpi->planes[1]-mpi->planes[0],
43fc27b873ca order of #includes changed - shouldn't include local things before config.h
arpi
parents: 4946
diff changeset
62 mpi->planes[2]-mpi->planes[1]);
4955
arpi
parents: 4954
diff changeset
63 #endif
arpi
parents: 4954
diff changeset
64
4946
a55d56509a2c using new cinepak codec api
arpi
parents: 4900
diff changeset
65 // 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
66 // (mpi->flags&MP_IMGFLAG_YUV)?16:(mpi->imgfmt&255), mpi->stride[0]);
a55d56509a2c using new cinepak codec api
arpi
parents: 4900
diff changeset
67
a55d56509a2c using new cinepak codec api
arpi
parents: 4900
diff changeset
68 decode_cinepak(sh->context, data, len, mpi);
4882
2ebd5bed2ce4 cinepak decoder - untested
arpi
parents:
diff changeset
69
2ebd5bed2ce4 cinepak decoder - untested
arpi
parents:
diff changeset
70 return mpi;
2ebd5bed2ce4 cinepak decoder - untested
arpi
parents:
diff changeset
71 }
2ebd5bed2ce4 cinepak decoder - untested
arpi
parents:
diff changeset
72