get_audio.c File Reference

#include <config.h>
#include <assert.h>
#include <stdio.h>
#include <math.h>
#include <sys/stat.h>
#include "lame.h"
#include "main.h"
#include "get_audio.h"
#include "portableio.h"
#include "timestatus.h"
#include "lametime.h"
#include "console.h"

Include dependency graph for get_audio.c:

Go to the source code of this file.

Defines

#define strchr   index
#define strrchr   rindex
#define memcpy(d, s, n)   bcopy ((s), (d), (n))
#define memmove(d, s, n)   bcopy ((s), (d), (n))
#define MAX_U_32_NUM   0xFFFFFFFF
#define GA_URS_IFLOOP(ga_urs_bps)
#define IFF_ID_FORM   0x464f524d
#define IFF_ID_AIFF   0x41494646
#define IFF_ID_AIFC   0x41494643
#define IFF_ID_COMM   0x434f4d4d
#define IFF_ID_SSND   0x53534e44
#define IFF_ID_MPEG   0x4d504547
#define IFF_ID_NONE   0x4e4f4e45 /* "NONE" */
#define IFF_ID_2CBE   0x74776f73 /* "twos" */
#define IFF_ID_2CLE   0x736f7774 /* "sowt" */
#define WAV_ID_RIFF   0x52494646
#define WAV_ID_WAVE   0x57415645
#define WAV_ID_FMT   0x666d7420
#define WAV_ID_DATA   0x64617461

Functions

char * strchr ()
char ** strrchr ()
int lame_decode_initfile (FILE *fd, mp3data_struct *mp3data, int *enc_delay, int *enc_padding)
int lame_decode_fromfile (FILE *fd, short int pcm_l[], short int pcm_r[], mp3data_struct *mp3data)
static int read_samples_pcm (FILE *musicin, int sample_buffer[2304], int frame_size, int samples_to_read)
static int read_samples_mp3 (lame_global_flags *const gfp, FILE *const musicin, short int mpg123pcm[2][1152], int num_chan)
void CloseSndFile (sound_file_format input, FILE *musicin)
FILE * OpenSndFile (lame_global_flags *gfp, char *, int *enc_delay, int *enc_padding)
static int fskip (FILE *fp, long offset, int whence)
FILE * init_outfile (char *outPath, int decode)
void init_infile (lame_global_flags *gfp, char *inPath, int *enc_delay, int *enc_padding)
void close_infile (void)
void SwapBytesInWords (short *ptr, int short_words)
static int get_audio_common (lame_global_flags *const gfp, int buffer[2][1152], short buffer16[2][1152])
int get_audio (lame_global_flags *const gfp, int buffer[2][1152])
int get_audio16 (lame_global_flags *const gfp, short buffer[2][1152])
int WriteWaveHeader (FILE *const fp, const int pcmbytes, const int freq, const int channels, const int bits)
static int unpack_read_samples (const int samples_to_read, const int bytes_per_sample, const int swap_order, int *sample_buffer, FILE *pcm_in)
static int parse_wave_header (lame_global_flags *gfp, FILE *sf)
int aiff_check2 (IFF_AIFF *const pcm_aiff_data)
static int parse_aiff_header (lame_global_flags *gfp, FILE *sf)
void parse_file_header (lame_global_flags *gfp, FILE *sf)

Variables

int count_samples_carefully
int pcmbitwidth
int pcmswapbytes = 0
unsigned int num_samples_read
FILE * musicin


Define Documentation

#define GA_URS_IFLOOP ( ga_urs_bps   ) 

Value:

if( bytes_per_sample == ga_urs_bps ) \
        for( i = samples_read * bytes_per_sample; (i -= bytes_per_sample) >=0;)

Referenced by unpack_read_samples().

#define IFF_ID_2CBE   0x74776f73 /* "twos" */

Definition at line 1021 of file get_audio.c.

Referenced by parse_aiff_header().

#define IFF_ID_2CLE   0x736f7774 /* "sowt" */

Definition at line 1022 of file get_audio.c.

Referenced by parse_aiff_header().

#define IFF_ID_AIFC   0x41494643

Definition at line 1015 of file get_audio.c.

Referenced by parse_aiff_header().

#define IFF_ID_AIFF   0x41494646

Definition at line 1014 of file get_audio.c.

Referenced by parse_aiff_header().

#define IFF_ID_COMM   0x434f4d4d

Definition at line 1016 of file get_audio.c.

Referenced by parse_aiff_header().

#define IFF_ID_FORM   0x464f524d

Definition at line 1013 of file get_audio.c.

Referenced by parse_file_header().

#define IFF_ID_MPEG   0x4d504547

Definition at line 1018 of file get_audio.c.

#define IFF_ID_NONE   0x4e4f4e45 /* "NONE" */

Definition at line 1020 of file get_audio.c.

Referenced by parse_aiff_header().

#define IFF_ID_SSND   0x53534e44

Definition at line 1017 of file get_audio.c.

Referenced by aiff_check2(), and parse_aiff_header().

#define MAX_U_32_NUM   0xFFFFFFFF

Definition at line 53 of file get_audio.c.

#define memcpy ( d,
s,
 )     bcopy ((s), (d), (n))

Definition at line 47 of file get_audio.c.

#define memmove ( d,
s,
 )     bcopy ((s), (d), (n))

Definition at line 48 of file get_audio.c.

#define strchr   index

Definition at line 42 of file get_audio.c.

#define strrchr   rindex

Definition at line 43 of file get_audio.c.

#define WAV_ID_DATA   0x64617461

Definition at line 1027 of file get_audio.c.

Referenced by parse_wave_header().

#define WAV_ID_FMT   0x666d7420

Definition at line 1026 of file get_audio.c.

Referenced by parse_wave_header().

#define WAV_ID_RIFF   0x52494646

Definition at line 1024 of file get_audio.c.

Referenced by parse_file_header().

#define WAV_ID_WAVE   0x57415645

Definition at line 1025 of file get_audio.c.

Referenced by parse_wave_header().


Function Documentation

int aiff_check2 ( IFF_AIFF *const  pcm_aiff_data  ) 

Definition at line 1137 of file get_audio.c.

References IFF_AIFF_struct::blkAlgn, blockAlign_struct::blockSize, error_printf(), IFF_ID_SSND, IFF_AIFF_struct::numChannels, IFF_AIFF_struct::sampleSize, IFF_AIFF_struct::sampleType, and silent.

Referenced by parse_aiff_header().

Here is the call graph for this function:

void close_infile ( void   ) 

Definition at line 226 of file get_audio.c.

References CloseSndFile(), input_format, and musicin.

Referenced by main().

Here is the call graph for this function:

void CloseSndFile ( sound_file_format  input,
FILE *  musicin 
)

Definition at line 1344 of file get_audio.c.

References error_printf(), and silent.

Referenced by close_infile().

Here is the call graph for this function:

static int fskip ( FILE *  fp,
long  offset,
int  whence 
) [static]

Definition at line 108 of file get_audio.c.

References error_printf(), Min, and silent.

Referenced by parse_aiff_header(), and parse_wave_header().

Here is the call graph for this function:

int get_audio ( lame_global_flags *const  gfp,
int  buffer[2][1152] 
)

Definition at line 300 of file get_audio.c.

References get_audio_common(), and gfp.

Referenced by lame_encoder(), and main().

Here is the call graph for this function:

int get_audio16 ( lame_global_flags *const  gfp,
short  buffer[2][1152] 
)

Definition at line 310 of file get_audio.c.

References get_audio_common(), and gfp.

Referenced by gtkmakeframe(), and lame_decoder().

Here is the call graph for this function:

static int get_audio_common ( lame_global_flags *const  gfp,
int  buffer[2][1152],
short  buffer16[2][1152] 
) [static]

Definition at line 325 of file get_audio.c.

References count_samples_carefully, gfp, i, input_format, is_mpeg_file_format(), lame_get_framesize(), lame_get_num_channels(), lame_get_num_samples(), MAX_U_32_NUM, Min, musicin, num_samples_read, read_samples_mp3(), and read_samples_pcm().

Referenced by get_audio(), and get_audio16().

Here is the call graph for this function:

void init_infile ( lame_global_flags gfp,
char *  inPath,
int *  enc_delay,
int *  enc_padding 
)

Definition at line 215 of file get_audio.c.

References count_samples_carefully, gfp, in_bitwidth, musicin, num_samples_read, OpenSndFile(), pcmbitwidth, pcmswapbytes, and swapbytes.

Referenced by init_files(), and main().

Here is the call graph for this function:

FILE* init_outfile ( char *  outPath,
int  decode 
)

Definition at line 178 of file get_audio.c.

References lame_set_stream_binary_mode().

Referenced by init_files().

Here is the call graph for this function:

int lame_decode_fromfile ( FILE *  fd,
short int  pcm_l[],
short int  pcm_r[],
mp3data_struct mp3data 
)

Referenced by read_samples_mp3().

int lame_decode_initfile ( FILE *  fd,
mp3data_struct mp3data,
int *  enc_delay,
int *  enc_padding 
)

Referenced by OpenSndFile().

FILE * OpenSndFile ( lame_global_flags gfp,
char *  ,
int *  enc_delay,
int *  enc_padding 
)

Definition at line 1359 of file get_audio.c.

References mp3data_struct::bitrate, console_printf(), error_printf(), gfp, input_format, is_mpeg_file_format(), lame_decode_initfile(), lame_get_file_size(), lame_get_in_samplerate(), lame_get_num_channels(), lame_get_num_samples(), lame_set_in_samplerate(), lame_set_num_channels(), lame_set_num_samples(), lame_set_stream_binary_mode(), MAX_U_32_NUM, mp3input_data, mp3data_struct::nsamp, parse_file_header(), pcmswapbytes, mp3data_struct::samplerate, sf_ogg, sf_raw, sf_unknown, silent, mp3data_struct::stereo, and swapbytes.

Referenced by init_infile().

Here is the call graph for this function:

static int parse_aiff_header ( lame_global_flags gfp,
FILE *  sf 
) [static]

Definition at line 1183 of file get_audio.c.

References aiff_check2(), error_printf(), fskip(), gfp, IFF_ID_2CBE, IFF_ID_2CLE, IFF_ID_AIFC, IFF_ID_AIFF, IFF_ID_COMM, IFF_ID_NONE, IFF_ID_SSND, lame_set_in_samplerate(), lame_set_num_channels(), lame_set_num_samples(), pcmbitwidth, pcmswapbytes, Read16BitsHighLow(), Read32BitsHighLow(), ReadIeeeExtendedHighLow(), silent, and swapbytes.

Referenced by parse_file_header().

Here is the call graph for this function:

void parse_file_header ( lame_global_flags gfp,
FILE *  sf 
)

Definition at line 1295 of file get_audio.c.

References count_samples_carefully, error_printf(), gfp, IFF_ID_FORM, input_format, parse_aiff_header(), parse_wave_header(), Read32BitsHighLow(), sf_aiff, sf_raw, sf_wave, silent, and WAV_ID_RIFF.

Referenced by OpenSndFile().

Here is the call graph for this function:

static int parse_wave_header ( lame_global_flags gfp,
FILE *  sf 
) [static]

Definition at line 1042 of file get_audio.c.

References error_printf(), fskip(), gfp, lame_set_in_samplerate(), lame_set_num_channels(), lame_set_num_samples(), pcmbitwidth, Read16BitsLowHigh(), Read32BitsHighLow(), Read32BitsLowHigh, silent, WAV_ID_DATA, WAV_ID_FMT, and WAV_ID_WAVE.

Referenced by parse_file_header().

Here is the call graph for this function:

int read_samples_mp3 ( lame_global_flags *const  gfp,
FILE *const   musicin,
short int  mpg123pcm[2][1152],
int  num_chan 
) [static]

Definition at line 446 of file get_audio.c.

References error_printf(), gfp, lame_decode_fromfile(), lame_get_in_samplerate(), lame_get_num_channels(), mp3input_data, mp3data_struct::samplerate, silent, and mp3data_struct::stereo.

Referenced by get_audio_common().

Here is the call graph for this function:

int read_samples_pcm ( FILE *  musicin,
int  sample_buffer[2304],
int  frame_size,
int  samples_to_read 
) [static]

Definition at line 963 of file get_audio.c.

References error_printf(), in_endian, input_format, order_bigEndian, order_littleEndian, order_unknown, pcmbitwidth, pcmswapbytes, sf_wave, silent, and unpack_read_samples().

Referenced by get_audio_common().

Here is the call graph for this function:

char* strchr (  ) 

char* * strrchr (  ) 

void SwapBytesInWords ( short *  ptr,
int  short_words 
)

Definition at line 233 of file get_audio.c.

static int unpack_read_samples ( const int  samples_to_read,
const int  bytes_per_sample,
const int  swap_order,
int *  sample_buffer,
FILE *  pcm_in 
) [static]

Definition at line 905 of file get_audio.c.

References GA_URS_IFLOOP, and i.

Referenced by read_samples_pcm().

int WriteWaveHeader ( FILE *const   fp,
const int  pcmbytes,
const int  freq,
const int  channels,
const int  bits 
)

Definition at line 485 of file get_audio.c.

References Write16BitsLowHigh(), and Write32BitsLowHigh().

Referenced by lame_decoder().

Here is the call graph for this function:


Variable Documentation

int count_samples_carefully

Definition at line 78 of file get_audio.c.

Referenced by get_audio_common(), init_infile(), and parse_file_header().

FILE* musicin

Definition at line 82 of file get_audio.c.

Referenced by close_infile(), get_audio_common(), and init_infile().

unsigned int num_samples_read

Definition at line 81 of file get_audio.c.

Referenced by get_audio_common(), and init_infile().

int pcmbitwidth

Definition at line 79 of file get_audio.c.

Referenced by init_infile(), parse_aiff_header(), parse_wave_header(), and read_samples_pcm().

int pcmswapbytes = 0

Definition at line 80 of file get_audio.c.

Referenced by init_infile(), OpenSndFile(), parse_aiff_header(), and read_samples_pcm().


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