annotate libvo/vo_kva.c @ 36990:89c6bf8bea6b

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