diff options
Diffstat (limited to 'src/inputPlugins')
-rw-r--r-- | src/inputPlugins/aac_plugin.c | 8 | ||||
-rw-r--r-- | src/inputPlugins/audiofile_plugin.c | 12 | ||||
-rw-r--r-- | src/inputPlugins/flac_plugin.c | 30 | ||||
-rw-r--r-- | src/inputPlugins/mp4_plugin.c | 8 |
4 files changed, 30 insertions, 28 deletions
diff --git a/src/inputPlugins/aac_plugin.c b/src/inputPlugins/aac_plugin.c index 0dd23f955..017aa7779 100644 --- a/src/inputPlugins/aac_plugin.c +++ b/src/inputPlugins/aac_plugin.c @@ -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; diff --git a/src/inputPlugins/audiofile_plugin.c b/src/inputPlugins/audiofile_plugin.c index 8c1089e1b..5fe1a5ccd 100644 --- a/src/inputPlugins/audiofile_plugin.c +++ b/src/inputPlugins/audiofile_plugin.c @@ -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; } diff --git a/src/inputPlugins/flac_plugin.c b/src/inputPlugins/flac_plugin.c index a90270850..67dc160ec 100644 --- a/src/inputPlugins/flac_plugin.c +++ b/src/inputPlugins/flac_plugin.c @@ -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); } } diff --git a/src/inputPlugins/mp4_plugin.c b/src/inputPlugins/mp4_plugin.c index 350aae777..f17b0b4ce 100644 --- a/src/inputPlugins/mp4_plugin.c +++ b/src/inputPlugins/mp4_plugin.c @@ -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; |