1 /********************************************************************
3 * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. *
4 * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
5 * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE. *
6 * PLEASE READ THESE TERMS DISTRIBUTING. *
8 * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-2000 *
9 * by Monty <monty@xiph.org> and The XIPHOPHORUS Company *
10 * http://www.xiph.org/ *
12 ********************************************************************
14 function: illustrate seeking, and test it too
15 last mod: $Id: seeking_example.c,v 1.2 2000/05/08 20:49:42 xiphmont Exp $
17 ********************************************************************/
21 #include "vorbis/codec.h"
22 #include "vorbis/vorbisfile.h"
23 #include "../lib/misc.h"
29 /* open the file/pipe on stdin */
30 if(ov_open(stdin,&ov,NULL,-1)==-1){
31 printf("Could not open input as an OggVorbis file.\n\n");
35 /* print details about each logical bitstream in the input */
37 double length=ov_time_total(&ov,-1);
38 printf("testing seeking to random places in %g seconds....\n",length);
40 ov_time_seek(&ov,drand48()*length);
41 printf("\r\t%d... ",i);
45 printf("\r \nOK.\n\n");
47 printf("Standard input was not seekable.\n");