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.c66
1 files changed, 15 insertions, 51 deletions
diff --git a/src/demuxers/demux_tta.c b/src/demuxers/demux_tta.c
index cf3745211..1a2f5ca27 100644
--- a/src/demuxers/demux_tta.c
+++ b/src/demuxers/demux_tta.c
@@ -34,12 +34,13 @@
// http://www.true-audio.com/TTA_Lossless_Audio_Codec_-_Format_Description
#define FRAME_TIME 1.04489795918367346939
-#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;
@@ -75,16 +76,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) )
@@ -99,7 +98,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, (uint8_t*)this->seektable, sizeof(uint32_t)*this->totalframes);
/* Skip the CRC32 */
@@ -301,19 +300,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)) {
@@ -330,40 +317,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 "audio/x-tta: tta: True Audio;"
- "audio/tta: tta: True Audio;";
-}
-
-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;
}