annotate libmpcodecs/vd_msvidc.c @ 5789:0132c5747e8a

fix audio only files play
author pontscho
date Mon, 22 Apr 2002 21:36:12 +0000
parents 3dcbf67c0de0
children 28677d779205
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 VFM_MSVIDC,
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
13 "A'rpi",
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
14 "Mike Melanson",
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
15 "native codec"
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
16 };
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
17
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
18 LIBVD_EXTERN(msvidc)
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
19
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
20 // to set/get/query special features/parameters
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
21 static int control(sh_video_t *sh,int cmd,void* arg,...){
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
22 return CONTROL_UNKNOWN;
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
23 }
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
24
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
25 // init driver
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
26 static int init(sh_video_t *sh){
5124
3dcbf67c0de0 handle error from mpcodecs_config_vo()
arpi
parents: 4987
diff changeset
27 return mpcodecs_config_vo(sh,sh->disp_w,sh->disp_h,IMGFMT_BGR24);
4987
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
28 }
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
29
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
30 // uninit driver
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
31 static void uninit(sh_video_t *sh){
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
32 }
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
33
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
34 //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
35
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
36 void AVI_Decode_Video1_16(
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
37 char *encoded,
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
38 int encoded_size,
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
39 char *decoded,
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
40 int width,
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
41 int height,
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
42 int bytes_per_pixel);
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
43
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
44 void AVI_Decode_Video1_8(
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
45 char *encoded,
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
46 int encoded_size,
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
47 char *decoded,
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
48 int width,
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
49 int height,
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
50 unsigned char *palette_map,
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
51 int bytes_per_pixel);
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
52
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
53 // decode a frame
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
54 static mp_image_t* decode(sh_video_t *sh,void* data,int len,int flags){
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
55 mp_image_t* mpi;
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
56 if(len<=0) return NULL; // skipped frame
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
57
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
58 mpi=mpcodecs_get_image(sh, MP_IMGTYPE_STATIC, MP_IMGFLAG_PRESERVE,
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 if(!mpi) return NULL;
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
61
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
62 if (sh->bih->biBitCount == 16)
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
63 AVI_Decode_Video1_16(
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
64 data, len, mpi->planes[0],
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
65 sh->disp_w, sh->disp_h,
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
66 mpi->bpp/8);
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
67 else
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
68 AVI_Decode_Video1_8(
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
69 data, len, mpi->planes[0],
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
70 sh->disp_w, sh->disp_h,
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
71 (unsigned char *)sh->bih+40,
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
72 mpi->bpp/8);
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
73
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
74 return mpi;
f412b0110524 fli and msvideo1 added
arpi
parents:
diff changeset
75 }