annotate libvo/vo_kva.c @ 29057:a71ce6c36d8e

sync with en/mplayer.1 r29059
author jrash
date Sun, 29 Mar 2009 12:28:46 +0000
parents c2baa796c5e5
children 6a0a30aa2b4a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
28915
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1 /*
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
2 * OS/2 video output driver
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
3 *
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
4 * Copyright (c) 2007-2009 by KO Myung-Hun (komh@chollian.net)
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
5 *
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
6 * This file is part of MPlayer.
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
7 *
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
8 * MPlayer is free software; you can redistribute it and/or modify
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
9 * it under the terms of the GNU General Public License as published by
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
10 * the Free Software Foundation; either version 2 of the License, or
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
11 * (at your option) any later version.
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
12 *
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
13 * MPlayer is distributed in the hope that it will be useful,
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
16 * GNU General Public License for more details.
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
17 *
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
18 * You should have received a copy of the GNU General Public License along
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
19 * with MPlayer; if not, write to the Free Software Foundation, Inc.,
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
20 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
21 */
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
22
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
23 #define INCL_WIN
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
24 #define INCL_GPI
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
25 #define INCL_DOS
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
26 #include <os2.h>
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
27
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
28 #include <mmioos2.h>
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
29 #include <fourcc.h>
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
30
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
31 #include <stdio.h>
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
32 #include <stdlib.h>
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
33 #include <string.h>
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
34 #include <float.h>
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
35
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
36 #include <kva.h>
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
37
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
38 #include "config.h"
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
39 #include "mp_msg.h"
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
40 #include "help_mp.h"
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
41 #include "video_out.h"
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
42 #include "video_out_internal.h"
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
43 #include "aspect.h"
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
44
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
45 #include "fastmemcpy.h"
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
46 #include "mp_fifo.h"
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
47 #include "osdep/keycodes.h"
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
48 #include "input/input.h"
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
49 #include "input/mouse.h"
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
50 #include "subopt-helper.h"
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
51 #include "sub.h"
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
52
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
53 #include "cpudetect.h"
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
54 #include "libswscale/swscale.h"
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
55 #include "libmpcodecs/vf_scale.h"
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
56
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
57 static const vo_info_t info = {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
58 "SNAP/WarpOverlay!/DIVE video output",
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
59 "kva",
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
60 "KO Myung-Hun <komh@chollian.net>",
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
61 ""
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
62 };
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
63
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
64 LIBVO_EXTERN(kva)
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
65
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
66 #define WC_MPLAYER "WC_MPLAYER"
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
67
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
68 #define SRC_WIDTH m_int.kvas.szlSrcSize.cx
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
69 #define SRC_HEIGHT m_int.kvas.szlSrcSize.cy
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
70
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
71 #define HWNDFROMWINID(wid) ((wid) + 0x80000000UL)
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
72
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
73 static const struct keymap m_vk_map[] = {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
74 {VK_NEWLINE, KEY_ENTER}, {VK_TAB, KEY_TAB}, {VK_SPACE, ' '},
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
75
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
76 // control keys
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
77 {VK_CTRL, KEY_CTRL}, {VK_BACKSPACE, KEY_BS},
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
78 {VK_DELETE, KEY_DELETE}, {VK_INSERT, KEY_INSERT},
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
79 {VK_HOME, KEY_HOME}, {VK_END, KEY_END},
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
80 {VK_PAGEUP, KEY_PAGE_UP}, {VK_PAGEDOWN, KEY_PAGE_DOWN},
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
81 {VK_ESC, KEY_ESC},
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
82
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
83 // cursor keys
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
84 {VK_RIGHT, KEY_RIGHT}, {VK_LEFT, KEY_LEFT},
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
85 {VK_DOWN, KEY_DOWN}, {VK_UP, KEY_UP},
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
86
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
87 // function keys
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
88 {VK_F1, KEY_F+1}, {VK_F2, KEY_F+2}, {VK_F3, KEY_F+3}, {VK_F4, KEY_F+4},
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
89 {VK_F5, KEY_F+5}, {VK_F6, KEY_F+6}, {VK_F7, KEY_F+7}, {VK_F8, KEY_F+8},
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
90 {VK_F9, KEY_F+9}, {VK_F10, KEY_F+10}, {VK_F11, KEY_F+11}, {VK_F12, KEY_F+12},
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
91
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
92 {0, 0}
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
93 };
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
94
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
95 static const struct keymap m_keypad_map[] = {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
96 // keypad keys
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
97 {0x52, KEY_KP0}, {0x4F, KEY_KP1}, {0x50, KEY_KP2}, {0x51, KEY_KP3},
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
98 {0x4B, KEY_KP4}, {0x4C, KEY_KP5}, {0x4D, KEY_KP6}, {0x47, KEY_KP7},
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
99 {0x48, KEY_KP8}, {0x49, KEY_KP9}, {0x53, KEY_KPDEC}, {0x5A, KEY_KPENTER},
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
100
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
101 {0, 0}
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
102 };
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
103
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
104 static const struct keymap m_mouse_map[] = {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
105 {WM_BUTTON1DOWN, MOUSE_BTN0},
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
106 {WM_BUTTON3DOWN, MOUSE_BTN1},
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
107 {WM_BUTTON2DOWN, MOUSE_BTN2},
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
108 {WM_BUTTON1DBLCLK, MOUSE_BTN0_DBL},
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
109 {WM_BUTTON3DBLCLK, MOUSE_BTN1_DBL},
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
110 {WM_BUTTON2DBLCLK, MOUSE_BTN2_DBL},
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
111
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
112 {0, 0}
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
113 };
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
114
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
115 struct {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
116 HAB hab;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
117 HMQ hmq;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
118 HWND hwndFrame;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
119 HWND hwndClient;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
120 HWND hwndSysMenu;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
121 HWND hwndTitleBar;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
122 HWND hwndMinMax;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
123 FOURCC fcc;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
124 int iImageFormat;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
125 int nChromaShift;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
126 KVASETUP kvas;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
127 KVACAPS kvac;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
128 RECTL rclDst;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
129 int bpp;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
130 LONG lStride;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
131 PBYTE pbImage;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
132 BOOL fFixT23;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
133 PFNWP pfnwpOldFrame;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
134 uint8_t *planes[3]; // y = 0, u = 1, v = 2
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
135 int stride[3];
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
136 BOOL fHWAccel;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
137 RECTL rclParent;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
138 struct SwsContext *sws;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
139 } m_int;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
140
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
141 static inline void setAspectRatio(ULONG ulRatio)
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
142 {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
143 m_int.kvas.ulRatio = ulRatio;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
144 kvaSetup(&m_int.kvas);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
145 }
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
146
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
147 static int query_format_info(int format, PBOOL pfHWAccel, PFOURCC pfcc,
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
148 int *pbpp, int *pnChromaShift)
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
149 {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
150 BOOL fHWAccel;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
151 FOURCC fcc;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
152 INT bpp;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
153 INT nChromaShift;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
154
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
155 switch (format) {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
156 case IMGFMT_YV12:
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
157 fHWAccel = m_int.kvac.ulInputFormatFlags & KVAF_YV12;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
158 fcc = FOURCC_YV12;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
159 bpp = 1;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
160 nChromaShift = 1;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
161 break;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
162
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
163 case IMGFMT_YUY2:
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
164 fHWAccel = m_int.kvac.ulInputFormatFlags & KVAF_YUY2;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
165 fcc = FOURCC_Y422;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
166 bpp = 2;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
167 nChromaShift = 0;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
168 break;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
169
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
170 case IMGFMT_YVU9:
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
171 fHWAccel = m_int.kvac.ulInputFormatFlags & KVAF_YVU9;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
172 fcc = FOURCC_YVU9;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
173 bpp = 1;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
174 nChromaShift = 2;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
175 break;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
176
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
177 case IMGFMT_BGR24:
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
178 fHWAccel = m_int.kvac.ulInputFormatFlags & KVAF_BGR24;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
179 fcc = FOURCC_BGR3;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
180 bpp = 3;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
181 nChromaShift = 0;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
182 break;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
183
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
184 case IMGFMT_BGR16:
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
185 fHWAccel = m_int.kvac.ulInputFormatFlags & KVAF_BGR16;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
186 fcc = FOURCC_R565;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
187 bpp = 2;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
188 nChromaShift = 0;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
189 break;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
190
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
191 case IMGFMT_BGR15:
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
192 fHWAccel = m_int.kvac.ulInputFormatFlags & KVAF_BGR15;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
193 fcc = FOURCC_R555;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
194 bpp = 2;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
195 nChromaShift = 0;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
196 break;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
197
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
198 default:
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
199 return 1;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
200 }
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
201
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
202 if (pfHWAccel)
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
203 *pfHWAccel = fHWAccel;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
204
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
205 if (pfcc)
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
206 *pfcc = fcc;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
207
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
208 if (pbpp)
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
209 *pbpp = bpp;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
210
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
211 if (pnChromaShift)
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
212 *pnChromaShift = nChromaShift;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
213
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
214 return 0;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
215 }
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
216
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
217 static void imgCreate(void)
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
218 {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
219 int size = SRC_HEIGHT * m_int.lStride;;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
220
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
221 switch (m_int.iImageFormat) {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
222 case IMGFMT_YV12:
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
223 size += size / 2;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
224 break;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
225
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
226 case IMGFMT_YVU9:
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
227 size += size / 8;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
228 break;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
229 }
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
230
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
231 m_int.pbImage = malloc(size);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
232
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
233 m_int.planes[0] = m_int.pbImage;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
234 m_int.stride[0] = m_int.lStride;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
235
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
236 // YV12 or YVU9 ?
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
237 if (m_int.nChromaShift) {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
238 m_int.planes[1] = m_int.planes[0] + SRC_HEIGHT * m_int.stride[0];
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
239 m_int.stride[1] = m_int.stride[0] >> m_int.nChromaShift;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
240
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
241 m_int.planes[2] = m_int.planes[1] +
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
242 (SRC_HEIGHT >> m_int.nChromaShift) * m_int.stride[1];
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
243 m_int.stride[2] = m_int.stride[1];
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
244 }
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
245 }
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
246
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
247 static void imgFree(void)
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
248 {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
249 free(m_int.pbImage);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
250
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
251 m_int.pbImage = NULL;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
252 }
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
253
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
254 static void imgDisplay(void)
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
255 {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
256 PVOID pBuffer;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
257 ULONG ulBPL;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
258
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
259 if (!kvaLockBuffer(&pBuffer, &ulBPL)) {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
260 uint8_t *dst[3];
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
261 int dstStride[3];
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
262
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
263 // Get packed or Y
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
264 dst[0] = pBuffer;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
265 dstStride[0] = ulBPL;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
266
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
267 // YV12 or YVU9 ?
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
268 if (m_int.nChromaShift) {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
269 // Get V
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
270 dst[2] = dst[0] + SRC_HEIGHT * dstStride[0];
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
271 dstStride[2] = dstStride[0] >> m_int.nChromaShift;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
272
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
273 // Get U
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
274 dst[1] = dst[2] +
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
275 (SRC_HEIGHT >> m_int.nChromaShift ) * dstStride[2];
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
276 dstStride[1] = dstStride[2];
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
277 }
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
278
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
279 if (m_int.fHWAccel) {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
280 int w, h;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
281
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
282 w = m_int.stride[0];
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
283 h = SRC_HEIGHT;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
284
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
285 // Copy packed or Y
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
286 mem2agpcpy_pic(dst[0], m_int.planes[0], w, h,
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
287 dstStride[0], m_int.stride[0]);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
288
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
289 // YV12 or YVU9 ?
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
290 if (m_int.nChromaShift) {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
291 w >>= m_int.nChromaShift; h >>= m_int.nChromaShift;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
292
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
293 // Copy U
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
294 mem2agpcpy_pic(dst[1], m_int.planes[1], w, h,
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
295 dstStride[1], m_int.stride[1]);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
296
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
297 // Copy V
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
298 mem2agpcpy_pic(dst[2], m_int.planes[2], w, h,
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
299 dstStride[2], m_int.stride[2]);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
300 }
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
301 } else {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
302 sws_scale(m_int.sws, m_int.planes, m_int.stride, 0, SRC_HEIGHT,
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
303 dst, dstStride);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
304 }
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
305
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
306 kvaUnlockBuffer();
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
307 }
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
308 }
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
309
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
310 // Frame window procedure to work around T23 laptop with S3 video card,
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
311 // which supports upscaling only.
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
312 static MRESULT EXPENTRY NewFrameWndProc(HWND hwnd, ULONG msg, MPARAM mp1,
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
313 MPARAM mp2)
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
314 {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
315 switch (msg) {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
316 case WM_QUERYTRACKINFO:
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
317 {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
318 PTRACKINFO pti = (PTRACKINFO)mp2;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
319 RECTL rcl;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
320
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
321 if (vo_fs)
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
322 break;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
323
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
324 m_int.pfnwpOldFrame(hwnd, msg, mp1, mp2);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
325
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
326 rcl.xLeft = 0;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
327 rcl.yBottom = 0;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
328 rcl.xRight = SRC_WIDTH + 1;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
329 rcl.yTop = SRC_HEIGHT + 1;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
330
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
331 WinCalcFrameRect(hwnd, &rcl, FALSE);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
332
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
333 pti->ptlMinTrackSize.x = rcl.xRight - rcl.xLeft;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
334 pti->ptlMinTrackSize.y = rcl.yTop - rcl.yBottom;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
335
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
336 pti->ptlMaxTrackSize.x = vo_screenwidth;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
337 pti->ptlMaxTrackSize.y = vo_screenheight;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
338
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
339 return (MRESULT)TRUE;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
340 }
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
341
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
342 case WM_ADJUSTWINDOWPOS:
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
343 {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
344 PSWP pswp = (PSWP)mp1;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
345 RECTL rcl;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
346
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
347 if (vo_fs)
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
348 break;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
349
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
350 if (pswp->fl & SWP_SIZE) {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
351 rcl.xLeft = pswp->x;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
352 rcl.yBottom = pswp->y;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
353 rcl.xRight = rcl.xLeft + pswp->cx;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
354 rcl.yTop = rcl.yBottom + pswp->cy;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
355
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
356 WinCalcFrameRect(hwnd, &rcl, TRUE);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
357
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
358 if (rcl.xRight - rcl.xLeft <= SRC_WIDTH)
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
359 rcl.xRight = rcl.xLeft + (SRC_WIDTH + 1);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
360
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
361 if (rcl.yTop - rcl.yBottom <= SRC_HEIGHT)
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
362 rcl.yTop = rcl.yBottom + (SRC_HEIGHT + 1);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
363
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
364 WinCalcFrameRect(hwnd, &rcl, FALSE);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
365
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
366 if (rcl.xRight - rcl.xLeft > vo_screenwidth) {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
367 rcl.xLeft = 0;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
368 rcl.xRight = vo_screenwidth;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
369 }
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
370
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
371 if (rcl.yTop - rcl.yBottom > vo_screenheight) {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
372 rcl.yBottom = 0;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
373 rcl.yTop = vo_screenheight;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
374 }
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
375
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
376 pswp->fl |= SWP_MOVE;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
377 pswp->x = rcl.xLeft;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
378 pswp->y = rcl.yBottom;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
379 pswp->cx = rcl.xRight - rcl.xLeft;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
380 pswp->cy = rcl.yTop - rcl.yBottom;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
381 }
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
382 break;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
383 }
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
384 }
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
385
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
386 return m_int.pfnwpOldFrame(hwnd, msg, mp1, mp2);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
387 }
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
388
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
389 static MRESULT EXPENTRY WndProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
390 {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
391 // if slave mode, ignore mouse events and deliver them to a parent window
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
392 if (WinID != -1 &&
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
393 ((msg >= WM_MOUSEFIRST && msg <= WM_MOUSELAST) ||
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
394 (msg >= WM_EXTMOUSEFIRST && msg <= WM_EXTMOUSELAST))) {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
395 WinPostMsg(HWNDFROMWINID(WinID), msg, mp1, mp2);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
396
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
397 return (MRESULT)TRUE;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
398 }
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
399
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
400 switch (msg) {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
401 case WM_CLOSE:
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
402 mplayer_put_key(KEY_CLOSE_WIN);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
403
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
404 return 0;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
405
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
406 case WM_CHAR:
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
407 {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
408 USHORT fsFlags = SHORT1FROMMP(mp1);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
409 UCHAR uchScan = CHAR4FROMMP(mp1);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
410 USHORT usCh = SHORT1FROMMP(mp2);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
411 USHORT usVk = SHORT2FROMMP(mp2);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
412 int mpkey;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
413
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
414 if (fsFlags & KC_KEYUP)
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
415 break;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
416
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
417 if (fsFlags & KC_SCANCODE) {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
418 mpkey = lookup_keymap_table(m_keypad_map, uchScan);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
419 if (mpkey) {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
420 // distinguish KEY_KP0 and KEY_KPINS
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
421 if (mpkey == KEY_KP0 && usCh != '0')
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
422 mpkey = KEY_KPINS;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
423
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
424 // distinguish KEY_KPDEC and KEY_KPDEL
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
425 if (mpkey == KEY_KPDEC && usCh != '.')
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
426 mpkey = KEY_KPDEL;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
427
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
428 mplayer_put_key(mpkey);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
429
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
430 return (MRESULT)TRUE;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
431 }
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
432 }
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
433
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
434 if (fsFlags & KC_VIRTUALKEY) {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
435 mpkey = lookup_keymap_table(m_vk_map, usVk);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
436 if (mpkey) {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
437 mplayer_put_key(mpkey);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
438
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
439 return (MRESULT)TRUE;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
440 }
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
441 }
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
442
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
443 if ((fsFlags & KC_CHAR) && !HIBYTE(usCh))
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
444 mplayer_put_key(usCh);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
445
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
446 return (MRESULT)TRUE;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
447 }
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
448
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
449 case WM_BUTTON1DOWN:
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
450 case WM_BUTTON3DOWN:
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
451 case WM_BUTTON2DOWN:
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
452 case WM_BUTTON1DBLCLK:
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
453 case WM_BUTTON3DBLCLK:
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
454 case WM_BUTTON2DBLCLK:
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
455 if (WinQueryFocus(HWND_DESKTOP) != hwnd)
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
456 WinSetFocus(HWND_DESKTOP, hwnd);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
457 else if (!vo_nomouse_input)
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
458 mplayer_put_key(lookup_keymap_table(m_mouse_map, msg));
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
459
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
460 return (MRESULT)TRUE;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
461
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
462 case WM_PAINT:
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
463 {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
464 HPS hps;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
465 RECTL rcl, rclDst;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
466 PRECTL prcl = NULL;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
467 HRGN hrgn, hrgnDst;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
468 RGNRECT rgnCtl;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
469
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
470 // get a current movie area
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
471 kvaAdjustDstRect(&m_int.kvas.rclSrcRect, &rclDst);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
472
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
473 // get a current invalidated area
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
474 hps = WinBeginPaint(hwnd, NULLHANDLE, &rcl);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
475
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
476 // create a region for an invalidated area
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
477 hrgn = GpiCreateRegion(hps, 1, &rcl);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
478 // create a region for a movie area
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
479 hrgnDst = GpiCreateRegion(hps, 1, &rclDst);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
480
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
481 // exclude a movie area from an invalidated area
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
482 GpiCombineRegion(hps, hrgn, hrgn, hrgnDst, CRGN_DIFF);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
483
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
484 // get rectangles from the region
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
485 rgnCtl.ircStart = 1;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
486 rgnCtl.ulDirection = RECTDIR_LFRT_TOPBOT;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
487 GpiQueryRegionRects(hps, hrgn, NULL, &rgnCtl, NULL);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
488
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
489 if (rgnCtl.crcReturned > 0) {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
490 rgnCtl.crc = rgnCtl.crcReturned;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
491 prcl = malloc(sizeof(RECTL) * rgnCtl.crcReturned);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
492 }
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
493
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
494 // draw black bar if needed
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
495 if (prcl && GpiQueryRegionRects(hps, hrgn, NULL, &rgnCtl, prcl)) {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
496 int i;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
497
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
498 for (i = 0; i < rgnCtl.crcReturned; i++)
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
499 WinFillRect(hps, &prcl[i], CLR_BLACK);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
500 }
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
501
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
502 free(prcl);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
503
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
504 GpiDestroyRegion(hps, hrgnDst);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
505 GpiDestroyRegion(hps, hrgn);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
506
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
507 WinEndPaint(hps);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
508
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
509 return 0;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
510 }
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
511 }
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
512
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
513 return WinDefWindowProc(hwnd, msg, mp1, mp2);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
514 }
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
515
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
516 // Change process type from VIO to PM to use PM APIs.
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
517 static void morphToPM(void)
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
518 {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
519 PPIB pib;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
520
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
521 DosGetInfoBlocks(NULL, &pib);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
522
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
523 // Change flag from VIO to PM:
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
524 if (pib->pib_ultype == 2)
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
525 pib->pib_ultype = 3;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
526 }
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
527
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
528 static int preinit(const char *arg)
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
529 {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
530 HWND hwndParent;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
531 ULONG flFrameFlags;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
532 ULONG kvaMode = 0;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
533
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
534 int fUseSnap = 0;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
535 int fUseWO = 0;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
536 int fUseDive = 0;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
537 int fFixT23 = 0;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
538
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
539 const opt_t subopts[] = {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
540 {"snap", OPT_ARG_BOOL, &fUseSnap, NULL},
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
541 {"wo", OPT_ARG_BOOL, &fUseWO, NULL},
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
542 {"dive", OPT_ARG_BOOL, &fUseDive, NULL},
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
543 {"t23", OPT_ARG_BOOL, &fFixT23, NULL},
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
544 {NULL, 0, NULL, NULL}
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
545 };
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
546
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
547 PCSZ pcszVideoModeStr[3] = {"DIVE", "WarpOverlay!", "SNAP"};
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
548
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
549 if (subopt_parse(arg, subopts) != 0)
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
550 return -1;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
551
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
552 morphToPM();
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
553
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
554 memset(&m_int, 0, sizeof(m_int));
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
555
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
556 m_int.hab = WinInitialize(0);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
557 m_int.hmq = WinCreateMsgQueue(m_int.hab, 0);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
558
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
559 WinRegisterClass(m_int.hab,
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
560 WC_MPLAYER,
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
561 WndProc,
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
562 CS_SIZEREDRAW | CS_MOVENOTIFY,
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
563 sizeof(PVOID));
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
564
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
565 if (WinID == -1) {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
566 hwndParent = HWND_DESKTOP;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
567 flFrameFlags = FCF_SYSMENU | FCF_TITLEBAR | FCF_MINMAX |
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
568 FCF_SIZEBORDER | FCF_TASKLIST;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
569 } else {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
570 hwndParent = HWNDFROMWINID(WinID);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
571 flFrameFlags = 0;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
572 }
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
573
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
574 m_int.hwndFrame =
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
575 WinCreateStdWindow(hwndParent, // parent window handle
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
576 WS_VISIBLE, // frame window style
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
577 &flFrameFlags, // window style
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
578 WC_MPLAYER, // class name
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
579 "", // window title
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
580 0L, // default client style
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
581 NULLHANDLE, // resource in exe file
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
582 1, // frame window id
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
583 &m_int.hwndClient); // client window handle
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
584
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
585 if (m_int.hwndFrame == NULLHANDLE)
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
586 return -1;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
587
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
588 m_int.hwndSysMenu = WinWindowFromID(m_int.hwndFrame, FID_SYSMENU);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
589 m_int.hwndTitleBar = WinWindowFromID(m_int.hwndFrame, FID_TITLEBAR);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
590 m_int.hwndMinMax = WinWindowFromID(m_int.hwndFrame, FID_MINMAX);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
591
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
592 m_int.fFixT23 = fFixT23;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
593
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
594 if (m_int.fFixT23)
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
595 m_int.pfnwpOldFrame = WinSubclassWindow(m_int.hwndFrame,
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
596 NewFrameWndProc);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
597
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
598 if (!!fUseSnap + !!fUseWO + !!fUseDive > 1)
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
599 mp_msg(MSGT_VO, MSGL_WARN,"KVA: Multiple mode specified!!!\n");
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
600
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
601 if (fUseSnap)
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
602 kvaMode = KVAM_SNAP;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
603 else if (fUseWO)
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
604 kvaMode = KVAM_WO;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
605 else if (fUseDive)
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
606 kvaMode = KVAM_DIVE;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
607 else
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
608 kvaMode = KVAM_AUTO;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
609
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
610 if (kvaInit(kvaMode, m_int.hwndClient, vo_colorkey)) {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
611 mp_msg(MSGT_VO, MSGL_ERR, "KVA: Init failed!!!\n");
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
612
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
613 return -1;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
614 }
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
615
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
616 kvaCaps(&m_int.kvac);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
617
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
618 mp_msg(MSGT_VO, MSGL_V, "KVA: Selected video mode = %s\n",
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
619 pcszVideoModeStr[m_int.kvac.ulMode - 1]);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
620
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
621 kvaDisableScreenSaver();
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
622
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
623 // Might cause PM DLLs to be loaded which incorrectly enable SIG_FPE,
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
624 // so mask off all floating-point exceptions.
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
625 _control87(MCW_EM, MCW_EM);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
626
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
627 return 0;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
628 }
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
629
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
630 static void uninit(void)
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
631 {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
632 kvaEnableScreenSaver();
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
633
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
634 imgFree();
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
635
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
636 sws_freeContext(m_int.sws);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
637
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
638 if (m_int.hwndFrame != NULLHANDLE) {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
639 kvaResetAttr();
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
640 kvaDone();
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
641
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
642 if (m_int.fFixT23)
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
643 WinSubclassWindow(m_int.hwndFrame, m_int.pfnwpOldFrame);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
644
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
645 WinDestroyWindow(m_int.hwndFrame);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
646 }
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
647
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
648 WinDestroyMsgQueue(m_int.hmq);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
649 WinTerminate(m_int.hab);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
650 }
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
651
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
652 static int config(uint32_t width, uint32_t height,
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
653 uint32_t d_width, uint32_t d_height,
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
654 uint32_t flags, char *title, uint32_t format)
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
655 {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
656 RECTL rcl;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
657
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
658 mp_msg(MSGT_VO, MSGL_V,
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
659 "KVA: Using 0x%X (%s) image format, vo_config_count = %d\n",
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
660 format, vo_format_name(format), vo_config_count);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
661
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
662 imgFree();
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
663
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
664 if (query_format_info(format, &m_int.fHWAccel, &m_int.fcc, &m_int.bpp,
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
665 &m_int.nChromaShift))
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
666 return 1;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
667
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
668 m_int.iImageFormat = format;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
669
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
670 // if there is no hw accel for given format,
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
671 // try any format supported by hw accel
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
672 if (!m_int.fHWAccel) {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
673 int dstFormat = 0;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
674
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
675 sws_freeContext(m_int.sws);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
676
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
677 if (m_int.kvac.ulInputFormatFlags & KVAF_YV12)
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
678 dstFormat = IMGFMT_YV12;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
679 else if (m_int.kvac.ulInputFormatFlags & KVAF_YUY2)
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
680 dstFormat = IMGFMT_YUY2;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
681 else if (m_int.kvac.ulInputFormatFlags & KVAF_YVU9)
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
682 dstFormat = IMGFMT_YVU9;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
683 else if (m_int.kvac.ulInputFormatFlags & KVAF_BGR24)
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
684 dstFormat = IMGFMT_BGR24;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
685 else if (m_int.kvac.ulInputFormatFlags & KVAF_BGR16)
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
686 dstFormat = IMGFMT_BGR16;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
687 else if (m_int.kvac.ulInputFormatFlags & KVAF_BGR15)
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
688 dstFormat = IMGFMT_BGR15;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
689
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
690 if (query_format_info(dstFormat, NULL, &m_int.fcc, NULL, NULL))
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
691 return 1;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
692
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
693 m_int.sws = sws_getContextFromCmdLine(width, height, format,
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
694 width, height, dstFormat);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
695 }
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
696
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
697 mp_msg(MSGT_VO, MSGL_V, "KVA: Selected FOURCC = %.4s\n", (char *)&m_int.fcc);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
698
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
699 m_int.kvas.ulLength = sizeof(KVASETUP);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
700 m_int.kvas.szlSrcSize.cx = width;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
701 m_int.kvas.szlSrcSize.cy = height;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
702 m_int.kvas.rclSrcRect.xLeft = 0;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
703 m_int.kvas.rclSrcRect.yTop = 0;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
704 m_int.kvas.rclSrcRect.xRight = width;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
705 m_int.kvas.rclSrcRect.yBottom = height;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
706 m_int.kvas.ulRatio = vo_keepaspect ? KVAR_FORCEANY : KVAR_NONE;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
707 m_int.kvas.ulAspectWidth = d_width;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
708 m_int.kvas.ulAspectHeight = d_height;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
709 m_int.kvas.fccSrcColor = m_int.fcc;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
710 m_int.kvas.fDither = TRUE;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
711
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
712 if (kvaSetup(&m_int.kvas)) {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
713 mp_msg(MSGT_VO, MSGL_ERR, "KVA: Setup failed!!!\n");
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
714
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
715 return 1;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
716 }
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
717
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
718 m_int.lStride = width * m_int.bpp;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
719
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
720 imgCreate();
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
721
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
722 if (WinID == -1) {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
723 WinSetWindowText(m_int.hwndFrame, title);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
724
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
725 // initialize 'vo_fs' only once at first config() call
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
726 if (vo_config_count == 0)
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
727 vo_fs = flags & VOFLAG_FULLSCREEN;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
728
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
729 // workaround for T23 laptop with S3 Video by Franz Bakan
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
730 if (!vo_fs && m_int.fFixT23) {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
731 d_width++;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
732 d_height++;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
733 }
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
734
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
735 m_int.rclDst.xLeft = ((LONG)vo_screenwidth - (LONG)d_width) / 2;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
736 m_int.rclDst.yBottom = ((LONG)vo_screenheight - (LONG)d_height) / 2;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
737 m_int.rclDst.xRight = m_int.rclDst.xLeft + d_width;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
738 m_int.rclDst.yTop = m_int.rclDst.yBottom + d_height;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
739
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
740 if (vo_fs) {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
741 d_width = vo_screenwidth;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
742 d_height = vo_screenheight;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
743
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
744 // when -fs option is used without this, title bar is not highlighted
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
745 WinSetActiveWindow(HWND_DESKTOP, m_int.hwndFrame);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
746
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
747 WinSetParent(m_int.hwndSysMenu, HWND_OBJECT, FALSE);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
748 WinSetParent(m_int.hwndTitleBar, HWND_OBJECT, FALSE);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
749 WinSetParent(m_int.hwndMinMax, HWND_OBJECT, FALSE);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
750
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
751 setAspectRatio(KVAR_FORCEANY);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
752 }
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
753
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
754 rcl.xLeft = ((LONG)vo_screenwidth - (LONG)d_width) / 2;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
755 rcl.yBottom = ((LONG)vo_screenheight - (LONG)d_height) /2 ;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
756 rcl.xRight = rcl.xLeft + d_width;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
757 rcl.yTop = rcl.yBottom + d_height;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
758 } else {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
759 vo_fs = 0;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
760
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
761 WinQueryWindowRect(HWNDFROMWINID(WinID), &m_int.rclDst);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
762 rcl = m_int.rclDst;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
763 }
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
764
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
765 WinCalcFrameRect(m_int.hwndFrame, &rcl, FALSE);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
766
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
767 WinSetWindowPos(m_int.hwndFrame, HWND_TOP,
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
768 rcl.xLeft, rcl.yBottom,
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
769 rcl.xRight - rcl.xLeft, rcl.yTop - rcl.yBottom,
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
770 SWP_SIZE | SWP_MOVE | SWP_ZORDER | SWP_SHOW |
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
771 (WinID == -1 ? SWP_ACTIVATE : 0));
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
772
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
773 WinInvalidateRect(m_int.hwndFrame, NULL, TRUE);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
774
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
775 return 0;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
776 }
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
777
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
778 static uint32_t get_image(mp_image_t *mpi)
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
779 {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
780 if (m_int.iImageFormat != mpi->imgfmt)
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
781 return VO_FALSE;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
782
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
783 if (mpi->type == MP_IMGTYPE_STATIC || mpi->type == MP_IMGTYPE_TEMP) {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
784 if (mpi->flags & MP_IMGFLAG_PLANAR) {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
785 mpi->planes[1] = m_int.planes[1];
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
786 mpi->planes[2] = m_int.planes[2];
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
787
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
788 mpi->stride[1] = m_int.stride[1];
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
789 mpi->stride[2] = m_int.stride[2];
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
790 }
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
791
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
792 mpi->planes[0] = m_int.planes[0];
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
793 mpi->stride[0] = m_int.stride[0];
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
794 mpi->flags |= MP_IMGFLAG_DIRECT;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
795
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
796 return VO_TRUE;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
797 }
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
798
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
799 return VO_FALSE;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
800 }
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
801
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
802 static uint32_t draw_image(mp_image_t *mpi)
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
803 {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
804 // if -dr or -slices then do nothing:
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
805 if (mpi->flags & (MP_IMGFLAG_DIRECT | MP_IMGFLAG_DRAW_CALLBACK))
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
806 return VO_TRUE;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
807
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
808 draw_slice(mpi->planes, mpi->stride, mpi->w, mpi->h, mpi->x, mpi->y);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
809
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
810 return VO_TRUE;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
811 }
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
812
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
813 static int query_format(uint32_t format)
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
814 {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
815 BOOL fHWAccel;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
816 int res;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
817
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
818 if (query_format_info(format, &fHWAccel, NULL, NULL, NULL))
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
819 return 0;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
820
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
821 res = VFCAP_CSP_SUPPORTED | VFCAP_OSD;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
822 if (fHWAccel) {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
823 res |= VFCAP_CSP_SUPPORTED_BY_HW | VFCAP_HWSCALE_UP;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
824
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
825 if (!m_int.fFixT23)
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
826 res |= VFCAP_HWSCALE_DOWN;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
827 }
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
828
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
829 return res;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
830 }
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
831
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
832 static int fs_toggle(void)
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
833 {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
834 RECTL rcl;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
835
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
836 vo_fs = !vo_fs;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
837
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
838 if (vo_fs) {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
839 SWP swp;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
840
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
841 WinQueryWindowPos(m_int.hwndFrame, &swp);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
842 m_int.rclDst.xLeft = swp.x;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
843 m_int.rclDst.yBottom = swp.y;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
844 m_int.rclDst.xRight = m_int.rclDst.xLeft + swp.cx;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
845 m_int.rclDst.yTop = m_int.rclDst.yBottom + swp.cy;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
846 WinCalcFrameRect(m_int.hwndFrame, &m_int.rclDst, TRUE);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
847
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
848 if (WinID != -1)
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
849 WinSetParent(m_int.hwndFrame, HWND_DESKTOP, FALSE);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
850
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
851 WinSetParent(m_int.hwndSysMenu, HWND_OBJECT, FALSE);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
852 WinSetParent(m_int.hwndTitleBar, HWND_OBJECT, FALSE);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
853 WinSetParent(m_int.hwndMinMax, HWND_OBJECT, FALSE);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
854
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
855 rcl.xLeft = 0;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
856 rcl.yBottom = 0;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
857 rcl.xRight = vo_screenwidth;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
858 rcl.yTop = vo_screenheight;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
859
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
860 setAspectRatio(KVAR_FORCEANY);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
861 } else {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
862 if (WinID != -1)
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
863 WinSetParent(m_int.hwndFrame, HWNDFROMWINID(WinID), TRUE);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
864
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
865 WinSetParent(m_int.hwndSysMenu, m_int.hwndFrame, FALSE);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
866 WinSetParent(m_int.hwndTitleBar, m_int.hwndFrame, FALSE);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
867 WinSetParent(m_int.hwndMinMax, m_int.hwndFrame, FALSE);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
868
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
869 rcl = m_int.rclDst;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
870
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
871 setAspectRatio(vo_keepaspect ? KVAR_FORCEANY : KVAR_NONE);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
872 }
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
873
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
874 WinCalcFrameRect(m_int.hwndFrame, &rcl, FALSE);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
875
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
876 WinSetWindowPos(m_int.hwndFrame, HWND_TOP,
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
877 rcl.xLeft, rcl.yBottom,
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
878 rcl.xRight - rcl.xLeft, rcl.yTop - rcl.yBottom,
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
879 SWP_SIZE | SWP_MOVE | SWP_ZORDER | SWP_SHOW |
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
880 (WinID == -1 ? SWP_ACTIVATE : 0));
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
881
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
882 return VO_TRUE;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
883 }
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
884
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
885 static int color_ctrl_set(char *what, int value)
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
886 {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
887 ULONG ulAttr;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
888 ULONG ulValue;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
889
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
890 if (!strcmp(what, "brightness"))
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
891 ulAttr = KVAA_BRIGHTNESS;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
892 else if (!strcmp(what, "contrast"))
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
893 ulAttr = KVAA_CONTRAST;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
894 else if (!strcmp(what, "hue"))
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
895 ulAttr = KVAA_HUE;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
896 else if (!strcmp(what, "saturation"))
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
897 ulAttr = KVAA_SATURATION;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
898 else
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
899 return VO_NOTIMPL;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
900
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
901 ulValue = (value + 100) * 255 / 200;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
902
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
903 if (kvaSetAttr(ulAttr, &ulValue))
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
904 return VO_NOTIMPL;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
905
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
906 return VO_TRUE;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
907 }
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
908
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
909 static int color_ctrl_get(char *what, int *value)
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
910 {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
911 ULONG ulAttr;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
912 ULONG ulValue;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
913
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
914 if (!strcmp(what, "brightness"))
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
915 ulAttr = KVAA_BRIGHTNESS;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
916 else if (!strcmp(what, "contrast"))
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
917 ulAttr = KVAA_CONTRAST;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
918 else if (!strcmp(what, "hue"))
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
919 ulAttr = KVAA_HUE;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
920 else if (!strcmp(what, "saturation"))
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
921 ulAttr = KVAA_SATURATION;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
922 else
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
923 return VO_NOTIMPL;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
924
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
925 if (kvaQueryAttr(ulAttr, &ulValue))
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
926 return VO_NOTIMPL;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
927
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
928 // add 1 to adjust range
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
929 *value = ((ulValue + 1) * 200 / 255) - 100;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
930
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
931 return VO_TRUE;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
932 }
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
933
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
934 static int control(uint32_t request, void *data, ...)
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
935 {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
936 switch (request) {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
937 case VOCTRL_GET_IMAGE:
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
938 return get_image(data);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
939
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
940 case VOCTRL_DRAW_IMAGE:
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
941 return draw_image(data);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
942
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
943 case VOCTRL_QUERY_FORMAT:
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
944 return query_format(*(uint32_t *)data);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
945
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
946 case VOCTRL_FULLSCREEN:
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
947 return fs_toggle();
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
948
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
949 case VOCTRL_SET_EQUALIZER:
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
950 {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
951 va_list ap;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
952 int value;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
953
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
954 va_start(ap, data);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
955 value = va_arg(ap, int);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
956 va_end(ap);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
957
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
958 return color_ctrl_set(data, value);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
959 }
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
960
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
961 case VOCTRL_GET_EQUALIZER:
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
962 {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
963 va_list ap;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
964 int *value;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
965
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
966 va_start(ap, data);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
967 value = va_arg(ap, int *);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
968 va_end(ap);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
969
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
970 return color_ctrl_get(data, value);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
971 }
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
972
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
973 case VOCTRL_UPDATE_SCREENINFO:
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
974 vo_screenwidth = m_int.kvac.cxScreen;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
975 vo_screenheight = m_int.kvac.cyScreen;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
976
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
977 aspect_save_screenres(vo_screenwidth, vo_screenheight);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
978
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
979 return VO_TRUE;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
980 }
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
981
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
982 return VO_NOTIMPL;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
983 }
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
984
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
985 static int draw_frame(uint8_t *src[])
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
986 {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
987 return VO_ERROR;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
988 }
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
989
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
990 static int draw_slice(uint8_t *src[], int stride[], int w, int h, int x, int y)
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
991 {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
992 uint8_t *s;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
993 uint8_t *d;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
994
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
995 // copy packed or Y
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
996 d = m_int.planes[0] + m_int.stride[0] * y + x;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
997 s = src[0];
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
998 mem2agpcpy_pic(d, s, w * m_int.bpp, h, m_int.stride[0], stride[0]);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
999
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1000 // YV12 or YVU9
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1001 if (m_int.nChromaShift) {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1002 w >>= m_int.nChromaShift; h >>= m_int.nChromaShift;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1003 x >>= m_int.nChromaShift; y >>= m_int.nChromaShift;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1004
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1005 // copy U
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1006 d = m_int.planes[1] + m_int.stride[1] * y + x;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1007 s = src[1];
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1008 mem2agpcpy_pic(d, s, w, h, m_int.stride[1], stride[1]);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1009
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1010 // copy V
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1011 d = m_int.planes[2] + m_int.stride[2] * y + x;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1012 s = src[2];
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1013 mem2agpcpy_pic(d, s, w, h, m_int.stride[2], stride[2]);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1014 }
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1015
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1016 return 0;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1017 }
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1018
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1019 #define vo_draw_alpha(imgfmt) \
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1020 vo_draw_alpha_##imgfmt(w, h, src, srca, stride, \
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1021 m_int.planes[0] + m_int.stride[0] * y0 + m_int.bpp * x0, \
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1022 m_int.stride[0])
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1023
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1024 static void draw_alpha(int x0, int y0, int w, int h,
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1025 unsigned char *src, unsigned char *srca, int stride)
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1026 {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1027 switch (m_int.iImageFormat) {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1028 case IMGFMT_YV12:
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1029 case IMGFMT_YVU9:
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1030 vo_draw_alpha(yv12);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1031 break;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1032
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1033 case IMGFMT_YUY2:
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1034 vo_draw_alpha(yuy2);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1035 break;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1036
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1037 case IMGFMT_BGR24:
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1038 vo_draw_alpha(rgb24);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1039 break;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1040
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1041 case IMGFMT_BGR16:
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1042 vo_draw_alpha(rgb16);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1043 break;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1044
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1045 case IMGFMT_BGR15:
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1046 vo_draw_alpha(rgb15);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1047 break;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1048 }
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1049 }
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1050
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1051 static void draw_osd(void)
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1052 {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1053 vo_draw_text(SRC_WIDTH, SRC_HEIGHT, draw_alpha);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1054 }
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1055
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1056 static void flip_page(void)
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1057 {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1058 imgDisplay();
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1059 }
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1060
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1061 static void check_events(void)
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1062 {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1063 QMSG qm;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1064
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1065 // On slave mode, we need to change our window size according to a
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1066 // parent window size
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1067 if (WinID != -1) {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1068 RECTL rcl;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1069
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1070 WinQueryWindowRect(HWNDFROMWINID(WinID), &rcl);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1071
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1072 if (rcl.xLeft != m_int.rclParent.xLeft ||
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1073 rcl.yBottom != m_int.rclParent.yBottom ||
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1074 rcl.xRight != m_int.rclParent.xRight ||
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1075 rcl.yTop != m_int.rclParent.yTop) {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1076 WinSetWindowPos(m_int.hwndFrame, NULLHANDLE,
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1077 rcl.xLeft, rcl.yBottom,
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1078 rcl.xRight - rcl.xLeft, rcl.yTop - rcl.yBottom,
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1079 SWP_SIZE | SWP_MOVE);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1080
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1081 m_int.rclParent = rcl;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1082 }
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1083 }
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1084
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1085 while (WinPeekMsg(m_int.hab, &qm, NULLHANDLE, 0, 0, PM_REMOVE))
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1086 WinDispatchMsg(m_int.hab, &qm);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1087 }