[xiph-commits] r3375 - in liboggz/trunk: include/oggz src/examples src/liboggz

conrad at svn.annodex.net conrad at svn.annodex.net
Wed Jan 23 20:05:09 PST 2008


Author: conrad
Date: 2008-01-23 20:05:07 -0800 (Wed, 23 Jan 2008)
New Revision: 3375

Added:
   liboggz/trunk/include/oggz/oggz_stream.h
Modified:
   liboggz/trunk/include/oggz/Makefile.am
   liboggz/trunk/include/oggz/oggz.h
   liboggz/trunk/include/oggz/oggz_read.h
   liboggz/trunk/src/examples/modify-headers.c
   liboggz/trunk/src/liboggz/Version_script.in
   liboggz/trunk/src/liboggz/oggz_stream.c
Log:
introduce oggz_stream_get_numheaders() API call, and use in modify-headers
example


Modified: liboggz/trunk/include/oggz/Makefile.am
===================================================================
--- liboggz/trunk/include/oggz/Makefile.am	2008-01-23 22:14:25 UTC (rev 3374)
+++ liboggz/trunk/include/oggz/Makefile.am	2008-01-24 04:05:07 UTC (rev 3375)
@@ -5,7 +5,8 @@
 # Include files to install
 oggzincludedir = $(includedir)/oggz
 oggzinclude_HEADERS = oggz.h oggz_comments.h oggz_constants.h oggz_read.h \
-	oggz_seek.h oggz_write.h oggz_io.h oggz_table.h oggz_deprecated.h \
+	oggz_seek.h oggz_stream.h oggz_write.h oggz_io.h oggz_table.h \
+	oggz_deprecated.h \
 	oggz_off_t.h oggz_off_t_generated.h
 
 BUILT_SOURCES = oggz_off_t_generated.h

Modified: liboggz/trunk/include/oggz/oggz.h
===================================================================
--- liboggz/trunk/include/oggz/oggz.h	2008-01-23 22:14:25 UTC (rev 3374)
+++ liboggz/trunk/include/oggz/oggz.h	2008-01-24 04:05:07 UTC (rev 3375)
@@ -565,6 +565,7 @@
 
 #include <oggz/oggz_off_t.h>
 #include <oggz/oggz_read.h>
+#include <oggz/oggz_stream.h>
 #include <oggz/oggz_seek.h>
 #include <oggz/oggz_write.h>
 #include <oggz/oggz_io.h>

Modified: liboggz/trunk/include/oggz/oggz_read.h
===================================================================
--- liboggz/trunk/include/oggz/oggz_read.h	2008-01-23 22:14:25 UTC (rev 3374)
+++ liboggz/trunk/include/oggz/oggz_read.h	2008-01-24 04:05:07 UTC (rev 3375)
@@ -205,4 +205,18 @@
  */
 const char * oggz_stream_get_content_type (OGGZ *oggz, long serialno);
 
+/**
+ * Determine the number of headers of the oggz stream referred to by
+ * \a serialno
+ *
+ * \param oggz An OGGZ handle
+ * \param serialno An ogg stream serialno
+ * \retval OGGZ_CONTENT_THEORA..OGGZ_CONTENT_UNKNOWN content successfully 
+ *          identified
+ * \retval OGGZ_ERR_BAD_OGGZ \a oggz does not refer to an existing OGGZ
+ * \retval OGGZ_ERR_BAD_SERIALNO \a serialno does not refer to an existing
+ *          stream
+ */
+int oggz_stream_get_numheaders (OGGZ * oggz, long serialno);
+
 #endif /* __OGGZ_READ_H__ */

Added: liboggz/trunk/include/oggz/oggz_stream.h
===================================================================
--- liboggz/trunk/include/oggz/oggz_stream.h	                        (rev 0)
+++ liboggz/trunk/include/oggz/oggz_stream.h	2008-01-24 04:05:07 UTC (rev 3375)
@@ -0,0 +1,77 @@
+/*
+   Copyright (C) 2007 Annodex Association
+
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions
+   are met:
+
+   - Redistributions of source code must retain the above copyright
+   notice, this list of conditions and the following disclaimer.
+
+   - Redistributions in binary form must reproduce the above copyright
+   notice, this list of conditions and the following disclaimer in the
+   documentation and/or other materials provided with the distribution.
+
+   - Neither the name of the Annodex Association nor the names of its
+   contributors may be used to endorse or promote products derived from
+   this software without specific prior written permission.
+
+   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+   ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+   PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE ASSOCIATION OR
+   CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+   EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+   PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+   PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+   LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+   NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+   SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#ifndef __OGGZ_STREAM_H__
+#define __OGGZ_STREAM_H__
+
+/** \file
+ * Interfaces for querying Ogg streams
+ */
+
+/**
+ * Determine the content type of the oggz stream referred to by \a serialno
+ *
+ * \param oggz An OGGZ handle
+ * \param serialno An ogg stream serialno
+ * \retval OGGZ_CONTENT_THEORA..OGGZ_CONTENT_UNKNOWN content successfully 
+ *          identified
+ * \retval OGGZ_ERR_BAD_OGGZ \a oggz does not refer to an existing OGGZ
+ * \retval OGGZ_ERR_BAD_SERIALNO \a serialno does not refer to an existing
+ *          stream
+ */
+OggzStreamContent oggz_stream_get_content (OGGZ * oggz, long serialno);
+
+/**
+ * Return human-readable string representation of content type of oggz stream
+ * referred to by \a serialno
+ *
+ * \param oggz An OGGZ handle
+ * \param serialno An ogg stream serialno
+ * \retval string the name of the content type
+ * \retval NULL \a oggz or \a serialno invalid
+ */
+const char * oggz_stream_get_content_type (OGGZ *oggz, long serialno);
+
+/**
+ * Determine the number of headers of the oggz stream referred to by
+ * \a serialno
+ *
+ * \param oggz An OGGZ handle
+ * \param serialno An ogg stream serialno
+ * \retval OGGZ_CONTENT_THEORA..OGGZ_CONTENT_UNKNOWN content successfully 
+ *          identified
+ * \retval OGGZ_ERR_BAD_OGGZ \a oggz does not refer to an existing OGGZ
+ * \retval OGGZ_ERR_BAD_SERIALNO \a serialno does not refer to an existing
+ *          stream
+ */
+int oggz_stream_get_numheaders (OGGZ * oggz, long serialno);
+
+#endif /* __OGGZ_STREAM_H__ */

Modified: liboggz/trunk/src/examples/modify-headers.c
===================================================================
--- liboggz/trunk/src/examples/modify-headers.c	2008-01-23 22:14:25 UTC (rev 3374)
+++ liboggz/trunk/src/examples/modify-headers.c	2008-01-24 04:05:07 UTC (rev 3375)
@@ -102,7 +102,7 @@
   }
 
   /* Determine if we're finished processing headers */
-  if (op->packetno >= 2) {
+  if (op->packetno+1 >= oggz_stream_get_numheaders (mhdata->reader, serialno)) {
     /* If this was the last header for this track, remove it from the
        track list */
     oggz_table_remove (mhdata->tracks, serialno);

Modified: liboggz/trunk/src/liboggz/Version_script.in
===================================================================
--- liboggz/trunk/src/liboggz/Version_script.in	2008-01-23 22:14:25 UTC (rev 3374)
+++ liboggz/trunk/src/liboggz/Version_script.in	2008-01-24 04:05:07 UTC (rev 3375)
@@ -60,6 +60,7 @@
 
                 oggz_stream_get_content;
                 oggz_stream_get_content_type;
+                oggz_stream_get_numheaders;
 
 		oggz_table_new;
 		oggz_table_delete;

Modified: liboggz/trunk/src/liboggz/oggz_stream.c
===================================================================
--- liboggz/trunk/src/liboggz/oggz_stream.c	2008-01-23 22:14:25 UTC (rev 3374)
+++ liboggz/trunk/src/liboggz/oggz_stream.c	2008-01-24 04:05:07 UTC (rev 3375)
@@ -72,3 +72,18 @@
 
   return oggz_auto_codec_ident[content].content_type;
 } 
+
+int
+oggz_stream_get_numheaders (OGGZ * oggz, long serialno)
+{
+  oggz_stream_t * stream;
+
+  if (oggz == NULL) return OGGZ_ERR_BAD_OGGZ;
+  
+  stream = oggz_get_stream (oggz, serialno);
+  if (stream == NULL) return OGGZ_ERR_BAD_SERIALNO;
+
+  /*return stream->numheaders;*/
+  return 3;
+}
+



More information about the commits mailing list