Mercurial > mplayer.hg
annotate libmpcodecs/ve_rawrgb.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 | c671e9adbe22 |
children |
rev | line source |
---|---|
5550 | 1 #include <stdio.h> |
2 #include <stdlib.h> | |
3 #include <string.h> | |
4 | |
5 #include "../config.h" | |
6 #include "../mp_msg.h" | |
7 | |
8 #include "codec-cfg.h" | |
9 #include "stream.h" | |
10 #include "demuxer.h" | |
11 #include "stheader.h" | |
12 | |
8585 | 13 #include "muxer.h" |
5550 | 14 |
5607 | 15 #include "img_format.h" |
16 #include "mp_image.h" | |
5550 | 17 #include "vf.h" |
18 | |
19 //===========================================================================// | |
20 | |
21 struct vf_priv_s { | |
8585 | 22 muxer_stream_t* mux; |
5550 | 23 }; |
24 #define mux_v (vf->priv->mux) | |
25 | |
26 static int config(struct vf_instance_s* vf, | |
27 int width, int height, int d_width, int d_height, | |
28 unsigned int flags, unsigned int outfmt){ | |
29 | |
30 mux_v->bih->biWidth=width; | |
31 mux_v->bih->biHeight=height; | |
32 mux_v->bih->biSizeImage=mux_v->bih->biWidth*mux_v->bih->biHeight*(mux_v->bih->biBitCount/8); | |
33 | |
34 return 1; | |
35 } | |
36 | |
37 static int control(struct vf_instance_s* vf, int request, void* data){ | |
38 | |
39 return CONTROL_UNKNOWN; | |
40 } | |
41 | |
42 static int query_format(struct vf_instance_s* vf, unsigned int fmt){ | |
5895 | 43 if(fmt==IMGFMT_BGR24) return 3 | VFCAP_FLIPPED; |
5550 | 44 return 0; |
45 } | |
46 | |
7368 | 47 static int put_image(struct vf_instance_s* vf, mp_image_t *mpi){ |
5550 | 48 mux_v->buffer=mpi->planes[0]; |
9014
c671e9adbe22
Cleanup of the muxer API, func parameters muxer & muxer_f eliminated.
arpi
parents:
8585
diff
changeset
|
49 muxer_write_chunk(mux_v, mpi->width*mpi->height*3, 0x10); |
7368 | 50 return 1; |
5550 | 51 } |
52 | |
53 //===========================================================================// | |
54 | |
55 static int vf_open(vf_instance_t *vf, char* args){ | |
56 vf->config=config; | |
57 vf->control=control; | |
58 vf->query_format=query_format; | |
59 vf->put_image=put_image; | |
60 vf->priv=malloc(sizeof(struct vf_priv_s)); | |
61 memset(vf->priv,0,sizeof(struct vf_priv_s)); | |
8585 | 62 vf->priv->mux=(muxer_stream_t*)args; |
5550 | 63 |
64 mux_v->bih=malloc(sizeof(BITMAPINFOHEADER)); | |
65 mux_v->bih->biSize=sizeof(BITMAPINFOHEADER); | |
66 mux_v->bih->biWidth=0; | |
67 mux_v->bih->biHeight=0; | |
68 mux_v->bih->biCompression=0; | |
69 mux_v->bih->biPlanes=1; | |
5551 | 70 mux_v->bih->biBitCount=24; |
5550 | 71 |
72 return 1; | |
73 } | |
74 | |
75 vf_info_t ve_info_rawrgb = { | |
76 "rawrgb encoder", | |
77 "rawrgb", | |
78 "A'rpi", | |
79 "for internal use by mencoder", | |
80 vf_open | |
81 }; | |
82 | |
83 //===========================================================================// |