Mercurial > mplayer.hg
annotate libmpcodecs/vd_qtrpza.c @ 9278:caea8ed36b48
The reason why mplayer crashes (in some cases) when using x11
output and -wid (>0) parameter is this:
Mplayer by default creates a colormap using DirectColor visual. If the
window given to mplayer uses TrueColor visual there will be an error
when mplayer sets the colormap for the window. This patch
modifies mplayer to use TrueColor visual if the window given to mplayer
uses TrueColor. Another solution is to make sure that the window given to
mplayer is created using DirectColor visual if it is supported by the
display.
Jouni Tulkki <jitulkki@cc.hut.fi>
author | arpi |
---|---|
date | Tue, 04 Feb 2003 18:31:44 +0000 |
parents | 75048549dc44 |
children |
rev | line source |
---|---|
4915
f6990fad0ab3
Qt RPZA decoder interface by Roberto Togni <rtogni@bresciaonline.it>
arpi
parents:
diff
changeset
|
1 #include <stdio.h> |
f6990fad0ab3
Qt RPZA decoder interface by Roberto Togni <rtogni@bresciaonline.it>
arpi
parents:
diff
changeset
|
2 #include <stdlib.h> |
f6990fad0ab3
Qt RPZA decoder interface by Roberto Togni <rtogni@bresciaonline.it>
arpi
parents:
diff
changeset
|
3 |
f6990fad0ab3
Qt RPZA decoder interface by Roberto Togni <rtogni@bresciaonline.it>
arpi
parents:
diff
changeset
|
4 #include "config.h" |
f6990fad0ab3
Qt RPZA decoder interface by Roberto Togni <rtogni@bresciaonline.it>
arpi
parents:
diff
changeset
|
5 #include "mp_msg.h" |
f6990fad0ab3
Qt RPZA decoder interface by Roberto Togni <rtogni@bresciaonline.it>
arpi
parents:
diff
changeset
|
6 |
f6990fad0ab3
Qt RPZA decoder interface by Roberto Togni <rtogni@bresciaonline.it>
arpi
parents:
diff
changeset
|
7 #include "vd_internal.h" |
f6990fad0ab3
Qt RPZA decoder interface by Roberto Togni <rtogni@bresciaonline.it>
arpi
parents:
diff
changeset
|
8 |
f6990fad0ab3
Qt RPZA decoder interface by Roberto Togni <rtogni@bresciaonline.it>
arpi
parents:
diff
changeset
|
9 static vd_info_t info = { |
f6990fad0ab3
Qt RPZA decoder interface by Roberto Togni <rtogni@bresciaonline.it>
arpi
parents:
diff
changeset
|
10 "Quicktime Apple Video", |
f6990fad0ab3
Qt RPZA decoder interface by Roberto Togni <rtogni@bresciaonline.it>
arpi
parents:
diff
changeset
|
11 "qtrpza", |
f6990fad0ab3
Qt RPZA decoder interface by Roberto Togni <rtogni@bresciaonline.it>
arpi
parents:
diff
changeset
|
12 "Roberto Togni", |
f6990fad0ab3
Qt RPZA decoder interface by Roberto Togni <rtogni@bresciaonline.it>
arpi
parents:
diff
changeset
|
13 "Roberto Togni", |
f6990fad0ab3
Qt RPZA decoder interface by Roberto Togni <rtogni@bresciaonline.it>
arpi
parents:
diff
changeset
|
14 "native codec" |
f6990fad0ab3
Qt RPZA decoder interface by Roberto Togni <rtogni@bresciaonline.it>
arpi
parents:
diff
changeset
|
15 }; |
f6990fad0ab3
Qt RPZA decoder interface by Roberto Togni <rtogni@bresciaonline.it>
arpi
parents:
diff
changeset
|
16 |
f6990fad0ab3
Qt RPZA decoder interface by Roberto Togni <rtogni@bresciaonline.it>
arpi
parents:
diff
changeset
|
17 LIBVD_EXTERN(qtrpza) |
f6990fad0ab3
Qt RPZA decoder interface by Roberto Togni <rtogni@bresciaonline.it>
arpi
parents:
diff
changeset
|
18 |
f6990fad0ab3
Qt RPZA decoder interface by Roberto Togni <rtogni@bresciaonline.it>
arpi
parents:
diff
changeset
|
19 // to set/get/query special features/parameters |
f6990fad0ab3
Qt RPZA decoder interface by Roberto Togni <rtogni@bresciaonline.it>
arpi
parents:
diff
changeset
|
20 static int control(sh_video_t *sh,int cmd,void* arg,...){ |
f6990fad0ab3
Qt RPZA decoder interface by Roberto Togni <rtogni@bresciaonline.it>
arpi
parents:
diff
changeset
|
21 return CONTROL_UNKNOWN; |
f6990fad0ab3
Qt RPZA decoder interface by Roberto Togni <rtogni@bresciaonline.it>
arpi
parents:
diff
changeset
|
22 } |
f6990fad0ab3
Qt RPZA decoder interface by Roberto Togni <rtogni@bresciaonline.it>
arpi
parents:
diff
changeset
|
23 |
f6990fad0ab3
Qt RPZA decoder interface by Roberto Togni <rtogni@bresciaonline.it>
arpi
parents:
diff
changeset
|
24 // init driver |
f6990fad0ab3
Qt RPZA decoder interface by Roberto Togni <rtogni@bresciaonline.it>
arpi
parents:
diff
changeset
|
25 static int init(sh_video_t *sh){ |
8954 | 26 return mpcodecs_config_vo(sh,sh->disp_w,sh->disp_h,IMGFMT_BGR15); |
4915
f6990fad0ab3
Qt RPZA decoder interface by Roberto Togni <rtogni@bresciaonline.it>
arpi
parents:
diff
changeset
|
27 } |
f6990fad0ab3
Qt RPZA decoder interface by Roberto Togni <rtogni@bresciaonline.it>
arpi
parents:
diff
changeset
|
28 |
f6990fad0ab3
Qt RPZA decoder interface by Roberto Togni <rtogni@bresciaonline.it>
arpi
parents:
diff
changeset
|
29 // uninit driver |
f6990fad0ab3
Qt RPZA decoder interface by Roberto Togni <rtogni@bresciaonline.it>
arpi
parents:
diff
changeset
|
30 static void uninit(sh_video_t *sh){ |
f6990fad0ab3
Qt RPZA decoder interface by Roberto Togni <rtogni@bresciaonline.it>
arpi
parents:
diff
changeset
|
31 } |
f6990fad0ab3
Qt RPZA decoder interface by Roberto Togni <rtogni@bresciaonline.it>
arpi
parents:
diff
changeset
|
32 |
f6990fad0ab3
Qt RPZA decoder interface by Roberto Togni <rtogni@bresciaonline.it>
arpi
parents:
diff
changeset
|
33 //mp_image_t* mpcodecs_get_image(sh_video_t *sh, int mp_imgtype, int mp_imgflag, int w, int h); |
f6990fad0ab3
Qt RPZA decoder interface by Roberto Togni <rtogni@bresciaonline.it>
arpi
parents:
diff
changeset
|
34 |
f6990fad0ab3
Qt RPZA decoder interface by Roberto Togni <rtogni@bresciaonline.it>
arpi
parents:
diff
changeset
|
35 void qt_decode_rpza(char *encoded, int encodec_size, char *decodec, int width, int height, int bytes_per_pixel); |
f6990fad0ab3
Qt RPZA decoder interface by Roberto Togni <rtogni@bresciaonline.it>
arpi
parents:
diff
changeset
|
36 |
f6990fad0ab3
Qt RPZA decoder interface by Roberto Togni <rtogni@bresciaonline.it>
arpi
parents:
diff
changeset
|
37 // decode a frame |
f6990fad0ab3
Qt RPZA decoder interface by Roberto Togni <rtogni@bresciaonline.it>
arpi
parents:
diff
changeset
|
38 static mp_image_t* decode(sh_video_t *sh,void* data,int len,int flags){ |
f6990fad0ab3
Qt RPZA decoder interface by Roberto Togni <rtogni@bresciaonline.it>
arpi
parents:
diff
changeset
|
39 mp_image_t* mpi; |
f6990fad0ab3
Qt RPZA decoder interface by Roberto Togni <rtogni@bresciaonline.it>
arpi
parents:
diff
changeset
|
40 if(len<=0) return NULL; // skipped frame |
f6990fad0ab3
Qt RPZA decoder interface by Roberto Togni <rtogni@bresciaonline.it>
arpi
parents:
diff
changeset
|
41 |
f6990fad0ab3
Qt RPZA decoder interface by Roberto Togni <rtogni@bresciaonline.it>
arpi
parents:
diff
changeset
|
42 mpi=mpcodecs_get_image(sh, MP_IMGTYPE_STATIC, MP_IMGFLAG_PRESERVE, sh->disp_w, sh->disp_h); |
f6990fad0ab3
Qt RPZA decoder interface by Roberto Togni <rtogni@bresciaonline.it>
arpi
parents:
diff
changeset
|
43 |
f6990fad0ab3
Qt RPZA decoder interface by Roberto Togni <rtogni@bresciaonline.it>
arpi
parents:
diff
changeset
|
44 if(!mpi){ // temporary! |
f6990fad0ab3
Qt RPZA decoder interface by Roberto Togni <rtogni@bresciaonline.it>
arpi
parents:
diff
changeset
|
45 printf("couldn't allocate image for qtrpza codec\n"); |
f6990fad0ab3
Qt RPZA decoder interface by Roberto Togni <rtogni@bresciaonline.it>
arpi
parents:
diff
changeset
|
46 return NULL; |
f6990fad0ab3
Qt RPZA decoder interface by Roberto Togni <rtogni@bresciaonline.it>
arpi
parents:
diff
changeset
|
47 } |
f6990fad0ab3
Qt RPZA decoder interface by Roberto Togni <rtogni@bresciaonline.it>
arpi
parents:
diff
changeset
|
48 |
f6990fad0ab3
Qt RPZA decoder interface by Roberto Togni <rtogni@bresciaonline.it>
arpi
parents:
diff
changeset
|
49 qt_decode_rpza(data, len, mpi->planes[0], sh->disp_w, sh->disp_h, |
4948 | 50 mpi->bpp/8); |
4915
f6990fad0ab3
Qt RPZA decoder interface by Roberto Togni <rtogni@bresciaonline.it>
arpi
parents:
diff
changeset
|
51 |
f6990fad0ab3
Qt RPZA decoder interface by Roberto Togni <rtogni@bresciaonline.it>
arpi
parents:
diff
changeset
|
52 return mpi; |
f6990fad0ab3
Qt RPZA decoder interface by Roberto Togni <rtogni@bresciaonline.it>
arpi
parents:
diff
changeset
|
53 } |