xref: /third_party/lame/frontend/get_audio.h (revision 159b3361)
1159b3361Sopenharmony_ci/*
2159b3361Sopenharmony_ci *    Get Audio routines include file
3159b3361Sopenharmony_ci *
4159b3361Sopenharmony_ci *    Copyright (c) 1999 Albert L Faber
5159b3361Sopenharmony_ci *                  2010 Robert Hegemann
6159b3361Sopenharmony_ci *
7159b3361Sopenharmony_ci * This library is free software; you can redistribute it and/or
8159b3361Sopenharmony_ci * modify it under the terms of the GNU Library General Public
9159b3361Sopenharmony_ci * License as published by the Free Software Foundation; either
10159b3361Sopenharmony_ci * version 2 of the License, or (at your option) any later version.
11159b3361Sopenharmony_ci *
12159b3361Sopenharmony_ci * This library is distributed in the hope that it will be useful,
13159b3361Sopenharmony_ci * but WITHOUT ANY WARRANTY; without even the implied warranty of
14159b3361Sopenharmony_ci * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15159b3361Sopenharmony_ci * Library General Public License for more details.
16159b3361Sopenharmony_ci *
17159b3361Sopenharmony_ci * You should have received a copy of the GNU Library General Public
18159b3361Sopenharmony_ci * License along with this library; if not, write to the
19159b3361Sopenharmony_ci * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20159b3361Sopenharmony_ci * Boston, MA 02111-1307, USA.
21159b3361Sopenharmony_ci */
22159b3361Sopenharmony_ci
23159b3361Sopenharmony_ci
24159b3361Sopenharmony_ci#ifndef LAME_GET_AUDIO_H
25159b3361Sopenharmony_ci#define LAME_GET_AUDIO_H
26159b3361Sopenharmony_ci#include "lame.h"
27159b3361Sopenharmony_ci#include <stdio.h>
28159b3361Sopenharmony_ci
29159b3361Sopenharmony_ci#ifdef __cplusplus
30159b3361Sopenharmony_ciextern "C" {
31159b3361Sopenharmony_ci#endif
32159b3361Sopenharmony_ci
33159b3361Sopenharmony_citypedef enum sound_file_format_e {
34159b3361Sopenharmony_ci    sf_unknown,
35159b3361Sopenharmony_ci    sf_raw,
36159b3361Sopenharmony_ci    sf_wave,
37159b3361Sopenharmony_ci    sf_aiff,
38159b3361Sopenharmony_ci    sf_mp1,                  /* MPEG Layer 1, aka mpg */
39159b3361Sopenharmony_ci    sf_mp2,                  /* MPEG Layer 2 */
40159b3361Sopenharmony_ci    sf_mp3,                  /* MPEG Layer 3 */
41159b3361Sopenharmony_ci    sf_mp123,                /* MPEG Layer 1,2 or 3; whatever .mp3, .mp2, .mp1 or .mpg contains */
42159b3361Sopenharmony_ci    sf_ogg
43159b3361Sopenharmony_ci} sound_file_format;
44159b3361Sopenharmony_ci
45159b3361Sopenharmony_ciint     is_mpeg_file_format( int input_file_format );
46159b3361Sopenharmony_ci
47159b3361Sopenharmony_ciint     init_infile(lame_t gfp, char const * inPath);
48159b3361Sopenharmony_ciint     samples_to_skip_at_start(void);
49159b3361Sopenharmony_ciint     samples_to_skip_at_end(void);
50159b3361Sopenharmony_civoid    close_infile(void);
51159b3361Sopenharmony_ciint     get_audio(lame_t gfp, int buffer[2][1152]);
52159b3361Sopenharmony_ciint     get_audio16(lame_t gfp, short buffer[2][1152]);
53159b3361Sopenharmony_ciint     get_audio_float(lame_t gfp, float buffer[2][1152]);
54159b3361Sopenharmony_ciint     get_audio_double(lame_t gfp, double buffer[2][1152]);
55159b3361Sopenharmony_cihip_t   get_hip(void);
56159b3361Sopenharmony_ci
57159b3361Sopenharmony_ciFILE   *init_outfile(char const *outPath, int decode);
58159b3361Sopenharmony_ciint     WriteWaveHeader(FILE * const fp, int pcmbytes, int freq, int channels, int bits);
59159b3361Sopenharmony_civoid    put_audio16(FILE* outf, short Buffer[2][1152], int iread, int nch);
60159b3361Sopenharmony_ci
61159b3361Sopenharmony_ci/*
62159b3361Sopenharmony_cistruct AudioReader;
63159b3361Sopenharmony_citypedef struct AudioReader* AudioReader;
64159b3361Sopenharmony_ci
65159b3361Sopenharmony_ciAudioReader ar_open(lame_t gfp, char const* inPath);
66159b3361Sopenharmony_ciint     ar_samplesToSkipAtStart(AudioReader ar);
67159b3361Sopenharmony_ciint     ar_samplesToSkipAtEnd(AudioReader ar);
68159b3361Sopenharmony_civoid    ar_close(AudioReader ar);
69159b3361Sopenharmony_ciint     ar_readInt(AudioReader ar, lame_t gfp, int buffer[2][1152]);
70159b3361Sopenharmony_ciint     ar_readShort(AudioReader ar, lame_t gfp, short buffer[2][1152]);
71159b3361Sopenharmony_ciint     ar_readFloat(AudioReader ar, lame_t gfp, float buffer[2][1152]);
72159b3361Sopenharmony_ci
73159b3361Sopenharmony_cistruct AudioWriter;
74159b3361Sopenharmony_citypedef struct AudioWriter* AudioWriter;
75159b3361Sopenharmony_ci
76159b3361Sopenharmony_ciAudioWriter aw_open(lame_t gfp, char const* outPath, int pcmbystes, int freq, int channels, int bits);
77159b3361Sopenharmony_ciint     aw_writeWaveHeader(AudioWriter aw);
78159b3361Sopenharmony_ciint     aw_write(AudioWriter aw, short buffer[2][1152], int n);
79159b3361Sopenharmony_ciint     aw_write(AudioWriter aw, float buffer[2][1152], int n);
80159b3361Sopenharmony_ci
81159b3361Sopenharmony_ci*/
82159b3361Sopenharmony_ci
83159b3361Sopenharmony_ciextern size_t sizeOfOldTag(lame_t gf);
84159b3361Sopenharmony_ciextern unsigned char* getOldTag(lame_t gf);
85159b3361Sopenharmony_ci
86159b3361Sopenharmony_ci#ifdef __cplusplus
87159b3361Sopenharmony_ci}
88159b3361Sopenharmony_ci#endif
89159b3361Sopenharmony_ci
90159b3361Sopenharmony_ci#endif /* ifndef LAME_GET_AUDIO_H */
91