Hello,
I'm new to this this forum and I hope it's the suitable one.
This is what I'm trying to do, in C++/Directshow:
- I have 3 sources with an output pin on each one (CSourceStream) : respectively for Video, Audio and Script
- I also have a WM ASF Writer and almost all the required code to set its profile
- I simply wish to connect these sources to the ASF Writer.
This is my current state :
- I can dynamically set the profile's attributes for the Audio and the Video input pins of the ASF Writer and it works well.
- The error 0x80040207 occurs when I use the ConnectDirect() method of the GraphBuilder.
I set the profile of the ASF Writer from scratch by adding each stream with the good mediatype and then update them according the Video/Audio attributes. The Script stream doesn't need to be set dynamically so that I defined it like that in the output pin of the script source :
AM_MEDIA_TYPE mediaType;
mediaType.majortype = WMMEDIATYPE_Script;
mediaType.subtype = GUID_NULL ;
mediaType.bFixedSizeSamples = 0;
mediaType.bTemporalCompression = 0;
mediaType.lSampleSize = 0;
mediaType.formattype = WMFORMAT_Script;
mediaType.pUnk = NULL;
mediaType.cbFormat = sizeof(WMSCRIPTFORMAT);
mediaType.pbFormat = (BYTE*) new WMSCRIPTFORMAT;
((WMSCRIPTFORMAT*)mediaType.pbFormat)->scriptType = WMSCRIPTTYPE_TwoStrings;
This Mediatype is accepted by the profile :
if (SUCCEEDED(hr))
{
hr = pProfile->CreateNewStream(WMMEDIATYPE_Script,&pStreamConfig);
}
if (SUCCEEDED(hr))
{
hr = pStreamConfig->SetStreamName(L"Subtitles Input");
}
if (SUCCEEDED(hr))
{
hr = pStreamConfig->QueryInterface(IID_IWMMediaProps,(void**)&pMediaProp);
}
if (SUCCEEDED(hr))
{
hr = pMediaProp->SetMediaType((WM_MEDIA_TYPE*)&SubTtMediaType);
pMediaProp->Release();
}
if (SUCCEEDED(hr))
{
hr = pProfile->AddStream(pStreamConfig);
}
if (SUCCEEDED(hr))
{
hr = pProfile->ReconfigStream(pStreamConfig);
pStreamConfig->Release();
}
//All succeeded
Am I doing something wrong ?
I read somewhere in another forum that the error 0x80040207 can occur when the pins don't use the same model (push/pull). Here my sources only use the Push model due to technical constraints.
Is it possible to connect a Push source to the Script Input of a WM ASF Writer ? (or only for Video and audio ?)
Thanks for your help
Cheers
OP
Replies