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  This is example code only sensible to be considered in the public domain.
5  Initially written by Thomas Orgis
6 */
7 
8 /* Note the lack of error checking here.
9  While it would be nicer to inform the user about troubles, libmpg123 is designed _not_ to bite you on operations with invalid handles , etc.
10  You just jet invalid results on invalid operations... */
11 
12 #include <mpg123.h>
13 #include <stdio.h>
14 
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 #if MPG123_API_VERSION < 46
27  mpg123_init();
28 #endif
29  m = mpg123_new(NULL, NULL);
30  mpg123_param(m, MPG123_RESYNC_LIMIT, -1, 0); /* New in library version 0.0.1 . */
31  for(i = 1; i < argc; ++i)
32  {
33  off_t a, b;
34 
35  mpg123_open(m, argv[i]);
36 
37  a = mpg123_length(m);
38  mpg123_scan(m);
39  b = mpg123_length(m);
40 
41  mpg123_close(m);
42 
43  printf("File %i: estimated %li vs. scanned %li\n", i, (long)a, (long)b);
44  }
45 
46  mpg123_delete(m);
47  return 0;
48 }
MPG123_EXPORT mpg123_handle * mpg123_new(const char *decoder, int *error)
MPG123_EXPORT void mpg123_delete(mpg123_handle *mh)
struct mpg123_handle_struct mpg123_handle
Definition: mpg123.h:164
MPG123_EXPORT int mpg123_param(mpg123_handle *mh, enum mpg123_parms type, long value, double fvalue)
MPG123_EXPORT int mpg123_init(void)
@ MPG123_RESYNC_LIMIT
Definition: mpg123.h:243
MPG123_EXPORT int mpg123_close(mpg123_handle *mh)
MPG123_EXPORT int mpg123_open(mpg123_handle *mh, const char *path)
MPG123_EXPORT int mpg123_scan(mpg123_handle *mh)
MPG123_EXPORT off_t mpg123_length(mpg123_handle *mh)
int main(int argc, char **argv)
Definition: scan.c:16
Hopefully valid HTML! Valid CSS!