问题
I am creating a program that will record microphone audio and convert it into mp3 using the DirectShow API in Visual C++. There is no built in filter to convert to convert audio into MPEG Layer 3 i.e. MP3 so i want to send the mic buffer to an external library called as LAME , it will convert the data in MP3 and then i can write it to a file using a file writer. But the problem is that i dont know how to access the buffer of the microphone , please help me i am new in directshow programming..
or tell me any other way to do it
回答1:
If you want to distribute your application then I will suggest to use Sample Grabber instead of Lame DirectShow Encoder filter. This will avoid filter registration but you will need to handle conversion logic.
Regarding using LAME encoder,
- what is the return value of hr = pOutputDevice->FindPin().
- you can give a try using GraphEdit and check for pin properties.
回答2:
You should be able to do this using a Sample Grabber.
You set it up with a callback object that will receive the samples. You can create a graph with just the source, the sample grabber and a Null Renderer.
来源:https://stackoverflow.com/questions/27243500/to-capture-the-buffer-of-a-microphone