- Take into consideration the image pitch when copying from Direct3D surface (DirectShow plugin only)

- Do not request for flipping when direct rendering is used
This commit is contained in:
bossiel 2013-07-29 05:59:53 +00:00
parent f172ae2a5a
commit 731ffabd8f
3 changed files with 31 additions and 6 deletions

View File

@ -348,6 +348,12 @@ static int plugin_video_dshow_consumer_consume(tmedia_consumer_t* self, const vo
// Force updating the destination rect if negotiated size change
CHECK_HR(hr = UpdateDestinationRect(pSelf, TRUE/* Force */));
}
if(((pSelf->nNegWidth * pSelf->nNegHeight) << 2) != size)
{
TSK_DEBUG_ERROR("%u not valid as input size", size);
CHECK_HR(hr = E_FAIL);
}
CHECK_HR(hr = TestCooperativeLevel(pSelf));
@ -357,15 +363,34 @@ static int plugin_video_dshow_consumer_consume(tmedia_consumer_t* self, const vo
CHECK_HR(hr = pSurf->LockRect(&pSelf->rcLock, NULL, D3DLOCK_NOSYSLOCK ));
// Fast copy() using MMX, SSE, or SSE2
// Only available on Vista or later: Use LoadLibrary() to get a pointer to the function
/*hr = MFCopyImage(
(BYTE*)pSelf->rcLock.pBits,
pSelf->rcLock.Pitch,
(BYTE*)buffer,
pSelf->rcLock.Pitch,
(pSelf->nNegWidth << 2),
(pSelf->nNegWidth << 2),
pSelf->nNegHeight
);*/
memcpy(pSelf->rcLock.pBits, buffer, size); // FIXME: Pitch is ignored
if(pSelf->rcLock.Pitch == (pSelf->nNegWidth << 2))
{
memcpy(pSelf->rcLock.pBits, buffer, size);
}
else
{
const BYTE* pSrcPtr = (const BYTE*)buffer;
BYTE* pDstPtr = (BYTE*)pSelf->rcLock.pBits;
UINT32 nDstPitch = pSelf->rcLock.Pitch;
UINT32 nSrcPitch = (pSelf->nNegWidth << 2);
for(UINT32 i = 0; i < pSelf->nNegHeight; ++i)
{
memcpy(pDstPtr, pSrcPtr, nSrcPitch);
pDstPtr += nDstPitch;
pSrcPtr += nSrcPitch;
}
}
if(FAILED(hr))
{
// unlock() before leaving

View File

@ -51,7 +51,7 @@
extern void tdav_win32_print_error(const char* func, HRESULT hr);
#if !defined(TDAV_DSOUND_PRODUCER_NOTIF_POS_COUNT)
# define TDAV_DSOUND_PRODUCER_NOTIF_POS_COUNT 20
# define TDAV_DSOUND_PRODUCER_NOTIF_POS_COUNT 10
#endif /* TDAV_DSOUND_PRODUCER_NOTIF_POS_COUNT */
typedef struct tdav_producer_dsound_s

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="9,00"
Version="9.00"
Name="tinyMEDIA"
ProjectGUID="{52814B0D-7DCA-45B8-9A16-8B147040D619}"
RootNamespace="tinyMEDIA"
@ -42,7 +42,7 @@
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="&quot;..\thirdparties\win32\include&quot;;include;&quot;..\tinySAK\src&quot;;&quot;..\tinySDP\include&quot;;&quot;..\tinyNET\src&quot;"
PreprocessorDefinitions="DEBUG_LEVEL=DEBUG_LEVEL_INFO;WIN32;_DEBUG;_WINDOWS;_USRDLL;TINYMEDIA_EXPORTS;FLIP_ENCODED_PICT=1;FLIP_DECODED_PICT=1"
PreprocessorDefinitions="DEBUG_LEVEL=DEBUG_LEVEL_INFO;WIN32;_DEBUG;_WINDOWS;_USRDLL;TINYMEDIA_EXPORTS;FLIP_ENCODED_PICT=1;FLIP_DECODED_PICT=0"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
@ -119,7 +119,7 @@
Optimization="3"
EnableIntrinsicFunctions="true"
AdditionalIncludeDirectories="&quot;..\thirdparties\win32\include&quot;;include;&quot;..\tinySAK\src&quot;;&quot;..\tinySDP\include&quot;;&quot;..\tinyNET\src&quot;"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;TINYMEDIA_EXPORTS;FLIP_ENCODED_PICT=1;FLIP_DECODED_PICT=1"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;TINYMEDIA_EXPORTS;FLIP_ENCODED_PICT=1;FLIP_DECODED_PICT=0"
RuntimeLibrary="2"
EnableFunctionLevelLinking="false"
UsePrecompiledHeader="0"