annotate libvo/vo_directfb2.c @ 10740:0b5748047607

sync
author gabucino
date Sun, 31 Aug 2003 20:34:14 +0000
parents 7901f7d6e0eb
children 10f45897d653
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
6952
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1 /*
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
2 MPlayer video driver for DirectFramebuffer device
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
3
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
4 (C) 2002
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
5
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
6 Written by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
7
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
8 This library is free software; you can redistribute it and/or
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
9 modify it under the terms of the GNU Lesser General Public
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
10 License as published by the Free Software Foundation; either
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
11 version 2 of the License, or (at your option) any later version.
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
12
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
13 This library is distributed in the hope that it will be useful,
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
16 Lesser General Public License for more details.
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
17
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
18 You should have received a copy of the GNU Lesser General Public
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
19 License along with this library; if not, write to the
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
20 Free Software Foundation, Inc., 59 Temple Place - Suite 330,
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
21 Boston, MA 02111-1307, USA.
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
22 */
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
23
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
24 // directfb includes
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
25
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
26 #include <directfb.h>
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
27
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
28 // other things
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
29
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
30 #include <stdio.h>
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
31 #include <stdlib.h>
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
32 #include <string.h>
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
33
8137
530d1c5f0c78 Switch containing options for DirectFB library was renamed to dfbopts.
arpi
parents: 7272
diff changeset
34 #ifdef __linux__
6952
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
35 #include <sys/kd.h>
8137
530d1c5f0c78 Switch containing options for DirectFB library was renamed to dfbopts.
arpi
parents: 7272
diff changeset
36 #else
530d1c5f0c78 Switch containing options for DirectFB library was renamed to dfbopts.
arpi
parents: 7272
diff changeset
37 #include <linux/kd.h>
530d1c5f0c78 Switch containing options for DirectFB library was renamed to dfbopts.
arpi
parents: 7272
diff changeset
38 #endif
6952
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
39
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
40 #include "config.h"
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
41 #include "video_out.h"
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
42 #include "video_out_internal.h"
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
43 #include "fastmemcpy.h"
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
44 #include "sub.h"
9937
8098165634f7 printf->mp_msg and honor -double switch
zdar
parents: 9538
diff changeset
45 #include "mp_msg.h"
6952
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
46 #include "aspect.h"
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
47
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
48 #ifndef min
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
49 #define min(x,y) (((x)<(y))?(x):(y))
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
50 #endif
10004
c889e7f9391a triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents: 9937
diff changeset
51
9937
8098165634f7 printf->mp_msg and honor -double switch
zdar
parents: 9538
diff changeset
52 #if DIRECTFBVERSION > 917
8098165634f7 printf->mp_msg and honor -double switch
zdar
parents: 9538
diff changeset
53 // triple buffering
8098165634f7 printf->mp_msg and honor -double switch
zdar
parents: 9538
diff changeset
54 #define TRIPLE 1
8098165634f7 printf->mp_msg and honor -double switch
zdar
parents: 9538
diff changeset
55 #endif
10004
c889e7f9391a triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents: 9937
diff changeset
56
8148
5b39e79af5fe removed get_info, using the same sheme as in libmpcodecs instead
alex
parents: 8137
diff changeset
57 static vo_info_t info = {
6952
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
58 "Direct Framebuffer Device",
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
59 "directfb",
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
60 "Jiri Svoboda Jiri.Svoboda@seznam.cz",
8137
530d1c5f0c78 Switch containing options for DirectFB library was renamed to dfbopts.
arpi
parents: 7272
diff changeset
61 "v 2.0 (for DirectFB version >=0.9.13)"
6952
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
62 };
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
63
8148
5b39e79af5fe removed get_info, using the same sheme as in libmpcodecs instead
alex
parents: 8137
diff changeset
64 LIBVO_EXTERN(directfb)
5b39e79af5fe removed get_info, using the same sheme as in libmpcodecs instead
alex
parents: 8137
diff changeset
65
6952
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
66 extern int verbose;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
67
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
68 /******************************
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
69 * vo_directfb globals *
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
70 ******************************/
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
71
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
72 #define DFBCHECK(x...) \
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
73 { \
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
74 DFBResult err = x; \
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
75 \
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
76 if (err != DFB_OK) \
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
77 { \
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
78 fprintf( stderr, "%s <%d>:\n\t", __FILE__, __LINE__ ); \
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
79 DirectFBErrorFatal( #x, err ); \
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
80 } \
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
81 }
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
82
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
83 /*
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
84 * filled by preinit
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
85 */
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
86
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
87 // main DirectFB handle
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
88 static IDirectFB *dfb = NULL;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
89 // keyboard handle
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
90 static IDirectFBInputDevice *keyboard = NULL;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
91 // A buffer for input events.
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
92 static IDirectFBEventBuffer *buffer = NULL;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
93
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
94 /*
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
95 * filled during config
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
96 */
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
97
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
98 // handle of used layer
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
99 static IDirectFBDisplayLayer *layer = NULL;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
100 // surface of used layer
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
101 static IDirectFBSurface *primary = NULL;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
102 static int primarylocked = 0;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
103 // handle of temporary surface (if used)
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
104 static IDirectFBSurface *frame = NULL;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
105 static int framelocked = 0;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
106 // flipping mode flag (layer/surface)
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
107 static int flipping = 0;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
108 // scaling flag
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
109 static int stretch = 0;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
110 // pictrure position
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
111 static int xoffset=0,yoffset=0;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
112 // picture size
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
113 static int out_width=0,out_height=0;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
114 // frame/primary size
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
115 static int width=0,height=0;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
116 // frame primary format
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
117 DFBSurfacePixelFormat pixel_format;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
118 /*
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
119 static void (*draw_alpha_p)(int w, int h, unsigned char *src,
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
120 unsigned char *srca, int stride, unsigned char *dst,
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
121 int dstride);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
122 */
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
123
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
124 /******************************
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
125 * cmd line parameteres *
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
126 ******************************/
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
127
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
128 /* command line/config file options */
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
129 #ifdef HAVE_FBDEV
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
130 extern char *fb_dev_name;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
131 #else
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
132 char *fb_dev_name;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
133 #endif
8137
530d1c5f0c78 Switch containing options for DirectFB library was renamed to dfbopts.
arpi
parents: 7272
diff changeset
134 char *dfb_params;
10004
c889e7f9391a triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents: 9937
diff changeset
135 static int layer_id = -1;
c889e7f9391a triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents: 9937
diff changeset
136 static int buffer_mode = 1;
c889e7f9391a triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents: 9937
diff changeset
137 static int use_input = 1;
c889e7f9391a triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents: 9937
diff changeset
138 static int field_parity = -1;
6952
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
139
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
140 /******************************
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
141 * implementation *
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
142 ******************************/
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
143
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
144 void unlock() {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
145 if (frame && framelocked) frame->Unlock(frame);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
146 if (primary && primarylocked) primary->Unlock(primary);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
147 }
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
148
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
149
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
150 static uint32_t preinit(const char *arg)
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
151 {
10004
c889e7f9391a triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents: 9937
diff changeset
152 DFBResult ret;
6952
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
153
10004
c889e7f9391a triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents: 9937
diff changeset
154 mp_msg(MSGT_VO, MSGL_INFO,"DirectFB: Preinit entered\n");
c889e7f9391a triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents: 9937
diff changeset
155
c889e7f9391a triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents: 9937
diff changeset
156 if (dfb) return 0; // we are already inited!
c889e7f9391a triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents: 9937
diff changeset
157
c889e7f9391a triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents: 9937
diff changeset
158 buffer_mode = 1 + vo_doublebuffering; // honor -double switch
6952
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
159
10004
c889e7f9391a triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents: 9937
diff changeset
160 // config stuff - borrowed from dfbmga (to be as compatible as it could be :-)
c889e7f9391a triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents: 9937
diff changeset
161
c889e7f9391a triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents: 9937
diff changeset
162 if (vo_subdevice) {
c889e7f9391a triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents: 9937
diff changeset
163 int show_help = 0;
c889e7f9391a triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents: 9937
diff changeset
164 int opt_no = 0;
c889e7f9391a triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents: 9937
diff changeset
165 while (*vo_subdevice != '\0') {
c889e7f9391a triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents: 9937
diff changeset
166 if (!strncmp(vo_subdevice, "input", 5)) {
c889e7f9391a triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents: 9937
diff changeset
167 use_input = !opt_no;
c889e7f9391a triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents: 9937
diff changeset
168 vo_subdevice += 5;
c889e7f9391a triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents: 9937
diff changeset
169 opt_no = 0;
c889e7f9391a triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents: 9937
diff changeset
170 } else if (!strncmp(vo_subdevice, "buffermode=", 11)) {
c889e7f9391a triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents: 9937
diff changeset
171 if (opt_no) {
c889e7f9391a triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents: 9937
diff changeset
172 show_help = 1;
c889e7f9391a triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents: 9937
diff changeset
173 break;
c889e7f9391a triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents: 9937
diff changeset
174 }
c889e7f9391a triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents: 9937
diff changeset
175 vo_subdevice += 11;
c889e7f9391a triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents: 9937
diff changeset
176 if (!strncmp(vo_subdevice, "single", 6)) {
c889e7f9391a triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents: 9937
diff changeset
177 buffer_mode = 1;
c889e7f9391a triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents: 9937
diff changeset
178 vo_subdevice += 6;
c889e7f9391a triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents: 9937
diff changeset
179 } else if (!strncmp(vo_subdevice, "double", 6)) {
c889e7f9391a triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents: 9937
diff changeset
180 buffer_mode = 2;
c889e7f9391a triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents: 9937
diff changeset
181 vo_subdevice += 6;
c889e7f9391a triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents: 9937
diff changeset
182 } else if (!strncmp(vo_subdevice, "triple", 6)) {
c889e7f9391a triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents: 9937
diff changeset
183 buffer_mode = 3;
c889e7f9391a triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents: 9937
diff changeset
184 vo_subdevice += 6;
c889e7f9391a triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents: 9937
diff changeset
185 } else {
c889e7f9391a triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents: 9937
diff changeset
186 show_help = 1;
c889e7f9391a triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents: 9937
diff changeset
187 break;
c889e7f9391a triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents: 9937
diff changeset
188 }
c889e7f9391a triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents: 9937
diff changeset
189 opt_no = 0;
c889e7f9391a triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents: 9937
diff changeset
190 } else if (!strncmp(vo_subdevice, "fieldparity=", 12)) {
c889e7f9391a triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents: 9937
diff changeset
191 if (opt_no) {
c889e7f9391a triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents: 9937
diff changeset
192 show_help = 1;
c889e7f9391a triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents: 9937
diff changeset
193 break;
c889e7f9391a triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents: 9937
diff changeset
194 }
c889e7f9391a triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents: 9937
diff changeset
195 vo_subdevice += 12;
c889e7f9391a triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents: 9937
diff changeset
196 if (!strncmp(vo_subdevice, "top", 3)) {
c889e7f9391a triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents: 9937
diff changeset
197 field_parity = 0;
c889e7f9391a triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents: 9937
diff changeset
198 vo_subdevice += 3;
c889e7f9391a triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents: 9937
diff changeset
199 } else if (!strncmp(vo_subdevice, "bottom", 6)) {
c889e7f9391a triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents: 9937
diff changeset
200 field_parity = 1;
c889e7f9391a triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents: 9937
diff changeset
201 vo_subdevice += 6;
c889e7f9391a triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents: 9937
diff changeset
202 } else {
c889e7f9391a triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents: 9937
diff changeset
203 show_help = 1;
c889e7f9391a triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents: 9937
diff changeset
204 break;
c889e7f9391a triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents: 9937
diff changeset
205 }
c889e7f9391a triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents: 9937
diff changeset
206 opt_no = 0;
c889e7f9391a triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents: 9937
diff changeset
207 } else if (!strncmp(vo_subdevice, "layer=", 6)) {
c889e7f9391a triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents: 9937
diff changeset
208 int tmp=-1;
c889e7f9391a triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents: 9937
diff changeset
209 if (opt_no) {
c889e7f9391a triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents: 9937
diff changeset
210 show_help = 1;
c889e7f9391a triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents: 9937
diff changeset
211 break;
c889e7f9391a triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents: 9937
diff changeset
212 }
c889e7f9391a triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents: 9937
diff changeset
213 vo_subdevice += 6;
c889e7f9391a triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents: 9937
diff changeset
214 if (sscanf(vo_subdevice,"%i",&tmp)) {
c889e7f9391a triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents: 9937
diff changeset
215 layer_id=tmp;
c889e7f9391a triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents: 9937
diff changeset
216 mp_msg(MSGT_VO, MSGL_INFO,"DirectFB: Layer id is forced to %i\n",layer_id);
c889e7f9391a triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents: 9937
diff changeset
217 } else {
c889e7f9391a triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents: 9937
diff changeset
218 show_help = 1;
c889e7f9391a triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents: 9937
diff changeset
219 break;
c889e7f9391a triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents: 9937
diff changeset
220 }
c889e7f9391a triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents: 9937
diff changeset
221 opt_no = 0;
c889e7f9391a triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents: 9937
diff changeset
222 } else if (!strncmp(vo_subdevice, "no", 2)) {
c889e7f9391a triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents: 9937
diff changeset
223 if (opt_no) {
c889e7f9391a triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents: 9937
diff changeset
224 show_help = 1;
c889e7f9391a triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents: 9937
diff changeset
225 break;
c889e7f9391a triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents: 9937
diff changeset
226 }
c889e7f9391a triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents: 9937
diff changeset
227 vo_subdevice += 2;
c889e7f9391a triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents: 9937
diff changeset
228 opt_no = 1;
c889e7f9391a triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents: 9937
diff changeset
229 } else if (*vo_subdevice == ':') {
c889e7f9391a triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents: 9937
diff changeset
230 if (opt_no) {
c889e7f9391a triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents: 9937
diff changeset
231 show_help = 1;
c889e7f9391a triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents: 9937
diff changeset
232 break;
c889e7f9391a triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents: 9937
diff changeset
233 }
c889e7f9391a triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents: 9937
diff changeset
234 vo_subdevice++;
c889e7f9391a triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents: 9937
diff changeset
235 opt_no = 0;
c889e7f9391a triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents: 9937
diff changeset
236 } else if (!strncmp(vo_subdevice, "help", 4)) {
c889e7f9391a triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents: 9937
diff changeset
237 show_help = 1;
c889e7f9391a triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents: 9937
diff changeset
238 vo_subdevice += 4;
c889e7f9391a triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents: 9937
diff changeset
239 break;
c889e7f9391a triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents: 9937
diff changeset
240 }
c889e7f9391a triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents: 9937
diff changeset
241 }
c889e7f9391a triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents: 9937
diff changeset
242
c889e7f9391a triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents: 9937
diff changeset
243 if (show_help) {
c889e7f9391a triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents: 9937
diff changeset
244 mp_msg( MSGT_VO, MSGL_ERR,
c889e7f9391a triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents: 9937
diff changeset
245 "\nvo_dfbmga command line help:\n"
c889e7f9391a triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents: 9937
diff changeset
246 "Example: mplayer -vo directfb:layer=1:buffermode=single\n"
c889e7f9391a triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents: 9937
diff changeset
247 "\nOptions (use 'no' prefix to disable):\n"
c889e7f9391a triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents: 9937
diff changeset
248 " input Use DirectFB for keyboard input\n"
c889e7f9391a triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents: 9937
diff changeset
249 "\nOther options:\n"
c889e7f9391a triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents: 9937
diff changeset
250 " layer=n\n"
c889e7f9391a triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents: 9937
diff changeset
251 " n=0..xx Use layer with id n for output (0=primary)\n"
c889e7f9391a triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents: 9937
diff changeset
252 " buffermode=(single|double|triple)\n"
c889e7f9391a triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents: 9937
diff changeset
253 " single Use single buffering\n"
c889e7f9391a triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents: 9937
diff changeset
254 " double Use double buffering\n"
c889e7f9391a triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents: 9937
diff changeset
255 " triple Use triple buffering\n"
c889e7f9391a triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents: 9937
diff changeset
256 " fieldparity=(top|bottom)\n"
c889e7f9391a triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents: 9937
diff changeset
257 " top Top field first\n"
c889e7f9391a triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents: 9937
diff changeset
258 " bottom Bottom field first\n"
c889e7f9391a triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents: 9937
diff changeset
259 "\n" );
c889e7f9391a triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents: 9937
diff changeset
260 return -1;
c889e7f9391a triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents: 9937
diff changeset
261 }
c889e7f9391a triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents: 9937
diff changeset
262 }
c889e7f9391a triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents: 9937
diff changeset
263
8137
530d1c5f0c78 Switch containing options for DirectFB library was renamed to dfbopts.
arpi
parents: 7272
diff changeset
264
530d1c5f0c78 Switch containing options for DirectFB library was renamed to dfbopts.
arpi
parents: 7272
diff changeset
265 if (dfb_params)
530d1c5f0c78 Switch containing options for DirectFB library was renamed to dfbopts.
arpi
parents: 7272
diff changeset
266 {
530d1c5f0c78 Switch containing options for DirectFB library was renamed to dfbopts.
arpi
parents: 7272
diff changeset
267 int argc = 2;
530d1c5f0c78 Switch containing options for DirectFB library was renamed to dfbopts.
arpi
parents: 7272
diff changeset
268 char arg0[10] = "mplayer";
530d1c5f0c78 Switch containing options for DirectFB library was renamed to dfbopts.
arpi
parents: 7272
diff changeset
269 char arg1[256] = "--dfb:";
530d1c5f0c78 Switch containing options for DirectFB library was renamed to dfbopts.
arpi
parents: 7272
diff changeset
270 char* argv[3];
530d1c5f0c78 Switch containing options for DirectFB library was renamed to dfbopts.
arpi
parents: 7272
diff changeset
271 char ** a;
530d1c5f0c78 Switch containing options for DirectFB library was renamed to dfbopts.
arpi
parents: 7272
diff changeset
272
530d1c5f0c78 Switch containing options for DirectFB library was renamed to dfbopts.
arpi
parents: 7272
diff changeset
273 a = &argv[0];
530d1c5f0c78 Switch containing options for DirectFB library was renamed to dfbopts.
arpi
parents: 7272
diff changeset
274
530d1c5f0c78 Switch containing options for DirectFB library was renamed to dfbopts.
arpi
parents: 7272
diff changeset
275 strncat(arg1,dfb_params,249);
530d1c5f0c78 Switch containing options for DirectFB library was renamed to dfbopts.
arpi
parents: 7272
diff changeset
276
530d1c5f0c78 Switch containing options for DirectFB library was renamed to dfbopts.
arpi
parents: 7272
diff changeset
277 argv[0]=arg0;
530d1c5f0c78 Switch containing options for DirectFB library was renamed to dfbopts.
arpi
parents: 7272
diff changeset
278 argv[1]=arg1;
530d1c5f0c78 Switch containing options for DirectFB library was renamed to dfbopts.
arpi
parents: 7272
diff changeset
279 argv[2]=NULL;
530d1c5f0c78 Switch containing options for DirectFB library was renamed to dfbopts.
arpi
parents: 7272
diff changeset
280
530d1c5f0c78 Switch containing options for DirectFB library was renamed to dfbopts.
arpi
parents: 7272
diff changeset
281 DFBCHECK (DirectFBInit (&argc,&a));
530d1c5f0c78 Switch containing options for DirectFB library was renamed to dfbopts.
arpi
parents: 7272
diff changeset
282
530d1c5f0c78 Switch containing options for DirectFB library was renamed to dfbopts.
arpi
parents: 7272
diff changeset
283 } else {
530d1c5f0c78 Switch containing options for DirectFB library was renamed to dfbopts.
arpi
parents: 7272
diff changeset
284
6952
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
285 DFBCHECK (DirectFBInit (NULL,NULL));
8137
530d1c5f0c78 Switch containing options for DirectFB library was renamed to dfbopts.
arpi
parents: 7272
diff changeset
286 }
6952
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
287
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
288 if (((directfb_major_version <= 0) &&
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
289 (directfb_minor_version <= 9) &&
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
290 (directfb_micro_version < 13)))
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
291 {
9937
8098165634f7 printf->mp_msg and honor -double switch
zdar
parents: 9538
diff changeset
292 mp_msg(MSGT_VO, MSGL_ERR,"DirectFB: Unsupported DirectFB version\n");
6952
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
293 return 1;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
294 }
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
295
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
296 /*
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
297 * (set options)
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
298 */
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
299
10618
7901f7d6e0eb 4x10l fix. Vars used by the config layer must be malloc'd (strdup) as they will be freed at exit.
alex
parents: 10004
diff changeset
300 if (!fb_dev_name && !(fb_dev_name = getenv("FRAMEBUFFER"))) fb_dev_name = strdup("/dev/fb0");
6952
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
301 DFBCHECK (DirectFBSetOption ("fbdev",fb_dev_name));
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
302
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
303 // uncomment this if you do not wish to create a new vt for DirectFB
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
304 // DFBCHECK (DirectFBSetOption ("no-vt-switch",""));
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
305
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
306 // uncomment this if you want to allow vt switching
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
307 // DFBCHECK (DirectFBSetOption ("vt-switching",""));
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
308
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
309 // uncomment this if you want to hide gfx cursor (req dfb >=0.9.9)
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
310 DFBCHECK (DirectFBSetOption ("no-cursor",""));
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
311
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
312 // bg color fix
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
313 DFBCHECK (DirectFBSetOption ("bg-color","00000000"));
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
314
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
315 /*
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
316 * (Initialize)
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
317 */
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
318
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
319 DFBCHECK (DirectFBCreate (&dfb));
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
320
9937
8098165634f7 printf->mp_msg and honor -double switch
zdar
parents: 9538
diff changeset
321 #if DIRECTFBVERSION < 917
9538
7b1907aa1422 Some 10l and better layer handling (to comply with DFB 0.9.17)
zdar
parents: 9515
diff changeset
322 if (DFB_OK != dfb->SetCooperativeLevel (dfb, DFSCL_FULLSCREEN)) {
9937
8098165634f7 printf->mp_msg and honor -double switch
zdar
parents: 9538
diff changeset
323 mp_msg(MSGT_VO, MSGL_WARN,"DirectFB: Warning - cannot swith to fullscreen mode");
9538
7b1907aa1422 Some 10l and better layer handling (to comply with DFB 0.9.17)
zdar
parents: 9515
diff changeset
324 };
7b1907aa1422 Some 10l and better layer handling (to comply with DFB 0.9.17)
zdar
parents: 9515
diff changeset
325 #endif
7b1907aa1422 Some 10l and better layer handling (to comply with DFB 0.9.17)
zdar
parents: 9515
diff changeset
326
6952
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
327 /*
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
328 * (Get keyboard)
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
329 */
10004
c889e7f9391a triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents: 9937
diff changeset
330
c889e7f9391a triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents: 9937
diff changeset
331 if (use_input) {
c889e7f9391a triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents: 9937
diff changeset
332 ret = dfb->GetInputDevice (dfb, DIDID_KEYBOARD, &keyboard);
c889e7f9391a triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents: 9937
diff changeset
333 if (ret==DFB_OK) {
c889e7f9391a triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents: 9937
diff changeset
334 mp_msg(MSGT_VO, MSGL_INFO,"DirectFB: Keyboard init OK\n");
c889e7f9391a triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents: 9937
diff changeset
335 } else {
c889e7f9391a triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents: 9937
diff changeset
336 keyboard = NULL;
c889e7f9391a triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents: 9937
diff changeset
337 mp_msg(MSGT_VO, MSGL_ERR,"DirectFB: Keyboard init FAILED\n");
c889e7f9391a triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents: 9937
diff changeset
338 }
c889e7f9391a triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents: 9937
diff changeset
339 }
6952
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
340
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
341
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
342 /*
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
343 * Create an input buffer for the keyboard.
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
344 */
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
345 if (keyboard) DFBCHECK (keyboard->CreateEventBuffer (keyboard, &buffer));
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
346
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
347 // just to start with clean ...
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
348 if (buffer) buffer->Reset(buffer);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
349
9937
8098165634f7 printf->mp_msg and honor -double switch
zdar
parents: 9538
diff changeset
350 mp_msg(MSGT_VO, MSGL_INFO,"DirectFB: Preinit OK\n");
6952
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
351
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
352 return 0;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
353
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
354 }
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
355
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
356 DFBSurfacePixelFormat convformat(uint32_t format)
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
357 {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
358 // add more formats !!!
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
359 switch (format) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
360 case IMGFMT_RGB32: return DSPF_RGB32; break;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
361 case IMGFMT_BGR32: return DSPF_RGB32; break;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
362 case IMGFMT_RGB24: return DSPF_RGB24; break;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
363 case IMGFMT_BGR24: return DSPF_RGB24; break;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
364 case IMGFMT_RGB16: return DSPF_RGB16; break;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
365 case IMGFMT_BGR16: return DSPF_RGB16; break;
8640
554e6aa7da5f fix to compile with DirecFB 0.9.16
zdar
parents: 8148
diff changeset
366 #if DIRECTFBVERSION > 915
554e6aa7da5f fix to compile with DirecFB 0.9.16
zdar
parents: 8148
diff changeset
367 case IMGFMT_RGB15: return DSPF_ARGB1555; break;
554e6aa7da5f fix to compile with DirecFB 0.9.16
zdar
parents: 8148
diff changeset
368 case IMGFMT_BGR15: return DSPF_ARGB1555; break;
554e6aa7da5f fix to compile with DirecFB 0.9.16
zdar
parents: 8148
diff changeset
369 #else
6952
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
370 case IMGFMT_RGB15: return DSPF_RGB15; break;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
371 case IMGFMT_BGR15: return DSPF_RGB15; break;
8640
554e6aa7da5f fix to compile with DirecFB 0.9.16
zdar
parents: 8148
diff changeset
372 #endif
6952
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
373 case IMGFMT_YUY2: return DSPF_YUY2; break;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
374 case IMGFMT_UYVY: return DSPF_UYVY; break;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
375 case IMGFMT_YV12: return DSPF_YV12; break;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
376 case IMGFMT_I420: return DSPF_I420; break;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
377 // case IMGFMT_IYUV: return DSPF_IYUV; break;
9538
7b1907aa1422 Some 10l and better layer handling (to comply with DFB 0.9.17)
zdar
parents: 9515
diff changeset
378 case IMGFMT_RGB8: return DSPF_RGB332; break;
7b1907aa1422 Some 10l and better layer handling (to comply with DFB 0.9.17)
zdar
parents: 9515
diff changeset
379 case IMGFMT_BGR8: return DSPF_RGB332; break;
7b1907aa1422 Some 10l and better layer handling (to comply with DFB 0.9.17)
zdar
parents: 9515
diff changeset
380
6952
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
381 default: return 0;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
382 }
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
383 return 0;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
384 }
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
385
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
386 typedef struct enum1_s {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
387 uint32_t format;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
388 int scale;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
389 int result;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
390 unsigned int id;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
391 unsigned int width;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
392 unsigned int height;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
393 int setsize;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
394 } enum1_t;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
395
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
396 DFBEnumerationResult test_format_callback( unsigned int id,
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
397 DFBDisplayLayerDescription desc,
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
398 void *data)
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
399 {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
400 enum1_t *params =(enum1_t *)data;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
401 IDirectFBDisplayLayer *layer;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
402 DFBResult ret;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
403
8137
530d1c5f0c78 Switch containing options for DirectFB library was renamed to dfbopts.
arpi
parents: 7272
diff changeset
404 if ((layer_id == -1 )||(layer_id == id)) {
530d1c5f0c78 Switch containing options for DirectFB library was renamed to dfbopts.
arpi
parents: 7272
diff changeset
405
6952
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
406 ret = dfb->GetDisplayLayer( dfb, id, &layer);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
407 if (ret) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
408 DirectFBError( "dfb->GetDisplayLayer failed", ret );
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
409 return DFENUM_OK;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
410 } else {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
411 DFBDisplayLayerConfig dlc;
9538
7b1907aa1422 Some 10l and better layer handling (to comply with DFB 0.9.17)
zdar
parents: 9515
diff changeset
412
6952
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
413 if (params->setsize) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
414 dlc.flags = DLCONF_WIDTH |DLCONF_HEIGHT;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
415 dlc.width = params->width;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
416 dlc.height = params->height;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
417 layer->SetConfiguration(layer,&dlc);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
418 }
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
419
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
420
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
421 dlc.flags = DLCONF_PIXELFORMAT;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
422 dlc.pixelformat = convformat(params->format);
9515
d3af25abde21 Layer configuration handling updates
zdar
parents: 9380
diff changeset
423
d3af25abde21 Layer configuration handling updates
zdar
parents: 9380
diff changeset
424 layer->SetOpacity(layer,0);
6952
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
425
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
426 ret = layer->TestConfiguration(layer,&dlc,NULL);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
427
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
428 layer->Release(layer);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
429
9937
8098165634f7 printf->mp_msg and honor -double switch
zdar
parents: 9538
diff changeset
430 mp_msg(MSGT_VO, MSGL_INFO,"DirectFB: Test format - layer %i scale/pos %i\n",id,(desc.caps & DLCAPS_SCREEN_LOCATION));
6952
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
431
9515
d3af25abde21 Layer configuration handling updates
zdar
parents: 9380
diff changeset
432 if (ret==DFB_OK) {
6952
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
433 // printf("Test OK\n");
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
434 if (params->result) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
435 if ((!params->scale) && (desc.caps & DLCAPS_SCREEN_LOCATION)) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
436 params->scale=1;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
437 params->id=id;
9937
8098165634f7 printf->mp_msg and honor -double switch
zdar
parents: 9538
diff changeset
438 mp_msg(MSGT_VO, MSGL_INFO,"DirectFB: Test format - added layer %i scale/pos %i\n",id,(desc.caps & DLCAPS_SCREEN_LOCATION));
6952
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
439 }
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
440 } else {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
441 params->result=1;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
442 params->id=id;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
443 if (desc.caps & DLCAPS_SCREEN_LOCATION) params->scale=1;
9937
8098165634f7 printf->mp_msg and honor -double switch
zdar
parents: 9538
diff changeset
444 mp_msg(MSGT_VO, MSGL_INFO,"DirectFB: Test format - added layer %i scale/pos %i\n",id,(desc.caps & DLCAPS_SCREEN_LOCATION));
6952
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
445 };
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
446 };
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
447 };
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
448
8137
530d1c5f0c78 Switch containing options for DirectFB library was renamed to dfbopts.
arpi
parents: 7272
diff changeset
449 };
9515
d3af25abde21 Layer configuration handling updates
zdar
parents: 9380
diff changeset
450
6952
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
451 return DFENUM_OK;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
452 }
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
453
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
454 static uint32_t query_format(uint32_t format)
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
455 {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
456 int ret = VFCAP_CSP_SUPPORTED|VFCAP_CSP_SUPPORTED_BY_HW|VFCAP_OSD; // osd should be removed in future -> will be handled outside...
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
457 enum1_t params;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
458
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
459
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
460 if (!convformat(format)) return 0;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
461 // temporary disable YV12
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
462 // if (format == IMGFMT_YV12) return 0;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
463 // if (format == IMGFMT_I420) return 0;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
464 if (format == IMGFMT_IYUV) return 0;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
465
9937
8098165634f7 printf->mp_msg and honor -double switch
zdar
parents: 9538
diff changeset
466 mp_msg(MSGT_VO, MSGL_INFO,"DirectFB: Format query: %s\n",vo_format_name(format));
6952
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
467
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
468 params.format=format;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
469 params.scale=0;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
470 params.result=0;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
471 params.setsize=0;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
472
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
473 DFBCHECK (dfb->EnumDisplayLayers(dfb,test_format_callback,&params));
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
474
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
475 if (params.result) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
476 if (params.scale) ret |=VFCAP_HWSCALE_UP|VFCAP_HWSCALE_DOWN;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
477 return ret;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
478 }
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
479
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
480 return 0;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
481 }
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
482
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
483 typedef struct videomode_s {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
484 int width;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
485 int height;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
486 int out_width;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
487 int out_height;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
488 int overx;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
489 int overy;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
490 int bpp;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
491 } videomode_t;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
492
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
493
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
494 DFBEnumerationResult video_modes_callback( unsigned int width,unsigned int height,unsigned int bpp, void *data)
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
495 {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
496 videomode_t *params =(videomode_t *)data;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
497
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
498 int overx=0,overy=0,closer=0,over=0;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
499 int we_are_under=0;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
500
9937
8098165634f7 printf->mp_msg and honor -double switch
zdar
parents: 9538
diff changeset
501 mp_msg(MSGT_VO, MSGL_INFO,"DirectFB: Validator entered %i %i %i\n",width,height,bpp);
6952
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
502
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
503 overx=width-params->out_width;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
504 overy=height-params->out_height;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
505
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
506 if (!params->width) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
507 params->width=width;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
508 params->height=height;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
509 params->overx=overx;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
510 params->overy=overy;
9937
8098165634f7 printf->mp_msg and honor -double switch
zdar
parents: 9538
diff changeset
511 mp_msg(MSGT_VO, MSGL_INFO,"DirectFB: Mode added %i %i %i\n",width,height,bpp);
6952
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
512 }
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
513
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
514 if ((params->overy<0)||(params->overx<0)) we_are_under=1; // stored mode is smaller than req mode
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
515 if (abs(overx*overy)<abs(params->overx * params->overy)) closer=1; // current mode is closer to desired res
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
516 if ((overx>=0)&&(overy>=0)) over=1; // current mode is bigger or equaul to desired res
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
517 if ((closer && (over || we_are_under)) || (we_are_under && over)) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
518 params->width=width;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
519 params->height=height;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
520 params->overx=overx;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
521 params->overy=overy;
9937
8098165634f7 printf->mp_msg and honor -double switch
zdar
parents: 9538
diff changeset
522 mp_msg(MSGT_VO, MSGL_INFO,"DirectFB: Better mode added %i %i %i\n",width,height,bpp);
6952
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
523 };
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
524
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
525 return DFENUM_OK;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
526 }
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
527
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
528 #define CONFIG_ERROR -1
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
529
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
530 static uint32_t config(uint32_t s_width, uint32_t s_height, uint32_t d_width,
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
531 uint32_t d_height, uint32_t fullscreen, char *title,
7272
fcbe94c83ff6 config() parameters change
zdar
parents: 6985
diff changeset
532 uint32_t format)
6952
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
533 {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
534 /*
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
535 * (Locals)
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
536 */
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
537
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
538 // decode flags
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
539
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
540 int fs = fullscreen & 0x01;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
541 int vm = fullscreen & 0x02;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
542 int zoom = fullscreen & 0x04;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
543 int flip = fullscreen & 0x08;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
544
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
545 DFBSurfaceDescription dsc;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
546 DFBResult ret;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
547 DFBDisplayLayerConfig dlc;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
548 DFBSurfaceCapabilities caps;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
549
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
550 enum1_t params;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
551
9937
8098165634f7 printf->mp_msg and honor -double switch
zdar
parents: 9538
diff changeset
552 mp_msg(MSGT_VO, MSGL_INFO,"DirectFB: Config entered [%ix%i]\n",s_width,s_height);
8098165634f7 printf->mp_msg and honor -double switch
zdar
parents: 9538
diff changeset
553 mp_msg(MSGT_VO, MSGL_INFO,"DirectFB: With requested format: %s\n",vo_format_name(format));
8098165634f7 printf->mp_msg and honor -double switch
zdar
parents: 9538
diff changeset
554
6952
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
555 // initial clean-up
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
556 if (frame) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
557 frame->Release(frame);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
558 frame=NULL;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
559 }
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
560
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
561 if (primary) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
562 primary->Release(primary);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
563 primary=NULL;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
564 }
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
565
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
566 if (layer) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
567 layer->Release(layer);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
568 layer=NULL;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
569 }
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
570
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
571
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
572 // vm things
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
573
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
574 if (vm) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
575 videomode_t params;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
576 params.out_width=d_width;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
577 params.out_height=d_height;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
578 params.width=0;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
579 params.height=0;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
580 switch (format) {
9515
d3af25abde21 Layer configuration handling updates
zdar
parents: 9380
diff changeset
581 case IMGFMT_RGB32:
d3af25abde21 Layer configuration handling updates
zdar
parents: 9380
diff changeset
582 case IMGFMT_BGR32:
6952
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
583 params.bpp=32;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
584 break;
9515
d3af25abde21 Layer configuration handling updates
zdar
parents: 9380
diff changeset
585 case IMGFMT_RGB24:
d3af25abde21 Layer configuration handling updates
zdar
parents: 9380
diff changeset
586 case IMGFMT_BGR24:
6952
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
587 params.bpp=24;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
588 break;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
589 case IMGFMT_RGB16:
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
590 case IMGFMT_BGR16:
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
591 case IMGFMT_RGB15:
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
592 case IMGFMT_BGR15:
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
593 params.bpp=16;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
594 break;
9515
d3af25abde21 Layer configuration handling updates
zdar
parents: 9380
diff changeset
595 default: params.bpp=0;
d3af25abde21 Layer configuration handling updates
zdar
parents: 9380
diff changeset
596
d3af25abde21 Layer configuration handling updates
zdar
parents: 9380
diff changeset
597 }
9937
8098165634f7 printf->mp_msg and honor -double switch
zdar
parents: 9538
diff changeset
598 mp_msg(MSGT_VO, MSGL_INFO,"DirectFB: Config - trying to change videomode\n");
6952
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
599 DFBCHECK (dfb->EnumVideoModes(dfb,video_modes_callback,&params));
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
600 ret=dfb->SetVideoMode(dfb,params.width,params.height,params.bpp);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
601 if (ret) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
602 ret=dfb->SetVideoMode(dfb,params.width,params.height,24);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
603 if (ret) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
604 ret=dfb->SetVideoMode(dfb,params.width,params.height,32);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
605 if (ret) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
606 ret=dfb->SetVideoMode(dfb,params.width,params.height,16);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
607 if (ret) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
608 ret=dfb->SetVideoMode(dfb,params.width,params.height,8);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
609 }
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
610 }
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
611 }
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
612 }
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
613 } // vm end
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
614
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
615 // find best layer
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
616
9937
8098165634f7 printf->mp_msg and honor -double switch
zdar
parents: 9538
diff changeset
617 mp_msg(MSGT_VO, MSGL_INFO,"DirectFB: Config - looking for suitable layer\n");
6952
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
618 params.format=format;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
619 params.scale=0;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
620 params.result=0;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
621 params.width=s_width;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
622 params.height=s_height;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
623 params.setsize=1;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
624
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
625 DFBCHECK (dfb->EnumDisplayLayers(dfb,test_format_callback,&params));
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
626
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
627 if (!params.result) {
9937
8098165634f7 printf->mp_msg and honor -double switch
zdar
parents: 9538
diff changeset
628 mp_msg(MSGT_VO, MSGL_ERR,"DirectFB: ConfigError - no suitable layer found\n");
6952
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
629 params.id = DLID_PRIMARY;
9515
d3af25abde21 Layer configuration handling updates
zdar
parents: 9380
diff changeset
630 }
9538
7b1907aa1422 Some 10l and better layer handling (to comply with DFB 0.9.17)
zdar
parents: 9515
diff changeset
631
9937
8098165634f7 printf->mp_msg and honor -double switch
zdar
parents: 9538
diff changeset
632 mp_msg(MSGT_VO, MSGL_INFO,"DirectFB: Config - layer %i\n",params.id);
6952
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
633
9538
7b1907aa1422 Some 10l and better layer handling (to comply with DFB 0.9.17)
zdar
parents: 9515
diff changeset
634 // setup layer
6952
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
635
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
636 DFBCHECK (dfb->GetDisplayLayer( dfb, params.id, &layer));
9538
7b1907aa1422 Some 10l and better layer handling (to comply with DFB 0.9.17)
zdar
parents: 9515
diff changeset
637
7b1907aa1422 Some 10l and better layer handling (to comply with DFB 0.9.17)
zdar
parents: 9515
diff changeset
638 #if DIRECTFBVERSION > 916
7b1907aa1422 Some 10l and better layer handling (to comply with DFB 0.9.17)
zdar
parents: 9515
diff changeset
639 ret = layer->SetCooperativeLevel (layer, DLSCL_EXCLUSIVE);
6952
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
640
9538
7b1907aa1422 Some 10l and better layer handling (to comply with DFB 0.9.17)
zdar
parents: 9515
diff changeset
641 if (DFB_OK != ret) {
9937
8098165634f7 printf->mp_msg and honor -double switch
zdar
parents: 9538
diff changeset
642 mp_msg(MSGT_VO, MSGL_WARN,"DirectFB: Warning - cannot swith layer to exclusive mode. This could cause\nproblems. You may need to select correct pixel format manually!\n");
9538
7b1907aa1422 Some 10l and better layer handling (to comply with DFB 0.9.17)
zdar
parents: 9515
diff changeset
643 DirectFBError("MPlayer - Switch layer to exlusive mode.",ret);
7b1907aa1422 Some 10l and better layer handling (to comply with DFB 0.9.17)
zdar
parents: 9515
diff changeset
644 };
7b1907aa1422 Some 10l and better layer handling (to comply with DFB 0.9.17)
zdar
parents: 9515
diff changeset
645 #endif
6952
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
646 if (params.scale) {
9937
8098165634f7 printf->mp_msg and honor -double switch
zdar
parents: 9538
diff changeset
647 mp_msg(MSGT_VO, MSGL_INFO,"DirectFB: Config - changing layer configuration (size)\n");
6952
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
648 dlc.flags = DLCONF_WIDTH | DLCONF_HEIGHT;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
649 dlc.width = s_width;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
650 dlc.height = s_height;
9515
d3af25abde21 Layer configuration handling updates
zdar
parents: 9380
diff changeset
651
6952
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
652 ret = layer->SetConfiguration(layer,&dlc);
9515
d3af25abde21 Layer configuration handling updates
zdar
parents: 9380
diff changeset
653
9538
7b1907aa1422 Some 10l and better layer handling (to comply with DFB 0.9.17)
zdar
parents: 9515
diff changeset
654 if (ret) {
9937
8098165634f7 printf->mp_msg and honor -double switch
zdar
parents: 9538
diff changeset
655 mp_msg(MSGT_VO, MSGL_ERR,"DirectFB: ConfigError in layer configuration (size)\n");
9538
7b1907aa1422 Some 10l and better layer handling (to comply with DFB 0.9.17)
zdar
parents: 9515
diff changeset
656 DirectFBError("MPlayer - Layer size change.",ret);
7b1907aa1422 Some 10l and better layer handling (to comply with DFB 0.9.17)
zdar
parents: 9515
diff changeset
657 };
6952
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
658 }
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
659
9515
d3af25abde21 Layer configuration handling updates
zdar
parents: 9380
diff changeset
660 // look if we need to change pixel fromat of layer
d3af25abde21 Layer configuration handling updates
zdar
parents: 9380
diff changeset
661 // and just for sure fetch also all layer propreties
d3af25abde21 Layer configuration handling updates
zdar
parents: 9380
diff changeset
662 dlc.flags = DLCONF_PIXELFORMAT | DLCONF_WIDTH | DLCONF_HEIGHT | DLCONF_OPTIONS | DLCONF_BUFFERMODE;
9538
7b1907aa1422 Some 10l and better layer handling (to comply with DFB 0.9.17)
zdar
parents: 9515
diff changeset
663
9515
d3af25abde21 Layer configuration handling updates
zdar
parents: 9380
diff changeset
664 ret = layer->GetConfiguration(layer,&dlc);
d3af25abde21 Layer configuration handling updates
zdar
parents: 9380
diff changeset
665
d3af25abde21 Layer configuration handling updates
zdar
parents: 9380
diff changeset
666 dlc.flags = DLCONF_PIXELFORMAT | DLCONF_WIDTH | DLCONF_HEIGHT;
d3af25abde21 Layer configuration handling updates
zdar
parents: 9380
diff changeset
667
d3af25abde21 Layer configuration handling updates
zdar
parents: 9380
diff changeset
668 if (ret) {
9937
8098165634f7 printf->mp_msg and honor -double switch
zdar
parents: 9538
diff changeset
669 mp_msg(MSGT_VO, MSGL_WARN,"DirectFB: Warning - could not get layer properties!\n");
8098165634f7 printf->mp_msg and honor -double switch
zdar
parents: 9538
diff changeset
670 } else {
8098165634f7 printf->mp_msg and honor -double switch
zdar
parents: 9538
diff changeset
671 mp_msg(MSGT_VO, MSGL_INFO,"DirectFB: Layer reports format:%x\n",dlc.pixelformat);
9515
d3af25abde21 Layer configuration handling updates
zdar
parents: 9380
diff changeset
672 }
6952
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
673
9515
d3af25abde21 Layer configuration handling updates
zdar
parents: 9380
diff changeset
674 if ((dlc.pixelformat != convformat(params.format)) || (ret != DFB_OK)) {
d3af25abde21 Layer configuration handling updates
zdar
parents: 9380
diff changeset
675
d3af25abde21 Layer configuration handling updates
zdar
parents: 9380
diff changeset
676 dlc.flags = DLCONF_PIXELFORMAT;
d3af25abde21 Layer configuration handling updates
zdar
parents: 9380
diff changeset
677 dlc.pixelformat = convformat(params.format);
d3af25abde21 Layer configuration handling updates
zdar
parents: 9380
diff changeset
678
9937
8098165634f7 printf->mp_msg and honor -double switch
zdar
parents: 9538
diff changeset
679 mp_msg(MSGT_VO, MSGL_INFO,"DirectFB: Desired pixelformat: %x\n",dlc.pixelformat);
9515
d3af25abde21 Layer configuration handling updates
zdar
parents: 9380
diff changeset
680
9937
8098165634f7 printf->mp_msg and honor -double switch
zdar
parents: 9538
diff changeset
681 mp_msg(MSGT_VO, MSGL_INFO,"DirectFB: Config - changing layer configuration (format)\n");
9515
d3af25abde21 Layer configuration handling updates
zdar
parents: 9380
diff changeset
682 ret = layer->SetConfiguration(layer,&dlc);
d3af25abde21 Layer configuration handling updates
zdar
parents: 9380
diff changeset
683
d3af25abde21 Layer configuration handling updates
zdar
parents: 9380
diff changeset
684 if (ret) {
9538
7b1907aa1422 Some 10l and better layer handling (to comply with DFB 0.9.17)
zdar
parents: 9515
diff changeset
685 unsigned int bpp;
9937
8098165634f7 printf->mp_msg and honor -double switch
zdar
parents: 9538
diff changeset
686 mp_msg(MSGT_VO, MSGL_ERR,"DirectFB: ConfigError in layer configuration (format, flags=%x)\n",dlc.flags);
9538
7b1907aa1422 Some 10l and better layer handling (to comply with DFB 0.9.17)
zdar
parents: 9515
diff changeset
687 DirectFBError("MPlayer - layer pixelformat change",ret);
7b1907aa1422 Some 10l and better layer handling (to comply with DFB 0.9.17)
zdar
parents: 9515
diff changeset
688
7b1907aa1422 Some 10l and better layer handling (to comply with DFB 0.9.17)
zdar
parents: 9515
diff changeset
689 // ugly fbdev workabout - try to switch pixelformat via videomode change
7b1907aa1422 Some 10l and better layer handling (to comply with DFB 0.9.17)
zdar
parents: 9515
diff changeset
690 switch (dlc.pixelformat) {
7b1907aa1422 Some 10l and better layer handling (to comply with DFB 0.9.17)
zdar
parents: 9515
diff changeset
691 case DSPF_ARGB:
7b1907aa1422 Some 10l and better layer handling (to comply with DFB 0.9.17)
zdar
parents: 9515
diff changeset
692 case DSPF_RGB32: bpp=32;break;
7b1907aa1422 Some 10l and better layer handling (to comply with DFB 0.9.17)
zdar
parents: 9515
diff changeset
693 case DSPF_RGB24: bpp=24;break;
7b1907aa1422 Some 10l and better layer handling (to comply with DFB 0.9.17)
zdar
parents: 9515
diff changeset
694 case DSPF_RGB16: bpp=16;break;
7b1907aa1422 Some 10l and better layer handling (to comply with DFB 0.9.17)
zdar
parents: 9515
diff changeset
695 #if DIRECTFBVERSION > 915
7b1907aa1422 Some 10l and better layer handling (to comply with DFB 0.9.17)
zdar
parents: 9515
diff changeset
696 case DSPF_ARGB1555: bpp=15;break;
7b1907aa1422 Some 10l and better layer handling (to comply with DFB 0.9.17)
zdar
parents: 9515
diff changeset
697 #else
7b1907aa1422 Some 10l and better layer handling (to comply with DFB 0.9.17)
zdar
parents: 9515
diff changeset
698 case DSPF_RGB15: bpp=15;break;
7b1907aa1422 Some 10l and better layer handling (to comply with DFB 0.9.17)
zdar
parents: 9515
diff changeset
699 #endif
7b1907aa1422 Some 10l and better layer handling (to comply with DFB 0.9.17)
zdar
parents: 9515
diff changeset
700 case DSPF_RGB332 : bpp=8;break;
7b1907aa1422 Some 10l and better layer handling (to comply with DFB 0.9.17)
zdar
parents: 9515
diff changeset
701 }
7b1907aa1422 Some 10l and better layer handling (to comply with DFB 0.9.17)
zdar
parents: 9515
diff changeset
702
7b1907aa1422 Some 10l and better layer handling (to comply with DFB 0.9.17)
zdar
parents: 9515
diff changeset
703 switch (dlc.pixelformat) {
7b1907aa1422 Some 10l and better layer handling (to comply with DFB 0.9.17)
zdar
parents: 9515
diff changeset
704 case DSPF_ARGB:
7b1907aa1422 Some 10l and better layer handling (to comply with DFB 0.9.17)
zdar
parents: 9515
diff changeset
705 case DSPF_RGB32:
7b1907aa1422 Some 10l and better layer handling (to comply with DFB 0.9.17)
zdar
parents: 9515
diff changeset
706 case DSPF_RGB24:
7b1907aa1422 Some 10l and better layer handling (to comply with DFB 0.9.17)
zdar
parents: 9515
diff changeset
707 case DSPF_RGB16:
7b1907aa1422 Some 10l and better layer handling (to comply with DFB 0.9.17)
zdar
parents: 9515
diff changeset
708 #if DIRECTFBVERSION > 915
7b1907aa1422 Some 10l and better layer handling (to comply with DFB 0.9.17)
zdar
parents: 9515
diff changeset
709 case DSPF_ARGB1555:
7b1907aa1422 Some 10l and better layer handling (to comply with DFB 0.9.17)
zdar
parents: 9515
diff changeset
710 #else
7b1907aa1422 Some 10l and better layer handling (to comply with DFB 0.9.17)
zdar
parents: 9515
diff changeset
711 case DSPF_RGB15:
7b1907aa1422 Some 10l and better layer handling (to comply with DFB 0.9.17)
zdar
parents: 9515
diff changeset
712 #endif
7b1907aa1422 Some 10l and better layer handling (to comply with DFB 0.9.17)
zdar
parents: 9515
diff changeset
713 case DSPF_RGB332:
9937
8098165634f7 printf->mp_msg and honor -double switch
zdar
parents: 9538
diff changeset
714 mp_msg(MSGT_VO, MSGL_INFO,"DirectFB: Trying to recover via videomode change (VM).\n");
9538
7b1907aa1422 Some 10l and better layer handling (to comply with DFB 0.9.17)
zdar
parents: 9515
diff changeset
715 // get size
7b1907aa1422 Some 10l and better layer handling (to comply with DFB 0.9.17)
zdar
parents: 9515
diff changeset
716 dlc.flags = DLCONF_WIDTH | DLCONF_HEIGHT;
7b1907aa1422 Some 10l and better layer handling (to comply with DFB 0.9.17)
zdar
parents: 9515
diff changeset
717 if (DFB_OK==layer->GetConfiguration(layer,&dlc)) {
7b1907aa1422 Some 10l and better layer handling (to comply with DFB 0.9.17)
zdar
parents: 9515
diff changeset
718 // try to set videomode
9937
8098165634f7 printf->mp_msg and honor -double switch
zdar
parents: 9538
diff changeset
719 mp_msg(MSGT_VO, MSGL_INFO,"DirectFB: Videomode %ix%i BPP %i\n",dlc.width,dlc.height,bpp);
9538
7b1907aa1422 Some 10l and better layer handling (to comply with DFB 0.9.17)
zdar
parents: 9515
diff changeset
720 ret = dfb->SetVideoMode(dfb,dlc.width,dlc.height,bpp);
7b1907aa1422 Some 10l and better layer handling (to comply with DFB 0.9.17)
zdar
parents: 9515
diff changeset
721 if (ret) DirectFBError("MPlayer - VM - pixelformat change",ret);
7b1907aa1422 Some 10l and better layer handling (to comply with DFB 0.9.17)
zdar
parents: 9515
diff changeset
722
7b1907aa1422 Some 10l and better layer handling (to comply with DFB 0.9.17)
zdar
parents: 9515
diff changeset
723 };
7b1907aa1422 Some 10l and better layer handling (to comply with DFB 0.9.17)
zdar
parents: 9515
diff changeset
724
7b1907aa1422 Some 10l and better layer handling (to comply with DFB 0.9.17)
zdar
parents: 9515
diff changeset
725 //get current pixel format
7b1907aa1422 Some 10l and better layer handling (to comply with DFB 0.9.17)
zdar
parents: 9515
diff changeset
726 dlc.flags = DLCONF_PIXELFORMAT;
7b1907aa1422 Some 10l and better layer handling (to comply with DFB 0.9.17)
zdar
parents: 9515
diff changeset
727 ret = layer->GetConfiguration(layer,&dlc);
7b1907aa1422 Some 10l and better layer handling (to comply with DFB 0.9.17)
zdar
parents: 9515
diff changeset
728 if (ret) {
7b1907aa1422 Some 10l and better layer handling (to comply with DFB 0.9.17)
zdar
parents: 9515
diff changeset
729 DirectFBError("MPlayer - VM - Layer->GetConfiguration",ret);
7b1907aa1422 Some 10l and better layer handling (to comply with DFB 0.9.17)
zdar
parents: 9515
diff changeset
730 } else {
9937
8098165634f7 printf->mp_msg and honor -double switch
zdar
parents: 9538
diff changeset
731 mp_msg(MSGT_VO, MSGL_INFO,"DirectFB: Layer has now pixelformat [%x]\n",dlc.pixelformat);
9538
7b1907aa1422 Some 10l and better layer handling (to comply with DFB 0.9.17)
zdar
parents: 9515
diff changeset
732 };
7b1907aa1422 Some 10l and better layer handling (to comply with DFB 0.9.17)
zdar
parents: 9515
diff changeset
733
7b1907aa1422 Some 10l and better layer handling (to comply with DFB 0.9.17)
zdar
parents: 9515
diff changeset
734 // check if we were succesfull
7b1907aa1422 Some 10l and better layer handling (to comply with DFB 0.9.17)
zdar
parents: 9515
diff changeset
735 if ((dlc.pixelformat != convformat(params.format)) || (ret != DFB_OK)) {
9937
8098165634f7 printf->mp_msg and honor -double switch
zdar
parents: 9538
diff changeset
736 mp_msg(MSGT_VO, MSGL_INFO,"DirectFB: Recovery failed!.\n");
9538
7b1907aa1422 Some 10l and better layer handling (to comply with DFB 0.9.17)
zdar
parents: 9515
diff changeset
737 return CONFIG_ERROR;
7b1907aa1422 Some 10l and better layer handling (to comply with DFB 0.9.17)
zdar
parents: 9515
diff changeset
738 }
7b1907aa1422 Some 10l and better layer handling (to comply with DFB 0.9.17)
zdar
parents: 9515
diff changeset
739
7b1907aa1422 Some 10l and better layer handling (to comply with DFB 0.9.17)
zdar
parents: 9515
diff changeset
740 break;
7b1907aa1422 Some 10l and better layer handling (to comply with DFB 0.9.17)
zdar
parents: 9515
diff changeset
741
7b1907aa1422 Some 10l and better layer handling (to comply with DFB 0.9.17)
zdar
parents: 9515
diff changeset
742 default: return CONFIG_ERROR;
7b1907aa1422 Some 10l and better layer handling (to comply with DFB 0.9.17)
zdar
parents: 9515
diff changeset
743
7b1907aa1422 Some 10l and better layer handling (to comply with DFB 0.9.17)
zdar
parents: 9515
diff changeset
744 };
9515
d3af25abde21 Layer configuration handling updates
zdar
parents: 9380
diff changeset
745 };
6952
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
746 };
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
747
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
748 // flipping of layer
10004
c889e7f9391a triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents: 9937
diff changeset
749 // try triple, \double... buffering
6952
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
750
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
751 dlc.flags = DLCONF_BUFFERMODE;
9937
8098165634f7 printf->mp_msg and honor -double switch
zdar
parents: 9538
diff changeset
752 #ifdef TRIPLE
10004
c889e7f9391a triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents: 9937
diff changeset
753 if (buffer_mode > 2) {
c889e7f9391a triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents: 9937
diff changeset
754 dlc.buffermode = DLBM_TRIPLE;
c889e7f9391a triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents: 9937
diff changeset
755 ret = layer->SetConfiguration( layer, &dlc );
c889e7f9391a triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents: 9937
diff changeset
756 } else {
c889e7f9391a triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents: 9937
diff changeset
757 ret=!DFB_OK;
c889e7f9391a triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents: 9937
diff changeset
758 }
c889e7f9391a triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents: 9937
diff changeset
759
9937
8098165634f7 printf->mp_msg and honor -double switch
zdar
parents: 9538
diff changeset
760 if (ret!=DFB_OK) {
8098165634f7 printf->mp_msg and honor -double switch
zdar
parents: 9538
diff changeset
761 #endif
10004
c889e7f9391a triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents: 9937
diff changeset
762 if (buffer_mode > 1) {
9937
8098165634f7 printf->mp_msg and honor -double switch
zdar
parents: 9538
diff changeset
763 dlc.buffermode = DLBM_BACKVIDEO;
8098165634f7 printf->mp_msg and honor -double switch
zdar
parents: 9538
diff changeset
764 ret = layer->SetConfiguration( layer, &dlc );
8098165634f7 printf->mp_msg and honor -double switch
zdar
parents: 9538
diff changeset
765 if (ret!=DFB_OK) {
8098165634f7 printf->mp_msg and honor -double switch
zdar
parents: 9538
diff changeset
766 dlc.buffermode = DLBM_BACKSYSTEM;
8098165634f7 printf->mp_msg and honor -double switch
zdar
parents: 9538
diff changeset
767 ret = layer->SetConfiguration( layer, &dlc );
6952
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
768 }
9937
8098165634f7 printf->mp_msg and honor -double switch
zdar
parents: 9538
diff changeset
769 }
8098165634f7 printf->mp_msg and honor -double switch
zdar
parents: 9538
diff changeset
770 if (ret == DFB_OK) {
8098165634f7 printf->mp_msg and honor -double switch
zdar
parents: 9538
diff changeset
771 mp_msg(MSGT_VO, MSGL_INFO,"DirectFB: Double buffering is active\n");
8098165634f7 printf->mp_msg and honor -double switch
zdar
parents: 9538
diff changeset
772 }
8098165634f7 printf->mp_msg and honor -double switch
zdar
parents: 9538
diff changeset
773 #ifdef TRIPLE
8098165634f7 printf->mp_msg and honor -double switch
zdar
parents: 9538
diff changeset
774 } else {
8098165634f7 printf->mp_msg and honor -double switch
zdar
parents: 9538
diff changeset
775 mp_msg(MSGT_VO, MSGL_INFO,"DirectFB: Triple buffering is active\n");
8098165634f7 printf->mp_msg and honor -double switch
zdar
parents: 9538
diff changeset
776 }
8098165634f7 printf->mp_msg and honor -double switch
zdar
parents: 9538
diff changeset
777 #endif
6952
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
778
10004
c889e7f9391a triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents: 9937
diff changeset
779 #if DIRECTFBVERSION > 916
c889e7f9391a triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents: 9937
diff changeset
780 if (field_parity != -1) {
c889e7f9391a triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents: 9937
diff changeset
781 dlc.flags = DLCONF_OPTIONS;
c889e7f9391a triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents: 9937
diff changeset
782 ret = layer->GetConfiguration( layer, &dlc );
c889e7f9391a triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents: 9937
diff changeset
783 if (ret==DFB_OK) {
c889e7f9391a triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents: 9937
diff changeset
784 dlc.options |= DLOP_FIELD_PARITY;
c889e7f9391a triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents: 9937
diff changeset
785 ret = layer->SetConfiguration( layer, &dlc );
c889e7f9391a triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents: 9937
diff changeset
786 if (ret==DFB_OK) {
c889e7f9391a triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents: 9937
diff changeset
787 layer->SetFieldParity( layer, field_parity );
c889e7f9391a triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents: 9937
diff changeset
788 }
c889e7f9391a triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents: 9937
diff changeset
789 }
c889e7f9391a triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents: 9937
diff changeset
790 }
c889e7f9391a triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents: 9937
diff changeset
791 #endif
c889e7f9391a triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents: 9937
diff changeset
792
c889e7f9391a triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents: 9937
diff changeset
793
6952
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
794 // get layer surface
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
795
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
796 ret = layer->GetSurface(layer,&primary);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
797
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
798 if (ret) {
9937
8098165634f7 printf->mp_msg and honor -double switch
zdar
parents: 9538
diff changeset
799 mp_msg(MSGT_VO, MSGL_ERR,"DirectFB: ConfigError - could not get surface\n");
6952
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
800 return CONFIG_ERROR; // what shall we report on fail?
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
801 }
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
802
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
803 // test surface for flipping
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
804 DFBCHECK(primary->GetCapabilities(primary,&caps));
8137
530d1c5f0c78 Switch containing options for DirectFB library was renamed to dfbopts.
arpi
parents: 7272
diff changeset
805 #if DIRECTFBVERSION > 913
9937
8098165634f7 printf->mp_msg and honor -double switch
zdar
parents: 9538
diff changeset
806 primary->Clear(primary,0,0,0,0xff);
8137
530d1c5f0c78 Switch containing options for DirectFB library was renamed to dfbopts.
arpi
parents: 7272
diff changeset
807 #endif
6952
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
808 flipping = 0;
10004
c889e7f9391a triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents: 9937
diff changeset
809 if (caps & (DSCAPS_FLIPPING
c889e7f9391a triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents: 9937
diff changeset
810 #ifdef TRIPLE
c889e7f9391a triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents: 9937
diff changeset
811 | DSCAPS_TRIPLE
c889e7f9391a triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents: 9937
diff changeset
812 #endif
c889e7f9391a triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents: 9937
diff changeset
813 )) {
6952
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
814 ret = primary->Flip(primary,NULL,0);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
815 if (ret==DFB_OK) {
8137
530d1c5f0c78 Switch containing options for DirectFB library was renamed to dfbopts.
arpi
parents: 7272
diff changeset
816 #if DIRECTFBVERSION > 913
9937
8098165634f7 printf->mp_msg and honor -double switch
zdar
parents: 9538
diff changeset
817 primary->Clear(primary,0,0,0,0xff);
8098165634f7 printf->mp_msg and honor -double switch
zdar
parents: 9538
diff changeset
818 #ifdef TRIPLE
8098165634f7 printf->mp_msg and honor -double switch
zdar
parents: 9538
diff changeset
819 // if we have 3 buffers clean once more
8098165634f7 printf->mp_msg and honor -double switch
zdar
parents: 9538
diff changeset
820 if (caps & DSCAPS_TRIPLE) {
8098165634f7 printf->mp_msg and honor -double switch
zdar
parents: 9538
diff changeset
821 primary->Flip(primary,NULL,0);
8098165634f7 printf->mp_msg and honor -double switch
zdar
parents: 9538
diff changeset
822 primary->Clear(primary,0,0,0,0xff);
8098165634f7 printf->mp_msg and honor -double switch
zdar
parents: 9538
diff changeset
823 }
8098165634f7 printf->mp_msg and honor -double switch
zdar
parents: 9538
diff changeset
824 #endif
8137
530d1c5f0c78 Switch containing options for DirectFB library was renamed to dfbopts.
arpi
parents: 7272
diff changeset
825 #endif
6952
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
826 flipping = 1;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
827 }
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
828 };
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
829
9937
8098165634f7 printf->mp_msg and honor -double switch
zdar
parents: 9538
diff changeset
830 mp_msg(MSGT_VO, MSGL_INFO,"DirectFB: Config - flipping = %i\n",flipping);
6952
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
831
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
832 // is scale needed ? Aspect ratio and layer pos/size
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
833
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
834
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
835 // get surface size
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
836 DFBCHECK(primary->GetSize(primary,&width,&height));
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
837
9937
8098165634f7 printf->mp_msg and honor -double switch
zdar
parents: 9538
diff changeset
838 mp_msg(MSGT_VO, MSGL_INFO,"DirectFB: Config - surface size = %ix%i\n",width,height);
6952
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
839
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
840 aspect_save_orig(s_width,s_height);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
841 aspect_save_prescale(d_width,d_height);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
842 if (params.scale) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
843 aspect_save_screenres(10000,10000);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
844 aspect(&out_width,&out_height,A_ZOOM);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
845
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
846 ret = layer->SetScreenLocation(layer,(1-(float)out_width/10000)/2,(1-(float)out_height/10000)/2,((float)out_width/10000),((float)out_height/10000));
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
847
9937
8098165634f7 printf->mp_msg and honor -double switch
zdar
parents: 9538
diff changeset
848 if (ret) mp_msg(MSGT_VO, MSGL_ERR,"DirectFB: ConfigError in layer configuration (position)\n");
6952
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
849
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
850 xoffset = 0;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
851 yoffset = 0;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
852
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
853 } else {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
854
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
855 aspect_save_screenres(width,height);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
856
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
857 if(fs) /* -fs */
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
858 aspect(&out_width,&out_height,A_ZOOM);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
859 else
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
860 aspect(&out_width,&out_height,A_NOZOOM);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
861
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
862
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
863 xoffset = (width - out_width) / 2;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
864 yoffset = (height - out_height) / 2;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
865 }
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
866
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
867 if (((s_width==out_width)&&(s_height==out_height)) || (params.scale)) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
868 stretch = 0;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
869 } else {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
870 stretch = 1;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
871 }
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
872
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
873
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
874 // temporary buffer in case of not flipping or scaling
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
875 if ((!flipping) || stretch) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
876
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
877 DFBCHECK (primary->GetPixelFormat (primary, &dsc.pixelformat));
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
878
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
879 dsc.flags = DSDESC_HEIGHT | DSDESC_PIXELFORMAT | DSDESC_WIDTH;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
880
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
881 dsc.width = s_width;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
882 dsc.height = s_height;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
883
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
884 DFBCHECK (dfb->CreateSurface( dfb, &dsc, &frame));
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
885 DFBCHECK(frame->GetSize(frame,&width,&height));
9937
8098165634f7 printf->mp_msg and honor -double switch
zdar
parents: 9538
diff changeset
886 mp_msg(MSGT_VO, MSGL_INFO,"DirectFB: Frame is active.\n");
6952
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
887 }
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
888
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
889 // get format for draw_alpha - should be removed soon - osd will be rendered outside vo driver
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
890 if (frame) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
891 DFBCHECK (frame->GetPixelFormat(frame,&pixel_format));
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
892 } else {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
893 DFBCHECK (primary->GetPixelFormat(primary,&pixel_format));
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
894 };
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
895
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
896 // finally turn on layer
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
897 layer->SetOpacity(layer,255);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
898
9937
8098165634f7 printf->mp_msg and honor -double switch
zdar
parents: 9538
diff changeset
899 mp_msg(MSGT_VO, MSGL_INFO,"DirectFB: Config finished [%ix%i] - [%ix%i]\n",out_width,out_height,width,height);
6952
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
900
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
901 return 0;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
902 }
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
903
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
904 extern void mplayer_put_key(int code);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
905
9380
edfe34c5405d linux->osdep
arpi
parents: 8640
diff changeset
906 #include "../osdep/keycodes.h"
6952
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
907
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
908 static void check_events(void)
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
909 {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
910
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
911 if (buffer) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
912
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
913 DFBInputEvent event;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
914
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
915 //if (verbose) printf ("DirectFB: Check events entered\n");
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
916 if (buffer->GetEvent(buffer, DFB_EVENT (&event)) == DFB_OK) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
917
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
918 if (event.type == DIET_KEYPRESS) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
919 switch (event.key_symbol) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
920 case DIKS_ESCAPE:
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
921 mplayer_put_key('q');
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
922 break;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
923 case DIKS_PAGE_UP: mplayer_put_key(KEY_PAGE_UP);break;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
924 case DIKS_PAGE_DOWN: mplayer_put_key(KEY_PAGE_DOWN);break;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
925 case DIKS_CURSOR_UP: mplayer_put_key(KEY_UP);break;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
926 case DIKS_CURSOR_DOWN: mplayer_put_key(KEY_DOWN);break;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
927 case DIKS_CURSOR_LEFT: mplayer_put_key(KEY_LEFT);break;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
928 case DIKS_CURSOR_RIGHT: mplayer_put_key(KEY_RIGHT);break;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
929 case DIKS_INSERT: mplayer_put_key(KEY_INSERT);break;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
930 case DIKS_DELETE: mplayer_put_key(KEY_DELETE);break;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
931 case DIKS_HOME: mplayer_put_key(KEY_HOME);break;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
932 case DIKS_END: mplayer_put_key(KEY_END);break;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
933
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
934 default:mplayer_put_key(event.key_symbol);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
935 };
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
936 };
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
937 };
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
938 // empty buffer, because of repeating (keyboard repeat is faster than key handling
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
939 // and this causes problems during seek)
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
940 // temporary workabout should be solved in the future
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
941 buffer->Reset(buffer);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
942
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
943 }
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
944 //if (verbose) printf ("DirectFB: Check events finished\n");
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
945 }
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
946
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
947 static void flip_page(void)
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
948 {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
949 DFBSurfaceBlittingFlags flags=DSBLIT_NOFX;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
950
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
951 unlock(); // unlock frame & primary
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
952
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
953 // if (verbose) printf("DirectFB: Flip page entered");
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
954
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
955 DFBCHECK (primary->SetBlittingFlags(primary,flags));
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
956
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
957 if (frame) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
958 if (stretch) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
959 DFBRectangle rect;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
960 rect.x=xoffset;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
961 rect.y=yoffset;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
962 rect.w=out_width;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
963 rect.h=out_height;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
964
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
965 DFBCHECK (primary->StretchBlit(primary,frame,NULL,&rect));
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
966
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
967 } else {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
968
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
969 DFBCHECK (primary->Blit(primary,frame,NULL,xoffset,yoffset));
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
970
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
971 };
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
972 };
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
973
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
974
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
975 if (flipping) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
976 DFBCHECK (primary->Flip (primary, NULL, DSFLIP_WAITFORSYNC));
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
977 }
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
978
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
979 }
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
980
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
981
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
982
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
983 static void uninit(void)
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
984 {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
985
9937
8098165634f7 printf->mp_msg and honor -double switch
zdar
parents: 9538
diff changeset
986 mp_msg(MSGT_VO, MSGL_INFO,"DirectFB: Uninit entered\n");
6952
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
987
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
988 unlock();
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
989
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
990 /*
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
991 * (Release)
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
992 */
10004
c889e7f9391a triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents: 9937
diff changeset
993 /*
9937
8098165634f7 printf->mp_msg and honor -double switch
zdar
parents: 9538
diff changeset
994 mp_msg(MSGT_VO, MSGL_INFO,"DirectFB: Releasing buffer\n");
6952
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
995 if (buffer) buffer->Release (buffer);
9937
8098165634f7 printf->mp_msg and honor -double switch
zdar
parents: 9538
diff changeset
996 mp_msg(MSGT_VO, MSGL_INFO,"DirectFB: Releasing keyboard\n");
6952
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
997 if (keyboard) keyboard->Release (keyboard);
10004
c889e7f9391a triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents: 9937
diff changeset
998 */
6952
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
999 if (frame) {
9937
8098165634f7 printf->mp_msg and honor -double switch
zdar
parents: 9538
diff changeset
1000 mp_msg(MSGT_VO, MSGL_INFO,"DirectFB: Releasing frame\n");
6952
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1001 frame->Release (frame);
10004
c889e7f9391a triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents: 9937
diff changeset
1002 frame = NULL;
6952
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1003 };
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1004
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1005 // switch off BES
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1006 // if (layer) layer->SetOpacity(layer,0);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1007
10004
c889e7f9391a triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents: 9937
diff changeset
1008 if (layer) {
c889e7f9391a triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents: 9937
diff changeset
1009 mp_msg(MSGT_VO, MSGL_INFO,"DirectFB: Releasing layer\n");
c889e7f9391a triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents: 9937
diff changeset
1010 layer->Release(layer);
c889e7f9391a triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents: 9937
diff changeset
1011 layer = NULL;
c889e7f9391a triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents: 9937
diff changeset
1012 }
6952
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1013
10004
c889e7f9391a triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents: 9937
diff changeset
1014 if (primary) {
c889e7f9391a triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents: 9937
diff changeset
1015 mp_msg(MSGT_VO, MSGL_INFO,"DirectFB: Releasing primary\n");
c889e7f9391a triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents: 9937
diff changeset
1016 primary->Release (primary);
c889e7f9391a triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents: 9937
diff changeset
1017 primary = NULL;
c889e7f9391a triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents: 9937
diff changeset
1018 }
c889e7f9391a triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents: 9937
diff changeset
1019
c889e7f9391a triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents: 9937
diff changeset
1020
c889e7f9391a triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents: 9937
diff changeset
1021 /* mp_msg(MSGT_VO, MSGL_INFO,"DirectFB: Releasing DirectFB library\n");
6952
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1022
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1023 dfb->Release (dfb);
10004
c889e7f9391a triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents: 9937
diff changeset
1024 */
9937
8098165634f7 printf->mp_msg and honor -double switch
zdar
parents: 9538
diff changeset
1025 mp_msg(MSGT_VO, MSGL_INFO,"DirectFB: Uninit done.\n");
6952
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1026 }
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1027
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1028
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1029 static uint32_t directfb_set_video_eq(char *data, int value) //data==name
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1030 {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1031
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1032 DFBColorAdjustment ca;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1033 float factor = (float)0xffff / 200.0;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1034
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1035 DFBDisplayLayerDescription desc;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1036
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1037 unlock();
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1038
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1039 if (layer) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1040
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1041 layer->GetDescription(layer,&desc);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1042
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1043 ca.flags=DCAF_NONE;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1044
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1045 if (! strcmp( data,"brightness" )) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1046 if (desc.caps & DLCAPS_BRIGHTNESS) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1047 ca.brightness = value * factor +0x8000;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1048 ca.flags |= DCAF_BRIGHTNESS;
9937
8098165634f7 printf->mp_msg and honor -double switch
zdar
parents: 9538
diff changeset
1049 mp_msg(MSGT_VO, MSGL_INFO,"DirectFB: SetVEq Brightness 0x%X %i\n",ca.brightness,value);
6952
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1050 } else return VO_FALSE;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1051 }
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1052
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1053 if (! strcmp( data,"contrast" )) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1054 if ((desc.caps & DLCAPS_CONTRAST)) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1055 ca.contrast = value * factor + 0x8000;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1056 ca.flags |= DCAF_CONTRAST;
9937
8098165634f7 printf->mp_msg and honor -double switch
zdar
parents: 9538
diff changeset
1057 mp_msg(MSGT_VO, MSGL_INFO,"DirectFB: SetVEq Contrast 0x%X %i\n",ca.contrast,value);
6952
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1058 } else return VO_FALSE;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1059 }
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1060
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1061 if (! strcmp( data,"hue" )) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1062 if ((desc.caps & DLCAPS_HUE)) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1063 ca.hue = value * factor + 0x8000;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1064 ca.flags |= DCAF_HUE;
9937
8098165634f7 printf->mp_msg and honor -double switch
zdar
parents: 9538
diff changeset
1065 mp_msg(MSGT_VO, MSGL_INFO,"DirectFB: SetVEq Hue 0x%X %i\n",ca.hue,value);
6952
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1066 } else return VO_FALSE;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1067 }
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1068
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1069 if (! strcmp( data,"saturation" )) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1070 if ((desc.caps & DLCAPS_SATURATION)) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1071 ca.saturation = value * factor + 0x8000;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1072 ca.flags |= DCAF_SATURATION;
9937
8098165634f7 printf->mp_msg and honor -double switch
zdar
parents: 9538
diff changeset
1073 mp_msg(MSGT_VO, MSGL_INFO,"DirectFB: SetVEq Saturation 0x%X %i\n",ca.saturation,value);
6952
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1074 } else return VO_FALSE;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1075 }
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1076
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1077 if (ca.flags != DCAF_NONE) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1078 layer->SetColorAdjustment(layer,&ca);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1079 return VO_TRUE;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1080 }
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1081 }
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1082
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1083 return VO_FALSE;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1084
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1085 }
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1086
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1087 static uint32_t directfb_get_video_eq(char *data, int *value) // data==name
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1088 {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1089
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1090 DFBColorAdjustment ca;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1091 float factor = 200.0 / (float)0xffff;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1092
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1093 DFBDisplayLayerDescription desc;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1094
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1095 if (layer) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1096
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1097 unlock();
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1098
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1099 layer->GetDescription(layer,&desc);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1100
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1101 layer->GetColorAdjustment(layer,&ca);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1102
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1103 if (! strcmp( data,"brightness" )) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1104 if (desc.caps & DLCAPS_BRIGHTNESS) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1105 *value = (int) ((ca.brightness-0x8000) * factor);
9937
8098165634f7 printf->mp_msg and honor -double switch
zdar
parents: 9538
diff changeset
1106 mp_msg(MSGT_VO, MSGL_INFO,"DirectFB: GetVEq Brightness 0x%X %i\n",ca.brightness,*value);
6952
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1107 return VO_TRUE;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1108 } else return VO_FALSE;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1109 }
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1110
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1111 if (! strcmp( data,"contrast" )) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1112 if ((desc.caps & DLCAPS_CONTRAST)) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1113 *value = (int) ((ca.contrast-0x8000) * factor);
9937
8098165634f7 printf->mp_msg and honor -double switch
zdar
parents: 9538
diff changeset
1114 mp_msg(MSGT_VO, MSGL_INFO,"DirectFB: GetVEq Contrast 0x%X %i\n",ca.contrast,*value);
6952
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1115 return VO_TRUE;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1116 } else return VO_FALSE;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1117 }
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1118
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1119 if (! strcmp( data,"hue" )) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1120 if ((desc.caps & DLCAPS_HUE)) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1121 *value = (int) ((ca.hue-0x8000) * factor);
9937
8098165634f7 printf->mp_msg and honor -double switch
zdar
parents: 9538
diff changeset
1122 mp_msg(MSGT_VO, MSGL_INFO,"DirectFB: GetVEq Hue 0x%X %i\n",ca.hue,*value);
6952
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1123 return VO_TRUE;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1124 } else return VO_FALSE;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1125 }
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1126
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1127 if (! strcmp( data,"saturation" )) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1128 if ((desc.caps & DLCAPS_SATURATION)) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1129 *value = (int) ((ca.saturation-0x8000) * factor);
9937
8098165634f7 printf->mp_msg and honor -double switch
zdar
parents: 9538
diff changeset
1130 mp_msg(MSGT_VO, MSGL_INFO,"DirectFB: GetVEq Saturation 0x%X %i\n",ca.saturation,*value);
6952
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1131 return VO_TRUE;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1132 } else return VO_FALSE;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1133 }
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1134 }
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1135 return VO_FALSE;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1136 }
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1137
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1138 static uint32_t get_image(mp_image_t *mpi)
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1139 {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1140
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1141 int err;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1142 void *dst;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1143 int pitch;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1144
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1145 // if (verbose) printf("DirectFB: get_image() called\n");
9937
8098165634f7 printf->mp_msg and honor -double switch
zdar
parents: 9538
diff changeset
1146 if(mpi->flags&MP_IMGFLAG_READABLE) return VO_FALSE; // slow video ram
6952
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1147 if(mpi->type==MP_IMGTYPE_STATIC) return VO_FALSE; // it is not static
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1148
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1149 // printf("width=%d vs. pitch=%d, flags=0x%X \n",mpi->width,pitch,mpi->flags);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1150
6985
6074119e09a0 Put/get_image fixed. Deleted forgotten development comments
zdar
parents: 6952
diff changeset
1151 if((mpi->width==pitch) ||
6952
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1152 (mpi->flags&(MP_IMGFLAG_ACCEPT_STRIDE|MP_IMGFLAG_ACCEPT_WIDTH))){
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1153 // we're lucky or codec accepts stride => ok, let's go!
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1154
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1155 if (frame) {
10004
c889e7f9391a triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents: 9937
diff changeset
1156 err = frame->Lock(frame,DSLF_WRITE|DSLF_READ,&dst,&pitch);
6952
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1157 framelocked=1;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1158 } else {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1159 err = primary->Lock(primary,DSLF_WRITE,&dst,&pitch);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1160 primarylocked=1;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1161 }
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1162
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1163 if (err) {
9937
8098165634f7 printf->mp_msg and honor -double switch
zdar
parents: 9538
diff changeset
1164 mp_msg(MSGT_VO, MSGL_ERR,"DirectFB: DR lock failed!");
6952
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1165 return VO_FALSE;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1166 };
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1167
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1168 if(mpi->flags&MP_IMGFLAG_PLANAR){
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1169 //YV12 format
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1170 mpi->planes[0]=dst;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1171 if(mpi->flags&MP_IMGFLAG_SWAPPED){
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1172 mpi->planes[1]=dst + pitch*height;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1173 mpi->planes[2]=mpi->planes[1] + pitch*height/4;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1174 } else {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1175 mpi->planes[2]=dst + pitch*height;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1176 mpi->planes[1]=mpi->planes[2] + pitch*height/4;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1177 }
6985
6074119e09a0 Put/get_image fixed. Deleted forgotten development comments
zdar
parents: 6952
diff changeset
1178 mpi->width=width;
6074119e09a0 Put/get_image fixed. Deleted forgotten development comments
zdar
parents: 6952
diff changeset
1179 mpi->stride[0]=pitch;
6952
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1180 mpi->stride[1]=mpi->stride[2]=pitch/2;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1181 } else {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1182 //YUY2 and RGB formats
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1183 mpi->planes[0]=dst;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1184 mpi->width=width;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1185 mpi->stride[0]=pitch;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1186 }
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1187 mpi->flags|=MP_IMGFLAG_DIRECT;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1188 // if (verbose) printf("DirectFB: get_image() SUCCESS -> Direct Rendering ENABLED\n");
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1189 return VO_TRUE;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1190
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1191 }
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1192 return VO_FALSE;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1193 }
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1194
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1195 static uint32_t draw_slice(uint8_t *src[], int stride[], int w, int h, int x, int y)
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1196 {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1197 int i;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1198 unsigned int pitch;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1199 void *dst;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1200 void *dst2;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1201 void *srcp;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1202 unsigned int p;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1203
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1204 unlock();
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1205
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1206 if (frame) {
10004
c889e7f9391a triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents: 9937
diff changeset
1207 DFBCHECK (frame->Lock(frame,DSLF_WRITE|DSLF_READ,&dst,&pitch));
6952
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1208 framelocked = 1;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1209 } else {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1210 DFBCHECK (primary->Lock(primary,DSLF_WRITE,&dst,&pitch));
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1211 primarylocked = 1;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1212 };
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1213
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1214 p=min(w,pitch);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1215
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1216 dst += y*pitch + x;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1217 dst2 = dst + pitch*height - y*pitch + y*pitch/4 - x/2;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1218 srcp = src[0];
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1219
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1220 for (i=0;i<h;i++) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1221 memcpy(dst,srcp,p);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1222 dst += pitch;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1223 srcp += stride[0];
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1224 }
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1225
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1226 if (pixel_format == DSPF_YV12) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1227
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1228 dst = dst2;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1229 srcp = src[2];
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1230 p = p/2;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1231
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1232 for (i=0;i<h/2;i++) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1233 memcpy(dst,srcp,p);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1234 dst += pitch/2;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1235 srcp += stride[2];
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1236 }
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1237
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1238 dst = dst2 + pitch*height/4;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1239 srcp = src[1];
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1240
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1241 for (i=0;i<h/2;i++) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1242 memcpy(dst,srcp,p);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1243 dst += pitch/2;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1244 srcp += stride[1];
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1245 }
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1246
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1247 } else {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1248
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1249 dst = dst2;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1250 srcp = src[1];
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1251 p = p/2;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1252
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1253 for (i=0;i<h/2;i++) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1254 memcpy(dst,srcp,p);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1255 dst += pitch/2;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1256 srcp += stride[1];
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1257 }
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1258
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1259 dst = dst2 + pitch*height/4;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1260 srcp = src[2];
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1261
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1262 for (i=0;i<h/2;i++) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1263 memcpy(dst,srcp,p);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1264 dst += pitch/2;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1265 srcp += stride[2];
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1266 }
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1267
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1268 }
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1269
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1270 unlock();
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1271
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1272 return 0;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1273 }
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1274
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1275
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1276 static uint32_t put_image(mp_image_t *mpi){
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1277
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1278
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1279 static IDirectFBSurface *tmp = NULL;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1280 DFBSurfaceDescription dsc;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1281 DFBRectangle rect;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1282
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1283 // if (verbose) printf("DirectFB: Put_image entered %i %i %i %i %i %i\n",mpi->x,mpi->y,mpi->w,mpi->h,mpi->width,mpi->height);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1284
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1285 unlock();
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1286
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1287 // already out?
6985
6074119e09a0 Put/get_image fixed. Deleted forgotten development comments
zdar
parents: 6952
diff changeset
1288 if((mpi->flags&(MP_IMGFLAG_DIRECT|MP_IMGFLAG_DRAW_CALLBACK))) {
6952
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1289 // if (verbose) printf("DirectFB: Put_image - nothing todo\n");
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1290 return VO_TRUE;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1291 }
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1292
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1293 if (mpi->flags&MP_IMGFLAG_PLANAR) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1294 // memcpy all planes - sad but necessary
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1295 int i;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1296 unsigned int pitch;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1297 void *dst;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1298 void *src;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1299 unsigned int p;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1300
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1301 // if (verbose) printf("DirectFB: Put_image - planar branch\n");
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1302 if (frame) {
10004
c889e7f9391a triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents: 9937
diff changeset
1303 DFBCHECK (frame->Lock(frame,DSLF_WRITE|DSLF_READ,&dst,&pitch));
6952
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1304 framelocked = 1;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1305 } else {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1306 DFBCHECK (primary->Lock(primary,DSLF_WRITE,&dst,&pitch));
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1307 primarylocked = 1;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1308 };
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1309
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1310 p=min(mpi->w,pitch);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1311
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1312 src = mpi->planes[0]+mpi->y*mpi->stride[0]+mpi->x;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1313
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1314 for (i=0;i<mpi->h;i++) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1315 memcpy(dst+i*pitch,src+i*mpi->stride[0],p);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1316 }
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1317
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1318 if (pixel_format == DSPF_YV12) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1319
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1320 dst += pitch*height;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1321 p = p/2;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1322 src = mpi->planes[2]+mpi->y*mpi->stride[2]+mpi->x/2;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1323
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1324 for (i=0;i<mpi->h/2;i++) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1325 memcpy(dst+i*pitch/2,src+i*mpi->stride[2],p);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1326 }
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1327
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1328 dst += pitch*height/4;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1329 src = mpi->planes[1]+mpi->y*mpi->stride[1]+mpi->x/2;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1330
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1331 for (i=0;i<mpi->h/2;i++) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1332 memcpy(dst+i*pitch/2,src+i*mpi->stride[1],p);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1333 }
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1334
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1335 } else {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1336
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1337 dst += pitch*height;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1338 p = p/2;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1339 src = mpi->planes[1]+mpi->y*mpi->stride[1]+mpi->x/2;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1340
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1341 for (i=0;i<mpi->h/2;i++) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1342 memcpy(dst+i*pitch/2,src+i*mpi->stride[1],p);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1343 }
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1344
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1345 dst += pitch*height/4;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1346 src = mpi->planes[2]+mpi->y*mpi->stride[2]+mpi->x/2;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1347
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1348 for (i=0;i<mpi->h/2;i++) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1349 memcpy(dst+i*pitch/2,src+i*mpi->stride[2],p);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1350 }
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1351
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1352 }
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1353 unlock();
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1354
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1355 } else {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1356
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1357 dsc.flags = DSDESC_HEIGHT | DSDESC_PIXELFORMAT | DSDESC_WIDTH | DSDESC_PREALLOCATED;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1358 dsc.preallocated[0].data = mpi->planes[0];
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1359 dsc.preallocated[0].pitch = mpi->stride[0];
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1360 dsc.width = mpi->width;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1361 dsc.height = mpi->height;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1362 dsc.pixelformat = convformat(mpi->imgfmt);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1363
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1364 DFBCHECK (dfb->CreateSurface( dfb, &dsc, &tmp));
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1365
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1366 rect.x=mpi->x;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1367 rect.y=mpi->y;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1368 rect.w=mpi->w;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1369 rect.h=mpi->h;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1370
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1371 if (frame) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1372 DFBCHECK (tmp->Blit(tmp,frame,&rect,0,0));
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1373 } else {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1374 DFBCHECK (tmp->Blit(tmp,primary,&rect,xoffset,yoffset));
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1375 };
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1376 tmp->Release(tmp);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1377 }
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1378 return VO_TRUE;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1379 }
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1380
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1381
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1382
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1383 static uint32_t control(uint32_t request, void *data, ...)
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1384 {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1385 switch (request) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1386 case VOCTRL_QUERY_FORMAT:
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1387 return query_format(*((uint32_t*)data));
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1388 case VOCTRL_GET_IMAGE:
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1389 return get_image(data);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1390 case VOCTRL_DRAW_IMAGE:
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1391 return put_image(data);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1392 case VOCTRL_SET_EQUALIZER:
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1393 {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1394 va_list ap;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1395 int value;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1396
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1397 va_start(ap, data);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1398 value = va_arg(ap, int);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1399 va_end(ap);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1400
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1401 return(directfb_set_video_eq(data, value));
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1402 }
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1403 case VOCTRL_GET_EQUALIZER:
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1404 {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1405 va_list ap;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1406 int *value;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1407
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1408 va_start(ap, data);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1409 value = va_arg(ap, int*);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1410 va_end(ap);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1411
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1412 return(directfb_get_video_eq(data, value));
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1413 }
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1414 };
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1415 return VO_NOTIMPL;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1416 }
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1417
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1418 // unused function
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1419
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1420 static uint32_t draw_frame(uint8_t *src[])
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1421 {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1422 return -1;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1423 }
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1424
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1425 // hopefully will be removed soon
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1426
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1427 static void draw_alpha(int x0, int y0, int w, int h, unsigned char *src,
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1428 unsigned char *srca, int stride)
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1429 {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1430 void *dst;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1431 int pitch;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1432
9937
8098165634f7 printf->mp_msg and honor -double switch
zdar
parents: 9538
diff changeset
1433 unlock(); // isnt it silly I have to unlock surface and than lock it again :-)
6952
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1434
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1435 if (frame) {
10004
c889e7f9391a triple buffering support, configuration/option system changed,some minor bugs fixed
zdar
parents: 9937
diff changeset
1436 DFBCHECK (frame->Lock(frame,DSLF_WRITE|DSLF_READ,&dst,&pitch));
6952
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1437 framelocked = 1;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1438 } else {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1439 DFBCHECK (primary->Lock(primary,DSLF_WRITE,&dst,&pitch));
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1440 primarylocked = 1;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1441 };
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1442
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1443 switch(pixel_format) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1444 case DSPF_RGB32:
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1445 case DSPF_ARGB:
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1446 vo_draw_alpha_rgb32(w,h,src,srca,stride,((uint8_t *) dst)+pitch*y0 + 4*x0,pitch);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1447 break;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1448
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1449 case DSPF_RGB24:
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1450 vo_draw_alpha_rgb24(w,h,src,srca,stride,((uint8_t *) dst)+pitch*y0 + 3*x0,pitch);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1451 break;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1452
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1453 case DSPF_RGB16:
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1454 vo_draw_alpha_rgb16(w,h,src,srca,stride,((uint8_t *) dst)+pitch*y0 + 2*x0,pitch);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1455 break;
8640
554e6aa7da5f fix to compile with DirecFB 0.9.16
zdar
parents: 8148
diff changeset
1456 #if DIRECTFBVERSION > 915
554e6aa7da5f fix to compile with DirecFB 0.9.16
zdar
parents: 8148
diff changeset
1457 case DSPF_ARGB1555:
554e6aa7da5f fix to compile with DirecFB 0.9.16
zdar
parents: 8148
diff changeset
1458 #else
6952
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1459 case DSPF_RGB15:
8640
554e6aa7da5f fix to compile with DirecFB 0.9.16
zdar
parents: 8148
diff changeset
1460 #endif
6952
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1461 vo_draw_alpha_rgb15(w,h,src,srca,stride,((uint8_t *) dst)+pitch*y0 + 2*x0,pitch);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1462 break;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1463
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1464 case DSPF_YUY2:
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1465 vo_draw_alpha_yuy2(w,h,src,srca,stride,((uint8_t *) dst) + pitch*y0 + 2*x0,pitch);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1466 break;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1467
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1468 case DSPF_UYVY:
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1469 vo_draw_alpha_yuy2(w,h,src,srca,stride,((uint8_t *) dst) + pitch*y0 + 2*x0 + 1,pitch);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1470 break;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1471
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1472 case DSPF_I420:
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1473 case DSPF_YV12:
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1474 vo_draw_alpha_yv12(w,h,src,srca,stride,((uint8_t *) dst) + pitch*y0 + 1*x0,pitch);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1475 break;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1476 }
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1477
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1478 unlock();
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1479 }
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1480
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1481 static void draw_osd(void)
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1482 {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1483 vo_draw_text(width,height,draw_alpha);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1484 }