annotate libmpcodecs/vd_msvidc.c @ 8744:f3c6f022d6b0

10l ;)
author colin
date Fri, 03 Jan 2003 18:33:26 +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 "Microsoft Video 1 / CRAM decoder",
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
11 "msvidc",
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(msvidc)
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 // init driver
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
25 static int init(sh_video_t *sh){
5124
3dcbf67c0de0 handle error from mpcodecs_config_vo()
arpi
parents: 4987
diff changeset
26 return mpcodecs_config_vo(sh,sh->disp_w,sh->disp_h,IMGFMT_BGR24);
4987
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
27 }
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
28
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
29 // uninit driver
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
30 static void uninit(sh_video_t *sh){
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
31 }
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
32
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
33 //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
34
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
35 void AVI_Decode_Video1_16(
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
36 char *encoded,
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
37 int encoded_size,
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
38 char *decoded,
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
39 int width,
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
40 int height,
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
41 int bytes_per_pixel);
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
42
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
43 void AVI_Decode_Video1_8(
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
44 char *encoded,
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
45 int encoded_size,
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
46 char *decoded,
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
47 int width,
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
48 int height,
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
49 unsigned char *palette_map,
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
50 int bytes_per_pixel);
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
51
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
52 // decode a frame
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
53 static mp_image_t* decode(sh_video_t *sh,void* data,int len,int flags){
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
54 mp_image_t* mpi;
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
55 if(len<=0) return NULL; // skipped frame
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
56
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
57 mpi=mpcodecs_get_image(sh, MP_IMGTYPE_STATIC, MP_IMGFLAG_PRESERVE,
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
58 sh->disp_w, sh->disp_h);
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
59 if(!mpi) return NULL;
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
60
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
61 if (sh->bih->biBitCount == 16)
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
62 AVI_Decode_Video1_16(
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
63 data, len, mpi->planes[0],
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
64 sh->disp_w, sh->disp_h,
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
65 mpi->bpp/8);
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
66 else
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
67 AVI_Decode_Video1_8(
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
68 data, len, mpi->planes[0],
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
69 sh->disp_w, sh->disp_h,
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
70 (unsigned char *)sh->bih+40,
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
71 mpi->bpp/8);
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
72
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
73 return mpi;
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
74 }