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