[xiph-commits] r3365 - in liboggz/trunk/src: examples liboggz
conrad at svn.annodex.net
conrad at svn.annodex.net
Sun Jan 20 17:36:52 PST 2008
Author: conrad
Date: 2008-01-20 17:36:51 -0800 (Sun, 20 Jan 2008)
New Revision: 3365
Modified:
liboggz/trunk/src/examples/modify-headers.c
liboggz/trunk/src/liboggz/oggz_auto.c
liboggz/trunk/src/liboggz/oggz_private.h
liboggz/trunk/src/liboggz/oggz_write.c
Log:
add private oggz_auto_identify_packet() function, and use it in
oggz_write_feed() when a bos page is encountered. This sets the content type
for writing, so that oggz can know how to structure comment packets etc.
Modified: liboggz/trunk/src/examples/modify-headers.c
===================================================================
--- liboggz/trunk/src/examples/modify-headers.c 2008-01-21 01:27:10 UTC (rev 3364)
+++ liboggz/trunk/src/examples/modify-headers.c 2008-01-21 01:36:51 UTC (rev 3365)
@@ -94,7 +94,7 @@
oggz_comment_add_byname (mhdata->writer, serialno,
"EDITOR", "modify-headers");
op = oggz_comment_generate (mhdata->writer, serialno,
- oggz_stream_get_content (mhdata->reader, serialno),
+ oggz_stream_get_content (mhdata->writer, serialno),
0);
}
Modified: liboggz/trunk/src/liboggz/oggz_auto.c
===================================================================
--- liboggz/trunk/src/liboggz/oggz_auto.c 2008-01-21 01:27:10 UTC (rev 3364)
+++ liboggz/trunk/src/liboggz/oggz_auto.c 2008-01-21 01:36:51 UTC (rev 3365)
@@ -892,8 +892,8 @@
{"", 0, "Unknown", NULL, NULL, NULL}
};
-int
-oggz_auto_identify_page (OGGZ *oggz, ogg_page *og, long serialno)
+static int
+oggz_auto_identify (OGGZ * oggz, long serialno, unsigned char * data, long len)
{
int i;
@@ -901,8 +901,8 @@
{
const oggz_auto_contenttype_t *codec = oggz_auto_codec_ident + i;
- if (og->body_len >= codec->bos_str_len &&
- memcmp (og->body, codec->bos_str, codec->bos_str_len) == 0) {
+ if (len >= codec->bos_str_len &&
+ memcmp (data, codec->bos_str, codec->bos_str_len) == 0) {
oggz_stream_set_content (oggz, serialno, i);
@@ -915,6 +915,18 @@
}
int
+oggz_auto_identify_page (OGGZ * oggz, ogg_page *og, long serialno)
+{
+ return oggz_auto_identify (oggz, serialno, og->body, og->body_len);
+}
+
+int
+oggz_auto_identify_packet (OGGZ * oggz, ogg_packet * op, long serialno)
+{
+ return oggz_auto_identify (oggz, serialno, op->packet, op->bytes);
+}
+
+int
oggz_auto_get_granulerate (OGGZ * oggz, ogg_packet * op, long serialno,
void * user_data)
{
Modified: liboggz/trunk/src/liboggz/oggz_private.h
===================================================================
--- liboggz/trunk/src/liboggz/oggz_private.h 2008-01-21 01:27:10 UTC (rev 3364)
+++ liboggz/trunk/src/liboggz/oggz_private.h 2008-01-21 01:36:51 UTC (rev 3365)
@@ -291,6 +291,7 @@
ogg_packet * op);
int oggz_auto_identify_page (OGGZ *oggz, ogg_page *og, long serialno);
+int oggz_auto_identify_packet (OGGZ * oggz, ogg_packet * op, long serialno);
/* comments */
int oggz_comments_init (oggz_stream_t * stream);
Modified: liboggz/trunk/src/liboggz/oggz_write.c
===================================================================
--- liboggz/trunk/src/liboggz/oggz_write.c 2008-01-21 01:27:10 UTC (rev 3364)
+++ liboggz/trunk/src/liboggz/oggz_write.c 2008-01-21 01:36:51 UTC (rev 3365)
@@ -247,6 +247,7 @@
if (b_o_s || !strict || suffix) {
stream = oggz_add_stream (oggz, serialno);
+ oggz_auto_identify_packet (oggz, op, serialno);
} else {
return OGGZ_ERR_BAD_SERIALNO;
}
More information about the commits
mailing list