4987
|
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 "Microsoft Video 1 / CRAM decoder",
|
|
11 "msvidc",
|
|
12 VFM_MSVIDC,
|
|
13 "A'rpi",
|
|
14 "Mike Melanson",
|
|
15 "native codec"
|
|
16 };
|
|
17
|
|
18 LIBVD_EXTERN(msvidc)
|
|
19
|
|
20 // to set/get/query special features/parameters
|
|
21 static int control(sh_video_t *sh,int cmd,void* arg,...){
|
|
22 return CONTROL_UNKNOWN;
|
|
23 }
|
|
24
|
|
25 // init driver
|
|
26 static int init(sh_video_t *sh){
|
|
27 mpcodecs_config_vo(sh,sh->disp_w,sh->disp_h,IMGFMT_BGR24);
|
|
28 return 1;
|
|
29 }
|
|
30
|
|
31 // uninit driver
|
|
32 static void uninit(sh_video_t *sh){
|
|
33 }
|
|
34
|
|
35 //mp_image_t* mpcodecs_get_image(sh_video_t *sh, int mp_imgtype, int mp_imgflag, int w, int h);
|
|
36
|
|
37 void AVI_Decode_Video1_16(
|
|
38 char *encoded,
|
|
39 int encoded_size,
|
|
40 char *decoded,
|
|
41 int width,
|
|
42 int height,
|
|
43 int bytes_per_pixel);
|
|
44
|
|
45 void AVI_Decode_Video1_8(
|
|
46 char *encoded,
|
|
47 int encoded_size,
|
|
48 char *decoded,
|
|
49 int width,
|
|
50 int height,
|
|
51 unsigned char *palette_map,
|
|
52 int bytes_per_pixel);
|
|
53
|
|
54 // decode a frame
|
|
55 static mp_image_t* decode(sh_video_t *sh,void* data,int len,int flags){
|
|
56 mp_image_t* mpi;
|
|
57 if(len<=0) return NULL; // skipped frame
|
|
58
|
|
59 mpi=mpcodecs_get_image(sh, MP_IMGTYPE_STATIC, MP_IMGFLAG_PRESERVE,
|
|
60 sh->disp_w, sh->disp_h);
|
|
61 if(!mpi) return NULL;
|
|
62
|
|
63 if (sh->bih->biBitCount == 16)
|
|
64 AVI_Decode_Video1_16(
|
|
65 data, len, mpi->planes[0],
|
|
66 sh->disp_w, sh->disp_h,
|
|
67 mpi->bpp/8);
|
|
68 else
|
|
69 AVI_Decode_Video1_8(
|
|
70 data, len, mpi->planes[0],
|
|
71 sh->disp_w, sh->disp_h,
|
|
72 (unsigned char *)sh->bih+40,
|
|
73 mpi->bpp/8);
|
|
74
|
|
75 return mpi;
|
|
76 }
|