Dan Sully
2004-Sep-26 23:15 UTC
[Flac-dev] Finding start of audio data using metadata level 2 interface.
* Josh Coalson <xflac@yahoo.com> shaped the electrons to say...>not exactly. the metadata interface won't tell you, but you >can create a decoder (say file decoder), set it up, then call > > FLAC__file_decoder_process_until_end_of_metadata(...) > FLAC__file_decoder_get_decode_position(...) > >and that will tell you. the decode position is relative to >the start of the file even if you have an id3v2 tag in front.Yeah, I was trying to avoid doing that. This is meant for some fast (as opposed to the current pure perl version) header parsing only code, not doing a decoder in this piece as well. It looks like FLAC__Metadata_Chain has a last_offset - but it's not exposed. That should theoretically give me the position after the last metadata block? -D -- Be who you are and say what you feel, because those who mind don't matter and those who matter don't mind. -- Dr. Seuss
Josh Coalson
2004-Sep-27 11:53 UTC
[Flac-dev] Finding start of audio data using metadata level 2 interface.
--- Dan Sully <daniel@electricrain.com> wrote:> * Josh Coalson <xflac@yahoo.com> shaped the electrons to say... > > >not exactly. the metadata interface won't tell you, but you > >can create a decoder (say file decoder), set it up, then call > > > > FLAC__file_decoder_process_until_end_of_metadata(...) > > FLAC__file_decoder_get_decode_position(...) > > > >and that will tell you. the decode position is relative to > >the start of the file even if you have an id3v2 tag in front. > > Yeah, I was trying to avoid doing that. This is meant for some fast > (as > opposed to the current pure perl version) header parsing only code, > not doing > a decoder in this piece as well. > > It looks like FLAC__Metadata_Chain has a last_offset - but it's not > exposed. > That should theoretically give me the position after the last > metadata block?yep, that will work too. but just writing skipping code is pretty simple: is_last=0 read 'fLaC' string while (!is_last) { read 1 byte metadata block type read 3 byte metadata block length is_last = type & 0x80 fseek(file,length,SEEK_CUR) } last_offset=ftell(file) see also: http://flac.sourceforge.net/format.html#metadata_block_header 'length' is big-endian Josh _______________________________ Do you Yahoo!? Declare Yourself - Register online to vote today! http://vote.yahoo.com
Dan Sully
2004-Sep-28 00:22 UTC
[Flac-dev] Finding start of audio data using metadata level 2 interface.
* Josh Coalson <xflac@yahoo.com> shaped the electrons to say...>yep, that will work too. but just writing skipping code is >pretty simple: > >is_last=0 >read 'fLaC' string >while (!is_last) { > read 1 byte metadata block type > read 3 byte metadata block length > is_last = type & 0x80 > fseek(file,length,SEEK_CUR) >} >last_offset=ftell(file) > >see also: > http://flac.sourceforge.net/format.html#metadata_block_header >'length' is big-endianShould type be of FLAC__byte, and length of FLAC__uint32? I'm not having much luck here.. (not a C programmer by nature). -D -- This movie has warped my fragile little mind.