Welcome to mirror list, hosted at ThFree Co, Russian Federation.

ISubPic.h « SubPic « src - github.com/mpc-hc/mpc-hc.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 0238ea5b6a835581a24431074d43c9e940831363 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
/*
 * (C) 2003-2006 Gabest
 * (C) 2006-2015 see Authors.txt
 *
 * This file is part of MPC-HC.
 *
 * MPC-HC is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 3 of the License, or
 * (at your option) any later version.
 *
 * MPC-HC is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 */

#pragma once

#include <atlbase.h>
#include <atlcoll.h>
#include "CoordGeom.h"

#pragma pack(push, 1)
struct SubPicDesc {
    int type;
    int w, h, bpp, pitch, pitchUV;
    BYTE* bits;
    BYTE* bitsU;
    BYTE* bitsV;
    RECT vidrect; // video rectangle

    struct SubPicDesc()
        : type(0)
        , w(0)
        , h(0)
        , bpp(0)
        , pitch(0)
        , pitchUV(0)
        , bits(nullptr)
        , bitsU(nullptr)
        , bitsV(nullptr) {
        ZeroMemory(&vidrect, sizeof(vidrect));
    }
};
#pragma pack(pop)

enum RelativeTo {
    WINDOW,
    VIDEO,
    BEST_FIT
};

//
// ISubPic
//

interface __declspec(uuid("DA3A5B51-958C-4C28-BF66-68D7947577A2"))
ISubPic :
public IUnknown {
    static const REFERENCE_TIME INVALID_TIME = -1;

    STDMETHOD_(void*, GetObject)() PURE;

    STDMETHOD_(REFERENCE_TIME, GetStart)() const PURE;
    STDMETHOD_(REFERENCE_TIME, GetStop)() const PURE;
    STDMETHOD_(void, SetStart)(REFERENCE_TIME rtStart) PURE;
    STDMETHOD_(void, SetStop)(REFERENCE_TIME rtStop) PURE;

    STDMETHOD(GetDesc)(SubPicDesc& spd /*[out]*/) PURE;
    STDMETHOD(CopyTo)(ISubPic* pSubPic /*[in]*/) PURE;

    STDMETHOD(ClearDirtyRect)(DWORD color /*[in]*/) PURE;
    STDMETHOD(GetDirtyRect)(RECT* pDirtyRect /*[out]*/) const PURE;
    STDMETHOD(SetDirtyRect)(const RECT* pDirtyRect /*[in]*/) PURE;

    STDMETHOD(GetMaxSize)(SIZE* pMaxSize /*[out]*/) const PURE;
    STDMETHOD(SetSize)(SIZE pSize /*[in]*/, RECT vidrect /*[in]*/) PURE;

    STDMETHOD(Lock)(SubPicDesc& spd /*[out]*/) PURE;
    STDMETHOD(Unlock)(RECT* pDirtyRect /*[in]*/) PURE;

    STDMETHOD(AlphaBlt)(RECT * pSrc, RECT * pDst, SubPicDesc* pTarget = nullptr /*[in]*/) PURE;
    STDMETHOD(GetSourceAndDest)(RECT rcWindow /*[in]*/, RECT rcVideo /*[in]*/,
                                RECT* pRcSource /*[out]*/,  RECT* pRcDest /*[out]*/,
                                const double videoStretchFactor = 1.0 /*[in]*/) const PURE;
    STDMETHOD(SetVirtualTextureSize)(const SIZE pSize, const POINT pTopLeft) PURE;
    STDMETHOD(GetRelativeTo)(RelativeTo* pRelativeTo /*[out]*/) const PURE;
    STDMETHOD(SetRelativeTo)(RelativeTo relativeTo /*[in]*/) PURE;

    STDMETHOD_(REFERENCE_TIME, GetSegmentStart)() const PURE;
    STDMETHOD_(REFERENCE_TIME, GetSegmentStop)() const PURE;
    STDMETHOD_(void, SetSegmentStart)(REFERENCE_TIME rtStart) PURE;
    STDMETHOD_(void, SetSegmentStop)(REFERENCE_TIME rtStop) PURE;

    STDMETHOD_(bool, GetInverseAlpha)() const PURE;
    STDMETHOD_(void, SetInverseAlpha)(bool bInverted) PURE;
};

//
// ISubPicAllocator
//

interface __declspec(uuid("CF7C3C23-6392-4a42-9E72-0736CFF793CB"))
ISubPicAllocator :
public IUnknown {
    STDMETHOD(SetCurSize)(SIZE size /*[in]*/) PURE;
    STDMETHOD(SetCurVidRect)(RECT curvidrect) PURE;

    STDMETHOD(GetStatic)(ISubPic** ppSubPic /*[out]*/) PURE;
    STDMETHOD(AllocDynamic)(ISubPic** ppSubPic /*[out]*/) PURE;

    STDMETHOD_(bool, IsDynamicWriteOnly)() const PURE;

    STDMETHOD(ChangeDevice)(IUnknown * pDev) PURE;
    STDMETHOD(SetMaxTextureSize)(SIZE maxTextureSize) PURE;

    STDMETHOD(FreeStatic)() PURE;
};

//
// ISubPicProvider
//

interface __declspec(uuid("D62B9A1A-879A-42db-AB04-88AA8F243CFD"))
ISubPicProvider :
public IUnknown {
    static const REFERENCE_TIME UNKNOWN_TIME = _I64_MAX;

    STDMETHOD(Lock)() PURE;
    STDMETHOD(Unlock)() PURE;

    STDMETHOD_(POSITION, GetStartPosition)(REFERENCE_TIME rt, double fps) PURE;
    STDMETHOD_(POSITION, GetNext)(POSITION pos) PURE;

    STDMETHOD_(REFERENCE_TIME, GetStart)(POSITION pos, double fps) PURE;
    STDMETHOD_(REFERENCE_TIME, GetStop)(POSITION pos, double fps) PURE;

    STDMETHOD_(bool, IsAnimated)(POSITION pos) PURE;

    STDMETHOD(Render)(SubPicDesc & spd, REFERENCE_TIME rt, double fps, RECT & bbox) PURE;
    STDMETHOD(GetTextureSize)(POSITION pos, SIZE & MaxTextureSize, SIZE & VirtualSize, POINT & VirtualTopLeft) PURE;
    STDMETHOD(GetRelativeTo)(POSITION pos, RelativeTo & relativeTo) PURE;
};

//
// ISubPicQueue
//

interface __declspec(uuid("C8334466-CD1E-4ad1-9D2D-8EE8519BD180"))
ISubPicQueue :
public IUnknown {
    STDMETHOD(SetSubPicProvider)(ISubPicProvider* pSubPicProvider /*[in]*/) PURE;
    STDMETHOD(GetSubPicProvider)(ISubPicProvider** pSubPicProvider /*[out]*/) PURE;

    STDMETHOD(SetFPS)(double fps /*[in]*/) PURE;
    STDMETHOD(SetTime)(REFERENCE_TIME rtNow /*[in]*/) PURE;

    STDMETHOD(Invalidate)(REFERENCE_TIME rtInvalidate = -1) PURE;
    STDMETHOD_(bool, LookupSubPic)(REFERENCE_TIME rtNow /*[in]*/, CComPtr<ISubPic>& pSubPic /*[out]*/) PURE;

    STDMETHOD(GetStats)(int& nSubPics, REFERENCE_TIME & rtNow, REFERENCE_TIME & rtStart, REFERENCE_TIME& rtStop /*[out]*/) PURE;
    STDMETHOD(GetStats)(int nSubPic /*[in]*/, REFERENCE_TIME & rtStart, REFERENCE_TIME& rtStop /*[out]*/) PURE;

    STDMETHOD_(bool, LookupSubPic)(REFERENCE_TIME rtNow /*[in]*/, bool bAdviseBlocking, CComPtr<ISubPic>& pSubPic /*[out]*/) PURE;
};

//
// ISubPicAllocatorPresenter
//

interface __declspec(uuid("CF75B1F0-535C-4074-8869-B15F177F944E"))
ISubPicAllocatorPresenter :
public IUnknown {
    STDMETHOD(CreateRenderer)(IUnknown** ppRenderer) PURE;

    STDMETHOD_(SIZE, GetVideoSize)(bool bCorrectAR = true) const PURE;
    STDMETHOD_(void, SetPosition)(RECT w, RECT v) PURE;
    STDMETHOD_(bool, Paint)(bool bAll) PURE;

    STDMETHOD_(void, SetTime)(REFERENCE_TIME rtNow) PURE;
    STDMETHOD_(void, SetSubtitleDelay)(int delayMs) PURE;
    STDMETHOD_(int, GetSubtitleDelay)() const PURE;
    STDMETHOD_(double, GetFPS)() const PURE;

    STDMETHOD_(void, SetSubPicProvider)(ISubPicProvider * pSubPicProvider) PURE;
    STDMETHOD_(void, Invalidate)(REFERENCE_TIME rtInvalidate = -1) PURE;

    STDMETHOD(GetDIB)(BYTE * lpDib, DWORD * size) PURE;

    STDMETHOD(SetVideoAngle)(Vector v) PURE;
    STDMETHOD(SetPixelShader)(LPCSTR pSrcData, LPCSTR pTarget) PURE;

    STDMETHOD_(bool, ResetDevice)() PURE;
    STDMETHOD_(bool, DisplayChange)() PURE;
};

interface __declspec(uuid("767AEBA8-A084-488a-89C8-F6B74E53A90F"))
ISubPicAllocatorPresenter2 :
public ISubPicAllocatorPresenter {
    STDMETHOD(SetPixelShader2)(LPCSTR pSrcData, LPCSTR pTarget, bool bScreenSpace) PURE;
    STDMETHOD_(SIZE, GetVisibleVideoSize)() const PURE;

    STDMETHOD_(bool, IsRendering)() PURE;
    STDMETHOD(SetIsRendering)(bool bIsRendering) PURE;
};

//
// ISubStream
//

interface __declspec(uuid("DE11E2FB-02D3-45e4-A174-6B7CE2783BDB"))
ISubStream :
public IPersist {
    STDMETHOD_(int, GetStreamCount)() PURE;
    STDMETHOD(GetStreamInfo)(int i, WCHAR** ppName, LCID * pLCID) PURE;
    STDMETHOD_(int, GetStream)() PURE;
    STDMETHOD(SetStream)(int iStream) PURE;
    STDMETHOD(Reload)() PURE;
    STDMETHOD(SetSourceTargetInfo)(CString yuvMatrix, int targetBlackLevel, int targetWhiteLevel) PURE;

    // TODO: get rid of IPersist to identify type and use only
    // interface functions to modify the settings of the substream
};