aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2013-04-22 13:41:10 +0200
committerAnton Khirnov <anton@khirnov.net>2013-11-04 11:02:12 +0100
commitb86d226edd4ca4d16a311482d87020e72d0d354c (patch)
treefe650bd68a42faa8c19bb4ca35daa333ec78d0a6
parent1ce22f8a1053242a2fdfb033ff8a184c2abec191 (diff)
libav decoder plugin: typedef the decoder context
-rw-r--r--src/decoder/libav_decoder_plugin.c30
1 files changed, 15 insertions, 15 deletions
diff --git a/src/decoder/libav_decoder_plugin.c b/src/decoder/libav_decoder_plugin.c
index 5e4f4c65..006d4514 100644
--- a/src/decoder/libav_decoder_plugin.c
+++ b/src/decoder/libav_decoder_plugin.c
@@ -45,6 +45,14 @@
#undef G_LOG_DOMAIN
#define G_LOG_DOMAIN "libav"
+typedef struct LibavDecContext {
+ struct decoder *decoder;
+ struct input_stream *input;
+
+ AVIOContext *io;
+ unsigned char buffer[8192];
+} LibavDecContext;
+
static GLogLevelFlags
level_libav_to_glib(int level)
{
@@ -76,18 +84,10 @@ mpd_libav_log_callback(G_GNUC_UNUSED void *ptr, int level,
}
}
-struct LibavDecContext {
- struct decoder *decoder;
- struct input_stream *input;
-
- AVIOContext *io;
- unsigned char buffer[8192];
-};
-
static int
mpd_libav_stream_read(void *opaque, uint8_t *buf, int size)
{
- struct LibavDecContext *stream = opaque;
+ LibavDecContext *stream = opaque;
return decoder_read(stream->decoder, stream->input,
(void *)buf, size);
@@ -96,7 +96,7 @@ mpd_libav_stream_read(void *opaque, uint8_t *buf, int size)
static int64_t
mpd_libav_stream_seek(void *opaque, int64_t pos, int whence)
{
- struct LibavDecContext *stream = opaque;
+ LibavDecContext *stream = opaque;
if (whence == AVSEEK_SIZE)
return stream->input->size;
@@ -107,10 +107,10 @@ mpd_libav_stream_seek(void *opaque, int64_t pos, int whence)
return stream->input->offset;
}
-static struct LibavDecContext *
+static LibavDecContext *
mpd_libav_stream_open(struct decoder *decoder, struct input_stream *input)
{
- struct LibavDecContext *stream = g_new(struct LibavDecContext, 1);
+ LibavDecContext *stream = g_new(LibavDecContext, 1);
stream->decoder = decoder;
stream->input = input;
stream->io = avio_alloc_context(stream->buffer, sizeof(stream->buffer),
@@ -146,7 +146,7 @@ mpd_libav_open_input(AVFormatContext **ic_ptr,
}
static void
-mpd_libav_stream_close(struct LibavDecContext *stream)
+mpd_libav_stream_close(LibavDecContext *stream)
{
av_free(stream->io);
g_free(stream);
@@ -338,7 +338,7 @@ libav_decode(struct decoder *decoder, struct input_stream *input)
g_debug("detected input format '%s' (%s)",
input_format->name, input_format->long_name);
- struct LibavDecContext *stream =
+ LibavDecContext *stream =
mpd_libav_stream_open(decoder, input);
if (stream == NULL) {
g_warning("Failed to open stream");
@@ -464,7 +464,7 @@ libav_scan_stream(struct input_stream *is,
if (input_format == NULL)
return false;
- struct LibavDecContext *stream = mpd_libav_stream_open(NULL, is);
+ LibavDecContext *stream = mpd_libav_stream_open(NULL, is);
if (stream == NULL)
return false;