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

2006-11-09 Thread Josh Coalson
ok, last night I checked in changes that I think should totally fix
the problem.

before, the process routines would encode a frame as soon as it
got a complete block.  so it could not really tell when it had
reached the end of the input and would rely on the total samples
estimate to set the EOS flag.  but this is bad because it is an
estimate and sometimes even unknown.

so now the process routines 'overread' by one sample, i.e. wait until
there is one more sample than a complete block before encoding it.
the last block is handled by FLAC__stream_encoder_finish()

Josh



 

Cheap talk?
Check out Yahoo! Messenger's low PC-to-Phone call rates.
http://voice.yahoo.com
___
Flac-dev mailing list
Flac-dev@xiph.org
http://lists.xiph.org/mailman/listinfo/flac-dev


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

2006-11-06 Thread Josh Coalson
--- Erik de Castro Lopo [EMAIL PROTECTED] wrote:
 Erik de Castro Lopo wrote:
 
  Josh et al,
  
  I've been tracking down a problem with generating OggFlac files.
 
 snip
 
  I have looked into this and suspect that the
 FLAC__stream_encoder_finish()
  function needs to finish off the stream using a call to
 ogg_stream_flush()
  instead of the standard function ogg_stream_pageout().
 
 I bashed on this a bit further and came up with the following patch:
 
 http://www.mega-nerd.com/tmp/flac-end_of_stream.diff
 
 There's probably a more tasteful way of acheiving the same result,
 but
 this version does fix the problem.

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).

Josh




 

Sponsored Link

Degrees online in as fast as 1 Yr - MBA, Bachelor's, Master's, Associate
Click now to apply http://yahoo.degrees.info
___
Flac-dev mailing list
Flac-dev@xiph.org
http://lists.xiph.org/mailman/listinfo/flac-dev


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

2006-11-06 Thread Erik de Castro Lopo
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
___
Flac-dev mailing list
Flac-dev@xiph.org
http://lists.xiph.org/mailman/listinfo/flac-dev


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

2006-11-06 Thread Ralph Giles
On Tue, Nov 07, 2006 at 06:31:04AM +1100, Erik de Castro Lopo wrote:

 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.

libogg checks the e_o_s flag (and has always done so, according to svn)
so you shouldn't have to call ogg_stream_flush() except when you want to 
force a page boundary (such as after the header packets).

ogg/src/framing.c line 449

One common mistake it to not loop on ogg_stream_pageout() but it looks 
like ogg_encoder_aspect.c is doing that.

 -r
___
Flac-dev mailing list
Flac-dev@xiph.org
http://lists.xiph.org/mailman/listinfo/flac-dev


[Flac-dev] Strangeness with OggFlac files

2006-11-03 Thread Erik de Castro Lopo
Josh et al,

I've been tracking down a problem with generating OggFlac files.

While investigatint this issue I hacked one of the test files from
the test_libFLAC directory of the flac-1.1.3-beta2. The result of
this hacking is this standalone C file:

http://www.mega-nerd.com/tmp/erikd_test.c

Directions for compiling this is in the comments at the top of
the file.

When the program is run, it generates 4 files:

seekable.flac
stream.flac
seekable.ogg
stream.ogg

The problem is that the two OggFlac files are lacking an end-of-stream
marker. For instance, the ogginfo program says: 

[EMAIL PROTECTED]  ogginfo stream.ogg 
Processing file stream.ogg...
New logical stream (#1, serial: 3039): type unknown
Warning: EOS not set on stream 1

[EMAIL PROTECTED]  ogginfo seekable.ogg 
Processing file seekable.ogg...
New logical stream (#1, serial: 3039): type unknown
Warning: EOS not set on stream 1

I have looked into this and suspect that the FLAC__stream_encoder_finish()
function needs to finish off the stream using a call to ogg_stream_flush()
instead of the standard function ogg_stream_pageout().

Josh (or anyone), I'd appreciate it if you could take a look at this.

Cheers,
Erik
-- 
+---+
  Erik de Castro Lopo
+---+
life is too long to be an expert at harmful things, including 
such evilness as C++ and perl. -- Erik Naggum
___
Flac-dev mailing list
Flac-dev@xiph.org
http://lists.xiph.org/mailman/listinfo/flac-dev


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

2006-11-03 Thread Erik de Castro Lopo
Erik de Castro Lopo wrote:

 Josh et al,
 
 I've been tracking down a problem with generating OggFlac files.

snip

 I have looked into this and suspect that the FLAC__stream_encoder_finish()
 function needs to finish off the stream using a call to ogg_stream_flush()
 instead of the standard function ogg_stream_pageout().

I bashed on this a bit further and came up with the following patch:

http://www.mega-nerd.com/tmp/flac-end_of_stream.diff

There's probably a more tasteful way of acheiving the same result, but
this version does fix the problem.

Cheers,
Erik
-- 
+---+
  Erik de Castro Lopo
+---+
Capitalism is an art form, an Apollonian fabrication to rival nature.
It is hypocritical for feminists and intellectuals to enjoy the pleasures
and conveniences of capitalism while sneering at it. Everyone born into
capitalism has incurred a debt to it.
-- Camille Paglia
___
Flac-dev mailing list
Flac-dev@xiph.org
http://lists.xiph.org/mailman/listinfo/flac-dev