Commit 29788623 authored by conrad's avatar conrad

decode FLAC vorbiscomments packet


git-svn-id: http://svn.annodex.net/liboggz/trunk@3367 8158c8cd-e7e1-0310-9fa4-c5954c97daef
parent 7d76ca05
...@@ -970,6 +970,7 @@ oggz_auto_read_comments (OGGZ * oggz, oggz_stream_t * stream, long serialno, ...@@ -970,6 +970,7 @@ oggz_auto_read_comments (OGGZ * oggz, oggz_stream_t * stream, long serialno,
ogg_packet * op) ogg_packet * op)
{ {
int offset = -1; int offset = -1;
long len = -1;
switch (stream->content) { switch (stream->content) {
case OGGZ_CONTENT_VORBIS: case OGGZ_CONTENT_VORBIS:
...@@ -982,12 +983,22 @@ oggz_auto_read_comments (OGGZ * oggz, oggz_stream_t * stream, long serialno, ...@@ -982,12 +983,22 @@ oggz_auto_read_comments (OGGZ * oggz, oggz_stream_t * stream, long serialno,
if (op->bytes > 7 && memcmp (op->packet, "\201theora", 7) == 0) if (op->bytes > 7 && memcmp (op->packet, "\201theora", 7) == 0)
offset = 7; offset = 7;
break; break;
case OGGZ_CONTENT_FLAC:
if (op->bytes > 4 && (op->packet[0] & 0x7) == 4) {
len = (op->packet[1]<<16) + (op->packet[2]<<8) + op->packet[3];
offset = 4;
}
default: default:
break; break;
} }
/* The length of the comments to decode is the rest of the packet,
* unless otherwise determined (ie. for FLAC) */
if (len == -1)
len = op->bytes - offset;
if (offset >= 0) { if (offset >= 0) {
oggz_comments_decode (oggz, serialno, op->packet+offset, op->bytes-offset); oggz_comments_decode (oggz, serialno, op->packet+offset, len);
} }
return 0; return 0;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment