|
|
@ -15,6 +15,7 @@ GNU General Public License for more details. |
|
|
|
|
|
|
|
|
|
|
|
#include "mpg123.h" |
|
|
|
#include "mpg123.h" |
|
|
|
#include "sample.h" |
|
|
|
#include "sample.h" |
|
|
|
|
|
|
|
#include "libmpg.h" |
|
|
|
|
|
|
|
|
|
|
|
static int initialized = 0; |
|
|
|
static int initialized = 0; |
|
|
|
|
|
|
|
|
|
|
@ -83,7 +84,7 @@ mpg123_handle_t *mpg123_parnew( mpg123_parm_t *mp, int *error ) |
|
|
|
return fr; |
|
|
|
return fr; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
int mpg123_par( mpg123_parm_t *mp, enum mpg123_parms key, long val ) |
|
|
|
static int mpg123_par( mpg123_parm_t *mp, enum mpg123_parms key, long val ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
int ret = MPG123_OK; |
|
|
|
int ret = MPG123_OK; |
|
|
|
|
|
|
|
|
|
|
@ -189,7 +190,7 @@ int mpg123_param( mpg123_handle_t *mh, enum mpg123_parms key, long val ) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
int mpg123_close( mpg123_handle_t *mh ) |
|
|
|
static int mpg123_close( mpg123_handle_t *mh ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if( mh == NULL ) |
|
|
|
if( mh == NULL ) |
|
|
|
return MPG123_BAD_HANDLE; |
|
|
|
return MPG123_BAD_HANDLE; |
|
|
@ -263,7 +264,7 @@ int mpg123_replace_reader_handle( mpg123_handle_t *mh, mpg_ssize_t (*fread)( voi |
|
|
|
// a) a new choice of decoder
|
|
|
|
// a) a new choice of decoder
|
|
|
|
// b) a changed native format of the MPEG stream
|
|
|
|
// b) a changed native format of the MPEG stream
|
|
|
|
// ... calls are only valid after parsing some MPEG frame!
|
|
|
|
// ... calls are only valid after parsing some MPEG frame!
|
|
|
|
int decode_update( mpg123_handle_t *mh ) |
|
|
|
static int decode_update( mpg123_handle_t *mh ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
long native_rate; |
|
|
|
long native_rate; |
|
|
|
int b; |
|
|
|
int b; |
|
|
@ -320,13 +321,13 @@ int decode_update( mpg123_handle_t *mh ) |
|
|
|
return 0; |
|
|
|
return 0; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
size_t mpg123_safe_buffer( void ) |
|
|
|
static size_t mpg123_safe_buffer( void ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
// real is the largest possible output
|
|
|
|
// real is the largest possible output
|
|
|
|
return sizeof( float ) * 2 * 1152; |
|
|
|
return sizeof( float ) * 2 * 1152; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
size_t mpg123_outblock( mpg123_handle_t *mh ) |
|
|
|
static size_t mpg123_outblock( mpg123_handle_t *mh ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
// try to be helpful and never return zero output block size.
|
|
|
|
// try to be helpful and never return zero output block size.
|
|
|
|
if( mh != NULL && mh->outblock > 0 ) |
|
|
|
if( mh != NULL && mh->outblock > 0 ) |
|
|
@ -697,7 +698,7 @@ int mpg123_getformat( mpg123_handle_t *mh, int *rate, int *channels, int *encodi |
|
|
|
return MPG123_OK; |
|
|
|
return MPG123_OK; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
int mpg123_scan( mpg123_handle_t *mh ) |
|
|
|
static int mpg123_scan( mpg123_handle_t *mh ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
mpg_off_t track_frames = 0; |
|
|
|
mpg_off_t track_frames = 0; |
|
|
|
mpg_off_t track_samples = 0; |
|
|
|
mpg_off_t track_samples = 0; |
|
|
@ -963,8 +964,10 @@ const char *mpg123_plain_strerror( int errcode ) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const char *get_error( mpg123_handle_t *mh ) |
|
|
|
const char *get_error( void *handle ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
mpg123_handle_t *mh = handle; |
|
|
|
|
|
|
|
|
|
|
|
if( !mh ) return mpg123_plain_strerror( MPG123_BAD_HANDLE ); |
|
|
|
if( !mh ) return mpg123_plain_strerror( MPG123_BAD_HANDLE ); |
|
|
|
return mpg123_plain_strerror( mh->err ); |
|
|
|
return mpg123_plain_strerror( mh->err ); |
|
|
|
} |
|
|
|
} |
|
|
|