problem with changing ACM codec's format - i am pretty desperate ...
problem with changing ACM codec's format - i am pretty desperate ...
in my project I need to convert audio files to wav files with codec - specified by user (e.g. u-Law,ADPCM,a-Law) and format also specified by user (frequency stereo/mono etc.) ; the project itself is in C# ,but due to incomplete managed interfaces of DirectShow , I decided to use C++ functions that use DirectShow that I call from C# from DLL by platform invoke; the problem is in IAMStreamConfig interface -> SetFormat method returns VFW_E_NOTCONNECTED error , and I call SetFormat after I connect the graph (either manually or with intelligent connect) . after trying to solve this problem for several weeks I am getting pretty desperate...anyone knows maybe what can be the problem
problem with changing ACM codec's format - i am pretty desperate ...
Tryin2Bgood
quote : "Are you setting the format on the pin before or after you connect " - I read some documentation again , and didn't find there anything about importance of change format before or after graph connection...I think the filter is supposed to reconnect it's pin with new format type if the graph is connected when I change format, no
Also I would like to thank you for answering my question ... you have given me new hope :)
Krutika
If you use the library I mentioned, there should be no need for the unmanaged C++ code.
I don't believe you can change which of the available media types GraphEdit uses to connect. It will just use the first one it finds that it can connect with.
The reason I was suggesting using GraphEdit was to use the Connect feature to connect to the graph you build programmatically to see if it is what you intend.
Are you setting the format on the pin before or after you connect
Lentilbean
A couple of thoughts:
1) For c#, you might take a look at http://DirectShowNet.SourceForge.Net It supports much more of the DS functionality than MS's managed solution.
2) According to the docs, this error is supposed to be returned if the *input* pin is not connected. Is that the point at which you are calling it Or are you only doing it after connecting the output pin
3) Have you tried connecting with GraphEdt to make sure the graph you are building is the one you intend
snuffy
yes , I tried in GraphEdit and it worked , though I don't know how to change media type of output pin of codec filter (inside GraphEdit) other than that the graph worked. In project it works also , but when I try to change media type that ACM codec's output pin (just like in example : http://www.codeproject.com/audio/dshowencoder.asp)
the graph just writes default format for each codec (for example for plain PCM format it always writes 22kHz 8bit format no matter what media type I set with IAMStreamConfig->SetFormat() method)