aboutsummaryrefslogtreecommitdiffstats
path: root/src/decoder
diff options
context:
space:
mode:
Diffstat (limited to 'src/decoder')
-rw-r--r--src/decoder/_flac_common.c2
-rw-r--r--src/decoder/_flac_common.h4
-rw-r--r--src/decoder/_ogg_common.c2
-rw-r--r--src/decoder/_ogg_common.h2
-rw-r--r--src/decoder/aac_plugin.c13
-rw-r--r--src/decoder/ffmpeg_plugin.c17
-rw-r--r--src/decoder/flac_plugin.c14
-rw-r--r--src/decoder/mp3_plugin.c16
-rw-r--r--src/decoder/mp4_plugin.c11
-rw-r--r--src/decoder/mpc_plugin.c7
-rw-r--r--src/decoder/oggvorbis_plugin.c10
-rw-r--r--src/decoder/wavpack_plugin.c15
12 files changed, 65 insertions, 48 deletions
diff --git a/src/decoder/_flac_common.c b/src/decoder/_flac_common.c
index db43e0003..5c160c103 100644
--- a/src/decoder/_flac_common.c
+++ b/src/decoder/_flac_common.c
@@ -26,7 +26,7 @@
#include <FLAC/metadata.h>
void init_FlacData(FlacData * data, struct decoder * decoder,
- InputStream * inStream)
+ struct input_stream *inStream)
{
data->time = 0;
data->position = 0;
diff --git a/src/decoder/_flac_common.h b/src/decoder/_flac_common.h
index 45714b4bd..052074980 100644
--- a/src/decoder/_flac_common.h
+++ b/src/decoder/_flac_common.h
@@ -144,14 +144,14 @@ typedef struct {
float total_time;
FLAC__uint64 position;
struct decoder *decoder;
- InputStream *inStream;
+ struct input_stream *inStream;
ReplayGainInfo *replayGainInfo;
struct tag *tag;
} FlacData;
/* initializes a given FlacData struct */
void init_FlacData(FlacData * data, struct decoder * decoder,
- InputStream * inStream);
+ struct input_stream *inStream);
void flac_metadata_common_cb(const FLAC__StreamMetadata * block,
FlacData * data);
void flac_error_common_cb(const char *plugin,
diff --git a/src/decoder/_ogg_common.c b/src/decoder/_ogg_common.c
index 841b2ad3f..b066712fd 100644
--- a/src/decoder/_ogg_common.c
+++ b/src/decoder/_ogg_common.c
@@ -23,7 +23,7 @@
#include "_flac_common.h"
#include "../utils.h"
-ogg_stream_type ogg_stream_type_detect(InputStream * inStream)
+ogg_stream_type ogg_stream_type_detect(struct input_stream *inStream)
{
/* oggflac detection based on code in ogg123 and this post
* http://lists.xiph.org/pipermail/flac/2004-December/000393.html
diff --git a/src/decoder/_ogg_common.h b/src/decoder/_ogg_common.h
index 7c9e7b630..d03bae301 100644
--- a/src/decoder/_ogg_common.h
+++ b/src/decoder/_ogg_common.h
@@ -26,6 +26,6 @@
typedef enum _ogg_stream_type { VORBIS, FLAC } ogg_stream_type;
-ogg_stream_type ogg_stream_type_detect(InputStream * inStream);
+ogg_stream_type ogg_stream_type_detect(struct input_stream *inStream);
#endif /* _OGG_COMMON_H */
diff --git a/src/decoder/aac_plugin.c b/src/decoder/aac_plugin.c
index 7842bcc22..fec6b1b83 100644
--- a/src/decoder/aac_plugin.c
+++ b/src/decoder/aac_plugin.c
@@ -29,7 +29,7 @@
/* all code here is either based on or copied from FAAD2's frontend code */
typedef struct {
struct decoder *decoder;
- InputStream *inStream;
+ struct input_stream *inStream;
size_t bytesIntoBuffer;
size_t bytesConsumed;
off_t fileOffset;
@@ -174,8 +174,9 @@ static void adtsParse(AacBuffer * b, float *length)
*length = (float)frames / framesPerSec;
}
-static void initAacBuffer(AacBuffer * b,
- struct decoder *decoder, InputStream * inStream)
+static void
+initAacBuffer(AacBuffer * b, struct decoder *decoder,
+ struct input_stream *inStream)
{
memset(b, 0, sizeof(AacBuffer));
@@ -253,7 +254,7 @@ static float getAacFloatTotalTime(char *file)
faacDecConfigurationPtr config;
uint32_t sample_rate;
unsigned char channels;
- InputStream inStream;
+ struct input_stream inStream;
long bread;
if (openInputStream(&inStream, file) < 0)
@@ -301,7 +302,7 @@ static int getAacTotalTime(char *file)
}
static int aac_stream_decode(struct decoder * mpd_decoder,
- InputStream *inStream)
+ struct input_stream *inStream)
{
float file_time;
float totalTime = 0;
@@ -454,7 +455,7 @@ static int aac_decode(struct decoder * mpd_decoder, char *path)
int seekPositionFound = 0; */
uint16_t bitRate = 0;
AacBuffer b;
- InputStream inStream;
+ struct input_stream inStream;
int initialized = 0;
if ((totalTime = getAacFloatTotalTime(path)) < 0)
diff --git a/src/decoder/ffmpeg_plugin.c b/src/decoder/ffmpeg_plugin.c
index 6455cd1ce..d66202efa 100644
--- a/src/decoder/ffmpeg_plugin.c
+++ b/src/decoder/ffmpeg_plugin.c
@@ -45,7 +45,7 @@ typedef struct {
AVCodecContext *aCodecCtx;
AVCodec *aCodec;
struct decoder *decoder;
- InputStream *input;
+ struct input_stream *input;
struct tag *tag;
} BasePtrs;
@@ -54,7 +54,7 @@ typedef struct {
char url[8];
struct decoder *decoder;
- InputStream *input;
+ struct input_stream *input;
} FopsHelper;
/**
@@ -137,8 +137,9 @@ static int ffmpeg_init(void)
return 0;
}
-static int ffmpeg_helper(InputStream *input, int (*callback)(BasePtrs *ptrs),
- BasePtrs *ptrs)
+static int
+ffmpeg_helper(struct input_stream *input, int (*callback)(BasePtrs *ptrs),
+ BasePtrs *ptrs)
{
AVFormatContext *pFormatCtx;
AVCodecContext *aCodecCtx;
@@ -211,7 +212,8 @@ static int ffmpeg_helper(InputStream *input, int (*callback)(BasePtrs *ptrs),
return ret;
}
-static bool ffmpeg_try_decode(InputStream *input)
+static bool
+ffmpeg_try_decode(struct input_stream *input)
{
int ret;
if (input->seekable) {
@@ -320,7 +322,8 @@ static int ffmpeg_decode_internal(BasePtrs *base)
return 0;
}
-static int ffmpeg_decode(struct decoder *decoder, InputStream *input)
+static int
+ffmpeg_decode(struct decoder *decoder, struct input_stream *input)
{
BasePtrs base;
int ret;
@@ -352,7 +355,7 @@ static int ffmpeg_tag_internal(BasePtrs *base)
//no tag reading in ffmpeg, check if playable
static struct tag *ffmpeg_tag(char *file)
{
- InputStream input;
+ struct input_stream input;
BasePtrs base;
int ret;
struct tag *tag = NULL;
diff --git a/src/decoder/flac_plugin.c b/src/decoder/flac_plugin.c
index 7b9fce27d..83d6fef55 100644
--- a/src/decoder/flac_plugin.c
+++ b/src/decoder/flac_plugin.c
@@ -301,8 +301,9 @@ static struct tag *flacTagDup(char *file)
return ret;
}
-static int flac_decode_internal(struct decoder * decoder,
- InputStream * inStream, int is_ogg)
+static int
+flac_decode_internal(struct decoder * decoder, struct input_stream *inStream,
+ int is_ogg)
{
flac_decoder *flacDec;
FlacData data;
@@ -378,7 +379,8 @@ fail:
return 0;
}
-static int flac_decode(struct decoder * decoder, InputStream * inStream)
+static int
+flac_decode(struct decoder * decoder, struct input_stream *inStream)
{
return flac_decode_internal(decoder, inStream, 0);
}
@@ -415,12 +417,14 @@ out:
return ret;
}
-static int oggflac_decode(struct decoder *decoder, InputStream * inStream)
+static int
+oggflac_decode(struct decoder *decoder, struct input_stream *inStream)
{
return flac_decode_internal(decoder, inStream, 1);
}
-static bool oggflac_try_decode(InputStream * inStream)
+static bool
+oggflac_try_decode(struct input_stream *inStream)
{
return FLAC_API_SUPPORTS_OGG_FLAC &&
ogg_stream_type_detect(inStream) == FLAC;
diff --git a/src/decoder/mp3_plugin.c b/src/decoder/mp3_plugin.c
index a0de30ba7..2d458ab97 100644
--- a/src/decoder/mp3_plugin.c
+++ b/src/decoder/mp3_plugin.c
@@ -125,12 +125,12 @@ typedef struct _mp3DecodeData {
int decodedFirstFrame;
unsigned long bitRate;
struct decoder *decoder;
- InputStream *inStream;
+ struct input_stream *inStream;
enum mad_layer layer;
} mp3DecodeData;
static void initMp3DecodeData(mp3DecodeData * data, struct decoder *decoder,
- InputStream * inStream)
+ struct input_stream *inStream)
{
data->muteFrame = MUTEFRAME_NONE;
data->highestFrame = 0;
@@ -753,7 +753,7 @@ static void mp3DecodeDataFinalize(mp3DecodeData * data)
/* this is primarily used for getting total time for tags */
static int getMp3TotalTime(char *file)
{
- InputStream inStream;
+ struct input_stream inStream;
mp3DecodeData data;
int ret;
@@ -770,9 +770,10 @@ static int getMp3TotalTime(char *file)
return ret;
}
-static int openMp3FromInputStream(InputStream * inStream, mp3DecodeData * data,
- struct decoder * decoder, struct tag ** tag,
- ReplayGainInfo ** replayGainInfo)
+static int
+openMp3FromInputStream(struct input_stream *inStream, mp3DecodeData * data,
+ struct decoder *decoder, struct tag **tag,
+ ReplayGainInfo **replayGainInfo)
{
initMp3DecodeData(data, decoder, inStream);
*tag = NULL;
@@ -988,7 +989,8 @@ static void initAudioFormatFromMp3DecodeData(mp3DecodeData * data,
af->channels = MAD_NCHANNELS(&(data->frame).header);
}
-static int mp3_decode(struct decoder * decoder, InputStream * inStream)
+static int
+mp3_decode(struct decoder * decoder, struct input_stream *inStream)
{
mp3DecodeData data;
struct tag *tag = NULL;
diff --git a/src/decoder/mp4_plugin.c b/src/decoder/mp4_plugin.c
index 4a613744e..210f1e5ec 100644
--- a/src/decoder/mp4_plugin.c
+++ b/src/decoder/mp4_plugin.c
@@ -68,15 +68,18 @@ static int mp4_getAACTrack(mp4ff_t * infile)
static uint32_t mp4_inputStreamReadCallback(void *inStream, void *buffer,
uint32_t length)
{
- return readFromInputStream((InputStream *) inStream, buffer, length);
+ return readFromInputStream((struct input_stream *) inStream,
+ buffer, length);
}
static uint32_t mp4_inputStreamSeekCallback(void *inStream, uint64_t position)
{
- return seekInputStream((InputStream *) inStream, position, SEEK_SET);
+ return seekInputStream((struct input_stream *) inStream,
+ position, SEEK_SET);
}
-static int mp4_decode(struct decoder * mpd_decoder, InputStream * inStream)
+static int
+mp4_decode(struct decoder *mpd_decoder, struct input_stream *inStream)
{
mp4ff_t *mp4fh;
mp4ff_callback_t *mp4cb;
@@ -304,7 +307,7 @@ static int mp4_decode(struct decoder * mpd_decoder, InputStream * inStream)
static struct tag *mp4DataDup(char *file, int *mp4MetadataFound)
{
struct tag *ret = NULL;
- InputStream inStream;
+ struct input_stream inStream;
mp4ff_t *mp4fh;
mp4ff_callback_t *callback;
int32_t track;
diff --git a/src/decoder/mpc_plugin.c b/src/decoder/mpc_plugin.c
index fb1b0b56c..e76b56cf9 100644
--- a/src/decoder/mpc_plugin.c
+++ b/src/decoder/mpc_plugin.c
@@ -23,7 +23,7 @@
#include <mpcdec/mpcdec.h>
typedef struct _MpcCallbackData {
- InputStream *inStream;
+ struct input_stream *inStream;
struct decoder *decoder;
} MpcCallbackData;
@@ -94,7 +94,8 @@ static inline int16_t convertSample(MPC_SAMPLE_FORMAT sample)
return val;
}
-static int mpc_decode(struct decoder * mpd_decoder, InputStream * inStream)
+static int
+mpc_decode(struct decoder *mpd_decoder, struct input_stream *inStream)
{
mpc_decoder decoder;
mpc_reader reader;
@@ -240,7 +241,7 @@ static int mpc_decode(struct decoder * mpd_decoder, InputStream * inStream)
static float mpcGetTime(char *file)
{
- InputStream inStream;
+ struct input_stream inStream;
float total_time = -1;
mpc_reader reader;
diff --git a/src/decoder/oggvorbis_plugin.c b/src/decoder/oggvorbis_plugin.c
index 0eecb783f..7fb47cceb 100644
--- a/src/decoder/oggvorbis_plugin.c
+++ b/src/decoder/oggvorbis_plugin.c
@@ -44,7 +44,7 @@
#endif
typedef struct _OggCallbackData {
- InputStream *inStream;
+ struct input_stream *inStream;
struct decoder *decoder;
} OggCallbackData;
@@ -56,7 +56,7 @@ static size_t ogg_read_cb(void *ptr, size_t size, size_t nmemb, void *vdata)
ret = decoder_read(data->decoder, data->inStream, ptr, size * nmemb);
errno = 0;
- /*if(ret<0) errno = ((InputStream *)inStream)->error; */
+ /*if(ret<0) errno = ((struct input_stream *)inStream)->error; */
return ret / size;
}
@@ -200,7 +200,8 @@ static void putOggCommentsIntoOutputBuffer(char *streamName,
}
/* public */
-static int oggvorbis_decode(struct decoder * decoder, InputStream * inStream)
+static int
+oggvorbis_decode(struct decoder *decoder, struct input_stream *inStream)
{
OggVorbis_File vf;
ov_callbacks callbacks;
@@ -360,7 +361,8 @@ static struct tag *oggvorbis_TagDup(char *file)
return ret;
}
-static bool oggvorbis_try_decode(InputStream * inStream)
+static bool
+oggvorbis_try_decode(struct input_stream *inStream)
{
if (!inStream->seekable)
/* we cannot seek after the detection, so don't bother
diff --git a/src/decoder/wavpack_plugin.c b/src/decoder/wavpack_plugin.c
index 14b7e5f69..515eb64ef 100644
--- a/src/decoder/wavpack_plugin.c
+++ b/src/decoder/wavpack_plugin.c
@@ -333,13 +333,13 @@ static struct tag *wavpack_tagdup(char *fname)
}
/*
- * mpd InputStream <=> WavpackStreamReader wrapper callbacks
+ * mpd input_stream <=> WavpackStreamReader wrapper callbacks
*/
/* This struct is needed for per-stream last_byte storage. */
typedef struct {
struct decoder *decoder;
- InputStream *is;
+ struct input_stream *is;
/* Needed for push_back_byte() */
int last_byte;
} InputStreamPlus;
@@ -403,7 +403,7 @@ static WavpackStreamReader mpd_is_reader = {
static void
initInputStreamPlus(InputStreamPlus *isp, struct decoder *decoder,
- InputStream *is)
+ struct input_stream *is)
{
isp->decoder = decoder;
isp->is = is;
@@ -413,7 +413,7 @@ initInputStreamPlus(InputStreamPlus *isp, struct decoder *decoder,
/*
* Tries to decode the specified stream, and gives true if managed to do it.
*/
-static bool wavpack_trydecode(InputStream *is)
+static bool wavpack_trydecode(struct input_stream *is)
{
char error[ERRORLEN];
WavpackContext *wpc;
@@ -433,7 +433,7 @@ static bool wavpack_trydecode(InputStream *is)
}
static int wavpack_open_wvc(struct decoder *decoder,
- InputStream *is_wvc)
+ struct input_stream *is_wvc)
{
char tmp[MPD_PATH_MAX];
const char *utf8url;
@@ -498,11 +498,12 @@ static int wavpack_open_wvc(struct decoder *decoder,
/*
* Decodes a stream.
*/
-static int wavpack_streamdecode(struct decoder * decoder, InputStream *is)
+static int
+wavpack_streamdecode(struct decoder * decoder, struct input_stream *is)
{
char error[ERRORLEN];
WavpackContext *wpc;
- InputStream is_wvc;
+ struct input_stream is_wvc;
int open_flags = OPEN_2CH_MAX | OPEN_NORMALIZE /*| OPEN_STREAMING*/;
InputStreamPlus isp, isp_wvc;