annotate libvo/vo_svga.c @ 5094:570ffe8dcc67

RM seeking works (?)
author gabucino
date Fri, 15 Mar 2002 16:38:36 +0000
parents c35d7ce151b3
children 30f196ff3bec
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
285
5cb4fdc94146 SVGAlib support - vo_svga.c added.
se7encode
parents:
diff changeset
1 /*
292
2c0bb83b77b3 Some bugfix.
se7encode
parents: 290
diff changeset
2 Video driver for SVGAlib - alpha, slow
285
5cb4fdc94146 SVGAlib support - vo_svga.c added.
se7encode
parents:
diff changeset
3 by Zoltan Mark Vician <se7en@sch.bme.hu>
381
bbd079aa1614 Date bugfix :)
se7encode
parents: 377
diff changeset
4 Code started: Mon Apr 1 23:25:47 2001
407
0a5b131f1f11 24/15bpp -> 32/16bpp added.
se7encode
parents: 387
diff changeset
5
0a5b131f1f11 24/15bpp -> 32/16bpp added.
se7encode
parents: 387
diff changeset
6 Uses HW acceleration if your card is supported by SVGAlib.
285
5cb4fdc94146 SVGAlib support - vo_svga.c added.
se7encode
parents:
diff changeset
7 */
5cb4fdc94146 SVGAlib support - vo_svga.c added.
se7encode
parents:
diff changeset
8
5cb4fdc94146 SVGAlib support - vo_svga.c added.
se7encode
parents:
diff changeset
9 #include <stdio.h>
5cb4fdc94146 SVGAlib support - vo_svga.c added.
se7encode
parents:
diff changeset
10 #include <stdlib.h>
5cb4fdc94146 SVGAlib support - vo_svga.c added.
se7encode
parents:
diff changeset
11
5cb4fdc94146 SVGAlib support - vo_svga.c added.
se7encode
parents:
diff changeset
12 #include <vga.h>
5cb4fdc94146 SVGAlib support - vo_svga.c added.
se7encode
parents:
diff changeset
13 #include <vgagl.h>
5cb4fdc94146 SVGAlib support - vo_svga.c added.
se7encode
parents:
diff changeset
14
485
dfafa47d751d Tons of code rewrites.
se7encode
parents: 483
diff changeset
15 #include <limits.h>
dfafa47d751d Tons of code rewrites.
se7encode
parents: 483
diff changeset
16
285
5cb4fdc94146 SVGAlib support - vo_svga.c added.
se7encode
parents:
diff changeset
17 #include "config.h"
5cb4fdc94146 SVGAlib support - vo_svga.c added.
se7encode
parents:
diff changeset
18 #include "video_out.h"
5cb4fdc94146 SVGAlib support - vo_svga.c added.
se7encode
parents:
diff changeset
19 #include "video_out_internal.h"
5cb4fdc94146 SVGAlib support - vo_svga.c added.
se7encode
parents:
diff changeset
20
616
41d6eec69b60 clean up
pontscho
parents: 612
diff changeset
21 #include "sub.h"
2556
71934dc06490 Using new stuff of rgb15to16
nick
parents: 1512
diff changeset
22 #include "../postproc/rgb2rgb.h"
616
41d6eec69b60 clean up
pontscho
parents: 612
diff changeset
23
485
dfafa47d751d Tons of code rewrites.
se7encode
parents: 483
diff changeset
24 extern int vo_dbpp;
504
a77e23145686 Some debug information (using verbose) added.
se7encode
parents: 502
diff changeset
25 extern int verbose;
407
0a5b131f1f11 24/15bpp -> 32/16bpp added.
se7encode
parents: 387
diff changeset
26
285
5cb4fdc94146 SVGAlib support - vo_svga.c added.
se7encode
parents:
diff changeset
27 LIBVO_EXTERN(svga)
5cb4fdc94146 SVGAlib support - vo_svga.c added.
se7encode
parents:
diff changeset
28
5cb4fdc94146 SVGAlib support - vo_svga.c added.
se7encode
parents:
diff changeset
29 static vo_info_t vo_info = {
5cb4fdc94146 SVGAlib support - vo_svga.c added.
se7encode
parents:
diff changeset
30 "SVGAlib",
5cb4fdc94146 SVGAlib support - vo_svga.c added.
se7encode
parents:
diff changeset
31 "svga",
5cb4fdc94146 SVGAlib support - vo_svga.c added.
se7encode
parents:
diff changeset
32 "Zoltan Mark Vician <se7en@sch.bme.hu>",
5cb4fdc94146 SVGAlib support - vo_svga.c added.
se7encode
parents:
diff changeset
33 ""
5cb4fdc94146 SVGAlib support - vo_svga.c added.
se7encode
parents:
diff changeset
34 };
5cb4fdc94146 SVGAlib support - vo_svga.c added.
se7encode
parents:
diff changeset
35
5cb4fdc94146 SVGAlib support - vo_svga.c added.
se7encode
parents:
diff changeset
36 // SVGAlib definitions
5cb4fdc94146 SVGAlib support - vo_svga.c added.
se7encode
parents:
diff changeset
37
5cb4fdc94146 SVGAlib support - vo_svga.c added.
se7encode
parents:
diff changeset
38 GraphicsContext *screen;
5cb4fdc94146 SVGAlib support - vo_svga.c added.
se7encode
parents:
diff changeset
39 GraphicsContext *virt;
5cb4fdc94146 SVGAlib support - vo_svga.c added.
se7encode
parents:
diff changeset
40
407
0a5b131f1f11 24/15bpp -> 32/16bpp added.
se7encode
parents: 387
diff changeset
41 static uint8_t *scalebuf = NULL, *yuvbuf = NULL, *bppbuf = NULL;
285
5cb4fdc94146 SVGAlib support - vo_svga.c added.
se7encode
parents:
diff changeset
42
5cb4fdc94146 SVGAlib support - vo_svga.c added.
se7encode
parents:
diff changeset
43 static uint32_t orig_w, orig_h, maxw, maxh; // Width, height
377
8ad594a8c94c Bugfixes in draw_slice.
se7encode
parents: 343
diff changeset
44 static float scaling = 1.0;
285
5cb4fdc94146 SVGAlib support - vo_svga.c added.
se7encode
parents:
diff changeset
45 static uint32_t x_pos, y_pos; // Position
5cb4fdc94146 SVGAlib support - vo_svga.c added.
se7encode
parents:
diff changeset
46
483
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
47 // SVGAlib - list of detected modes
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
48 typedef struct vga_modelist_s {
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
49 uint16_t modenum;
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
50 vga_modeinfo modeinfo;
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
51 struct vga_modelist_s *next;
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
52 } vga_modelist_t;
447
b3b28a0d9404 All available videomodes support added.
se7encode
parents: 411
diff changeset
53
483
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
54 vga_modelist_t *modelist = NULL;
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
55
327
e7731f5c76cc OSD renderers for all modes added.
se7encode
parents: 293
diff changeset
56 static uint8_t bpp;
483
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
57 static uint8_t bpp_conv = 0;
448
198b46b739d8 qrva eletbe nem kene cvs-t elbaszni inkabb ne nyuljatok hozza baz+
arpi_esp
parents: 447
diff changeset
58 static uint32_t pformat;
447
b3b28a0d9404 All available videomodes support added.
se7encode
parents: 411
diff changeset
59
483
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
60 #define BPP_15 1
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
61 #define BPP_16 2
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
62 #define BPP_24 4
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
63 #define BPP_32 8
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
64 static uint8_t bpp_avail = 0;
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
65
285
5cb4fdc94146 SVGAlib support - vo_svga.c added.
se7encode
parents:
diff changeset
66 static uint8_t checked = 0;
483
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
67
485
dfafa47d751d Tons of code rewrites.
se7encode
parents: 483
diff changeset
68 static uint32_t add_mode(uint16_t mode, vga_modeinfo minfo) {
483
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
69 vga_modelist_t *list;
285
5cb4fdc94146 SVGAlib support - vo_svga.c added.
se7encode
parents:
diff changeset
70
483
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
71 if (modelist == NULL) {
485
dfafa47d751d Tons of code rewrites.
se7encode
parents: 483
diff changeset
72 modelist = (vga_modelist_t *) malloc(sizeof(vga_modelist_t));
483
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
73 if (modelist == NULL) {
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
74 printf("vo_svga: add_mode() failed. Not enough memory for modelist.");
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
75 return(1); // error
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
76 }
485
dfafa47d751d Tons of code rewrites.
se7encode
parents: 483
diff changeset
77 modelist->modenum = mode;
dfafa47d751d Tons of code rewrites.
se7encode
parents: 483
diff changeset
78 modelist->modeinfo = minfo;
dfafa47d751d Tons of code rewrites.
se7encode
parents: 483
diff changeset
79 modelist->next = NULL;
483
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
80 } else {
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
81 list = modelist;
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
82 while (list->next != NULL)
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
83 list = list->next;
485
dfafa47d751d Tons of code rewrites.
se7encode
parents: 483
diff changeset
84 list->next = (vga_modelist_t *) malloc(sizeof(vga_modelist_t));
483
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
85 if (list->next == NULL) {
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
86 printf("vo_svga: add_mode() failed. Not enough memory for modelist.");
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
87 return(1); // error
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
88 }
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
89 list = list->next;
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
90 list->modenum = mode;
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
91 list->modeinfo = minfo;
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
92 list->next = NULL;
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
93 }
485
dfafa47d751d Tons of code rewrites.
se7encode
parents: 483
diff changeset
94 return (0);
483
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
95 }
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
96
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
97 static int checksupportedmodes() {
485
dfafa47d751d Tons of code rewrites.
se7encode
parents: 483
diff changeset
98 uint16_t i, max;
483
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
99 vga_modeinfo *minfo;
285
5cb4fdc94146 SVGAlib support - vo_svga.c added.
se7encode
parents:
diff changeset
100
5cb4fdc94146 SVGAlib support - vo_svga.c added.
se7encode
parents:
diff changeset
101 checked = 1;
5cb4fdc94146 SVGAlib support - vo_svga.c added.
se7encode
parents:
diff changeset
102 vga_init();
5cb4fdc94146 SVGAlib support - vo_svga.c added.
se7encode
parents:
diff changeset
103 vga_disabledriverreport();
485
dfafa47d751d Tons of code rewrites.
se7encode
parents: 483
diff changeset
104 max = vga_lastmodenumber();
dfafa47d751d Tons of code rewrites.
se7encode
parents: 483
diff changeset
105 for (i = 1; i < max; i++)
483
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
106 if (vga_hasmode(i) > 0) {
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
107 minfo = vga_getmodeinfo(i);
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
108 switch (minfo->colors) {
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
109 case 32768: bpp_avail |= BPP_15; break;
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
110 case 65536: bpp_avail |= BPP_16; break;
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
111 }
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
112 switch (minfo->bytesperpixel) {
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
113 case 3: bpp_avail |= BPP_24; break;
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
114 case 4: bpp_avail |= BPP_32; break;
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
115 }
504
a77e23145686 Some debug information (using verbose) added.
se7encode
parents: 502
diff changeset
116 if (verbose >= 2)
a77e23145686 Some debug information (using verbose) added.
se7encode
parents: 502
diff changeset
117 printf("vo_svga: Mode found: %s\n",vga_getmodename(i));
483
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
118 if (add_mode(i, *minfo))
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
119 return(1);
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
120 }
485
dfafa47d751d Tons of code rewrites.
se7encode
parents: 483
diff changeset
121 return(0);
285
5cb4fdc94146 SVGAlib support - vo_svga.c added.
se7encode
parents:
diff changeset
122 }
5cb4fdc94146 SVGAlib support - vo_svga.c added.
se7encode
parents:
diff changeset
123
4433
df8e0f71cc3c new info for tuning
nick
parents: 4352
diff changeset
124 static uint32_t config(uint32_t width, uint32_t height, uint32_t d_width,
285
5cb4fdc94146 SVGAlib support - vo_svga.c added.
se7encode
parents:
diff changeset
125 uint32_t d_height, uint32_t fullscreen, char *title,
4433
df8e0f71cc3c new info for tuning
nick
parents: 4352
diff changeset
126 uint32_t format,const vo_tune_info_t *info) {
483
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
127 uint32_t req_w = (d_width > 0 ? d_width : width);
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
128 uint32_t req_h = (d_height > 0 ? d_height : height);
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
129 uint16_t vid_mode = 0;
976
90408bd383a5 Scaling bug fixed.
se7encode
parents: 875
diff changeset
130 uint8_t res_widescr, vid_widescr = (((req_w*1.0)/req_h) > (4.0/3)) ? 1 : 0;
485
dfafa47d751d Tons of code rewrites.
se7encode
parents: 483
diff changeset
131 uint16_t buf_w = USHRT_MAX, buf_h = USHRT_MAX;
483
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
132 vga_modelist_t *list = modelist;
387
43acef8f7c74 Requested resolution (d_width) added.
se7encode
parents: 381
diff changeset
133
285
5cb4fdc94146 SVGAlib support - vo_svga.c added.
se7encode
parents:
diff changeset
134 if (!checked) {
485
dfafa47d751d Tons of code rewrites.
se7encode
parents: 483
diff changeset
135 if (checksupportedmodes()) // Looking for available video modes
483
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
136 return(1);
285
5cb4fdc94146 SVGAlib support - vo_svga.c added.
se7encode
parents:
diff changeset
137 }
407
0a5b131f1f11 24/15bpp -> 32/16bpp added.
se7encode
parents: 387
diff changeset
138
483
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
139 bpp_avail = 0;
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
140 while (list != NULL) {
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
141 if ((list->modeinfo.width >= req_w) && (list->modeinfo.height >= req_h)) {
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
142 switch (list->modeinfo.colors) {
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
143 case 32768: bpp_avail |= BPP_15; break;
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
144 case 65536: bpp_avail |= BPP_16; break;
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
145 }
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
146 switch (list->modeinfo.bytesperpixel) {
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
147 case 3: bpp_avail |= BPP_24; break;
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
148 case 4: bpp_avail |= BPP_32; break;
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
149 }
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
150 }
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
151 list = list->next;
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
152 }
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
153
285
5cb4fdc94146 SVGAlib support - vo_svga.c added.
se7encode
parents:
diff changeset
154 pformat = format;
411
53203545daa7 -bpp added.
se7encode
parents: 407
diff changeset
155
483
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
156 // bpp check
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
157 bpp_conv = 0;
411
53203545daa7 -bpp added.
se7encode
parents: 407
diff changeset
158 if (!vo_dbpp) {
53203545daa7 -bpp added.
se7encode
parents: 407
diff changeset
159 if (format == IMGFMT_YV12) bpp = 32;
53203545daa7 -bpp added.
se7encode
parents: 407
diff changeset
160 else bpp = format & 255;
504
a77e23145686 Some debug information (using verbose) added.
se7encode
parents: 502
diff changeset
161 if (verbose)
a77e23145686 Some debug information (using verbose) added.
se7encode
parents: 502
diff changeset
162 printf("vo_svga: vo_dbpp == 0, bpp: %d\n",bpp);
483
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
163 switch (bpp) {
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
164 case 32: if (!(bpp_avail & BPP_32)) {
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
165 printf("vo_svga: Haven't found video mode which fit to: %dx%d %dbpp\n",req_w,req_h,bpp);
485
dfafa47d751d Tons of code rewrites.
se7encode
parents: 483
diff changeset
166 printf("vo_svga: Maybe you should try -bpp\n");
483
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
167 return(1);
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
168 }
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
169 break;
619
99a716d8cac8 -Wall warnings fixed.
se7encode
parents: 617
diff changeset
170 case 24: if (!(bpp_avail & BPP_24)) {
483
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
171 if (!(bpp_avail & BPP_32)) {
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
172 printf("vo_svga: Haven't found video mode which fit to: %dx%d %dbpp\n",req_w,req_h,bpp);
485
dfafa47d751d Tons of code rewrites.
se7encode
parents: 483
diff changeset
173 printf("vo_svga: Maybe you should try -bpp\n");
483
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
174 return(1);
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
175 } else {
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
176 bpp = 32;
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
177 bpp_conv = 1;
617
33b559940fb4 *** empty log message ***
se7encode
parents: 616
diff changeset
178 printf("vo_svga: BPP conversion 24->32\n");
619
99a716d8cac8 -Wall warnings fixed.
se7encode
parents: 617
diff changeset
179 }
99a716d8cac8 -Wall warnings fixed.
se7encode
parents: 617
diff changeset
180 }
483
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
181 break;
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
182 case 16: if (!(bpp_avail & BPP_16)) {
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
183 printf("vo_svga: Haven't found video mode which fit to: %dx%d %dbpp\n",req_w,req_h,bpp);
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
184 printf("vo_svga: Maybe you should try -bpp\n");
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
185 return(1);
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
186 }
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
187 break;
619
99a716d8cac8 -Wall warnings fixed.
se7encode
parents: 617
diff changeset
188 case 15: if (!(bpp_avail & BPP_15)) {
483
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
189 if (!(bpp_avail & BPP_16)) {
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
190 printf("vo_svga: Haven't found video mode which fit to: %dx%d %dbpp\n",req_w,req_h,bpp);
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
191 printf("vo_svga: Maybe you should try -bpp\n");
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
192 return(1);
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
193 } else {
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
194 bpp = 16;
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
195 bpp_conv = 1;
617
33b559940fb4 *** empty log message ***
se7encode
parents: 616
diff changeset
196 printf("vo_svga: BPP conversion 15->16\n");
483
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
197 }
619
99a716d8cac8 -Wall warnings fixed.
se7encode
parents: 617
diff changeset
198 }
483
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
199 break;
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
200 }
411
53203545daa7 -bpp added.
se7encode
parents: 407
diff changeset
201 } else {
53203545daa7 -bpp added.
se7encode
parents: 407
diff changeset
202 bpp = vo_dbpp;
504
a77e23145686 Some debug information (using verbose) added.
se7encode
parents: 502
diff changeset
203 if (verbose)
a77e23145686 Some debug information (using verbose) added.
se7encode
parents: 502
diff changeset
204 printf("vo_svga: vo_dbpp == %d\n",bpp);
411
53203545daa7 -bpp added.
se7encode
parents: 407
diff changeset
205 switch (bpp) {
483
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
206 case 32: if (!(bpp_avail & BPP_32)) {
485
dfafa47d751d Tons of code rewrites.
se7encode
parents: 483
diff changeset
207 printf("vo_svga: %dbpp not supported in %dx%d (or larger resoltuion) by HW or SVGAlib\n",bpp,req_w,req_h);
411
53203545daa7 -bpp added.
se7encode
parents: 407
diff changeset
208 return(1);
53203545daa7 -bpp added.
se7encode
parents: 407
diff changeset
209 }
485
dfafa47d751d Tons of code rewrites.
se7encode
parents: 483
diff changeset
210 break;
483
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
211 case 24: if (!(bpp_avail & BPP_24)) {
485
dfafa47d751d Tons of code rewrites.
se7encode
parents: 483
diff changeset
212 printf("vo_svga: %dbpp not supported in %dx%d (or larger resoltuion) by HW or SVGAlib\n",bpp,req_w,req_h);
411
53203545daa7 -bpp added.
se7encode
parents: 407
diff changeset
213 return(1);
53203545daa7 -bpp added.
se7encode
parents: 407
diff changeset
214 }
485
dfafa47d751d Tons of code rewrites.
se7encode
parents: 483
diff changeset
215 break;
483
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
216 case 16: if (!(bpp_avail & BPP_16)) {
485
dfafa47d751d Tons of code rewrites.
se7encode
parents: 483
diff changeset
217 printf("vo_svga: %dbpp not supported in %dx%d (or larger resoltuion) by HW or SVGAlib\n",bpp,req_w,req_h);
411
53203545daa7 -bpp added.
se7encode
parents: 407
diff changeset
218 return(1);
53203545daa7 -bpp added.
se7encode
parents: 407
diff changeset
219 }
485
dfafa47d751d Tons of code rewrites.
se7encode
parents: 483
diff changeset
220 break;
483
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
221 case 15: if (!(bpp_avail & BPP_15)) {
485
dfafa47d751d Tons of code rewrites.
se7encode
parents: 483
diff changeset
222 printf("vo_svga: %dbpp not supported in %dx%d (or larger resoltuion) by HW or SVGAlib\n",bpp,req_w,req_h);
411
53203545daa7 -bpp added.
se7encode
parents: 407
diff changeset
223 return(1);
53203545daa7 -bpp added.
se7encode
parents: 407
diff changeset
224 }
485
dfafa47d751d Tons of code rewrites.
se7encode
parents: 483
diff changeset
225 break;
411
53203545daa7 -bpp added.
se7encode
parents: 407
diff changeset
226 }
53203545daa7 -bpp added.
se7encode
parents: 407
diff changeset
227 }
483
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
228
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
229 list = modelist;
504
a77e23145686 Some debug information (using verbose) added.
se7encode
parents: 502
diff changeset
230 if (verbose) {
a77e23145686 Some debug information (using verbose) added.
se7encode
parents: 502
diff changeset
231 printf("vo_svga: Looking for the best resolution...\n");
a77e23145686 Some debug information (using verbose) added.
se7encode
parents: 502
diff changeset
232 printf("vo_svga: req_w: %d, req_h: %d, bpp: %d\n",req_w,req_h,bpp);
a77e23145686 Some debug information (using verbose) added.
se7encode
parents: 502
diff changeset
233 }
485
dfafa47d751d Tons of code rewrites.
se7encode
parents: 483
diff changeset
234 while (list != NULL) {
483
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
235 if ((list->modeinfo.width >= req_w) && (list->modeinfo.height >= req_h)) {
504
a77e23145686 Some debug information (using verbose) added.
se7encode
parents: 502
diff changeset
236 if (verbose) {
a77e23145686 Some debug information (using verbose) added.
se7encode
parents: 502
diff changeset
237 switch (list->modeinfo.colors) {
a77e23145686 Some debug information (using verbose) added.
se7encode
parents: 502
diff changeset
238 case 32768: printf("vo_svga: vid_mode: %d, %dx%d 15bpp\n",list->modenum,list->modeinfo.width,list->modeinfo.height);
a77e23145686 Some debug information (using verbose) added.
se7encode
parents: 502
diff changeset
239 break;
a77e23145686 Some debug information (using verbose) added.
se7encode
parents: 502
diff changeset
240 case 65536: printf("vo_svga: vid_mode: %d, %dx%d 16bpp\n",list->modenum,list->modeinfo.width,list->modeinfo.height);
a77e23145686 Some debug information (using verbose) added.
se7encode
parents: 502
diff changeset
241 break;
a77e23145686 Some debug information (using verbose) added.
se7encode
parents: 502
diff changeset
242 }
a77e23145686 Some debug information (using verbose) added.
se7encode
parents: 502
diff changeset
243 switch (list->modeinfo.bytesperpixel) {
a77e23145686 Some debug information (using verbose) added.
se7encode
parents: 502
diff changeset
244 case 3: printf("vo_svga: vid_mode: %d, %dx%d 24bpp\n",list->modenum,list->modeinfo.width,list->modeinfo.height);
a77e23145686 Some debug information (using verbose) added.
se7encode
parents: 502
diff changeset
245 break;
a77e23145686 Some debug information (using verbose) added.
se7encode
parents: 502
diff changeset
246 case 4: printf("vo_svga: vid_mode: %d, %dx%d 32bpp\n",list->modenum,list->modeinfo.width,list->modeinfo.height);
a77e23145686 Some debug information (using verbose) added.
se7encode
parents: 502
diff changeset
247 break;
a77e23145686 Some debug information (using verbose) added.
se7encode
parents: 502
diff changeset
248 }
a77e23145686 Some debug information (using verbose) added.
se7encode
parents: 502
diff changeset
249 }
285
5cb4fdc94146 SVGAlib support - vo_svga.c added.
se7encode
parents:
diff changeset
250 switch (bpp) {
483
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
251 case 32: if (list->modeinfo.bytesperpixel == 4)
485
dfafa47d751d Tons of code rewrites.
se7encode
parents: 483
diff changeset
252 if ((list->modeinfo.width < buf_w) || (list->modeinfo.height < buf_h)) {
dfafa47d751d Tons of code rewrites.
se7encode
parents: 483
diff changeset
253 vid_mode = list->modenum;
dfafa47d751d Tons of code rewrites.
se7encode
parents: 483
diff changeset
254 buf_w = list->modeinfo.width;
dfafa47d751d Tons of code rewrites.
se7encode
parents: 483
diff changeset
255 buf_h = list->modeinfo.height;
976
90408bd383a5 Scaling bug fixed.
se7encode
parents: 875
diff changeset
256 res_widescr = (((buf_w*1.0)/buf_h) > (4.0/3)) ? 1 : 0;
485
dfafa47d751d Tons of code rewrites.
se7encode
parents: 483
diff changeset
257 }
dfafa47d751d Tons of code rewrites.
se7encode
parents: 483
diff changeset
258 break;
483
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
259 case 24: if (list->modeinfo.bytesperpixel == 3)
485
dfafa47d751d Tons of code rewrites.
se7encode
parents: 483
diff changeset
260 if ((list->modeinfo.width < buf_w) || (list->modeinfo.height < buf_h)) {
dfafa47d751d Tons of code rewrites.
se7encode
parents: 483
diff changeset
261 vid_mode = list->modenum;
dfafa47d751d Tons of code rewrites.
se7encode
parents: 483
diff changeset
262 buf_w = list->modeinfo.width;
dfafa47d751d Tons of code rewrites.
se7encode
parents: 483
diff changeset
263 buf_h = list->modeinfo.height;
976
90408bd383a5 Scaling bug fixed.
se7encode
parents: 875
diff changeset
264 res_widescr = (((buf_w*1.0)/buf_h) > (4.0/3)) ? 1 : 0;
485
dfafa47d751d Tons of code rewrites.
se7encode
parents: 483
diff changeset
265 }
dfafa47d751d Tons of code rewrites.
se7encode
parents: 483
diff changeset
266 break;
483
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
267 case 16: if (list->modeinfo.colors == 65536)
485
dfafa47d751d Tons of code rewrites.
se7encode
parents: 483
diff changeset
268 if ((list->modeinfo.width < buf_w) || (list->modeinfo.height < buf_h)) {
dfafa47d751d Tons of code rewrites.
se7encode
parents: 483
diff changeset
269 vid_mode = list->modenum;
dfafa47d751d Tons of code rewrites.
se7encode
parents: 483
diff changeset
270 buf_w = list->modeinfo.width;
dfafa47d751d Tons of code rewrites.
se7encode
parents: 483
diff changeset
271 buf_h = list->modeinfo.height;
976
90408bd383a5 Scaling bug fixed.
se7encode
parents: 875
diff changeset
272 res_widescr = (((buf_w*1.0)/buf_h) > (4.0/3)) ? 1 : 0;
485
dfafa47d751d Tons of code rewrites.
se7encode
parents: 483
diff changeset
273 }
dfafa47d751d Tons of code rewrites.
se7encode
parents: 483
diff changeset
274 break;
483
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
275 case 15: if (list->modeinfo.colors == 32768)
485
dfafa47d751d Tons of code rewrites.
se7encode
parents: 483
diff changeset
276 if ((list->modeinfo.width < buf_w) || (list->modeinfo.height < buf_h)) {
dfafa47d751d Tons of code rewrites.
se7encode
parents: 483
diff changeset
277 vid_mode = list->modenum;
dfafa47d751d Tons of code rewrites.
se7encode
parents: 483
diff changeset
278 buf_w = list->modeinfo.width;
dfafa47d751d Tons of code rewrites.
se7encode
parents: 483
diff changeset
279 buf_h = list->modeinfo.height;
976
90408bd383a5 Scaling bug fixed.
se7encode
parents: 875
diff changeset
280 res_widescr = (((buf_w*1.0)/buf_h) > (4.0/3)) ? 1 : 0;
485
dfafa47d751d Tons of code rewrites.
se7encode
parents: 483
diff changeset
281 }
dfafa47d751d Tons of code rewrites.
se7encode
parents: 483
diff changeset
282 break;
285
5cb4fdc94146 SVGAlib support - vo_svga.c added.
se7encode
parents:
diff changeset
283 }
483
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
284 }
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
285 list = list->next;
407
0a5b131f1f11 24/15bpp -> 32/16bpp added.
se7encode
parents: 387
diff changeset
286 }
485
dfafa47d751d Tons of code rewrites.
se7encode
parents: 483
diff changeset
287
2982
32638add0dc8 mode selection (subdev) fix by Matan Ziv-Av matan@svgalib.org
arpi
parents: 2732
diff changeset
288 if(vo_subdevice) {
32638add0dc8 mode selection (subdev) fix by Matan Ziv-Av matan@svgalib.org
arpi
parents: 2732
diff changeset
289 int vm;
32638add0dc8 mode selection (subdev) fix by Matan Ziv-Av matan@svgalib.org
arpi
parents: 2732
diff changeset
290 vm=vga_getmodenumber(vo_subdevice);
32638add0dc8 mode selection (subdev) fix by Matan Ziv-Av matan@svgalib.org
arpi
parents: 2732
diff changeset
291 list=modelist;
32638add0dc8 mode selection (subdev) fix by Matan Ziv-Av matan@svgalib.org
arpi
parents: 2732
diff changeset
292 while(list) {
32638add0dc8 mode selection (subdev) fix by Matan Ziv-Av matan@svgalib.org
arpi
parents: 2732
diff changeset
293 if(list->modenum == vm) {
32638add0dc8 mode selection (subdev) fix by Matan Ziv-Av matan@svgalib.org
arpi
parents: 2732
diff changeset
294 buf_w = list->modeinfo.width;
32638add0dc8 mode selection (subdev) fix by Matan Ziv-Av matan@svgalib.org
arpi
parents: 2732
diff changeset
295 buf_h = list->modeinfo.height;
32638add0dc8 mode selection (subdev) fix by Matan Ziv-Av matan@svgalib.org
arpi
parents: 2732
diff changeset
296 res_widescr = (((buf_w*1.0)/buf_h) > (4.0/3)) ? 1 : 0;
32638add0dc8 mode selection (subdev) fix by Matan Ziv-Av matan@svgalib.org
arpi
parents: 2732
diff changeset
297 switch(list->modeinfo.colors) {
32638add0dc8 mode selection (subdev) fix by Matan Ziv-Av matan@svgalib.org
arpi
parents: 2732
diff changeset
298 case 32768:
32638add0dc8 mode selection (subdev) fix by Matan Ziv-Av matan@svgalib.org
arpi
parents: 2732
diff changeset
299 bpp=16;
32638add0dc8 mode selection (subdev) fix by Matan Ziv-Av matan@svgalib.org
arpi
parents: 2732
diff changeset
300 bpp_conv=1;
32638add0dc8 mode selection (subdev) fix by Matan Ziv-Av matan@svgalib.org
arpi
parents: 2732
diff changeset
301 break;
32638add0dc8 mode selection (subdev) fix by Matan Ziv-Av matan@svgalib.org
arpi
parents: 2732
diff changeset
302 case 65536:
32638add0dc8 mode selection (subdev) fix by Matan Ziv-Av matan@svgalib.org
arpi
parents: 2732
diff changeset
303 bpp=16;
32638add0dc8 mode selection (subdev) fix by Matan Ziv-Av matan@svgalib.org
arpi
parents: 2732
diff changeset
304 bpp_conv=0;
32638add0dc8 mode selection (subdev) fix by Matan Ziv-Av matan@svgalib.org
arpi
parents: 2732
diff changeset
305 break;
32638add0dc8 mode selection (subdev) fix by Matan Ziv-Av matan@svgalib.org
arpi
parents: 2732
diff changeset
306 case (1<<24):
32638add0dc8 mode selection (subdev) fix by Matan Ziv-Av matan@svgalib.org
arpi
parents: 2732
diff changeset
307 if(list->modeinfo.bytesperpixel == 3) {
32638add0dc8 mode selection (subdev) fix by Matan Ziv-Av matan@svgalib.org
arpi
parents: 2732
diff changeset
308 bpp=32;
32638add0dc8 mode selection (subdev) fix by Matan Ziv-Av matan@svgalib.org
arpi
parents: 2732
diff changeset
309 bpp_conv=1;
32638add0dc8 mode selection (subdev) fix by Matan Ziv-Av matan@svgalib.org
arpi
parents: 2732
diff changeset
310 } else {
32638add0dc8 mode selection (subdev) fix by Matan Ziv-Av matan@svgalib.org
arpi
parents: 2732
diff changeset
311 bpp=32;
32638add0dc8 mode selection (subdev) fix by Matan Ziv-Av matan@svgalib.org
arpi
parents: 2732
diff changeset
312 bpp_conv=0;
32638add0dc8 mode selection (subdev) fix by Matan Ziv-Av matan@svgalib.org
arpi
parents: 2732
diff changeset
313 }
32638add0dc8 mode selection (subdev) fix by Matan Ziv-Av matan@svgalib.org
arpi
parents: 2732
diff changeset
314 break;
32638add0dc8 mode selection (subdev) fix by Matan Ziv-Av matan@svgalib.org
arpi
parents: 2732
diff changeset
315 }
32638add0dc8 mode selection (subdev) fix by Matan Ziv-Av matan@svgalib.org
arpi
parents: 2732
diff changeset
316 vid_mode=vm;
32638add0dc8 mode selection (subdev) fix by Matan Ziv-Av matan@svgalib.org
arpi
parents: 2732
diff changeset
317 list=NULL;
32638add0dc8 mode selection (subdev) fix by Matan Ziv-Av matan@svgalib.org
arpi
parents: 2732
diff changeset
318 } else list=list->next;
32638add0dc8 mode selection (subdev) fix by Matan Ziv-Av matan@svgalib.org
arpi
parents: 2732
diff changeset
319 }
32638add0dc8 mode selection (subdev) fix by Matan Ziv-Av matan@svgalib.org
arpi
parents: 2732
diff changeset
320 }
32638add0dc8 mode selection (subdev) fix by Matan Ziv-Av matan@svgalib.org
arpi
parents: 2732
diff changeset
321
504
a77e23145686 Some debug information (using verbose) added.
se7encode
parents: 502
diff changeset
322 if (verbose)
a77e23145686 Some debug information (using verbose) added.
se7encode
parents: 502
diff changeset
323 printf("vo_svga: vid_mode: %d\n",vid_mode);
485
dfafa47d751d Tons of code rewrites.
se7encode
parents: 483
diff changeset
324 if (vga_setmode(vid_mode) == -1) {
286
b2f3f2ab3787 integrated vo_svga by se7en
arpi_esp
parents: 285
diff changeset
325 printf("vo_svga: vga_setmode(%d) failed.\n",vid_mode);
483
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
326 uninit();
285
5cb4fdc94146 SVGAlib support - vo_svga.c added.
se7encode
parents:
diff changeset
327 return(1); // error
485
dfafa47d751d Tons of code rewrites.
se7encode
parents: 483
diff changeset
328 }
2982
32638add0dc8 mode selection (subdev) fix by Matan Ziv-Av matan@svgalib.org
arpi
parents: 2732
diff changeset
329 vga_setlinearaddressing();
485
dfafa47d751d Tons of code rewrites.
se7encode
parents: 483
diff changeset
330 if (gl_setcontextvga(vid_mode)) {
286
b2f3f2ab3787 integrated vo_svga by se7en
arpi_esp
parents: 285
diff changeset
331 printf("vo_svga: gl_setcontextvga(%d) failed.\n",vid_mode);
483
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
332 uninit();
285
5cb4fdc94146 SVGAlib support - vo_svga.c added.
se7encode
parents:
diff changeset
333 return(1); // error
286
b2f3f2ab3787 integrated vo_svga by se7en
arpi_esp
parents: 285
diff changeset
334 }
285
5cb4fdc94146 SVGAlib support - vo_svga.c added.
se7encode
parents:
diff changeset
335 screen = gl_allocatecontext();
5cb4fdc94146 SVGAlib support - vo_svga.c added.
se7encode
parents:
diff changeset
336 gl_getcontext(screen);
485
dfafa47d751d Tons of code rewrites.
se7encode
parents: 483
diff changeset
337 if (gl_setcontextvgavirtual(vid_mode)) {
286
b2f3f2ab3787 integrated vo_svga by se7en
arpi_esp
parents: 285
diff changeset
338 printf("vo_svga: gl_setcontextvgavirtual(%d) failed.\n",vid_mode);
483
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
339 uninit();
285
5cb4fdc94146 SVGAlib support - vo_svga.c added.
se7encode
parents:
diff changeset
340 return(1); // error
286
b2f3f2ab3787 integrated vo_svga by se7en
arpi_esp
parents: 285
diff changeset
341 }
285
5cb4fdc94146 SVGAlib support - vo_svga.c added.
se7encode
parents:
diff changeset
342 virt = gl_allocatecontext();
5cb4fdc94146 SVGAlib support - vo_svga.c added.
se7encode
parents:
diff changeset
343 gl_getcontext(virt);
5cb4fdc94146 SVGAlib support - vo_svga.c added.
se7encode
parents:
diff changeset
344 gl_setcontext(virt);
5cb4fdc94146 SVGAlib support - vo_svga.c added.
se7encode
parents:
diff changeset
345 gl_clearscreen(0);
5cb4fdc94146 SVGAlib support - vo_svga.c added.
se7encode
parents:
diff changeset
346
485
dfafa47d751d Tons of code rewrites.
se7encode
parents: 483
diff changeset
347 if (bpp_conv) {
483
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
348 bppbuf = malloc(maxw * maxh * BYTESPERPIXEL);
485
dfafa47d751d Tons of code rewrites.
se7encode
parents: 483
diff changeset
349 if (bppbuf == NULL) {
dfafa47d751d Tons of code rewrites.
se7encode
parents: 483
diff changeset
350 printf("vo_svga: bppbuf -> Not enough memory for buffering!\n");
dfafa47d751d Tons of code rewrites.
se7encode
parents: 483
diff changeset
351 uninit();
dfafa47d751d Tons of code rewrites.
se7encode
parents: 483
diff changeset
352 return (1);
dfafa47d751d Tons of code rewrites.
se7encode
parents: 483
diff changeset
353 }
483
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
354 }
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
355
285
5cb4fdc94146 SVGAlib support - vo_svga.c added.
se7encode
parents:
diff changeset
356 orig_w = width;
5cb4fdc94146 SVGAlib support - vo_svga.c added.
se7encode
parents:
diff changeset
357 orig_h = height;
976
90408bd383a5 Scaling bug fixed.
se7encode
parents: 875
diff changeset
358 if ((fullscreen & 0x04) && (WIDTH != orig_w) && (HEIGHT != orig_h)) {
90408bd383a5 Scaling bug fixed.
se7encode
parents: 875
diff changeset
359 if (!vid_widescr || !res_widescr) {
292
2c0bb83b77b3 Some bugfix.
se7encode
parents: 290
diff changeset
360 maxh = HEIGHT;
2c0bb83b77b3 Some bugfix.
se7encode
parents: 290
diff changeset
361 scaling = maxh / (orig_h * 1.0);
2c0bb83b77b3 Some bugfix.
se7encode
parents: 290
diff changeset
362 maxw = (uint32_t) (orig_w * scaling);
2c0bb83b77b3 Some bugfix.
se7encode
parents: 290
diff changeset
363 scalebuf = malloc(maxw * maxh * BYTESPERPIXEL);
483
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
364 if (scalebuf == NULL) {
485
dfafa47d751d Tons of code rewrites.
se7encode
parents: 483
diff changeset
365 printf("vo_svga: scalebuf -> Not enough memory for buffering!\n");
407
0a5b131f1f11 24/15bpp -> 32/16bpp added.
se7encode
parents: 387
diff changeset
366 uninit();
0a5b131f1f11 24/15bpp -> 32/16bpp added.
se7encode
parents: 387
diff changeset
367 return (1);
0a5b131f1f11 24/15bpp -> 32/16bpp added.
se7encode
parents: 387
diff changeset
368 }
292
2c0bb83b77b3 Some bugfix.
se7encode
parents: 290
diff changeset
369 } else {
2c0bb83b77b3 Some bugfix.
se7encode
parents: 290
diff changeset
370 maxw = WIDTH;
2c0bb83b77b3 Some bugfix.
se7encode
parents: 290
diff changeset
371 scaling = maxw / (orig_w * 1.0);
2c0bb83b77b3 Some bugfix.
se7encode
parents: 290
diff changeset
372 maxh = (uint32_t) (orig_h * scaling);
2c0bb83b77b3 Some bugfix.
se7encode
parents: 290
diff changeset
373 scalebuf = malloc(maxw * maxh * BYTESPERPIXEL);
483
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
374 if (scalebuf == NULL) {
485
dfafa47d751d Tons of code rewrites.
se7encode
parents: 483
diff changeset
375 printf("vo_svga: scalebuf -> Not enough memory for buffering!\n");
407
0a5b131f1f11 24/15bpp -> 32/16bpp added.
se7encode
parents: 387
diff changeset
376 uninit();
0a5b131f1f11 24/15bpp -> 32/16bpp added.
se7encode
parents: 387
diff changeset
377 return (1);
0a5b131f1f11 24/15bpp -> 32/16bpp added.
se7encode
parents: 387
diff changeset
378 }
292
2c0bb83b77b3 Some bugfix.
se7encode
parents: 290
diff changeset
379 }
285
5cb4fdc94146 SVGAlib support - vo_svga.c added.
se7encode
parents:
diff changeset
380 } else {
5cb4fdc94146 SVGAlib support - vo_svga.c added.
se7encode
parents:
diff changeset
381 maxw = orig_w;
5cb4fdc94146 SVGAlib support - vo_svga.c added.
se7encode
parents:
diff changeset
382 maxh = orig_h;
5cb4fdc94146 SVGAlib support - vo_svga.c added.
se7encode
parents:
diff changeset
383 }
5cb4fdc94146 SVGAlib support - vo_svga.c added.
se7encode
parents:
diff changeset
384 x_pos = (WIDTH - maxw) / 2;
5cb4fdc94146 SVGAlib support - vo_svga.c added.
se7encode
parents:
diff changeset
385 y_pos = (HEIGHT - maxh) / 2;
5cb4fdc94146 SVGAlib support - vo_svga.c added.
se7encode
parents:
diff changeset
386
5cb4fdc94146 SVGAlib support - vo_svga.c added.
se7encode
parents:
diff changeset
387 if (pformat == IMGFMT_YV12) {
5cb4fdc94146 SVGAlib support - vo_svga.c added.
se7encode
parents:
diff changeset
388 yuv2rgb_init(bpp, MODE_RGB);
5cb4fdc94146 SVGAlib support - vo_svga.c added.
se7encode
parents:
diff changeset
389 yuvbuf = malloc(maxw * maxh * BYTESPERPIXEL);
483
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
390 if (yuvbuf == NULL) {
485
dfafa47d751d Tons of code rewrites.
se7encode
parents: 483
diff changeset
391 printf("vo_svga: yuvbuf -> Not enough memory for buffering!\n");
407
0a5b131f1f11 24/15bpp -> 32/16bpp added.
se7encode
parents: 387
diff changeset
392 uninit();
0a5b131f1f11 24/15bpp -> 32/16bpp added.
se7encode
parents: 387
diff changeset
393 return (1);
0a5b131f1f11 24/15bpp -> 32/16bpp added.
se7encode
parents: 387
diff changeset
394 }
285
5cb4fdc94146 SVGAlib support - vo_svga.c added.
se7encode
parents:
diff changeset
395 }
377
8ad594a8c94c Bugfixes in draw_slice.
se7encode
parents: 343
diff changeset
396
504
a77e23145686 Some debug information (using verbose) added.
se7encode
parents: 502
diff changeset
397 printf("vo_svga: SVGAlib resolution: %dx%d %dbpp - ", WIDTH, HEIGHT, bpp);
293
f7e65132e296 Some bugfix.
se7encode
parents: 292
diff changeset
398 if (maxw != orig_w || maxh != orig_h) printf("Video scaled to: %dx%d\n",maxw,maxh);
285
5cb4fdc94146 SVGAlib support - vo_svga.c added.
se7encode
parents:
diff changeset
399 else printf("No video scaling\n");
5cb4fdc94146 SVGAlib support - vo_svga.c added.
se7encode
parents:
diff changeset
400
5cb4fdc94146 SVGAlib support - vo_svga.c added.
se7encode
parents:
diff changeset
401 return (0);
5cb4fdc94146 SVGAlib support - vo_svga.c added.
se7encode
parents:
diff changeset
402 }
5cb4fdc94146 SVGAlib support - vo_svga.c added.
se7encode
parents:
diff changeset
403
5cb4fdc94146 SVGAlib support - vo_svga.c added.
se7encode
parents:
diff changeset
404 static uint32_t query_format(uint32_t format) {
485
dfafa47d751d Tons of code rewrites.
se7encode
parents: 483
diff changeset
405 uint32_t res = 0;
407
0a5b131f1f11 24/15bpp -> 32/16bpp added.
se7encode
parents: 387
diff changeset
406
483
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
407 if (!checked) {
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
408 if (checksupportedmodes()) // Looking for available video modes
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
409 return(0);
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
410 }
485
dfafa47d751d Tons of code rewrites.
se7encode
parents: 483
diff changeset
411
dfafa47d751d Tons of code rewrites.
se7encode
parents: 483
diff changeset
412 // if (vo_dbpp) => There is NO conversion!!!
dfafa47d751d Tons of code rewrites.
se7encode
parents: 483
diff changeset
413 if (vo_dbpp) {
712
ea093aa3ecae -bpp bug fixed.
se7encode
parents: 620
diff changeset
414 if (format == IMGFMT_YV12) return (1);
485
dfafa47d751d Tons of code rewrites.
se7encode
parents: 483
diff changeset
415 switch (vo_dbpp) {
488
108be5ee3b1a Thanx to Arpi, There is no more YUY2 bug.
se7encode
parents: 486
diff changeset
416 case 32: if ((format == IMGFMT_RGB32) || (format == IMGFMT_BGR32))
485
dfafa47d751d Tons of code rewrites.
se7encode
parents: 483
diff changeset
417 return ((bpp_avail & BPP_32) ? 1 : 0);
dfafa47d751d Tons of code rewrites.
se7encode
parents: 483
diff changeset
418 break;
488
108be5ee3b1a Thanx to Arpi, There is no more YUY2 bug.
se7encode
parents: 486
diff changeset
419 case 24: if ((format == IMGFMT_RGB24) || (format == IMGFMT_BGR24))
485
dfafa47d751d Tons of code rewrites.
se7encode
parents: 483
diff changeset
420 return ((bpp_avail & BPP_24) ? 1 : 0);
dfafa47d751d Tons of code rewrites.
se7encode
parents: 483
diff changeset
421 break;
488
108be5ee3b1a Thanx to Arpi, There is no more YUY2 bug.
se7encode
parents: 486
diff changeset
422 case 16: if ((format == IMGFMT_RGB16) || (format == IMGFMT_BGR16))
485
dfafa47d751d Tons of code rewrites.
se7encode
parents: 483
diff changeset
423 return ((bpp_avail & BPP_16) ? 1 : 0);
dfafa47d751d Tons of code rewrites.
se7encode
parents: 483
diff changeset
424 break;
488
108be5ee3b1a Thanx to Arpi, There is no more YUY2 bug.
se7encode
parents: 486
diff changeset
425 case 15: if ((format == IMGFMT_RGB15) || (format == IMGFMT_BGR15))
485
dfafa47d751d Tons of code rewrites.
se7encode
parents: 483
diff changeset
426 return ((bpp_avail & BPP_15) ? 1 : 0);
dfafa47d751d Tons of code rewrites.
se7encode
parents: 483
diff changeset
427 break;
407
0a5b131f1f11 24/15bpp -> 32/16bpp added.
se7encode
parents: 387
diff changeset
428 }
488
108be5ee3b1a Thanx to Arpi, There is no more YUY2 bug.
se7encode
parents: 486
diff changeset
429 } else {
485
dfafa47d751d Tons of code rewrites.
se7encode
parents: 483
diff changeset
430 switch (format) {
dfafa47d751d Tons of code rewrites.
se7encode
parents: 483
diff changeset
431 case IMGFMT_RGB32:
488
108be5ee3b1a Thanx to Arpi, There is no more YUY2 bug.
se7encode
parents: 486
diff changeset
432 case IMGFMT_BGR32: return ((bpp_avail & BPP_32) ? 1 : 0); break;
485
dfafa47d751d Tons of code rewrites.
se7encode
parents: 483
diff changeset
433 case IMGFMT_RGB24:
488
108be5ee3b1a Thanx to Arpi, There is no more YUY2 bug.
se7encode
parents: 486
diff changeset
434 case IMGFMT_BGR24: {
485
dfafa47d751d Tons of code rewrites.
se7encode
parents: 483
diff changeset
435 res = (bpp_avail & BPP_24) ? 1 : 0;
dfafa47d751d Tons of code rewrites.
se7encode
parents: 483
diff changeset
436 if (!res)
dfafa47d751d Tons of code rewrites.
se7encode
parents: 483
diff changeset
437 res = (bpp_avail & BPP_32) ? 1 : 0;
dfafa47d751d Tons of code rewrites.
se7encode
parents: 483
diff changeset
438 return (res);
dfafa47d751d Tons of code rewrites.
se7encode
parents: 483
diff changeset
439 } break;
dfafa47d751d Tons of code rewrites.
se7encode
parents: 483
diff changeset
440 case IMGFMT_RGB16:
488
108be5ee3b1a Thanx to Arpi, There is no more YUY2 bug.
se7encode
parents: 486
diff changeset
441 case IMGFMT_BGR16: return ((bpp_avail & BPP_16) ? 1 : 0); break;
485
dfafa47d751d Tons of code rewrites.
se7encode
parents: 483
diff changeset
442 case IMGFMT_RGB15:
488
108be5ee3b1a Thanx to Arpi, There is no more YUY2 bug.
se7encode
parents: 486
diff changeset
443 case IMGFMT_BGR15: {
485
dfafa47d751d Tons of code rewrites.
se7encode
parents: 483
diff changeset
444 res = (bpp_avail & BPP_15) ? 1 : 0;
dfafa47d751d Tons of code rewrites.
se7encode
parents: 483
diff changeset
445 if (!res)
dfafa47d751d Tons of code rewrites.
se7encode
parents: 483
diff changeset
446 res = (bpp_avail & BPP_16) ? 1 : 0;
dfafa47d751d Tons of code rewrites.
se7encode
parents: 483
diff changeset
447 return (res);
dfafa47d751d Tons of code rewrites.
se7encode
parents: 483
diff changeset
448 } break;
dfafa47d751d Tons of code rewrites.
se7encode
parents: 483
diff changeset
449 case IMGFMT_YV12: return (1); break;
285
5cb4fdc94146 SVGAlib support - vo_svga.c added.
se7encode
parents:
diff changeset
450 }
488
108be5ee3b1a Thanx to Arpi, There is no more YUY2 bug.
se7encode
parents: 486
diff changeset
451 }
285
5cb4fdc94146 SVGAlib support - vo_svga.c added.
se7encode
parents:
diff changeset
452 return (0);
5cb4fdc94146 SVGAlib support - vo_svga.c added.
se7encode
parents:
diff changeset
453 }
5cb4fdc94146 SVGAlib support - vo_svga.c added.
se7encode
parents:
diff changeset
454
5cb4fdc94146 SVGAlib support - vo_svga.c added.
se7encode
parents:
diff changeset
455 static const vo_info_t* get_info(void) {
5cb4fdc94146 SVGAlib support - vo_svga.c added.
se7encode
parents:
diff changeset
456 return (&vo_info);
5cb4fdc94146 SVGAlib support - vo_svga.c added.
se7encode
parents:
diff changeset
457 }
5cb4fdc94146 SVGAlib support - vo_svga.c added.
se7encode
parents:
diff changeset
458
5cb4fdc94146 SVGAlib support - vo_svga.c added.
se7encode
parents:
diff changeset
459 static void draw_alpha(int x0, int y0, int w, int h, unsigned char *src,
5cb4fdc94146 SVGAlib support - vo_svga.c added.
se7encode
parents:
diff changeset
460 unsigned char *srca, int stride) {
327
e7731f5c76cc OSD renderers for all modes added.
se7encode
parents: 293
diff changeset
461 switch (bpp) {
e7731f5c76cc OSD renderers for all modes added.
se7encode
parents: 293
diff changeset
462 case 32:
e7731f5c76cc OSD renderers for all modes added.
se7encode
parents: 293
diff changeset
463 vo_draw_alpha_rgb32(w, h, src, srca, stride, virt->vbuf+4*(y0*WIDTH+x0), 4*WIDTH);
e7731f5c76cc OSD renderers for all modes added.
se7encode
parents: 293
diff changeset
464 break;
e7731f5c76cc OSD renderers for all modes added.
se7encode
parents: 293
diff changeset
465 case 24:
e7731f5c76cc OSD renderers for all modes added.
se7encode
parents: 293
diff changeset
466 vo_draw_alpha_rgb24(w, h, src, srca, stride, virt->vbuf+3*(y0*WIDTH+x0), 3*WIDTH);
e7731f5c76cc OSD renderers for all modes added.
se7encode
parents: 293
diff changeset
467 break;
e7731f5c76cc OSD renderers for all modes added.
se7encode
parents: 293
diff changeset
468 case 16:
e7731f5c76cc OSD renderers for all modes added.
se7encode
parents: 293
diff changeset
469 vo_draw_alpha_rgb16(w, h, src, srca, stride, virt->vbuf+2*(y0*WIDTH+x0), 2*WIDTH);
e7731f5c76cc OSD renderers for all modes added.
se7encode
parents: 293
diff changeset
470 break;
e7731f5c76cc OSD renderers for all modes added.
se7encode
parents: 293
diff changeset
471 case 15:
e7731f5c76cc OSD renderers for all modes added.
se7encode
parents: 293
diff changeset
472 vo_draw_alpha_rgb15(w, h, src, srca, stride, virt->vbuf+2*(y0*WIDTH+x0), 2*WIDTH);
e7731f5c76cc OSD renderers for all modes added.
se7encode
parents: 293
diff changeset
473 break;
e7731f5c76cc OSD renderers for all modes added.
se7encode
parents: 293
diff changeset
474 }
285
5cb4fdc94146 SVGAlib support - vo_svga.c added.
se7encode
parents:
diff changeset
475 }
5cb4fdc94146 SVGAlib support - vo_svga.c added.
se7encode
parents:
diff changeset
476
5cb4fdc94146 SVGAlib support - vo_svga.c added.
se7encode
parents:
diff changeset
477 static uint32_t draw_frame(uint8_t *src[]) {
5cb4fdc94146 SVGAlib support - vo_svga.c added.
se7encode
parents:
diff changeset
478 if (pformat == IMGFMT_YV12) {
5cb4fdc94146 SVGAlib support - vo_svga.c added.
se7encode
parents:
diff changeset
479 yuv2rgb(yuvbuf, src[0], src[1], src[2], orig_w, orig_h, orig_w * BYTESPERPIXEL, orig_w, orig_w / 2);
5cb4fdc94146 SVGAlib support - vo_svga.c added.
se7encode
parents:
diff changeset
480 src[0] = yuvbuf;
5cb4fdc94146 SVGAlib support - vo_svga.c added.
se7encode
parents:
diff changeset
481 }
483
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
482 if (scalebuf != NULL) {
285
5cb4fdc94146 SVGAlib support - vo_svga.c added.
se7encode
parents:
diff changeset
483 gl_scalebox(orig_w, orig_h, src[0], maxw, maxh, scalebuf);
5cb4fdc94146 SVGAlib support - vo_svga.c added.
se7encode
parents:
diff changeset
484 src[0] = scalebuf;
5cb4fdc94146 SVGAlib support - vo_svga.c added.
se7encode
parents:
diff changeset
485 }
407
0a5b131f1f11 24/15bpp -> 32/16bpp added.
se7encode
parents: 387
diff changeset
486 if (bpp_conv) {
0a5b131f1f11 24/15bpp -> 32/16bpp added.
se7encode
parents: 387
diff changeset
487 switch(bpp) {
485
dfafa47d751d Tons of code rewrites.
se7encode
parents: 483
diff changeset
488 case 32: {
620
b623949ddedb Some names, types changed.
se7encode
parents: 619
diff changeset
489 uint8_t *source = src[0];
b623949ddedb Some names, types changed.
se7encode
parents: 619
diff changeset
490 uint8_t *dest = bppbuf;
b623949ddedb Some names, types changed.
se7encode
parents: 619
diff changeset
491 register uint32_t i = 0;
502
75c689abb763 Maybe a little speedup.
se7encode
parents: 488
diff changeset
492
620
b623949ddedb Some names, types changed.
se7encode
parents: 619
diff changeset
493 while (i < (maxw * maxh * 4)) {
b623949ddedb Some names, types changed.
se7encode
parents: 619
diff changeset
494 dest[i] = source[i];
b623949ddedb Some names, types changed.
se7encode
parents: 619
diff changeset
495 dest[i+1] = source[i+1];
b623949ddedb Some names, types changed.
se7encode
parents: 619
diff changeset
496 dest[i+2] = source[i+2];
b623949ddedb Some names, types changed.
se7encode
parents: 619
diff changeset
497 dest[i+3] = 0;
b623949ddedb Some names, types changed.
se7encode
parents: 619
diff changeset
498 i += 4;
407
0a5b131f1f11 24/15bpp -> 32/16bpp added.
se7encode
parents: 387
diff changeset
499 }
485
dfafa47d751d Tons of code rewrites.
se7encode
parents: 483
diff changeset
500 } break;
dfafa47d751d Tons of code rewrites.
se7encode
parents: 483
diff changeset
501 case 16: {
2556
71934dc06490 Using new stuff of rgb15to16
nick
parents: 1512
diff changeset
502 rgb15to16(src[0],bppbuf,maxw * maxh * 2);
485
dfafa47d751d Tons of code rewrites.
se7encode
parents: 483
diff changeset
503 } break;
407
0a5b131f1f11 24/15bpp -> 32/16bpp added.
se7encode
parents: 387
diff changeset
504 }
0a5b131f1f11 24/15bpp -> 32/16bpp added.
se7encode
parents: 387
diff changeset
505 src[0] = bppbuf;
0a5b131f1f11 24/15bpp -> 32/16bpp added.
se7encode
parents: 387
diff changeset
506 }
285
5cb4fdc94146 SVGAlib support - vo_svga.c added.
se7encode
parents:
diff changeset
507 gl_putbox(x_pos, y_pos, maxw, maxh, src[0]);
617
33b559940fb4 *** empty log message ***
se7encode
parents: 616
diff changeset
508
33b559940fb4 *** empty log message ***
se7encode
parents: 616
diff changeset
509 return (0);
285
5cb4fdc94146 SVGAlib support - vo_svga.c added.
se7encode
parents:
diff changeset
510 }
5cb4fdc94146 SVGAlib support - vo_svga.c added.
se7encode
parents:
diff changeset
511
5cb4fdc94146 SVGAlib support - vo_svga.c added.
se7encode
parents:
diff changeset
512 static uint32_t draw_slice(uint8_t *image[], int stride[],
5cb4fdc94146 SVGAlib support - vo_svga.c added.
se7encode
parents:
diff changeset
513 int w, int h, int x, int y) {
5cb4fdc94146 SVGAlib support - vo_svga.c added.
se7encode
parents:
diff changeset
514 uint8_t *src = yuvbuf;
377
8ad594a8c94c Bugfixes in draw_slice.
se7encode
parents: 343
diff changeset
515 uint32_t sw, sh;
8ad594a8c94c Bugfixes in draw_slice.
se7encode
parents: 343
diff changeset
516
875
c1cd62f01b2f removed emms() and reordered stuff
arpi_esp
parents: 874
diff changeset
517 yuv2rgb(yuvbuf, image[0], image[1], image[2], w, h, orig_w * BYTESPERPIXEL, stride[0], stride[1]);
377
8ad594a8c94c Bugfixes in draw_slice.
se7encode
parents: 343
diff changeset
518 sw = (uint32_t) (w * scaling);
8ad594a8c94c Bugfixes in draw_slice.
se7encode
parents: 343
diff changeset
519 sh = (uint32_t) (h * scaling);
483
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
520 if (scalebuf != NULL) {
377
8ad594a8c94c Bugfixes in draw_slice.
se7encode
parents: 343
diff changeset
521 gl_scalebox(w, h, yuvbuf, sw, sh, scalebuf);
285
5cb4fdc94146 SVGAlib support - vo_svga.c added.
se7encode
parents:
diff changeset
522 src = scalebuf;
5cb4fdc94146 SVGAlib support - vo_svga.c added.
se7encode
parents:
diff changeset
523 }
377
8ad594a8c94c Bugfixes in draw_slice.
se7encode
parents: 343
diff changeset
524 gl_putbox((int)(x * scaling) + x_pos, (int)(y * scaling) + y_pos, sw, sh, src);
617
33b559940fb4 *** empty log message ***
se7encode
parents: 616
diff changeset
525
33b559940fb4 *** empty log message ***
se7encode
parents: 616
diff changeset
526 return (0);
285
5cb4fdc94146 SVGAlib support - vo_svga.c added.
se7encode
parents:
diff changeset
527 }
5cb4fdc94146 SVGAlib support - vo_svga.c added.
se7encode
parents:
diff changeset
528
1501
d40f2b686846 changes according to -utf8 option, draw_osd() function added
atlka
parents: 1339
diff changeset
529 static void draw_osd(void)
d40f2b686846 changes according to -utf8 option, draw_osd() function added
atlka
parents: 1339
diff changeset
530 {
292
2c0bb83b77b3 Some bugfix.
se7encode
parents: 290
diff changeset
531 if (y_pos) {
2c0bb83b77b3 Some bugfix.
se7encode
parents: 290
diff changeset
532 gl_fillbox(0, 0, WIDTH, y_pos, 0);
2c0bb83b77b3 Some bugfix.
se7encode
parents: 290
diff changeset
533 gl_fillbox(0, HEIGHT - y_pos, WIDTH, y_pos, 0);
1512
d3364cc1f792 small changes to erase only needed place (rectangles doesn't overlap)
atlka
parents: 1501
diff changeset
534 if (x_pos) {
d3364cc1f792 small changes to erase only needed place (rectangles doesn't overlap)
atlka
parents: 1501
diff changeset
535 int hmy=HEIGHT - (y_pos<<1);
d3364cc1f792 small changes to erase only needed place (rectangles doesn't overlap)
atlka
parents: 1501
diff changeset
536 gl_fillbox(0, y_pos, x_pos, hmy, 0);
d3364cc1f792 small changes to erase only needed place (rectangles doesn't overlap)
atlka
parents: 1501
diff changeset
537 gl_fillbox(WIDTH - x_pos, y_pos, x_pos, hmy, 0);
d3364cc1f792 small changes to erase only needed place (rectangles doesn't overlap)
atlka
parents: 1501
diff changeset
538 }
d3364cc1f792 small changes to erase only needed place (rectangles doesn't overlap)
atlka
parents: 1501
diff changeset
539 } else if (x_pos) {
d3364cc1f792 small changes to erase only needed place (rectangles doesn't overlap)
atlka
parents: 1501
diff changeset
540 gl_fillbox(0, y_pos, x_pos, HEIGHT, 0);
d3364cc1f792 small changes to erase only needed place (rectangles doesn't overlap)
atlka
parents: 1501
diff changeset
541 gl_fillbox(WIDTH - x_pos, y_pos, x_pos, HEIGHT, 0);
989
1be1647ebd7d flip_page gl_fillbox fix.
se7encode
parents: 976
diff changeset
542 }
1be1647ebd7d flip_page gl_fillbox fix.
se7encode
parents: 976
diff changeset
543
486
4f52aa06f0fc A couple of bugfixes.
se7encode
parents: 485
diff changeset
544 vo_draw_text(WIDTH, HEIGHT, draw_alpha);
1501
d40f2b686846 changes according to -utf8 option, draw_osd() function added
atlka
parents: 1339
diff changeset
545 }
d40f2b686846 changes according to -utf8 option, draw_osd() function added
atlka
parents: 1339
diff changeset
546
d40f2b686846 changes according to -utf8 option, draw_osd() function added
atlka
parents: 1339
diff changeset
547 static void flip_page(void) {
285
5cb4fdc94146 SVGAlib support - vo_svga.c added.
se7encode
parents:
diff changeset
548 gl_copyscreen(screen);
5cb4fdc94146 SVGAlib support - vo_svga.c added.
se7encode
parents:
diff changeset
549 }
5cb4fdc94146 SVGAlib support - vo_svga.c added.
se7encode
parents:
diff changeset
550
5cb4fdc94146 SVGAlib support - vo_svga.c added.
se7encode
parents:
diff changeset
551 static void check_events(void) {
5cb4fdc94146 SVGAlib support - vo_svga.c added.
se7encode
parents:
diff changeset
552 }
5cb4fdc94146 SVGAlib support - vo_svga.c added.
se7encode
parents:
diff changeset
553
5cb4fdc94146 SVGAlib support - vo_svga.c added.
se7encode
parents:
diff changeset
554 static void uninit(void) {
483
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
555 vga_modelist_t *list = modelist;
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
556
285
5cb4fdc94146 SVGAlib support - vo_svga.c added.
se7encode
parents:
diff changeset
557 gl_freecontext(screen);
5cb4fdc94146 SVGAlib support - vo_svga.c added.
se7encode
parents:
diff changeset
558 gl_freecontext(virt);
5cb4fdc94146 SVGAlib support - vo_svga.c added.
se7encode
parents:
diff changeset
559 vga_setmode(TEXT);
483
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
560 if (bppbuf != NULL)
407
0a5b131f1f11 24/15bpp -> 32/16bpp added.
se7encode
parents: 387
diff changeset
561 free(bppbuf);
483
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
562 if (scalebuf != NULL)
285
5cb4fdc94146 SVGAlib support - vo_svga.c added.
se7encode
parents:
diff changeset
563 free(scalebuf);
483
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
564 if (yuvbuf != NULL)
285
5cb4fdc94146 SVGAlib support - vo_svga.c added.
se7encode
parents:
diff changeset
565 free(yuvbuf);
1501
d40f2b686846 changes according to -utf8 option, draw_osd() function added
atlka
parents: 1339
diff changeset
566 while (modelist != NULL) {
d40f2b686846 changes according to -utf8 option, draw_osd() function added
atlka
parents: 1339
diff changeset
567 list=modelist;
d40f2b686846 changes according to -utf8 option, draw_osd() function added
atlka
parents: 1339
diff changeset
568 modelist=modelist->next;
d40f2b686846 changes according to -utf8 option, draw_osd() function added
atlka
parents: 1339
diff changeset
569 free(list);
483
92f170c8b9ba fix to newest revision after cvs rollback
atmosfear
parents: 448
diff changeset
570 }
285
5cb4fdc94146 SVGAlib support - vo_svga.c added.
se7encode
parents:
diff changeset
571 }
4352
ed5b85b713a3 Extensions for video accelerated architecture
nick
parents: 2982
diff changeset
572
ed5b85b713a3 Extensions for video accelerated architecture
nick
parents: 2982
diff changeset
573 static uint32_t preinit(const char *arg)
ed5b85b713a3 Extensions for video accelerated architecture
nick
parents: 2982
diff changeset
574 {
ed5b85b713a3 Extensions for video accelerated architecture
nick
parents: 2982
diff changeset
575 return 0;
ed5b85b713a3 Extensions for video accelerated architecture
nick
parents: 2982
diff changeset
576 }
ed5b85b713a3 Extensions for video accelerated architecture
nick
parents: 2982
diff changeset
577
4596
c35d7ce151b3 10000hl to Holm... control MUST BE static...
arpi
parents: 4592
diff changeset
578 static uint32_t control(uint32_t request, void *data, ...)
4352
ed5b85b713a3 Extensions for video accelerated architecture
nick
parents: 2982
diff changeset
579 {
4592
5fbfd8545c3b query_ stuff replaced by new control() - patch by David Holm
arpi
parents: 4433
diff changeset
580 switch (request) {
5fbfd8545c3b query_ stuff replaced by new control() - patch by David Holm
arpi
parents: 4433
diff changeset
581 case VOCTRL_QUERY_FORMAT:
5fbfd8545c3b query_ stuff replaced by new control() - patch by David Holm
arpi
parents: 4433
diff changeset
582 return query_format(*((uint32_t*)data));
5fbfd8545c3b query_ stuff replaced by new control() - patch by David Holm
arpi
parents: 4433
diff changeset
583 }
5fbfd8545c3b query_ stuff replaced by new control() - patch by David Holm
arpi
parents: 4433
diff changeset
584 return VO_NOTIMPL;
4352
ed5b85b713a3 Extensions for video accelerated architecture
nick
parents: 2982
diff changeset
585 }