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 "A'rpi",
|
|
13 "Mike Melanson",
|
|
14 "native codec"
|
|
15 };
|
|
16
|
|
17 LIBVD_EXTERN(qtsmc)
|
|
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 int qt_init_decode_smc(void);
|
|
25
|
|
26 // init driver
|
|
27 static int init(sh_video_t *sh){
|
|
28 if (qt_init_decode_smc() != 0){
|
|
29 mp_msg(MSGT_DECVIDEO, MSGL_ERR, "SMC decoder could not allocate enough memory");
|
|
30 return 0;
|
|
31 }
|
|
32
|
5124
|
33 return mpcodecs_config_vo(sh,sh->disp_w,sh->disp_h,IMGFMT_BGR24);
|
4989
|
34 }
|
|
35
|
|
36 // uninit driver
|
|
37 static void uninit(sh_video_t *sh){
|
|
38 }
|
|
39
|
|
40 //mp_image_t* mpcodecs_get_image(sh_video_t *sh, int mp_imgtype, int mp_imgflag, int w, int h);
|
|
41
|
|
42 void qt_decode_smc(
|
|
43 unsigned char *encoded,
|
|
44 int encoded_size,
|
|
45 unsigned char *decoded,
|
|
46 int width,
|
|
47 int height,
|
|
48 unsigned char *palette_map,
|
|
49 int bytes_per_pixel);
|
|
50
|
|
51 // decode a frame
|
|
52 static mp_image_t* decode(sh_video_t *sh,void* data,int len,int flags){
|
|
53 mp_image_t* mpi;
|
|
54 if(len<=0) return NULL; // skipped frame
|
|
55
|
|
56 mpi=mpcodecs_get_image(sh, MP_IMGTYPE_STATIC, MP_IMGFLAG_PRESERVE,
|
|
57 sh->disp_w, sh->disp_h);
|
|
58 if(!mpi) return NULL;
|
|
59
|
|
60 qt_decode_smc(
|
|
61 data,len, mpi->planes[0],
|
|
62 sh->disp_w, sh->disp_h,
|
|
63 (unsigned char *)sh->bih+40,
|
|
64 mpi->bpp/8);
|
|
65
|
|
66 return mpi;
|
|
67 }
|