You could access this page securely.

API documentation for libmpg123, libout123, and libsyn123

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, NEWS.libout123, NEWS.libsyn123, and the overall NEWS file on libmpg123 versions and important changes between them.
Let me emphasize that the policy for the lib*123 family 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.
1 /*
2  scan: Estimate length (sample count) of a mpeg file and compare to length from exact scan.
3 
4  copyright 2007 by the mpg123 project - free software under the terms of the LGPL 2.1
5  see COPYING and AUTHORS files in distribution or http://mpg123.org
6  initially written by Thomas Orgis
7 */
8 
9 /* Note the lack of error checking here.
10  While it would be nicer to inform the user about troubles, libmpg123 is designed _not_ to bite you on operations with invalid handles , etc.
11  You just jet invalid results on invalid operations... */
12 
13 #include <mpg123.h>
14 #include <stdio.h>
15 
16 int main(int argc, char **argv)
17 {
18  mpg123_handle *m;
19  int i;
20  if(argc < 2)
21  {
22  fprintf(stderr, "\nI will give you the estimated and exact sample lengths of MPEG audio files.\n");
23  fprintf(stderr, "\nUsage: %s <mpeg audio file list>\n\n", argv[0]);
24  return -1;
25  }
26  mpg123_init();
27  m = mpg123_new(NULL, NULL);
28  mpg123_param(m, MPG123_RESYNC_LIMIT, -1, 0); /* New in library version 0.0.1 . */
29  for(i = 1; i < argc; ++i)
30  {
31  off_t a, b;
32 
33  mpg123_open(m, argv[i]);
34 
35  a = mpg123_length(m);
36  mpg123_scan(m);
37  b = mpg123_length(m);
38 
39  mpg123_close(m);
40 
41  printf("File %i: estimated %li vs. scanned %li\n", i, (long)a, (long)b);
42  }
43 
44  mpg123_delete(m);
45  mpg123_exit();
46  return 0;
47 }
struct mpg123_handle_struct mpg123_handle
Definition: mpg123.h:132
MPG123_EXPORT off_t mpg123_length(mpg123_handle *mh)
MPG123_EXPORT void mpg123_exit(void)
MPG123_EXPORT int mpg123_close(mpg123_handle *mh)
MPG123_EXPORT int mpg123_init(void)
MPG123_EXPORT void mpg123_delete(mpg123_handle *mh)
MPG123_EXPORT int mpg123_param(mpg123_handle *mh, enum mpg123_parms type, long value, double fvalue)
MPG123_EXPORT mpg123_handle * mpg123_new(const char *decoder, int *error)
MPG123_EXPORT int mpg123_scan(mpg123_handle *mh)
MPG123_EXPORT int mpg123_open(mpg123_handle *mh, const char *path)
Hopefully valid HTML! Valid CSS!