# vorbis makefile configured for use with gcc on any platform
-# $Id: Makefile.in,v 1.13 1999/11/02 11:17:34 xiphmont Exp $
+# $Id: Makefile.in,v 1.14 1999/11/02 23:27:32 xiphmont Exp $
###############################################################################
# #
lsp.o lpc.o analysis.o synthesis.o psy.o info.o bitwise.o\
spectrum.o
+FFILES = vorbisfile.o
+
EFILES = encoder_example.o decoder_example.o chaining_example.o
all:
profile:
$(MAKE) target CFLAGS="$(PROFILE)"
-target: libvorbis.a encoder_example decoder_example chaining_example
+target: libvorbis.a vorbisfile.a \
+ encoder_example decoder_example chaining_example
selftest:
$(MAKE) clean
$(CC) $(CFLAGS) $(LDFLAGS) decoder_example.o libvorbis.a -o \
decoder_example -lm
-chaining_example: $(EFILES) libvorbis.a
- $(CC) $(CFLAGS) $(LDFLAGS) chaining_example.o libvorbis.a -o \
- chaining_example -lm
+chaining_example: $(EFILES) libvorbis.a vorbisfile.a
+ $(CC) $(CFLAGS) $(LDFLAGS) chaining_example.o \
+ vorbisfile.a libvorbis.a -o chaining_example -lm
libvorbis.a: $(LFILES)
- $(AR) -r libvorbis.a $(LFILES)
+ $(AR) -r libvorbis.a $^
$(RANLIB) libvorbis.a
+vorbisfile.a: $(FFILES)
+ $(AR) -r vorbisfile.a $^
+ $(RANLIB) vorbisfile.a
+
+
$(LFILES): $(HFILES)
+$(FFILES): $(HFILES) vorbisfile.h
+$(EFILES): $(HFILES) vorbisfile.h
info.o: modes.h
* *
********************************************************************
- function: simple example of opening/seeking chained bitstreams
+ function: stdio-based convenience library for opening/seeking/decoding
author: Monty <xiphmont@mit.edu>
modifications by: Monty
last modification date: Nov 02 1999
********************************************************************/
#include <stdlib.h>
-#include <unistd.h>
-#include <sys/types.h>
#include <stdio.h>
-#include <math.h>
#include "codec.h"
+#include "vorbisfile.h"
/* A 'chained bitstream' is a Vorbis bitstream that contains more than
one logical bitstream arranged end to end (the only form of Ogg
bitstream structure right off the bat, or find pieces on demand.
This example determines and caches structure for the entire
bitstream, but builds a virtual decoder on the fly when moving
- between links in the chain */
+ between links in the chain. */
/* There are also different ways to implement seeking. Enough
information exists in an Ogg bitstream to seek to
picking some portion of the stream roughtly in the area if we only
want course navigation through the stream. */
-typedef struct {
- FILE *f;
- int seekable;
- long offset;
- long end;
- ogg_sync_state oy;
-
- /* If the FILE handle isn't seekable (eg, a pipe), only the current
- stream appears */
- int links;
- long *offsets;
- long *serialnos;
- size64 *pcmlengths;
- vorbis_info *vi;
-
- /* Decoding working state local storage */
- int ready;
- ogg_stream_state os; /* take physical pages, weld into a logical
- stream of packets */
- vorbis_dsp_state vd; /* central working state for the packet->PCM decoder */
- vorbis_block vb; /* local working space for packet->PCM decode */
-
-} OggVorbis_File;
-
-
/*************************************************************************
* Many, many internal helpers. The intention is not to be confusing;
* rampant duplication and monolithic function implementation would be
return(0);
}
-long ov_totaltime(OggVorbis_File *vf){
+double ov_totaltime(OggVorbis_File *vf){
double acc=0;
int i;
for(i=0;i<vf->links;i++)
}
/* seek to an offset relative to the *compressed* data */
-int ov_seek_stream;
+int ov_seek_stream(OggVorbis_File *vf,long pos){
+
+
+
+
+}
+
+/* seek to the beginning of the next logical bitstream within the
+ physical bitstream */
+int ov_seek_bitstream(OggVorbis_File *vf,long pos){
+
+
+
+}
/* seek to an offset relative to the decompressed *output* stream */
-int ov_seek_pcm;
+int ov_seek_pcm(OggVorbis_File *vf,long pos){
-int main(){
- OggVorbis_File ov;
- int i;
- /* open the file/pipe on stdin */
- if(ov_open(stdin,&ov,NULL,-1)==-1){
- printf("Could not open input as an OggVorbis file.\n\n");
- exit(1);
- }
-
- /* print details about each logical bitstream in the input */
- if(ov.seekable){
- printf("Input bitstream contained %d logical bitstream section(s).\n",
- ov.links);
- printf("Total bitstream playing time: %ld seconds\n\n",
- (long)ov_totaltime(&ov));
+}
+
+int ov_seek_time(OggVorbis_File *vf,double seconds){
+
- }else{
- printf("Standard input was not seekable.\n"
- "First logical bitstream information:\n\n");
- }
- for(i=0;i<ov.links;i++){
- printf("\tlogical bitstream section %d information:\n",i+1);
- printf("\t\tsample rate: %ldHz\n",ov.vi[i].rate);
- printf("\t\tchannels: %d\n",ov.vi[i].channels);
- printf("\t\tserial number: %ld\n",ov.serialnos[i]);
- printf("\t\traw length: %ldbytes\n",(ov.offsets?
- ov.offsets[i+1]-ov.offsets[i]:
- -1));
- printf("\t\tplay time: %lds\n\n",(long)ov_lbtime(&ov,i));
- }
-
- ov_clear(&ov);
- return 0;
}
+
--- /dev/null
+/********************************************************************
+ * *
+ * 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: stdio-based convenience library for opening/seeking/decoding
+ author: Monty <xiphmont@mit.edu>
+ modifications by: Monty
+ last modification date: Nov 02 1999
+
+ ********************************************************************/
+
+#ifndef _VO_FILE_H_
+#define _VO_FILE_H_
+
+#include <stdio.h>
+#include "codec.h"
+
+typedef struct {
+ FILE *f;
+ int seekable;
+ long offset;
+ long end;
+ ogg_sync_state oy;
+
+ /* If the FILE handle isn't seekable (eg, a pipe), only the current
+ stream appears */
+ int links;
+ long *offsets;
+ long *serialnos;
+ size64 *pcmlengths;
+ vorbis_info *vi;
+
+ /* Decoding working state local storage */
+ int ready;
+ ogg_stream_state os; /* take physical pages, weld into a logical
+ stream of packets */
+ vorbis_dsp_state vd; /* central working state for the packet->PCM decoder */
+ vorbis_block vb; /* local working space for packet->PCM decode */
+
+} OggVorbis_File;
+
+extern int ov_clear(OggVorbis_File *vf);
+extern int ov_open(FILE *f,OggVorbis_File *vf,char *initial,long ibytes);
+
+extern double ov_lbtime(OggVorbis_File *vf,int i);
+extern double ov_totaltime(OggVorbis_File *vf);
+
+
+#endif
+
+
+
+
+
+
+