[PATCH] Re: [Flac-dev] Strangeness with OggFlac files

Erik de Castro Lopo erikd-flac at mega-nerd.com
Mon Nov 6 11:31:04 PST 2006


Josh Coalson wrote:

> thanks Erik, can you confirm that this is happening only because
> the total_samples_estimate is 0?  (so the e_o_s setting in the
> existing code is never triggered).

In the Ogg code, I believe that there are two things that must be 
satisfied to correctly write an end of stream:

   - packet.e_o_s must be true
   - Need to call ogg_stream_flush() instead of instead of 
     ogg_stream_pageout()

I haven't tested it, but I don't think just setting packet.e_o_s
is sufficient to close the stream. The forced ogg_stream_flush()
is required.

Maybe these two actions can be carried out in the function
FLAC__ogg_encoder_aspect_finish() which currently only does this:

   void FLAC__ogg_encoder_aspect_finish(FLAC__OggEncoderAspect *aspect)
   {
	(void)ogg_stream_clear(&aspect->stream_state);
	/*@@@ what about the page? */
   }

I could investigate this further, but I'm really busy over the next 
couple of days. I wouldn't be able to look at this until this weekend
or possibly the next.

Erik
-- 
+-----------------------------------------------------------+
  Erik de Castro Lopo
+-----------------------------------------------------------+
"Do I do everything in C++ and teach a course in advanced swearing?"
-- David Beazley at IPC8, on choosing a language for teaching


More information about the Flac-dev mailing list