Skip to content

Latest commit

 

History

History
2112 lines (2112 loc) · 89.3 KB

mpg123-1.25.6.patch

File metadata and controls

2112 lines (2112 loc) · 89.3 KB
 
1
2
diff -ruN mpg123-1.25.6.orig/android/config.h mpg123-1.25.6/android/config.h
--- mpg123-1.25.6.orig/android/config.h 1969-12-31 16:00:00.000000000 -0800
Nov 2, 2017
Nov 2, 2017
3
+++ mpg123-1.25.6/android/config.h 2017-10-23 07:43:01.919907577 -0700
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
@@ -0,0 +1,478 @@
+/* src/config.h. Generated from config.h.in by configure. */
+/* src/config.h.in. Generated from configure.ac by autoheader. */
+
+/* Define if your architecture wants/needs/can use attribute_align_arg and
+ alignment checks. It is for 32bit x86... */
+/* #undef ABI_ALIGN_FUN */
+
+/* Define to use proper rounding. */
+/* #undef ACCURATE_ROUNDING */
+
+/* Define if building universal (internal helper macro) */
+/* #undef AC_APPLE_UNIVERSAL_BUILD */
+
+/* Define if .balign is present. */
+#define ASMALIGN_BALIGN 1
+
+/* Define if .align just takes byte count. */
+/* #undef ASMALIGN_BYTE */
+
+/* Define if .align takes 3 for alignment of 2^3=8 bytes instead of 8. */
+/* #undef ASMALIGN_EXP */
+
+/* Define if __attribute__((aligned(16))) shall be used */
+#define CCALIGN 1
+
+/* Define if debugging is enabled. */
+/* #undef DEBUG */
+
+/* The default audio output module(s) to use */
+#define DEFAULT_OUTPUT_MODULE "oss,esd,pulse"
+
+/* Define if building with dynamcally linked libmpg123 */
+#define DYNAMIC_BUILD 1
+
+/* Use EFBIG as substitude for EOVERFLOW, mingw.org may lack the latter */
+/* #undef EOVERFLOW */
+
+/* Define if FIFO support is enabled. */
+/* #undef FIFO */
+
+/* Define if frame index should be used. */
+#define FRAME_INDEX 1
+
+/* Define if gapless is enabled. */
+#define GAPLESS 1
+
+/* Define to 1 if you have the <alc.h> header file. */
+/* #undef HAVE_ALC_H */
+
+/* Define to 1 if you have the <Alib.h> header file. */
+/* #undef HAVE_ALIB_H */
+
+/* Define to 1 if you have the <AL/alc.h> header file. */
+/* #undef HAVE_AL_ALC_H */
+
+/* Define to 1 if you have the <AL/al.h> header file. */
+/* #undef HAVE_AL_AL_H */
+
+/* Define to 1 if you have the <al.h> header file. */
+/* #undef HAVE_AL_H */
+
+/* Define to 1 if you have the <arpa/inet.h> header file. */
+#define HAVE_ARPA_INET_H 1
+
+/* Define to 1 if you have the <asm/audioio.h> header file. */
+/* #undef HAVE_ASM_AUDIOIO_H */
+
+/* Define to 1 if you have the `atoll' function. */
+#define HAVE_ATOLL 1
+
+/* Define to 1 if you have the <audios.h> header file. */
+/* #undef HAVE_AUDIOS_H */
+
+/* Define to 1 if you have the <AudioToolbox/AudioToolbox.h> header file. */
+/* #undef HAVE_AUDIOTOOLBOX_AUDIOTOOLBOX_H */
+
+/* Define to 1 if you have the <AudioUnit/AudioUnit.h> header file. */
+/* #undef HAVE_AUDIOUNIT_AUDIOUNIT_H */
+
+/* Define to 1 if you have the <CoreServices/CoreServices.h> header file. */
+/* #undef HAVE_CORESERVICES_CORESERVICES_H */
+
+/* Define to 1 if you have the <CUlib.h> header file. */
+/* #undef HAVE_CULIB_H */
+
+/* Define to 1 if you have the <dirent.h> header file. */
+#define HAVE_DIRENT_H 1
+
+/* Define to 1 if you have the `dlclose' function. */
+#define HAVE_DLCLOSE 1
+
+/* Define to 1 if you have the <dlfcn.h> header file. */
+#define HAVE_DLFCN_H 1
+
+/* Define to 1 if you have the `dlopen' function. */
+#define HAVE_DLOPEN 1
+
+/* Define to 1 if you have the `dlsym' function. */
+#define HAVE_DLSYM 1
+
+/* Define if getaddrinfo accepts the AI_ADDRCONFIG flag */
+/* #undef HAVE_GAI_ADDRCONFIG */
+
+/* Define to 1 if you have the `getaddrinfo' function. */
+#define HAVE_GETADDRINFO 1
+
+/* Define to 1 if you have the `getpagesize' function. */
+/* #undef HAVE_GETPAGESIZE */
+
+/* Define to 1 if you have the `getuid' function. */
+#define HAVE_GETUID 1
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#define HAVE_INTTYPES_H 1
+
+/* Define to 1 if you have the <langinfo.h> header file. */
+/* #undef HAVE_LANGINFO_H */
+
+/* Define to 1 if you have the `m' library (-lm). */
+#define HAVE_LIBM 1
+
+/* Define to 1 if you have the `mx' library (-lmx). */
+/* #undef HAVE_LIBMX */
+
+/* Define to 1 if you have the <limits.h> header file. */
+#define HAVE_LIMITS_H 1
+
+/* Define to 1 if you have the <linux/soundcard.h> header file. */
+#define HAVE_LINUX_SOUNDCARD_H 1
+
+/* Define to 1 if you have the <locale.h> header file. */
+#define HAVE_LOCALE_H 1
+
+/* Define to 1 if you have the <machine/soundcard.h> header file. */
+/* #undef HAVE_MACHINE_SOUNDCARD_H */
+
+/* Define to 1 if you have the <memory.h> header file. */
+#define HAVE_MEMORY_H 1
+
+/* Define to 1 if you have the `mkfifo' function. */
+/* #undef HAVE_MKFIFO */
+
+/* Define to 1 if you have a working `mmap' system call. */
+/* #undef HAVE_MMAP */
+
+/* Define to 1 if you have the <netdb.h> header file. */
+#define HAVE_NETDB_H 1
+
+/* Define to 1 if you have the <netinet/in.h> header file. */
+#define HAVE_NETINET_IN_H 1
+
+/* Define to 1 if you have the <netinet/tcp.h> header file. */
+/* #undef HAVE_NETINET_TCP_H */
+
+/* Define to 1 if you have the `nl_langinfo' function. */
+/* #undef HAVE_NL_LANGINFO */
+
+/* Define to 1 if you have the <OpenAL/alc.h> header file. */
+/* #undef HAVE_OPENAL_ALC_H */
+
+/* Define to 1 if you have the <OpenAL/al.h> header file. */
+/* #undef HAVE_OPENAL_AL_H */
+
+/* Define to 1 if you have the <os2me.h> header file. */
+/* #undef HAVE_OS2ME_H */
+
+/* Define to 1 if you have the <os2.h> header file. */
+/* #undef HAVE_OS2_H */
+
+/* Define to 1 if you have the `random' function. */
+/* #undef HAVE_RANDOM */
+
+/* Define to 1 if you have the <sched.h> header file. */
+#define HAVE_SCHED_H 1
+
+/* Define to 1 if you have the `sched_setscheduler' function. */
+#define HAVE_SCHED_SETSCHEDULER 1
+
+/* Define to 1 if you have the `setlocale' function. */
+#define HAVE_SETLOCALE 1
+
+/* Define to 1 if you have the `setpriority' function. */
+#define HAVE_SETPRIORITY 1
+
+/* Define to 1 if you have the `setuid' function. */
+#define HAVE_SETUID 1
+
+/* Define to 1 if you have the <signal.h> header file. */
+#define HAVE_SIGNAL_H 1
+
+/* Define to 1 if you have the <sndio.h> header file. */
+/* #undef HAVE_SNDIO_H */
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#define HAVE_STDINT_H 1
+
+/* Define to 1 if you have the <stdio.h> header file. */
+#define HAVE_STDIO_H 1
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#define HAVE_STDLIB_H 1
+
+/* Define to 1 if you have the `strerror' function. */
+#define HAVE_STRERROR 1
+
+/* Define to 1 if you have the <strings.h> header file. */
+#define HAVE_STRINGS_H 1
+
+/* Define to 1 if you have the <string.h> header file. */
+#define HAVE_STRING_H 1
+
+/* Define to 1 if you have the <sun/audioio.h> header file. */
+/* #undef HAVE_SUN_AUDIOIO_H */
+
+/* Define to 1 if you have the <sys/audioio.h> header file. */
+/* #undef HAVE_SYS_AUDIOIO_H */
+
+/* Define to 1 if you have the <sys/audio.h> header file. */
+/* #undef HAVE_SYS_AUDIO_H */
+
+/* Define to 1 if you have the <sys/ioctl.h> header file. */
+#define HAVE_SYS_IOCTL_H 1
+
+/* Define to 1 if you have the <sys/param.h> header file. */
+#define HAVE_SYS_PARAM_H 1
+
+/* Define to 1 if you have the <sys/resource.h> header file. */
+#define HAVE_SYS_RESOURCE_H 1
+
+/* Define to 1 if you have the <sys/select.h> header file. */
+#define HAVE_SYS_SELECT_H 1
+
+/* Define to 1 if you have the <sys/signal.h> header file. */
+/* #undef HAVE_SYS_SIGNAL_H */
+
+/* Define to 1 if you have the <sys/socket.h> header file. */
+#define HAVE_SYS_SOCKET_H 1
+
+/* Define to 1 if you have the <sys/soundcard.h> header file. */
+/* #undef HAVE_SYS_SOUNDCARD_H */
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#define HAVE_SYS_STAT_H 1
+
+/* Define to 1 if you have the <sys/time.h> header file. */
+#define HAVE_SYS_TIME_H 1
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#define HAVE_SYS_TYPES_H 1
+
+/* Define to 1 if you have the <sys/wait.h> header file. */
+#define HAVE_SYS_WAIT_H 1
+
+/* Define this if you have the POSIX termios library */
+#define HAVE_TERMIOS 1
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#define HAVE_UNISTD_H 1
+
+/* Define to 1 if you have the <windows.h> header file. */
+/* #undef HAVE_WINDOWS_H */
+
+/* Define to 1 if you have the <ws2tcpip.h> header file. */
+/* #undef HAVE_WS2TCPIP_H */
+
+/* Define to indicate that float storage follows IEEE754. */
+#define IEEE_FLOAT 1
+
+/* size of the frame index seek table */
+#define INDEX_SIZE 1000
+
+/* Define if IPV6 support is enabled. */
+#define IPV6 1
+
+/* Define this to the size of native offset type in bits, used for LFS alias
+ functions. */
+#define LFS_ALIAS_BITS 32
+
+/* Define to the extension used for runtime loadable modules, say, ".so". */
+#define LT_MODULE_EXT ".so"
+
+/* Define to the sub-directory where libtool stores uninstalled libraries. */
+#define LT_OBJDIR ".libs/"
+
+/* Define to the shared library suffix, say, ".dylib". */
+/* #undef LT_SHARED_EXT */
+
+/* Define to the shared archive member specification, say "(shr.o)". */
+/* #undef LT_SHARED_LIB_MEMBER */
+
+/* Define if network support is enabled. */
+#define NETWORK 1
+
+/* Define to disable 16 bit integer output. */
+/* #undef NO_16BIT */
+
+/* Define to disable 32 bit and 24 bit integer output. */
+/* #undef NO_32BIT */
+
+/* Define to disable 8 bit integer output. */
+/* #undef NO_8BIT */
+
+/* Define to disable downsampled decoding. */
+/* #undef NO_DOWNSAMPLE */
+
+/* Define to disable equalizer. */
+/* #undef NO_EQUALIZER */
+
+/* Define to disable error messages in combination with a return value (the
+ return is left intact). */
+/* #undef NO_ERETURN */
+
+/* Define to disable error messages. */
+/* #undef NO_ERRORMSG */
+
+/* Define to disable feeder and buffered readers. */
+/* #undef NO_FEEDER */
+
+/* Define to disable ICY handling. */
+/* #undef NO_ICY */
+
+/* Define to disable ID3v2 parsing. */
+/* #undef NO_ID3V2 */
+
+/* Define to disable layer I. */
+/* #undef NO_LAYER1 */
+
+/* Define to disable layer II. */
+/* #undef NO_LAYER2 */
+
+/* Define to disable layer III. */
+/* #undef NO_LAYER3 */
+
+/* Define to disable ntom resampling. */
+/* #undef NO_NTOM */
+
+/* Define to disable real output. */
+/* #undef NO_REAL */
+
+/* Define to disable string functions. */
+/* #undef NO_STRING */
+
+/* Define for post-processed 32 bit formats. */
+/* #undef NO_SYNTH32 */
+
+/* Define to disable warning messages. */
+/* #undef NO_WARNING */
+
+/* Name of package */
+#define PACKAGE "mpg123"
+
+/* Define to the address where bug reports for this package should be sent. */
+#define PACKAGE_BUGREPORT "maintainer@mpg123.org"
+
+/* Define to the full name of this package. */
+#define PACKAGE_NAME "mpg123"
+
+/* Define to the full name and version of this package. */
+#define PACKAGE_STRING "mpg123 1.25.6"
+
+/* Define to the one symbol short name of this package. */
+#define PACKAGE_TARNAME "mpg123"
+
+/* Define to the home page for this package. */
+#define PACKAGE_URL ""
+
+/* Define to the version of this package. */
+#define PACKAGE_VERSION "1.25.6"
+
+/* Define if portaudio v18 API is wanted. */
+/* #undef PORTAUDIO18 */
+
+/* The size of `int32_t', as computed by sizeof. */
+#define SIZEOF_INT32_T 4
+
+/* The size of `long', as computed by sizeof. */
+#define SIZEOF_LONG 4
+
+/* The size of `off_t', as computed by sizeof. */
+#define SIZEOF_OFF_T 4
+
+/* The size of `size_t', as computed by sizeof. */
+#define SIZEOF_SIZE_T 4
+
+/* The size of `ssize_t', as computed by sizeof. */
+#define SIZEOF_SSIZE_T 4
+
+/* Define to 1 if you have the ANSI C header files. */
+#define STDC_HEADERS 1
+
+/* Define if modules are enabled */
+#define USE_MODULES 1
+
+/* Define for new Huffman decoding scheme. */
+#define USE_NEW_HUFFTABLE 1
+
+/* Define to use yasm for assemble AVX sources. */
+/* #undef USE_YASM_FOR_AVX */
+
+/* Version number of package */
+#define VERSION "1.25.6"
+
+/* Define to use Win32 named pipes */
+/* #undef WANT_WIN32_FIFO */
+
+/* Define to use Win32 sockets */
+/* #undef WANT_WIN32_SOCKETS */
+
+/* Define to use Unicode for Windows */
+/* #undef WANT_WIN32_UNICODE */
+
+/* WinXP and above for ipv6 */
+/* #undef WINVER */
+
+/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
+ significant byte first (like Motorola and SPARC, unlike Intel). */
+#if defined AC_APPLE_UNIVERSAL_BUILD
+# if defined __BIG_ENDIAN__
+# define WORDS_BIGENDIAN 1
+# endif
+#else
+# ifndef WORDS_BIGENDIAN
+/* # undef WORDS_BIGENDIAN */
+# endif
+#endif
+
+/* Enable large inode numbers on Mac OS X 10.5. */
+#ifndef _DARWIN_USE_64_BIT_INODE
+# define _DARWIN_USE_64_BIT_INODE 1
+#endif
+
+/* Number of bits in a file offset, on hosts where this is settable. */
+/* #undef _FILE_OFFSET_BITS */
+
+/* Define for large files, on AIX-style hosts. */
+/* #undef _LARGE_FILES */
+
+/* WinXP and above for ipv6 */
+/* #undef _WIN32_WINNT */
+
+/* Define to empty if `const' does not conform to ANSI C. */
+/* #undef const */
+
+/* Define to `__inline__' or `__inline' if that's what the C compiler
+ calls it, or to nothing if 'inline' is not supported under any name. */
+#ifndef __cplusplus
+/* #undef inline */
+#endif
+
+/* Define to `short' if <sys/types.h> does not define. */
+/* #undef int16_t */
+
+/* Define to `int' if <sys/types.h> does not define. */
+/* #undef int32_t */
+
+/* Define to `long long' if <sys/types.h> does not define. */
+/* #undef int64_t */
+
+/* Define to the native offset type (long or actually off_t). */
+#define lfs_alias_t off_t
+
+/* Define to `long int' if <sys/types.h> does not define. */
+/* #undef off_t */
+
+/* Define to `unsigned long' if <sys/types.h> does not define. */
+/* #undef size_t */
+
+/* Define to `long' if <sys/types.h> does not define. */
+/* #undef ssize_t */
+
+/* Define to `unsigned short' if <sys/types.h> does not define. */
+/* #undef uint16_t */
+
+/* Define to `unsigned int' if <sys/types.h> does not define. */
+/* #undef uint32_t */
+
+/* Define to `unsigned long' if <sys/types.h> does not define. */
+/* #undef uintptr_t */
diff -ruN mpg123-1.25.6.orig/android/mpg123.h mpg123-1.25.6/android/mpg123.h
--- mpg123-1.25.6.orig/android/mpg123.h 1969-12-31 16:00:00.000000000 -0800
Nov 2, 2017
Nov 2, 2017
485
+++ mpg123-1.25.6/android/mpg123.h 2017-10-23 07:43:01.919907577 -0700
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
@@ -0,0 +1,1441 @@
+/*
+ libmpg123: MPEG Audio Decoder library (version 1.25.6)
+
+ copyright 1995-2015 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
+*/
+
+#ifndef MPG123_LIB_H
+#define MPG123_LIB_H
+
+#include <fmt123.h>
+
+/** \file mpg123.h The header file for the libmpg123 MPEG Audio decoder */
+
+/** A macro to check at compile time which set of API functions to expect.
+ * This should be incremented at least each time a new symbol is added
+ * to the header.
+ */
+#define MPG123_API_VERSION 44
+
+#ifndef MPG123_EXPORT
+/** Defines needed for MS Visual Studio(tm) DLL builds.
+ * Every public function must be prefixed with MPG123_EXPORT. When building
+ * the DLL ensure to define BUILD_MPG123_DLL. This makes the function accessible
+ * for clients and includes it in the import library which is created together
+ * with the DLL. When consuming the DLL ensure to define LINK_MPG123_DLL which
+ * imports the functions from the DLL.
+ */
+#ifdef BUILD_MPG123_DLL
+/* The dll exports. */
+#define MPG123_EXPORT __declspec(dllexport)
+#else
+#ifdef LINK_MPG123_DLL
+/* The exe imports. */
+#define MPG123_EXPORT __declspec(dllimport)
+#else
+/* Nothing on normal/UNIX builds */
+#define MPG123_EXPORT
+#endif
+#endif
+#endif
+
+/* This is for Visual Studio, so this header works as distributed in the binary downloads */
+#if defined(_MSC_VER) && !defined(MPG123_DEF_SSIZE_T)
+#define MPG123_DEF_SSIZE_T
+#include <stddef.h>
+typedef ptrdiff_t ssize_t;
+#endif
+
+#ifndef MPG123_NO_CONFIGURE /* Enable use of this file without configure. */
+#include <stdlib.h>
+#include <sys/types.h>
+
+/* Simplified large file handling.
+ I used to have a check here that prevents building for a library with conflicting large file setup
+ (application that uses 32 bit offsets with library that uses 64 bits).
+ While that was perfectly fine in an environment where there is one incarnation of the library,
+ it hurt GNU/Linux and Solaris systems with multilib where the distribution fails to provide the
+ correct header matching the 32 bit library (where large files need explicit support) or
+ the 64 bit library (where there is no distinction).
+
+ New approach: When the app defines _FILE_OFFSET_BITS, it wants non-default large file support,
+ and thus functions with added suffix (mpg123_open_64).
+ Any mismatch will be caught at link time because of the _FILE_OFFSET_BITS setting used when
+ building libmpg123. Plus, there's dual mode large file support in mpg123 since 1.12 now.
+ Link failure is not the expected outcome of any half-sane usage anymore.
+
+ More complication: What about client code defining _LARGEFILE64_SOURCE? It might want direct access to the _64 functions, along with the ones without suffix. Well, that's possible now via defining MPG123_NO_LARGENAME and MPG123_LARGESUFFIX, respectively, for disabling or enforcing the suffix names.
+*/
+
+/*
+ Now, the renaming of large file aware functions.
+ By default, it appends underscore _FILE_OFFSET_BITS (so, mpg123_seek_64 for mpg123_seek), if _FILE_OFFSET_BITS is defined. You can force a different suffix via MPG123_LARGESUFFIX (that must include the underscore), or you can just disable the whole mess by defining MPG123_NO_LARGENAME.
+*/
+#if (!defined MPG123_NO_LARGENAME) && ((defined _FILE_OFFSET_BITS) || (defined MPG123_LARGESUFFIX))
+
+/* Need some trickery to concatenate the value(s) of the given macro(s). */
+#define MPG123_MACROCAT_REALLY(a, b) a ## b
+#define MPG123_MACROCAT(a, b) MPG123_MACROCAT_REALLY(a, b)
+#ifndef MPG123_LARGESUFFIX
+#define MPG123_LARGESUFFIX MPG123_MACROCAT(_, _FILE_OFFSET_BITS)
+#endif
+#define MPG123_LARGENAME(func) MPG123_MACROCAT(func, MPG123_LARGESUFFIX)
+
+#define mpg123_open MPG123_LARGENAME(mpg123_open)
+#define mpg123_open_fd MPG123_LARGENAME(mpg123_open_fd)
+#define mpg123_open_handle MPG123_LARGENAME(mpg123_open_handle)
+#define mpg123_framebyframe_decode MPG123_LARGENAME(mpg123_framebyframe_decode)
+#define mpg123_decode_frame MPG123_LARGENAME(mpg123_decode_frame)
+#define mpg123_tell MPG123_LARGENAME(mpg123_tell)
+#define mpg123_tellframe MPG123_LARGENAME(mpg123_tellframe)
+#define mpg123_tell_stream MPG123_LARGENAME(mpg123_tell_stream)
+#define mpg123_seek MPG123_LARGENAME(mpg123_seek)
+#define mpg123_feedseek MPG123_LARGENAME(mpg123_feedseek)
+#define mpg123_seek_frame MPG123_LARGENAME(mpg123_seek_frame)
+#define mpg123_timeframe MPG123_LARGENAME(mpg123_timeframe)
+#define mpg123_index MPG123_LARGENAME(mpg123_index)
+#define mpg123_set_index MPG123_LARGENAME(mpg123_set_index)
+#define mpg123_position MPG123_LARGENAME(mpg123_position)
+#define mpg123_length MPG123_LARGENAME(mpg123_length)
+#define mpg123_framelength MPG123_LARGENAME(mpg123_framelength)
+#define mpg123_set_filesize MPG123_LARGENAME(mpg123_set_filesize)
+#define mpg123_replace_reader MPG123_LARGENAME(mpg123_replace_reader)
+#define mpg123_replace_reader_handle MPG123_LARGENAME(mpg123_replace_reader_handle)
+#define mpg123_framepos MPG123_LARGENAME(mpg123_framepos)
+
+#endif /* largefile hackery */
+
+#endif /* MPG123_NO_CONFIGURE */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** \defgroup mpg123_init mpg123 library and handle setup
+ *
+ * Functions to initialise and shutdown the mpg123 library and handles.
+ * The parameters of handles have workable defaults, you only have to tune them when you want to tune something;-)
+ * Tip: Use a RVA setting...
+ *
+ * @{
+ */
+
+/** Opaque structure for the libmpg123 decoder handle. */
+struct mpg123_handle_struct;
+
+/** Opaque structure for the libmpg123 decoder handle.
+ * Most functions take a pointer to a mpg123_handle as first argument and operate on its data in an object-oriented manner.
+ */
+typedef struct mpg123_handle_struct mpg123_handle;
+
+/** Function to initialise the mpg123 library.
+ * This function is not thread-safe. Call it exactly once per process, before any other (possibly threaded) work with the library.
+ *
+ * \return MPG123_OK if successful, otherwise an error number.
+ */
+MPG123_EXPORT int mpg123_init(void);
+
+/** Function to close down the mpg123 library.
+ * This function is not thread-safe. Call it exactly once per process, before any other (possibly threaded) work with the library. */
+MPG123_EXPORT void mpg123_exit(void);
+
+/** Create a handle with optional choice of decoder (named by a string, see mpg123_decoders() or mpg123_supported_decoders()).
+ * and optional retrieval of an error code to feed to mpg123_plain_strerror().
+ * Optional means: Any of or both the parameters may be NULL.
+ *
+ * \param decoder optional choice of decoder variant (NULL for default)
+ * \param error optional address to store error codes
+ * \return Non-NULL pointer to fresh handle when successful.
+ */
+MPG123_EXPORT mpg123_handle *mpg123_new(const char* decoder, int *error);
+
+/** Delete handle, mh is either a valid mpg123 handle or NULL.
+ * \param mh handle
+ */
+MPG123_EXPORT void mpg123_delete(mpg123_handle *mh);
+
+/** Enumeration of the parameters types that it is possible to set/get. */
+enum mpg123_parms
+{
+ MPG123_VERBOSE = 0, /**< set verbosity value for enabling messages to stderr, >= 0 makes sense (integer) */
+ MPG123_FLAGS, /**< set all flags, p.ex val = MPG123_GAPLESS|MPG123_MONO_MIX (integer) */
+ MPG123_ADD_FLAGS, /**< add some flags (integer) */
+ MPG123_FORCE_RATE, /**< when value > 0, force output rate to that value (integer) */
+ MPG123_DOWN_SAMPLE, /**< 0=native rate, 1=half rate, 2=quarter rate (integer) */
+ MPG123_RVA, /**< one of the RVA choices above (integer) */
+ MPG123_DOWNSPEED, /**< play a frame N times (integer) */
+ MPG123_UPSPEED, /**< play every Nth frame (integer) */
+ MPG123_START_FRAME, /**< start with this frame (skip frames before that, integer) */
+ MPG123_DECODE_FRAMES, /**< decode only this number of frames (integer) */
+ MPG123_ICY_INTERVAL, /**< stream contains ICY metadata with this interval (integer) */
+ MPG123_OUTSCALE, /**< the scale for output samples (amplitude - integer or float according to mpg123 output format, normally integer) */
+ MPG123_TIMEOUT, /**< timeout for reading from a stream (not supported on win32, integer) */
+ MPG123_REMOVE_FLAGS, /**< remove some flags (inverse of MPG123_ADD_FLAGS, integer) */
+ MPG123_RESYNC_LIMIT, /**< Try resync on frame parsing for that many bytes or until end of stream (<0 ... integer). This can enlarge the limit for skipping junk on beginning, too (but not reduce it). */
+ MPG123_INDEX_SIZE /**< Set the frame index size (if supported). Values <0 mean that the index is allowed to grow dynamically in these steps (in positive direction, of course) -- Use this when you really want a full index with every individual frame. */
+ ,MPG123_PREFRAMES /**< Decode/ignore that many frames in advance for layer 3. This is needed to fill bit reservoir after seeking, for example (but also at least one frame in advance is needed to have all "normal" data for layer 3). Give a positive integer value, please.*/
+ ,MPG123_FEEDPOOL /**< For feeder mode, keep that many buffers in a pool to avoid frequent malloc/free. The pool is allocated on mpg123_open_feed(). If you change this parameter afterwards, you can trigger growth and shrinkage during decoding. The default value could change any time. If you care about this, then set it. (integer) */
+ ,MPG123_FEEDBUFFER /**< Minimal size of one internal feeder buffer, again, the default value is subject to change. (integer) */
+};
+
+/** Flag bits for MPG123_FLAGS, use the usual binary or to combine. */
+enum mpg123_param_flags
+{
+ MPG123_FORCE_MONO = 0x7 /**< 0111 Force some mono mode: This is a test bitmask for seeing if any mono forcing is active. */
+ ,MPG123_MONO_LEFT = 0x1 /**< 0001 Force playback of left channel only. */
+ ,MPG123_MONO_RIGHT = 0x2 /**< 0010 Force playback of right channel only. */
+ ,MPG123_MONO_MIX = 0x4 /**< 0100 Force playback of mixed mono. */
+ ,MPG123_FORCE_STEREO = 0x8 /**< 1000 Force stereo output. */
+ ,MPG123_FORCE_8BIT = 0x10 /**< 00010000 Force 8bit formats. */
+ ,MPG123_QUIET = 0x20 /**< 00100000 Suppress any printouts (overrules verbose). */
+ ,MPG123_GAPLESS = 0x40 /**< 01000000 Enable gapless decoding (default on if libmpg123 has support). */
+ ,MPG123_NO_RESYNC = 0x80 /**< 10000000 Disable resync stream after error. */
+ ,MPG123_SEEKBUFFER = 0x100 /**< 000100000000 Enable small buffer on non-seekable streams to allow some peek-ahead (for better MPEG sync). */
+ ,MPG123_FUZZY = 0x200 /**< 001000000000 Enable fuzzy seeks (guessing byte offsets or using approximate seek points from Xing TOC) */
+ ,MPG123_FORCE_FLOAT = 0x400 /**< 010000000000 Force floating point output (32 or 64 bits depends on mpg123 internal precision). */
+ ,MPG123_PLAIN_ID3TEXT = 0x800 /**< 100000000000 Do not translate ID3 text data to UTF-8. ID3 strings will contain the raw text data, with the first byte containing the ID3 encoding code. */
+ ,MPG123_IGNORE_STREAMLENGTH = 0x1000 /**< 1000000000000 Ignore any stream length information contained in the stream, which can be contained in a 'TLEN' frame of an ID3v2 tag or a Xing tag */
+ ,MPG123_SKIP_ID3V2 = 0x2000 /**< 10 0000 0000 0000 Do not parse ID3v2 tags, just skip them. */
+ ,MPG123_IGNORE_INFOFRAME = 0x4000 /**< 100 0000 0000 0000 Do not parse the LAME/Xing info frame, treat it as normal MPEG data. */
+ ,MPG123_AUTO_RESAMPLE = 0x8000 /**< 1000 0000 0000 0000 Allow automatic internal resampling of any kind (default on if supported). Especially when going lowlevel with replacing output buffer, you might want to unset this flag. Setting MPG123_DOWNSAMPLE or MPG123_FORCE_RATE will override this. */
+ ,MPG123_PICTURE = 0x10000 /**< 17th bit: Enable storage of pictures from tags (ID3v2 APIC). */
+ ,MPG123_NO_PEEK_END = 0x20000 /**< 18th bit: Do not seek to the end of
+ * the stream in order to probe
+ * the stream length and search for the id3v1 field. This also means
+ * the file size is unknown unless set using mpg123_set_filesize() and
+ * the stream is assumed as non-seekable unless overridden.
+ */
+ ,MPG123_FORCE_SEEKABLE = 0x40000 /**< 19th bit: Force the stream to be seekable. */
+};
+
+/** choices for MPG123_RVA */
+enum mpg123_param_rva
+{
+ MPG123_RVA_OFF = 0 /**< RVA disabled (default). */
+ ,MPG123_RVA_MIX = 1 /**< Use mix/track/radio gain. */
+ ,MPG123_RVA_ALBUM = 2 /**< Use album/audiophile gain */
+ ,MPG123_RVA_MAX = MPG123_RVA_ALBUM /**< The maximum RVA code, may increase in future. */
+};
+
+/** Set a specific parameter, for a specific mpg123_handle, using a parameter
+ * type key chosen from the mpg123_parms enumeration, to the specified value.
+ * \param mh handle
+ * \param type parameter choice
+ * \param value integer value
+ * \param fvalue floating point value
+ * \return MPG123_OK on success
+ */
+MPG123_EXPORT int mpg123_param( mpg123_handle *mh
+, enum mpg123_parms type, long value, double fvalue );
+
+/** Get a specific parameter, for a specific mpg123_handle.
+ * See the mpg123_parms enumeration for a list of available parameters.
+ * \param mh handle
+ * \param type parameter choice
+ * \param value integer value return address
+ * \param fvalue floating point value return address
+ * \return MPG123_OK on success
+ */
+MPG123_EXPORT int mpg123_getparam( mpg123_handle *mh
+, enum mpg123_parms type, long *value, double *fvalue );
+
+/** Feature set available for query with mpg123_feature. */
+enum mpg123_feature_set
+{
+ MPG123_FEATURE_ABI_UTF8OPEN = 0 /**< mpg123 expects path names to be given in UTF-8 encoding instead of plain native. */
+ ,MPG123_FEATURE_OUTPUT_8BIT /**< 8bit output */
+ ,MPG123_FEATURE_OUTPUT_16BIT /**< 16bit output */
+ ,MPG123_FEATURE_OUTPUT_32BIT /**< 32bit output */
+ ,MPG123_FEATURE_INDEX /**< support for building a frame index for accurate seeking */
+ ,MPG123_FEATURE_PARSE_ID3V2 /**< id3v2 parsing */
+ ,MPG123_FEATURE_DECODE_LAYER1 /**< mpeg layer-1 decoder enabled */
+ ,MPG123_FEATURE_DECODE_LAYER2 /**< mpeg layer-2 decoder enabled */
+ ,MPG123_FEATURE_DECODE_LAYER3 /**< mpeg layer-3 decoder enabled */
+ ,MPG123_FEATURE_DECODE_ACCURATE /**< accurate decoder rounding */
+ ,MPG123_FEATURE_DECODE_DOWNSAMPLE /**< downsample (sample omit) */
+ ,MPG123_FEATURE_DECODE_NTOM /**< flexible rate decoding */
+ ,MPG123_FEATURE_PARSE_ICY /**< ICY support */
+ ,MPG123_FEATURE_TIMEOUT_READ /**< Reader with timeout (network). */
+ ,MPG123_FEATURE_EQUALIZER /**< tunable equalizer */
+};
+
+/** Query libmpg123 features.
+ * \param key feature selection
+ * \return 1 for success, 0 for unimplemented functions
+ */
+MPG123_EXPORT int mpg123_feature(const enum mpg123_feature_set key);
+
+/* @} */
+
+
+/** \defgroup mpg123_error mpg123 error handling
+ *
+ * Functions to get text version of the error numbers and an enumeration
+ * of the error codes returned by libmpg123.
+ *
+ * Most functions operating on a mpg123_handle simply return MPG123_OK (0)
+ * on success and MPG123_ERR (-1) on failure, setting the internal error
+ * variable of the handle to the specific error code. If there was not a valid
+ * (non-NULL) handle provided to a function operating on one, MPG123_BAD_HANDLE
+ * may be returned if this can not be confused with a valid positive return
+ * value.
+ * Meaning: A function expected to return positive integers on success will
+ * always indicate error or a special condition by returning a negative one.
+ *
+ * Decoding/seek functions may also return message codes MPG123_DONE,
+ * MPG123_NEW_FORMAT and MPG123_NEED_MORE (all negative, see below on how to
+ * react). Note that calls to those can be nested, so generally watch out
+ * for these codes after initial handle setup.
+ * Especially any function that needs information about the current stream
+ * to work will try to at least parse the beginning if that did not happen
+ * yet.
+ *
+ * On a function that is supposed to return MPG123_OK on success and
+ * MPG123_ERR on failure, make sure you check for != MPG123_OK, not
+ * == MPG123_ERR, as the error code could get more specific in future,
+ * or there is just a special message from a decoding routine as indicated
+ * above.
+ *
+ * @{
+ */
+
+/** Enumeration of the message and error codes and returned by libmpg123 functions. */
+enum mpg123_errors
+{
+ MPG123_DONE=-12, /**< Message: Track ended. Stop decoding. */
+ MPG123_NEW_FORMAT=-11, /**< Message: Output format will be different on next call. Note that some libmpg123 versions between 1.4.3 and 1.8.0 insist on you calling mpg123_getformat() after getting this message code. Newer verisons behave like advertised: You have the chance to call mpg123_getformat(), but you can also just continue decoding and get your data. */
+ MPG123_NEED_MORE=-10, /**< Message: For feed reader: "Feed me more!" (call mpg123_feed() or mpg123_decode() with some new input data). */
+ MPG123_ERR=-1, /**< Generic Error */
+ MPG123_OK=0, /**< Success */
+ MPG123_BAD_OUTFORMAT, /**< Unable to set up output format! */
+ MPG123_BAD_CHANNEL, /**< Invalid channel number specified. */
+ MPG123_BAD_RATE, /**< Invalid sample rate specified. */
+ MPG123_ERR_16TO8TABLE, /**< Unable to allocate memory for 16 to 8 converter table! */
+ MPG123_BAD_PARAM, /**< Bad parameter id! */
+ MPG123_BAD_BUFFER, /**< Bad buffer given -- invalid pointer or too small size. */
+ MPG123_OUT_OF_MEM, /**< Out of memory -- some malloc() failed. */
+ MPG123_NOT_INITIALIZED, /**< You didn't initialize the library! */
+ MPG123_BAD_DECODER, /**< Invalid decoder choice. */
+ MPG123_BAD_HANDLE, /**< Invalid mpg123 handle. */
+ MPG123_NO_BUFFERS, /**< Unable to initialize frame buffers (out of memory?). */
+ MPG123_BAD_RVA, /**< Invalid RVA mode. */
+ MPG123_NO_GAPLESS, /**< This build doesn't support gapless decoding. */
+ MPG123_NO_SPACE, /**< Not enough buffer space. */
+ MPG123_BAD_TYPES, /**< Incompatible numeric data types. */
+ MPG123_BAD_BAND, /**< Bad equalizer band. */
+ MPG123_ERR_NULL, /**< Null pointer given where valid storage address needed. */
+ MPG123_ERR_READER, /**< Error reading the stream. */
+ MPG123_NO_SEEK_FROM_END,/**< Cannot seek from end (end is not known). */
+ MPG123_BAD_WHENCE, /**< Invalid 'whence' for seek function.*/
+ MPG123_NO_TIMEOUT, /**< Build does not support stream timeouts. */
+ MPG123_BAD_FILE, /**< File access error. */
+ MPG123_NO_SEEK, /**< Seek not supported by stream. */
+ MPG123_NO_READER, /**< No stream opened. */
+ MPG123_BAD_PARS, /**< Bad parameter handle. */
+ MPG123_BAD_INDEX_PAR, /**< Bad parameters to mpg123_index() and mpg123_set_index() */
+ MPG123_OUT_OF_SYNC, /**< Lost track in bytestream and did not try to resync. */
+ MPG123_RESYNC_FAIL, /**< Resync failed to find valid MPEG data. */
+ MPG123_NO_8BIT, /**< No 8bit encoding possible. */
+ MPG123_BAD_ALIGN, /**< Stack aligmnent error */
+ MPG123_NULL_BUFFER, /**< NULL input buffer with non-zero size... */
+ MPG123_NO_RELSEEK, /**< Relative seek not possible (screwed up file offset) */
+ MPG123_NULL_POINTER, /**< You gave a null pointer somewhere where you shouldn't have. */
+ MPG123_BAD_KEY, /**< Bad key value given. */
+ MPG123_NO_INDEX, /**< No frame index in this build. */
+ MPG123_INDEX_FAIL, /**< Something with frame index went wrong. */
+ MPG123_BAD_DECODER_SETUP, /**< Something prevents a proper decoder setup */
+ MPG123_MISSING_FEATURE /**< This feature has not been built into libmpg123. */
+ ,MPG123_BAD_VALUE /**< A bad value has been given, somewhere. */
+ ,MPG123_LSEEK_FAILED /**< Low-level seek failed. */
+ ,MPG123_BAD_CUSTOM_IO /**< Custom I/O not prepared. */
+ ,MPG123_LFS_OVERFLOW /**< Offset value overflow during translation of large file API calls -- your client program cannot handle that large file. */
+ ,MPG123_INT_OVERFLOW /**< Some integer overflow. */
+};
+
+/** Look up error strings given integer code.
+ * \param errcode integer error code
+ * \return string describing what that error error code means
+ */
+MPG123_EXPORT const char* mpg123_plain_strerror(int errcode);
+
+/** Give string describing what error has occured in the context of handle mh.
+ * When a function operating on an mpg123 handle returns MPG123_ERR, you should check for the actual reason via
+ * char *errmsg = mpg123_strerror(mh)
+ * This function will catch mh == NULL and return the message for MPG123_BAD_HANDLE.
+ * \param mh handle
+ * \return error message
+ */
+MPG123_EXPORT const char* mpg123_strerror(mpg123_handle *mh);
+
+/** Return the plain errcode intead of a string.
+ * \param mh handle
+ * \return error code recorded in handle or MPG123_BAD_HANDLE
+ */
+MPG123_EXPORT int mpg123_errcode(mpg123_handle *mh);
+
+/*@}*/
+
+
+/** \defgroup mpg123_decoder mpg123 decoder selection
+ *
+ * Functions to list and select the available decoders.
+ * Perhaps the most prominent feature of mpg123: You have several (optimized) decoders to choose from (on x86 and PPC (MacOS) systems, that is).
+ *
+ * @{
+ */
+
+/** Get available decoder list.
+ * \return NULL-terminated array of generally available decoder names (plain 8bit ASCII)
+ */
+MPG123_EXPORT const char **mpg123_decoders(void);
+
+/** Get supported decoder list.
+ * \return NULL-terminated array of the decoders supported by the CPU (plain 8bit ASCII)
+ */
+MPG123_EXPORT const char **mpg123_supported_decoders(void);
+
+/** Set the active decoder.
+ * \param mh handle
+ * \param decoder_name name of decoder
+ * \return MPG123_OK on success
+ */
+MPG123_EXPORT int mpg123_decoder(mpg123_handle *mh, const char* decoder_name);
+
+/** Get the currently active decoder name.
+ * The active decoder engine can vary depening on output constraints,
+ * mostly non-resampling, integer output is accelerated via 3DNow & Co. but for
+ * other modes a fallback engine kicks in.
+ * Note that this can return a decoder that is only active in the hidden and not
+ * available as decoder choice from the outside.
+ * \param mh handle
+ * \return The decoder name or NULL on error.
+ */
+MPG123_EXPORT const char* mpg123_current_decoder(mpg123_handle *mh);
+
+/*@}*/
+
+
+/** \defgroup mpg123_output mpg123 output audio format
+ *
+ * Functions to get and select the format of the decoded audio.
+ *
+ * Before you dive in, please be warned that you might get confused by this. This seems to happen a lot, therefore I am trying to explain in advance.
+ *
+ * The mpg123 library decides what output format to use when encountering the first frame in a stream, or actually any frame that is still valid but differs from the frames before in the prompted output format. At such a deciding point, an internal table of allowed encodings, sampling rates and channel setups is consulted. According to this table, an output format is chosen and the decoding engine set up accordingly (including optimized routines for different output formats). This might seem unusual but it just follows from the non-existence of "MPEG audio files" with defined overall properties. There are streams, streams are concatenations of (semi) independent frames. We store streams on disk and call them "MPEG audio files", but that does not change their nature as the decoder is concerned (the LAME/Xing header for gapless decoding makes things interesting again).
+ *
+ * To get to the point: What you do with mpg123_format() and friends is to fill the internal table of allowed formats before it is used. That includes removing support for some formats or adding your forced sample rate (see MPG123_FORCE_RATE) that will be used with the crude internal resampler. Also keep in mind that the sample encoding is just a question of choice -- the MPEG frames do only indicate their native sampling rate and channel count. If you want to decode to integer or float samples, 8 or 16 bit ... that is your decision. In a "clean" world, libmpg123 would always decode to 32 bit float and let you handle any sample conversion. But there are optimized routines that work faster by directly decoding to the desired encoding / accuracy. We prefer efficiency over conceptual tidyness.
+ *
+ * People often start out thinking that mpg123_format() should change the actual decoding format on the fly. That is wrong. It only has effect on the next natural change of output format, when libmpg123 will consult its format table again. To make life easier, you might want to call mpg123_format_none() before any thing else and then just allow one desired encoding and a limited set of sample rates / channel choices that you actually intend to deal with. You can force libmpg123 to decode everything to 44100 KHz, stereo, 16 bit integer ... it will duplicate mono channels and even do resampling if needed (unless that feature is disabled in the build, same with some encodings). But I have to stress that the resampling of libmpg123 is very crude and doesn't even contain any kind of "proper" interpolation.
+ *
+ * In any case, watch out for MPG123_NEW_FORMAT as return message from decoding routines and call mpg123_getformat() to get the currently active output format.
+ *
+ * @{
+ */
+
+/** They can be combined into one number (3) to indicate mono and stereo... */
+enum mpg123_channelcount
+{
+ MPG123_MONO = 1 /**< mono */
+ ,MPG123_STEREO = 2 /**< stereo */
+};
+
+/** An array of supported standard sample rates
+ * These are possible native sample rates of MPEG audio files.
+ * You can still force mpg123 to resample to a different one, but by default you will only get audio in one of these samplings.
+ * \param list Store a pointer to the sample rates array there.
+ * \param number Store the number of sample rates there. */
+MPG123_EXPORT void mpg123_rates(const long **list, size_t *number);
+
+/** An array of supported audio encodings.
+ * An audio encoding is one of the fully qualified members of mpg123_enc_enum (MPG123_ENC_SIGNED_16, not MPG123_SIGNED).
+ * \param list Store a pointer to the encodings array there.
+ * \param number Store the number of encodings there. */
+MPG123_EXPORT void mpg123_encodings(const int **list, size_t *number);
+
+/** Return the size (in bytes) of one mono sample of the named encoding.
+ * \param encoding The encoding value to analyze.
+ * \return positive size of encoding in bytes, 0 on invalid encoding. */
+MPG123_EXPORT int mpg123_encsize(int encoding);
+
+/** Configure a mpg123 handle to accept no output format at all,
+ * use before specifying supported formats with mpg123_format
+ * \param mh handle
+ * \return MPG123_OK on success
+ */
+MPG123_EXPORT int mpg123_format_none(mpg123_handle *mh);
+
+/** Configure mpg123 handle to accept all formats
+ * (also any custom rate you may set) -- this is default.
+ * \param mh handle
+ * \return MPG123_OK on success
+ */
+MPG123_EXPORT int mpg123_format_all(mpg123_handle *mh);
+
+/** Set the audio format support of a mpg123_handle in detail:
+ * \param mh handle
+ * \param rate The sample rate value (in Hertz).
+ * \param channels A combination of MPG123_STEREO and MPG123_MONO.
+ * \param encodings A combination of accepted encodings for rate and channels, p.ex MPG123_ENC_SIGNED16 | MPG123_ENC_ULAW_8 (or 0 for no support). Please note that some encodings may not be supported in the library build and thus will be ignored here.
+ * \return MPG123_OK on success, MPG123_ERR if there was an error. */
+MPG123_EXPORT int mpg123_format( mpg123_handle *mh
+, long rate, int channels, int encodings );
+
+/** Check to see if a specific format at a specific rate is supported
+ * by mpg123_handle.
+ * \param mh handle
+ * \param rate sampling rate
+ * \param encoding encoding
+ * \return 0 for no support (that includes invalid parameters), MPG123_STEREO,
+ * MPG123_MONO or MPG123_STEREO|MPG123_MONO. */
+MPG123_EXPORT int mpg123_format_support( mpg123_handle *mh
+, long rate, int encoding );
+
+/** Get the current output format written to the addresses given.
+ * If the stream is freshly loaded, this will try to parse enough
+ * of it to give you the format to come. This clears the flag that
+ * would otherwise make the first decoding call return
+ * MPG123_NEW_FORMAT.
+ * \param mh handle
+ * \param rate sampling rate return address
+ * \param channels channel count return address
+ * \param encoding encoding return address
+ * \return MPG123_OK on success
+ */
+MPG123_EXPORT int mpg123_getformat( mpg123_handle *mh
+, long *rate, int *channels, int *encoding );
+
+/** Get the current output format written to the addresses given.
+ * This differs from plain mpg123_getformat() in that you can choose
+ * _not_ to clear the flag that would trigger the next decoding call
+ * to return MPG123_NEW_FORMAT in case of a new format arriving.
+ * \param mh handle
+ * \param rate sampling rate return address