summaryrefslogtreecommitdiff
path: root/src/demuxers/demux_tta.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/demuxers/demux_tta.c')
-rw-r--r--src/demuxers/demux_tta.c67
1 files changed, 13 insertions, 54 deletions
diff --git a/src/demuxers/demux_tta.c b/src/demuxers/demux_tta.c
index f6eadd652..2a8af09bb 100644
--- a/src/demuxers/demux_tta.c
+++ b/src/demuxers/demux_tta.c
@@ -30,6 +30,7 @@
#include "buffer.h"
#include "bswap.h"
#include "group_audio.h"
+#include "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_BE_32(peek) != FOURCC_32('T', 'T', 'A', '1') )
+ if ( peek != ME_FOURCC('T', 'T', 'A', '1') )
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 = xine_xmalloc(sizeof(uint32_t)*this->totalframes);
+ this->seektable = xine_xcalloc(this->totalframes, sizeof(uint32_t));
this->input->read(this->input, this->seektable, sizeof(uint32_t)*this->totalframes);
/* Skip the CRC32 */
@@ -201,12 +200,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;
@@ -240,7 +233,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;
@@ -253,19 +246,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)) {
@@ -282,39 +263,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 = xine_xmalloc (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;
}