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){
|
5124
|
27 return mpcodecs_config_vo(sh,sh->disp_w,sh->disp_h,IMGFMT_BGR24);
|
4987
|
28 }
|
|
29
|
|
30 // uninit driver
|
|
31 static void uninit(sh_video_t *sh){
|
|
32 }
|
|
33
|
|
34 //mp_image_t* mpcodecs_get_image(sh_video_t *sh, int mp_imgtype, int mp_imgflag, int w, int h);
|
|
35
|
|
36 void AVI_Decode_Video1_16(
|
|
37 char *encoded,
|
|
38 int encoded_size,
|
|
39 char *decoded,
|
|
40 int width,
|
|
41 int height,
|
|
42 int bytes_per_pixel);
|
|
43
|
|
44 void AVI_Decode_Video1_8(
|
|
45 char *encoded,
|
|
46 int encoded_size,
|
|
47 char *decoded,
|
|
48 int width,
|
|
49 int height,
|
|
50 unsigned char *palette_map,
|
|
51 int bytes_per_pixel);
|
|
52
|
|
53 // decode a frame
|
|
54 static mp_image_t* decode(sh_video_t *sh,void* data,int len,int flags){
|
|
55 mp_image_t* mpi;
|
|
56 if(len<=0) return NULL; // skipped frame
|
|
57
|
|
58 mpi=mpcodecs_get_image(sh, MP_IMGTYPE_STATIC, MP_IMGFLAG_PRESERVE,
|
|
59 sh->disp_w, sh->disp_h);
|
|
60 if(!mpi) return NULL;
|
|
61
|
|
62 if (sh->bih->biBitCount == 16)
|
|
63 AVI_Decode_Video1_16(
|
|
64 data, len, mpi->planes[0],
|
|
65 sh->disp_w, sh->disp_h,
|
|
66 mpi->bpp/8);
|
|
67 else
|
|
68 AVI_Decode_Video1_8(
|
|
69 data, len, mpi->planes[0],
|
|
70 sh->disp_w, sh->disp_h,
|
|
71 (unsigned char *)sh->bih+40,
|
|
72 mpi->bpp/8);
|
|
73
|
|
74 return mpi;
|
|
75 }
|