icynames are now copied to title of streams
git-svn-id: https://svn.musicpd.org/mpd/trunk@1258 09075e82-0dd4-0310-85a5-a0d7c8717e4f
This commit is contained in:
@@ -250,7 +250,7 @@ int getAacTotalTime(char * file) {
|
||||
}
|
||||
|
||||
|
||||
int aac_decode(OutputBuffer * cb, DecoderControl * dc) {
|
||||
int aac_decode(OutputBuffer * cb, DecoderControl * dc, char * path) {
|
||||
float time;
|
||||
float totalTime;
|
||||
faacDecHandle decoder;
|
||||
@@ -270,9 +270,9 @@ int aac_decode(OutputBuffer * cb, DecoderControl * dc) {
|
||||
AacBuffer b;
|
||||
InputStream inStream;
|
||||
|
||||
if((totalTime = getAacFloatTotalTime(dc->file)) < 0) return -1;
|
||||
if((totalTime = getAacFloatTotalTime(path)) < 0) return -1;
|
||||
|
||||
if(openInputStream(&inStream,dc->file) < 0) return -1;
|
||||
if(openInputStream(&inStream, path) < 0) return -1;
|
||||
|
||||
initAacBuffer(&inStream,&b,NULL,NULL,NULL);
|
||||
|
||||
@@ -328,7 +328,7 @@ int aac_decode(OutputBuffer * cb, DecoderControl * dc) {
|
||||
#endif
|
||||
|
||||
if(frameInfo.error > 0) {
|
||||
ERROR("error decoding AAC file: %s\n",dc->file);
|
||||
ERROR("error decoding AAC file: %s\n", path);
|
||||
ERROR("faad2 error: %s\n",
|
||||
faacDecGetErrorMessage(frameInfo.error));
|
||||
eof = 1;
|
||||
|
||||
@@ -51,21 +51,21 @@ int getAudiofileTotalTime(char * file)
|
||||
return time;
|
||||
}
|
||||
|
||||
int audiofile_decode(OutputBuffer * cb, DecoderControl * dc) {
|
||||
int audiofile_decode(OutputBuffer * cb, DecoderControl * dc, char * path) {
|
||||
int fs, frame_count;
|
||||
AFfilehandle af_fp;
|
||||
int bits;
|
||||
mpd_uint16 bitRate;
|
||||
struct stat st;
|
||||
|
||||
if(stat(dc->file,&st) < 0) {
|
||||
ERROR("failed to stat: %s\n",dc->file);
|
||||
if(stat(path, &st) < 0) {
|
||||
ERROR("failed to stat: %s\n", path);
|
||||
return -1;
|
||||
}
|
||||
|
||||
af_fp = afOpenFile(dc->file,"r", NULL);
|
||||
af_fp = afOpenFile(path, "r", NULL);
|
||||
if(af_fp == AF_NULL_FILEHANDLE) {
|
||||
ERROR("failed to open: %s\n",dc->file);
|
||||
ERROR("failed to open: %s\n", path);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -83,7 +83,7 @@ int audiofile_decode(OutputBuffer * cb, DecoderControl * dc) {
|
||||
|
||||
if (dc->audioFormat.bits != 8 && dc->audioFormat.bits != 16) {
|
||||
ERROR("Only 8 and 16-bit files are supported. %s is %i-bit\n",
|
||||
dc->file,dc->audioFormat.bits);
|
||||
path, dc->audioFormat.bits);
|
||||
afCloseFile(af_fp);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -45,6 +45,7 @@ typedef struct {
|
||||
DecoderControl * dc;
|
||||
InputStream inStream;
|
||||
float replayGainScale;
|
||||
char * path;
|
||||
} FlacData;
|
||||
|
||||
/* this code is based on flac123, from flac-tools */
|
||||
@@ -68,7 +69,7 @@ FLAC__SeekableStreamDecoderLengthStatus flacLength(
|
||||
const FLAC__SeekableStreamDecoder *, FLAC__uint64 *, void *);
|
||||
FLAC__bool flacEOF(const FLAC__SeekableStreamDecoder *, void *);
|
||||
|
||||
int flac_decode(OutputBuffer * cb, DecoderControl *dc) {
|
||||
int flac_decode(OutputBuffer * cb, DecoderControl *dc, char * path) {
|
||||
FLAC__SeekableStreamDecoder * flacDec;
|
||||
FlacData data;
|
||||
int status = 1;
|
||||
@@ -80,9 +81,10 @@ int flac_decode(OutputBuffer * cb, DecoderControl *dc) {
|
||||
data.cb = cb;
|
||||
data.dc = dc;
|
||||
data.replayGainScale = 1.0;
|
||||
data.path = path;
|
||||
|
||||
if(openInputStream(&(data.inStream),dc->file)<0) {
|
||||
ERROR("unable to open flac: %s\n",dc->file);
|
||||
if(openInputStream(&(data.inStream), path)<0) {
|
||||
ERROR("unable to open flac: %s\n", path);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -106,10 +108,10 @@ int flac_decode(OutputBuffer * cb, DecoderControl *dc) {
|
||||
status&=FLAC__seekable_stream_decoder_set_client_data(flacDec,
|
||||
(void *)&data);
|
||||
if(!status) {
|
||||
ERROR("flac problem before init(): %s\n",dc->file);
|
||||
ERROR("flac problem before init(): %s\n", path);
|
||||
flacPrintErroredState(
|
||||
FLAC__seekable_stream_decoder_get_state(flacDec),
|
||||
dc->file);
|
||||
path);
|
||||
FLAC__seekable_stream_decoder_delete(flacDec);
|
||||
return -1;
|
||||
}
|
||||
@@ -117,19 +119,19 @@ int flac_decode(OutputBuffer * cb, DecoderControl *dc) {
|
||||
if(FLAC__seekable_stream_decoder_init(flacDec)!=
|
||||
FLAC__STREAM_DECODER_SEARCH_FOR_METADATA)
|
||||
{
|
||||
ERROR("flac problem doing init(): %s\n",dc->file);
|
||||
ERROR("flac problem doing init(): %s\n", path);
|
||||
flacPrintErroredState(
|
||||
FLAC__seekable_stream_decoder_get_state(flacDec),
|
||||
dc->file);
|
||||
path);
|
||||
FLAC__seekable_stream_decoder_delete(flacDec);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if(!FLAC__seekable_stream_decoder_process_until_end_of_metadata(flacDec)) {
|
||||
ERROR("flac problem reading metadata: %s\n", dc->file);
|
||||
ERROR("flac problem reading metadata: %s\n", path);
|
||||
flacPrintErroredState(
|
||||
FLAC__seekable_stream_decoder_get_state(flacDec),
|
||||
dc->file);
|
||||
path);
|
||||
FLAC__seekable_stream_decoder_delete(flacDec);
|
||||
return -1;
|
||||
}
|
||||
@@ -163,7 +165,7 @@ int flac_decode(OutputBuffer * cb, DecoderControl *dc) {
|
||||
if(!dc->stop) {
|
||||
flacPrintErroredState(
|
||||
FLAC__seekable_stream_decoder_get_state(flacDec),
|
||||
dc->file);
|
||||
path);
|
||||
FLAC__seekable_stream_decoder_finish(flacDec);
|
||||
}
|
||||
FLAC__seekable_stream_decoder_delete(flacDec);
|
||||
@@ -253,16 +255,16 @@ void flacError(const FLAC__SeekableStreamDecoder *dec,
|
||||
|
||||
switch(status) {
|
||||
case FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC:
|
||||
ERROR("flac lost sync: %s\n",data->dc->file);
|
||||
ERROR("flac lost sync: %s\n", data->path);
|
||||
break;
|
||||
case FLAC__STREAM_DECODER_ERROR_STATUS_BAD_HEADER:
|
||||
ERROR("bad header %s\n",data->dc->file);
|
||||
ERROR("bad header %s\n", data->path);
|
||||
break;
|
||||
case FLAC__STREAM_DECODER_ERROR_STATUS_FRAME_CRC_MISMATCH:
|
||||
ERROR("crc mismatch %s\n",data->dc->file);
|
||||
ERROR("crc mismatch %s\n", data->path);
|
||||
break;
|
||||
default:
|
||||
ERROR("unknow flac error %s\n",data->dc->file);
|
||||
ERROR("unknow flac error %s\n", data->path);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -85,7 +85,7 @@ uint32_t mp4_inputStreamSeekCallback(void *inStream, uint64_t position) {
|
||||
}
|
||||
|
||||
|
||||
int mp4_decode(OutputBuffer * cb, DecoderControl * dc) {
|
||||
int mp4_decode(OutputBuffer * cb, DecoderControl * dc, char * path) {
|
||||
mp4ff_t * mp4fh;
|
||||
mp4ff_callback_t * mp4cb;
|
||||
int32_t track;
|
||||
@@ -113,8 +113,8 @@ int mp4_decode(OutputBuffer * cb, DecoderControl * dc) {
|
||||
mpd_uint16 bitRate = 0;
|
||||
InputStream inStream;
|
||||
|
||||
if(openInputStream(&inStream,dc->file) < 0) {
|
||||
ERROR("failed to open %s\n",dc->file);
|
||||
if(openInputStream(&inStream, path) < 0) {
|
||||
ERROR("failed to open %s\n", path);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -241,7 +241,7 @@ int mp4_decode(OutputBuffer * cb, DecoderControl * dc) {
|
||||
|
||||
if(mp4Buffer) free(mp4Buffer);
|
||||
if(frameInfo.error > 0) {
|
||||
ERROR("error decoding MP4 file: %s\n",dc->file);
|
||||
ERROR("error decoding MP4 file: %s\n", path);
|
||||
ERROR("faad2 error: %s\n",
|
||||
faacDecGetErrorMessage(frameInfo.error));
|
||||
eof = 1;
|
||||
|
||||
Reference in New Issue
Block a user