1
0
mirror of http://mpg123.de/trunk/.git synced 2025-10-23 16:48:31 +03:00
Files
mpg123/doc/examples/dump_seekindex.c
thor b030c49633 examples: fix compiler warnings
git-svn-id: svn://scm.orgis.org/mpg123/trunk@4620 35dc7657-300d-0410-a2e5-dc2837fedb53
2020-03-16 07:19:54 +00:00

43 lines
1018 B
C

/*
dump_seekindex: Scan a mpeg file and dump its seek index.
copyright 2010 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 Patrick Dehne
*/
#include <mpg123.h>
#include <stdio.h>
#include <inttypes.h>
int main(int argc, char **argv)
{
mpg123_handle *m;
off_t* offsets;
off_t step;
size_t fill, i;
if(argc != 2)
{
fprintf(stderr, "\nI will dump the frame index of an MPEG audio file.\n");
fprintf(stderr, "\nUsage: %s <mpeg audio file>\n\n", argv[0]);
return -1;
}
mpg123_init();
m = mpg123_new(NULL, NULL);
mpg123_param(m, MPG123_RESYNC_LIMIT, -1, 0);
mpg123_param(m, MPG123_INDEX_SIZE, -1, 0);
mpg123_open(m, argv[1]);
mpg123_scan(m);
mpg123_index(m, &offsets, &step, &fill);
for(i=0; i<fill;i++) {
printf("Frame number %"PRIiMAX": file offset %"PRIiMAX"\n", (intmax_t)(i * step), (intmax_t)offsets[i]);
}
mpg123_close(m);
mpg123_delete(m);
mpg123_exit();
return 0;
}