[xiph-commits] r9571 - trunk/vorbis-tools/ogg123
giles at svn.xiph.org
giles at svn.xiph.org
Sat Jul 16 12:19:28 PDT 2005
Author: giles
Date: 2005-07-16 12:19:27 -0700 (Sat, 16 Jul 2005)
New Revision: 9571
Modified:
trunk/vorbis-tools/ogg123/flac_format.c
Log:
Update file magic detection to recognize the new OggFLAC format as well
as the old. Patch from mikael at karlsson.com. Ticket #596.
Modified: trunk/vorbis-tools/ogg123/flac_format.c
===================================================================
--- trunk/vorbis-tools/ogg123/flac_format.c 2005-07-16 19:14:37 UTC (rev 9570)
+++ trunk/vorbis-tools/ogg123/flac_format.c 2005-07-16 19:19:27 UTC (rev 9571)
@@ -5,7 +5,7 @@
* THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE. *
* PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
* *
- * THE Ogg123 SOURCE CODE IS (C) COPYRIGHT 2000-2003 *
+ * THE Ogg123 SOURCE CODE IS (C) COPYRIGHT 2000-2005 *
* by Stan Seibert <volsung at xiph.org> AND OTHER CONTRIBUTORS *
* http://www.xiph.org/ *
* *
@@ -96,16 +96,27 @@
int oggflac_can_decode (data_source_t *source)
{
- char buf[32];
+ char buf[36];
int len;
- len = source->transport->peek(source, buf, sizeof(char), 32);
+ len = source->transport->peek(source, buf, sizeof(char), 36);
- if (len >= 32 && memcmp(buf, "OggS", 4) == 0
- && memcmp(buf+28, "fLaC", 4) == 0)
- return 1; /* Ogg FLAC */
- else
- return 0;
+ if (len >= 36 && memcmp(buf, "OggS", 4) == 0
+ && memcmp(buf+28, "fLaC", 4) == 0) {
+ /* old Ogg FLAC , pre flac 1.1.1 */
+ return 1;
+ }
+
+ if (len >= 36 && memcmp(buf, "OggS", 4) == 0
+ && buf[28] == 0x7F
+ && memcmp(buf+29, "FLAC", 4) == 0
+ && buf[33] == 1
+ && buf[34] == 0) {
+ /* Ogg FLAC >= 1.1.1, according to OggFlac mapping 1.0 */
+ return 1;
+ }
+
+ return 0;
}
More information about the commits
mailing list