From b86d226edd4ca4d16a311482d87020e72d0d354c Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Mon, 22 Apr 2013 13:41:10 +0200 Subject: libav decoder plugin: typedef the decoder context --- src/decoder/libav_decoder_plugin.c | 30 +++++++++++++++--------------- 1 file 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; -- cgit v1.2.3