summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMonty <xiphmont@xiph.org>1999-10-29 10:23:25 +0000
committerMonty <xiphmont@xiph.org>1999-10-29 10:23:25 +0000
commitf273cbeb2158eb8b24251a3c45afefb76a04b026 (patch)
tree093de4eb9b86d42422c43beb72e6964431ef3aa8 /lib
parentf974b8cc4c029240f8412e95f2779447a9604321 (diff)
downloadlibvorbis-git-f273cbeb2158eb8b24251a3c45afefb76a04b026.tar.gz
... beginning of the chaining example code.
Monty svn path=/trunk/vorbis/; revision=155
Diffstat (limited to 'lib')
-rw-r--r--lib/chaining_example.c49
1 files changed, 49 insertions, 0 deletions
diff --git a/lib/chaining_example.c b/lib/chaining_example.c
new file mode 100644
index 00000000..0c1e95b0
--- /dev/null
+++ b/lib/chaining_example.c
@@ -0,0 +1,49 @@
+/********************************************************************
+ * *
+ * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. *
+ * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
+ * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE. *
+ * PLEASE READ THESE TERMS DISTRIBUTING. *
+ * *
+ * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-1999 *
+ * by 1999 Monty <monty@xiph.org> and The XIPHOPHORUS Company *
+ * http://www.xiph.org/ *
+ * *
+ ********************************************************************
+
+ function: simple example of opening/seeking chained bitstreams
+ author: Monty <xiphmont@mit.edu>
+ modifications by: Monty
+ last modification date: Oct 29 1999
+
+ ********************************************************************/
+
+
+#include <stdio.h>
+#include <math.h>
+#include "codec.h"
+
+/* A 'chained bitstream' is a Vorbis bitstream that contains more than
+ one logical bitstream arranged end to end (the only form of Ogg
+ multiplexing allowed in a Vorbis bitstream; grouping [parallel
+ multiplexing] is not allowed in Vorbis) */
+
+/* A Vorbis file can be played beginning to end (streamed) without
+ worrying ahead of time about chaining. If we have the whole file,
+ however, and want random access (seeking/scrubbing) or desire to
+ know the total length/time of a file, we need to account for the
+ possibility of chaining. */
+
+/* We can handle things a number of ways; we can determine the entire
+ bitstream structure right off the bat, or piece it together later.
+ This example determines and caches structure for the entire
+ bitstream, but builds a virtual decoder on the fly when moving from
+ one link of the chain to another */
+
+/* There are also different ways to implement seeking. Enough
+ information exists in an Ogg bitstream to seek to
+ sample-granularity positions in the output. Or, one can seek by
+ picking some portion of the stream roughtly in the area we only
+ want course navigation through the stream. This example implements
+ the latter. */
+