aboutsummaryrefslogtreecommitdiffstats
path: root/src/decoder
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-11-04 17:05:00 +0100
committerMax Kellermann <max@duempel.org>2008-11-04 17:05:00 +0100
commit9ecfc57c3ae9a1635ec51aa6a5d2f13d9f98185c (patch)
tree10d26baa05a7b63611e52a47bdb4683e6e9569c7 /src/decoder
parent632dc7c96b6692129846817a1338770e83587ac7 (diff)
downloadmpd-9ecfc57c3ae9a1635ec51aa6a5d2f13d9f98185c.tar.gz
mpd-9ecfc57c3ae9a1635ec51aa6a5d2f13d9f98185c.tar.xz
mpd-9ecfc57c3ae9a1635ec51aa6a5d2f13d9f98185c.zip
mp4: pass struct mp4_context to the mp4ff_callback_t methods
We need the decoder object, so we have to begin passing a new struct to these callbacks, instead of only the pointer to the input_stream object.
Diffstat (limited to '')
-rw-r--r--src/decoder/mp4_plugin.c28
1 files changed, 18 insertions, 10 deletions
diff --git a/src/decoder/mp4_plugin.c b/src/decoder/mp4_plugin.c
index 5d3aa78e4..996c19fdf 100644
--- a/src/decoder/mp4_plugin.c
+++ b/src/decoder/mp4_plugin.c
@@ -28,6 +28,10 @@
/* all code here is either based on or copied from FAAD2's frontend code */
+struct mp4_context {
+ struct input_stream *input_stream;
+};
+
static int
mp4_get_aac_track(mp4ff_t * infile)
{
@@ -71,25 +75,30 @@ mp4_get_aac_track(mp4ff_t * infile)
static uint32_t
mp4_read(void *user_data, void *buffer, uint32_t length)
{
- return input_stream_read((struct input_stream *) user_data,
- buffer, length);
+ struct mp4_context *ctx = user_data;
+
+ return input_stream_read(ctx->input_stream, buffer, length);
}
static uint32_t
mp4_seek(void *user_data, uint64_t position)
{
- return input_stream_seek((struct input_stream *) user_data,
- position, SEEK_SET)
+ struct mp4_context *ctx = user_data;
+
+ return input_stream_seek(ctx->input_stream, position, SEEK_SET)
? 0 : -1;
}
static bool
mp4_decode(struct decoder *mpd_decoder, struct input_stream *input_stream)
{
+ struct mp4_context ctx = {
+ .input_stream = input_stream,
+ };
mp4ff_callback_t callback = {
.read = mp4_read,
.seek = mp4_seek,
- .user_data = input_stream,
+ .user_data = &ctx,
};
mp4ff_t *mp4fh;
int32_t track;
@@ -119,10 +128,6 @@ mp4_decode(struct decoder *mpd_decoder, struct input_stream *input_stream)
double seek_where = 0;
bool initialized = false;
- callback.read = mp4_read;
- callback.seek = mp4_seek;
- callback.user_data = input_stream;
-
mp4fh = mp4ff_open_read(&callback);
if (!mp4fh) {
g_warning("Input does not appear to be a mp4 stream.\n");
@@ -307,10 +312,13 @@ mp4_load_tag(const char *file)
{
struct tag *ret = NULL;
struct input_stream input_stream;
+ struct mp4_context ctx = {
+ .input_stream = &input_stream,
+ };
mp4ff_callback_t callback = {
.read = mp4_read,
.seek = mp4_seek,
- .user_data = &input_stream,
+ .user_data = &ctx,
};
mp4ff_t *mp4fh;
int32_t track;