2004-02-24 00:41:20 +01:00
|
|
|
/* the Music Player Daemon (MPD)
|
2006-07-14 21:37:45 +02:00
|
|
|
* (c)2003-2006 by Warren Dukes (warren.dukes@gmail.com)
|
2004-02-24 00:41:20 +01:00
|
|
|
* This project's homepage is: http://www.musicpd.org
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
*/
|
|
|
|
|
2004-05-31 03:54:10 +02:00
|
|
|
#include "../inputPlugin.h"
|
2004-02-24 00:41:20 +01:00
|
|
|
|
2004-03-18 04:29:25 +01:00
|
|
|
#ifdef HAVE_FLAC
|
|
|
|
|
2006-03-16 07:52:46 +01:00
|
|
|
#include "_flac_common.h"
|
|
|
|
|
2004-05-31 03:54:10 +02:00
|
|
|
#include "../utils.h"
|
|
|
|
#include "../log.h"
|
|
|
|
#include "../pcm_utils.h"
|
|
|
|
#include "../inputStream.h"
|
|
|
|
#include "../outputBuffer.h"
|
|
|
|
#include "../replayGain.h"
|
|
|
|
#include "../audio.h"
|
2004-02-24 00:41:20 +01:00
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <unistd.h>
|
2006-12-04 05:45:44 +01:00
|
|
|
#include <FLAC/stream_decoder.h>
|
2004-02-24 00:41:20 +01:00
|
|
|
#include <FLAC/metadata.h>
|
|
|
|
|
|
|
|
/* this code is based on flac123, from flac-tools */
|
|
|
|
|
2006-12-04 05:45:44 +01:00
|
|
|
static FLAC__StreamDecoderReadStatus flacRead(const FLAC__StreamDecoder
|
2006-07-20 18:02:40 +02:00
|
|
|
* flacDec,
|
|
|
|
FLAC__byte buf[],
|
|
|
|
unsigned *bytes,
|
|
|
|
void *fdata)
|
|
|
|
{
|
|
|
|
FlacData *data = (FlacData *) fdata;
|
2005-03-13 23:58:04 +01:00
|
|
|
size_t r;
|
|
|
|
|
|
|
|
while (1) {
|
2006-07-20 18:02:40 +02:00
|
|
|
r = readFromInputStream(data->inStream, (void *)buf, 1, *bytes);
|
2005-03-13 23:58:04 +01:00
|
|
|
if (r == 0 && !inputStreamAtEOF(data->inStream) &&
|
2006-07-20 18:02:40 +02:00
|
|
|
!data->dc->stop)
|
2005-03-13 23:58:04 +01:00
|
|
|
my_usleep(10000);
|
|
|
|
else
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
*bytes = r;
|
2006-07-20 18:02:40 +02:00
|
|
|
|
2006-12-04 05:45:44 +01:00
|
|
|
if (r == 0 && !data->dc->stop) {
|
|
|
|
if (inputStreamAtEOF(data->inStream))
|
|
|
|
return FLAC__STREAM_DECODER_READ_STATUS_END_OF_STREAM;
|
|
|
|
else
|
|
|
|
return FLAC__STREAM_DECODER_READ_STATUS_ABORT;
|
|
|
|
}
|
|
|
|
return FLAC__STREAM_DECODER_READ_STATUS_CONTINUE;
|
2004-05-05 01:39:02 +02:00
|
|
|
}
|
|
|
|
|
2006-12-04 05:45:44 +01:00
|
|
|
static FLAC__StreamDecoderSeekStatus flacSeek(const FLAC__StreamDecoder
|
2006-07-20 18:02:40 +02:00
|
|
|
* flacDec,
|
|
|
|
FLAC__uint64 offset,
|
|
|
|
void *fdata)
|
2004-05-05 01:39:02 +02:00
|
|
|
{
|
2006-07-20 18:02:40 +02:00
|
|
|
FlacData *data = (FlacData *) fdata;
|
2004-05-05 01:39:02 +02:00
|
|
|
|
2006-07-20 18:02:40 +02:00
|
|
|
if (seekInputStream(data->inStream, offset, SEEK_SET) < 0) {
|
2006-12-04 05:45:44 +01:00
|
|
|
return FLAC__STREAM_DECODER_SEEK_STATUS_ERROR;
|
2006-07-20 18:02:40 +02:00
|
|
|
}
|
2004-05-05 01:39:02 +02:00
|
|
|
|
2006-12-04 05:45:44 +01:00
|
|
|
return FLAC__STREAM_DECODER_SEEK_STATUS_OK;
|
2004-05-05 01:39:02 +02:00
|
|
|
}
|
|
|
|
|
2006-12-04 05:45:44 +01:00
|
|
|
static FLAC__StreamDecoderTellStatus flacTell(const FLAC__StreamDecoder
|
2006-07-20 18:02:40 +02:00
|
|
|
* flacDec,
|
|
|
|
FLAC__uint64 * offset,
|
|
|
|
void *fdata)
|
2004-05-05 01:39:02 +02:00
|
|
|
{
|
2006-07-20 18:02:40 +02:00
|
|
|
FlacData *data = (FlacData *) fdata;
|
2004-05-05 01:39:02 +02:00
|
|
|
|
2006-07-20 18:02:40 +02:00
|
|
|
*offset = (long)(data->inStream->offset);
|
2004-05-05 01:39:02 +02:00
|
|
|
|
2006-12-04 05:45:44 +01:00
|
|
|
return FLAC__STREAM_DECODER_TELL_STATUS_OK;
|
2004-05-05 01:39:02 +02:00
|
|
|
}
|
|
|
|
|
2006-12-04 05:45:44 +01:00
|
|
|
static FLAC__StreamDecoderLengthStatus flacLength(const FLAC__StreamDecoder
|
2006-07-20 18:02:40 +02:00
|
|
|
* flacDec,
|
|
|
|
FLAC__uint64 * length,
|
|
|
|
void *fdata)
|
2004-05-05 01:39:02 +02:00
|
|
|
{
|
2006-07-20 18:02:40 +02:00
|
|
|
FlacData *data = (FlacData *) fdata;
|
2004-05-05 01:39:02 +02:00
|
|
|
|
2006-07-20 18:02:40 +02:00
|
|
|
*length = (size_t) (data->inStream->size);
|
2004-05-05 01:39:02 +02:00
|
|
|
|
2006-12-04 05:45:44 +01:00
|
|
|
return FLAC__STREAM_DECODER_LENGTH_STATUS_OK;
|
2004-05-05 01:39:02 +02:00
|
|
|
}
|
|
|
|
|
2006-12-04 05:45:44 +01:00
|
|
|
static FLAC__bool flacEOF(const FLAC__StreamDecoder * flacDec, void *fdata)
|
2006-07-20 18:02:40 +02:00
|
|
|
{
|
|
|
|
FlacData *data = (FlacData *) fdata;
|
|
|
|
|
2006-03-16 07:52:46 +01:00
|
|
|
if (inputStreamAtEOF(data->inStream) == 1)
|
2006-07-20 18:02:40 +02:00
|
|
|
return true;
|
2006-03-16 07:52:46 +01:00
|
|
|
return false;
|
2004-05-05 01:39:02 +02:00
|
|
|
}
|
|
|
|
|
2006-12-04 05:45:44 +01:00
|
|
|
static void flacError(const FLAC__StreamDecoder * dec,
|
2006-07-20 18:02:40 +02:00
|
|
|
FLAC__StreamDecoderErrorStatus status, void *fdata)
|
2004-05-05 01:39:02 +02:00
|
|
|
{
|
2006-07-20 18:02:40 +02:00
|
|
|
flac_error_common_cb("flac", status, (FlacData *) fdata);
|
2004-02-24 00:41:20 +01:00
|
|
|
}
|
|
|
|
|
2006-12-04 05:45:44 +01:00
|
|
|
static void flacPrintErroredState(FLAC__StreamDecoderState state)
|
2004-05-05 01:39:02 +02:00
|
|
|
{
|
2006-12-04 05:45:44 +01:00
|
|
|
const char *str = ""; /* "" to silence compiler warning */
|
2006-07-20 18:02:40 +02:00
|
|
|
switch (state) {
|
2006-12-04 05:45:44 +01:00
|
|
|
case FLAC__STREAM_DECODER_SEARCH_FOR_METADATA:
|
|
|
|
case FLAC__STREAM_DECODER_READ_METADATA:
|
|
|
|
case FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC:
|
|
|
|
case FLAC__STREAM_DECODER_READ_FRAME:
|
|
|
|
case FLAC__STREAM_DECODER_END_OF_STREAM:
|
|
|
|
return;
|
|
|
|
case FLAC__STREAM_DECODER_OGG_ERROR:
|
|
|
|
str = "error in the Ogg layer";
|
2004-05-05 01:39:02 +02:00
|
|
|
break;
|
2006-12-04 05:45:44 +01:00
|
|
|
case FLAC__STREAM_DECODER_SEEK_ERROR:
|
|
|
|
str = "seek error";
|
2004-02-24 00:41:20 +01:00
|
|
|
break;
|
2006-12-04 05:45:44 +01:00
|
|
|
case FLAC__STREAM_DECODER_ABORTED:
|
|
|
|
str = "decoder aborted by read";
|
2004-02-24 00:41:20 +01:00
|
|
|
break;
|
2006-12-04 05:45:44 +01:00
|
|
|
case FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR:
|
|
|
|
str = "allocation error";
|
2004-02-24 00:41:20 +01:00
|
|
|
break;
|
2006-12-04 05:45:44 +01:00
|
|
|
case FLAC__STREAM_DECODER_UNINITIALIZED:
|
|
|
|
str = "decoder uninitialized";
|
2004-02-24 00:41:20 +01:00
|
|
|
break;
|
|
|
|
}
|
2006-12-04 05:45:44 +01:00
|
|
|
ERROR("flac %s\n", str);
|
2004-02-24 00:41:20 +01:00
|
|
|
}
|
|
|
|
|
2006-12-04 05:45:44 +01:00
|
|
|
static void flacMetadata(const FLAC__StreamDecoder * dec,
|
2006-07-20 18:02:40 +02:00
|
|
|
const FLAC__StreamMetadata * block, void *vdata)
|
2004-05-05 01:39:02 +02:00
|
|
|
{
|
2006-07-20 18:02:40 +02:00
|
|
|
flac_metadata_common_cb(block, (FlacData *) vdata);
|
2004-02-24 00:41:20 +01:00
|
|
|
}
|
|
|
|
|
2006-12-04 05:45:44 +01:00
|
|
|
static FLAC__StreamDecoderWriteStatus flacWrite(const FLAC__StreamDecoder *
|
2006-07-20 18:02:40 +02:00
|
|
|
dec, const FLAC__Frame * frame,
|
|
|
|
const FLAC__int32 * const buf[],
|
|
|
|
void *vdata)
|
2004-05-05 01:39:02 +02:00
|
|
|
{
|
2006-07-20 18:02:40 +02:00
|
|
|
FlacData *data = (FlacData *) vdata;
|
2004-02-24 00:41:20 +01:00
|
|
|
FLAC__uint32 samples = frame->header.blocksize;
|
2005-12-31 04:40:03 +01:00
|
|
|
FLAC__uint16 u16;
|
2006-07-20 18:02:40 +02:00
|
|
|
unsigned char *uc;
|
2005-12-31 04:40:03 +01:00
|
|
|
int c_samp, c_chan, d_samp;
|
|
|
|
int i;
|
2004-02-26 04:21:24 +01:00
|
|
|
float timeChange;
|
|
|
|
FLAC__uint64 newPosition = 0;
|
2006-07-20 18:02:40 +02:00
|
|
|
|
|
|
|
timeChange = ((float)samples) / frame->header.sample_rate;
|
|
|
|
data->time += timeChange;
|
|
|
|
|
2006-12-04 05:45:44 +01:00
|
|
|
FLAC__stream_decoder_get_decode_position(dec, &newPosition);
|
2006-07-20 18:02:40 +02:00
|
|
|
if (data->position) {
|
|
|
|
data->bitRate =
|
|
|
|
((newPosition - data->position) * 8.0 / timeChange)
|
|
|
|
/ 1000 + 0.5;
|
2004-02-26 04:21:24 +01:00
|
|
|
}
|
|
|
|
data->position = newPosition;
|
2004-02-24 00:41:20 +01:00
|
|
|
|
2006-07-20 18:02:40 +02:00
|
|
|
for (c_samp = d_samp = 0; c_samp < frame->header.blocksize; c_samp++) {
|
|
|
|
for (c_chan = 0; c_chan < frame->header.channels;
|
|
|
|
c_chan++, d_samp++) {
|
2005-12-31 04:40:03 +01:00
|
|
|
u16 = buf[c_chan][c_samp];
|
|
|
|
uc = (unsigned char *)&u16;
|
2006-07-20 18:02:40 +02:00
|
|
|
for (i = 0; i < (data->dc->audioFormat.bits / 8); i++) {
|
|
|
|
if (data->chunk_length >= FLAC_CHUNK_SIZE) {
|
|
|
|
if (flacSendChunk(data) < 0) {
|
|
|
|
return
|
|
|
|
FLAC__STREAM_DECODER_WRITE_STATUS_ABORT;
|
2005-12-31 04:40:03 +01:00
|
|
|
}
|
|
|
|
data->chunk_length = 0;
|
2006-07-20 18:02:40 +02:00
|
|
|
if (data->dc->seek) {
|
|
|
|
return
|
|
|
|
FLAC__STREAM_DECODER_WRITE_STATUS_CONTINUE;
|
2005-12-31 04:40:03 +01:00
|
|
|
}
|
2004-02-24 00:41:20 +01:00
|
|
|
}
|
2005-12-31 04:40:03 +01:00
|
|
|
data->chunk[data->chunk_length++] = *(uc++);
|
2004-02-24 00:41:20 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return FLAC__STREAM_DECODER_WRITE_STATUS_CONTINUE;
|
|
|
|
}
|
|
|
|
|
2006-07-20 18:02:40 +02:00
|
|
|
static MpdTag *flacMetadataDup(char *file, int *vorbisCommentFound)
|
|
|
|
{
|
|
|
|
MpdTag *ret = NULL;
|
|
|
|
FLAC__Metadata_SimpleIterator *it;
|
|
|
|
FLAC__StreamMetadata *block = NULL;
|
2004-05-31 03:54:10 +02:00
|
|
|
|
|
|
|
*vorbisCommentFound = 0;
|
|
|
|
|
|
|
|
it = FLAC__metadata_simple_iterator_new();
|
2006-07-20 18:02:40 +02:00
|
|
|
if (!FLAC__metadata_simple_iterator_init(it, file, 1, 0)) {
|
|
|
|
switch (FLAC__metadata_simple_iterator_status(it)) {
|
|
|
|
case FLAC__METADATA_SIMPLE_ITERATOR_STATUS_ILLEGAL_INPUT:
|
|
|
|
DEBUG
|
|
|
|
("flacMetadataDup: Reading '%s' metadata gave the following error: Illegal Input\n",
|
|
|
|
file);
|
|
|
|
break;
|
|
|
|
case FLAC__METADATA_SIMPLE_ITERATOR_STATUS_ERROR_OPENING_FILE:
|
|
|
|
DEBUG
|
|
|
|
("flacMetadataDup: Reading '%s' metadata gave the following error: Error Opening File\n",
|
|
|
|
file);
|
|
|
|
break;
|
|
|
|
case FLAC__METADATA_SIMPLE_ITERATOR_STATUS_NOT_A_FLAC_FILE:
|
|
|
|
DEBUG
|
|
|
|
("flacMetadataDup: Reading '%s' metadata gave the following error: Not A Flac File\n",
|
|
|
|
file);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
DEBUG("flacMetadataDup: Reading '%s' metadata failed\n",
|
|
|
|
file);
|
2005-09-08 23:08:02 +02:00
|
|
|
}
|
2004-05-31 03:54:10 +02:00
|
|
|
FLAC__metadata_simple_iterator_delete(it);
|
|
|
|
return ret;
|
|
|
|
}
|
2006-07-20 18:02:40 +02:00
|
|
|
|
2004-05-31 03:54:10 +02:00
|
|
|
do {
|
|
|
|
block = FLAC__metadata_simple_iterator_get_block(it);
|
2006-07-20 18:02:40 +02:00
|
|
|
if (!block)
|
|
|
|
break;
|
|
|
|
if (block->type == FLAC__METADATA_TYPE_VORBIS_COMMENT) {
|
2004-11-10 22:58:27 +01:00
|
|
|
ret = copyVorbisCommentBlockToMpdTag(block, ret);
|
|
|
|
|
2006-07-20 18:02:40 +02:00
|
|
|
if (ret)
|
|
|
|
*vorbisCommentFound = 1;
|
|
|
|
} else if (block->type == FLAC__METADATA_TYPE_STREAMINFO) {
|
|
|
|
if (!ret)
|
|
|
|
ret = newMpdTag();
|
2004-05-31 03:54:10 +02:00
|
|
|
ret->time = ((float)block->data.stream_info.
|
2006-07-20 18:02:40 +02:00
|
|
|
total_samples) /
|
|
|
|
block->data.stream_info.sample_rate + 0.5;
|
2004-05-31 03:54:10 +02:00
|
|
|
}
|
|
|
|
FLAC__metadata_object_delete(block);
|
2006-07-20 18:02:40 +02:00
|
|
|
} while (FLAC__metadata_simple_iterator_next(it));
|
2004-05-31 03:54:10 +02:00
|
|
|
|
|
|
|
FLAC__metadata_simple_iterator_delete(it);
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2006-07-20 18:02:40 +02:00
|
|
|
static MpdTag *flacTagDup(char *file)
|
|
|
|
{
|
|
|
|
MpdTag *ret = NULL;
|
2004-05-31 03:54:10 +02:00
|
|
|
int foundVorbisComment = 0;
|
|
|
|
|
2004-05-31 04:21:06 +02:00
|
|
|
ret = flacMetadataDup(file, &foundVorbisComment);
|
2006-07-20 18:02:40 +02:00
|
|
|
if (!ret) {
|
|
|
|
DEBUG("flacTagDup: Failed to grab information from: %s\n",
|
|
|
|
file);
|
2005-09-08 23:08:02 +02:00
|
|
|
return NULL;
|
|
|
|
}
|
2006-07-20 18:02:40 +02:00
|
|
|
if (!foundVorbisComment) {
|
|
|
|
MpdTag *temp = id3Dup(file);
|
|
|
|
if (temp) {
|
2004-05-31 03:54:10 +02:00
|
|
|
temp->time = ret->time;
|
|
|
|
freeMpdTag(ret);
|
|
|
|
ret = temp;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2006-12-04 05:45:41 +01:00
|
|
|
static int flac_decode(OutputBuffer * cb, DecoderControl * dc,
|
|
|
|
InputStream * inStream)
|
|
|
|
{
|
2006-12-04 05:45:44 +01:00
|
|
|
FLAC__StreamDecoder *flacDec;
|
2006-12-04 05:45:41 +01:00
|
|
|
FlacData data;
|
|
|
|
int ret = 0;
|
|
|
|
|
2006-12-04 05:45:44 +01:00
|
|
|
if (!(flacDec = FLAC__stream_decoder_new()))
|
|
|
|
return -1;
|
2006-12-04 05:45:41 +01:00
|
|
|
init_FlacData(&data, cb, dc, inStream);
|
2006-12-04 05:45:44 +01:00
|
|
|
if (FLAC__stream_decoder_init_stream(flacDec, flacRead, flacSeek,
|
|
|
|
flacTell, flacLength, flacEOF,
|
|
|
|
flacWrite, flacMetadata,
|
|
|
|
flacError, (void *)&data)
|
|
|
|
!= FLAC__STREAM_DECODER_INIT_STATUS_OK) {
|
2006-12-04 05:45:41 +01:00
|
|
|
ERROR("flac problem doing init()\n");
|
2006-12-04 05:45:44 +01:00
|
|
|
flacPrintErroredState(FLAC__stream_decoder_get_state(flacDec));
|
2006-12-04 05:45:41 +01:00
|
|
|
ret = -1;
|
|
|
|
goto fail;
|
|
|
|
}
|
|
|
|
|
2006-12-04 05:45:44 +01:00
|
|
|
if (!FLAC__stream_decoder_process_until_end_of_metadata(flacDec)) {
|
2006-12-04 05:45:41 +01:00
|
|
|
ERROR("flac problem reading metadata\n");
|
2006-12-04 05:45:44 +01:00
|
|
|
flacPrintErroredState(FLAC__stream_decoder_get_state(flacDec));
|
2006-12-04 05:45:41 +01:00
|
|
|
ret = -1;
|
|
|
|
goto fail;
|
|
|
|
}
|
|
|
|
|
|
|
|
dc->state = DECODE_STATE_DECODE;
|
|
|
|
|
|
|
|
while (1) {
|
2006-12-04 05:45:44 +01:00
|
|
|
if (!FLAC__stream_decoder_process_single(flacDec))
|
|
|
|
break;
|
|
|
|
if (FLAC__stream_decoder_get_state(flacDec) ==
|
|
|
|
FLAC__STREAM_DECODER_END_OF_STREAM)
|
2006-12-04 05:45:41 +01:00
|
|
|
break;
|
|
|
|
if (dc->seek) {
|
|
|
|
FLAC__uint64 sampleToSeek = dc->seekWhere *
|
|
|
|
dc->audioFormat.sampleRate + 0.5;
|
2006-12-04 05:45:44 +01:00
|
|
|
if (FLAC__stream_decoder_seek_absolute(flacDec,
|
|
|
|
sampleToSeek))
|
2006-12-04 05:45:41 +01:00
|
|
|
{
|
|
|
|
clearOutputBuffer(cb);
|
|
|
|
data.time = ((float)sampleToSeek) /
|
|
|
|
dc->audioFormat.sampleRate;
|
|
|
|
data.position = 0;
|
|
|
|
} else
|
|
|
|
dc->seekError = 1;
|
|
|
|
dc->seek = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (!dc->stop) {
|
2006-12-04 05:45:44 +01:00
|
|
|
flacPrintErroredState(FLAC__stream_decoder_get_state(flacDec));
|
|
|
|
FLAC__stream_decoder_finish(flacDec);
|
2006-12-04 05:45:41 +01:00
|
|
|
}
|
|
|
|
/* send last little bit */
|
|
|
|
if (data.chunk_length > 0 && !dc->stop) {
|
|
|
|
flacSendChunk(&data);
|
|
|
|
flushOutputBuffer(data.cb);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*if(dc->seek) {
|
|
|
|
dc->seekError = 1;
|
|
|
|
dc->seek = 0;
|
|
|
|
} */
|
|
|
|
|
|
|
|
dc->state = DECODE_STATE_STOP;
|
|
|
|
dc->stop = 0;
|
|
|
|
|
|
|
|
fail:
|
|
|
|
if (data.replayGainInfo)
|
|
|
|
freeReplayGainInfo(data.replayGainInfo);
|
|
|
|
|
|
|
|
if (flacDec)
|
2006-12-04 05:45:44 +01:00
|
|
|
FLAC__stream_decoder_delete(flacDec);
|
2006-12-04 05:45:41 +01:00
|
|
|
|
|
|
|
closeInputStream(inStream);
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2006-07-20 18:02:40 +02:00
|
|
|
static char *flacSuffixes[] = { "flac", NULL };
|
|
|
|
static char *flac_mime_types[] = { "application/x-flac", NULL };
|
2004-05-31 03:54:10 +02:00
|
|
|
|
2006-07-20 18:02:40 +02:00
|
|
|
InputPlugin flacPlugin = {
|
2006-03-16 07:52:46 +01:00
|
|
|
"flac",
|
|
|
|
NULL,
|
2004-05-31 22:59:55 +02:00
|
|
|
NULL,
|
2005-01-30 00:46:06 +01:00
|
|
|
NULL,
|
2006-03-16 07:52:46 +01:00
|
|
|
flac_decode,
|
|
|
|
NULL,
|
|
|
|
flacTagDup,
|
|
|
|
INPUT_PLUGIN_STREAM_URL | INPUT_PLUGIN_STREAM_FILE,
|
|
|
|
flacSuffixes,
|
|
|
|
flac_mime_types
|
2004-05-31 03:54:10 +02:00
|
|
|
};
|
|
|
|
|
2006-07-20 20:53:56 +02:00
|
|
|
#else /* !HAVE_FLAC */
|
2004-05-31 03:54:10 +02:00
|
|
|
|
2006-07-20 18:02:40 +02:00
|
|
|
InputPlugin flacPlugin = {
|
2006-03-16 07:52:46 +01:00
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
0,
|
2004-05-31 22:59:55 +02:00
|
|
|
NULL,
|
|
|
|
NULL,
|
2004-05-31 03:54:10 +02:00
|
|
|
};
|
|
|
|
|
2006-07-20 20:53:56 +02:00
|
|
|
#endif /* HAVE_FLAC */
|