annotate libvo/vo_kva.c @ 33714:5fda3578d1c5

Do not assign anything when a stream control returns an error. Avoids issues with some places that don't check the return value of stream_control.
author reimar
date Sun, 03 Jul 2011 09:45:29 +0000
parents ddb45e9443ec
children 7ef4cfcb1791
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 = {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
59 "SNAP/WarpOverlay!/DIVE video output",
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
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
187 case IMGFMT_BGR24:
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
188 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
189 fcc = FOURCC_BGR3;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
190 bpp = 3;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
191 nChromaShift = 0;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
192 break;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
193
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
194 case IMGFMT_BGR16:
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_BGR16;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
196 fcc = FOURCC_R565;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
197 bpp = 2;
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_BGR15:
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_BGR15;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
203 fcc = FOURCC_R555;
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 default:
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
209 return 1;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
210 }
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
211
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
212 if (pfHWAccel)
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
213 *pfHWAccel = fHWAccel;
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 if (pfcc)
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
216 *pfcc = fcc;
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 if (pbpp)
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
219 *pbpp = bpp;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
220
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
221 if (pnChromaShift)
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
222 *pnChromaShift = nChromaShift;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
223
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
224 return 0;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
225 }
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
226
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
227 static void imgCreate(void)
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
228 {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
229 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
230
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
231 switch (m_int.iImageFormat) {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
232 case IMGFMT_YV12:
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
233 size += size / 2;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
234 break;
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 case IMGFMT_YVU9:
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
237 size += size / 8;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
238 break;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
239 }
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
240
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
241 m_int.pbImage = malloc(size);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
242
29062
6a0a30aa2b4a Consistently use MP_MAX_PLANES as size for plane pointer/stride arrays in libvo.
reimar
parents: 28915
diff changeset
243 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
244 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
245 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
246 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
247
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
248 // YV12 or YVU9 ?
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
249 if (m_int.nChromaShift) {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
250 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
251 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
252
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
253 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
254 (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
255 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
256 }
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
257 }
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
258
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
259 static void imgFree(void)
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
260 {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
261 free(m_int.pbImage);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
262
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
263 m_int.pbImage = NULL;
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 imgDisplay(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 PVOID pBuffer;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
269 ULONG ulBPL;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
270
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
271 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
272 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
273 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
274
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
275 // Get packed or Y
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
276 dst[0] = pBuffer;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
277 dstStride[0] = ulBPL;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
278
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
279 // YV12 or YVU9 ?
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
280 if (m_int.nChromaShift) {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
281 // Get V
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
282 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
283 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
284
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
285 // Get U
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
286 dst[1] = dst[2] +
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
287 (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
288 dstStride[1] = dstStride[2];
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
289 }
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
290
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
291 if (m_int.fHWAccel) {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
292 int w, h;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
293
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
294 w = m_int.stride[0];
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
295 h = SRC_HEIGHT;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
296
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
297 // Copy packed or Y
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
298 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
299 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
300
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
301 // YV12 or YVU9 ?
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
302 if (m_int.nChromaShift) {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
303 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
304
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
305 // Copy U
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
306 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
307 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
308
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
309 // Copy V
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
310 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
311 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
312 }
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
313 } else {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
314 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
315 dst, dstStride);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
316 }
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
317
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
318 kvaUnlockBuffer();
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
319 }
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
320 }
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
321
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
322 // 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
323 // which supports upscaling only.
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
324 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
325 MPARAM mp2)
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 switch (msg) {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
328 case WM_QUERYTRACKINFO:
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
329 {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
330 PTRACKINFO pti = (PTRACKINFO)mp2;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
331 RECTL rcl;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
332
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
333 if (vo_fs)
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
334 break;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
335
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
336 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
337
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
338 rcl.xLeft = 0;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
339 rcl.yBottom = 0;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
340 rcl.xRight = SRC_WIDTH + 1;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
341 rcl.yTop = SRC_HEIGHT + 1;
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 WinCalcFrameRect(hwnd, &rcl, FALSE);
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 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
346 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
347
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
348 pti->ptlMaxTrackSize.x = vo_screenwidth;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
349 pti->ptlMaxTrackSize.y = vo_screenheight;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
350
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
351 return (MRESULT)TRUE;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
352 }
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
353
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
354 case WM_ADJUSTWINDOWPOS:
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
355 {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
356 PSWP pswp = (PSWP)mp1;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
357 RECTL rcl;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
358
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
359 if (vo_fs)
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
360 break;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
361
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
362 if (pswp->fl & SWP_SIZE) {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
363 rcl.xLeft = pswp->x;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
364 rcl.yBottom = pswp->y;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
365 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
366 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
367
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
368 WinCalcFrameRect(hwnd, &rcl, TRUE);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
369
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
370 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
371 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
372
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
373 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
374 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
375
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
376 WinCalcFrameRect(hwnd, &rcl, FALSE);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
377
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
378 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
379 rcl.xLeft = 0;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
380 rcl.xRight = vo_screenwidth;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
381 }
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
382
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
383 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
384 rcl.yBottom = 0;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
385 rcl.yTop = vo_screenheight;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
386 }
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
387
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
388 pswp->fl |= SWP_MOVE;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
389 pswp->x = rcl.xLeft;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
390 pswp->y = rcl.yBottom;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
391 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
392 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
393 }
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
394 break;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
395 }
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
396 }
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
397
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
398 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
399 }
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 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
402 {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
403 // 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
404 if (WinID != -1 &&
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
405 ((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
406 (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
407 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
408
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
409 return (MRESULT)TRUE;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
410 }
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
411
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
412 switch (msg) {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
413 case WM_CLOSE:
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
414 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
415
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
416 return 0;
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 case WM_CHAR:
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
419 {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
420 USHORT fsFlags = SHORT1FROMMP(mp1);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
421 UCHAR uchScan = CHAR4FROMMP(mp1);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
422 USHORT usCh = SHORT1FROMMP(mp2);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
423 USHORT usVk = SHORT2FROMMP(mp2);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
424 int mpkey;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
425
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
426 if (fsFlags & KC_KEYUP)
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
427 break;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
428
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
429 if (fsFlags & KC_SCANCODE) {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
430 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
431 if (mpkey) {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
432 // 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
433 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
434 mpkey = KEY_KPINS;
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 // 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
437 if (mpkey == KEY_KPDEC && usCh != '.')
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
438 mpkey = KEY_KPDEL;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
439
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
440 mplayer_put_key(mpkey);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
441
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
442 return (MRESULT)TRUE;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
443 }
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
444 }
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
445
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
446 if (fsFlags & KC_VIRTUALKEY) {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
447 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
448 if (mpkey) {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
449 mplayer_put_key(mpkey);
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 return (MRESULT)TRUE;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
452 }
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
453 }
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
454
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
455 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
456 mplayer_put_key(usCh);
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 case WM_BUTTON1DOWN:
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
462 case WM_BUTTON3DOWN:
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
463 case WM_BUTTON2DOWN:
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
464 case WM_BUTTON1DBLCLK:
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
465 case WM_BUTTON3DBLCLK:
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
466 case WM_BUTTON2DBLCLK:
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
467 if (WinQueryFocus(HWND_DESKTOP) != hwnd)
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
468 WinSetFocus(HWND_DESKTOP, hwnd);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
469 else if (!vo_nomouse_input)
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
470 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
471
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
472 return (MRESULT)TRUE;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
473
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
474 case WM_PAINT:
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
475 {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
476 HPS hps;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
477 RECTL rcl, rclDst;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
478 PRECTL prcl = NULL;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
479 HRGN hrgn, hrgnDst;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
480 RGNRECT rgnCtl;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
481
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
482 // get a current movie area
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
483 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
484
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
485 // get a current invalidated area
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
486 hps = WinBeginPaint(hwnd, NULLHANDLE, &rcl);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
487
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
488 // 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
489 hrgn = GpiCreateRegion(hps, 1, &rcl);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
490 // 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
491 hrgnDst = GpiCreateRegion(hps, 1, &rclDst);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
492
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
493 // 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
494 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
495
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
496 // get rectangles from the region
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
497 rgnCtl.ircStart = 1;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
498 rgnCtl.ulDirection = RECTDIR_LFRT_TOPBOT;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
499 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
500
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
501 if (rgnCtl.crcReturned > 0) {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
502 rgnCtl.crc = rgnCtl.crcReturned;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
503 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
504 }
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
505
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
506 // draw black bar if needed
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
507 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
508 int i;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
509
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
510 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
511 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
512 }
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
513
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
514 free(prcl);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
515
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
516 GpiDestroyRegion(hps, hrgnDst);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
517 GpiDestroyRegion(hps, hrgn);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
518
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
519 WinEndPaint(hps);
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 return 0;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
522 }
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
523 }
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
524
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
525 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
526 }
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
527
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
528 // 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
529 static void morphToPM(void)
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 PPIB pib;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
532
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
533 DosGetInfoBlocks(NULL, &pib);
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 flag from VIO to PM:
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
536 if (pib->pib_ultype == 2)
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
537 pib->pib_ultype = 3;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
538 }
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
539
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
540 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
541 {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
542 HWND hwndParent;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
543 ULONG flFrameFlags;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
544 ULONG kvaMode = 0;
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 int fUseSnap = 0;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
547 int fUseWO = 0;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
548 int fUseDive = 0;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
549 int fFixT23 = 0;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
550
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
551 const opt_t subopts[] = {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
552 {"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
553 {"wo", OPT_ARG_BOOL, &fUseWO, NULL},
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
554 {"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
555 {"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
556 {NULL, 0, NULL, NULL}
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
557 };
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
558
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
559 PCSZ pcszVideoModeStr[3] = {"DIVE", "WarpOverlay!", "SNAP"};
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
560
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
561 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
562 return -1;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
563
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
564 morphToPM();
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
565
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
566 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
567
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
568 m_int.hab = WinInitialize(0);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
569 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
570
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
571 WinRegisterClass(m_int.hab,
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
572 WC_MPLAYER,
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
573 WndProc,
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
574 CS_SIZEREDRAW | CS_MOVENOTIFY,
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
575 sizeof(PVOID));
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 if (WinID == -1) {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
578 hwndParent = HWND_DESKTOP;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
579 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
580 FCF_SIZEBORDER | FCF_TASKLIST;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
581 } else {
32482
cc24ebf93de4 Prevent a parent window from painting over our window on slave mode
komh
parents: 32467
diff changeset
582 ULONG ulStyle;
cc24ebf93de4 Prevent a parent window from painting over our window on slave mode
komh
parents: 32467
diff changeset
583
28915
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
584 hwndParent = HWNDFROMWINID(WinID);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
585 flFrameFlags = 0;
32482
cc24ebf93de4 Prevent a parent window from painting over our window on slave mode
komh
parents: 32467
diff changeset
586
cc24ebf93de4 Prevent a parent window from painting over our window on slave mode
komh
parents: 32467
diff changeset
587 // 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
588 ulStyle = WinQueryWindowULong(hwndParent, QWL_STYLE);
cc24ebf93de4 Prevent a parent window from painting over our window on slave mode
komh
parents: 32467
diff changeset
589 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
590 }
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
591
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
592 m_int.hwndFrame =
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
593 WinCreateStdWindow(hwndParent, // parent window handle
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
594 WS_VISIBLE, // frame window style
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
595 &flFrameFlags, // window style
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
596 WC_MPLAYER, // class name
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
597 "", // window title
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
598 0L, // default client style
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
599 NULLHANDLE, // resource in exe file
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
600 1, // frame window id
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
601 &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
602
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
603 if (m_int.hwndFrame == NULLHANDLE)
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
604 return -1;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
605
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
606 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
607 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
608 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
609
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
610 m_int.fFixT23 = fFixT23;
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.fFixT23)
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
613 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
614 NewFrameWndProc);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
615
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
616 if (!!fUseSnap + !!fUseWO + !!fUseDive > 1)
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
617 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
618
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
619 if (fUseSnap)
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
620 kvaMode = KVAM_SNAP;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
621 else if (fUseWO)
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
622 kvaMode = KVAM_WO;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
623 else if (fUseDive)
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
624 kvaMode = KVAM_DIVE;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
625 else
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
626 kvaMode = KVAM_AUTO;
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 (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
629 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
630
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
631 return -1;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
632 }
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
633
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
634 kvaCaps(&m_int.kvac);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
635
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
636 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
637 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
638
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
639 kvaDisableScreenSaver();
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
640
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
641 // 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
642 // 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
643 _control87(MCW_EM, MCW_EM);
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 return 0;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
646 }
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
647
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
648 static void uninit(void)
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 kvaEnableScreenSaver();
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 imgFree();
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
653
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
654 sws_freeContext(m_int.sws);
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 if (m_int.hwndFrame != NULLHANDLE) {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
657 kvaResetAttr();
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
658 kvaDone();
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
659
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
660 if (m_int.fFixT23)
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
661 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
662
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
663 WinDestroyWindow(m_int.hwndFrame);
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
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
666 WinDestroyMsgQueue(m_int.hmq);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
667 WinTerminate(m_int.hab);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
668 }
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
669
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
670 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
671 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
672 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
673 {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
674 RECTL rcl;
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 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
677 "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
678 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
679
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
680 imgFree();
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
681
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
682 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
683 &m_int.nChromaShift))
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
684 return 1;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
685
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
686 m_int.iImageFormat = format;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
687
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
688 // 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
689 // 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
690 if (!m_int.fHWAccel) {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
691 int dstFormat = 0;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
692
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
693 sws_freeContext(m_int.sws);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
694
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
695 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
696 dstFormat = IMGFMT_YV12;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
697 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
698 dstFormat = IMGFMT_YUY2;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
699 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
700 dstFormat = IMGFMT_YVU9;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
701 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
702 dstFormat = IMGFMT_BGR24;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
703 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
704 dstFormat = IMGFMT_BGR16;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
705 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
706 dstFormat = IMGFMT_BGR15;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
707
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
708 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
709 return 1;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
710
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
711 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
712 width, height, dstFormat);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
713 }
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
714
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
715 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
716
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
717 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
718 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
719 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
720 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
721 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
722 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
723 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
724 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
725 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
726 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
727 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
728 m_int.kvas.fDither = TRUE;
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 if (kvaSetup(&m_int.kvas)) {
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_ERR, "KVA: Setup failed!!!\n");
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 return 1;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
734 }
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
735
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
736 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
737
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
738 imgCreate();
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
739
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
740 if (WinID == -1) {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
741 WinSetWindowText(m_int.hwndFrame, title);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
742
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
743 // 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
744 if (vo_config_count == 0)
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
745 vo_fs = flags & VOFLAG_FULLSCREEN;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
746
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
747 // 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
748 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
749 d_width++;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
750 d_height++;
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
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
753 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
754 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
755 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
756 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
757
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
758 if (vo_fs) {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
759 d_width = vo_screenwidth;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
760 d_height = vo_screenheight;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
761
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
762 // 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
763 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
764
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
765 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
766 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
767 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
768
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
769 setAspectRatio(KVAR_FORCEANY);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
770 }
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
771
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
772 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
773 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
774 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
775 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
776 } else {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
777 vo_fs = 0;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
778
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
779 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
780 rcl = m_int.rclDst;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
781 }
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
782
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
783 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
784
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
785 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
786 rcl.xLeft, rcl.yBottom,
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
787 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
788 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
789 (WinID == -1 ? SWP_ACTIVATE : 0));
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
790
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
791 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
792
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
793 return 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
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
796 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
797 {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
798 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
799 return VO_FALSE;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
800
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
801 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
802 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
803 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
804 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
805
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
806 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
807 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
808 }
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
809
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
810 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
811 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
812 mpi->flags |= MP_IMGFLAG_DIRECT;
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 return VO_TRUE;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
815 }
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
816
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
817 return VO_FALSE;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
818 }
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
819
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
820 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
821 {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
822 // 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
823 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
824 return VO_TRUE;
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 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
827
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
828 return VO_TRUE;
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
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
831 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
832 {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
833 BOOL fHWAccel;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
834 int res;
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 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
837 return 0;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
838
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
839 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
840 if (fHWAccel) {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
841 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
842
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
843 if (!m_int.fFixT23)
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
844 res |= VFCAP_HWSCALE_DOWN;
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 return res;
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
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
850 static int fs_toggle(void)
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 RECTL rcl;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
853
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
854 vo_fs = !vo_fs;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
855
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
856 if (vo_fs) {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
857 SWP swp;
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 WinQueryWindowPos(m_int.hwndFrame, &swp);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
860 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
861 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
862 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
863 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
864 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
865
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
866 if (WinID != -1)
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
867 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
868
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
869 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
870 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
871 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
872
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
873 rcl.xLeft = 0;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
874 rcl.yBottom = 0;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
875 rcl.xRight = vo_screenwidth;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
876 rcl.yTop = vo_screenheight;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
877
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
878 setAspectRatio(KVAR_FORCEANY);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
879 } else {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
880 if (WinID != -1)
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
881 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
882
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
883 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
884 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
885 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
886
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
887 rcl = m_int.rclDst;
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 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
890 }
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
891
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
892 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
893
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
894 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
895 rcl.xLeft, rcl.yBottom,
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
896 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
897 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
898 (WinID == -1 ? SWP_ACTIVATE : 0));
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
899
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
900 return VO_TRUE;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
901 }
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
902
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
903 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
904 {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
905 ULONG ulAttr;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
906 ULONG ulValue;
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 if (!strcmp(what, "brightness"))
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
909 ulAttr = KVAA_BRIGHTNESS;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
910 else if (!strcmp(what, "contrast"))
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
911 ulAttr = KVAA_CONTRAST;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
912 else if (!strcmp(what, "hue"))
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
913 ulAttr = KVAA_HUE;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
914 else if (!strcmp(what, "saturation"))
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
915 ulAttr = KVAA_SATURATION;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
916 else
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
917 return VO_NOTIMPL;
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 ulValue = (value + 100) * 255 / 200;
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 if (kvaSetAttr(ulAttr, &ulValue))
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
922 return VO_NOTIMPL;
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 return VO_TRUE;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
925 }
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
926
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
927 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
928 {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
929 ULONG ulAttr;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
930 ULONG ulValue;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
931
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
932 if (!strcmp(what, "brightness"))
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
933 ulAttr = KVAA_BRIGHTNESS;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
934 else if (!strcmp(what, "contrast"))
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
935 ulAttr = KVAA_CONTRAST;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
936 else if (!strcmp(what, "hue"))
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
937 ulAttr = KVAA_HUE;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
938 else if (!strcmp(what, "saturation"))
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
939 ulAttr = KVAA_SATURATION;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
940 else
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
941 return VO_NOTIMPL;
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 if (kvaQueryAttr(ulAttr, &ulValue))
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
944 return VO_NOTIMPL;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
945
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
946 // add 1 to adjust range
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
947 *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
948
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
949 return VO_TRUE;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
950 }
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
951
33305
ddb45e9443ec Remove the variable arguments from the libvo control() functions.
iive
parents: 33301
diff changeset
952 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
953 {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
954 switch (request) {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
955 case VOCTRL_GET_IMAGE:
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
956 return get_image(data);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
957
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
958 case VOCTRL_DRAW_IMAGE:
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
959 return draw_image(data);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
960
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
961 case VOCTRL_QUERY_FORMAT:
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
962 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
963
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
964 case VOCTRL_FULLSCREEN:
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
965 return fs_toggle();
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 case VOCTRL_SET_EQUALIZER:
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
968 {
33301
899d817e56fc Implement control() VOCTRL_SET/GET_EQUALIZER using a vf_equalize struct,
iive
parents: 32483
diff changeset
969 vf_equalizer_t *eq=data;
899d817e56fc Implement control() VOCTRL_SET/GET_EQUALIZER using a vf_equalize struct,
iive
parents: 32483
diff changeset
970 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
971 }
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
972
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
973 case VOCTRL_GET_EQUALIZER:
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
974 {
33301
899d817e56fc Implement control() VOCTRL_SET/GET_EQUALIZER using a vf_equalize struct,
iive
parents: 32483
diff changeset
975 vf_equalizer_t *eq=data;
899d817e56fc Implement control() VOCTRL_SET/GET_EQUALIZER using a vf_equalize struct,
iive
parents: 32483
diff changeset
976 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
977 }
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
978
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
979 case VOCTRL_UPDATE_SCREENINFO:
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
980 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
981 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
982
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
983 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
984
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
985 return VO_TRUE;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
986 }
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
987
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
988 return VO_NOTIMPL;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
989 }
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
990
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
991 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
992 {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
993 return VO_ERROR;
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
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
996 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
997 {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
998 uint8_t *s;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
999 uint8_t *d;
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 // copy packed or Y
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1002 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
1003 s = src[0];
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1004 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
1005
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1006 // YV12 or YVU9
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1007 if (m_int.nChromaShift) {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1008 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
1009 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
1010
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1011 // copy U
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1012 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
1013 s = src[1];
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1014 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
1015
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1016 // copy V
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1017 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
1018 s = src[2];
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1019 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
1020 }
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 return 0;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1023 }
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1024
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1025 #define vo_draw_alpha(imgfmt) \
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1026 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
1027 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
1028 m_int.stride[0])
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1029
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1030 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
1031 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
1032 {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1033 switch (m_int.iImageFormat) {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1034 case IMGFMT_YV12:
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1035 case IMGFMT_YVU9:
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1036 vo_draw_alpha(yv12);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1037 break;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1038
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1039 case IMGFMT_YUY2:
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1040 vo_draw_alpha(yuy2);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1041 break;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1042
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1043 case IMGFMT_BGR24:
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1044 vo_draw_alpha(rgb24);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1045 break;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1046
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1047 case IMGFMT_BGR16:
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1048 vo_draw_alpha(rgb16);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1049 break;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1050
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1051 case IMGFMT_BGR15:
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1052 vo_draw_alpha(rgb15);
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 }
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1056
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1057 static void draw_osd(void)
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 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
1060 }
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1061
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1062 static void flip_page(void)
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1063 {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1064 imgDisplay();
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1065 }
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1066
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1067 static void check_events(void)
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1068 {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1069 QMSG qm;
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 // 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
1072 // parent window size
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1073 if (WinID != -1) {
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1074 RECTL rcl;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1075
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1076 WinQueryWindowRect(HWNDFROMWINID(WinID), &rcl);
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 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
1079 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
1080 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
1081 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
1082 WinSetWindowPos(m_int.hwndFrame, NULLHANDLE,
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1083 rcl.xLeft, rcl.yBottom,
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1084 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
1085 SWP_SIZE | SWP_MOVE);
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 m_int.rclParent = rcl;
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1088 }
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1089 }
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1090
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1091 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
1092 WinDispatchMsg(m_int.hab, &qm);
c2baa796c5e5 KVA vo driver for OS/2, patch by KO Myung-Hun, komh chollian net
diego
parents:
diff changeset
1093 }