treech
09-25-2002, 11:11 AM
OGG support would be nice, i'll paste some simple example code:
void Oggtag(FILE *fp)
{
OggVorbis_File vf;
double duration;
long bitrate;
if ( ov_open (fp, &vf, NULL, 0 ) != 0 )
printf("Something went wrong!\n");
duration = ov_time_total ( &vf, -1 );
bitrate = ov_bitrate ( &vf, -1 ) / 1000;
{
char **ptr = ov_comment(&vf,-1)->user_comments;
vorbis_info *vi = ov_info(&vf,-1);
printf("\n\nBitstream is %d channel, %ldHz\n",vi->channels,vi->rate);
printf("Encoded by: %s\n\n",ov_comment(&vf,-1)->vendor);
printf("Bitrate: %d Kbit/Sec\n", bitrate);
printf("Duration: %.0f Seconds\n", duration);
printf("\n\t---------- Vorbis Tag: ----------\n\n");
while(*ptr)
{
printf("%s\n",*ptr);
++ptr;
}
}
ov_clear (&vf);
}
very simple, you will of course need the ogg/vorbis/vorbisfile libraries install. (and link to the libraries, -lvorbisfile -lvorbis)
void Oggtag(FILE *fp)
{
OggVorbis_File vf;
double duration;
long bitrate;
if ( ov_open (fp, &vf, NULL, 0 ) != 0 )
printf("Something went wrong!\n");
duration = ov_time_total ( &vf, -1 );
bitrate = ov_bitrate ( &vf, -1 ) / 1000;
{
char **ptr = ov_comment(&vf,-1)->user_comments;
vorbis_info *vi = ov_info(&vf,-1);
printf("\n\nBitstream is %d channel, %ldHz\n",vi->channels,vi->rate);
printf("Encoded by: %s\n\n",ov_comment(&vf,-1)->vendor);
printf("Bitrate: %d Kbit/Sec\n", bitrate);
printf("Duration: %.0f Seconds\n", duration);
printf("\n\t---------- Vorbis Tag: ----------\n\n");
while(*ptr)
{
printf("%s\n",*ptr);
++ptr;
}
}
ov_clear (&vf);
}
very simple, you will of course need the ogg/vorbis/vorbisfile libraries install. (and link to the libraries, -lvorbisfile -lvorbis)