summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <unknown@xiph.org>2004-03-20 18:18:51 +0000
committerunknown <unknown@xiph.org>2004-03-20 18:18:51 +0000
commit08309f2d62179920fe6c51d4383b93e9bc26b1fa (patch)
tree5d17b3a570b044e8904f9d82cfc8675b5518676f
parent0ccebdf7b8162db708c1fa3b863d4205b0568cc5 (diff)
parent5b634bdf8ca2013d31e44caeeb3befe007678cbd (diff)
downloadlibvorbis-git-08309f2d62179920fe6c51d4383b93e9bc26b1fa.tar.gz
This commit was manufactured by cvs2svn to create branch
'new_acoustics_pending_merge_20000328'. svn path=/branches/new_acoustics_pending_merge_20000328/vorbis/; revision=308
-rw-r--r--examples/seeking_example.c65
1 files changed, 65 insertions, 0 deletions
diff --git a/examples/seeking_example.c b/examples/seeking_example.c
new file mode 100644
index 00000000..b9a2264e
--- /dev/null
+++ b/examples/seeking_example.c
@@ -0,0 +1,65 @@
+/********************************************************************
+ * *
+ * 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-2000 *
+ * by Monty <monty@xiph.org> and The XIPHOPHORUS Company *
+ * http://www.xiph.org/ *
+ * *
+ ********************************************************************
+
+ function: illustrate seeking, and test it too
+ last mod: $Id: seeking_example.c,v 1.1 2000/04/03 09:51:07 xiphmont Exp $
+
+ ********************************************************************/
+
+#include <stdlib.h>
+#include <stdio.h>
+#include "vorbis/codec.h"
+#include "vorbis/vorbisfile.h"
+#include "../lib/misc.h"
+
+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(&ov)){
+ double length=ov_time_total(&ov,-1);
+ printf("testing seeking to random places in %g seconds....\n",length);
+ for(i=0;i<100;i++){
+ ov_time_seek(&ov,drand48()*length);
+ printf("\r\t%d... ",i);
+ fflush(stdout);
+ }
+
+ printf("\r \nOK.\n\n");
+ }else{
+ printf("Standard input was not seekable.\n");
+ }
+
+ ov_clear(&ov);
+ return 0;
+}
+
+
+
+
+
+
+
+
+
+
+
+
+