diff options
Diffstat (limited to 'src/demuxers/demux_tta.c')
-rw-r--r-- | src/demuxers/demux_tta.c | 75 |
1 files changed, 17 insertions, 58 deletions
diff --git a/src/demuxers/demux_tta.c b/src/demuxers/demux_tta.c index de50ac63d..ce6ddb23a 100644 --- a/src/demuxers/demux_tta.c +++ b/src/demuxers/demux_tta.c @@ -24,12 +24,13 @@ #define LOG_MODULE "demux_tta" #define LOG_VERBOSE -#include "xine_internal.h" -#include "xineutils.h" -#include "demux.h" -#include "buffer.h" +#include <xine/xine_internal.h> +#include <xine/xineutils.h> +#include <xine/demux.h> +#include <xine/buffer.h> #include "bswap.h" #include "group_audio.h" +#include <xine/attributes.h> typedef struct { demux_plugin_t demux_plugin; @@ -54,7 +55,7 @@ typedef struct { uint32_t samplerate; uint32_t data_length; uint32_t crc32; - } __attribute__((__packed__)) tta; + } XINE_PACKED tta; uint8_t buffer[22]; /* This is the size of the header */ } header; } demux_tta_t; @@ -63,16 +64,14 @@ typedef struct { demux_class_t demux_class; } demux_tta_class_t; -#define FOURCC_32(a, b, c, d) (d + (c<<8) + (b<<16) + (a<<24)) - static int open_tta_file(demux_tta_t *this) { - uint8_t peek[4]; + uint32_t peek; uint32_t framelen; - if (_x_demux_read_header(this->input, peek, 4) != 4) + if (_x_demux_read_header(this->input, &peek, 4) != 4) return 0; - if ( !_x_is_fourcc(peek, "TTA1") ) + if ( !_x_is_fourcc(&peek, "TTA1") ) return 0; if ( this->input->read(this->input, this->header.buffer, sizeof(this->header)) != sizeof(this->header) ) @@ -87,7 +86,7 @@ static int open_tta_file(demux_tta_t *this) { return 0; } - this->seektable = calloc(this->totalframes, sizeof(uint32_t)); + this->seektable = xine_xcalloc(this->totalframes, sizeof(uint32_t)); this->input->read(this->input, this->seektable, sizeof(uint32_t)*this->totalframes); /* Skip the CRC32 */ @@ -205,12 +204,6 @@ static int demux_tta_seek (demux_plugin_t *this_gen, return this->status; } -static void demux_tta_dispose (demux_plugin_t *this_gen) { - demux_tta_t *this = (demux_tta_t *) this_gen; - - free(this); -} - static int demux_tta_get_status (demux_plugin_t *this_gen) { demux_tta_t *this = (demux_tta_t *) this_gen; @@ -244,7 +237,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str this->demux_plugin.send_headers = demux_tta_send_headers; this->demux_plugin.send_chunk = demux_tta_send_chunk; this->demux_plugin.seek = demux_tta_seek; - this->demux_plugin.dispose = demux_tta_dispose; + this->demux_plugin.dispose = default_demux_plugin_dispose; this->demux_plugin.get_status = demux_tta_get_status; this->demux_plugin.get_stream_length = demux_tta_get_stream_length; this->demux_plugin.get_capabilities = demux_tta_get_capabilities; @@ -257,19 +250,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str switch (stream->content_detection_method) { - case METHOD_BY_EXTENSION: { - const char *extensions, *mrl; - - mrl = input->get_mrl (input); - extensions = class_gen->get_extensions (class_gen); - - if (!_x_demux_check_extension (mrl, extensions)) { - free (this); - return NULL; - } - } - /* Falling through is intended */ - + case METHOD_BY_MRL: case METHOD_BY_CONTENT: case METHOD_EXPLICIT: if (!open_tta_file(this)) { @@ -286,39 +267,17 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str return &this->demux_plugin; } -static const char *get_description (demux_class_t *this_gen) { - return "True Audio demux plugin"; -} - -static const char *get_identifier (demux_class_t *this_gen) { - return "True Audio"; -} - -static const char *get_extensions (demux_class_t *this_gen) { - return "tta"; -} - -static const char *get_mimetypes (demux_class_t *this_gen) { - return NULL; -} - -static void class_dispose (demux_class_t *this_gen) { - demux_tta_class_t *this = (demux_tta_class_t *) this_gen; - - free (this); -} - void *demux_tta_init_plugin (xine_t *xine, void *data) { demux_tta_class_t *this; this = calloc(1, sizeof(demux_tta_class_t)); this->demux_class.open_plugin = open_plugin; - this->demux_class.get_description = get_description; - this->demux_class.get_identifier = get_identifier; - this->demux_class.get_mimetypes = get_mimetypes; - this->demux_class.get_extensions = get_extensions; - this->demux_class.dispose = class_dispose; + this->demux_class.description = N_("True Audio demux plugin"); + this->demux_class.identifier = "True Audio"; + this->demux_class.mimetypes = NULL; + this->demux_class.extensions = "tta"; + this->demux_class.dispose = default_demux_class_dispose; return this; } |