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 "Quicktime Animation (RLE) decoder",
|
|
11 "qtrle",
|
|
12 VFM_QTRLE,
|
|
13 "A'rpi",
|
|
14 "Mike Melanson",
|
|
15 "native codec"
|
|
16 };
|
|
17
|
|
18 LIBVD_EXTERN(qtrle)
|
|
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 if (sh->bih->biBitCount != 24){
|
|
28 mp_msg(MSGT_DECVIDEO,MSGL_ERR,
|
|
29 " *** FYI: This Quicktime file is using %d-bit RLE Animation\n" \
|
|
30 " encoding, which is not yet supported by MPlayer. But if you upload\n" \
|
|
31 " this Quicktime file to the MPlayer FTP, the team could look at it.\n",
|
|
32 sh->bih->biBitCount);
|
|
33 return 0;
|
|
34 }
|
|
35
|
5124
|
36 return mpcodecs_config_vo(sh,sh->disp_w,sh->disp_h,IMGFMT_BGR24);
|
4989
|
37 }
|
|
38
|
|
39 // uninit driver
|
|
40 static void uninit(sh_video_t *sh){
|
|
41 }
|
|
42
|
|
43 //mp_image_t* mpcodecs_get_image(sh_video_t *sh, int mp_imgtype, int mp_imgflag, int w, int h);
|
|
44
|
|
45 void qt_decode_rle(
|
|
46 unsigned char *encoded,
|
|
47 int encoded_size,
|
|
48 unsigned char *decoded,
|
|
49 int width,
|
|
50 int height,
|
|
51 int encoded_bpp,
|
|
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 qt_decode_rle(
|
|
64 data,len, mpi->planes[0],
|
|
65 sh->disp_w, sh->disp_h,
|
|
66 sh->bih->biBitCount,
|
|
67 mpi->bpp/8);
|
|
68
|
|
69 return mpi;
|
|
70 }
|