I am writing a small DirectShow application in C ,
and i'm have a lot of trouble fetching the data of the recorded audio.
What i'm trying to achieve :
Microphone->Avi MUX filter->Data buffer->send buffer to server-> write data to an Avi file
How can this be done ? How can I fetch the raw buffer from the Avi Mux filter?
Help would be much appreciated
My current filter graph is built as follow, and it works:
Microphone -> Avi MUX filter -> File writer
This filter graph flow works fine, and i'm able to hear the recording.
CodePudding user response:
Your question lack one important aspect. Are you going to send the data to server as content is being generated, or you want to send on completion and just bypass disk file creation.
In either case you need an equivalent replacement for file writer filter, with your custom filter. SDK Dump Filter Sample [1, 2] might be a good starting point. You will have to extend it to better mimic file writer. This more or less addresses the second variant of mentioned above sending to server on recording completion.
If you also want to send data as recording goes, you will have to put more effort and, probably, extend writer file more (possible, but makes no sense for me), or rather stop using AVI mux at all switching to sending some sort of half-processed content to server where it is combined into playable file and eventually stored.
CodePudding user response:
As Roman already said, you should remove the AVI MUX from your graph. Just send the raw audio data you get from the microphone to the server. And mux the data on the server side to an AVI file.
AVI MUX and FileWriter are a special combination. As the AVI MUX not just outputs chunks of an AVI file, but calls a special interface to write to the file after the filter graph has been stopped!