[cvs-annodex] commit (/annodex): liboggz/trunk/src/liboggz/Makefile.am liboggz/trunk/src/liboggz/oggz.c liboggz/trunk/src/liboggz/oggz_auto.c liboggz/trunk/src/liboggz/oggz_private.h liboggz/trunk/src/liboggz/oggz_stream.h +liboggz/trunk/src/liboggz/oggz_stream.c

conrad nobody at lists.annodex.net
Mon Jan 24 13:02:51 EST 2005


Update of /annodex (new revision 710)

Added files:
   liboggz/trunk/src/liboggz/oggz_stream.c

Modified files:
   liboggz/trunk/src/liboggz/Makefile.am
   liboggz/trunk/src/liboggz/oggz.c
   liboggz/trunk/src/liboggz/oggz_auto.c
   liboggz/trunk/src/liboggz/oggz_private.h
   liboggz/trunk/src/liboggz/oggz_stream.h

Log Message:
add oggz_stream.c, basic stream identification and fishead/fisbone consistency
checking


Modified: liboggz/trunk/src/liboggz/Makefile.am
===================================================================
--- liboggz/trunk/src/liboggz/Makefile.am	2005-01-24 01:31:33 UTC (rev 709)
+++ liboggz/trunk/src/liboggz/Makefile.am	2005-01-24 02:02:50 UTC (rev 710)
@@ -15,6 +15,7 @@
 	oggz_io.c \
 	oggz_read.c oggz_write.c \
 	oggz_auto.c oggz_auto.h \
+	oggz_stream.c oggz_stream.h \
 	oggz_table.c \
 	oggz_vector.c oggz_vector.h
 

Modified: liboggz/trunk/src/liboggz/oggz.c
===================================================================
--- liboggz/trunk/src/liboggz/oggz.c	2005-01-24 01:31:33 UTC (rev 709)
+++ liboggz/trunk/src/liboggz/oggz.c	2005-01-24 02:02:50 UTC (rev 710)
@@ -260,6 +260,8 @@
 
   ogg_stream_init (&stream->ogg_stream, (int)serialno);
 
+  stream->content = OGGZ_CONTENT_UNKNOWN;
+
   stream->delivered_non_b_o_s = 0;
   stream->b_o_s = 1;
   stream->e_o_s = 0;

Modified: liboggz/trunk/src/liboggz/oggz_auto.c
===================================================================
--- liboggz/trunk/src/liboggz/oggz_auto.c	2005-01-24 01:31:33 UTC (rev 709)
+++ liboggz/trunk/src/liboggz/oggz_auto.c	2005-01-24 02:02:50 UTC (rev 710)
@@ -277,27 +277,31 @@
   return 1;
 }
 
-#if 0
 static int
 auto_fishead (OGGZ * oggz, ogg_packet * op, long serialno, void * user_data)
 {
   unsigned char * header = op->packet;
+  int content;
+  
+  if (op->b_o_s) {
+    if (op->bytes < 8) return 0;
+    if (strncmp ((char *)header, "fishead", 8)) return 0;
+    oggz_stream_set_content (oggz, serialno, OGGZ_CONTENT_SKELETON);
+  } else if (op->e_o_s) {
+    content =  oggz_stream_get_content (oggz, serialno);
+    if (content != OGGZ_CONTENT_SKELETON) return 0;
 
-  if (op->bytes < 8) return 0;
+    /* Finished processing the skeleton; apply a zero metric */
+    oggz_set_metric_linear (oggz, serialno, 0, 1);
+  }
 
-  if (strncmp ((char *)header, "fishead", 8)) return 0;
-  if (!op->b_o_s) return 0;
-
-  /* Yeah ... set it up with a "linear" metric with numerator 0 :) */
-  oggz_set_metric_linear (oggz, serialno, 0, 1);
-
   return 1;
 }
-#endif
 
 static int
 auto_fisbone (OGGZ * oggz, ogg_packet * op, long serialno, void * user_data)
 {
+  int content;
   unsigned char * header = op->packet;
   long fisbone_serialno; /* The serialno referred to in this fisbone */
   ogg_int64_t granule_rate_numerator = 0, granule_rate_denominator = 0;
@@ -305,6 +309,8 @@
   if (op->bytes < 48) return 0;
 
   if (strncmp ((char *)header, "fisbone", 7)) return 0;
+  content =  oggz_stream_get_content (oggz, serialno);
+  if (content != OGGZ_CONTENT_SKELETON) return 0;
 
   fisbone_serialno = (long) INT32_LE_AT(&header[12]);
 

Modified: liboggz/trunk/src/liboggz/oggz_private.h
===================================================================
--- liboggz/trunk/src/liboggz/oggz_private.h	2005-01-24 01:31:33 UTC (rev 709)
+++ liboggz/trunk/src/liboggz/oggz_private.h	2005-01-24 02:02:50 UTC (rev 710)
@@ -74,6 +74,8 @@
 struct _oggz_stream_t {
   ogg_stream_state ogg_stream;
 
+  int content;
+
   /* non b_o_s packet has been written (not just queued) */
   int delivered_non_b_o_s;
 

Added: liboggz/trunk/src/liboggz/oggz_stream.c
===================================================================
--- liboggz/trunk/src/liboggz/oggz_stream.c	2005-01-24 01:31:33 UTC (rev 709)
+++ liboggz/trunk/src/liboggz/oggz_stream.c	2005-01-24 02:02:50 UTC (rev 710)
@@ -0,0 +1,57 @@
+/*
+   Copyright (C) 2003 Commonwealth Scientific and Industrial Research
+   Organisation (CSIRO) Australia
+
+   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 CSIRO Australia 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 ORGANISATION 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.
+*/
+
+#include "oggz_private.h"
+
+int
+oggz_stream_set_content (OGGZ * oggz, long serialno, int content)
+{
+  oggz_stream_t * stream;
+
+  stream = oggz_get_stream (oggz, serialno);
+  if (stream == NULL) return OGGZ_ERR_BAD_SERIALNO;
+
+  stream->content = content;
+
+  return 0;
+}
+
+int
+oggz_stream_get_content (OGGZ * oggz, long serialno)
+{
+  oggz_stream_t * stream;
+
+  stream = oggz_get_stream (oggz, serialno);
+  if (stream == NULL) return OGGZ_ERR_BAD_SERIALNO;
+
+  return stream->content;
+}

Modified: liboggz/trunk/src/liboggz/oggz_stream.h
===================================================================
--- liboggz/trunk/src/liboggz/oggz_stream.h	2005-01-24 01:31:33 UTC (rev 709)
+++ liboggz/trunk/src/liboggz/oggz_stream.h	2005-01-24 02:02:50 UTC (rev 710)
@@ -33,11 +33,18 @@
 #ifndef __OGGZ_STREAM_H__
 #define __OGGZ_STREAM_H__
 
+enum {
+  OGGZ_CONTENT_UNKNOWN = 0,
+  OGGZ_CONTENT_SKELETON = 1
+};
+
 typedef struct _oggz_stream_t oggz_stream_t;
 
 oggz_stream_t * oggz_get_stream (OGGZ * oggz, long serialno);
 oggz_stream_t * oggz_add_stream (OGGZ * oggz, long serialno);
 
 int oggz_stream_has_metric (OGGZ * oggz, long serialno);
+int oggz_stream_set_content (OGGZ * oggz, long serialno, int content);
+int oggz_stream_get_content (OGGZ * oggz, long serialno);
 
 #endif /* __OGGZ_STREAM_H__ */


-- 
conrad



More information about the cvs-annodex mailing list