[xiph-cvs] cvs commit: ices/src mp3.c
Brendan
brendan at xiph.org
Sat Mar 15 12:58:55 PST 2003
brendan 03/03/15 15:58:55
Modified: src mp3.c
Log:
Remove silly code to prevent identification of MPEG 2.5 files.
Find VBR tag in files other than MPEG 1 stereo.
Revision Changes Path
1.25 +18 -4 ices/src/mp3.c
Index: mp3.c
===================================================================
RCS file: /cvs/ice/ices/src/mp3.c,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -r1.24 -r1.25
--- mp3.c 15 Mar 2003 18:38:25 -0000 1.24
+++ mp3.c 15 Mar 2003 20:58:54 -0000 1.25
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
- * $Id: mp3.c,v 1.24 2003/03/15 18:38:25 brendan Exp $
+ * $Id: mp3.c,v 1.25 2003/03/15 20:58:54 brendan Exp $
*/
#include "definitions.h"
@@ -302,7 +302,7 @@
break;
case 0:
header->version = 2;
- return 0;
+ break;
default:
return 0;
}
@@ -346,9 +346,22 @@
return -1;
cur = lseek(source->fd, 0, SEEK_CUR);
- offset = mp3_data->len - mp3_data->pos;
/* check for VBR tag */
- lseek(source->fd, 36 - offset, SEEK_CUR);
+ /* Tag offset varies (but FhG VBRI is always MPEG1 Layer III 160 kbps stereo) */
+ if (header->version == 0) {
+ if (header->channels == 1)
+ offset = 21;
+ else
+ offset = 36;
+ } else {
+ if (header->channels == 1)
+ offset = 13;
+ else
+ offset = 21;
+ }
+
+ offset -= mp3_data->len - mp3_data->pos;
+ lseek(source->fd, offset, SEEK_CUR);
if (read(source->fd, buf, 4) == 4) {
if (!strncmp("VBRI", buf, 4) || !strncmp("Xing", buf, 4)) {
ices_log_debug("VBR tag found");
@@ -362,6 +375,7 @@
}
/* otherwise check next frame if possible */
+ offset = mp3_data->len - mp3_data->pos;
lseek(source->fd, cur, SEEK_SET);
if ((framelen = mp3_frame_length(header))) {
ices_log_debug("Frame length expected: %d bytes", framelen);
<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 'cvs-request at xiph.org'
containing only the word 'unsubscribe' in the body. No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.
More information about the commits
mailing list