input_stream: removed the InputStream typedef
Everybody should use struct input_stream.
This commit is contained in:
parent
bbaedb17d5
commit
21b8590b53
|
@ -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;
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -21,8 +21,6 @@
|
|||
|
||||
#include <stddef.h>
|
||||
|
||||
typedef struct input_stream InputStream;
|
||||
|
||||
struct input_stream {
|
||||
int ready;
|
||||
|
||||
|
|
Loading…
Reference in New Issue