mpg123 logo
download : svn :: features :: sf.net project - bug tracker :: news archive
libmpg123 API :: hacking :: testing :: benchmarking :: FAQ :: links :: contact
Note: This API doc is automatically generated from the current development version that you can get via Subversion or as a daily snapshot from http://mpg123.org/snapshot. There may be differences (additions) compared to the latest stable release. See NEWS.libmpg123 and the overall NEWS file on libmpg123 versions and important changes between them.
Let me emphasize that the policy for libmpg123 is to always stay backwards compatible -- only additions are planned (and it's not yet planned to change the plans;-).

scan.c

Go to the documentation of this file.
00001 /*
00002         scan: Estimate length (sample count) of a mpeg file and compare to length from exact scan.
00003 
00004         copyright 2007 by the mpg123 project - free software under the terms of the LGPL 2.1
00005         see COPYING and AUTHORS files in distribution or http://mpg123.org
00006         initially written by Thomas Orgis
00007 */
00008 
00009 /* Note the lack of error checking here.
00010    While it would be nicer to inform the user about troubles, libmpg123 is designed _not_ to bite you on operations with invalid handles , etc.
00011   You just jet invalid results on invalid operations... */
00012 
00013 #include <mpg123.h>
00014 #include <stdio.h>
00015 
00016 int main(int argc, char **argv)
00017 {
00018         mpg123_handle *m;
00019         int i;
00020         if(argc < 2)
00021         {
00022                 fprintf(stderr, "\nI will give you the estimated and exact sample lengths of MPEG audio files.\n");
00023                 fprintf(stderr, "\nUsage: %s <mpeg audio file list>\n\n", argv[0]);
00024                 return -1;
00025         }
00026         mpg123_init();
00027         m = mpg123_new(NULL, NULL);
00028         mpg123_param(m, MPG123_RESYNC_LIMIT, -1, 0); /* New in library version 0.0.1 . */
00029         for(i = 1; i < argc; ++i)
00030         {
00031                 off_t a, b;
00032                 
00033                 mpg123_open(m, argv[i]);
00034 
00035                 a = mpg123_length(m);           
00036                 mpg123_scan(m);
00037                 b = mpg123_length(m);
00038 
00039                 mpg123_close(m);
00040 
00041                 printf("File %i: estimated %li vs. scanned %li\n", i, (long)a, (long)b);
00042         }
00043 
00044         mpg123_delete(m);
00045         mpg123_exit();
00046         return 0;
00047 }

Generated on Mon Feb 6 01:07:20 2012 for libmpg123 by  doxygen 1.5.6