[Vorbis-dev] want to know, how much data will be extracted from every single packet

Tertium Organum tertium at front.ru
Tue Jan 10 08:16:31 PST 2006


hi there. here's a problem.
is there any way to know, how much unpacked data is in the vorbis packet (i.e. how much data will be extracted from the packet after synthesys)? coz i need to seek quickly to the byte no X in unpacked audio stream as it will be uncompressed PCM.
for now when program starts, i must run through all pages, getting all packets, extracting all of them and getting result datasize using such code:

....
if (vorbis_synthesis(&vorb_block,&m_packets[cur_packet_num]) == 0) 
	vorbis_synthesis_blockin(&vorb_dsp_state,&vorb_block);
int bout = vorbis_synthesis_pcmout(&vorb_dsp_state,NULL);
packet_result_data_size[cur_packet_num] = 
	bout * sizeof(int16) * vorb_info.channels;
....


of coz it's very slow, but i can't help to solve that problem so far. what can u say, folks?

i dont know why, but vorb_dsp_state.granulepos == -1. i can get granulepos of the current page, but there are many packets in it, so it's almost useless. granulepos in the end is equal to uncompressed data size, and it's pretty well, but i want the size of every packet's uncompressed data.

with gratest wishes,
Tertium Organum



More information about the Vorbis-dev mailing list