get_audio.h

Go to the documentation of this file.
00001 /*
00002  *      Get Audio routines include file
00003  *
00004  *      Copyright (c) 1999 Albert L Faber
00005  *
00006  * This library is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU Lesser General Public
00008  * License as published by the Free Software Foundation; either
00009  * version 2 of the License, or (at your option) any later version.
00010  *
00011  * This library is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014  * Library General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU Lesser General Public
00017  * License along with this library; if not, write to the
00018  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00019  * Boston, MA 02111-1307, USA.
00020  */
00021 
00022 
00023 #ifndef LAME_GET_AUDIO_H
00024 #define LAME_GET_AUDIO_H
00025 #include "lame.h"
00026 #include <stdio.h>
00027 
00028 typedef enum sound_file_format_e {
00029     sf_unknown,
00030     sf_raw,
00031     sf_wave,
00032     sf_aiff,
00033     sf_mp1,                  /* MPEG Layer 1, aka mpg */
00034     sf_mp2,                  /* MPEG Layer 2 */
00035     sf_mp3,                  /* MPEG Layer 3 */
00036     sf_mp123,                /* MPEG Layer 1,2 or 3; whatever .mp3, .mp2, .mp1 or .mpg contains */
00037     sf_ogg
00038 } sound_file_format;
00039 
00040 static int is_mpeg_file_format( int input_format )
00041 {
00042   switch ( input_format ) {
00043   case sf_mp1: return 1;
00044   case sf_mp2: return 2;
00045   case sf_mp3: return 3;
00046   case sf_mp123: return -1;
00047   default: break;
00048   }
00049   return 0;
00050 }
00051 
00052 
00053 
00054 FILE   *init_outfile(char *outPath, int decode);
00055 void    init_infile(lame_global_flags *, char *inPath, int *enc_delay, int *enc_padding);
00056 void    close_infile(void);
00057 int     get_audio(lame_global_flags * const gfp, int buffer[2][1152]);
00058 int     get_audio16(lame_global_flags * const gfp, short buffer[2][1152]);
00059 int     WriteWaveHeader(FILE * const fp, const int pcmbytes,
00060                         const int freq, const int channels, const int bits);
00061 
00062 
00063 
00064 /* the simple lame decoder */
00065 /* After calling lame_init(), lame_init_params() and
00066  * init_infile(), call this routine to read the input MP3 file 
00067  * and output .wav data to the specified file pointer
00068  * lame_decoder will ignore the first 528 samples, since these samples
00069  * represent the mpglib decoding delay (and are all 0).  
00070  *skip = number of additional
00071  * samples to skip, to (for example) compensate for the encoder delay,
00072  * only used when decoding mp3 
00073 */
00074 int     lame_decoder(lame_global_flags * gfp, FILE * outf, int skip, char *inPath, char *outPath,
00075                      int *enc_delay, int *enc_padding);
00076 
00077 
00078 
00079 void    SwapBytesInWords(short *loc, int words);
00080 
00081 
00082 
00083 #ifdef LIBSNDFILE
00084 
00085 #include "sndfile.h"
00086 
00087 
00088 #else
00089 /*****************************************************************
00090  * LAME/ISO built in audio file I/O routines 
00091  *******************************************************************/
00092 #include "portableio.h"
00093 
00094 
00095 typedef struct blockAlign_struct {
00096     unsigned long offset;
00097     unsigned long blockSize;
00098 } blockAlign;
00099 
00100 typedef struct IFF_AIFF_struct {
00101     short   numChannels;
00102     unsigned long numSampleFrames;
00103     short   sampleSize;
00104     double  sampleRate;
00105     unsigned long sampleType;
00106     blockAlign blkAlgn;
00107 } IFF_AIFF;
00108 
00109 extern int aiff_read_headers(FILE *, IFF_AIFF *);
00110 extern int aiff_seek_to_sound_data(FILE *);
00111 extern int aiff_write_headers(FILE *, IFF_AIFF *);
00112 extern int parse_wavheader(void);
00113 extern int parse_aiff(const char fn[]);
00114 extern void aiff_check(const char *, IFF_AIFF *, int *);
00115 
00116 
00117 
00118 #endif /* ifdef LIBSNDFILE */
00119 #endif /* ifndef LAME_GET_AUDIO_H */

Generated on Sun Dec 2 11:34:17 2007 for LAME by  doxygen 1.5.2