annotate libvo/vo_kva.c @ 34595:97bf974e7623

Simplify character array definition.
author ib
date Fri, 10 Feb 2012 15:24:27 +0000
parents c6aaa2f49c18
children 5d3f93051de9
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"
33301
899d817e56fc Implement control() VOCTRL_SET/GET_EQUALIZER using a vf_equalize struct,
iive
parents: 32483
diff changeset
43 #include "libmpcodecs/vf.h"
28915
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
44 #include "aspect.h"
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
45
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
46 #include "fastmemcpy.h"
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
47 #include "mp_fifo.h"
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
48 #include "osdep/keycodes.h"
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
49 #include "input/input.h"
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
50 #include "input/mouse.h"
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
51 #include "subopt-helper.h"
32467
fbe5c829c69b Move libvo/sub.[ch] from libvo to sub.
cigaes
parents: 31017
diff changeset
52 #include "sub/sub.h"
28915
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
53
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
54 #include "cpudetect.h"
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
55 #include "libswscale/swscale.h"
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
56 #include "libmpcodecs/vf_scale.h"
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
57
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
58 static const vo_info_t info = {
34557
8ae9ca41186d Add VMAN-backend supports
komh
parents: 34556
diff changeset
59 "SNAP/WarpOverlay!/VMAN/DIVE video output",
28915
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
60 "kva",
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
61 "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
62 ""
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
63 };
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
64
30925
f8939d5b14b5 Mark some more LIBVO_EXTERN declarations as const where possible.
reimar
parents: 29062
diff changeset
65 const LIBVO_EXTERN(kva)
28915
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
66
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
67 #define WC_MPLAYER "WC_MPLAYER"
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
68
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
69 #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
70 #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
71
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
72 #define HWNDFROMWINID(wid) ((wid) + 0x80000000UL)
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
73
31017
fca6cfc4d5ca rename 'struct keymap' -> 'struct mp_keymap'
siretart
parents: 30925
diff changeset
74 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
75 {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
76
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
77 // control keys
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
78 {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
79 {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
80 {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
81 {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
82 {VK_ESC, KEY_ESC},
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
83
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
84 // cursor keys
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
85 {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
86 {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
87
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
88 // function keys
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
89 {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
90 {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
91 {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
92
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
93 {0, 0}
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
94 };
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
95
31017
fca6cfc4d5ca rename 'struct keymap' -> 'struct mp_keymap'
siretart
parents: 30925
diff changeset
96 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
97 // keypad keys
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
98 {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
99 {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
100 {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
101
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
102 {0, 0}
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
103 };
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
104
31017
fca6cfc4d5ca rename 'struct keymap' -> 'struct mp_keymap'
siretart
parents: 30925
diff changeset
105 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
106 {WM_BUTTON1DOWN, MOUSE_BTN0},
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
107 {WM_BUTTON3DOWN, MOUSE_BTN1},
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
108 {WM_BUTTON2DOWN, MOUSE_BTN2},
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
109 {WM_BUTTON1DBLCLK, MOUSE_BTN0_DBL},
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
110 {WM_BUTTON3DBLCLK, MOUSE_BTN1_DBL},
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
111 {WM_BUTTON2DBLCLK, MOUSE_BTN2_DBL},
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
112
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
113 {0, 0}
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
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
116 struct {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
117 HAB hab;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
118 HMQ hmq;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
119 HWND hwndFrame;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
120 HWND hwndClient;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
121 HWND hwndSysMenu;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
122 HWND hwndTitleBar;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
123 HWND hwndMinMax;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
124 FOURCC fcc;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
125 int iImageFormat;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
126 int nChromaShift;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
127 KVASETUP kvas;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
128 KVACAPS kvac;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
129 RECTL rclDst;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
130 int bpp;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
131 LONG lStride;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
132 PBYTE pbImage;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
133 BOOL fFixT23;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
134 PFNWP pfnwpOldFrame;
29062
6a0a30aa2b4a Consistently use MP_MAX_PLANES as size for plane pointer/stride arrays in libvo.
reimar
parents: 28915
diff changeset
135 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
136 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
137 BOOL fHWAccel;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
138 RECTL rclParent;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
139 struct SwsContext *sws;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
140 } m_int;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
141
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
142 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
143 {
32483
8975b893179e Restore all the attributes after changing aspect ratio.
komh
parents: 32482
diff changeset
144 ULONG ulValue;
8975b893179e Restore all the attributes after changing aspect ratio.
komh
parents: 32482
diff changeset
145 int i;
8975b893179e Restore all the attributes after changing aspect ratio.
komh
parents: 32482
diff changeset
146
28915
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
147 m_int.kvas.ulRatio = ulRatio;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
148 kvaSetup(&m_int.kvas);
32483
8975b893179e Restore all the attributes after changing aspect ratio.
komh
parents: 32482
diff changeset
149
8975b893179e Restore all the attributes after changing aspect ratio.
komh
parents: 32482
diff changeset
150 // Setup initializes all attributes, so need to restore them.
8975b893179e Restore all the attributes after changing aspect ratio.
komh
parents: 32482
diff changeset
151 for (i = 0; i < KVAA_LAST; i++) {
8975b893179e Restore all the attributes after changing aspect ratio.
komh
parents: 32482
diff changeset
152 kvaQueryAttr(i, &ulValue);
8975b893179e Restore all the attributes after changing aspect ratio.
komh
parents: 32482
diff changeset
153 kvaSetAttr(i, &ulValue);
8975b893179e Restore all the attributes after changing aspect ratio.
komh
parents: 32482
diff changeset
154 }
28915
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
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
157 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
158 int *pbpp, int *pnChromaShift)
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
159 {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
160 BOOL fHWAccel;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
161 FOURCC fcc;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
162 INT bpp;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
163 INT nChromaShift;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
164
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
165 switch (format) {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
166 case IMGFMT_YV12:
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
167 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
168 fcc = FOURCC_YV12;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
169 bpp = 1;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
170 nChromaShift = 1;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
171 break;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
172
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
173 case IMGFMT_YUY2:
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
174 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
175 fcc = FOURCC_Y422;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
176 bpp = 2;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
177 nChromaShift = 0;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
178 break;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
179
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
180 case IMGFMT_YVU9:
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
181 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
182 fcc = FOURCC_YVU9;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
183 bpp = 1;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
184 nChromaShift = 2;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
185 break;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
186
34556
7e3b96b760ae Add IMGFMT_BGR32 supports
komh
parents: 34310
diff changeset
187 case IMGFMT_BGR32:
7e3b96b760ae Add IMGFMT_BGR32 supports
komh
parents: 34310
diff changeset
188 fHWAccel = m_int.kvac.ulInputFormatFlags & KVAF_BGR32;
7e3b96b760ae Add IMGFMT_BGR32 supports
komh
parents: 34310
diff changeset
189 fcc = FOURCC_BGR4;
34558
c6aaa2f49c18 Fix bpp for IMGFMT_BGR32
komh
parents: 34557
diff changeset
190 bpp = 4;
34556
7e3b96b760ae Add IMGFMT_BGR32 supports
komh
parents: 34310
diff changeset
191 nChromaShift = 0;
7e3b96b760ae Add IMGFMT_BGR32 supports
komh
parents: 34310
diff changeset
192 break;
7e3b96b760ae Add IMGFMT_BGR32 supports
komh
parents: 34310
diff changeset
193
28915
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
194 case IMGFMT_BGR24:
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
195 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
196 fcc = FOURCC_BGR3;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
197 bpp = 3;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
198 nChromaShift = 0;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
199 break;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
200
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
201 case IMGFMT_BGR16:
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
202 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
203 fcc = FOURCC_R565;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
204 bpp = 2;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
205 nChromaShift = 0;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
206 break;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
207
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
208 case IMGFMT_BGR15:
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
209 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
210 fcc = FOURCC_R555;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
211 bpp = 2;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
212 nChromaShift = 0;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
213 break;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
214
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
215 default:
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
216 return 1;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
217 }
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
218
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
219 if (pfHWAccel)
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
220 *pfHWAccel = fHWAccel;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
221
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
222 if (pfcc)
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
223 *pfcc = fcc;
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 if (pbpp)
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
226 *pbpp = bpp;
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 if (pnChromaShift)
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
229 *pnChromaShift = nChromaShift;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
230
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
231 return 0;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
232 }
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
233
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
234 static void imgCreate(void)
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
235 {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
236 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
237
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
238 switch (m_int.iImageFormat) {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
239 case IMGFMT_YV12:
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
240 size += size / 2;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
241 break;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
242
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
243 case IMGFMT_YVU9:
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
244 size += size / 8;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
245 break;
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
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
248 m_int.pbImage = malloc(size);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
249
29062
6a0a30aa2b4a Consistently use MP_MAX_PLANES as size for plane pointer/stride arrays in libvo.
reimar
parents: 28915
diff changeset
250 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
251 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
252 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
253 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
254
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
255 // YV12 or YVU9 ?
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
256 if (m_int.nChromaShift) {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
257 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
258 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
259
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
260 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
261 (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
262 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
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
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
266 static void imgFree(void)
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
267 {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
268 free(m_int.pbImage);
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 m_int.pbImage = NULL;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
271 }
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
272
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
273 static void imgDisplay(void)
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
274 {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
275 PVOID pBuffer;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
276 ULONG 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 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
279 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
280 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
281
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
282 // Get packed or Y
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
283 dst[0] = pBuffer;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
284 dstStride[0] = ulBPL;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
285
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
286 // YV12 or YVU9 ?
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
287 if (m_int.nChromaShift) {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
288 // Get V
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
289 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
290 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
291
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
292 // Get U
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
293 dst[1] = dst[2] +
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
294 (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
295 dstStride[1] = dstStride[2];
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
296 }
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
297
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
298 if (m_int.fHWAccel) {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
299 int w, h;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
300
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
301 w = m_int.stride[0];
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
302 h = SRC_HEIGHT;
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 packed or Y
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
305 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
306 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
307
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
308 // YV12 or YVU9 ?
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
309 if (m_int.nChromaShift) {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
310 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
311
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
312 // Copy U
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
313 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
314 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
315
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
316 // Copy V
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
317 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
318 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
319 }
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
320 } else {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
321 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
322 dst, dstStride);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
323 }
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
324
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
325 kvaUnlockBuffer();
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
326 }
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
327 }
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 // 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
330 // which supports upscaling only.
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
331 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
332 MPARAM mp2)
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
333 {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
334 switch (msg) {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
335 case WM_QUERYTRACKINFO:
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 PTRACKINFO pti = (PTRACKINFO)mp2;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
338 RECTL rcl;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
339
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
340 if (vo_fs)
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
341 break;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
342
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
343 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
344
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
345 rcl.xLeft = 0;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
346 rcl.yBottom = 0;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
347 rcl.xRight = SRC_WIDTH + 1;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
348 rcl.yTop = SRC_HEIGHT + 1;
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 WinCalcFrameRect(hwnd, &rcl, FALSE);
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 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
353 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
354
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
355 pti->ptlMaxTrackSize.x = vo_screenwidth;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
356 pti->ptlMaxTrackSize.y = vo_screenheight;
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 return (MRESULT)TRUE;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
359 }
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 case WM_ADJUSTWINDOWPOS:
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
362 {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
363 PSWP pswp = (PSWP)mp1;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
364 RECTL rcl;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
365
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
366 if (vo_fs)
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
367 break;
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 (pswp->fl & SWP_SIZE) {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
370 rcl.xLeft = pswp->x;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
371 rcl.yBottom = pswp->y;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
372 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
373 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
374
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
375 WinCalcFrameRect(hwnd, &rcl, TRUE);
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 <= SRC_WIDTH)
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
378 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
379
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
380 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
381 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
382
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
383 WinCalcFrameRect(hwnd, &rcl, FALSE);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
384
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
385 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
386 rcl.xLeft = 0;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
387 rcl.xRight = vo_screenwidth;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
388 }
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
389
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
390 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
391 rcl.yBottom = 0;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
392 rcl.yTop = vo_screenheight;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
393 }
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 pswp->fl |= SWP_MOVE;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
396 pswp->x = rcl.xLeft;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
397 pswp->y = rcl.yBottom;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
398 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
399 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
400 }
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
401 break;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
402 }
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
403 }
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
404
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
405 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
406 }
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 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
409 {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
410 // 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
411 if (WinID != -1 &&
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
412 ((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
413 (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
414 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
415
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
416 return (MRESULT)TRUE;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
417 }
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 switch (msg) {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
420 case WM_CLOSE:
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
421 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
422
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
423 return 0;
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 case WM_CHAR:
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
426 {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
427 USHORT fsFlags = SHORT1FROMMP(mp1);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
428 UCHAR uchScan = CHAR4FROMMP(mp1);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
429 USHORT usCh = SHORT1FROMMP(mp2);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
430 USHORT usVk = SHORT2FROMMP(mp2);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
431 int mpkey;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
432
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
433 if (fsFlags & KC_KEYUP)
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
434 break;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
435
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
436 if (fsFlags & KC_SCANCODE) {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
437 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
438 if (mpkey) {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
439 // 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
440 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
441 mpkey = KEY_KPINS;
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 // 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
444 if (mpkey == KEY_KPDEC && usCh != '.')
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
445 mpkey = KEY_KPDEL;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
446
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
447 mplayer_put_key(mpkey);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
448
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
449 return (MRESULT)TRUE;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
450 }
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 if (fsFlags & KC_VIRTUALKEY) {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
454 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
455 if (mpkey) {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
456 mplayer_put_key(mpkey);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
457
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
458 return (MRESULT)TRUE;
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 }
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
461
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
462 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
463 mplayer_put_key(usCh);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
464
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
465 return (MRESULT)TRUE;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
466 }
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
467
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
468 case WM_BUTTON1DOWN:
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
469 case WM_BUTTON3DOWN:
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
470 case WM_BUTTON2DOWN:
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
471 case WM_BUTTON1DBLCLK:
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
472 case WM_BUTTON3DBLCLK:
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
473 case WM_BUTTON2DBLCLK:
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
474 if (WinQueryFocus(HWND_DESKTOP) != hwnd)
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
475 WinSetFocus(HWND_DESKTOP, hwnd);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
476 else if (!vo_nomouse_input)
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
477 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
478
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
479 return (MRESULT)TRUE;
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 case WM_PAINT:
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
482 {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
483 HPS hps;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
484 RECTL rcl, rclDst;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
485 PRECTL prcl = NULL;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
486 HRGN hrgn, hrgnDst;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
487 RGNRECT rgnCtl;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
488
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
489 // get a current movie area
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
490 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
491
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
492 // get a current invalidated area
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
493 hps = WinBeginPaint(hwnd, NULLHANDLE, &rcl);
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 // 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
496 hrgn = GpiCreateRegion(hps, 1, &rcl);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
497 // 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
498 hrgnDst = GpiCreateRegion(hps, 1, &rclDst);
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 // 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
501 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
502
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
503 // get rectangles from the region
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
504 rgnCtl.ircStart = 1;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
505 rgnCtl.ulDirection = RECTDIR_LFRT_TOPBOT;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
506 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
507
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
508 if (rgnCtl.crcReturned > 0) {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
509 rgnCtl.crc = rgnCtl.crcReturned;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
510 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
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 // draw black bar if needed
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
514 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
515 int i;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
516
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
517 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
518 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
519 }
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
520
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
521 free(prcl);
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 GpiDestroyRegion(hps, hrgnDst);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
524 GpiDestroyRegion(hps, hrgn);
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 WinEndPaint(hps);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
527
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
528 return 0;
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 }
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 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
533 }
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
534
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
535 // 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
536 static void morphToPM(void)
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 PPIB pib;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
539
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
540 DosGetInfoBlocks(NULL, &pib);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
541
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
542 // 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
543 if (pib->pib_ultype == 2)
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
544 pib->pib_ultype = 3;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
545 }
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
546
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
547 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
548 {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
549 HWND hwndParent;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
550 ULONG flFrameFlags;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
551 ULONG kvaMode = 0;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
552
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
553 int fUseSnap = 0;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
554 int fUseWO = 0;
34557
8ae9ca41186d Add VMAN-backend supports
komh
parents: 34556
diff changeset
555 int fUseVman = 0;
28915
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
556 int fUseDive = 0;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
557 int fFixT23 = 0;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
558
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
559 const opt_t subopts[] = {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
560 {"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
561 {"wo", OPT_ARG_BOOL, &fUseWO, NULL},
34557
8ae9ca41186d Add VMAN-backend supports
komh
parents: 34556
diff changeset
562 {"vman", OPT_ARG_BOOL, &fUseVman, NULL},
28915
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
563 {"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
564 {"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
565 {NULL, 0, NULL, NULL}
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
34557
8ae9ca41186d Add VMAN-backend supports
komh
parents: 34556
diff changeset
568 PCSZ pcszVideoModeStr[3] = {"DIVE", "WarpOverlay!", "SNAP", "VMAN"};
28915
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 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
571 return -1;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
572
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
573 morphToPM();
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
574
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
575 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
576
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
577 m_int.hab = WinInitialize(0);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
578 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
579
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
580 WinRegisterClass(m_int.hab,
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
581 WC_MPLAYER,
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
582 WndProc,
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
583 CS_SIZEREDRAW | CS_MOVENOTIFY,
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
584 sizeof(PVOID));
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
585
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
586 if (WinID == -1) {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
587 hwndParent = HWND_DESKTOP;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
588 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
589 FCF_SIZEBORDER | FCF_TASKLIST;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
590 } else {
32482
cc24ebf93de4 Prevent a parent window from painting over our window on slave mode
komh
parents: 32467
diff changeset
591 ULONG ulStyle;
cc24ebf93de4 Prevent a parent window from painting over our window on slave mode
komh
parents: 32467
diff changeset
592
28915
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
593 hwndParent = HWNDFROMWINID(WinID);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
594 flFrameFlags = 0;
32482
cc24ebf93de4 Prevent a parent window from painting over our window on slave mode
komh
parents: 32467
diff changeset
595
cc24ebf93de4 Prevent a parent window from painting over our window on slave mode
komh
parents: 32467
diff changeset
596 // 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
597 ulStyle = WinQueryWindowULong(hwndParent, QWL_STYLE);
cc24ebf93de4 Prevent a parent window from painting over our window on slave mode
komh
parents: 32467
diff changeset
598 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
599 }
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
600
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
601 m_int.hwndFrame =
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
602 WinCreateStdWindow(hwndParent, // parent window handle
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
603 WS_VISIBLE, // frame window style
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
604 &flFrameFlags, // window style
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
605 WC_MPLAYER, // class name
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
606 "", // window title
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
607 0L, // default client style
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
608 NULLHANDLE, // resource in exe file
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
609 1, // frame window id
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
610 &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
611
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
612 if (m_int.hwndFrame == NULLHANDLE)
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
613 return -1;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
614
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
615 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
616 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
617 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
618
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
619 m_int.fFixT23 = fFixT23;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
620
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
621 if (m_int.fFixT23)
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
622 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
623 NewFrameWndProc);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
624
34557
8ae9ca41186d Add VMAN-backend supports
komh
parents: 34556
diff changeset
625 if (!!fUseSnap + !!fUseWO + !!fUseVman + !!fUseDive > 1)
28915
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
626 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
627
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
628 if (fUseSnap)
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
629 kvaMode = KVAM_SNAP;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
630 else if (fUseWO)
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
631 kvaMode = KVAM_WO;
34557
8ae9ca41186d Add VMAN-backend supports
komh
parents: 34556
diff changeset
632 else if (fUseVman)
8ae9ca41186d Add VMAN-backend supports
komh
parents: 34556
diff changeset
633 kvaMode = KVAM_VMAN;
28915
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
634 else if (fUseDive)
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
635 kvaMode = KVAM_DIVE;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
636 else
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
637 kvaMode = KVAM_AUTO;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
638
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
639 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
640 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
641
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
642 return -1;
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
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
645 kvaCaps(&m_int.kvac);
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 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
648 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
649
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
650 kvaDisableScreenSaver();
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
651
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
652 // 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
653 // 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
654 _control87(MCW_EM, MCW_EM);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
655
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
656 return 0;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
657 }
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
658
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
659 static void uninit(void)
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
660 {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
661 kvaEnableScreenSaver();
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
662
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
663 imgFree();
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 sws_freeContext(m_int.sws);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
666
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
667 if (m_int.hwndFrame != NULLHANDLE) {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
668 kvaResetAttr();
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
669 kvaDone();
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
670
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
671 if (m_int.fFixT23)
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
672 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
673
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
674 WinDestroyWindow(m_int.hwndFrame);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
675 }
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
676
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
677 WinDestroyMsgQueue(m_int.hmq);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
678 WinTerminate(m_int.hab);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
679 }
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 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
682 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
683 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
684 {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
685 RECTL rcl;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
686
34310
7ef4cfcb1791 vo_kva: support -title.
reimar
parents: 33305
diff changeset
687 if (vo_wintitle)
7ef4cfcb1791 vo_kva: support -title.
reimar
parents: 33305
diff changeset
688 title = vo_wintitle;
7ef4cfcb1791 vo_kva: support -title.
reimar
parents: 33305
diff changeset
689
28915
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
690 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
691 "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
692 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
693
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
694 imgFree();
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
695
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
696 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
697 &m_int.nChromaShift))
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
698 return 1;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
699
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
700 m_int.iImageFormat = format;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
701
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
702 // 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
703 // 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
704 if (!m_int.fHWAccel) {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
705 int dstFormat = 0;
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 sws_freeContext(m_int.sws);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
708
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
709 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
710 dstFormat = IMGFMT_YV12;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
711 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
712 dstFormat = IMGFMT_YUY2;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
713 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
714 dstFormat = IMGFMT_YVU9;
34556
7e3b96b760ae Add IMGFMT_BGR32 supports
komh
parents: 34310
diff changeset
715 else if (m_int.kvac.ulInputFormatFlags & KVAF_BGR32)
7e3b96b760ae Add IMGFMT_BGR32 supports
komh
parents: 34310
diff changeset
716 dstFormat = IMGFMT_BGR32;
28915
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
717 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
718 dstFormat = IMGFMT_BGR24;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
719 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
720 dstFormat = IMGFMT_BGR16;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
721 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
722 dstFormat = IMGFMT_BGR15;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
723
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
724 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
725 return 1;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
726
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
727 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
728 width, height, dstFormat);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
729 }
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
730
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
731 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
732
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
733 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
734 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
735 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
736 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
737 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
738 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
739 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
740 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
741 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
742 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
743 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
744 m_int.kvas.fDither = TRUE;
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 if (kvaSetup(&m_int.kvas)) {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
747 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
748
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
749 return 1;
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.lStride = width * m_int.bpp;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
753
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
754 imgCreate();
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
755
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
756 if (WinID == -1) {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
757 WinSetWindowText(m_int.hwndFrame, title);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
758
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
759 // 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
760 if (vo_config_count == 0)
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
761 vo_fs = flags & VOFLAG_FULLSCREEN;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
762
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
763 // 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
764 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
765 d_width++;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
766 d_height++;
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
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
769 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
770 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
771 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
772 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
773
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
774 if (vo_fs) {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
775 d_width = vo_screenwidth;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
776 d_height = vo_screenheight;
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 // 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
779 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
780
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
781 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
782 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
783 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
784
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
785 setAspectRatio(KVAR_FORCEANY);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
786 }
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
787
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
788 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
789 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
790 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
791 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
792 } else {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
793 vo_fs = 0;
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 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
796 rcl = m_int.rclDst;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
797 }
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
798
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
799 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
800
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
801 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
802 rcl.xLeft, rcl.yBottom,
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
803 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
804 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
805 (WinID == -1 ? SWP_ACTIVATE : 0));
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
806
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
807 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
808
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
809 return 0;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
810 }
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
811
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
812 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
813 {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
814 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
815 return VO_FALSE;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
816
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
817 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
818 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
819 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
820 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
821
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
822 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
823 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
824 }
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
825
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
826 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
827 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
828 mpi->flags |= MP_IMGFLAG_DIRECT;
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 return VO_TRUE;
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
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
833 return VO_FALSE;
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
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
836 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
837 {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
838 // 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
839 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
840 return VO_TRUE;
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 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
843
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
844 return VO_TRUE;
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
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
847 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
848 {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
849 BOOL fHWAccel;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
850 int res;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
851
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
852 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
853 return 0;
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 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
856 if (fHWAccel) {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
857 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
858
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
859 if (!m_int.fFixT23)
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
860 res |= VFCAP_HWSCALE_DOWN;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
861 }
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
862
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
863 return res;
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
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
866 static int fs_toggle(void)
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 RECTL rcl;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
869
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
870 vo_fs = !vo_fs;
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 if (vo_fs) {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
873 SWP swp;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
874
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
875 WinQueryWindowPos(m_int.hwndFrame, &swp);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
876 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
877 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
878 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
879 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
880 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
881
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
882 if (WinID != -1)
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
883 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
884
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
885 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
886 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
887 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
888
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
889 rcl.xLeft = 0;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
890 rcl.yBottom = 0;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
891 rcl.xRight = vo_screenwidth;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
892 rcl.yTop = vo_screenheight;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
893
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
894 setAspectRatio(KVAR_FORCEANY);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
895 } else {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
896 if (WinID != -1)
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
897 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
898
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
899 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
900 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
901 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
902
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
903 rcl = m_int.rclDst;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
904
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
905 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
906 }
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
907
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
908 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
909
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
910 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
911 rcl.xLeft, rcl.yBottom,
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
912 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
913 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
914 (WinID == -1 ? SWP_ACTIVATE : 0));
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
915
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
916 return VO_TRUE;
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
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
919 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
920 {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
921 ULONG ulAttr;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
922 ULONG ulValue;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
923
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
924 if (!strcmp(what, "brightness"))
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
925 ulAttr = KVAA_BRIGHTNESS;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
926 else if (!strcmp(what, "contrast"))
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
927 ulAttr = KVAA_CONTRAST;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
928 else if (!strcmp(what, "hue"))
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
929 ulAttr = KVAA_HUE;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
930 else if (!strcmp(what, "saturation"))
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
931 ulAttr = KVAA_SATURATION;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
932 else
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
933 return VO_NOTIMPL;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
934
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
935 ulValue = (value + 100) * 255 / 200;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
936
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
937 if (kvaSetAttr(ulAttr, &ulValue))
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
938 return VO_NOTIMPL;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
939
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
940 return VO_TRUE;
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
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
943 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
944 {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
945 ULONG ulAttr;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
946 ULONG ulValue;
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 if (!strcmp(what, "brightness"))
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
949 ulAttr = KVAA_BRIGHTNESS;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
950 else if (!strcmp(what, "contrast"))
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
951 ulAttr = KVAA_CONTRAST;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
952 else if (!strcmp(what, "hue"))
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
953 ulAttr = KVAA_HUE;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
954 else if (!strcmp(what, "saturation"))
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
955 ulAttr = KVAA_SATURATION;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
956 else
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
957 return VO_NOTIMPL;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
958
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
959 if (kvaQueryAttr(ulAttr, &ulValue))
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
960 return VO_NOTIMPL;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
961
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
962 // add 1 to adjust range
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
963 *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
964
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
965 return VO_TRUE;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
966 }
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
967
33305
ddb45e9443ec Remove the variable arguments from the libvo control() functions.
iive
parents: 33301
diff changeset
968 static int control(uint32_t request, void *data)
28915
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
969 {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
970 switch (request) {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
971 case VOCTRL_GET_IMAGE:
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
972 return get_image(data);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
973
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
974 case VOCTRL_DRAW_IMAGE:
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
975 return draw_image(data);
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 case VOCTRL_QUERY_FORMAT:
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
978 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
979
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
980 case VOCTRL_FULLSCREEN:
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
981 return fs_toggle();
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 case VOCTRL_SET_EQUALIZER:
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
984 {
33301
899d817e56fc Implement control() VOCTRL_SET/GET_EQUALIZER using a vf_equalize struct,
iive
parents: 32483
diff changeset
985 vf_equalizer_t *eq=data;
899d817e56fc Implement control() VOCTRL_SET/GET_EQUALIZER using a vf_equalize struct,
iive
parents: 32483
diff changeset
986 return color_ctrl_set(eq->item, eq->value);
28915
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
987 }
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 case VOCTRL_GET_EQUALIZER:
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
990 {
33301
899d817e56fc Implement control() VOCTRL_SET/GET_EQUALIZER using a vf_equalize struct,
iive
parents: 32483
diff changeset
991 vf_equalizer_t *eq=data;
899d817e56fc Implement control() VOCTRL_SET/GET_EQUALIZER using a vf_equalize struct,
iive
parents: 32483
diff changeset
992 return color_ctrl_get(eq->item, &eq->value);
28915
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
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
995 case VOCTRL_UPDATE_SCREENINFO:
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
996 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
997 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
998
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
999 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
1000
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1001 return VO_TRUE;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1002 }
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_NOTIMPL;
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_frame(uint8_t *src[])
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 return VO_ERROR;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1010 }
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 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
1013 {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1014 uint8_t *s;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1015 uint8_t *d;
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 // copy packed or Y
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1018 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
1019 s = src[0];
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1020 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
1021
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1022 // YV12 or YVU9
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1023 if (m_int.nChromaShift) {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1024 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
1025 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
1026
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1027 // copy U
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1028 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
1029 s = src[1];
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[1], stride[1]);
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 // copy V
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1033 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
1034 s = src[2];
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1035 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
1036 }
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1037
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1038 return 0;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1039 }
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 #define vo_draw_alpha(imgfmt) \
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1042 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
1043 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
1044 m_int.stride[0])
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1045
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1046 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
1047 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
1048 {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1049 switch (m_int.iImageFormat) {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1050 case IMGFMT_YV12:
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1051 case IMGFMT_YVU9:
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1052 vo_draw_alpha(yv12);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1053 break;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1054
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1055 case IMGFMT_YUY2:
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1056 vo_draw_alpha(yuy2);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1057 break;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1058
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1059 case IMGFMT_BGR24:
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1060 vo_draw_alpha(rgb24);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1061 break;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1062
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1063 case IMGFMT_BGR16:
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1064 vo_draw_alpha(rgb16);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1065 break;
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 case IMGFMT_BGR15:
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1068 vo_draw_alpha(rgb15);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1069 break;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1070 }
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 draw_osd(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 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
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 flip_page(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 imgDisplay();
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
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1083 static void check_events(void)
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1084 {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1085 QMSG qm;
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 // 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
1088 // parent window size
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1089 if (WinID != -1) {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1090 RECTL rcl;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1091
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1092 WinQueryWindowRect(HWNDFROMWINID(WinID), &rcl);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1093
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1094 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
1095 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
1096 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
1097 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
1098 WinSetWindowPos(m_int.hwndFrame, NULLHANDLE,
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1099 rcl.xLeft, rcl.yBottom,
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1100 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
1101 SWP_SIZE | SWP_MOVE);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1102
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1103 m_int.rclParent = rcl;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1104 }
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1105 }
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1106
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1107 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
1108 WinDispatchMsg(m_int.hab, &qm);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1109 }