1
0
mirror of http://mpg123.de/trunk/.git synced 2025-07-30 02:01:12 +03:00

Move example programs from src/ to doc/examples/ .

git-svn-id: svn://scm.orgis.org/mpg123/trunk@1148 35dc7657-300d-0410-a2e5-dc2837fedb53
This commit is contained in:
thor
2007-11-28 09:35:58 +00:00
parent f22684a813
commit bf8e644005
5 changed files with 21 additions and 23 deletions

34
doc/examples/scan.c Normal file
View File

@ -0,0 +1,34 @@
/*
scan: Estimate length (sample count) of a mpeg file and compare to length from exact scan.
copyright 2007 by the mpg123 project - free software under the terms of the LGPL 2.1
see COPYING and AUTHORS files in distribution or http://mpg123.org
initially written by Thomas Orgis
*/
/* Note the lack of error checking here.
While it would be nicer to inform the user about troubles, libmpg123 is designed _not_ to bite you on operations with invalid handles , etc.
You just jet invalid results on invalid operations... */
#include <stdio.h>
#include "mpg123.h"
int main(int argc, char **argv)
{
mpg123_handle *m;
int i;
mpg123_init();
m = mpg123_new(NULL, NULL);
for(i = 1; i < argc; ++i)
{
off_t a, b;
mpg123_open(m, argv[i]);
a = mpg123_length(m);
mpg123_scan(m);
b = mpg123_length(m);
printf("File %i: estimated %li vs. scanned %li\n", i, (long)a, (long)b);
}
mpg123_delete(m);
mpg123_exit();
return 0;
}