aboutsummaryrefslogtreecommitdiffstats
path: root/src/decoder
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2010-05-31 09:29:45 +0200
committerMax Kellermann <max@duempel.org>2010-05-31 09:29:45 +0200
commitbe308c6657152ad380f927f221730973c3430fa6 (patch)
tree71836f3d15ed1ee4ad25b184aa0a682fb82617f3 /src/decoder
parent1729a0b4376b75684e25f71165087cb7f8498b58 (diff)
downloadmpd-be308c6657152ad380f927f221730973c3430fa6.tar.gz
mpd-be308c6657152ad380f927f221730973c3430fa6.tar.xz
mpd-be308c6657152ad380f927f221730973c3430fa6.zip
decoder/mp4ff: merge code into mp4ff_input_stream_open()
Diffstat (limited to 'src/decoder')
-rw-r--r--src/decoder/mp4ff_decoder_plugin.c34
1 files changed, 17 insertions, 17 deletions
diff --git a/src/decoder/mp4ff_decoder_plugin.c b/src/decoder/mp4ff_decoder_plugin.c
index 4f4e563b9..97184674e 100644
--- a/src/decoder/mp4ff_decoder_plugin.c
+++ b/src/decoder/mp4ff_decoder_plugin.c
@@ -111,6 +111,19 @@ static const mp4ff_callback_t mpd_mp4ff_callback = {
.seek = mp4_seek,
};
+static mp4ff_t *
+mp4ff_input_stream_open(struct mp4ff_input_stream *mis,
+ struct decoder *decoder,
+ struct input_stream *input_stream)
+{
+ mis->callback = mpd_mp4ff_callback;
+ mis->callback.user_data = mis;
+ mis->decoder = decoder;
+ mis->input_stream = input_stream;
+
+ return mp4ff_open_read(&mis->callback);
+}
+
static faacDecHandle
mp4_faad_new(mp4ff_t *mp4fh, int *track_r, struct audio_format *audio_format)
{
@@ -157,11 +170,7 @@ mp4_faad_new(mp4ff_t *mp4fh, int *track_r, struct audio_format *audio_format)
static void
mp4_decode(struct decoder *mpd_decoder, struct input_stream *input_stream)
{
- struct mp4ff_input_stream mis = {
- .callback = mpd_mp4ff_callback,
- .decoder = mpd_decoder,
- .input_stream = input_stream,
- };
+ struct mp4ff_input_stream mis;
mp4ff_t *mp4fh;
int32_t track;
float file_time, total_time;
@@ -187,9 +196,7 @@ mp4_decode(struct decoder *mpd_decoder, struct input_stream *input_stream)
double seek_where = 0;
enum decoder_command cmd = DECODE_COMMAND_NONE;
- mis.callback.user_data = &mis;
-
- mp4fh = mp4ff_open_read(&mis.callback);
+ mp4fh = mp4ff_input_stream_open(&mis, mpd_decoder, input_stream);
if (!mp4fh) {
g_warning("Input does not appear to be a mp4 stream.\n");
return;
@@ -361,20 +368,13 @@ static struct tag *
mp4_stream_tag(struct input_stream *is)
{
struct tag *ret = NULL;
- struct mp4ff_input_stream mis = {
- .callback = mpd_mp4ff_callback,
- .decoder = NULL,
- .input_stream = is,
- };
- mp4ff_t *mp4fh;
+ struct mp4ff_input_stream mis;
int32_t track;
int32_t file_time;
int32_t scale;
int i;
- mis.callback.user_data = &mis;
-
- mp4fh = mp4ff_open_read(&mis.callback);
+ mp4ff_t *mp4fh = mp4ff_input_stream_open(&mis, NULL, is);
if (mp4fh == NULL)
return NULL;