annotate libvo/vo_directfb.c @ 13006:8639d064d3a1

DTS support via lavc and libdts Patch by Aurelien Jacobs ( aurel at gnuage dot org ) dts in wav by me
author rtognimp
date Thu, 12 Aug 2004 12:36:08 +0000
parents 6e35326c742f
children e047e70a9767
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1 /*
3341
59390e321c4e -aspect ration correction
atmos4
parents: 3339
diff changeset
2 MPlayer video driver for DirectFramebuffer device
59390e321c4e -aspect ration correction
atmos4
parents: 3339
diff changeset
3
59390e321c4e -aspect ration correction
atmos4
parents: 3339
diff changeset
4 (C) 2001
59390e321c4e -aspect ration correction
atmos4
parents: 3339
diff changeset
5
59390e321c4e -aspect ration correction
atmos4
parents: 3339
diff changeset
6 Written by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
59390e321c4e -aspect ration correction
atmos4
parents: 3339
diff changeset
7
59390e321c4e -aspect ration correction
atmos4
parents: 3339
diff changeset
8 Inspired by vo_sdl and vo_fbdev.
59390e321c4e -aspect ration correction
atmos4
parents: 3339
diff changeset
9
59390e321c4e -aspect ration correction
atmos4
parents: 3339
diff changeset
10 To get second head working delete line 120
59390e321c4e -aspect ration correction
atmos4
parents: 3339
diff changeset
11 from fbdev.c (from DirectFB sources version 0.9.7)
59390e321c4e -aspect ration correction
atmos4
parents: 3339
diff changeset
12 Line contains following:
59390e321c4e -aspect ration correction
atmos4
parents: 3339
diff changeset
13 fbdev->fd = open( "/dev/fb0", O_RDWR );
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
14
3341
59390e321c4e -aspect ration correction
atmos4
parents: 3339
diff changeset
15 Parts of this code taken from DirectFB examples:
59390e321c4e -aspect ration correction
atmos4
parents: 3339
diff changeset
16 (c) Copyright 2000 convergence integrated media GmbH.
59390e321c4e -aspect ration correction
atmos4
parents: 3339
diff changeset
17 All rights reserved.
59390e321c4e -aspect ration correction
atmos4
parents: 3339
diff changeset
18
59390e321c4e -aspect ration correction
atmos4
parents: 3339
diff changeset
19 This library is free software; you can redistribute it and/or
59390e321c4e -aspect ration correction
atmos4
parents: 3339
diff changeset
20 modify it under the terms of the GNU Lesser General Public
59390e321c4e -aspect ration correction
atmos4
parents: 3339
diff changeset
21 License as published by the Free Software Foundation; either
59390e321c4e -aspect ration correction
atmos4
parents: 3339
diff changeset
22 version 2 of the License, or (at your option) any later version.
59390e321c4e -aspect ration correction
atmos4
parents: 3339
diff changeset
23
59390e321c4e -aspect ration correction
atmos4
parents: 3339
diff changeset
24 This library is distributed in the hope that it will be useful,
59390e321c4e -aspect ration correction
atmos4
parents: 3339
diff changeset
25 but WITHOUT ANY WARRANTY; without even the implied warranty of
59390e321c4e -aspect ration correction
atmos4
parents: 3339
diff changeset
26 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
59390e321c4e -aspect ration correction
atmos4
parents: 3339
diff changeset
27 Lesser General Public License for more details.
59390e321c4e -aspect ration correction
atmos4
parents: 3339
diff changeset
28
59390e321c4e -aspect ration correction
atmos4
parents: 3339
diff changeset
29 You should have received a copy of the GNU Lesser General Public
59390e321c4e -aspect ration correction
atmos4
parents: 3339
diff changeset
30 License along with this library; if not, write to the
59390e321c4e -aspect ration correction
atmos4
parents: 3339
diff changeset
31 Free Software Foundation, Inc., 59 Temple Place - Suite 330,
59390e321c4e -aspect ration correction
atmos4
parents: 3339
diff changeset
32 Boston, MA 02111-1307, USA.
59390e321c4e -aspect ration correction
atmos4
parents: 3339
diff changeset
33 */
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
34
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
35 // directfb includes
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
36
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
37 #include <directfb.h>
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
38
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
39 // other things
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
40
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
41 #include <stdio.h>
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
42 #include <stdlib.h>
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
43 #include <string.h>
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
44 #include <fcntl.h>
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
45 #include <unistd.h>
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
46 #include <errno.h>
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
47 #include <ctype.h>
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
48 #include <assert.h>
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
49
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
50 #include <sys/mman.h>
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
51 #include <sys/ioctl.h>
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
52 #include <sys/kd.h>
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
53 #include <linux/fb.h>
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
54
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
55 #include "config.h"
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
56 #include "video_out.h"
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
57 #include "video_out_internal.h"
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
58 #include "fastmemcpy.h"
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
59 #include "sub.h"
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
60 #include "../postproc/rgb2rgb.h"
5611
0fad81defb4f 0.1 bugfix
arpi
parents: 5607
diff changeset
61
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
62 #include "aspect.h"
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
63
5611
0fad81defb4f 0.1 bugfix
arpi
parents: 5607
diff changeset
64 #ifndef min
0fad81defb4f 0.1 bugfix
arpi
parents: 5607
diff changeset
65 #define min(x,y) (((x)<(y))?(x):(y))
0fad81defb4f 0.1 bugfix
arpi
parents: 5607
diff changeset
66 #endif
0fad81defb4f 0.1 bugfix
arpi
parents: 5607
diff changeset
67
8148
5b39e79af5fe removed get_info, using the same sheme as in libmpcodecs instead
alex
parents: 7124
diff changeset
68 static vo_info_t info = {
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
69 "Direct Framebuffer Device",
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
70 "directfb",
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
71 "Jiri Svoboda Jiri.Svoboda@seznam.cz",
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
72 ""
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
73 };
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
74
8148
5b39e79af5fe removed get_info, using the same sheme as in libmpcodecs instead
alex
parents: 7124
diff changeset
75 LIBVO_EXTERN(directfb)
5b39e79af5fe removed get_info, using the same sheme as in libmpcodecs instead
alex
parents: 7124
diff changeset
76
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
77 extern int verbose;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
78
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
79 /******************************
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
80 * directfb *
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
81 ******************************/
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
82
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
83 /*
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
84 * (Globals)
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
85 */
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
86 static IDirectFB *dfb = NULL;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
87 static IDirectFBSurface *primary = NULL;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
88 static IDirectFBInputDevice *keyboard = NULL;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
89 static IDirectFBDisplayLayer *videolayer = NULL;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
90 static DFBDisplayLayerConfig dlc;
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
91 static unsigned int screen_width = 0;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
92 static unsigned int screen_height = 0;
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
93 static DFBSurfacePixelFormat frame_format;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
94 static unsigned int frame_pixel_size = 0;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
95 static unsigned int source_pixel_size = 0;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
96 static int xoffset=0,yoffset=0;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
97 #define DFBCHECK(x...) \
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
98 { \
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
99 DFBResult err = x; \
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
100 \
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
101 if (err != DFB_OK) \
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
102 { \
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
103 fprintf( stderr, "%s <%d>:\n\t", __FILE__, __LINE__ ); \
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
104 DirectFBErrorFatal( #x, err ); \
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
105 } \
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
106 }
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
107
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
108 /*
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
109 * The frame is to be loaded into a surface that we can blit from.
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
110 */
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
111
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
112 static IDirectFBSurface *frame = NULL;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
113
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
114 /*
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
115 * A buffer for input events.
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
116 */
5026
693b917ac916 DirectFB 0.9.9 support - patch by Aubin Paul <aubin@punknews.org>
arpi
parents: 4596
diff changeset
117
6920
447ee5862f5d updates, using DIRECTFBVERSION and video EQ support by Jiri.Svoboda@seznam.cz
arpi
parents: 6717
diff changeset
118 #if DIRECTFBVERSION > 908
5026
693b917ac916 DirectFB 0.9.9 support - patch by Aubin Paul <aubin@punknews.org>
arpi
parents: 4596
diff changeset
119 static IDirectFBEventBuffer *buffer = NULL;
693b917ac916 DirectFB 0.9.9 support - patch by Aubin Paul <aubin@punknews.org>
arpi
parents: 4596
diff changeset
120 #else
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
121 static IDirectFBInputBuffer *buffer = NULL;
5026
693b917ac916 DirectFB 0.9.9 support - patch by Aubin Paul <aubin@punknews.org>
arpi
parents: 4596
diff changeset
122 #endif
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
123
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
124 /******************************
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
125 * vo_directfb *
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
126 ******************************/
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
127
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
128 /* command line/config file options */
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
129 #ifdef HAVE_FBDEV
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
130 extern char *fb_dev_name;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
131 #else
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
132 char *fb_dev_name;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
133 #endif
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
134
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
135 static void (*draw_alpha_p)(int w, int h, unsigned char *src,
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
136 unsigned char *srca, int stride, unsigned char *dst,
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
137 int dstride);
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
138
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
139 static uint32_t in_width;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
140 static uint32_t in_height;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
141 static uint32_t out_width=1;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
142 static uint32_t out_height=1;
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
143 static uint32_t pixel_format;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
144 static int fs;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
145 static int flip;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
146 static int stretch=0;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
147 struct modes_t {
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
148 int valid;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
149 unsigned int width;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
150 unsigned int height;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
151 int overx,overy;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
152 } modes [4];
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
153 static unsigned int best_bpp=5;
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
154 // videolayer stuff
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
155 static int videolayeractive=0;
5258
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
156 static int videolayerpresent=0;
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
157 //some info about videolayer - filled on preinit
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
158 struct vlayer_t {
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
159 int iv12;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
160 int i420;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
161 int yuy2;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
162 int uyvy;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
163 int brightness;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
164 int saturation;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
165 int contrast;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
166 int hue;
6717
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
167 int hwscale;
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
168 } videolayercaps;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
169 // workabout for DirectFB bug
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
170 static int buggyYV12BitBlt=0;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
171 static int memcpyBitBlt=0;
6717
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
172 //
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
173 static int hwstretchblit=0;
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
174 #define DIRECTRENDER
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
175 #ifdef DIRECTRENDER
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
176 static int dr_enabled=0;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
177 static int framelocked=0;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
178 #endif
6717
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
179 #define FLIPPING
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
180 #ifdef FLIPPING
6920
447ee5862f5d updates, using DIRECTFBVERSION and video EQ support by Jiri.Svoboda@seznam.cz
arpi
parents: 6717
diff changeset
181 static int do_flipping=1; // turn (on) off flipping - prepared for cmd line switch
6717
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
182 static int wait_vsync_after_flip=0;
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
183 static int flipping=0; // flipping is active
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
184 static int invram=0; // backbuffer in video memory
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
185 static int blitperformed=0; // in case of temporary frame we will blit before drawing osd
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
186 #endif
5258
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
187 // primary & frame stuff
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
188 static int frameallocated=0;
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
189 static int primaryallocated=0;
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
190
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
191 DFBEnumerationResult enum_modes_callback( unsigned int width,unsigned int height,unsigned int bpp, void *data)
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
192 {
6262
ae3cfbfc8e3f -updates vo_directfb (+configure&makefile) according to planned changes
arpi
parents: 6211
diff changeset
193 int overx=0,overy=0,closer=0,over=0;
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
194 unsigned int index=bpp/8-1;
6262
ae3cfbfc8e3f -updates vo_directfb (+configure&makefile) according to planned changes
arpi
parents: 6211
diff changeset
195 int we_are_under=0;
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
196
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
197 if (verbose) printf("DirectFB: Validator entered %i %i %i\n",width,height,bpp);
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
198
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
199 overx=width-out_width;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
200 overy=height-out_height;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
201 if (!modes[index].valid) {
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
202 modes[index].valid=1;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
203 modes[index].width=width;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
204 modes[index].height=height;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
205 modes[index].overx=overx;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
206 modes[index].overy=overy;
6717
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
207 if (verbose) printf("DirectFB: Mode added %i %i %i\n",width,height,bpp);
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
208 }
6262
ae3cfbfc8e3f -updates vo_directfb (+configure&makefile) according to planned changes
arpi
parents: 6211
diff changeset
209 if ((modes[index].overy<0)||(modes[index].overx<0)) we_are_under=1; // stored mode is smaller than req mode
ae3cfbfc8e3f -updates vo_directfb (+configure&makefile) according to planned changes
arpi
parents: 6211
diff changeset
210 if (abs(overx*overy)<abs(modes[index].overx * modes[index].overy)) closer=1; // current mode is closer to desired res
ae3cfbfc8e3f -updates vo_directfb (+configure&makefile) according to planned changes
arpi
parents: 6211
diff changeset
211 if ((overx>=0)&&(overy>=0)) over=1; // current mode is bigger or equaul to desired res
ae3cfbfc8e3f -updates vo_directfb (+configure&makefile) according to planned changes
arpi
parents: 6211
diff changeset
212 if ((closer && (over || we_are_under)) || (we_are_under && over)) {
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
213 modes[index].valid=1;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
214 modes[index].width=width;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
215 modes[index].height=height;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
216 modes[index].overx=overx;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
217 modes[index].overy=overy;
6717
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
218 if (verbose) printf("DirectFB: Better mode added %i %i %i\n",width,height,bpp);
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
219 };
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
220
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
221 return DFENUM_OK;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
222 }
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
223
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
224
6920
447ee5862f5d updates, using DIRECTFBVERSION and video EQ support by Jiri.Svoboda@seznam.cz
arpi
parents: 6717
diff changeset
225 #if DIRECTFBVERSION > 912
447ee5862f5d updates, using DIRECTFBVERSION and video EQ support by Jiri.Svoboda@seznam.cz
arpi
parents: 6717
diff changeset
226 DFBEnumerationResult enum_layers_callback( DFBDisplayLayerID id,
447ee5862f5d updates, using DIRECTFBVERSION and video EQ support by Jiri.Svoboda@seznam.cz
arpi
parents: 6717
diff changeset
227 DFBDisplayLayerDescription desc,
447ee5862f5d updates, using DIRECTFBVERSION and video EQ support by Jiri.Svoboda@seznam.cz
arpi
parents: 6717
diff changeset
228 void *data )
447ee5862f5d updates, using DIRECTFBVERSION and video EQ support by Jiri.Svoboda@seznam.cz
arpi
parents: 6717
diff changeset
229 {
447ee5862f5d updates, using DIRECTFBVERSION and video EQ support by Jiri.Svoboda@seznam.cz
arpi
parents: 6717
diff changeset
230 DFBDisplayLayerCapabilities caps = desc.caps;
447ee5862f5d updates, using DIRECTFBVERSION and video EQ support by Jiri.Svoboda@seznam.cz
arpi
parents: 6717
diff changeset
231 #else
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
232 DFBEnumerationResult enum_layers_callback( unsigned int id,
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
233 DFBDisplayLayerCapabilities caps,
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
234 void *data )
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
235 {
6920
447ee5862f5d updates, using DIRECTFBVERSION and video EQ support by Jiri.Svoboda@seznam.cz
arpi
parents: 6717
diff changeset
236 #endif
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
237 IDirectFBDisplayLayer **layer = (IDirectFBDisplayLayer **)data;
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
238 if (verbose) {
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
239 printf("\nDirectFB: Layer %d:\n", id );
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
240
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
241 if (caps & DLCAPS_SURFACE)
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
242 printf( " - Has a surface.\n" );
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
243
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
244 if (caps & DLCAPS_ALPHACHANNEL)
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
245 printf( " - Supports blending based on alpha channel.\n" );
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
246
6920
447ee5862f5d updates, using DIRECTFBVERSION and video EQ support by Jiri.Svoboda@seznam.cz
arpi
parents: 6717
diff changeset
247 #if DIRECTFBVERSION > 909
5890
f3283d1c7e41 DFB 0.9.10 update patch by Jiri.
atmos4
parents: 5611
diff changeset
248 if (caps & DLCAPS_SRC_COLORKEY)
f3283d1c7e41 DFB 0.9.10 update patch by Jiri.
atmos4
parents: 5611
diff changeset
249 printf( " - Supports source based color keying.\n" );
f3283d1c7e41 DFB 0.9.10 update patch by Jiri.
atmos4
parents: 5611
diff changeset
250
f3283d1c7e41 DFB 0.9.10 update patch by Jiri.
atmos4
parents: 5611
diff changeset
251 if (caps & DLCAPS_DST_COLORKEY)
f3283d1c7e41 DFB 0.9.10 update patch by Jiri.
atmos4
parents: 5611
diff changeset
252 printf( " - Supports destination based color keying.\n" );
f3283d1c7e41 DFB 0.9.10 update patch by Jiri.
atmos4
parents: 5611
diff changeset
253 #else
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
254 if (caps & DLCAPS_COLORKEYING)
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
255 printf( " - Supports color keying.\n" );
5890
f3283d1c7e41 DFB 0.9.10 update patch by Jiri.
atmos4
parents: 5611
diff changeset
256 #endif
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
257
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
258 if (caps & DLCAPS_FLICKER_FILTERING)
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
259 printf( " - Supports flicker filtering.\n" );
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
260
6717
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
261 /* renamed in dfb v. 0.9.13
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
262 if (caps & DLCAPS_INTERLACED_VIDEO)
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
263 printf( " - Can natively display interlaced video.\n" );
6717
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
264 */
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
265 if (caps & DLCAPS_OPACITY)
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
266 printf( " - Supports blending based on global alpha factor.\n" );
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
267
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
268 if (caps & DLCAPS_SCREEN_LOCATION)
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
269 printf( " - Can be positioned on the screen.\n" );
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
270
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
271 if (caps & DLCAPS_BRIGHTNESS)
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
272 printf( " - Brightness can be adjusted.\n" );
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
273
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
274 if (caps & DLCAPS_CONTRAST)
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
275 printf( " - Contrast can be adjusted.\n" );
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
276
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
277 if (caps & DLCAPS_HUE)
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
278 printf( " - Hue can be adjusted.\n" );
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
279
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
280 if (caps & DLCAPS_SATURATION)
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
281 printf( " - Saturation can be adjusted.\n" );
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
282
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
283 printf("\n");
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
284 }
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
285 /* We take the first layer not being the primary */
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
286 if (id != DLID_PRIMARY) {
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
287 DFBResult ret;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
288
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
289 ret = dfb->GetDisplayLayer( dfb, id, layer );
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
290 if (ret)
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
291 DirectFBError( "dfb->GetDisplayLayer failed", ret );
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
292 else
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
293 return DFENUM_CANCEL;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
294 }
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
295
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
296 return DFENUM_OK;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
297 }
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
298
4354
5018e8014ebd fixed preinit conflict
alex
parents: 4352
diff changeset
299 static uint32_t preinit(const char *arg)
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
300 {
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
301 DFBSurfaceDescription dsc;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
302 DFBResult ret;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
303 DFBDisplayLayerConfigFlags failed;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
304
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
305 /*
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
306 * (Initialize)
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
307 */
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
308
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
309 if (verbose) printf("DirectFB: Preinit entered\n");
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
310
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
311 DFBCHECK (DirectFBInit (NULL,NULL));
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
312
6717
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
313 if (!((directfb_major_version <= 0) &&
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
314 (directfb_minor_version <= 9) &&
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
315 (directfb_micro_version < 7)))
3651
8148193fee93 working with 0.9.6 too (0.9.6 is coming with debian woody)
alex
parents: 3588
diff changeset
316 {
10618
7901f7d6e0eb 4x10l fix. Vars used by the config layer must be malloc'd (strdup) as they will be freed at exit.
alex
parents: 9380
diff changeset
317 if (!fb_dev_name && !(fb_dev_name = getenv("FRAMEBUFFER"))) fb_dev_name = strdup("/dev/fb0");
3651
8148193fee93 working with 0.9.6 too (0.9.6 is coming with debian woody)
alex
parents: 3588
diff changeset
318 DFBCHECK (DirectFBSetOption ("fbdev",fb_dev_name));
8148193fee93 working with 0.9.6 too (0.9.6 is coming with debian woody)
alex
parents: 3588
diff changeset
319 }
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
320
6717
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
321 // use own bitblt for YV12 beacuse bug in dfb till 0.9.11
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
322 if ((directfb_major_version <= 0) &&
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
323 (directfb_minor_version <= 9) &&
6262
ae3cfbfc8e3f -updates vo_directfb (+configure&makefile) according to planned changes
arpi
parents: 6211
diff changeset
324 (directfb_micro_version <= 11)) {
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
325 buggyYV12BitBlt=1;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
326 if (verbose) printf("DirectFB: Buggy YV12BitBlt!\n");
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
327 }
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
328
6717
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
329 #ifdef FLIPPING
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
330 // activate flipping from release 0.9.11
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
331 if ((directfb_major_version <= 0) &&
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
332 (directfb_minor_version <= 9) &&
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
333 (directfb_micro_version <= 10)) {
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
334 do_flipping=0;
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
335 } else {
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
336 // (de)activated by default - should be overwritten by cmd line option
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
337 // do_flipping=1;
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
338 }
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
339 // wait for vsync if ver <0.9.13
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
340 if ((directfb_major_version <= 0) &&
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
341 (directfb_minor_version <= 9) &&
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
342 (directfb_micro_version <= 12)) {
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
343 wait_vsync_after_flip=1;
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
344 if (verbose) printf("DirectFB: Manual wait for vsync enabled!\n");
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
345 } else {
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
346 wait_vsync_after_flip=0;
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
347 }
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
348 #endif
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
349
3588
8e56fe18e7fb Applied patch by Jiri Svoboda <Jiri.Svoboda@seznam.cz>:
pl
parents: 3341
diff changeset
350 // uncomment this if you do not wish to create a new vt for DirectFB
6717
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
351 // DFBCHECK (DirectFBSetOption ("no-vt-switch",""));
3588
8e56fe18e7fb Applied patch by Jiri Svoboda <Jiri.Svoboda@seznam.cz>:
pl
parents: 3341
diff changeset
352
8e56fe18e7fb Applied patch by Jiri Svoboda <Jiri.Svoboda@seznam.cz>:
pl
parents: 3341
diff changeset
353 // uncomment this if you want to allow vt switching
6717
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
354 // DFBCHECK (DirectFBSetOption ("vt-switching",""));
6920
447ee5862f5d updates, using DIRECTFBVERSION and video EQ support by Jiri.Svoboda@seznam.cz
arpi
parents: 6717
diff changeset
355 #if DIRECTFBVERSION > 908
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
356 // uncomment this if you want to hide gfx cursor (req dfb >=0.9.9)
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
357 DFBCHECK (DirectFBSetOption ("no-cursor",""));
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
358 #endif
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
359
3588
8e56fe18e7fb Applied patch by Jiri Svoboda <Jiri.Svoboda@seznam.cz>:
pl
parents: 3341
diff changeset
360 DFBCHECK (DirectFBSetOption ("bg-color","00000000"));
8e56fe18e7fb Applied patch by Jiri Svoboda <Jiri.Svoboda@seznam.cz>:
pl
parents: 3341
diff changeset
361
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
362 DFBCHECK (DirectFBCreate (&dfb));
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
363 DFBCHECK (dfb->SetCooperativeLevel (dfb, DFSCL_FULLSCREEN));
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
364
11000
6e35326c742f many small typo and grammar fixes
gabucino
parents: 10618
diff changeset
365 // let's try to get YUY2 layer - borrowed from DirectFb examples
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
366
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
367 /* Enumerate display layers */
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
368 DFBCHECK (dfb->EnumDisplayLayers( dfb, enum_layers_callback, &videolayer ));
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
369
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
370 if (!videolayer) {
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
371 if (verbose) printf("DirectFB: No videolayer found\n");
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
372 // no videolayer found
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
373 // printf( "\nNo additional layers have been found.\n" );
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
374 videolayeractive=0;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
375
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
376 } else {
6717
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
377 // just to be sure that layer is hidden during config
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
378 videolayer->SetOpacity(videolayer,0);
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
379
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
380 // there is an additional layer so test it for YUV formats
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
381 // some videolayers support RGB formats - not used now
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
382 if (verbose) printf("DirectFB: Testing videolayer caps\n");
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
383
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
384 dlc.flags = DLCONF_PIXELFORMAT;
6920
447ee5862f5d updates, using DIRECTFBVERSION and video EQ support by Jiri.Svoboda@seznam.cz
arpi
parents: 6717
diff changeset
385 #if DIRECTFBVERSION > 908
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
386 dlc.pixelformat = DSPF_YV12;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
387 ret = videolayer->TestConfiguration( videolayer, &dlc, &failed );
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
388 if (ret==DFB_OK) {
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
389 videolayercaps.iv12=1;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
390 if (verbose) printf("DirectFB: Videolayer supports YV12 format\n");
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
391 } else {
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
392 videolayercaps.iv12=0;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
393 if (verbose) printf("DirectFB: Videolayer doesn't support YV12 format\n");
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
394 };
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
395
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
396 dlc.pixelformat = DSPF_I420;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
397 ret = videolayer->TestConfiguration( videolayer, &dlc, &failed );
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
398 if (ret==DFB_OK) {
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
399 videolayercaps.i420=1;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
400 if (verbose) printf("DirectFB: Videolayer supports I420 format\n");
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
401 } else {
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
402 videolayercaps.i420=0;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
403 if (verbose) printf("DirectFB: Videolayer doesn't support I420 format\n");
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
404 };
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
405 #else
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
406 videolayercaps.yuy2=0;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
407 #endif
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
408
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
409 dlc.pixelformat = DSPF_YUY2;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
410 ret = videolayer->TestConfiguration( videolayer, &dlc, &failed );
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
411 if (ret==DFB_OK) {
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
412 videolayercaps.yuy2=1;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
413 if (verbose) printf("DirectFB: Videolayer supports YUY2 format\n");
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
414 } else {
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
415 videolayercaps.yuy2=0;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
416 if (verbose) printf("DirectFB: Videolayer doesn't support YUY2 format\n");
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
417 };
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
418
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
419 dlc.pixelformat = DSPF_UYVY;
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
420 ret = videolayer->TestConfiguration( videolayer, &dlc, &failed );
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
421 if (ret==DFB_OK) {
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
422 videolayercaps.uyvy=1;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
423 if (verbose) printf("DirectFB: Videolayer supports UYVY format\n");
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
424 } else {
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
425 videolayercaps.uyvy=0;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
426 if (verbose) printf("DirectFB: Videolayer doesn't support UYVY format\n");
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
427 };
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
428
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
429 // test for color caps
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
430 {
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
431 DFBDisplayLayerCapabilities caps;
6920
447ee5862f5d updates, using DIRECTFBVERSION and video EQ support by Jiri.Svoboda@seznam.cz
arpi
parents: 6717
diff changeset
432 #if DIRECTFBVERSION > 912
447ee5862f5d updates, using DIRECTFBVERSION and video EQ support by Jiri.Svoboda@seznam.cz
arpi
parents: 6717
diff changeset
433 DFBDisplayLayerDescription desc;
447ee5862f5d updates, using DIRECTFBVERSION and video EQ support by Jiri.Svoboda@seznam.cz
arpi
parents: 6717
diff changeset
434 videolayer->GetDescription(videolayer,&desc);
447ee5862f5d updates, using DIRECTFBVERSION and video EQ support by Jiri.Svoboda@seznam.cz
arpi
parents: 6717
diff changeset
435 caps = desc.caps;
447ee5862f5d updates, using DIRECTFBVERSION and video EQ support by Jiri.Svoboda@seznam.cz
arpi
parents: 6717
diff changeset
436 #else
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
437 videolayer->GetCapabilities(videolayer,&caps);
6920
447ee5862f5d updates, using DIRECTFBVERSION and video EQ support by Jiri.Svoboda@seznam.cz
arpi
parents: 6717
diff changeset
438 #endif
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
439 if (caps & DLCAPS_BRIGHTNESS) {
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
440 videolayercaps.brightness=1;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
441 } else {
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
442 videolayercaps.brightness=0;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
443 };
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
444
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
445 if (caps & DLCAPS_CONTRAST) {
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
446 videolayercaps.contrast=1;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
447 } else {
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
448 videolayercaps.contrast=0;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
449 };
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
450
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
451 if (caps & DLCAPS_HUE) {
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
452 videolayercaps.hue=1;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
453 } else {
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
454 videolayercaps.hue=0;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
455 };
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
456
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
457 if (caps & DLCAPS_SATURATION) {
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
458 videolayercaps.saturation=1;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
459 } else {
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
460 videolayercaps.saturation=0;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
461 };
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
462
6717
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
463 // test if layer can change size/position
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
464 if (caps & DLCAPS_SCREEN_LOCATION) {
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
465 videolayercaps.hwscale=1;
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
466 } else {
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
467 videolayercaps.hwscale=0;
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
468 };
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
469
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
470
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
471 }
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
472
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
473
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
474 // is there a working yuv ? if no we will not use videolayer
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
475 if ((videolayercaps.iv12==0)&&(videolayercaps.i420==0)&&(videolayercaps.yuy2==0)&&(videolayercaps.uyvy==0)) {
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
476 // videolayer doesn't work with yuv so release it
5258
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
477 videolayerpresent=0;
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
478 videolayer->SetOpacity(videolayer,0);
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
479 videolayer->Release(videolayer);
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
480 } else {
5258
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
481 videolayerpresent=1;
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
482 };
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
483 }
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
484
6717
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
485 // check generic card capabilities (for hw scaling)
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
486 {
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
487 DFBCardCapabilities caps;
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
488 DFBCHECK (dfb->GetCardCapabilities(dfb,&caps));
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
489 if (caps.acceleration_mask & DFXL_STRETCHBLIT) hwstretchblit=1; else hwstretchblit=0;
6952
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents: 6920
diff changeset
490 if (verbose && hwstretchblit) printf("DirectFB: Card supports hw stretch blit\n");
6717
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
491 }
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
492
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
493 // just look at RGB things for main layer
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
494 modes[0].valid=0;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
495 modes[1].valid=0;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
496 modes[2].valid=0;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
497 modes[3].valid=0;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
498 DFBCHECK (dfb->EnumVideoModes(dfb,enum_modes_callback,NULL));
5258
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
499
6717
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
500
5258
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
501 /*
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
502 * (Get keyboard)
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
503 */
6717
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
504 ret = dfb->GetInputDevice (dfb, DIDID_KEYBOARD, &keyboard);
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
505
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
506 if (ret==DFB_OK) {
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
507 if (verbose) {
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
508 printf("DirectFB: Keyboard init OK\n");
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
509 }
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
510 } else {
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
511 keyboard = NULL;
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
512 printf("DirectFB: Keyboard init FAILED\n");
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
513 }
5258
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
514
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
515 /*
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
516 * Create an input buffer for the keyboard.
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
517 */
6920
447ee5862f5d updates, using DIRECTFBVERSION and video EQ support by Jiri.Svoboda@seznam.cz
arpi
parents: 6717
diff changeset
518 #if DIRECTFBVERSION > 908
6717
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
519 if (keyboard) DFBCHECK (keyboard->CreateEventBuffer (keyboard, &buffer));
5258
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
520 #else
6717
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
521 if (keyboard) DFBCHECK (keyboard->CreateInputBuffer (keyboard, &buffer));
5258
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
522 #endif
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
523 // just to start with clean ...
6717
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
524 if (buffer) buffer->Reset(buffer);
4359
266ebffd8fc9 no longer required to call preinit from init and query_format, mplayer.c does this
alex
parents: 4354
diff changeset
525 return 0;
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
526
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
527 }
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
528
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
529
4433
df8e0f71cc3c new info for tuning
nick
parents: 4359
diff changeset
530 static uint32_t config(uint32_t width, uint32_t height, uint32_t d_width,
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
531 uint32_t d_height, uint32_t fullscreen, char *title,
7124
eca7dbad0166 finally removed query_vaa, bes_da and vo_tune_info - the obsoleted libvo api
alex
parents: 6952
diff changeset
532 uint32_t format)
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
533 {
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
534 /*
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
535 * (Locals)
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
536 */
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
537 DFBSurfaceDescription dsc;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
538 DFBResult ret;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
539
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
540
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
541 int vm = fullscreen & 0x02;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
542 int zoom = fullscreen & 0x04;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
543
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
544 if (verbose) printf("DirectFB: Config entered [%ix%i]\n",width,height);
5258
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
545 if (verbose) printf("DirectFB: With requested format: %s\n",vo_format_name(format));
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
546
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
547 fs = fullscreen & 0x01;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
548 flip = fullscreen & 0x08;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
549
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
550 pixel_format=format;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
551
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
552 in_width = width;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
553 in_height = height;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
554
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
555 if (d_width) {
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
556 out_width = d_width;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
557 out_height = d_height;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
558 } else {
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
559 d_width = out_width = in_width;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
560 d_height = out_height = in_height;
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
561 }
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
562
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
563 // just look at RGB things for main layer - once again - now we now desired screen size
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
564 modes[0].valid=0;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
565 modes[1].valid=0;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
566 modes[2].valid=0;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
567 modes[3].valid=0;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
568 DFBCHECK (dfb->EnumVideoModes(dfb,enum_modes_callback,NULL));
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
569
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
570 if (vm) {
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
571 // need better algorithm just hack
6262
ae3cfbfc8e3f -updates vo_directfb (+configure&makefile) according to planned changes
arpi
parents: 6211
diff changeset
572 switch (format) {
ae3cfbfc8e3f -updates vo_directfb (+configure&makefile) according to planned changes
arpi
parents: 6211
diff changeset
573 case IMGFMT_RGB32:
ae3cfbfc8e3f -updates vo_directfb (+configure&makefile) according to planned changes
arpi
parents: 6211
diff changeset
574 case IMGFMT_BGR32:
ae3cfbfc8e3f -updates vo_directfb (+configure&makefile) according to planned changes
arpi
parents: 6211
diff changeset
575 if (modes[3].valid) {
ae3cfbfc8e3f -updates vo_directfb (+configure&makefile) according to planned changes
arpi
parents: 6211
diff changeset
576 dfb->SetVideoMode(dfb,modes[3].width,modes[3].height,32);
ae3cfbfc8e3f -updates vo_directfb (+configure&makefile) according to planned changes
arpi
parents: 6211
diff changeset
577 if (verbose) printf("DirectFB: Trying to set videomode [%ix%i 32 bpp]\n",modes[3].width,modes[3].height);
ae3cfbfc8e3f -updates vo_directfb (+configure&makefile) according to planned changes
arpi
parents: 6211
diff changeset
578 };
ae3cfbfc8e3f -updates vo_directfb (+configure&makefile) according to planned changes
arpi
parents: 6211
diff changeset
579 break;
ae3cfbfc8e3f -updates vo_directfb (+configure&makefile) according to planned changes
arpi
parents: 6211
diff changeset
580 case IMGFMT_RGB24:
ae3cfbfc8e3f -updates vo_directfb (+configure&makefile) according to planned changes
arpi
parents: 6211
diff changeset
581 case IMGFMT_BGR24:
ae3cfbfc8e3f -updates vo_directfb (+configure&makefile) according to planned changes
arpi
parents: 6211
diff changeset
582 if (modes[2].valid) {
ae3cfbfc8e3f -updates vo_directfb (+configure&makefile) according to planned changes
arpi
parents: 6211
diff changeset
583 dfb->SetVideoMode(dfb,modes[2].width,modes[2].height,24);
ae3cfbfc8e3f -updates vo_directfb (+configure&makefile) according to planned changes
arpi
parents: 6211
diff changeset
584 if (verbose) printf("DirectFB: Trying to set videomode [%ix%i 24 bpp]\n",modes[2].width,modes[2].height);
ae3cfbfc8e3f -updates vo_directfb (+configure&makefile) according to planned changes
arpi
parents: 6211
diff changeset
585 };
ae3cfbfc8e3f -updates vo_directfb (+configure&makefile) according to planned changes
arpi
parents: 6211
diff changeset
586 break;
ae3cfbfc8e3f -updates vo_directfb (+configure&makefile) according to planned changes
arpi
parents: 6211
diff changeset
587 case IMGFMT_RGB16:
ae3cfbfc8e3f -updates vo_directfb (+configure&makefile) according to planned changes
arpi
parents: 6211
diff changeset
588 case IMGFMT_BGR16:
ae3cfbfc8e3f -updates vo_directfb (+configure&makefile) according to planned changes
arpi
parents: 6211
diff changeset
589 case IMGFMT_RGB15:
ae3cfbfc8e3f -updates vo_directfb (+configure&makefile) according to planned changes
arpi
parents: 6211
diff changeset
590 case IMGFMT_BGR15:
ae3cfbfc8e3f -updates vo_directfb (+configure&makefile) according to planned changes
arpi
parents: 6211
diff changeset
591 if (modes[1].valid) {
ae3cfbfc8e3f -updates vo_directfb (+configure&makefile) according to planned changes
arpi
parents: 6211
diff changeset
592 dfb->SetVideoMode(dfb,modes[1].width,modes[1].height,16);
ae3cfbfc8e3f -updates vo_directfb (+configure&makefile) according to planned changes
arpi
parents: 6211
diff changeset
593 if (verbose) printf("DirectFB: Trying to set videomode [%ix%i 16 bpp]\n",modes[1].width,modes[1].height);
ae3cfbfc8e3f -updates vo_directfb (+configure&makefile) according to planned changes
arpi
parents: 6211
diff changeset
594 };
ae3cfbfc8e3f -updates vo_directfb (+configure&makefile) according to planned changes
arpi
parents: 6211
diff changeset
595 break;
ae3cfbfc8e3f -updates vo_directfb (+configure&makefile) according to planned changes
arpi
parents: 6211
diff changeset
596
6717
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
597 default: // try all of them in order 24bit 16bit 32bit 8bit
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
598 if (modes[2].valid) {
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
599 dfb->SetVideoMode(dfb,modes[2].width,modes[2].height,24);
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
600 if (verbose) printf("DirectFB: Trying to set videomode [%ix%i 24 bpp]\n",modes[2].width,modes[2].height);
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
601 }
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
602 else if (modes[1].valid) {
6262
ae3cfbfc8e3f -updates vo_directfb (+configure&makefile) according to planned changes
arpi
parents: 6211
diff changeset
603 dfb->SetVideoMode(dfb,modes[1].width,modes[1].height,16);
ae3cfbfc8e3f -updates vo_directfb (+configure&makefile) according to planned changes
arpi
parents: 6211
diff changeset
604 if (verbose) printf("DirectFB: Trying to set videomode [%ix%i 16 bpp]\n",modes[1].width,modes[1].height);
ae3cfbfc8e3f -updates vo_directfb (+configure&makefile) according to planned changes
arpi
parents: 6211
diff changeset
605 }
ae3cfbfc8e3f -updates vo_directfb (+configure&makefile) according to planned changes
arpi
parents: 6211
diff changeset
606 else if (modes[3].valid) {
ae3cfbfc8e3f -updates vo_directfb (+configure&makefile) according to planned changes
arpi
parents: 6211
diff changeset
607 dfb->SetVideoMode(dfb,modes[3].width,modes[3].height,32);
ae3cfbfc8e3f -updates vo_directfb (+configure&makefile) according to planned changes
arpi
parents: 6211
diff changeset
608 if (verbose) printf("DirectFB: Trying to set videomode [%ix%i 32 bpp]\n",modes[3].width,modes[3].height);
ae3cfbfc8e3f -updates vo_directfb (+configure&makefile) according to planned changes
arpi
parents: 6211
diff changeset
609 }
ae3cfbfc8e3f -updates vo_directfb (+configure&makefile) according to planned changes
arpi
parents: 6211
diff changeset
610 else if (modes[0].valid) {
ae3cfbfc8e3f -updates vo_directfb (+configure&makefile) according to planned changes
arpi
parents: 6211
diff changeset
611 dfb->SetVideoMode(dfb,modes[0].width,modes[0].height,8);
ae3cfbfc8e3f -updates vo_directfb (+configure&makefile) according to planned changes
arpi
parents: 6211
diff changeset
612 if (verbose) printf("DirectFB: Trying to set videomode [%ix%i 8 bpp]\n",modes[0].width,modes[0].height);
ae3cfbfc8e3f -updates vo_directfb (+configure&makefile) according to planned changes
arpi
parents: 6211
diff changeset
613 }
ae3cfbfc8e3f -updates vo_directfb (+configure&makefile) according to planned changes
arpi
parents: 6211
diff changeset
614 break;
ae3cfbfc8e3f -updates vo_directfb (+configure&makefile) according to planned changes
arpi
parents: 6211
diff changeset
615 };
ae3cfbfc8e3f -updates vo_directfb (+configure&makefile) according to planned changes
arpi
parents: 6211
diff changeset
616
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
617 }
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
618
5258
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
619 // release primary if it is already allocated
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
620 if (primaryallocated) {
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
621 if (verbose ) printf("DirectFB: Release primary\n");
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
622 primary->Release (primary);
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
623 primaryallocated=0;
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
624 };
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
625
5258
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
626 videolayeractive=0; // will be enabled on succes later
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
627
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
628 if (videolayerpresent) {
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
629
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
630 // try to set proper w a h values matching image size
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
631 dlc.flags = DLCONF_WIDTH | DLCONF_HEIGHT;
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
632 dlc.width = in_width;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
633 dlc.height = in_height;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
634
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
635 ret = videolayer->SetConfiguration( videolayer, &dlc );
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
636
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
637 if (ret) {
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
638 if (verbose) printf("DirectFB: Set layer size failed\n");
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
639 };
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
640
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
641 // try to set correct pixel format (closest to required)
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
642
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
643 dlc.flags = DLCONF_PIXELFORMAT;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
644 dlc.pixelformat = 0;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
645 switch (pixel_format) {
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
646 case IMGFMT_YV12:
6920
447ee5862f5d updates, using DIRECTFBVERSION and video EQ support by Jiri.Svoboda@seznam.cz
arpi
parents: 6717
diff changeset
647 #if DIRECTFBVERSION > 908
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
648 if (videolayercaps.i420==1) {
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
649 dlc.pixelformat=DSPF_I420;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
650 break;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
651 } else if (videolayercaps.iv12==1) {
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
652 dlc.pixelformat=DSPF_YV12;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
653 break;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
654 };
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
655
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
656 #endif
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
657 case IMGFMT_YUY2: if (videolayercaps.yuy2==1) {
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
658 dlc.pixelformat=DSPF_YUY2;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
659 break;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
660 // temporary disabled - do not have conv tool to uyvy
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
661 /* } else if (videolayercaps.uyvy==1) {
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
662 dlc.pixelformat=DSPF_UYVY;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
663 break;
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
664 */
6920
447ee5862f5d updates, using DIRECTFBVERSION and video EQ support by Jiri.Svoboda@seznam.cz
arpi
parents: 6717
diff changeset
665 #if DIRECTFBVERSION > 908
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
666 } else if (videolayercaps.i420==1) {
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
667 dlc.pixelformat=DSPF_I420;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
668 break;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
669 } else if (videolayercaps.iv12==1) {
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
670 dlc.pixelformat=DSPF_YV12;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
671 break;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
672 #endif
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
673 };
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
674 // shouldn't happen - if it reaches here -> bug
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
675
5258
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
676 case IMGFMT_RGB32: dlc.pixelformat = DSPF_ARGB; break;
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
677 case IMGFMT_BGR32: dlc.pixelformat = DSPF_ARGB; break;
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
678 case IMGFMT_RGB24: dlc.pixelformat = DSPF_RGB24; break;
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
679 case IMGFMT_BGR24: dlc.pixelformat = DSPF_RGB24; break;
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
680 case IMGFMT_RGB16: dlc.pixelformat = DSPF_RGB16; break;
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
681 case IMGFMT_BGR16: dlc.pixelformat = DSPF_RGB16; break;
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
682 case IMGFMT_RGB15: dlc.pixelformat = DSPF_RGB15; break;
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
683 case IMGFMT_BGR15: dlc.pixelformat = DSPF_RGB15; break;
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
684 default: dlc.pixelformat = DSPF_RGB24; break;
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
685 }
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
686
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
687 if (verbose) switch (dlc.pixelformat) {
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
688 case DSPF_ARGB: printf("DirectFB: layer format ARGB\n");
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
689 break;
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
690 case DSPF_RGB32: printf("DirectFB: layer format RGB32\n");
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
691 break;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
692 case DSPF_RGB24: printf("DirectFB: layer format RGB24\n");
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
693 break;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
694 case DSPF_RGB16: printf("DirectFB: layer format RGB16\n");
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
695 break;
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
696 case DSPF_RGB15: printf("DirectFB: layer format RGB15\n");
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
697 break;
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
698 case DSPF_YUY2: printf("DirectFB: layer format YUY2\n");
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
699 break;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
700 case DSPF_UYVY: printf("DirectFB: layer format UYVY\n");
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
701 break;
6920
447ee5862f5d updates, using DIRECTFBVERSION and video EQ support by Jiri.Svoboda@seznam.cz
arpi
parents: 6717
diff changeset
702 #if DIRECTFBVERSION > 908
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
703 case DSPF_YV12: printf("DirectFB: layer format YV12\n");
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
704 break;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
705 case DSPF_I420: printf("DirectFB: layer format I420\n");
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
706 break;
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
707 #endif
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
708 default: printf("DirectFB: - unknown format ->exit\n"); return 1;
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
709 }
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
710
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
711 ret =videolayer->SetConfiguration( videolayer, &dlc );
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
712 if (!ret) {
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
713 if (verbose) printf("DirectFB: SetConfiguration for layer OK\n");
6717
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
714
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
715 #ifdef FLIPPING
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
716 // try to set flipping for videolayer
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
717 if (do_flipping) {
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
718 dlc.flags = DLCONF_BUFFERMODE;
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
719 dlc.buffermode = DLBM_BACKVIDEO;
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
720 invram = 1;
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
721 flipping = 1;
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
722 ret =videolayer->SetConfiguration( videolayer, &dlc );
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
723 if (ret!=DFB_OK) {
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
724 invram = 0;
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
725 if (!((directfb_major_version <= 0) &&
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
726 (directfb_minor_version <= 9) &&
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
727 (directfb_micro_version <= 11))) {
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
728
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
729 dlc.buffermode = DLBM_BACKSYSTEM;
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
730 ret =videolayer->SetConfiguration( videolayer, &dlc );
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
731 if (ret!=DFB_OK) {
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
732 flipping = 0;
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
733 }
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
734 } else { flipping = 0; };
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
735 }
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
736 if (verbose) if (flipping) {
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
737 printf("DirectFB: SetFlipping for layer: OK (vram=%i)\n",invram);
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
738 } else {
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
739 printf("DirectFB: SetFlipping for layer: FAILED\n");
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
740 }
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
741 } else flipping=0;
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
742 #endif
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
743 ret = videolayer->GetSurface( videolayer, &primary );
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
744 if (!ret){
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
745 videolayeractive=1;
6717
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
746 if (verbose) printf("DirectFB: Get surface for layer: OK\n");
5258
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
747 primaryallocated=1;
6717
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
748 // set videolayer to be visible
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
749 videolayer->SetOpacity(videolayer,0xFF);
5258
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
750 } else {
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
751 videolayeractive=0;
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
752 if (videolayer) videolayer->SetOpacity(videolayer,0);
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
753 };
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
754 } else {
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
755 videolayeractive=0;
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
756 if (videolayer) videolayer->SetOpacity(videolayer,0);
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
757 };
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
758
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
759 }
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
760
6717
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
761 // for flipping we will use BitBlt not integrated directfb flip (if necessary)
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
762 dsc.flags = DSDESC_CAPS | DSDESC_PIXELFORMAT;
6717
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
763 dsc.caps = DSCAPS_PRIMARY /*| DSCAPS_VIDEOONLY*/;
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
764
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
765 switch (format) {
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
766 case IMGFMT_RGB32: dsc.pixelformat = DSPF_ARGB; source_pixel_size= 4; break;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
767 case IMGFMT_BGR32: dsc.pixelformat = DSPF_ARGB; source_pixel_size= 4; break;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
768 case IMGFMT_RGB24: dsc.pixelformat = DSPF_RGB24; source_pixel_size= 3; break;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
769 case IMGFMT_BGR24: dsc.pixelformat = DSPF_RGB24; source_pixel_size= 3; break;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
770 case IMGFMT_RGB16: dsc.pixelformat = DSPF_RGB16; source_pixel_size= 2; break;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
771 case IMGFMT_BGR16: dsc.pixelformat = DSPF_RGB16; source_pixel_size= 2; break;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
772 case IMGFMT_RGB15: dsc.pixelformat = DSPF_RGB15; source_pixel_size= 2; break;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
773 case IMGFMT_BGR15: dsc.pixelformat = DSPF_RGB15; source_pixel_size= 2; break;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
774 default: dsc.pixelformat = DSPF_RGB24; source_pixel_size=2; break; //YUV formats
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
775 };
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
776
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
777 if (!videolayeractive) {
6717
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
778 #ifdef FLIPPING
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
779 if (do_flipping) {
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
780 flipping = 1;
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
781 invram = 0;
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
782 dsc.caps |= DSCAPS_FLIPPING;
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
783 ret = dfb->CreateSurface( dfb, &dsc, &primary );
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
784 if (ret!=DFB_OK) {
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
785 dsc.caps &= ~DSCAPS_FLIPPING;
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
786 DFBCHECK (dfb->CreateSurface( dfb, &dsc, &primary ));
6717
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
787 flipping = 0;
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
788 } else {
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
789 // test flipping again
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
790 DFBCHECK (primary->GetCapabilities(primary,&dsc.caps));
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
791 if (!(dsc.caps & DSCAPS_FLIPPING)) {
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
792 printf("DirectFB: Error - surface sucesfully created with flipping flag, but doesn't support it.\n");
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
793 flipping = 0;
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
794 } else {
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
795 // test fliping in real - sometimes flips fails even if shouldn't
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
796 DFBResult ret;
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
797 ret = primary->Flip(primary,NULL,0);
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
798 if (ret!=DFB_OK) {
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
799 // recreate surface as non flipping
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
800 printf("DirectFB: Error - surface sucesfully created with flipping flag, but test flip failed.\n");
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
801 flipping = 0;
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
802 dsc.caps &= ~DSCAPS_FLIPPING;
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
803 primary->Release(primary);
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
804 DFBCHECK (dfb->CreateSurface( dfb, &dsc, &primary ));
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
805 }
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
806
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
807 }
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
808 }
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
809 /* if (verbose) if (flipping) {
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
810 printf("DirectFB: Flipping for primary: OK\n");
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
811 } else {
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
812 printf("DirectFB: Flipping for primary: FAILED\n");
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
813 }
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
814 */ } else {
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
815 flipping = 0;
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
816 #endif
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
817 DFBCHECK (dfb->CreateSurface( dfb, &dsc, &primary ));
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
818 #ifdef FLIPPING
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
819 }
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
820 #endif
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
821
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
822 if (verbose) printf("DirectFB: Get primary surface: OK\n");
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
823
5258
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
824 primaryallocated=1;
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
825 }
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
826
6717
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
827 #ifdef FLIPPING
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
828 // final check for flipping - based on real caps
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
829
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
830 DFBCHECK (primary->GetCapabilities(primary,&dsc.caps));
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
831 if (!(dsc.caps & DSCAPS_FLIPPING)) {
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
832 printf("DirectFB: Flipping si NOT active.\n");
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
833 flipping = 0;
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
834 } else {
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
835 printf("DirectFB: Flipping is active.\n");
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
836 flipping = 1;
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
837 }
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
838 // }
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
839 #endif
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
840
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
841 DFBCHECK (primary->GetSize (primary, &screen_width, &screen_height));
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
842
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
843 DFBCHECK (primary->GetPixelFormat (primary, &frame_format));
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
844
5258
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
845 // temporary frame buffer
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
846 dsc.flags = DSDESC_CAPS | DSDESC_HEIGHT | DSDESC_PIXELFORMAT | DSDESC_WIDTH;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
847
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
848 dsc.width = in_width;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
849 dsc.height = in_height;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
850
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
851 // at this time use pixel req format or format of main disp
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
852
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
853 switch (format) {
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
854 case IMGFMT_RGB32: dsc.pixelformat = DSPF_ARGB; break;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
855 case IMGFMT_BGR32: dsc.pixelformat = DSPF_ARGB; break;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
856 case IMGFMT_RGB24: dsc.pixelformat = DSPF_RGB24; break;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
857 case IMGFMT_BGR24: dsc.pixelformat = DSPF_RGB24; break;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
858 case IMGFMT_RGB16: dsc.pixelformat = DSPF_RGB16; break;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
859 case IMGFMT_BGR16: dsc.pixelformat = DSPF_RGB16; break;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
860 case IMGFMT_RGB15: dsc.pixelformat = DSPF_RGB15; break;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
861 case IMGFMT_BGR15: dsc.pixelformat = DSPF_RGB15; break;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
862 default: dsc.pixelformat = frame_format; break; // uknown or YUV -> retain layer format eg. RGB or YUY2
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
863 };
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
864
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
865
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
866 /*
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
867 * Create a surface based on the description of the source frame
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
868 */
6920
447ee5862f5d updates, using DIRECTFBVERSION and video EQ support by Jiri.Svoboda@seznam.cz
arpi
parents: 6717
diff changeset
869 #if DIRECTFBVERSION > 908
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
870 if (((dsc.pixelformat==DSPF_YV12)||(dsc.pixelformat==DSPF_I420)) && buggyYV12BitBlt) {
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
871 memcpyBitBlt = 1;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
872 } else {
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
873 memcpyBitBlt = 0;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
874 };
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
875 #else
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
876 memcpyBitBlt = 0;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
877 #endif
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
878
6717
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
879
5258
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
880 // release frame if it is already allocated
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
881 if (frameallocated) {
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
882 if (verbose ) printf("DirectFB: Release frame\n");
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
883 frame->Release (frame);
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
884 frameallocated=0;
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
885 };
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
886
6717
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
887 // picture size and position
5258
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
888
6717
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
889 aspect_save_orig(in_width,in_height);
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
890 aspect_save_prescale(d_width,d_height);
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
891 if (videolayeractive) {// try to set pos for YUY2 layer and proper aspect ratio
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
892 aspect_save_screenres(10000,10000);
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
893 aspect(&out_width,&out_height,A_ZOOM);
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
894
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
895 ret = videolayer->SetScreenLocation(videolayer,(1-(float)out_width/10000)/2,(1-(float)out_height/10000)/2,((float)out_width/10000),((float)out_height/10000));
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
896
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
897 xoffset = 0;
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
898 yoffset = 0;
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
899 } else {
6717
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
900 // aspect ratio correction for zoom to fullscreen
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
901 aspect_save_screenres(screen_width,screen_height);
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
902
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
903 if(fs) /* -fs */
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
904 aspect(&out_width,&out_height,A_ZOOM);
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
905 else
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
906 aspect(&out_width,&out_height,A_NOZOOM);
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
907
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
908
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
909 xoffset = (screen_width - out_width) / 2;
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
910 yoffset = (screen_height - out_height) / 2;
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
911 }
6717
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
912
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
913 if (((out_width != in_width) || (out_height != in_height)) && (!videolayeractive)) {stretch = 1;} else stretch=0; //yuy doesn't like strech and should not be needed
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
914
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
915 #ifdef FLIPPING
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
916 // frame will not be allocated in case of overlay or nonstrech blit on primary
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
917 if (flipping && (!stretch)) {
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
918 frame = primary;
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
919 frameallocated = 0;
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
920 if (verbose) printf("DirectFB: Frame is NOT used (flipping is active).\n");
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
921 } else {
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
922 #endif
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
923 /*
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
924 dsc.caps = DSCAPS_SYSTEMONLY;
6717
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
925 //let dfb decide where frame should be - preparation for AGP support
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
926 */
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
927 dsc.flags &=~DSDESC_CAPS;
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
928
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
929 DFBCHECK (dfb->CreateSurface( dfb, &dsc, &frame));
5258
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
930 frameallocated=1;
6717
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
931 #ifdef FLIPPING
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
932 if (verbose) if (flipping) {
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
933 printf("DirectFB: Frame created (flipping&stretch is active).\n");
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
934 } else {
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
935 printf("DirectFB: Frame created (flipping is NOT active).\n");
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
936 };
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
937 };
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
938 #endif
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
939
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
940 DFBCHECK (frame->GetPixelFormat (frame, &frame_format));
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
941
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
942 switch (frame_format) {
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
943 case DSPF_ARGB: if (verbose) printf("DirectFB: frame format ARGB\n");
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
944 frame_pixel_size = 4;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
945 break;
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
946 case DSPF_RGB32: if (verbose) printf("DirectFB: frame format RGB32\n");
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
947 frame_pixel_size = 4;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
948 break;
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
949 case DSPF_RGB24: if (verbose) printf("DirectFB: frame format RGB24\n");
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
950 frame_pixel_size = 3;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
951 break;
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
952 case DSPF_RGB16: if (verbose) printf("DirectFB: frame format RGB16\n");
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
953 frame_pixel_size = 2;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
954 break;
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
955 case DSPF_RGB15: if (verbose) printf("DirectFB: frame format RGB15\n");
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
956 frame_pixel_size = 2;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
957 break;
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
958 case DSPF_YUY2: if (verbose) printf("DirectFB: frame format YUY2\n");
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
959 frame_pixel_size = 2;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
960 break;
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
961 case DSPF_UYVY: if (verbose) printf("DirectFB: frame format UYVY\n");
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
962 frame_pixel_size = 2;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
963 break;
6920
447ee5862f5d updates, using DIRECTFBVERSION and video EQ support by Jiri.Svoboda@seznam.cz
arpi
parents: 6717
diff changeset
964 #if DIRECTFBVERSION > 908
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
965 case DSPF_YV12: if (verbose) printf("DirectFB: frame format YV12\n");
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
966 frame_pixel_size = 1;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
967 break;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
968 case DSPF_I420: if (verbose) printf("DirectFB: frame format I420\n");
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
969 frame_pixel_size = 1;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
970 break;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
971 #endif
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
972 default: printf("DirectFB: - unknown format ->exit\n"); return 1;
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
973 }
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
974
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
975 if ((out_width < in_width || out_height < in_height) && (!fs)) {
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
976 printf("Screensize is smaller than video size !\n");
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
977 // return 1; // doesn't matter we will rescale
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
978 }
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
979
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
980
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
981
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
982 // yuv2rgb transform init
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
983
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
984 if (((format == IMGFMT_YV12) || (format == IMGFMT_YUY2)) && (!videolayeractive)){ yuv2rgb_init(frame_pixel_size * 8,MODE_RGB);};
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
985
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
986 if ((verbose)&&(memcpyBitBlt)) printf("DirectFB: Using memcpyBitBlt\n");
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
987 #ifdef DIRECTRENDER
6717
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
988 //direct rendering is enabled in case of same buffer and img format
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
989 if ((format==IMGFMT_RGB32)&&(frame_format ==DSPF_ARGB) ||
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
990 (format==IMGFMT_BGR32)&&(frame_format ==DSPF_ARGB) ||
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
991 (format==IMGFMT_RGB24)&&(frame_format ==DSPF_RGB24) ||
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
992 (format==IMGFMT_BGR24)&&(frame_format ==DSPF_RGB24) ||
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
993 (format==IMGFMT_RGB16)&&(frame_format ==DSPF_RGB16) ||
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
994 (format==IMGFMT_BGR16)&&(frame_format ==DSPF_RGB16) ||
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
995 (format==IMGFMT_RGB15)&&(frame_format ==DSPF_RGB15) ||
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
996 (format==IMGFMT_BGR15)&&(frame_format ==DSPF_RGB15) ||
6920
447ee5862f5d updates, using DIRECTFBVERSION and video EQ support by Jiri.Svoboda@seznam.cz
arpi
parents: 6717
diff changeset
997 #if DIRECTFBVERSION > 908
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
998 (format==IMGFMT_YUY2)&&(frame_format ==DSPF_YUY2) ||
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
999 (format==IMGFMT_YV12)&&(frame_format ==DSPF_I420) ||
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1000 (format==IMGFMT_YV12)&&(frame_format ==DSPF_YV12)){
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1001 #else
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1002 (format==IMGFMT_YUY2)&&(frame_format ==DSPF_YUY2)){
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1003 #endif
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1004 dr_enabled=1;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1005 if (verbose) printf("DirectFB: Direct rendering supported\n");
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1006 } else {
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1007 dr_enabled=0;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1008 if (verbose) printf("DirectFB: Direct rendering not supported\n");
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1009 };
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1010 #endif
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1011
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1012
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1013 if (verbose) printf("DirectFB: Config finished [%ix%i]\n",out_width,out_height);
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1014
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1015 return 0;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1016 }
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1017
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1018 static uint32_t query_format(uint32_t format)
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1019 {
6211
a59795bd14d0 revised query_format
alex
parents: 5890
diff changeset
1020 int ret = VFCAP_CSP_SUPPORTED|VFCAP_OSD; /* osd/sub is supported on every bpp */
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1021
4359
266ebffd8fc9 no longer required to call preinit from init and query_format, mplayer.c does this
alex
parents: 4354
diff changeset
1022 // preinit(NULL);
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1023
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1024 if (verbose ) printf("DirectFB: Format query: %s\n",vo_format_name(format));
6717
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
1025
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
1026 switch (format) {
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
1027 // primary
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
1028 case IMGFMT_RGB32:
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
1029 case IMGFMT_BGR32:
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
1030 case IMGFMT_RGB24:
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
1031 case IMGFMT_BGR24:
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
1032 case IMGFMT_RGB16:
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
1033 case IMGFMT_BGR16:
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
1034 case IMGFMT_RGB15:
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
1035 case IMGFMT_BGR15: if (hwstretchblit) ret |=VFCAP_HWSCALE_UP|VFCAP_HWSCALE_DOWN;
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
1036 break;
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
1037 // overlay
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
1038 case IMGFMT_YUY2:
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
1039 case IMGFMT_YV12: if (videolayercaps.hwscale) ret |=VFCAP_HWSCALE_UP|VFCAP_HWSCALE_DOWN;
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
1040 break;
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
1041 }
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
1042
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
1043
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1044 switch (format) {
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1045
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1046 // RGB mode works only if color depth is same as on screen and this driver doesn't know before init
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1047 // so we couldn't report supported formats well
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1048
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1049 // Just support those detected by preinit
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1050 case IMGFMT_RGB32:
6211
a59795bd14d0 revised query_format
alex
parents: 5890
diff changeset
1051 case IMGFMT_BGR32: if (modes[3].valid) return ret;
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1052 break;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1053 case IMGFMT_RGB24:
6211
a59795bd14d0 revised query_format
alex
parents: 5890
diff changeset
1054 case IMGFMT_BGR24: if (modes[2].valid) return ret;
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1055 break;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1056 case IMGFMT_RGB16:
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1057 case IMGFMT_BGR16:
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1058 case IMGFMT_RGB15:
6211
a59795bd14d0 revised query_format
alex
parents: 5890
diff changeset
1059 case IMGFMT_BGR15: if (modes[1].valid) return ret;
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1060 break;
5258
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
1061 case IMGFMT_YUY2: if (videolayerpresent) {
6717
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
1062 if (videolayercaps.hwscale) ret |=VFCAP_HWSCALE_UP|VFCAP_HWSCALE_DOWN;
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1063 if (videolayercaps.yuy2) {
6211
a59795bd14d0 revised query_format
alex
parents: 5890
diff changeset
1064 return ret|VFCAP_CSP_SUPPORTED_BY_HW;
6717
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
1065 // disabled - MPlayer will do conversion automatically
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
1066 /* } else {
6211
a59795bd14d0 revised query_format
alex
parents: 5890
diff changeset
1067 return ret;
6717
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
1068 */ };
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1069 };
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1070 break;
5258
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
1071 case IMGFMT_YV12: if ((videolayerpresent) &&
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1072 (videolayercaps.i420 || videolayercaps.iv12))
6211
a59795bd14d0 revised query_format
alex
parents: 5890
diff changeset
1073 return ret|VFCAP_CSP_SUPPORTED_BY_HW;
6717
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
1074 // disabled - MPlayer will do conversion automatically
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
1075 /* else return ret;
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
1076 */ break;
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1077 }
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1078
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1079 return 0;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1080 }
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1081
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1082 static void draw_alpha(int x0, int y0, int w, int h, unsigned char *src,
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1083 unsigned char *srca, int stride)
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1084 {
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1085 void *dst;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1086 int pitch;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1087 int len;
6717
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
1088 static IDirectFBSurface *surface = NULL;
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
1089
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1090
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1091 #ifdef DIRECTRENDER
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1092 if(framelocked) {
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1093 frame->Unlock(frame);
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1094 framelocked=0;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1095 };
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1096 #endif
6717
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
1097 #ifdef FLIPPING
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
1098 if (flipping && stretch) {
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
1099 DFBCHECK (primary->Lock(primary,DSLF_WRITE,&dst,&pitch));
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
1100 } else {
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
1101 #endif
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1102 DFBCHECK (frame->Lock(frame,DSLF_WRITE,&dst,&pitch));
6717
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
1103 #ifdef FLIPPING
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
1104 }
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
1105 #endif
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1106 switch(frame_format) {
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1107 case DSPF_RGB32:
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1108 case DSPF_ARGB:
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1109 vo_draw_alpha_rgb32(w,h,src,srca,stride,((uint8_t *) dst)+pitch*y0 + frame_pixel_size*x0,pitch);
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1110 break;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1111
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1112 case DSPF_RGB24:
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1113 vo_draw_alpha_rgb24(w,h,src,srca,stride,((uint8_t *) dst)+pitch*y0 + frame_pixel_size*x0,pitch);
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1114 break;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1115
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1116 case DSPF_RGB16:
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1117 vo_draw_alpha_rgb16(w,h,src,srca,stride,((uint8_t *) dst)+pitch*y0 + frame_pixel_size*x0,pitch);
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1118 break;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1119
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1120 case DSPF_RGB15:
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1121 vo_draw_alpha_rgb15(w,h,src,srca,stride,((uint8_t *) dst)+pitch*y0 + frame_pixel_size*x0,pitch);
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1122 break;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1123
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1124 case DSPF_YUY2:
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1125 vo_draw_alpha_yuy2(w,h,src,srca,stride,((uint8_t *) dst) + pitch*y0 + frame_pixel_size*x0,pitch);
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1126 break;
3341
59390e321c4e -aspect ration correction
atmos4
parents: 3339
diff changeset
1127
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1128 case DSPF_UYVY:
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1129 vo_draw_alpha_yuy2(w,h,src,srca,stride,((uint8_t *) dst) + pitch*y0 + frame_pixel_size*x0 + 1,pitch);
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1130 break;
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1131
6920
447ee5862f5d updates, using DIRECTFBVERSION and video EQ support by Jiri.Svoboda@seznam.cz
arpi
parents: 6717
diff changeset
1132 #if DIRECTFBVERSION > 908
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1133 case DSPF_I420:
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1134 case DSPF_YV12:
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1135 vo_draw_alpha_yv12(w,h,src,srca,stride,((uint8_t *) dst) + pitch*y0 + frame_pixel_size*x0,pitch);
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1136 break;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1137 #endif
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1138 }
6717
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
1139 #ifdef FLIPPING
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
1140 if (flipping && stretch) {
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
1141 DFBCHECK (primary->Unlock(primary));
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
1142 } else {
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
1143 #endif
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1144 DFBCHECK (frame->Unlock(frame));
6717
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
1145 #ifdef FLIPPING
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
1146 }
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
1147 #endif
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1148 }
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1149
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1150 static uint32_t draw_frame(uint8_t *src[])
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1151 {
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1152 void *dst;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1153 int pitch;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1154 int len;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1155
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1156 // printf("Drawframe\n");
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1157 #ifdef DIRECTRENDER
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1158 if(framelocked) {
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1159 frame->Unlock(frame);
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1160 framelocked=0;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1161 };
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1162 #endif
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1163
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1164 DFBCHECK (frame->Lock(frame,DSLF_WRITE,&dst,&pitch));
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1165
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1166 switch (frame_format) {
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1167 case DSPF_ARGB:
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1168 case DSPF_RGB32:
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1169 case DSPF_RGB24:
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1170 case DSPF_RGB16:
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1171 case DSPF_RGB15: switch (pixel_format) {
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1172 case IMGFMT_YV12:
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1173 yuv2rgb(dst,src[0],src[1],src[2],in_width,in_height,pitch,in_width,in_width/2);
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1174 break;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1175 /* how to handle this? need conversion from YUY2 to RGB*/
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1176 /* case IMGFMT_YUY2:
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1177 yuv2rgb(dst,src[0],src[0]+1,src[0]+3,1,in_height*in_width/2,frame_pixel_size*2,4,4); //odd pixels
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1178 yuv2rgb(dst+1,src[0]+2,src[0]+1,src[0]+3,1,in_height*in_width/2,frame_pixel_size*2,4,4); //even pixels
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1179 break;*/
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1180 // RGB - just copy
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1181 default: if (source_pixel_size==frame_pixel_size) {
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1182 if (pitch==(in_width*frame_pixel_size)) {
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1183 memcpy(dst,src[0],in_width * in_height * source_pixel_size);
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1184 } else {
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1185 int i;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1186 int sp=in_width*source_pixel_size;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1187 int ll=min(sp,pitch);
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1188 for (i=0;i<in_height;i++) {
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1189 memcpy(dst+i*pitch,src[0]+i*sp,ll);
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1190 };
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1191 };
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1192 };
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1193 };
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1194 break;
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1195 case DSPF_YUY2:
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1196 switch (pixel_format) {
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1197 case IMGFMT_YV12: yv12toyuy2(src[0],src[1],src[2],dst,in_width,in_height,in_width,in_width >>1,pitch);
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1198 break;
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1199 case IMGFMT_YUY2: if (pitch==(in_width*2)) {
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1200 memcpy(dst,src[0],in_width * in_height * source_pixel_size);
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1201 } else {
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1202 int i;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1203 for (i=0;i<in_height;i++) {
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1204 memcpy(dst+i*pitch,src[0]+i*in_width*2,in_width*2);
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1205 }
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1206 }
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1207 break;
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1208 // hopefully there will be no RGB in this case otherwise convert - not implemented
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1209 };
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1210 break;
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1211
6920
447ee5862f5d updates, using DIRECTFBVERSION and video EQ support by Jiri.Svoboda@seznam.cz
arpi
parents: 6717
diff changeset
1212 #if DIRECTFBVERSION > 908
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1213 case DSPF_YV12:
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1214 switch (pixel_format) {
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1215 case IMGFMT_YV12: {
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1216 int i;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1217 int p=min(in_width,pitch);
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1218 for (i=0;i<in_height;i++) {
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1219 memcpy(dst+i*pitch,src[0]+i*in_width,p);
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1220 }
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1221 dst += pitch*in_height;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1222 p = p/2;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1223 for (i=0;i<in_height/2;i++) {
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1224 memcpy(dst+i*pitch/2,src[2]+i*in_width/2,p);
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1225 }
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1226 dst += pitch*in_height/4;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1227 for (i=0;i<in_height/2;i++) {
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1228 memcpy(dst+i*pitch/2,src[1]+i*in_width/2,p);
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1229 }
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1230 };
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1231 break;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1232 case IMGFMT_YUY2: yuy2toyv12(src[0],dst,dst+pitch*in_height+pitch*in_height/4,dst+pitch*in_height,in_width,in_height,pitch,pitch/2,pitch/2);
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1233 break;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1234 // hopefully there will be no RGB in this case otherwise convert - not implemented
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1235 }
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1236 break;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1237 case DSPF_I420:
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1238 switch (pixel_format) {
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1239 case IMGFMT_YV12: {
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1240 int i;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1241 int p=min(in_width,pitch);
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1242 for (i=0;i<in_height;i++) {
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1243 memcpy(dst+i*pitch,src[0]+i*in_width,p);
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1244 }
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1245 dst += pitch*in_height;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1246 p = p/2;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1247 for (i=0;i<in_height/2;i++) {
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1248 memcpy(dst+i*pitch/2,src[1]+i*in_width/2,p);
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1249 }
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1250 dst += pitch*in_height/4;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1251 for (i=0;i<in_height/2;i++) {
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1252 memcpy(dst+i*pitch/2,src[2]+i*in_width/2,p);
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1253 }
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1254 };
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1255 break;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1256 case IMGFMT_YUY2: yuy2toyv12(src[0],dst,dst+pitch*in_height,dst+pitch*in_height+pitch*in_height/4,in_width,in_height,pitch,pitch/2,pitch/2);
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1257 break;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1258 // hopefully there will be no RGB in this case otherwise convert - not implemented
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1259 }
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1260 break;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1261 #endif
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1262 }
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1263 DFBCHECK (frame->Unlock(frame));
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1264 return 0;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1265 }
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1266
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1267 static uint32_t draw_slice(uint8_t *src[], int stride[], int w, int h, int x, int y)
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1268 {
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1269
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1270 int err;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1271 void *dst;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1272 uint8_t *s;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1273 int pitch;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1274 int i;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1275
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1276 #ifdef DIRECTRENDER
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1277 if(framelocked) {
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1278 frame->Unlock(frame);
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1279 framelocked=0;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1280 };
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1281 #endif
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1282
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1283 err = frame->Lock(frame,DSLF_WRITE,&dst,&pitch);
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1284 // err = primary->Lock(primary,DSLF_WRITE,&dst,&pitch); // for direct rendering
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1285
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1286 // printf("Drawslice w=%i h=%i x=%i y=%i pitch=%i\n",w,h,x,y,pitch);
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1287
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1288 if (err) {
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1289 printf("DirectFB: Frame lock failed!");
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1290 return 1;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1291 };
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1292 switch (frame_format) {
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1293 case DSPF_ARGB:
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1294 case DSPF_RGB32:
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1295 case DSPF_RGB24:
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1296 case DSPF_RGB16:
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1297 case DSPF_RGB15:
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1298 switch (pixel_format) {
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1299 case IMGFMT_YV12:
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1300 yuv2rgb(dst+ y * pitch + frame_pixel_size*x ,src[0],src[1],src[2],w,h,pitch,stride[0],stride[1]);
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1301 break;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1302 default: if (source_pixel_size==frame_pixel_size) {
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1303 dst += x * frame_pixel_size;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1304 s = src[0];
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1305 for (i=y;i<(y+h);i++) {
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1306 memcpy(dst,s,w);
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1307 dst += (pitch);
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1308 s += stride[0];
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1309 };
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1310 }
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1311 break;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1312
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1313 }
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1314 break;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1315 case DSPF_YUY2:
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1316 switch (pixel_format) {
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1317 case IMGFMT_YV12: yv12toyuy2(src[0],src[1],src[2],dst + pitch*y + frame_pixel_size*x ,w,h,stride[0],stride[1],pitch);
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1318 break;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1319 // hopefully there will be no RGB in this case otherwise convert - not implemented
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1320 }
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1321 break;
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1322
6920
447ee5862f5d updates, using DIRECTFBVERSION and video EQ support by Jiri.Svoboda@seznam.cz
arpi
parents: 6717
diff changeset
1323 #if DIRECTFBVERSION > 908
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1324 case DSPF_YV12:
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1325 switch (pixel_format) {
5258
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
1326 case IMGFMT_YV12: {
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
1327 void *d,*s;
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1328 int i;
5258
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
1329 d = dst + pitch*y + x;
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
1330 s = src[0];
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
1331 for (i=0;i<h;i++) {
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
1332 memcpy(d,s,w);
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
1333 d+=pitch;
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
1334 s+=stride[0];
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1335 }
5258
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
1336 d = dst + pitch*in_height + pitch*y/4 + x/2;
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
1337 s = src[2];
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
1338 for (i=0;i<h/2;i++) {
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
1339 memcpy(d,s,w/2);
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
1340 d+=pitch/2;
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
1341 s+=stride[2];
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1342 }
5258
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
1343 d = dst + pitch*in_height + pitch*in_height/4 + pitch*y/4 + x/2;
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
1344 s = src[1];
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
1345 for (i=0;i<h/2;i++) {
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
1346 memcpy(d,s,w/2);
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
1347 d+=pitch/2;
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
1348 s+=stride[1];
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1349 }
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1350 };
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1351 break;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1352 /* case IMGFMT_YUY2: {
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1353 int i;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1354 for (i=y;i<(y+h);i++) {
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1355 yuy2toyv12(src[0]+i*stride[0],dst+i*pitch+x*frame_pixel_size,dst+pitch*(in_height+i/2)+x*frame_pixel_size/2,dst+pitch*(in_height+in_height/4+i/2)+x*frame_pixel_size/2,w,h,pitch,pitch/2,pitch/2);
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1356 }
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1357 }
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1358
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1359 break;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1360 */ // hopefully there will be no RGB in this case otherwise convert - not implemented
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1361 }
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1362 break;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1363
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1364 case DSPF_I420:
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1365 switch (pixel_format) {
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1366 case IMGFMT_YV12: {
5258
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
1367 void *d,*s;
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1368 int i;
5258
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
1369 d = dst + pitch*y + x;
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
1370 s = src[0];
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
1371 for (i=0;i<h;i++) {
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
1372 memcpy(d,s,w);
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
1373 d+=pitch;
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
1374 s+=stride[0];
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1375 }
5258
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
1376 d = dst + pitch*in_height + pitch*y/4 + x/2;
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
1377 s = src[1];
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
1378 for (i=0;i<h/2;i++) {
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
1379 memcpy(d,s,w/2);
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
1380 d+=pitch/2;
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
1381 s+=stride[1];
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1382 }
5258
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
1383 d = dst + pitch*in_height + pitch*in_height/4 + pitch*y/4 + x/2;
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
1384 s = src[2];
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
1385 for (i=0;i<h/2;i++) {
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
1386 memcpy(d,s,w/2);
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
1387 d+=pitch/2;
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
1388 s+=stride[2];
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1389 }
5258
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
1390 };
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1391 break;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1392 /* case IMGFMT_YUY2: {
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1393 int i;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1394 for (i=y;i<(y+h);i++) {
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1395 yuy2toyv12(src[0]+i*stride[0],dst+i*pitch+x*frame_pixel_size,dst+pitch*(in_height+in_height/4+i/2)+x*frame_pixel_size/2,dst+pitch*(in_height+i/2)+x*frame_pixel_size/2,w,h,pitch,pitch/2,pitch/2);
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1396 }
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1397 }
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1398
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1399 break;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1400 */ // hopefully there will be no RGB in this case otherwise convert - not implemented
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1401 }
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1402 break;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1403 #endif
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1404 };
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1405
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1406 frame->Unlock(frame);
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1407 // primary->Unlock(primary);
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1408
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1409 return 0;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1410 }
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1411
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1412 extern void mplayer_put_key(int code);
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1413
9380
edfe34c5405d linux->osdep
arpi
parents: 8148
diff changeset
1414 #include "../osdep/keycodes.h"
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1415
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1416 static void check_events(void)
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1417 {
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1418
6717
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
1419 if (buffer) {
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
1420
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1421 DFBInputEvent event;
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1422 //if (verbose) printf ("DirectFB: Check events entered\n");
6920
447ee5862f5d updates, using DIRECTFBVERSION and video EQ support by Jiri.Svoboda@seznam.cz
arpi
parents: 6717
diff changeset
1423 #if DIRECTFBVERSION > 909
6262
ae3cfbfc8e3f -updates vo_directfb (+configure&makefile) according to planned changes
arpi
parents: 6211
diff changeset
1424 if (buffer->GetEvent(buffer, DFB_EVENT (&event)) == DFB_OK) {
ae3cfbfc8e3f -updates vo_directfb (+configure&makefile) according to planned changes
arpi
parents: 6211
diff changeset
1425 #else
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1426 if (buffer->GetEvent(buffer, &event) == DFB_OK) {
6262
ae3cfbfc8e3f -updates vo_directfb (+configure&makefile) according to planned changes
arpi
parents: 6211
diff changeset
1427 #endif
3341
59390e321c4e -aspect ration correction
atmos4
parents: 3339
diff changeset
1428 if (event.type == DIET_KEYPRESS) {
6920
447ee5862f5d updates, using DIRECTFBVERSION and video EQ support by Jiri.Svoboda@seznam.cz
arpi
parents: 6717
diff changeset
1429 #if DIRECTFBVERSION > 910
6262
ae3cfbfc8e3f -updates vo_directfb (+configure&makefile) according to planned changes
arpi
parents: 6211
diff changeset
1430 switch (event.key_symbol) {
ae3cfbfc8e3f -updates vo_directfb (+configure&makefile) according to planned changes
arpi
parents: 6211
diff changeset
1431 case DIKS_ESCAPE:
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1432 mplayer_put_key('q');
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1433 break;
6262
ae3cfbfc8e3f -updates vo_directfb (+configure&makefile) according to planned changes
arpi
parents: 6211
diff changeset
1434 case DIKS_PAGE_UP: mplayer_put_key(KEY_PAGE_UP);break;
ae3cfbfc8e3f -updates vo_directfb (+configure&makefile) according to planned changes
arpi
parents: 6211
diff changeset
1435 case DIKS_PAGE_DOWN: mplayer_put_key(KEY_PAGE_DOWN);break;
ae3cfbfc8e3f -updates vo_directfb (+configure&makefile) according to planned changes
arpi
parents: 6211
diff changeset
1436 case DIKS_CURSOR_UP: mplayer_put_key(KEY_UP);break;
ae3cfbfc8e3f -updates vo_directfb (+configure&makefile) according to planned changes
arpi
parents: 6211
diff changeset
1437 case DIKS_CURSOR_DOWN: mplayer_put_key(KEY_DOWN);break;
ae3cfbfc8e3f -updates vo_directfb (+configure&makefile) according to planned changes
arpi
parents: 6211
diff changeset
1438 case DIKS_CURSOR_LEFT: mplayer_put_key(KEY_LEFT);break;
ae3cfbfc8e3f -updates vo_directfb (+configure&makefile) according to planned changes
arpi
parents: 6211
diff changeset
1439 case DIKS_CURSOR_RIGHT: mplayer_put_key(KEY_RIGHT);break;
ae3cfbfc8e3f -updates vo_directfb (+configure&makefile) according to planned changes
arpi
parents: 6211
diff changeset
1440 case DIKS_INSERT: mplayer_put_key(KEY_INSERT);break;
ae3cfbfc8e3f -updates vo_directfb (+configure&makefile) according to planned changes
arpi
parents: 6211
diff changeset
1441 case DIKS_DELETE: mplayer_put_key(KEY_DELETE);break;
ae3cfbfc8e3f -updates vo_directfb (+configure&makefile) according to planned changes
arpi
parents: 6211
diff changeset
1442 case DIKS_HOME: mplayer_put_key(KEY_HOME);break;
ae3cfbfc8e3f -updates vo_directfb (+configure&makefile) according to planned changes
arpi
parents: 6211
diff changeset
1443 case DIKS_END: mplayer_put_key(KEY_END);break;
ae3cfbfc8e3f -updates vo_directfb (+configure&makefile) according to planned changes
arpi
parents: 6211
diff changeset
1444
ae3cfbfc8e3f -updates vo_directfb (+configure&makefile) according to planned changes
arpi
parents: 6211
diff changeset
1445 default:mplayer_put_key(event.key_symbol);
ae3cfbfc8e3f -updates vo_directfb (+configure&makefile) according to planned changes
arpi
parents: 6211
diff changeset
1446 };
ae3cfbfc8e3f -updates vo_directfb (+configure&makefile) according to planned changes
arpi
parents: 6211
diff changeset
1447 #else /* DirectFB < 0.9.11 */
ae3cfbfc8e3f -updates vo_directfb (+configure&makefile) according to planned changes
arpi
parents: 6211
diff changeset
1448 switch (event.keycode) {
ae3cfbfc8e3f -updates vo_directfb (+configure&makefile) according to planned changes
arpi
parents: 6211
diff changeset
1449 case DIKC_ESCAPE: mplayer_put_key('q');break;
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1450 case DIKC_KP_PLUS: mplayer_put_key('+');break;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1451 case DIKC_KP_MINUS: mplayer_put_key('-');break;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1452 case DIKC_TAB: mplayer_put_key('\t');break;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1453 case DIKC_PAGEUP: mplayer_put_key(KEY_PAGE_UP);break;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1454 case DIKC_PAGEDOWN: mplayer_put_key(KEY_PAGE_DOWN);break;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1455 case DIKC_UP: mplayer_put_key(KEY_UP);break;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1456 case DIKC_DOWN: mplayer_put_key(KEY_DOWN);break;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1457 case DIKC_LEFT: mplayer_put_key(KEY_LEFT);break;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1458 case DIKC_RIGHT: mplayer_put_key(KEY_RIGHT);break;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1459 case DIKC_ASTERISK:
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1460 case DIKC_KP_MULT:mplayer_put_key('*');break;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1461 case DIKC_KP_DIV: mplayer_put_key('/');break;
3341
59390e321c4e -aspect ration correction
atmos4
parents: 3339
diff changeset
1462 case DIKC_INSERT: mplayer_put_key(KEY_INSERT);break;
59390e321c4e -aspect ration correction
atmos4
parents: 3339
diff changeset
1463 case DIKC_DELETE: mplayer_put_key(KEY_DELETE);break;
59390e321c4e -aspect ration correction
atmos4
parents: 3339
diff changeset
1464 case DIKC_HOME: mplayer_put_key(KEY_HOME);break;
59390e321c4e -aspect ration correction
atmos4
parents: 3339
diff changeset
1465 case DIKC_END: mplayer_put_key(KEY_END);break;
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1466
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1467 default:mplayer_put_key(event.key_ascii);
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1468 };
6262
ae3cfbfc8e3f -updates vo_directfb (+configure&makefile) according to planned changes
arpi
parents: 6211
diff changeset
1469 #endif
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1470 };
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1471 };
6717
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
1472 }
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1473 // empty buffer, because of repeating (keyboard repeat is faster than key handling
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1474 // and this causes problems during seek)
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1475 // temporary workabout should be solved in the future
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1476
6717
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
1477 if (buffer) buffer->Reset(buffer);
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1478 //if (verbose) printf ("DirectFB: Check events finished\n");
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1479
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1480 }
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1481
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1482 static void draw_osd(void)
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1483 {
6717
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
1484 // if flipping is active we will draw directly to primary
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
1485 // we will also blit from frame to primary if necessary
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
1486 #ifdef FLIPPING
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
1487 if (stretch && flipping) {
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
1488 DFBRectangle rect;
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
1489 rect.x=xoffset;
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
1490 rect.y=yoffset;
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
1491 rect.w=out_width;
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
1492 rect.h=out_height;
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
1493 #ifdef DIRECTRENDER
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
1494 if(framelocked) {
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
1495 frame->Unlock(frame);
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
1496 framelocked=0;
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
1497 };
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
1498 #endif
11000
6e35326c742f many small typo and grammar fixes
gabucino
parents: 10618
diff changeset
1499 // let's clear blackborders
6717
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
1500 primary->SetColor(primary,0,0,0,0);
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
1501 // top
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
1502 primary->FillRectangle(primary,0,0,screen_width,yoffset);
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
1503 // bottom
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
1504 primary->FillRectangle(primary,0,screen_height-yoffset,screen_width,yoffset);
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
1505 //left
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
1506 // primary->FillRectangle(primary,0,yoffset,xoffset,screen_height-2*yoffset);
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
1507 //right
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
1508 // primary->FillRectangle(primary,screen_width-xoffset-1,yoffset,xoffset,screen_height-2*yoffset);
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
1509
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
1510 DFBCHECK (primary->StretchBlit(primary,frame,NULL,&rect));
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
1511 blitperformed=1;
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
1512 vo_draw_text(screen_width, screen_height, draw_alpha);
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
1513 } else {
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
1514 #endif
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1515 vo_draw_text(in_width, in_height, draw_alpha);
6717
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
1516 #ifdef FLIPPING
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
1517 }
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
1518 #endif
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1519 }
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1520
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1521 static void flip_page(void)
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1522 {
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1523 DFBSurfaceBlittingFlags flags=DSBLIT_NOFX;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1524
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1525 // if (verbose) printf("DirectFB: Flip page entered");
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1526
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1527 DFBCHECK (primary->SetBlittingFlags(primary,flags));
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1528
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1529 #ifdef DIRECTRENDER
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1530 if(framelocked) {
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1531 frame->Unlock(frame);
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1532 framelocked=0;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1533 };
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1534 #endif
6717
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
1535 if (stretch
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
1536 #ifdef FLIPPING
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
1537 && (!blitperformed)
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
1538 #endif
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
1539 ) {
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1540 DFBRectangle rect;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1541 rect.x=xoffset;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1542 rect.y=yoffset;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1543 rect.w=out_width;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1544 rect.h=out_height;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1545
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1546 DFBCHECK (primary->StretchBlit(primary,frame,NULL,&rect));
6717
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
1547 #ifdef FLIPPING
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
1548 blitperformed=0;
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
1549 #endif
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1550 }
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1551 else {
6717
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
1552 #ifdef FLIPPING
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
1553 if (!flipping) {
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
1554 #endif
6920
447ee5862f5d updates, using DIRECTFBVERSION and video EQ support by Jiri.Svoboda@seznam.cz
arpi
parents: 6717
diff changeset
1555 #if DIRECTFBVERSION > 908
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1556 if (!memcpyBitBlt) {
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1557 #endif
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1558 DFBCHECK (primary->Blit(primary,frame,NULL,xoffset,yoffset));
6920
447ee5862f5d updates, using DIRECTFBVERSION and video EQ support by Jiri.Svoboda@seznam.cz
arpi
parents: 6717
diff changeset
1559 #if DIRECTFBVERSION > 908
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1560 } else {
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1561
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1562 int err,err2;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1563 void *dst,*src;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1564 int pitch,pitch2;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1565
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1566 // printf("MemcpyBlit");
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1567
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1568 err = frame->Lock(frame,DSLF_READ,&src,&pitch);
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1569 err2 = primary->Lock(primary,DSLF_WRITE,&dst,&pitch2);
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1570
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1571 // printf("DirectFB: pitch=%i pitch2=%i\n",pitch,pitch2);
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1572
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1573
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1574 if (pitch==pitch2) {
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1575 memcpy(dst,src,in_height * pitch * 1.5);
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1576 } else
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1577 {
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1578 int i;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1579 int p=min(pitch,pitch2);
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1580 for (i=0;i<in_height;i++) {
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1581 memcpy (dst+i*pitch2,src+i*pitch,p);
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1582 };
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1583 dst+= in_height * pitch2;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1584 src+= in_height * pitch;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1585 p=p/2;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1586 for (i=0;i<in_height/2;i++) {
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1587 memcpy (dst+i*pitch2/2,src+i*pitch/2,p);
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1588 };
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1589 dst+= in_height * pitch2/4;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1590 src+= in_height * pitch/4;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1591 for (i=0;i<in_height/2;i++) {
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1592 memcpy (dst+i*pitch2/2,src+i*pitch/2,p);
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1593 };
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1594 }
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1595 frame->Unlock(frame);
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1596 primary->Unlock(primary);
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1597 };
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1598 #endif
6717
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
1599 #ifdef FLIPPING
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1600 };
6717
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
1601 #endif
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
1602 };
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
1603 #ifdef FLIPPING
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
1604 if (flipping) {
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
1605 if (videolayeractive && wait_vsync_after_flip) {
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
1606 DFBCHECK (primary->Flip (primary, NULL, /*DSFLIP_WAITFORSYNC*/0));
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
1607 /* workabout for videolayer
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
1608 flip will take place on next vsync, but pointers are updated instanlty ->
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
1609 -> decoding goes into "new" buffer which is still displayed ->
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
1610 -> so wait for vsync to be safe (and have surfaces REALLY flipped)
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
1611 */
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
1612 dfb->WaitForSync(dfb);
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
1613 } else {
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
1614 DFBCHECK (primary->Flip (primary, NULL, DSFLIP_WAITFORSYNC));
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
1615 };
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
1616 };
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
1617 #endif
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1618 }
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1619
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1620 static void uninit(void)
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1621 {
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1622 if (verbose ) printf("DirectFB: uninit entered\n");
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1623 /*
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1624 * (Release)
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1625 */
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1626 if (verbose ) printf("DirectFB: Release buffer\n");
6717
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
1627 if (buffer) buffer->Release (buffer);
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1628 if (verbose ) printf("DirectFB: Release keyboard\n");
6717
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
1629 if (keyboard) keyboard->Release (keyboard);
5258
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
1630 if (frameallocated) {
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
1631 if (verbose ) printf("DirectFB: Release frame\n");
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
1632 frame->Release (frame);
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
1633 frameallocated=0;
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
1634 };
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
1635
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1636 // we will not release dfb and layer because there could be a new film
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1637
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1638 if (verbose ) printf("DirectFB: Release primary\n");
3588
8e56fe18e7fb Applied patch by Jiri Svoboda <Jiri.Svoboda@seznam.cz>:
pl
parents: 3341
diff changeset
1639 primary->Release (primary);
8e56fe18e7fb Applied patch by Jiri Svoboda <Jiri.Svoboda@seznam.cz>:
pl
parents: 3341
diff changeset
1640 // switch off BES
8e56fe18e7fb Applied patch by Jiri Svoboda <Jiri.Svoboda@seznam.cz>:
pl
parents: 3341
diff changeset
1641 if (videolayer) videolayer->SetOpacity(videolayer,0);
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1642
6920
447ee5862f5d updates, using DIRECTFBVERSION and video EQ support by Jiri.Svoboda@seznam.cz
arpi
parents: 6717
diff changeset
1643 #if DIRECTFBVERSION > 908
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1644 if (verbose&&videolayer ) printf("DirectFB: Release videolayer\n");
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1645 if (videolayer) videolayer->Release(videolayer);
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1646
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1647 if (verbose ) printf("DirectFB: Release DirectFB library\n");
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1648 dfb->Release (dfb);
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1649 #endif
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1650
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1651 if (verbose ) printf("DirectFB: Uninit done.\n");
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1652 }
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1653
6920
447ee5862f5d updates, using DIRECTFBVERSION and video EQ support by Jiri.Svoboda@seznam.cz
arpi
parents: 6717
diff changeset
1654 static uint32_t directfb_set_video_eq(char *data, int value) //data==name
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1655 {
6920
447ee5862f5d updates, using DIRECTFBVERSION and video EQ support by Jiri.Svoboda@seznam.cz
arpi
parents: 6717
diff changeset
1656
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1657 DFBColorAdjustment ca;
6920
447ee5862f5d updates, using DIRECTFBVERSION and video EQ support by Jiri.Svoboda@seznam.cz
arpi
parents: 6717
diff changeset
1658 float factor = (float)0xffff / 200.0;
447ee5862f5d updates, using DIRECTFBVERSION and video EQ support by Jiri.Svoboda@seznam.cz
arpi
parents: 6717
diff changeset
1659 DFBDisplayLayerCapabilities caps;
447ee5862f5d updates, using DIRECTFBVERSION and video EQ support by Jiri.Svoboda@seznam.cz
arpi
parents: 6717
diff changeset
1660
447ee5862f5d updates, using DIRECTFBVERSION and video EQ support by Jiri.Svoboda@seznam.cz
arpi
parents: 6717
diff changeset
1661 if (videolayer) {
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1662
6920
447ee5862f5d updates, using DIRECTFBVERSION and video EQ support by Jiri.Svoboda@seznam.cz
arpi
parents: 6717
diff changeset
1663 #if DIRECTFBVERSION > 912
447ee5862f5d updates, using DIRECTFBVERSION and video EQ support by Jiri.Svoboda@seznam.cz
arpi
parents: 6717
diff changeset
1664 DFBDisplayLayerDescription desc;
447ee5862f5d updates, using DIRECTFBVERSION and video EQ support by Jiri.Svoboda@seznam.cz
arpi
parents: 6717
diff changeset
1665 videolayer->GetDescription(videolayer,&desc);
447ee5862f5d updates, using DIRECTFBVERSION and video EQ support by Jiri.Svoboda@seznam.cz
arpi
parents: 6717
diff changeset
1666 caps = desc.caps;
447ee5862f5d updates, using DIRECTFBVERSION and video EQ support by Jiri.Svoboda@seznam.cz
arpi
parents: 6717
diff changeset
1667 #else
447ee5862f5d updates, using DIRECTFBVERSION and video EQ support by Jiri.Svoboda@seznam.cz
arpi
parents: 6717
diff changeset
1668 videolayer->GetCapabilities(videolayer,&caps);
447ee5862f5d updates, using DIRECTFBVERSION and video EQ support by Jiri.Svoboda@seznam.cz
arpi
parents: 6717
diff changeset
1669 #endif
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1670 ca.flags=DCAF_NONE;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1671
6920
447ee5862f5d updates, using DIRECTFBVERSION and video EQ support by Jiri.Svoboda@seznam.cz
arpi
parents: 6717
diff changeset
1672 if (! strcmp( data,"brightness" )) {
447ee5862f5d updates, using DIRECTFBVERSION and video EQ support by Jiri.Svoboda@seznam.cz
arpi
parents: 6717
diff changeset
1673 if (caps & DLCAPS_BRIGHTNESS) {
447ee5862f5d updates, using DIRECTFBVERSION and video EQ support by Jiri.Svoboda@seznam.cz
arpi
parents: 6717
diff changeset
1674 ca.brightness = value * factor +0x8000;
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1675 ca.flags |= DCAF_BRIGHTNESS;
6920
447ee5862f5d updates, using DIRECTFBVERSION and video EQ support by Jiri.Svoboda@seznam.cz
arpi
parents: 6717
diff changeset
1676 if (verbose) printf("DirectFB: SetVEq Brightness 0x%X %i\n",ca.brightness,value);
447ee5862f5d updates, using DIRECTFBVERSION and video EQ support by Jiri.Svoboda@seznam.cz
arpi
parents: 6717
diff changeset
1677 } else return VO_FALSE;
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1678 }
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1679
6920
447ee5862f5d updates, using DIRECTFBVERSION and video EQ support by Jiri.Svoboda@seznam.cz
arpi
parents: 6717
diff changeset
1680 if (! strcmp( data,"contrast" )) {
447ee5862f5d updates, using DIRECTFBVERSION and video EQ support by Jiri.Svoboda@seznam.cz
arpi
parents: 6717
diff changeset
1681 if ((caps & DLCAPS_CONTRAST)) {
447ee5862f5d updates, using DIRECTFBVERSION and video EQ support by Jiri.Svoboda@seznam.cz
arpi
parents: 6717
diff changeset
1682 ca.contrast = value * factor + 0x8000;
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1683 ca.flags |= DCAF_CONTRAST;
6920
447ee5862f5d updates, using DIRECTFBVERSION and video EQ support by Jiri.Svoboda@seznam.cz
arpi
parents: 6717
diff changeset
1684 if (verbose) printf("DirectFB: SetVEq Contrast 0x%X %i\n",ca.contrast,value);
447ee5862f5d updates, using DIRECTFBVERSION and video EQ support by Jiri.Svoboda@seznam.cz
arpi
parents: 6717
diff changeset
1685 } else return VO_FALSE;
447ee5862f5d updates, using DIRECTFBVERSION and video EQ support by Jiri.Svoboda@seznam.cz
arpi
parents: 6717
diff changeset
1686 }
447ee5862f5d updates, using DIRECTFBVERSION and video EQ support by Jiri.Svoboda@seznam.cz
arpi
parents: 6717
diff changeset
1687
447ee5862f5d updates, using DIRECTFBVERSION and video EQ support by Jiri.Svoboda@seznam.cz
arpi
parents: 6717
diff changeset
1688 if (! strcmp( data,"hue" )) {
447ee5862f5d updates, using DIRECTFBVERSION and video EQ support by Jiri.Svoboda@seznam.cz
arpi
parents: 6717
diff changeset
1689 if ((caps & DLCAPS_HUE)) {
447ee5862f5d updates, using DIRECTFBVERSION and video EQ support by Jiri.Svoboda@seznam.cz
arpi
parents: 6717
diff changeset
1690 ca.hue = value * factor + 0x8000;
447ee5862f5d updates, using DIRECTFBVERSION and video EQ support by Jiri.Svoboda@seznam.cz
arpi
parents: 6717
diff changeset
1691 ca.flags |= DCAF_HUE;
447ee5862f5d updates, using DIRECTFBVERSION and video EQ support by Jiri.Svoboda@seznam.cz
arpi
parents: 6717
diff changeset
1692 if (verbose) printf("DirectFB: SetVEq Hue 0x%X %i\n",ca.hue,value);
447ee5862f5d updates, using DIRECTFBVERSION and video EQ support by Jiri.Svoboda@seznam.cz
arpi
parents: 6717
diff changeset
1693 } else return VO_FALSE;
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1694 }
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1695
6920
447ee5862f5d updates, using DIRECTFBVERSION and video EQ support by Jiri.Svoboda@seznam.cz
arpi
parents: 6717
diff changeset
1696 if (! strcmp( data,"saturation" )) {
447ee5862f5d updates, using DIRECTFBVERSION and video EQ support by Jiri.Svoboda@seznam.cz
arpi
parents: 6717
diff changeset
1697 if ((caps & DLCAPS_SATURATION)) {
447ee5862f5d updates, using DIRECTFBVERSION and video EQ support by Jiri.Svoboda@seznam.cz
arpi
parents: 6717
diff changeset
1698 ca.saturation = value * factor + 0x8000;
447ee5862f5d updates, using DIRECTFBVERSION and video EQ support by Jiri.Svoboda@seznam.cz
arpi
parents: 6717
diff changeset
1699 ca.flags |= DCAF_SATURATION;
447ee5862f5d updates, using DIRECTFBVERSION and video EQ support by Jiri.Svoboda@seznam.cz
arpi
parents: 6717
diff changeset
1700 if (verbose) printf("DirectFB: SetVEq Saturation 0x%X %i\n",ca.saturation,value);
447ee5862f5d updates, using DIRECTFBVERSION and video EQ support by Jiri.Svoboda@seznam.cz
arpi
parents: 6717
diff changeset
1701 } else return VO_FALSE;
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1702 }
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1703
6920
447ee5862f5d updates, using DIRECTFBVERSION and video EQ support by Jiri.Svoboda@seznam.cz
arpi
parents: 6717
diff changeset
1704 if (ca.flags != DCAF_NONE) {
447ee5862f5d updates, using DIRECTFBVERSION and video EQ support by Jiri.Svoboda@seznam.cz
arpi
parents: 6717
diff changeset
1705 videolayer->SetColorAdjustment(videolayer,&ca);
447ee5862f5d updates, using DIRECTFBVERSION and video EQ support by Jiri.Svoboda@seznam.cz
arpi
parents: 6717
diff changeset
1706 return VO_TRUE;
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1707 }
6920
447ee5862f5d updates, using DIRECTFBVERSION and video EQ support by Jiri.Svoboda@seznam.cz
arpi
parents: 6717
diff changeset
1708 }
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1709
6920
447ee5862f5d updates, using DIRECTFBVERSION and video EQ support by Jiri.Svoboda@seznam.cz
arpi
parents: 6717
diff changeset
1710 return VO_FALSE;
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1711
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1712 }
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1713
6920
447ee5862f5d updates, using DIRECTFBVERSION and video EQ support by Jiri.Svoboda@seznam.cz
arpi
parents: 6717
diff changeset
1714 static uint32_t directfb_get_video_eq(char *data, int *value) // data==name
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1715 {
6920
447ee5862f5d updates, using DIRECTFBVERSION and video EQ support by Jiri.Svoboda@seznam.cz
arpi
parents: 6717
diff changeset
1716
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1717 DFBColorAdjustment ca;
6920
447ee5862f5d updates, using DIRECTFBVERSION and video EQ support by Jiri.Svoboda@seznam.cz
arpi
parents: 6717
diff changeset
1718 float factor = 200.0 / (float)0xffff;
447ee5862f5d updates, using DIRECTFBVERSION and video EQ support by Jiri.Svoboda@seznam.cz
arpi
parents: 6717
diff changeset
1719 DFBDisplayLayerCapabilities caps;
447ee5862f5d updates, using DIRECTFBVERSION and video EQ support by Jiri.Svoboda@seznam.cz
arpi
parents: 6717
diff changeset
1720
447ee5862f5d updates, using DIRECTFBVERSION and video EQ support by Jiri.Svoboda@seznam.cz
arpi
parents: 6717
diff changeset
1721 if (videolayer) {
447ee5862f5d updates, using DIRECTFBVERSION and video EQ support by Jiri.Svoboda@seznam.cz
arpi
parents: 6717
diff changeset
1722 #if DIRECTFBVERSION > 912
447ee5862f5d updates, using DIRECTFBVERSION and video EQ support by Jiri.Svoboda@seznam.cz
arpi
parents: 6717
diff changeset
1723 DFBDisplayLayerDescription desc;
447ee5862f5d updates, using DIRECTFBVERSION and video EQ support by Jiri.Svoboda@seznam.cz
arpi
parents: 6717
diff changeset
1724 videolayer->GetDescription(videolayer,&desc);
447ee5862f5d updates, using DIRECTFBVERSION and video EQ support by Jiri.Svoboda@seznam.cz
arpi
parents: 6717
diff changeset
1725 caps = desc.caps;
447ee5862f5d updates, using DIRECTFBVERSION and video EQ support by Jiri.Svoboda@seznam.cz
arpi
parents: 6717
diff changeset
1726 #else
447ee5862f5d updates, using DIRECTFBVERSION and video EQ support by Jiri.Svoboda@seznam.cz
arpi
parents: 6717
diff changeset
1727 videolayer->GetCapabilities(videolayer,&caps);
447ee5862f5d updates, using DIRECTFBVERSION and video EQ support by Jiri.Svoboda@seznam.cz
arpi
parents: 6717
diff changeset
1728 #endif
447ee5862f5d updates, using DIRECTFBVERSION and video EQ support by Jiri.Svoboda@seznam.cz
arpi
parents: 6717
diff changeset
1729
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1730 videolayer->GetColorAdjustment(videolayer,&ca);
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1731
6920
447ee5862f5d updates, using DIRECTFBVERSION and video EQ support by Jiri.Svoboda@seznam.cz
arpi
parents: 6717
diff changeset
1732 if (! strcmp( data,"brightness" )) {
447ee5862f5d updates, using DIRECTFBVERSION and video EQ support by Jiri.Svoboda@seznam.cz
arpi
parents: 6717
diff changeset
1733 if (caps & DLCAPS_BRIGHTNESS) {
447ee5862f5d updates, using DIRECTFBVERSION and video EQ support by Jiri.Svoboda@seznam.cz
arpi
parents: 6717
diff changeset
1734 *value = (int) ((ca.brightness-0x8000) * factor);
447ee5862f5d updates, using DIRECTFBVERSION and video EQ support by Jiri.Svoboda@seznam.cz
arpi
parents: 6717
diff changeset
1735 if (verbose) printf("DirectFB: GetVEq Brightness 0x%X %i\n",ca.brightness,*value);
447ee5862f5d updates, using DIRECTFBVERSION and video EQ support by Jiri.Svoboda@seznam.cz
arpi
parents: 6717
diff changeset
1736 return VO_TRUE;
447ee5862f5d updates, using DIRECTFBVERSION and video EQ support by Jiri.Svoboda@seznam.cz
arpi
parents: 6717
diff changeset
1737 } else return VO_FALSE;
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1738 }
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1739
6920
447ee5862f5d updates, using DIRECTFBVERSION and video EQ support by Jiri.Svoboda@seznam.cz
arpi
parents: 6717
diff changeset
1740 if (! strcmp( data,"contrast" )) {
447ee5862f5d updates, using DIRECTFBVERSION and video EQ support by Jiri.Svoboda@seznam.cz
arpi
parents: 6717
diff changeset
1741 if ((caps & DLCAPS_CONTRAST)) {
447ee5862f5d updates, using DIRECTFBVERSION and video EQ support by Jiri.Svoboda@seznam.cz
arpi
parents: 6717
diff changeset
1742 *value = (int) ((ca.contrast-0x8000) * factor);
447ee5862f5d updates, using DIRECTFBVERSION and video EQ support by Jiri.Svoboda@seznam.cz
arpi
parents: 6717
diff changeset
1743 if (verbose) printf("DirectFB: GetVEq Contrast 0x%X %i\n",ca.contrast,*value);
447ee5862f5d updates, using DIRECTFBVERSION and video EQ support by Jiri.Svoboda@seznam.cz
arpi
parents: 6717
diff changeset
1744 return VO_TRUE;
447ee5862f5d updates, using DIRECTFBVERSION and video EQ support by Jiri.Svoboda@seznam.cz
arpi
parents: 6717
diff changeset
1745 } else return VO_FALSE;
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1746 }
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1747
6920
447ee5862f5d updates, using DIRECTFBVERSION and video EQ support by Jiri.Svoboda@seznam.cz
arpi
parents: 6717
diff changeset
1748 if (! strcmp( data,"hue" )) {
447ee5862f5d updates, using DIRECTFBVERSION and video EQ support by Jiri.Svoboda@seznam.cz
arpi
parents: 6717
diff changeset
1749 if ((caps & DLCAPS_HUE)) {
447ee5862f5d updates, using DIRECTFBVERSION and video EQ support by Jiri.Svoboda@seznam.cz
arpi
parents: 6717
diff changeset
1750 *value = (int) ((ca.hue-0x8000) * factor);
447ee5862f5d updates, using DIRECTFBVERSION and video EQ support by Jiri.Svoboda@seznam.cz
arpi
parents: 6717
diff changeset
1751 if (verbose) printf("DirectFB: GetVEq Hue 0x%X %i\n",ca.hue,*value);
447ee5862f5d updates, using DIRECTFBVERSION and video EQ support by Jiri.Svoboda@seznam.cz
arpi
parents: 6717
diff changeset
1752 return VO_TRUE;
447ee5862f5d updates, using DIRECTFBVERSION and video EQ support by Jiri.Svoboda@seznam.cz
arpi
parents: 6717
diff changeset
1753 } else return VO_FALSE;
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1754 }
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1755
6920
447ee5862f5d updates, using DIRECTFBVERSION and video EQ support by Jiri.Svoboda@seznam.cz
arpi
parents: 6717
diff changeset
1756 if (! strcmp( data,"saturation" )) {
447ee5862f5d updates, using DIRECTFBVERSION and video EQ support by Jiri.Svoboda@seznam.cz
arpi
parents: 6717
diff changeset
1757 if ((caps & DLCAPS_SATURATION)) {
447ee5862f5d updates, using DIRECTFBVERSION and video EQ support by Jiri.Svoboda@seznam.cz
arpi
parents: 6717
diff changeset
1758 *value = (int) ((ca.saturation-0x8000) * factor);
447ee5862f5d updates, using DIRECTFBVERSION and video EQ support by Jiri.Svoboda@seznam.cz
arpi
parents: 6717
diff changeset
1759 if (verbose) printf("DirectFB: GetVEq Saturation 0x%X %i\n",ca.saturation,*value);
447ee5862f5d updates, using DIRECTFBVERSION and video EQ support by Jiri.Svoboda@seznam.cz
arpi
parents: 6717
diff changeset
1760 return VO_TRUE;
447ee5862f5d updates, using DIRECTFBVERSION and video EQ support by Jiri.Svoboda@seznam.cz
arpi
parents: 6717
diff changeset
1761 } else return VO_FALSE;
447ee5862f5d updates, using DIRECTFBVERSION and video EQ support by Jiri.Svoboda@seznam.cz
arpi
parents: 6717
diff changeset
1762 }
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1763 }
6920
447ee5862f5d updates, using DIRECTFBVERSION and video EQ support by Jiri.Svoboda@seznam.cz
arpi
parents: 6717
diff changeset
1764 return VO_FALSE;
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1765 }
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1766
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1767 #ifdef DIRECTRENDER
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1768 static uint32_t get_image(mp_image_t *mpi){
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1769 int err;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1770 void *dst;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1771 int pitch;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1772
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1773 // printf("DirectFB: get_image() called\n");
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1774
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1775 // now we are always in system memory (in this version - mybe will change in future)
6717
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
1776 #ifdef FLIPPING
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
1777 if((mpi->flags&MP_IMGFLAG_READABLE) && invram) return VO_FALSE; // slow video ram
9d34c286f0ba Patch by Jiri Svoboda:
atmos4
parents: 6262
diff changeset
1778 #endif
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1779 // printf("width=%d vs. pitch=%d, flags=0x%X \n",mpi->width,pitch,mpi->flags);
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1780 if((mpi->width==pitch/frame_pixel_size) ||
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1781 (mpi->flags&(MP_IMGFLAG_ACCEPT_STRIDE|MP_IMGFLAG_ACCEPT_WIDTH))){
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1782 // we're lucky or codec accepts stride => ok, let's go!
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1783 if(mpi->flags&MP_IMGFLAG_PLANAR){
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1784
6920
447ee5862f5d updates, using DIRECTFBVERSION and video EQ support by Jiri.Svoboda@seznam.cz
arpi
parents: 6717
diff changeset
1785 #if DIRECTFBVERSION > 908
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1786 err = frame->Lock(frame,DSLF_WRITE/*|DSLF_READ*/,&dst,&pitch);
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1787 // err = primary->Lock(primary,DSLF_WRITE,&dst,&pitch); // for real direct rendering
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1788
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1789 if (err) {
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1790 printf("DirectFB: Frame lock failed!");
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1791 return VO_FALSE;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1792 };
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1793 framelocked=1;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1794
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1795 //YV12 format
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1796 mpi->planes[0]=dst;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1797 switch(frame_format) {
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1798 case DSPF_I420: mpi->planes[1]=dst + pitch*in_height;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1799 mpi->planes[2]=mpi->planes[1] + pitch*in_height/4;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1800 break;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1801 case DSPF_YV12: mpi->planes[2]=dst + pitch*in_height;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1802 mpi->planes[1]=mpi->planes[1] + pitch*in_height/4;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1803 break;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1804
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1805 }
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1806 mpi->width=mpi->stride[0]=pitch;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1807 mpi->stride[1]=mpi->stride[2]=pitch/2;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1808 #else
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1809 return VO_FALSE;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1810 #endif
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1811 } else {
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1812 err = frame->Lock(frame,DSLF_WRITE/*|DSLF_READ*/,&dst,&pitch);
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1813 // err = primary->Lock(primary,DSLF_WRITE,&dst,&pitch); // for real direct rendering
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1814
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1815 if (err) {
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1816 printf("DirectFB: Frame lock failed!");
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1817 return VO_FALSE;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1818 };
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1819 framelocked=1;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1820 //YUY2 and RGB formats
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1821 mpi->planes[0]=dst;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1822 mpi->width=pitch/frame_pixel_size;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1823 mpi->stride[0]=pitch;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1824 }
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1825 mpi->flags|=MP_IMGFLAG_DIRECT;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1826 // printf("DirectFB: get_image() SUCCESS -> Direct Rendering ENABLED\n");
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1827 return VO_TRUE;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1828 }
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1829
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1830 if(framelocked) {
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1831 frame->Unlock(frame);
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1832 framelocked=0;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1833 };
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1834 return VO_FALSE;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1835 }
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1836 #endif
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1837
4596
c35d7ce151b3 10000hl to Holm... control MUST BE static...
arpi
parents: 4592
diff changeset
1838 static uint32_t control(uint32_t request, void *data, ...)
4352
ed5b85b713a3 Extensions for video accelerated architecture
nick
parents: 3651
diff changeset
1839 {
4592
5fbfd8545c3b query_ stuff replaced by new control() - patch by David Holm
arpi
parents: 4433
diff changeset
1840 switch (request) {
6920
447ee5862f5d updates, using DIRECTFBVERSION and video EQ support by Jiri.Svoboda@seznam.cz
arpi
parents: 6717
diff changeset
1841 case VOCTRL_SET_EQUALIZER:
447ee5862f5d updates, using DIRECTFBVERSION and video EQ support by Jiri.Svoboda@seznam.cz
arpi
parents: 6717
diff changeset
1842 {
447ee5862f5d updates, using DIRECTFBVERSION and video EQ support by Jiri.Svoboda@seznam.cz
arpi
parents: 6717
diff changeset
1843 va_list ap;
447ee5862f5d updates, using DIRECTFBVERSION and video EQ support by Jiri.Svoboda@seznam.cz
arpi
parents: 6717
diff changeset
1844 int value;
447ee5862f5d updates, using DIRECTFBVERSION and video EQ support by Jiri.Svoboda@seznam.cz
arpi
parents: 6717
diff changeset
1845
447ee5862f5d updates, using DIRECTFBVERSION and video EQ support by Jiri.Svoboda@seznam.cz
arpi
parents: 6717
diff changeset
1846 va_start(ap, data);
447ee5862f5d updates, using DIRECTFBVERSION and video EQ support by Jiri.Svoboda@seznam.cz
arpi
parents: 6717
diff changeset
1847 value = va_arg(ap, int);
447ee5862f5d updates, using DIRECTFBVERSION and video EQ support by Jiri.Svoboda@seznam.cz
arpi
parents: 6717
diff changeset
1848 va_end(ap);
447ee5862f5d updates, using DIRECTFBVERSION and video EQ support by Jiri.Svoboda@seznam.cz
arpi
parents: 6717
diff changeset
1849
447ee5862f5d updates, using DIRECTFBVERSION and video EQ support by Jiri.Svoboda@seznam.cz
arpi
parents: 6717
diff changeset
1850 return(directfb_set_video_eq(data, value));
447ee5862f5d updates, using DIRECTFBVERSION and video EQ support by Jiri.Svoboda@seznam.cz
arpi
parents: 6717
diff changeset
1851 }
447ee5862f5d updates, using DIRECTFBVERSION and video EQ support by Jiri.Svoboda@seznam.cz
arpi
parents: 6717
diff changeset
1852 case VOCTRL_GET_EQUALIZER:
447ee5862f5d updates, using DIRECTFBVERSION and video EQ support by Jiri.Svoboda@seznam.cz
arpi
parents: 6717
diff changeset
1853 {
447ee5862f5d updates, using DIRECTFBVERSION and video EQ support by Jiri.Svoboda@seznam.cz
arpi
parents: 6717
diff changeset
1854 va_list ap;
447ee5862f5d updates, using DIRECTFBVERSION and video EQ support by Jiri.Svoboda@seznam.cz
arpi
parents: 6717
diff changeset
1855 int *value;
447ee5862f5d updates, using DIRECTFBVERSION and video EQ support by Jiri.Svoboda@seznam.cz
arpi
parents: 6717
diff changeset
1856
447ee5862f5d updates, using DIRECTFBVERSION and video EQ support by Jiri.Svoboda@seznam.cz
arpi
parents: 6717
diff changeset
1857 va_start(ap, data);
447ee5862f5d updates, using DIRECTFBVERSION and video EQ support by Jiri.Svoboda@seznam.cz
arpi
parents: 6717
diff changeset
1858 value = va_arg(ap, int*);
447ee5862f5d updates, using DIRECTFBVERSION and video EQ support by Jiri.Svoboda@seznam.cz
arpi
parents: 6717
diff changeset
1859 va_end(ap);
447ee5862f5d updates, using DIRECTFBVERSION and video EQ support by Jiri.Svoboda@seznam.cz
arpi
parents: 6717
diff changeset
1860
447ee5862f5d updates, using DIRECTFBVERSION and video EQ support by Jiri.Svoboda@seznam.cz
arpi
parents: 6717
diff changeset
1861 return(directfb_get_video_eq(data, value));
447ee5862f5d updates, using DIRECTFBVERSION and video EQ support by Jiri.Svoboda@seznam.cz
arpi
parents: 6717
diff changeset
1862 }
4592
5fbfd8545c3b query_ stuff replaced by new control() - patch by David Holm
arpi
parents: 4433
diff changeset
1863 case VOCTRL_QUERY_FORMAT:
5fbfd8545c3b query_ stuff replaced by new control() - patch by David Holm
arpi
parents: 4433
diff changeset
1864 return query_format(*((uint32_t*)data));
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1865 #ifdef DIRECTRENDER
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1866 case VOCTRL_GET_IMAGE:
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1867 // printf("DirectFB: control(VOCTRL_GET_IMAGE) called\n");
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1868 if (dr_enabled) return get_image(data);
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1869 #endif
4592
5fbfd8545c3b query_ stuff replaced by new control() - patch by David Holm
arpi
parents: 4433
diff changeset
1870 }
5fbfd8545c3b query_ stuff replaced by new control() - patch by David Holm
arpi
parents: 4433
diff changeset
1871 return VO_NOTIMPL;
4352
ed5b85b713a3 Extensions for video accelerated architecture
nick
parents: 3651
diff changeset
1872 }