- rewind(file);
- ret = ogg_open_callbacks(file, &of, ovc);
- if (ret < 0)
- goto err;
- ret = -E_OGG_INFO;
- vi = ov_info(&of, 0);
- if (!vi)
- goto err;
- time_total = ov_time_total(&of, -1);
- raw_total = ov_raw_total(&of, -1);
- afi->seconds_total = time_total;
- vi_sampling_rate = vi->rate;
- vi_bitrate = ov_bitrate(&of, 0);
- rewind(file);
- afi->chunks_total = ogg_compute_chunk_table(&of, afi, time_total);
- rewind(file);
- sprintf(afi->info_string, "audio_file_info1:%lu x %lu, %ldkHz, "
- "%d channels, %ldkbps\n"
- "audio_file_info2: \n"
- "audio_file_info3: \n",
- afi->chunks_total, (long unsigned) (chunk_time * 1000 * 1000),
- vi_sampling_rate / 1000, vi->channels, vi_bitrate / 1000
- );
- rewind(file);
- audio_file = file;
- afi->chunk_tv.tv_sec = 0;
- afi->chunk_tv.tv_usec = 250 * 1000;
- tv_scale(3, &afi->chunk_tv, &afi->eof_tv);
- ret = 1;
-err:
- ov_clear(&of); /* keeps the file open */
- if (ret < 0)
- free(afi->header);