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
|
/*
* Copyright (C) 2010-2014 Hendrik Leppkes
* http://www.1f0.de
*
* This program 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 2 of the License, or
* (at your option) any later version.
*
* This program 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, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "stdafx.h"
#include "VideoInputPin.h"
CVideoInputPin::CVideoInputPin(TCHAR* pObjectName, CLAVVideo* pFilter, HRESULT* phr, LPWSTR pName)
: CDeCSSTransformInputPin(pObjectName, pFilter, phr, pName)
, m_pLAVVideo(pFilter)
{
}
// IKsPropertySet
STDMETHODIMP CVideoInputPin::Set(REFGUID PropSet, ULONG Id, LPVOID pInstanceData, ULONG InstanceLength, LPVOID pPropertyData, ULONG DataLength)
{
if(PropSet != AM_KSPROPSETID_TSRateChange) {
return __super::Set(PropSet, Id, pInstanceData, InstanceLength, pPropertyData, DataLength);
}
switch(Id) {
case AM_RATE_SimpleRateChange: {
AM_SimpleRateChange* p = (AM_SimpleRateChange*)pPropertyData;
if (!m_CorrectTS) {
return E_PROP_ID_UNSUPPORTED;
}
CAutoLock cAutoLock(&m_csRateLock);
m_ratechange = *p;
}
break;
case AM_RATE_UseRateVersion: {
WORD* p = (WORD*)pPropertyData;
if (*p > 0x0101) {
return E_PROP_ID_UNSUPPORTED;
}
}
break;
case AM_RATE_CorrectTS: {
LONG* p = (LONG*)pPropertyData;
m_CorrectTS = *p;
}
break;
default:
return E_PROP_ID_UNSUPPORTED;
}
return S_OK;
}
STDMETHODIMP CVideoInputPin::Get(REFGUID PropSet, ULONG Id, LPVOID pInstanceData, ULONG InstanceLength, LPVOID pPropertyData, ULONG DataLength, ULONG* pBytesReturned)
{
if(PropSet != AM_KSPROPSETID_TSRateChange) {
return __super::Get(PropSet, Id, pInstanceData, InstanceLength, pPropertyData, DataLength, pBytesReturned);
}
switch(Id) {
case AM_RATE_SimpleRateChange: {
AM_SimpleRateChange* p = (AM_SimpleRateChange*)pPropertyData;
CAutoLock cAutoLock(&m_csRateLock);
*p = m_ratechange;
*pBytesReturned = sizeof(AM_SimpleRateChange);
}
break;
case AM_RATE_MaxFullDataRate: {
AM_MaxFullDataRate* p = (AM_MaxFullDataRate*)pPropertyData;
*p = 2 * 10000;
*pBytesReturned = sizeof(AM_MaxFullDataRate);
}
break;
case AM_RATE_QueryFullFrameRate: {
AM_QueryRate* p = (AM_QueryRate*)pPropertyData;
p->lMaxForwardFullFrame = 2 * 10000;
p->lMaxReverseFullFrame = 0;
*pBytesReturned = sizeof(AM_QueryRate);
}
break;
case AM_RATE_QueryLastRateSegPTS: {
//REFERENCE_TIME* p = (REFERENCE_TIME*)pPropertyData;
return E_PROP_ID_UNSUPPORTED;
}
break;
default:
return E_PROP_ID_UNSUPPORTED;
}
return S_OK;
}
STDMETHODIMP CVideoInputPin::QuerySupported(REFGUID PropSet, ULONG Id, ULONG* pTypeSupport)
{
if(PropSet != AM_KSPROPSETID_TSRateChange) {
return __super::QuerySupported(PropSet, Id, pTypeSupport);
}
switch (Id) {
case AM_RATE_SimpleRateChange:
*pTypeSupport = KSPROPERTY_SUPPORT_GET | KSPROPERTY_SUPPORT_SET;
break;
case AM_RATE_MaxFullDataRate:
*pTypeSupport = KSPROPERTY_SUPPORT_GET;
break;
case AM_RATE_UseRateVersion:
*pTypeSupport = KSPROPERTY_SUPPORT_SET;
break;
case AM_RATE_QueryFullFrameRate:
*pTypeSupport = KSPROPERTY_SUPPORT_GET;
break;
case AM_RATE_QueryLastRateSegPTS:
*pTypeSupport = KSPROPERTY_SUPPORT_GET;
break;
case AM_RATE_CorrectTS:
*pTypeSupport = KSPROPERTY_SUPPORT_SET;
break;
default:
return E_PROP_ID_UNSUPPORTED;
}
return S_OK;
}
|