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 :
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 :
hr = pProfile->CreateNewStream(WMMEDIATYPE_Script,&pStreamConfig);
hr = pStreamConfig->SetStreamName(L"Subtitles Input");
hr = pStreamConfig->QueryInterface(IID_IWMMediaProps,(void**)&pMediaProp);
hr = pMediaProp->SetMediaType((WM_MEDIA_TYPE*)&SubTtMediaType);
hr = pProfile->AddStream(pStreamConfig);
hr = pProfile->ReconfigStream(pStreamConfig);
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 ?)