annotate libvo/vo_kva.c @ 33041:bf51474ed3fe

Attempt to fix crashes with VDPAU and threads.
author reimar
date Sun, 27 Mar 2011 13:18:59 +0000
parents 8975b893179e
children 899d817e56fc
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"
32467
fbe5c829c69b Move libvo/sub.[ch] from libvo to sub.
cigaes
parents: 31017
diff changeset
51 #include "sub/sub.h"
28915
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
30925
f8939d5b14b5 Mark some more LIBVO_EXTERN declarations as const where possible.
reimar
parents: 29062
diff changeset
64 const LIBVO_EXTERN(kva)
28915
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
31017
fca6cfc4d5ca rename 'struct keymap' -> 'struct mp_keymap'
siretart
parents: 30925
diff changeset
73 static const struct mp_keymap m_vk_map[] = {
28915
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
31017
fca6cfc4d5ca rename 'struct keymap' -> 'struct mp_keymap'
siretart
parents: 30925
diff changeset
95 static const struct mp_keymap m_keypad_map[] = {
28915
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
31017
fca6cfc4d5ca rename 'struct keymap' -> 'struct mp_keymap'
siretart
parents: 30925
diff changeset
104 static const struct mp_keymap m_mouse_map[] = {
28915
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;
29062
6a0a30aa2b4a Consistently use MP_MAX_PLANES as size for plane pointer/stride arrays in libvo.
reimar
parents: 28915
diff changeset
134 uint8_t *planes[MP_MAX_PLANES]; // y = 0, u = 1, v = 2
6a0a30aa2b4a Consistently use MP_MAX_PLANES as size for plane pointer/stride arrays in libvo.
reimar
parents: 28915
diff changeset
135 int stride[MP_MAX_PLANES];
28915
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 {
32483
8975b893179e Restore all the attributes after changing aspect ratio.
komh
parents: 32482
diff changeset
143 ULONG ulValue;
8975b893179e Restore all the attributes after changing aspect ratio.
komh
parents: 32482
diff changeset
144 int i;
8975b893179e Restore all the attributes after changing aspect ratio.
komh
parents: 32482
diff changeset
145
28915
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
146 m_int.kvas.ulRatio = ulRatio;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
147 kvaSetup(&m_int.kvas);
32483
8975b893179e Restore all the attributes after changing aspect ratio.
komh
parents: 32482
diff changeset
148
8975b893179e Restore all the attributes after changing aspect ratio.
komh
parents: 32482
diff changeset
149 // Setup initializes all attributes, so need to restore them.
8975b893179e Restore all the attributes after changing aspect ratio.
komh
parents: 32482
diff changeset
150 for (i = 0; i < KVAA_LAST; i++) {
8975b893179e Restore all the attributes after changing aspect ratio.
komh
parents: 32482
diff changeset
151 kvaQueryAttr(i, &ulValue);
8975b893179e Restore all the attributes after changing aspect ratio.
komh
parents: 32482
diff changeset
152 kvaSetAttr(i, &ulValue);
8975b893179e Restore all the attributes after changing aspect ratio.
komh
parents: 32482
diff changeset
153 }
28915
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
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
156 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
157 int *pbpp, int *pnChromaShift)
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
158 {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
159 BOOL fHWAccel;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
160 FOURCC fcc;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
161 INT bpp;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
162 INT nChromaShift;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
163
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
164 switch (format) {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
165 case IMGFMT_YV12:
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
166 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
167 fcc = FOURCC_YV12;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
168 bpp = 1;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
169 nChromaShift = 1;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
170 break;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
171
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
172 case IMGFMT_YUY2:
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
173 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
174 fcc = FOURCC_Y422;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
175 bpp = 2;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
176 nChromaShift = 0;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
177 break;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
178
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
179 case IMGFMT_YVU9:
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
180 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
181 fcc = FOURCC_YVU9;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
182 bpp = 1;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
183 nChromaShift = 2;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
184 break;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
185
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
186 case IMGFMT_BGR24:
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
187 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
188 fcc = FOURCC_BGR3;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
189 bpp = 3;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
190 nChromaShift = 0;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
191 break;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
192
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
193 case IMGFMT_BGR16:
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
194 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
195 fcc = FOURCC_R565;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
196 bpp = 2;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
197 nChromaShift = 0;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
198 break;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
199
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
200 case IMGFMT_BGR15:
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
201 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
202 fcc = FOURCC_R555;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
203 bpp = 2;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
204 nChromaShift = 0;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
205 break;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
206
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
207 default:
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
208 return 1;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
209 }
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 (pfHWAccel)
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
212 *pfHWAccel = fHWAccel;
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 if (pfcc)
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
215 *pfcc = fcc;
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 if (pbpp)
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
218 *pbpp = bpp;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
219
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
220 if (pnChromaShift)
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
221 *pnChromaShift = nChromaShift;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
222
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
223 return 0;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
224 }
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 static void imgCreate(void)
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
227 {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
228 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
229
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
230 switch (m_int.iImageFormat) {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
231 case IMGFMT_YV12:
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
232 size += size / 2;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
233 break;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
234
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
235 case IMGFMT_YVU9:
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
236 size += size / 8;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
237 break;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
238 }
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
239
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
240 m_int.pbImage = malloc(size);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
241
29062
6a0a30aa2b4a Consistently use MP_MAX_PLANES as size for plane pointer/stride arrays in libvo.
reimar
parents: 28915
diff changeset
242 memset(m_int.planes, 0, sizeof(m_int.planes));
6a0a30aa2b4a Consistently use MP_MAX_PLANES as size for plane pointer/stride arrays in libvo.
reimar
parents: 28915
diff changeset
243 memset(m_int.stride, 0, sizeof(m_int.stride));
28915
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
244 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
245 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
246
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
247 // YV12 or YVU9 ?
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
248 if (m_int.nChromaShift) {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
249 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
250 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
251
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
252 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
253 (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
254 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
255 }
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
256 }
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
257
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
258 static void imgFree(void)
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
259 {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
260 free(m_int.pbImage);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
261
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
262 m_int.pbImage = NULL;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
263 }
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
264
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
265 static void imgDisplay(void)
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 PVOID pBuffer;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
268 ULONG ulBPL;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
269
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
270 if (!kvaLockBuffer(&pBuffer, &ulBPL)) {
29062
6a0a30aa2b4a Consistently use MP_MAX_PLANES as size for plane pointer/stride arrays in libvo.
reimar
parents: 28915
diff changeset
271 uint8_t *dst[MP_MAX_PLANES] = {NULL};
6a0a30aa2b4a Consistently use MP_MAX_PLANES as size for plane pointer/stride arrays in libvo.
reimar
parents: 28915
diff changeset
272 int dstStride[MP_MAX_PLANES] = {0};
28915
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
273
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
274 // Get packed or Y
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
275 dst[0] = pBuffer;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
276 dstStride[0] = ulBPL;
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 // YV12 or YVU9 ?
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
279 if (m_int.nChromaShift) {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
280 // Get V
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
281 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
282 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
283
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
284 // Get U
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
285 dst[1] = dst[2] +
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
286 (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
287 dstStride[1] = dstStride[2];
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
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
290 if (m_int.fHWAccel) {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
291 int w, h;
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 w = m_int.stride[0];
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
294 h = SRC_HEIGHT;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
295
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
296 // Copy packed or Y
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
297 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
298 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
299
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
300 // YV12 or YVU9 ?
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
301 if (m_int.nChromaShift) {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
302 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
303
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
304 // Copy U
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
305 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
306 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
307
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
308 // Copy V
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
309 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
310 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
311 }
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
312 } else {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
313 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
314 dst, dstStride);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
315 }
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
316
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
317 kvaUnlockBuffer();
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
318 }
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
319 }
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 // 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
322 // which supports upscaling only.
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
323 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
324 MPARAM 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 switch (msg) {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
327 case WM_QUERYTRACKINFO:
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
328 {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
329 PTRACKINFO pti = (PTRACKINFO)mp2;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
330 RECTL rcl;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
331
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
332 if (vo_fs)
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
333 break;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
334
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
335 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
336
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
337 rcl.xLeft = 0;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
338 rcl.yBottom = 0;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
339 rcl.xRight = SRC_WIDTH + 1;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
340 rcl.yTop = SRC_HEIGHT + 1;
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 WinCalcFrameRect(hwnd, &rcl, FALSE);
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 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
345 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
346
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
347 pti->ptlMaxTrackSize.x = vo_screenwidth;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
348 pti->ptlMaxTrackSize.y = vo_screenheight;
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 return (MRESULT)TRUE;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
351 }
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
352
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
353 case WM_ADJUSTWINDOWPOS:
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
354 {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
355 PSWP pswp = (PSWP)mp1;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
356 RECTL rcl;
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 (vo_fs)
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
359 break;
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 (pswp->fl & SWP_SIZE) {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
362 rcl.xLeft = pswp->x;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
363 rcl.yBottom = pswp->y;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
364 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
365 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
366
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
367 WinCalcFrameRect(hwnd, &rcl, TRUE);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
368
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
369 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
370 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
371
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
372 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
373 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
374
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
375 WinCalcFrameRect(hwnd, &rcl, FALSE);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
376
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
377 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
378 rcl.xLeft = 0;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
379 rcl.xRight = vo_screenwidth;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
380 }
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 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
383 rcl.yBottom = 0;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
384 rcl.yTop = vo_screenheight;
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
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
387 pswp->fl |= SWP_MOVE;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
388 pswp->x = rcl.xLeft;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
389 pswp->y = rcl.yBottom;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
390 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
391 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
392 }
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
393 break;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
394 }
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
395 }
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 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
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 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
401 {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
402 // 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
403 if (WinID != -1 &&
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
404 ((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
405 (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
406 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
407
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
408 return (MRESULT)TRUE;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
409 }
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
410
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
411 switch (msg) {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
412 case WM_CLOSE:
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
413 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
414
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
415 return 0;
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 case WM_CHAR:
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
418 {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
419 USHORT fsFlags = SHORT1FROMMP(mp1);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
420 UCHAR uchScan = CHAR4FROMMP(mp1);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
421 USHORT usCh = SHORT1FROMMP(mp2);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
422 USHORT usVk = SHORT2FROMMP(mp2);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
423 int mpkey;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
424
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
425 if (fsFlags & KC_KEYUP)
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
426 break;
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 if (fsFlags & KC_SCANCODE) {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
429 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
430 if (mpkey) {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
431 // 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
432 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
433 mpkey = KEY_KPINS;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
434
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
435 // 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
436 if (mpkey == KEY_KPDEC && usCh != '.')
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
437 mpkey = KEY_KPDEL;
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 mplayer_put_key(mpkey);
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 return (MRESULT)TRUE;
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 }
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
444
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
445 if (fsFlags & KC_VIRTUALKEY) {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
446 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
447 if (mpkey) {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
448 mplayer_put_key(mpkey);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
449
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
450 return (MRESULT)TRUE;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
451 }
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
452 }
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
453
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
454 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
455 mplayer_put_key(usCh);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
456
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
457 return (MRESULT)TRUE;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
458 }
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 case WM_BUTTON1DOWN:
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
461 case WM_BUTTON3DOWN:
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
462 case WM_BUTTON2DOWN:
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
463 case WM_BUTTON1DBLCLK:
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
464 case WM_BUTTON3DBLCLK:
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
465 case WM_BUTTON2DBLCLK:
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
466 if (WinQueryFocus(HWND_DESKTOP) != hwnd)
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
467 WinSetFocus(HWND_DESKTOP, hwnd);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
468 else if (!vo_nomouse_input)
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
469 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
470
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
471 return (MRESULT)TRUE;
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 case WM_PAINT:
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
474 {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
475 HPS hps;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
476 RECTL rcl, rclDst;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
477 PRECTL prcl = NULL;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
478 HRGN hrgn, hrgnDst;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
479 RGNRECT rgnCtl;
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 // get a current movie area
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
482 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
483
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
484 // get a current invalidated area
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
485 hps = WinBeginPaint(hwnd, NULLHANDLE, &rcl);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
486
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
487 // 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
488 hrgn = GpiCreateRegion(hps, 1, &rcl);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
489 // 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
490 hrgnDst = GpiCreateRegion(hps, 1, &rclDst);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
491
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
492 // 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
493 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
494
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
495 // get rectangles from the region
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
496 rgnCtl.ircStart = 1;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
497 rgnCtl.ulDirection = RECTDIR_LFRT_TOPBOT;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
498 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
499
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
500 if (rgnCtl.crcReturned > 0) {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
501 rgnCtl.crc = rgnCtl.crcReturned;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
502 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
503 }
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
504
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
505 // draw black bar if needed
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
506 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
507 int i;
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 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
510 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
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 free(prcl);
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 GpiDestroyRegion(hps, hrgnDst);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
516 GpiDestroyRegion(hps, hrgn);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
517
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
518 WinEndPaint(hps);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
519
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
520 return 0;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
521 }
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
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
524 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
525 }
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 // 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
528 static void morphToPM(void)
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 PPIB pib;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
531
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
532 DosGetInfoBlocks(NULL, &pib);
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 // 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
535 if (pib->pib_ultype == 2)
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
536 pib->pib_ultype = 3;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
537 }
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 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
540 {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
541 HWND hwndParent;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
542 ULONG flFrameFlags;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
543 ULONG kvaMode = 0;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
544
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
545 int fUseSnap = 0;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
546 int fUseWO = 0;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
547 int fUseDive = 0;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
548 int fFixT23 = 0;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
549
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
550 const opt_t subopts[] = {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
551 {"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
552 {"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
553 {"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
554 {"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
555 {NULL, 0, NULL, NULL}
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
556 };
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
557
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
558 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
559
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
560 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
561 return -1;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
562
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
563 morphToPM();
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 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
566
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
567 m_int.hab = WinInitialize(0);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
568 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
569
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
570 WinRegisterClass(m_int.hab,
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
571 WC_MPLAYER,
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
572 WndProc,
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
573 CS_SIZEREDRAW | CS_MOVENOTIFY,
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
574 sizeof(PVOID));
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
575
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
576 if (WinID == -1) {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
577 hwndParent = HWND_DESKTOP;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
578 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
579 FCF_SIZEBORDER | FCF_TASKLIST;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
580 } else {
32482
cc24ebf93de4 Prevent a parent window from painting over our window on slave mode
komh
parents: 32467
diff changeset
581 ULONG ulStyle;
cc24ebf93de4 Prevent a parent window from painting over our window on slave mode
komh
parents: 32467
diff changeset
582
28915
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
583 hwndParent = HWNDFROMWINID(WinID);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
584 flFrameFlags = 0;
32482
cc24ebf93de4 Prevent a parent window from painting over our window on slave mode
komh
parents: 32467
diff changeset
585
cc24ebf93de4 Prevent a parent window from painting over our window on slave mode
komh
parents: 32467
diff changeset
586 // Prevent a parent window from painting over our window
cc24ebf93de4 Prevent a parent window from painting over our window on slave mode
komh
parents: 32467
diff changeset
587 ulStyle = WinQueryWindowULong(hwndParent, QWL_STYLE);
cc24ebf93de4 Prevent a parent window from painting over our window on slave mode
komh
parents: 32467
diff changeset
588 WinSetWindowULong(hwndParent, QWL_STYLE, ulStyle | WS_CLIPCHILDREN);
28915
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
589 }
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
590
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
591 m_int.hwndFrame =
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
592 WinCreateStdWindow(hwndParent, // parent window handle
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
593 WS_VISIBLE, // frame window style
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
594 &flFrameFlags, // window style
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
595 WC_MPLAYER, // class name
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
596 "", // window title
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
597 0L, // default client style
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
598 NULLHANDLE, // resource in exe file
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
599 1, // frame window id
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
600 &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
601
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
602 if (m_int.hwndFrame == NULLHANDLE)
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
603 return -1;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
604
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
605 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
606 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
607 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
608
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
609 m_int.fFixT23 = fFixT23;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
610
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
611 if (m_int.fFixT23)
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
612 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
613 NewFrameWndProc);
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 if (!!fUseSnap + !!fUseWO + !!fUseDive > 1)
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
616 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
617
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
618 if (fUseSnap)
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
619 kvaMode = KVAM_SNAP;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
620 else if (fUseWO)
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
621 kvaMode = KVAM_WO;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
622 else if (fUseDive)
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
623 kvaMode = KVAM_DIVE;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
624 else
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
625 kvaMode = KVAM_AUTO;
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 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
628 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
629
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
630 return -1;
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
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
633 kvaCaps(&m_int.kvac);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
634
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
635 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
636 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
637
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
638 kvaDisableScreenSaver();
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
639
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
640 // 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
641 // 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
642 _control87(MCW_EM, MCW_EM);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
643
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
644 return 0;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
645 }
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 static void uninit(void)
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
648 {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
649 kvaEnableScreenSaver();
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 imgFree();
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
652
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
653 sws_freeContext(m_int.sws);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
654
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
655 if (m_int.hwndFrame != NULLHANDLE) {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
656 kvaResetAttr();
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
657 kvaDone();
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
658
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
659 if (m_int.fFixT23)
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
660 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
661
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
662 WinDestroyWindow(m_int.hwndFrame);
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
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
665 WinDestroyMsgQueue(m_int.hmq);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
666 WinTerminate(m_int.hab);
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
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
669 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
670 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
671 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
672 {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
673 RECTL rcl;
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 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
676 "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
677 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
678
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
679 imgFree();
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
680
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
681 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
682 &m_int.nChromaShift))
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
683 return 1;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
684
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
685 m_int.iImageFormat = format;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
686
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
687 // 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
688 // 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
689 if (!m_int.fHWAccel) {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
690 int dstFormat = 0;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
691
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
692 sws_freeContext(m_int.sws);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
693
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
694 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
695 dstFormat = IMGFMT_YV12;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
696 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
697 dstFormat = IMGFMT_YUY2;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
698 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
699 dstFormat = IMGFMT_YVU9;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
700 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
701 dstFormat = IMGFMT_BGR24;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
702 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
703 dstFormat = IMGFMT_BGR16;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
704 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
705 dstFormat = IMGFMT_BGR15;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
706
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
707 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
708 return 1;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
709
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
710 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
711 width, height, dstFormat);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
712 }
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
713
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
714 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
715
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
716 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
717 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
718 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
719 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
720 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
721 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
722 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
723 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
724 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
725 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
726 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
727 m_int.kvas.fDither = TRUE;
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 if (kvaSetup(&m_int.kvas)) {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
730 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
731
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
732 return 1;
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.lStride = width * m_int.bpp;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
736
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
737 imgCreate();
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
738
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
739 if (WinID == -1) {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
740 WinSetWindowText(m_int.hwndFrame, title);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
741
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
742 // 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
743 if (vo_config_count == 0)
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
744 vo_fs = flags & VOFLAG_FULLSCREEN;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
745
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
746 // 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
747 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
748 d_width++;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
749 d_height++;
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
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
752 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
753 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
754 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
755 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
756
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
757 if (vo_fs) {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
758 d_width = vo_screenwidth;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
759 d_height = vo_screenheight;
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 // 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
762 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
763
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
764 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
765 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
766 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
767
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
768 setAspectRatio(KVAR_FORCEANY);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
769 }
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
770
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
771 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
772 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
773 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
774 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
775 } else {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
776 vo_fs = 0;
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 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
779 rcl = m_int.rclDst;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
780 }
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
781
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
782 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
783
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
784 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
785 rcl.xLeft, rcl.yBottom,
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
786 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
787 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
788 (WinID == -1 ? SWP_ACTIVATE : 0));
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
789
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
790 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
791
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
792 return 0;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
793 }
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
794
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
795 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
796 {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
797 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
798 return VO_FALSE;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
799
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
800 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
801 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
802 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
803 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
804
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
805 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
806 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
807 }
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
808
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
809 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
810 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
811 mpi->flags |= MP_IMGFLAG_DIRECT;
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 return VO_TRUE;
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
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
816 return VO_FALSE;
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
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
819 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
820 {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
821 // 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
822 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
823 return VO_TRUE;
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 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
826
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
827 return VO_TRUE;
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
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
830 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
831 {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
832 BOOL fHWAccel;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
833 int res;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
834
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
835 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
836 return 0;
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 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
839 if (fHWAccel) {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
840 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
841
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
842 if (!m_int.fFixT23)
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
843 res |= VFCAP_HWSCALE_DOWN;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
844 }
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
845
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
846 return res;
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
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
849 static int fs_toggle(void)
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 RECTL rcl;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
852
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
853 vo_fs = !vo_fs;
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 if (vo_fs) {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
856 SWP swp;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
857
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
858 WinQueryWindowPos(m_int.hwndFrame, &swp);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
859 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
860 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
861 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
862 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
863 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
864
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
865 if (WinID != -1)
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
866 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
867
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
868 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
869 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
870 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
871
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
872 rcl.xLeft = 0;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
873 rcl.yBottom = 0;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
874 rcl.xRight = vo_screenwidth;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
875 rcl.yTop = vo_screenheight;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
876
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
877 setAspectRatio(KVAR_FORCEANY);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
878 } else {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
879 if (WinID != -1)
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
880 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
881
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
882 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
883 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
884 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
885
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
886 rcl = m_int.rclDst;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
887
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
888 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
889 }
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
890
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
891 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
892
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
893 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
894 rcl.xLeft, rcl.yBottom,
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
895 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
896 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
897 (WinID == -1 ? SWP_ACTIVATE : 0));
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
898
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
899 return VO_TRUE;
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
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
902 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
903 {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
904 ULONG ulAttr;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
905 ULONG ulValue;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
906
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
907 if (!strcmp(what, "brightness"))
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
908 ulAttr = KVAA_BRIGHTNESS;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
909 else if (!strcmp(what, "contrast"))
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
910 ulAttr = KVAA_CONTRAST;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
911 else if (!strcmp(what, "hue"))
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
912 ulAttr = KVAA_HUE;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
913 else if (!strcmp(what, "saturation"))
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
914 ulAttr = KVAA_SATURATION;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
915 else
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
916 return VO_NOTIMPL;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
917
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
918 ulValue = (value + 100) * 255 / 200;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
919
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
920 if (kvaSetAttr(ulAttr, &ulValue))
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
921 return VO_NOTIMPL;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
922
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
923 return VO_TRUE;
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
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
926 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
927 {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
928 ULONG ulAttr;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
929 ULONG ulValue;
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 if (!strcmp(what, "brightness"))
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
932 ulAttr = KVAA_BRIGHTNESS;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
933 else if (!strcmp(what, "contrast"))
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
934 ulAttr = KVAA_CONTRAST;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
935 else if (!strcmp(what, "hue"))
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
936 ulAttr = KVAA_HUE;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
937 else if (!strcmp(what, "saturation"))
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
938 ulAttr = KVAA_SATURATION;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
939 else
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
940 return VO_NOTIMPL;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
941
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
942 if (kvaQueryAttr(ulAttr, &ulValue))
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
943 return VO_NOTIMPL;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
944
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
945 // add 1 to adjust range
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
946 *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
947
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
948 return VO_TRUE;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
949 }
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 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
952 {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
953 switch (request) {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
954 case VOCTRL_GET_IMAGE:
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
955 return get_image(data);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
956
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
957 case VOCTRL_DRAW_IMAGE:
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
958 return draw_image(data);
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 case VOCTRL_QUERY_FORMAT:
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
961 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
962
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
963 case VOCTRL_FULLSCREEN:
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
964 return fs_toggle();
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 case VOCTRL_SET_EQUALIZER:
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
967 {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
968 va_list ap;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
969 int value;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
970
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
971 va_start(ap, data);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
972 value = va_arg(ap, int);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
973 va_end(ap);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
974
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
975 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
976 }
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
977
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
978 case VOCTRL_GET_EQUALIZER:
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
979 {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
980 va_list ap;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
981 int *value;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
982
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
983 va_start(ap, data);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
984 value = va_arg(ap, int *);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
985 va_end(ap);
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 color_ctrl_get(data, value);
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 case VOCTRL_UPDATE_SCREENINFO:
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
991 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
992 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
993
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
994 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
995
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
996 return VO_TRUE;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
997 }
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
998
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
999 return VO_NOTIMPL;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1000 }
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1001
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1002 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
1003 {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1004 return VO_ERROR;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1005 }
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1006
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1007 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
1008 {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1009 uint8_t *s;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1010 uint8_t *d;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1011
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1012 // copy packed or Y
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1013 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
1014 s = src[0];
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1015 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
1016
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1017 // YV12 or YVU9
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1018 if (m_int.nChromaShift) {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1019 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
1020 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
1021
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1022 // copy U
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1023 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
1024 s = src[1];
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1025 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
1026
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1027 // copy V
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1028 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
1029 s = src[2];
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1030 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
1031 }
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 return 0;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1034 }
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1035
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1036 #define vo_draw_alpha(imgfmt) \
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1037 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
1038 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
1039 m_int.stride[0])
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 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
1042 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
1043 {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1044 switch (m_int.iImageFormat) {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1045 case IMGFMT_YV12:
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1046 case IMGFMT_YVU9:
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1047 vo_draw_alpha(yv12);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1048 break;
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 case IMGFMT_YUY2:
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1051 vo_draw_alpha(yuy2);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1052 break;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1053
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1054 case IMGFMT_BGR24:
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1055 vo_draw_alpha(rgb24);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1056 break;
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 case IMGFMT_BGR16:
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1059 vo_draw_alpha(rgb16);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1060 break;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1061
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1062 case IMGFMT_BGR15:
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1063 vo_draw_alpha(rgb15);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1064 break;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1065 }
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1066 }
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1067
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1068 static void draw_osd(void)
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 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
1071 }
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1072
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1073 static void flip_page(void)
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1074 {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1075 imgDisplay();
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1076 }
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1077
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1078 static void check_events(void)
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1079 {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1080 QMSG qm;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1081
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1082 // 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
1083 // parent window size
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1084 if (WinID != -1) {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1085 RECTL rcl;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1086
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1087 WinQueryWindowRect(HWNDFROMWINID(WinID), &rcl);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1088
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1089 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
1090 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
1091 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
1092 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
1093 WinSetWindowPos(m_int.hwndFrame, NULLHANDLE,
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1094 rcl.xLeft, rcl.yBottom,
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1095 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
1096 SWP_SIZE | SWP_MOVE);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1097
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1098 m_int.rclParent = rcl;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1099 }
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1100 }
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1101
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1102 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
1103 WinDispatchMsg(m_int.hab, &qm);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1104 }