I'm adding some final features to my CD Ripper and Encoder before the full, version 1 release. As part of that release, the program will offer the ability to play (for review purposes) both WAV and OGG files. I have both the decoder and playback code working but I have one final issue to resolve: finding the play time for the Vorbis bitstream that is being played back. I used the example_encode and example_decode code as the initial basis for my code model (but it has really changes a bunch since I started the project <grin>). Anyway, can someone inform me how I can get this information from the file using the OGG, VORBIS or VORBISENC DLL interfaces? I'd rather not add any new interfaces to get this information. TIA. John Lundy <p><p>--- >8 ---- List archives: http://www.xiph.org/archives/ Ogg project homepage: http://www.xiph.org/ogg/ To unsubscribe from this list, send a message to 'vorbis-request@xiph.org' containing only the word 'unsubscribe' in the body. No subject is needed. Unsubscribe messages sent to the list will be ignored/filtered.
ogg_page og; vorbis_info vi; final_granulepos = ogg_page_granulepos (&og); // (done after last page has been decoded (your final position) final_granulepos / vi.rate; // (gives you time of stream in seconds) <p><p>On Sun, 2002-03-10 at 19:37, John Lundy wrote:> I'm adding some final features to my CD Ripper and Encoder before the full, > version 1 release. As part of that release, the program will offer the > ability to play (for review purposes) both WAV and OGG files. I have both > the decoder and playback code working but I have one final issue to resolve: > finding the play time for the Vorbis bitstream that is being played back. I > used the example_encode and example_decode code as the initial basis for my > code model (but it has really changes a bunch since I started the project > <grin>). Anyway, can someone inform me how I can get this information from > the file using the OGG, VORBIS or VORBISENC DLL interfaces? I'd rather not > add any new interfaces to get this information. TIA. > > John Lundy > > > > --- >8 ---- > List archives: http://www.xiph.org/archives/ > Ogg project homepage: http://www.xiph.org/ogg/ > To unsubscribe from this list, send a message to 'vorbis-request@xiph.org' > containing only the word 'unsubscribe' in the body. No subject is needed. > Unsubscribe messages sent to the list will be ignored/filtered.<p><p>--- >8 ---- List archives: http://www.xiph.org/archives/ Ogg project homepage: http://www.xiph.org/ogg/ To unsubscribe from this list, send a message to 'vorbis-request@xiph.org' containing only the word 'unsubscribe' in the body. No subject is needed. Unsubscribe messages sent to the list will be ignored/filtered.
AFAIK it needs to run through the entire file due to the fact that multiple streams could be included in the same file. Since you are creating the Ogg files, they will be single stream so you can simply open the file directly and search for the last page header to determine the granulepos. I do this in WinVorbis rather than using the library & it is very fast. Let me know if you want more info. Ross Levis. John Lundy wrote:> OK, easy enough. And thanks. > > However, the implication is that the entire file needs to be > decoded in > order to determine the playtime. This sounds unreasonable > just to display a > files properties. > > Is there a more realistic alternative? > > John > > ----- Original Message ----- > From: "Ed Sweetman" <ed.sweetman@wmich.edu> > To: <vorbis@xiph.org> > Sent: Sunday, March 10, 2002 7:28 PM > Subject: Re: [vorbis] Finding length (time) of encoded birstream > > > > > > ogg_page og; > > vorbis_info vi; > > > > final_granulepos = ogg_page_granulepos (&og); // (done > after last page > > has been decoded (your final position) > > final_granulepos / vi.rate; // (gives you time of stream > in seconds)--- >8 ---- List archives: http://www.xiph.org/archives/ Ogg project homepage: http://www.xiph.org/ogg/ To unsubscribe from this list, send a message to 'vorbis-request@xiph.org' containing only the word 'unsubscribe' in the body. No subject is needed. Unsubscribe messages sent to the list will be ignored/filtered.
Can't you just call ov_time_total() or ov_pcm_total() in vorbisfile to get what you want? Or am I missing something? -David Mitchell On Sunday 10 March 2002 05:37 pm, John Lundy wrote:> I'm adding some final features to my CD Ripper and Encoder before the full, > version 1 release. As part of that release, the program will offer the > ability to play (for review purposes) both WAV and OGG files. I have both > the decoder and playback code working but I have one final issue to > resolve: finding the play time for the Vorbis bitstream that is being > played back. I used the example_encode and example_decode code as the > initial basis for my code model (but it has really changes a bunch since I > started the project <grin>). Anyway, can someone inform me how I can get > this information from the file using the OGG, VORBIS or VORBISENC DLL > interfaces? I'd rather not add any new interfaces to get this information. > TIA. > > John Lundy > > > > --- >8 ---- > List archives: http://www.xiph.org/archives/ > Ogg project homepage: http://www.xiph.org/ogg/ > To unsubscribe from this list, send a message to 'vorbis-request@xiph.org' > containing only the word 'unsubscribe' in the body. No subject is needed. > Unsubscribe messages sent to the list will be ignored/filtered.--- >8 ---- List archives: http://www.xiph.org/archives/ Ogg project homepage: http://www.xiph.org/ogg/ To unsubscribe from this list, send a message to 'vorbis-request@xiph.org' containing only the word 'unsubscribe' in the body. No subject is needed. Unsubscribe messages sent to the list will be ignored/filtered.