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.4 2000/10/12 03:12:39 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 double val=(double)rand()/RAND_MAX*length;
41 ov_time_seek(&ov,val);
42 printf("\r\t%d [%gs]... ",i,val);
46 printf("\r \nOK.\n\n");
48 printf("Standard input was not seekable.\n");