4989
|
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 "Apple Graphics (SMC) decoder",
|
|
11 "qtsmc",
|
|
12 VFM_QTSMC,
|
|
13 "A'rpi",
|
|
14 "Mike Melanson",
|
|
15 "native codec"
|
|
16 };
|
|
17
|
|
18 LIBVD_EXTERN(qtsmc)
|
|
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 int qt_init_decode_smc(void);
|
|
26
|
|
27 // init driver
|
|
28 static int init(sh_video_t *sh){
|
|
29 if (qt_init_decode_smc() != 0){
|
|
30 mp_msg(MSGT_DECVIDEO, MSGL_ERR, "SMC decoder could not allocate enough memory");
|
|
31 return 0;
|
|
32 }
|
|
33
|
5124
|
34 return mpcodecs_config_vo(sh,sh->disp_w,sh->disp_h,IMGFMT_BGR24);
|
4989
|
35 }
|
|
36
|
|
37 // uninit driver
|
|
38 static void uninit(sh_video_t *sh){
|
|
39 }
|
|
40
|
|
41 //mp_image_t* mpcodecs_get_image(sh_video_t *sh, int mp_imgtype, int mp_imgflag, int w, int h);
|
|
42
|
|
43 void qt_decode_smc(
|
|
44 unsigned char *encoded,
|
|
45 int encoded_size,
|
|
46 unsigned 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 qt_decode_smc(
|
|
62 data,len, mpi->planes[0],
|
|
63 sh->disp_w, sh->disp_h,
|
|
64 (unsigned char *)sh->bih+40,
|
|
65 mpi->bpp/8);
|
|
66
|
|
67 return mpi;
|
|
68 }
|