Hey i've recently written some directshow filters for ogg vorbis and speex (www.illiminable.com/ogg/) and i thought i might add flac too... i've had a quick look at the C++ api and it appears that the decoding works by having a read callback to get it's data. In directshow everything is pushed into the decoder it can't ask for data when it wants... i'm just wondering if there is an alternate way to do this... is there support for this style of decoding in the underlying C library ? Does anyone have any ideas about how i can go about doing a decode with only the output callback and no input callback ? Thanks !
P.S. that was for native FLAC, for Ogg FLAC it will be clear from the Ogg layer how big the packet is (one packet = 1 FLAC frame). Josh __________________________________ Do you Yahoo!? Yahoo! Finance Tax Center - File online. File on time. http://taxes.yahoo.com/filing.html
--- illiminable K <illiminable@westnet.com.au> wrote:> In directshow everything is pushed into the decoder it can't ask for > data > when it wants... i'm just wondering if there is an alternate way to > do > this... is there support for this style of decoding in the underlying > C > library ? > > Does anyone have any ideas about how i can go about doing a decode > with only > the output callback and no input callback ?if it's single threaded: I think you will have to have an intermediate buffer that is filled by the push, and read by the read callback. then you have to make sure you don't call FLAC__*_process_single() unless you know there is enough data in the buffer to make a frame, else it will block. you can estimate what a maximum frame size will be using blocksize*bytes_per_sample*channels plus a little overhead (maybe 100 bytes). if it's multithreaded, you should be able to just block in the FLAC read callback for more data to be pushed in. then you don't have to worry about having enough data before calling FLAC__*_process_single(). Josh __________________________________ Do you Yahoo!? Yahoo! Finance Tax Center - File online. File on time. http://taxes.yahoo.com/filing.html
Thanks for the reply, But that still tries to read for itself from libogg... i need to be able to feed data only... it can never try and read for itself. That code is still trying to control the data flow. Basicly i need to operate like this. SetupCodec when i have data to give to the codec FeedDataToCodec(data) //Receive a bunch of callbacks somewhere returning me pcm data //Codec waits for more data and doesn't reset itself. I will always give it a complete ogg packet as a buffer (but not in an oggpacket struct because directshow uses a different sample structure.) and size. And i need it to process the data i give it and then wait until i give it some more. There is no way the codec can read data unless i give it to it. And incidentally i use my own demuxer written in C++ and not libogg. So i have none of the data normal ogg data structures. Thanks ! ----- Original Message ----- From: "Josh Coalson" <xflac@yahoo.com> To: "illiminable K" <illiminable@westnet.com.au>; <flac-dev@lists.sourceforge.net> Sent: Thursday, March 25, 2004 2:56 AM Subject: Re: [Flac-dev] Decoding without read callbacks.> P.S. that was for native FLAC, for Ogg FLAC it will be clear > from the Ogg layer how big the packet is (one packet = 1 FLAC > frame). > > Josh > > > __________________________________ > Do you Yahoo!? > Yahoo! Finance Tax Center - File online. File on time. > http://taxes.yahoo.com/filing.html >