Skip to main content
gamedev.net
🔒 Locked

DirectShow Base Classes

Started by thekiwimaddog 4 replies 1.3k views
Original Post
thekiwimaddog
thekiwimaddog
Hi everyone, I wondered if someone could clear something up for me. I've been experimenting with video textures and I've been having some problems when using the Directshow Base Pin Class. In particular:
virtual HRESULT CheckMediaType( const CMediaType *pmt ) = 0;

From what I understand, this is called with a proposed media type and you can then return S_OK when you find a sutible format. What I don't understand is how these calls can vary between computers. From testing, one machine will be offered different formats than others. The same codecs are installed on all machines so I'm wondering what the factors are that influence this? Is it GFX card limitations (enven tho the codec doesn't require hardware), current Display setup or maybe GFX drivers? I'm just having a hard time as when I get a video texture working on one machine, the next machine will instead launch an "ActiveMovie Window" as I'm guessing it was unable to find a suitable format.

Please correct me if I'm not understanding the process correctly as I think this is where I'm going wrong!

Here is the code I'm using:
HRESULT CVideoTextureRenderer::CheckMediaType(const CMediaType *pmt){	HRESULT   hr = E_FAIL;	VIDEOINFO *pvi=0;	CheckPointer(pmt,E_POINTER);	// Reject the connection if this is not a video type	if( *pmt->FormatType() != FORMAT_VideoInfo )	{		ErrorLog("CheckMediaType() - Not A Video Type!",NULL);		return E_INVALIDARG;	}	// Only accept RGB24 video	pvi = (VIDEOINFO *)pmt->Format();	if(IsEqualGUID( *pmt->Type(),    MEDIATYPE_Video)  &&		IsEqualGUID( *pmt->Subtype(), MEDIASUBTYPE_RGB24))	{		hr = S_OK;		ErrorLog("CheckMediaType() - Found Matching Format!",NULL);	}	else	{		ErrorLog("CheckMediaType() - Not RGB24 Video Format!",NULL);	}	return hr;}

Any advice would be great!

Thanks in advance!
David

[Edited by - thekiwimaddog on October 3, 2010 5:16:26 AM]
hossainiir
hossainiir
hi, i'm using this code and work well in my pc and also another pcs.
it worked on about 30 pcs and no error occured.
i test on win7 x86 x64 ,win vista x86 x64,win xp x86.
maby your video file did't convert well!!

excuse for bad english.
???? ?? ??? ???? Persian Gulf
thekiwimaddog
thekiwimaddog
Quote:
Original post by hossainiir
hi, i'm using this code and work well in my pc and also another pcs.
it worked on about 30 pcs and no error occured.
i test on win7 x86 x64 ,win vista x86 x64,win xp x86.
maby your video file did't convert well!!

excuse for bad english.


I've tried many other machines and some work others don't. I've also tried other videos. I still get differing results from machine to machine. Does this mean that you would expect the same proposed media types for all machines? There is no reason why I would be getting different reults from different machines?
I've seen that sometimes other applications will show the "ActiveMovie Window" instead of running within the app.
Can someone explain why this happens??

Thanks Again
David
hossainiir
hossainiir
can you write the codes of "DoRenderSample"??
???? ?? ??? ???? Persian Gulf
thekiwimaddog
thekiwimaddog
Quote:
Original post by hossainiir
can you write the codes of "DoRenderSample"??


Hi again, I'm not sure why that would be relevant as if I don't find a sutible Media Type when CheckMediaType() is called, I'm not going to get as far as DoRenderSample(). The trouble I'm having is that when CheckMediaType() is called the formats it provides me with are different from machine to machine. This is true even when the same codec is installed on all. So I'm just unsure how to handle this as the Types offered are always different. I'm using this for a Video Texture in DX and it would mean writing many different converters from the possible offered Types to the Texture format I'm using.

For example, my machine one of the formats offered is MEDIASUBTYPE_RGB24 for an AVI I'm using. Another machine isn't offered that at all but is offered MEDIASUBTYPE_RGB32. So I've now implemented a converter for both of them but still other machines are not offered either.
I'm assuming this is releated to drivers/hardware specifications.
Am I wrong about this or is not the expected behaviour?

Thanks
David
hossainiir
hossainiir
did you see video filter sample in nvidia directx sdk??
run this sample in computer that have this problem and see this work or not.
if worked use "DoRenderSample" of this sample.
???? ?? ??? ???? Persian Gulf

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.