aboutsummaryrefslogtreecommitdiffstats
path: root/src/decoder
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-10-26 20:34:47 +0100
committerMax Kellermann <max@duempel.org>2008-10-26 20:34:47 +0100
commitdbc7e9ba2f57c71a9b73cd6d035ba2906190be72 (patch)
tree0f9a55ed4a533d4daf266f6748acb30830a6f095 /src/decoder
parent97a9c7a8e094f830e70fdb479425c96e182f8b5e (diff)
downloadmpd-dbc7e9ba2f57c71a9b73cd6d035ba2906190be72.tar.gz
mpd-dbc7e9ba2f57c71a9b73cd6d035ba2906190be72.tar.xz
mpd-dbc7e9ba2f57c71a9b73cd6d035ba2906190be72.zip
input_stream: no CamelCase
Renamed all functions and variables.
Diffstat (limited to '')
-rw-r--r--src/decoder/_ogg_common.c4
-rw-r--r--src/decoder/aac_plugin.c10
-rw-r--r--src/decoder/ffmpeg_plugin.c12
-rw-r--r--src/decoder/flac_plugin.c6
-rw-r--r--src/decoder/mp3_plugin.c40
-rw-r--r--src/decoder/mp4_plugin.c14
-rw-r--r--src/decoder/mpc_plugin.c8
-rw-r--r--src/decoder/oggflac_plugin.c12
-rw-r--r--src/decoder/oggvorbis_plugin.c4
-rw-r--r--src/decoder/wavpack_plugin.c20
-rw-r--r--src/decoder_api.c6
-rw-r--r--src/decoder_thread.c10
12 files changed, 73 insertions, 73 deletions
diff --git a/src/decoder/_ogg_common.c b/src/decoder/_ogg_common.c
index b066712fd..92408984a 100644
--- a/src/decoder/_ogg_common.c
+++ b/src/decoder/_ogg_common.c
@@ -31,12 +31,12 @@ ogg_stream_type ogg_stream_type_detect(struct input_stream *inStream)
unsigned char buf[41];
size_t r;
- seekInputStream(inStream, 0, SEEK_SET);
+ input_stream_seek(inStream, 0, SEEK_SET);
r = decoder_read(NULL, inStream, buf, sizeof(buf));
if (r > 0)
- seekInputStream(inStream, 0, SEEK_SET);
+ input_stream_seek(inStream, 0, SEEK_SET);
if (r >= 32 && memcmp(buf, "OggS", 4) == 0 && (
(memcmp(buf+29, "FLAC", 4) == 0
diff --git a/src/decoder/aac_plugin.c b/src/decoder/aac_plugin.c
index fec6b1b83..017844201 100644
--- a/src/decoder/aac_plugin.c
+++ b/src/decoder/aac_plugin.c
@@ -67,7 +67,7 @@ static void fillAacBuffer(AacBuffer * b)
bread = decoder_read(b->decoder, b->inStream,
(void *)(b->buffer + b->bytesIntoBuffer),
rest);
- if (bread == 0 && inputStreamAtEOF(b->inStream))
+ if (bread == 0 && input_stream_eof(b->inStream))
b->atEof = 1;
b->bytesIntoBuffer += bread;
}
@@ -215,7 +215,7 @@ static void aac_parse_header(AacBuffer * b, float *length)
if (b->bytesIntoBuffer >= 2 &&
(b->buffer[0] == 0xFF) && ((b->buffer[1] & 0xF6) == 0xF0)) {
adtsParse(b, length);
- seekInputStream(b->inStream, tagsize, SEEK_SET);
+ input_stream_seek(b->inStream, tagsize, SEEK_SET);
b->bytesIntoBuffer = 0;
b->bytesConsumed = 0;
@@ -257,7 +257,7 @@ static float getAacFloatTotalTime(char *file)
struct input_stream inStream;
long bread;
- if (openInputStream(&inStream, file) < 0)
+ if (input_stream_open(&inStream, file) < 0)
return -1;
initAacBuffer(&b, NULL, &inStream);
@@ -285,7 +285,7 @@ static float getAacFloatTotalTime(char *file)
if (b.buffer)
free(b.buffer);
- closeInputStream(&inStream);
+ input_stream_close(&inStream);
return length;
}
@@ -461,7 +461,7 @@ static int aac_decode(struct decoder * mpd_decoder, char *path)
if ((totalTime = getAacFloatTotalTime(path)) < 0)
return -1;
- if (openInputStream(&inStream, path) < 0)
+ if (input_stream_open(&inStream, path) < 0)
return -1;
initAacBuffer(&b, mpd_decoder, &inStream);
diff --git a/src/decoder/ffmpeg_plugin.c b/src/decoder/ffmpeg_plugin.c
index d66202efa..bc0ffe221 100644
--- a/src/decoder/ffmpeg_plugin.c
+++ b/src/decoder/ffmpeg_plugin.c
@@ -85,10 +85,10 @@ static int mpdurl_read(URLContext *h, unsigned char *buf, int size)
int ret;
FopsHelper *base = (FopsHelper *) h->priv_data;
while (1) {
- ret = readFromInputStream(base->input, (void *)buf, size);
+ ret = input_stream_read(base->input, (void *)buf, size);
if (ret == 0) {
DEBUG("ret 0\n");
- if (inputStreamAtEOF(base->input) ||
+ if (input_stream_eof(base->input) ||
(base->decoder &&
decoder_get_command(base->decoder) != DECODE_COMMAND_NONE)) {
DEBUG("eof stream\n");
@@ -107,7 +107,7 @@ static int64_t mpdurl_seek(URLContext *h, int64_t pos, int whence)
{
FopsHelper *base = (FopsHelper *) h->priv_data;
if (whence != AVSEEK_SIZE) { //only ftell
- (void) seekInputStream(base->input, pos, whence);
+ (void) input_stream_seek(base->input, pos, whence);
}
return base->input->offset;
}
@@ -116,7 +116,7 @@ static int mpdurl_close(URLContext *h)
{
FopsHelper *base = (FopsHelper *) h->priv_data;
if (base && base->input->seekable) {
- (void) seekInputStream(base->input, 0, SEEK_SET);
+ (void) input_stream_seek(base->input, 0, SEEK_SET);
}
h->priv_data = 0;
return 0;
@@ -360,7 +360,7 @@ static struct tag *ffmpeg_tag(char *file)
int ret;
struct tag *tag = NULL;
- if (openInputStream(&input, file) < 0) {
+ if (input_stream_open(&input, file) < 0) {
ERROR("failed to open %s\n", file);
return NULL;
}
@@ -375,7 +375,7 @@ static struct tag *ffmpeg_tag(char *file)
tag = NULL;
}
- closeInputStream(&input);
+ input_stream_close(&input);
return tag;
}
diff --git a/src/decoder/flac_plugin.c b/src/decoder/flac_plugin.c
index 83d6fef55..f65fef9b9 100644
--- a/src/decoder/flac_plugin.c
+++ b/src/decoder/flac_plugin.c
@@ -37,7 +37,7 @@ static flac_read_status flacRead(mpd_unused const flac_decoder * flacDec,
if (r == 0) {
if (decoder_get_command(data->decoder) != DECODE_COMMAND_NONE ||
- inputStreamAtEOF(data->inStream))
+ input_stream_eof(data->inStream))
return flac_read_status_eof;
else
return flac_read_status_abort;
@@ -52,7 +52,7 @@ static flac_seek_status flacSeek(mpd_unused const flac_decoder * flacDec,
{
FlacData *data = (FlacData *) fdata;
- if (seekInputStream(data->inStream, offset, SEEK_SET) < 0) {
+ if (input_stream_seek(data->inStream, offset, SEEK_SET) < 0) {
return flac_seek_status_error;
}
@@ -87,7 +87,7 @@ static FLAC__bool flacEOF(mpd_unused const flac_decoder * flacDec, void *fdata)
return (decoder_get_command(data->decoder) != DECODE_COMMAND_NONE &&
decoder_get_command(data->decoder) != DECODE_COMMAND_SEEK) ||
- inputStreamAtEOF(data->inStream);
+ input_stream_eof(data->inStream);
}
static void flacError(mpd_unused const flac_decoder *dec,
diff --git a/src/decoder/mp3_plugin.c b/src/decoder/mp3_plugin.c
index 2d458ab97..a3b8c5a5a 100644
--- a/src/decoder/mp3_plugin.c
+++ b/src/decoder/mp3_plugin.c
@@ -158,7 +158,7 @@ static void initMp3DecodeData(mp3DecodeData * data, struct decoder *decoder,
static int seekMp3InputBuffer(mp3DecodeData * data, long offset)
{
- if (seekInputStream(data->inStream, offset, SEEK_SET) < 0) {
+ if (input_stream_seek(data->inStream, offset, SEEK_SET) < 0) {
return -1;
}
@@ -757,7 +757,7 @@ static int getMp3TotalTime(char *file)
mp3DecodeData data;
int ret;
- if (openInputStream(&inStream, file) < 0)
+ if (input_stream_open(&inStream, file) < 0)
return -1;
initMp3DecodeData(&data, NULL, &inStream);
if (decodeFirstFrame(&data, NULL, NULL) < 0)
@@ -765,7 +765,7 @@ static int getMp3TotalTime(char *file)
else
ret = data.totalTime + 0.5;
mp3DecodeDataFinalize(&data);
- closeInputStream(&inStream);
+ input_stream_close(&inStream);
return ret;
}
@@ -854,16 +854,16 @@ mp3Read(mp3DecodeData * data, ReplayGainInfo ** replayGainInfo)
return DECODE_BREAK;
}
- if (data->inStream->metaTitle) {
+ if (data->inStream->meta_title) {
struct tag *tag = tag_new();
- if (data->inStream->metaName) {
+ if (data->inStream->meta_name) {
tag_add_item(tag, TAG_ITEM_NAME,
- data->inStream->metaName);
+ data->inStream->meta_name);
}
tag_add_item(tag, TAG_ITEM_TITLE,
- data->inStream->metaTitle);
- free(data->inStream->metaTitle);
- data->inStream->metaTitle = NULL;
+ data->inStream->meta_title);
+ free(data->inStream->meta_title);
+ data->inStream->meta_title = NULL;
tag_free(tag);
}
@@ -1009,27 +1009,27 @@ mp3_decode(struct decoder * decoder, struct input_stream *inStream)
initAudioFormatFromMp3DecodeData(&data, &audio_format);
- if (inStream->metaTitle) {
+ if (inStream->meta_title) {
if (tag)
tag_free(tag);
tag = tag_new();
- tag_add_item(tag, TAG_ITEM_TITLE, inStream->metaTitle);
- free(inStream->metaTitle);
- inStream->metaTitle = NULL;
- if (inStream->metaName) {
- tag_add_item(tag, TAG_ITEM_NAME, inStream->metaName);
+ tag_add_item(tag, TAG_ITEM_TITLE, inStream->meta_title);
+ free(inStream->meta_title);
+ inStream->meta_title = NULL;
+ if (inStream->meta_name) {
+ tag_add_item(tag, TAG_ITEM_NAME, inStream->meta_name);
}
tag_free(tag);
} else if (tag) {
- if (inStream->metaName) {
+ if (inStream->meta_name) {
tag_clear_items_by_type(tag, TAG_ITEM_NAME);
- tag_add_item(tag, TAG_ITEM_NAME, inStream->metaName);
+ tag_add_item(tag, TAG_ITEM_NAME, inStream->meta_name);
}
tag_free(tag);
- } else if (inStream->metaName) {
+ } else if (inStream->meta_name) {
tag = tag_new();
- if (inStream->metaName) {
- tag_add_item(tag, TAG_ITEM_NAME, inStream->metaName);
+ if (inStream->meta_name) {
+ tag_add_item(tag, TAG_ITEM_NAME, inStream->meta_name);
}
tag_free(tag);
}
diff --git a/src/decoder/mp4_plugin.c b/src/decoder/mp4_plugin.c
index 210f1e5ec..b5197bb3b 100644
--- a/src/decoder/mp4_plugin.c
+++ b/src/decoder/mp4_plugin.c
@@ -68,13 +68,13 @@ static int mp4_getAACTrack(mp4ff_t * infile)
static uint32_t mp4_inputStreamReadCallback(void *inStream, void *buffer,
uint32_t length)
{
- return readFromInputStream((struct input_stream *) inStream,
+ return input_stream_read((struct input_stream *) inStream,
buffer, length);
}
static uint32_t mp4_inputStreamSeekCallback(void *inStream, uint64_t position)
{
- return seekInputStream((struct input_stream *) inStream,
+ return input_stream_seek((struct input_stream *) inStream,
position, SEEK_SET);
}
@@ -317,7 +317,7 @@ static struct tag *mp4DataDup(char *file, int *mp4MetadataFound)
*mp4MetadataFound = 0;
- if (openInputStream(&inStream, file) < 0) {
+ if (input_stream_open(&inStream, file) < 0) {
DEBUG("mp4DataDup: Failed to open file: %s\n", file);
return NULL;
}
@@ -330,14 +330,14 @@ static struct tag *mp4DataDup(char *file, int *mp4MetadataFound)
mp4fh = mp4ff_open_read(callback);
if (!mp4fh) {
free(callback);
- closeInputStream(&inStream);
+ input_stream_close(&inStream);
return NULL;
}
track = mp4_getAACTrack(mp4fh);
if (track < 0) {
mp4ff_close(mp4fh);
- closeInputStream(&inStream);
+ input_stream_close(&inStream);
free(callback);
return NULL;
}
@@ -347,7 +347,7 @@ static struct tag *mp4DataDup(char *file, int *mp4MetadataFound)
scale = mp4ff_time_scale(mp4fh, track);
if (scale < 0) {
mp4ff_close(mp4fh);
- closeInputStream(&inStream);
+ input_stream_close(&inStream);
free(callback);
tag_free(ret);
return NULL;
@@ -388,7 +388,7 @@ static struct tag *mp4DataDup(char *file, int *mp4MetadataFound)
}
mp4ff_close(mp4fh);
- closeInputStream(&inStream);
+ input_stream_close(&inStream);
return ret;
}
diff --git a/src/decoder/mpc_plugin.c b/src/decoder/mpc_plugin.c
index e76b56cf9..7d792f429 100644
--- a/src/decoder/mpc_plugin.c
+++ b/src/decoder/mpc_plugin.c
@@ -38,7 +38,7 @@ static mpc_bool_t mpc_seek_cb(void *vdata, mpc_int32_t offset)
{
MpcCallbackData *data = (MpcCallbackData *) vdata;
- return seekInputStream(data->inStream, offset, SEEK_SET) < 0 ? 0 : 1;
+ return input_stream_seek(data->inStream, offset, SEEK_SET) < 0 ? 0 : 1;
}
static mpc_int32_t mpc_tell_cb(void *vdata)
@@ -260,19 +260,19 @@ static float mpcGetTime(char *file)
mpc_streaminfo_init(&info);
- if (openInputStream(&inStream, file) < 0) {
+ if (input_stream_open(&inStream, file) < 0) {
DEBUG("mpcGetTime: Failed to open file: %s\n", file);
return -1;
}
if (mpc_streaminfo_read(&info, &reader) != ERROR_CODE_OK) {
- closeInputStream(&inStream);
+ input_stream_close(&inStream);
return -1;
}
total_time = mpc_streaminfo_get_length(&info);
- closeInputStream(&inStream);
+ input_stream_close(&inStream);
return total_time;
}
diff --git a/src/decoder/oggflac_plugin.c b/src/decoder/oggflac_plugin.c
index 091b00988..47a66f6f5 100644
--- a/src/decoder/oggflac_plugin.c
+++ b/src/decoder/oggflac_plugin.c
@@ -49,7 +49,7 @@ static OggFLAC__SeekableStreamDecoderReadStatus of_read_cb(mpd_unused const
r = decoder_read(data->decoder, data->inStream, (void *)buf, *bytes);
*bytes = r;
- if (r == 0 && !inputStreamAtEOF(data->inStream) &&
+ if (r == 0 && !input_stream_eof(data->inStream) &&
decoder_get_command(data->decoder) == DECODE_COMMAND_NONE)
return OggFLAC__SEEKABLE_STREAM_DECODER_READ_STATUS_ERROR;
@@ -64,7 +64,7 @@ static OggFLAC__SeekableStreamDecoderSeekStatus of_seek_cb(mpd_unused const
{
FlacData *data = (FlacData *) fdata;
- if (seekInputStream(data->inStream, offset, SEEK_SET) < 0) {
+ if (input_stream_seek(data->inStream, offset, SEEK_SET) < 0) {
return OggFLAC__SEEKABLE_STREAM_DECODER_SEEK_STATUS_ERROR;
}
@@ -105,7 +105,7 @@ static FLAC__bool of_EOF_cb(mpd_unused const OggFLAC__SeekableStreamDecoder * de
return (decoder_get_command(data->decoder) != DECODE_COMMAND_NONE &&
decoder_get_command(data->decoder) != DECODE_COMMAND_SEEK) ||
- inputStreamAtEOF(data->inStream);
+ input_stream_eof(data->inStream);
}
static void of_error_cb(mpd_unused const OggFLAC__SeekableStreamDecoder * decoder,
@@ -261,10 +261,10 @@ static struct tag *oggflac_TagDup(char *file)
OggFLAC__SeekableStreamDecoder *decoder;
FlacData data;
- if (openInputStream(&inStream, file) < 0)
+ if (input_stream_open(&inStream, file) < 0)
return NULL;
if (ogg_stream_type_detect(&inStream) != FLAC) {
- closeInputStream(&inStream);
+ input_stream_close(&inStream);
return NULL;
}
@@ -275,7 +275,7 @@ static struct tag *oggflac_TagDup(char *file)
decoder = full_decoder_init_and_read_metadata(&data, 1);
oggflac_cleanup(&data, decoder);
- closeInputStream(&inStream);
+ input_stream_close(&inStream);
return data.tag;
}
diff --git a/src/decoder/oggvorbis_plugin.c b/src/decoder/oggvorbis_plugin.c
index 7fb47cceb..0eb0380f4 100644
--- a/src/decoder/oggvorbis_plugin.c
+++ b/src/decoder/oggvorbis_plugin.c
@@ -66,7 +66,7 @@ static int ogg_seek_cb(void *vdata, ogg_int64_t offset, int whence)
const OggCallbackData *data = (const OggCallbackData *) vdata;
if(decoder_get_command(data->decoder) == DECODE_COMMAND_STOP)
return -1;
- return seekInputStream(data->inStream, offset, whence);
+ return input_stream_seek(data->inStream, offset, whence);
}
/* TODO: check Ogg libraries API and see if we can just not have this func */
@@ -284,7 +284,7 @@ oggvorbis_decode(struct decoder *decoder, struct input_stream *inStream)
initialized = 1;
}
comments = ov_comment(&vf, -1)->user_comments;
- putOggCommentsIntoOutputBuffer(inStream->metaName,
+ putOggCommentsIntoOutputBuffer(inStream->meta_name,
comments);
ogg_getReplayGainInfo(comments, &replayGainInfo);
}
diff --git a/src/decoder/wavpack_plugin.c b/src/decoder/wavpack_plugin.c
index 515eb64ef..7a0a2249f 100644
--- a/src/decoder/wavpack_plugin.c
+++ b/src/decoder/wavpack_plugin.c
@@ -366,12 +366,12 @@ static uint32_t get_pos(void *id)
static int set_pos_abs(void *id, uint32_t pos)
{
- return seekInputStream(((InputStreamPlus *)id)->is, pos, SEEK_SET);
+ return input_stream_seek(((InputStreamPlus *)id)->is, pos, SEEK_SET);
}
static int set_pos_rel(void *id, int32_t delta, int mode)
{
- return seekInputStream(((InputStreamPlus *)id)->is, delta, mode);
+ return input_stream_seek(((InputStreamPlus *)id)->is, delta, mode);
}
static int push_back_byte(void *id, int c)
@@ -427,7 +427,7 @@ static bool wavpack_trydecode(struct input_stream *is)
WavpackCloseFile(wpc);
/* Seek it back in order to play from the first byte. */
- seekInputStream(is, 0, SEEK_SET);
+ input_stream_seek(is, 0, SEEK_SET);
return true;
}
@@ -461,7 +461,7 @@ static int wavpack_open_wvc(struct decoder *decoder,
wvc_url[len] = 'c';
wvc_url[len + 1] = '\0';
- ret = openInputStream(is_wvc, wvc_url);
+ ret = input_stream_open(is_wvc, wvc_url);
free(wvc_url);
if (ret)
@@ -472,21 +472,21 @@ static int wavpack_open_wvc(struct decoder *decoder,
* about a possible 404 error.
*/
for (;;) {
- if (inputStreamAtEOF(is_wvc)) {
+ if (input_stream_eof(is_wvc)) {
/*
* EOF is reached even without
* a single byte is read...
* So, this is not good :/
*/
- closeInputStream(is_wvc);
+ input_stream_close(is_wvc);
return 0;
}
- if (bufferInputStream(is_wvc) >= 0)
+ if (input_stream_buffer(is_wvc) >= 0)
return 1;
if (decoder_get_command(decoder) != DECODE_COMMAND_NONE) {
- closeInputStream(is_wvc);
+ input_stream_close(is_wvc);
return 0;
}
@@ -525,8 +525,8 @@ wavpack_streamdecode(struct decoder * decoder, struct input_stream *is)
WavpackCloseFile(wpc);
if (open_flags & OPEN_WVC)
- closeInputStream(&is_wvc);
- closeInputStream(is);
+ input_stream_close(&is_wvc);
+ input_stream_close(is);
return 0;
}
diff --git a/src/decoder_api.c b/src/decoder_api.c
index f20dbf42d..27994d300 100644
--- a/src/decoder_api.c
+++ b/src/decoder_api.c
@@ -115,8 +115,8 @@ size_t decoder_read(struct decoder *decoder,
dc.command != DECODE_COMMAND_NONE)
return 0;
- nbytes = readFromInputStream(inStream, buffer, length);
- if (nbytes > 0 || inputStreamAtEOF(inStream))
+ nbytes = input_stream_read(inStream, buffer, length);
+ if (nbytes > 0 || input_stream_eof(inStream))
return nbytes;
/* sleep for a fraction of a second! */
@@ -145,7 +145,7 @@ need_chunks(struct decoder *decoder,
}
if (!inStream ||
- bufferInputStream(inStream) <= 0) {
+ input_stream_buffer(inStream) <= 0) {
notify_wait(&dc.notify);
notify_signal(&pc.notify);
}
diff --git a/src/decoder_thread.c b/src/decoder_thread.c
index d6171a5fe..3c56dfbcb 100644
--- a/src/decoder_thread.c
+++ b/src/decoder_thread.c
@@ -43,7 +43,7 @@ static void decodeStart(void)
song_get_url(song, path_max_fs);
dc.current_song = dc.next_song; /* NEED LOCK */
- if (openInputStream(&inStream, path_max_fs) < 0) {
+ if (input_stream_open(&inStream, path_max_fs) < 0) {
dc.error = DECODE_ERROR_FILE;
goto stop_no_close;
}
@@ -61,12 +61,12 @@ static void decodeStart(void)
if (dc.command != DECODE_COMMAND_NONE)
goto stop;
- ret = bufferInputStream(&inStream);
+ ret = input_stream_buffer(&inStream);
if (ret < 0)
goto stop;
}
- /* for http streams, seekable is determined in bufferInputStream */
+ /* for http streams, seekable is determined in input_stream_buffer */
dc.seekable = inStream.seekable;
if (dc.command == DECODE_COMMAND_STOP)
@@ -132,7 +132,7 @@ static void decodeStart(void)
continue;
if (plugin->file_decode != NULL) {
- closeInputStream(&inStream);
+ input_stream_close(&inStream);
close_instream = false;
decoder.plugin = plugin;
ret = plugin->file_decode(&decoder,
@@ -156,7 +156,7 @@ static void decodeStart(void)
stop:
if (close_instream)
- closeInputStream(&inStream);
+ input_stream_close(&inStream);
stop_no_close:
dc.state = DECODE_STATE_STOP;
dc.command = DECODE_COMMAND_NONE;