summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJose Fonseca <jfonseca@vmware.com>2016-05-13 07:23:45 -0700
committerJose Fonseca <jfonseca@vmware.com>2016-05-13 07:35:43 -0700
commitf6757272f76575b71954ecc55db810f58febcf13 (patch)
tree713e5e3022acfcb8e57d9d7ad46ab14f283e91d3
parent97d22a7a36523a6dad2b41706c7ab0236c80660e (diff)
d3d9trace: Capture IDirectXVideoDecoder buffer mappings.
By emitting fake memcpys.
-rw-r--r--wrappers/d3d9trace.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/wrappers/d3d9trace.py b/wrappers/d3d9trace.py
index 5f111979..5b966cb0 100644
--- a/wrappers/d3d9trace.py
+++ b/wrappers/d3d9trace.py
@@ -67,6 +67,11 @@ class D3D9Tracer(DllTracer):
('VOID *', 'm_pbData', '0'),
]
+ if interface.name == 'IDirectXVideoDecoder':
+ variables += [
+ ('std::map<UINT, std::pair<void *, UINT> >', '_MappedData', None),
+ ]
+
return variables
def implementWrapperInterfaceMethodBody(self, interface, base, method):
@@ -84,6 +89,13 @@ class D3D9Tracer(DllTracer):
self.emit_memcpy('(LPBYTE)m_pbData', '_MappedSize')
print ' }'
+ if interface.name == 'IDirectXVideoDecoder' and method.name == 'ReleaseBuffer':
+ print ' std::map<UINT, std::pair<void *, UINT> >::iterator it = _MappedData.find(BufferType);'
+ print ' if (it != _MappedData.end()) {'
+ self.emit_memcpy('it->second.first', 'it->second.second')
+ print ' _MappedData.erase(it);'
+ print ' }'
+
DllTracer.implementWrapperInterfaceMethodBody(self, interface, base, method)
if method.name in ('Lock', 'LockRect', 'LockBox'):
@@ -112,6 +124,13 @@ class D3D9Tracer(DllTracer):
print ' _MappedSize = 0;'
print ' }'
+ if interface.name == 'IDirectXVideoDecoder' and method.name == 'GetBuffer':
+ print ' if (SUCCEEDED(_result)) {'
+ print ' _MappedData[BufferType] = std::make_pair(*ppBuffer, *pBufferSize);'
+ print ' } else {'
+ print ' _MappedData[BufferType] = std::make_pair(nullptr, 0);'
+ print ' }'
+
if __name__ == '__main__':
print '#define INITGUID'