lame.h | lame.h | |||
---|---|---|---|---|
skipping to change at line 22 | skipping to change at line 22 | |||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |||
* Library General Public License for more details. | * Library General Public License for more details. | |||
* | * | |||
* You should have received a copy of the GNU Lesser General Public | * You should have received a copy of the GNU Lesser General Public | |||
* License along with this library; if not, write to the | * License along with this library; if not, write to the | |||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330, | * Free Software Foundation, Inc., 59 Temple Place - Suite 330, | |||
* Boston, MA 02111-1307, USA. | * Boston, MA 02111-1307, USA. | |||
*/ | */ | |||
/* $Id: lame.h,v 1.170.2.4 2009/01/18 15:44:28 robert Exp $ */ | /* $Id: lame.h,v 1.170 2008/04/12 18:18:06 robert Exp $ */ | |||
#ifndef LAME_LAME_H | #ifndef LAME_LAME_H | |||
#define LAME_LAME_H | #define LAME_LAME_H | |||
/* for size_t typedef */ | /* for size_t typedef */ | |||
#include <stddef.h> | #include <stddef.h> | |||
/* for va_list typedef */ | /* for va_list typedef */ | |||
#include <stdarg.h> | #include <stdarg.h> | |||
/* for FILE typedef, TODO: remove when removing lame_mp3_tags_fid */ | /* for FILE typedef, TODO: remove when removing lame_mp3_tags_fid */ | |||
#include <stdio.h> | #include <stdio.h> | |||
#if defined(__cplusplus) | #if defined(__cplusplus) | |||
extern "C" { | extern "C" { | |||
#endif | #endif | |||
#if defined(WIN32) || defined(_WIN32) | #if defined(WIN32) | |||
#undef CDECL | #undef CDECL | |||
#define CDECL __cdecl | #define CDECL _cdecl | |||
#else | #else | |||
#define CDECL | #define CDECL | |||
#endif | #endif | |||
#define DEPRECATED_OR_OBSOLETE_CODE_REMOVED 1 | #define DEPRECATED_OR_OBSOLETE_CODE_REMOVED 1 | |||
typedef enum vbr_mode_e { | typedef enum vbr_mode_e { | |||
vbr_off=0, | vbr_off=0, | |||
vbr_mt, /* obsolete, same as vbr_mtrh */ | vbr_mt, /* obsolete, same as vbr_mtrh */ | |||
vbr_rh, | vbr_rh, | |||
skipping to change at line 918 | skipping to change at line 918 | |||
#endif | #endif | |||
/********************************************************************* | /********************************************************************* | |||
* | * | |||
* decoding | * decoding | |||
* | * | |||
* a simple interface to mpglib, part of mpg123, is also included if | * a simple interface to mpglib, part of mpg123, is also included if | |||
* libmp3lame is compiled with HAVE_MPGLIB | * libmp3lame is compiled with HAVE_MPGLIB | |||
* | * | |||
*********************************************************************/ | *********************************************************************/ | |||
struct hip_global_struct; | ||||
typedef struct hip_global_struct hip_global_flags; | ||||
typedef hip_global_flags *hip_t; | ||||
typedef struct { | typedef struct { | |||
int header_parsed; /* 1 if header was parsed and following data was | int header_parsed; /* 1 if header was parsed and following data was | |||
computed */ | computed */ | |||
int stereo; /* number of channels */ | int stereo; /* number of channels */ | |||
int samplerate; /* sample rate */ | int samplerate; /* sample rate */ | |||
int bitrate; /* bitrate */ | int bitrate; /* bitrate */ | |||
int mode; /* mp3 frame type */ | int mode; /* mp3 frame type */ | |||
int mode_ext; /* mp3 frame type */ | int mode_ext; /* mp3 frame type */ | |||
int framesize; /* number of samples per mp3 frame */ | int framesize; /* number of samples per mp3 frame */ | |||
/* this data is only computed if mpglib detects a Xing VBR header */ | /* this data is only computed if mpglib detects a Xing VBR header */ | |||
unsigned long nsamp; /* number of samples in mp3 file. */ | unsigned long nsamp; /* number of samples in mp3 file. */ | |||
int totalframes; /* total number of frames in mp3 file */ | int totalframes; /* total number of frames in mp3 file */ | |||
/* this data is not currently computed by the mpglib routines */ | /* this data is not currently computed by the mpglib routines */ | |||
int framenum; /* frames decoded counter */ | int framenum; /* frames decoded counter */ | |||
} mp3data_struct; | } mp3data_struct; | |||
/* required call to initialize decoder */ | /* required call to initialize decoder | |||
hip_t CDECL hip_decode_init(void); | * NOTE: the decoder should not be used when encoding is performed | |||
* with decoding on the fly */ | ||||
/* cleanup call to exit decoder */ | int CDECL lame_decode_init(void); | |||
int CDECL hip_decode_exit(hip_t gfp); | ||||
/********************************************************************* | /********************************************************************* | |||
* input 1 mp3 frame, output (maybe) pcm data. | * input 1 mp3 frame, output (maybe) pcm data. | |||
* | * | |||
* nout = hip_decode(hip, mp3buf,len,pcm_l,pcm_r); | * nout = lame_decode(mp3buf,len,pcm_l,pcm_r); | |||
* | * | |||
* input: | * input: | |||
* len : number of bytes of mp3 data in mp3buf | * len : number of bytes of mp3 data in mp3buf | |||
* mp3buf[len] : mp3 data to be decoded | * mp3buf[len] : mp3 data to be decoded | |||
* | * | |||
* output: | * output: | |||
* nout: -1 : decoding error | * nout: -1 : decoding error | |||
* 0 : need more data before we can complete the decode | * 0 : need more data before we can complete the decode | |||
* >0 : returned 'nout' samples worth of data in pcm_l,pcm_r | * >0 : returned 'nout' samples worth of data in pcm_l,pcm_r | |||
* pcm_l[nout] : left channel data | * pcm_l[nout] : left channel data | |||
* pcm_r[nout] : right channel data | * pcm_r[nout] : right channel data | |||
* | * | |||
*********************************************************************/ | *********************************************************************/ | |||
int CDECL hip_decode( hip_t gfp | ||||
, unsigned char * mp3buf | ||||
, size_t len | ||||
, short pcm_l[] | ||||
, short pcm_r[] | ||||
); | ||||
/* same as hip_decode, and also returns mp3 header data */ | ||||
int CDECL hip_decode_headers( hip_t gfp | ||||
, unsigned char* mp3buf | ||||
, size_t len | ||||
, short pcm_l[] | ||||
, short pcm_r[] | ||||
, mp3data_struct* mp3data | ||||
); | ||||
/* same as hip_decode, but returns at most one frame */ | ||||
int CDECL hip_decode1( hip_t gfp | ||||
, unsigned char* mp3buf | ||||
, size_t len | ||||
, short pcm_l[] | ||||
, short pcm_r[] | ||||
); | ||||
/* same as hip_decode1, but returns at most one frame and mp3 header data * | ||||
/ | ||||
int CDECL hip_decode1_headers( hip_t gfp | ||||
, unsigned char* mp3buf | ||||
, size_t len | ||||
, short pcm_l[] | ||||
, short pcm_r[] | ||||
, mp3data_struct* mp3data | ||||
); | ||||
/* same as hip_decode1_headers, but also returns enc_delay and enc_padding | ||||
from VBR Info tag, (-1 if no info tag was found) */ | ||||
int CDECL hip_decode1_headersB( hip_t gfp | ||||
, unsigned char* mp3buf | ||||
, size_t len | ||||
, short pcm_l[] | ||||
, short pcm_r[] | ||||
, mp3data_struct* mp3data | ||||
, int *enc_delay | ||||
, int *enc_padding | ||||
); | ||||
/* OBSOLETE: | ||||
* lame_decode... functions are there to keep old code working | ||||
* but it is strongly recommended to replace calls by hip_decode... | ||||
* function calls, see above. | ||||
*/ | ||||
#if 1 | ||||
int CDECL lame_decode_init(void); | ||||
int CDECL lame_decode( | int CDECL lame_decode( | |||
unsigned char * mp3buf, | unsigned char * mp3buf, | |||
int len, | int len, | |||
short pcm_l[], | short pcm_l[], | |||
short pcm_r[] ); | short pcm_r[] ); | |||
/* same as lame_decode, and also returns mp3 header data */ | ||||
int CDECL lame_decode_headers( | int CDECL lame_decode_headers( | |||
unsigned char* mp3buf, | unsigned char* mp3buf, | |||
int len, | int len, | |||
short pcm_l[], | short pcm_l[], | |||
short pcm_r[], | short pcm_r[], | |||
mp3data_struct* mp3data ); | mp3data_struct* mp3data ); | |||
/* same as lame_decode, but returns at most one frame */ | ||||
int CDECL lame_decode1( | int CDECL lame_decode1( | |||
unsigned char* mp3buf, | unsigned char* mp3buf, | |||
int len, | int len, | |||
short pcm_l[], | short pcm_l[], | |||
short pcm_r[] ); | short pcm_r[] ); | |||
/* same as lame_decode1, but returns at most one frame and mp3 header data | ||||
*/ | ||||
int CDECL lame_decode1_headers( | int CDECL lame_decode1_headers( | |||
unsigned char* mp3buf, | unsigned char* mp3buf, | |||
int len, | int len, | |||
short pcm_l[], | short pcm_l[], | |||
short pcm_r[], | short pcm_r[], | |||
mp3data_struct* mp3data ); | mp3data_struct* mp3data ); | |||
/* same as lame_decode1_headers, but also returns enc_delay and enc_padding | ||||
from VBR Info tag, (-1 if no info tag was found) */ | ||||
int CDECL lame_decode1_headersB( | int CDECL lame_decode1_headersB( | |||
unsigned char* mp3buf, | unsigned char* mp3buf, | |||
int len, | int len, | |||
short pcm_l[], | short pcm_l[], | |||
short pcm_r[], | short pcm_r[], | |||
mp3data_struct* mp3data, | mp3data_struct* mp3data, | |||
int *enc_delay, | int *enc_delay, | |||
int *enc_padding ); | int *enc_padding ); | |||
int CDECL lame_decode_exit(void); | ||||
#endif /* obsolete lame_decode API calls */ | /* cleanup call to exit decoder */ | |||
int CDECL lame_decode_exit(void); | ||||
/********************************************************************* | /********************************************************************* | |||
* | * | |||
* id3tag stuff | * id3tag stuff | |||
* | * | |||
*********************************************************************/ | *********************************************************************/ | |||
/* | /* | |||
* id3tag.h -- Interface to write ID3 version 1 and 2 tags. | * id3tag.h -- Interface to write ID3 version 1 and 2 tags. | |||
* | * | |||
skipping to change at line 1081 | skipping to change at line 1032 | |||
* You should have received a copy of the GNU Library General Public | * You should have received a copy of the GNU Library General Public | |||
* License along with this library; if not, write to the Free Software | * License along with this library; if not, write to the Free Software | |||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA . | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA . | |||
*/ | */ | |||
/* utility to obtain alphabetically sorted list of genre names with numbers */ | /* utility to obtain alphabetically sorted list of genre names with numbers */ | |||
void CDECL id3tag_genre_list( | void CDECL id3tag_genre_list( | |||
void (*handler)(int, const char *, void *), | void (*handler)(int, const char *, void *), | |||
void* cookie); | void* cookie); | |||
void CDECL id3tag_init (lame_t gfp); | void CDECL id3tag_init (lame_global_flags *gfp); | |||
/* force addition of version 2 tag */ | /* force addition of version 2 tag */ | |||
void CDECL id3tag_add_v2 (lame_t gfp); | void CDECL id3tag_add_v2 (lame_global_flags *gfp); | |||
/* add only a version 1 tag */ | /* add only a version 1 tag */ | |||
void CDECL id3tag_v1_only (lame_t gfp); | void CDECL id3tag_v1_only (lame_global_flags *gfp); | |||
/* add only a version 2 tag */ | /* add only a version 2 tag */ | |||
void CDECL id3tag_v2_only (lame_t gfp); | void CDECL id3tag_v2_only (lame_global_flags *gfp); | |||
/* pad version 1 tag with spaces instead of nulls */ | /* pad version 1 tag with spaces instead of nulls */ | |||
void CDECL id3tag_space_v1 (lame_t gfp); | void CDECL id3tag_space_v1 (lame_global_flags *gfp); | |||
/* pad version 2 tag with extra 128 bytes */ | /* pad version 2 tag with extra 128 bytes */ | |||
void CDECL id3tag_pad_v2 (lame_t gfp); | void CDECL id3tag_pad_v2 (lame_global_flags *gfp); | |||
/* pad version 2 tag with extra n bytes */ | ||||
void CDECL id3tag_set_pad (lame_t gfp, size_t n); | ||||
void CDECL id3tag_set_title(lame_t gfp, const char* title); | void CDECL id3tag_set_title( | |||
void CDECL id3tag_set_artist(lame_t gfp, const char* artist); | lame_global_flags* gfp, | |||
void CDECL id3tag_set_album(lame_t gfp, const char* album); | const char* title ); | |||
void CDECL id3tag_set_year(lame_t gfp, const char* year); | void CDECL id3tag_set_artist( | |||
void CDECL id3tag_set_comment(lame_t gfp, const char* comment); | lame_global_flags* gfp, | |||
const char* artist ); | ||||
void CDECL id3tag_set_album( | ||||
lame_global_flags* gfp, | ||||
const char* album ); | ||||
void CDECL id3tag_set_year( | ||||
lame_global_flags* gfp, | ||||
const char* year ); | ||||
void CDECL id3tag_set_comment( | ||||
lame_global_flags* gfp, | ||||
const char* comment ); | ||||
/* return -1 result if track number is out of ID3v1 range | /* return -1 result if track number is out of ID3v1 range | |||
and ignored for ID3v1 */ | and ignored for ID3v1 */ | |||
int CDECL id3tag_set_track(lame_t gfp, const char* track); | int CDECL id3tag_set_track( | |||
lame_global_flags* gfp, | ||||
const char* track ); | ||||
/* return non-zero result if genre name or number is invalid | /* return non-zero result if genre name or number is invalid | |||
result 0: OK | result 0: OK | |||
result -1: genre number out of range | result -1: genre number out of range | |||
result -2: no valid ID3v1 genre name, mapped to ID3v1 'Other' | result -2: no valid ID3v1 genre name, mapped to ID3v1 'Other' | |||
but taken as-is for ID3v2 genre tag */ | but taken as-is for ID3v2 genre tag */ | |||
int CDECL id3tag_set_genre(lame_t gfp, const char* genre); | int CDECL id3tag_set_genre( | |||
lame_global_flags* gfp, | ||||
const char* genre ); | ||||
/* return non-zero result if field name is invalid */ | /* return non-zero result if field name is invalid */ | |||
int CDECL id3tag_set_fieldvalue(lame_t gfp, const char* fieldvalue); | int CDECL id3tag_set_fieldvalue( | |||
lame_global_flags* gfp, | ||||
const char* fieldvalue); | ||||
/* return non-zero result if image type is invalid */ | /* return non-zero result if image type is invalid */ | |||
int CDECL id3tag_set_albumart(lame_t gfp, const char* image, size_t size); | int CDECL id3tag_set_albumart( | |||
lame_global_flags* gfp, | ||||
const char* image, | ||||
unsigned long size ); | ||||
/* lame_get_id3v1_tag copies ID3v1 tag into buffer. | /* lame_get_id3v1_tag copies ID3v1 tag into buffer. | |||
* Function returns number of bytes copied into buffer, or number | * Function returns number of bytes copied into buffer, or number | |||
* of bytes rquired if buffer 'size' is too small. | * of bytes rquired if buffer 'size' is too small. | |||
* Function fails, if returned value is larger than 'size'. | * Function fails, if returned value is larger than 'size'. | |||
* NOTE: | * NOTE: | |||
* This functions does nothing, if user/LAME disabled ID3v1 tag. | * This functions does nothing, if user/LAME disabled ID3v1 tag. | |||
*/ | */ | |||
size_t CDECL lame_get_id3v1_tag(lame_t gfp, unsigned char* buffer, size_t s | size_t CDECL lame_get_id3v1_tag( | |||
ize); | lame_global_flags * gfp, unsigned char* buffer, size_t size); | |||
/* lame_get_id3v2_tag copies ID3v2 tag into buffer. | /* lame_get_id3v2_tag copies ID3v2 tag into buffer. | |||
* Function returns number of bytes copied into buffer, or number | * Function returns number of bytes copied into buffer, or number | |||
* of bytes rquired if buffer 'size' is too small. | * of bytes rquired if buffer 'size' is too small. | |||
* Function fails, if returned value is larger than 'size'. | * Function fails, if returned value is larger than 'size'. | |||
* NOTE: | * NOTE: | |||
* This functions does nothing, if user/LAME disabled ID3v2 tag. | * This functions does nothing, if user/LAME disabled ID3v2 tag. | |||
*/ | */ | |||
size_t CDECL lame_get_id3v2_tag(lame_t gfp, unsigned char* buffer, size_t s | size_t CDECL lame_get_id3v2_tag( | |||
ize); | lame_global_flags * gfp, unsigned char* buffer, size_t size); | |||
/* normaly lame_init_param writes ID3v2 tags into the audio stream | /* normaly lame_init_param writes ID3v2 tags into the audio stream | |||
* Call lame_set_write_id3tag_automatic(gfp, 0) before lame_init_param | * Call lame_set_write_id3tag_automatic(gfp, 0) before lame_init_param | |||
* to turn off this behaviour and get ID3v2 tag with above function | * to turn off this behaviour and get ID3v2 tag with above function | |||
* write it yourself into your file. | * write it yourself into your file. | |||
*/ | */ | |||
void CDECL lame_set_write_id3tag_automatic(lame_global_flags * gfp, int); | void CDECL lame_set_write_id3tag_automatic(lame_global_flags * gfp, int); | |||
int CDECL lame_get_write_id3tag_automatic(lame_global_flags const* gfp); | int CDECL lame_get_write_id3tag_automatic(lame_global_flags const* gfp); | |||
/*********************************************************************** | /*********************************************************************** | |||
End of changes. 26 change blocks. | ||||
91 lines changed or deleted | 58 lines changed or added | |||