34 #include <vorbis/codec.h>
35 #include <vorbis/vorbisfile.h>
37 #ifdef HAVE_SYS_STAT_H
50 const char *
const ext = strrchr(filename,
'.');
51 if (ext && (!strncasecmp(ext,
".ogg", 4) ||
52 !strncasecmp(ext,
".oga", 4)) )
71 const char *
const filename)
79 if (!
ogg_ext_check(filename) || (ov_test(in, &vf, NULL, 0) != 0))
91 fstat(fileno(in), &filestat);
92 p->
size = filestat.st_size;
93 p->
mtime = filestat.st_mtime;
95 if (ov_test_open(&vf) == 0) {
97 vorbis_comment *comment = ov_comment(&vf, -1);
98 if (comment != NULL) {
99 if ((t = vorbis_comment_query(comment,
"ALBUM", 0)))
101 if ((t = vorbis_comment_query(comment,
"ARTIST", 0)))
103 if ((t = vorbis_comment_query(comment,
"TITLE", 0)))
105 if ((t = vorbis_comment_query(comment,
"TRACKNUMBER", 0)))
107 if ((t = vorbis_comment_query(comment,
"DATE", 0)))
109 if ((t = vorbis_comment_query(comment,
"DISCNUMBER", 0)))
111 if ((t = vorbis_comment_query(comment,
"GENRE", 0)))
119 vorbis_info *info = ov_info(&vf, -1);
120 p->
freq = info->rate;
122 #ifndef NO_BR_NOMINAL
123 if (info->bitrate_nominal)
124 p->
bitrate = info->bitrate_nominal;
127 p->
bitrate = (long)ov_bitrate(&vf, -1);
128 if ((info->bitrate_upper > 0) && (info->bitrate_upper == info->bitrate_lower));
131 p->
length = (long)ov_time_total(&vf, -1);