[Flac-dev] Can a libFLAC encoder be initialize and called from inside a libFLAC decoder callback?
david at troendle.org
Tue May 24 12:11:04 PDT 2011
Thanks for the tip, Brian. I did have a version that does everything in
memory, but only had enough memory to get six threads going. (Although my
system has 16GB, I have not taken the time to create 64-bit libraries for
wxWidgets, TagLib, libFLAC, etc.)
Based on the direction you are pointing me in, I assume that encoding from
within the decoder is not permitted.
I really like your idea of the FIFO, and will probably go in that direction.
What do you think of implementing the FIFO via a pipe? That might simplify
Thanks for the advice.
Kindest regards to you and the flac-dev community.
From: Brian Willoughby [mailto:brianw at sounds.wa.com]
Sent: Tuesday, May 24, 2011 1:16 PM
To: David Troendle
Cc: flac-dev at xiph.org
Subject: Re: [Flac-dev] Can a libFLAC encoder be initialize and called from
inside a libFLAC decoder callback?
Have you tried decoding to memory, and encoding from that memory?
This technique would avoid file I/O.
If you are reluctant to allocate enough memory for the full file (and
why not, with a 64-bit system?), then you could implement a FIFO.
You would need a semaphore to keep track of the decoder's progress, and
multithreaded coding. The decoder would pause, whenever the FIFO gets full,
until the encoder empties out the samples so far.
It's also possible that you have made a mistake in InitializeEncoder
() where the new file format does not match the incoming Buffer blocks.
More information about the Flac-dev