Click here to Skip to main content
15,910,877 members

Comments by GrizzlyJames (Top 6 by date)

GrizzlyJames 7-May-13 11:54am View    
Turns out I can't get to the silverlightControlHost div. Everytime I try to get the contentWindow or contentDocument of the iframe I create I get an "Access is denied" error. I would imagine that's because I'm going to a different domain.
GrizzlyJames 6-May-13 19:02pm View    
It appears to be inside of a div. My DOM Tree is as follows (the relevant parts anyways):
<html>
<head>...</head>
<body>
<div id="mainContentBorder>
<div id="mainContent"> <!-- This is what _targetNode is from the code above -->
<iframe> <!-- This is the iframe I create, from here on, I have no control -->
<html>
<head>...</head>
<body>
<form>
<div id="silverlightControlHost">
<object>...</object>
<iframe>...</iframe>
</div>
</form>
</body>
</html>
</iframe>
</div>
</div>
</body>
</html>
GrizzlyJames 12-Sep-12 2:17am View    
Using GraphEdit I found out that the AVI file that I was using had a format that was unsupported by the machine. I did some conversions, and it now runs on the test machine as well!

Thank you very much Maxim Kartavenkov! You will be listed in our games credits for your help. I'll be sure to send you a link to our game once we finish it next month.
GrizzlyJames 11-Sep-12 0:31am View    
Holy crap! I did not know this thing existed! I will definitely try running this tool tomorrow and see what's up.
GrizzlyJames 10-Sep-12 13:07pm View    
Unfortunately, it still does not work on the test machine. For now I'm going to just use AVIFile to get videos to work.

Here is my new code for InitializeDevice if you or anyone else would like to take a look at it:

HRESULT VideoAllocator::InitializeDevice (DWORD_PTR dwUserID, VMR9AllocationInfo* lpAllocInfo, DWORD* lpNumBuffers)
{
EnterCriticalSection(&m_CriticalSection);

if (lpAllocInfo == NULL)
{
#ifndef _RELEASEBUILD
printf("Invalid Allocation pointer in InitializeDevice().\n");
#endif
LeaveCriticalSection(&m_CriticalSection);
return E_POINTER;
}

if (lpNumBuffers == NULL)
{
#ifndef _RELEASEBUILD
printf("Invalid Number of Buffers pointer in InitializeDevice().\n");
#endif
LeaveCriticalSection(&m_CriticalSection);
return E_POINTER;
}

D3DCAPS9 d3dcaps;
DWORD dwWidth = 1;
DWORD dwHeight = 1;

m_pDevice->GetDeviceCaps(&d3dcaps);
if (d3dcaps.TextureCaps & D3DPTEXTURECAPS_POW2)
{
while (dwWidth < lpAllocInfo->dwWidth)
dwWidth <<= 1;
while (dwHeight < lpAllocInfo->dwHeight)
dwHeight <<= 1;
lpAllocInfo->dwWidth = dwWidth;
lpAllocInfo->dwHeight = dwHeight;
}

// Try creating textures first, if the machine can handle it.
lpAllocInfo->dwFlags |= VMR9AllocFlag_TextureSurface;

ReleaseSurfaces();
m_dwSurfaces = *lpNumBuffers;
m_pSurfaces = new IDirect3DSurface9* [m_dwSurfaces];
HRESULT hr = m_pNotify->AllocateSurfaceHelper(lpAllocInfo, lpNumBuffers, m_pSurfaces);

// If we failed, and the format is not an alpha format, then we need to render
// to an off-screen surface, and copy decode the images onto a private texture.
if (FAILED(hr) && !(lpAllocInfo->dwFlags & VMR9AllocFlag_3DRenderTarget))
{
// Is the surface a YUV?
if (lpAllocInfo->Format > '0000')
{
D3DDISPLAYMODE dm;
hr = m_pDevice->GetDisplayMode(NULL, &dm);
if (FAILED(hr))
{
#ifndef _RELEASEBUILD
printf("Failed to get the Display Mode in InitializeDevice().\n");
#endif
LeaveCriticalSection(&m_CriticalSection);
return hr;
}

hr = m_pDevice->CreateTexture(lpAllocInfo->dwWidth, lpAllocInfo->dwHeight,
1, D3DUSAGE_RENDERTARGET, dm.Format, D3DPOOL_DEFAULT, &m_pPrivateTexture, NULL);
if (FAILED(hr))
{
#ifndef _RELEASEBUILD
printf("Failed to create a private texture in InitializeDevice().\n");
#endif
LeaveCriticalSection(&m_CriticalSection);
return hr;
}
}

lpAllocInfo->dwFlags &= ~VMR9AllocFlag_TextureSurface;
lpAllocInfo->dwFlags |= VMR9AllocFlag_OffscreenSurface;

hr = m_pNotify->AllocateSurfaceHelper(lpAllocInfo, lpNumBuffers, m_pSurfaces);
if (FAILED(hr))
{
#ifndef _RELEASEBUILD
printf("Failed to work around this machine, VMR-9 ain't gonna happen.\n");
#endif
LeaveCriticalSection(&m_CriticalSection);
return hr;
}
}

LeaveCriticalSection(&m_CriticalSection);
return hr;
}