From 54f924caa91b80827a370043436c759bfec6f0de Mon Sep 17 00:00:00 2001 From: Carlo Bramini Date: Thu, 3 Dec 2009 13:03:56 +0100 Subject: Linkage error on minggw+msys when building demux_mpeg: libintl_printf is undefined. --- src/demuxers/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/demuxers') diff --git a/src/demuxers/Makefile.am b/src/demuxers/Makefile.am index bcf812e03..027f6750f 100644 --- a/src/demuxers/Makefile.am +++ b/src/demuxers/Makefile.am @@ -62,7 +62,7 @@ xineplug_dmx_mpeg_block_la_SOURCES = demux_mpeg_block.c xineplug_dmx_mpeg_block_la_LIBADD = $(XINE_LIB) $(LTLIBINTL) xineplug_dmx_mpeg_la_SOURCES = demux_mpeg.c -xineplug_dmx_mpeg_la_LIBADD = $(XINE_LIB) +xineplug_dmx_mpeg_la_LIBADD = $(XINE_LIB) $(LTLIBINTL) xineplug_dmx_mpeg_elem_la_SOURCES = demux_elem.c xineplug_dmx_mpeg_elem_la_LIBADD = $(XINE_LIB) -- cgit v1.2.3 From f9ea010689310758463cc071e42f743553d17edf Mon Sep 17 00:00:00 2001 From: Kelvie Wong Date: Sat, 5 Dec 2009 19:12:21 +0000 Subject: Add mimetypes for the TTA demuxer I've noticed that a lot of the demuxers don't have mimetypes -- Nokia and KDE's Phonon (when using the Xine backend, and consequently this bothers all Amarok users) depend on the mimetypes to see what types of files it can process. This adds support for the True Audio data type, which scratches my itch; I'm sure there are several other demuxers that need a similar change. --- src/demuxers/demux_tta.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/demuxers') diff --git a/src/demuxers/demux_tta.c b/src/demuxers/demux_tta.c index 9edad08bd..2626ca8e8 100644 --- a/src/demuxers/demux_tta.c +++ b/src/demuxers/demux_tta.c @@ -303,7 +303,8 @@ static const char *get_extensions (demux_class_t *this_gen) { } static const char *get_mimetypes (demux_class_t *this_gen) { - return NULL; + return "audio/x-tta: tta: True Audio;" + "audio/tta: tta: True Audio;"; } static void class_dispose (demux_class_t *this_gen) { -- cgit v1.2.3 From d46dc89d77af8947ee6e4e005afbb0b324a9d720 Mon Sep 17 00:00:00 2001 From: Kelvie Wong Date: Sun, 6 Dec 2009 03:12:00 -0800 Subject: Fix a couple of memory leaks. --- src/demuxers/demux_flac.c | 1 + src/demuxers/demux_tta.c | 1 + 2 files changed, 2 insertions(+), 0 deletions(-) --HG-- extra : transplant_source : C%21X%B8%E1p%D2%8E%E0%26%CA%3E%09%8B%09%16%19%C1CQ --- src/demuxers/demux_flac.c | 1 + src/demuxers/demux_tta.c | 1 + 2 files changed, 2 insertions(+) (limited to 'src/demuxers') diff --git a/src/demuxers/demux_flac.c b/src/demuxers/demux_flac.c index 885e440a1..976656016 100644 --- a/src/demuxers/demux_flac.c +++ b/src/demuxers/demux_flac.c @@ -471,6 +471,7 @@ static void demux_flac_dispose (demux_plugin_t *this_gen) { demux_flac_t *this = (demux_flac_t *) this_gen; free(this->seekpoints); + free(this); } static int demux_flac_get_status (demux_plugin_t *this_gen) { diff --git a/src/demuxers/demux_tta.c b/src/demuxers/demux_tta.c index 2626ca8e8..11fcdd387 100644 --- a/src/demuxers/demux_tta.c +++ b/src/demuxers/demux_tta.c @@ -212,6 +212,7 @@ static int demux_tta_seek (demux_plugin_t *this_gen, static void demux_tta_dispose (demux_plugin_t *this_gen) { demux_tta_t *this = (demux_tta_t *) this_gen; + free(this->seektable); free(this); } -- cgit v1.2.3 From 6190e8a7282f7f19816c8b1df742e7fb69b33379 Mon Sep 17 00:00:00 2001 From: Kelvie Wong Date: Sun, 6 Dec 2009 03:12:09 -0800 Subject: Finish implementing the TTA demuxer * Return the correct stream length * Return the current time * Implement seeking --- src/demuxers/demux_tta.c | 47 ++++++++++++++++++++++++++++++++++++++++----- 1 files changed, 41 insertions(+), 6 deletions(-) --HG-- extra : transplant_source : D%27%B7%5C%C4%95Ra%90E%DD%99IG%CF%5D%21%27zN --- src/demuxers/demux_tta.c | 44 +++++++++++++++++++++++++++++++++++++++----- 1 file changed, 39 insertions(+), 5 deletions(-) (limited to 'src/demuxers') diff --git a/src/demuxers/demux_tta.c b/src/demuxers/demux_tta.c index 11fcdd387..d5217477d 100644 --- a/src/demuxers/demux_tta.c +++ b/src/demuxers/demux_tta.c @@ -19,6 +19,8 @@ * * True Audio demuxer by Diego Pettenò * Inspired by tta libavformat demuxer by Alex Beregszaszi + * + * Seek + time support added by Kelvie Wong */ #ifdef HAVE_CONFIG_H @@ -28,6 +30,10 @@ #define LOG_MODULE "demux_tta" #define LOG_VERBOSE +// This is from the TTA spec, the length (in seconds) of a frame +// 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" @@ -47,6 +53,8 @@ typedef struct { uint32_t totalframes; uint32_t currentframe; + off_t datastart; + int status; union { @@ -82,7 +90,7 @@ static int open_tta_file(demux_tta_t *this) { if ( this->input->read(this->input, this->header.buffer, sizeof(this->header)) != sizeof(this->header) ) return 0; - framelen = 1.04489795918367346939 * le2me_32(this->header.tta.samplerate); + framelen = (uint32_t)(FRAME_TIME * le2me_32(this->header.tta.samplerate)); this->totalframes = le2me_32(this->header.tta.data_length) / framelen + ((le2me_32(this->header.tta.data_length) % framelen) ? 1 : 0); this->currentframe = 0; @@ -97,6 +105,9 @@ static int open_tta_file(demux_tta_t *this) { /* Skip the CRC32 */ this->input->seek(this->input, 4, SEEK_CUR); + /* Store the offset after the header for seeking */ + this->datastart = this->input->get_current_pos(this->input); + return 1; } @@ -127,7 +138,7 @@ static int demux_tta_send_chunk(demux_plugin_t *this_gen) { (int) ((double) this->currentframe * 65535 / this->totalframes); /* Set time */ - /* buf->extra_info->input_time = this->current_sample / this->samplerate; */ + buf->extra_info->input_time = (int)(FRAME_TIME * this->currentframe)*1000; bytes_read = this->input->read(this->input, buf->content, ( bytes_to_read > buf->max_size ) ? buf->max_size : bytes_to_read); if (bytes_read < 0) { @@ -196,6 +207,9 @@ static void demux_tta_send_headers(demux_plugin_t *this_gen) { static int demux_tta_seek (demux_plugin_t *this_gen, off_t start_pos, int start_time, int playing) { demux_tta_t *this = (demux_tta_t *) this_gen; + uint32_t start_frame; + uint32_t frame_index; + off_t start_off = this->datastart; /* if thread is not running, initialize demuxer */ if( !playing ) { @@ -203,6 +217,27 @@ static int demux_tta_seek (demux_plugin_t *this_gen, /* send new pts */ _x_demux_control_newpts(this->stream, 0, 0); + this->status = DEMUX_OK; + + } else { + + /* Get the starting frame */ + if( start_pos ) + start_frame = start_pos * this->totalframes / 65535; + else + start_frame = (uint32_t)((double)start_time/ 1000.0 / FRAME_TIME); + + /* Now we find the offset */ + for( frame_index = 0; frame_index < start_frame; frame_index++ ) + start_off += le2me_32(this->seektable[frame_index]); + + /* Let's seek! We store the current frame internally, so let's update that + * as well */ + _x_demux_flush_engine(this->stream); + this->input->seek(this->input, start_off, SEEK_SET); + this->currentframe = start_frame; + _x_demux_control_newpts(this->stream, (int)(FRAME_TIME * start_frame) * 90000, BUF_FLAG_SEEK); + this->status = DEMUX_OK; } @@ -223,9 +258,8 @@ static int demux_tta_get_status (demux_plugin_t *this_gen) { } static int demux_tta_get_stream_length (demux_plugin_t *this_gen) { -// demux_tta_t *this = (demux_tta_t *) this_gen; - - return 0; + demux_tta_t *this = (demux_tta_t *) this_gen; + return (int)(FRAME_TIME * this->totalframes * 1000); } static uint32_t demux_tta_get_capabilities(demux_plugin_t *this_gen) { -- cgit v1.2.3