From 5eafe2906b8b141be1a8b5069814cd3beefa8ed8 Mon Sep 17 00:00:00 2001 From: Petri Hintukainen Date: Tue, 27 Sep 2011 15:05:41 +0300 Subject: demux_ts: removed sending of preview/header buffers. Now all used decoders work without header/preview buffers. --- src/demuxers/demux_ts.c | 46 +--------------------------------------------- 1 file changed, 1 insertion(+), 45 deletions(-) (limited to 'src') diff --git a/src/demuxers/demux_ts.c b/src/demuxers/demux_ts.c index b5bf2309d..c606d52a8 100644 --- a/src/demuxers/demux_ts.c +++ b/src/demuxers/demux_ts.c @@ -270,7 +270,6 @@ typedef struct { int64_t pts; buf_element_t *buf; unsigned int counter; - unsigned int numPreview; uint16_t descriptor_tag; /* +0x100 for PES stream IDs (no available TS descriptor tag?) */ int corrupted_pes; uint32_t buffered_bytes; @@ -952,15 +951,6 @@ static int demux_ts_parse_pes_header (xine_t *xine, demux_ts_media *m, return 0 ; } - -/* - * Track how many of these types of packets we have seen in this stream. - */ -static inline unsigned get_preview_frame_number(unsigned *numPreview, unsigned limit) { - unsigned preview = *numPreview; - return (preview < limit) ? ++(*numPreview) : preview; -} - /* * buffer arriving pes data */ @@ -992,44 +982,11 @@ static void demux_ts_buffer_pes(demux_ts_t*this, unsigned char *ts, if (pus) { /* new PES packet */ if (m->buffered_bytes) { - unsigned previewLimit = 0; m->buf->content = m->buf->mem; m->buf->size = m->buffered_bytes; m->buf->type = m->type; - - switch (m->type & BUF_MAJOR_MASK) { - case BUF_SPU_BASE: - if( (m->buf->type & (BUF_MAJOR_MASK | BUF_DECODER_MASK)) == BUF_SPU_DVB ) { - /* TODO: DVBSUB handling needed? */ - } - break; - - case BUF_VIDEO_BASE: - previewLimit = 5; - break; - - case BUF_AUDIO_BASE: - previewLimit = 2; - break; - - default: - break; - } - - if (previewLimit != 0) { - unsigned numPreview; - - numPreview = get_preview_frame_number(&m->numPreview, previewLimit); - - if (numPreview == 1) - m->buf->decoder_flags = BUF_FLAG_HEADER | BUF_FLAG_FRAME_END; - else if (numPreview < previewLimit) - m->buf->decoder_flags = BUF_FLAG_PREVIEW; - else - m->buf->decoder_flags |= BUF_FLAG_FRAME_END; - } - + m->buf->decoder_flags |= BUF_FLAG_FRAME_END; m->buf->pts = m->pts; m->buf->decoder_info[0] = 1; @@ -1110,7 +1067,6 @@ static void demux_ts_pes_new(demux_ts_t*this, if (m->buf != NULL) m->buf->free_buffer(m->buf); m->buf = NULL; m->counter = INVALID_CC; - m->numPreview = 0; m->descriptor_tag = descriptor; m->corrupted_pes = 1; m->buffered_bytes = 0; -- cgit v1.2.3 From 03fada269864f411b267f7ea23cd88ec765abc23 Mon Sep 17 00:00:00 2001 From: Petri Hintukainen Date: Tue, 4 Oct 2011 09:36:43 +0300 Subject: utils.c: fixed missing prototypes: unconditionally include xine_internal.h _x_set_file_close_on_exec() and _x_set_socket_close_on_exec() prototypes were missing. We need the prototypes because of visibility attributes. --- src/xine-utils/utils.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'src') diff --git a/src/xine-utils/utils.c b/src/xine-utils/utils.c index 70c600b96..25b275f26 100644 --- a/src/xine-utils/utils.c +++ b/src/xine-utils/utils.c @@ -29,9 +29,7 @@ #include "xineutils.h" #include "xineintl.h" -#ifdef _MSC_VER #include "xine_internal.h" -#endif #include #include -- cgit v1.2.3 From 44e75aa7b7f9a4f69a91e75691557a2b809949eb Mon Sep 17 00:00:00 2001 From: Petri Hintukainen Date: Tue, 4 Oct 2011 10:52:43 +0300 Subject: demux_ts: save pcr pid from pmt --- src/demuxers/demux_ts.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/demuxers/demux_ts.c b/src/demuxers/demux_ts.c index c606d52a8..491942adc 100644 --- a/src/demuxers/demux_ts.c +++ b/src/demuxers/demux_ts.c @@ -329,6 +329,7 @@ typedef struct { * and audio PIDs, we keep the index of the corresponding entry * inthe media[] array. */ + unsigned int pcr_pid; unsigned int videoPid; unsigned int videoMedia; @@ -666,6 +667,7 @@ static void demux_ts_parse_pat (demux_ts_t*this, unsigned char *original_pkt, this->last_pmt_crc = 0; this->videoPid = INVALID_PID; this->spu_pid = INVALID_PID; + this->pcr_pid = INVALID_PID; if (this->pmt[program_count] != NULL) { free(this->pmt[program_count]); @@ -1581,23 +1583,21 @@ printf("Program Number is %i, looking for %i\n",program_number,this->program_num section_length -= coded_length; } -#if 0 /* * Get the current PCR PID. */ pid = ((this->pmt[program_count][8] << 8) | this->pmt[program_count][9]) & 0x1fff; - if (this->pcrPid != pid) { + if (this->pcr_pid != pid) { #ifdef TS_PMT_LOG - if (this->pcrPid == INVALID_PID) { + if (this->pcr_pid == INVALID_PID) { printf ("demux_ts: PMT pcr pid 0x%.4x\n", pid); } else { printf ("demux_ts: PMT pcr pid changed 0x%.4x\n", pid); } #endif - this->pcrPid = pid; + this->pcr_pid = pid; } -#endif if ( this->stream->spu_channel>=0 && this->spu_langs_count>0 ) demux_ts_update_spu_channel( this ); @@ -2045,6 +2045,7 @@ static void demux_ts_event_handler (demux_ts_t *this) { case XINE_EVENT_PIDS_CHANGE: this->videoPid = INVALID_PID; + this->pcr_pid = INVALID_PID; this->audio_tracks_count = 0; this->media_num = 0; this->send_newpts = 1; @@ -2125,6 +2126,7 @@ static void demux_ts_send_headers (demux_plugin_t *this_gen) { */ this->videoPid = INVALID_PID; + this->pcr_pid = INVALID_PID; this->audio_tracks_count = 0; this->media_num= 0; this->last_pmt_crc = 0; @@ -2383,6 +2385,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, this->scrambled_npids = 0; this->videoPid = INVALID_PID; + this->pcr_pid = INVALID_PID; this->audio_tracks_count = 0; this->last_pmt_crc = 0; -- cgit v1.2.3 From 06a273f4917e5b7460985a33a96276b0f84dc8b1 Mon Sep 17 00:00:00 2001 From: Petri Hintukainen Date: Tue, 4 Oct 2011 11:14:55 +0300 Subject: demux_real: fixed buffer size check Check used (NULL) target pointer instead of length and would be always false --- src/demuxers/demux_real.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/demuxers/demux_real.c b/src/demuxers/demux_real.c index 340083221..19b7794ef 100644 --- a/src/demuxers/demux_real.c +++ b/src/demuxers/demux_real.c @@ -303,7 +303,7 @@ static mdpr_t *real_parse_mdpr(const char *data, const unsigned int size) mdpr->mime_type[(int)mdpr->mime_type_size]=0; mdpr->type_specific_len=_X_BE_32(&data[34+mdpr->stream_name_size+mdpr->mime_type_size]); - if (size < 38 + mdpr->stream_name_size + mdpr->mime_type_size + mdpr->type_specific_data) + if (size < 38 + mdpr->stream_name_size + mdpr->mime_type_size + mdpr->type_specific_len) goto fail; mdpr->type_specific_data=malloc(mdpr->type_specific_len); if (!mdpr->type_specific_data) -- cgit v1.2.3 From 0c0175429f974b607f085c56be152ed5c3c20251 Mon Sep 17 00:00:00 2001 From: Petri Hintukainen Date: Tue, 4 Oct 2011 11:16:10 +0300 Subject: demux_qt: fixed using uninitialized data --- src/demuxers/demux_qt.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/demuxers/demux_qt.c b/src/demuxers/demux_qt.c index 7c6f7efe3..70b325535 100644 --- a/src/demuxers/demux_qt.c +++ b/src/demuxers/demux_qt.c @@ -1802,11 +1802,12 @@ static void get_next_edit_list_entry(qt_trak *trak, int64_t *edit_list_duration, unsigned int global_timescale) { + *edit_list_media_time = 0; + *edit_list_duration = MAX_DURATION; + /* if there is no edit list, set to max duration and get out */ if (!trak->edit_list_table) { - *edit_list_media_time = 0; - *edit_list_duration = MAX_DURATION; debug_edit_list(" qt: no edit list table, initial = %d, %"PRId64"\n", *edit_list_media_time, *edit_list_duration); return; -- cgit v1.2.3 From 6bccdb3cd66f73336bb754baa045af1fefd5588b Mon Sep 17 00:00:00 2001 From: Petri Hintukainen Date: Tue, 4 Oct 2011 11:20:57 +0300 Subject: demux_ogg: check asprintf return value --- src/demuxers/demux_ogg.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/demuxers/demux_ogg.c b/src/demuxers/demux_ogg.c index 573baa593..14a8ac29a 100644 --- a/src/demuxers/demux_ogg.c +++ b/src/demuxers/demux_ogg.c @@ -468,9 +468,10 @@ static int read_comments (demux_ogg_t *this, const char *comment) if (!strncasecmp (metadata[i].tag, comment, ml) && comment[ml]) { if (metadata[i].append && this->meta[metadata[i].meta]) { char *newstr; - asprintf (&newstr, "%s\n%s", this->meta[metadata[i].meta], comment + ml); - free (this->meta[metadata[i].meta]); - this->meta[metadata[i].meta] = newstr; + if (asprintf (&newstr, "%s\n%s", this->meta[metadata[i].meta], comment + ml) >= 0) { + free (this->meta[metadata[i].meta]); + this->meta[metadata[i].meta] = newstr; + } } else { free (this->meta[metadata[i].meta]); -- cgit v1.2.3 From 7bf45d72df8abccbb2a56c86446aaeaca70f5fbf Mon Sep 17 00:00:00 2001 From: Petri Hintukainen Date: Tue, 4 Oct 2011 11:22:21 +0300 Subject: demux_qt: check asprintf() return value --- src/demuxers/demux_qt.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/demuxers/demux_qt.c b/src/demuxers/demux_qt.c index 70b325535..d0fa3fd77 100644 --- a/src/demuxers/demux_qt.c +++ b/src/demuxers/demux_qt.c @@ -710,9 +710,11 @@ static char *qtl_file_url (input_plugin_t *input, const unsigned char *preview, { /* relative */ const char *dir = input->get_mrl (input); slash = strrchr (dir, '/'); - asprintf (&url, "%.*s/%s", - slash ? (int)(slash - dir) : 1, - slash ? dir : ".", url); + if (asprintf (&url, "%.*s/%s", + slash ? (int)(slash - dir) : 1, + slash ? dir : ".", url) < 0) { + url = NULL; + } } } -- cgit v1.2.3 From 7e458b3e9af11628783d7c67bc2ca60c2cd3cfd0 Mon Sep 17 00:00:00 2001 From: Petri Hintukainen Date: Tue, 4 Oct 2011 11:22:41 +0300 Subject: fixed remaining compiler warnings from demuxers --- src/demuxers/demux_aiff.c | 2 +- src/demuxers/demux_ogg.c | 2 ++ src/demuxers/demux_tta.c | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/demuxers/demux_aiff.c b/src/demuxers/demux_aiff.c index ee45963a5..0b4f5c513 100644 --- a/src/demuxers/demux_aiff.c +++ b/src/demuxers/demux_aiff.c @@ -94,7 +94,7 @@ static int extended_to_int(const unsigned char p[10]) m = (m<<8) + p[2+i];; e = (((int)p[0]&0x7f)<<8) | p[1]; if (e == 0x7fff && m) - return 0.0/0.0; + return (int)(0.0/0.0); e -= 16383 + 63; if (p[0]&0x80) diff --git a/src/demuxers/demux_ogg.c b/src/demuxers/demux_ogg.c index 14a8ac29a..e0abd0cd6 100644 --- a/src/demuxers/demux_ogg.c +++ b/src/demuxers/demux_ogg.c @@ -446,6 +446,7 @@ static const struct ogg_meta { OGG_META (COMMENT, 0), }; +#if 0 /* ensure that those marked "append" are cleared */ /* FIXME: is this useful? Should they be cleared on first write? */ static void prepare_read_comments (demux_ogg_t *this) @@ -458,6 +459,7 @@ static void prepare_read_comments (demux_ogg_t *this) this->meta[metadata[i].meta] = NULL; } } +#endif static int read_comments (demux_ogg_t *this, const char *comment) { diff --git a/src/demuxers/demux_tta.c b/src/demuxers/demux_tta.c index 57d2c8357..cf3745211 100644 --- a/src/demuxers/demux_tta.c +++ b/src/demuxers/demux_tta.c @@ -100,7 +100,7 @@ static int open_tta_file(demux_tta_t *this) { } this->seektable = calloc(this->totalframes, sizeof(uint32_t)); - this->input->read(this->input, this->seektable, sizeof(uint32_t)*this->totalframes); + this->input->read(this->input, (uint8_t*)this->seektable, sizeof(uint32_t)*this->totalframes); /* Skip the CRC32 */ this->input->seek(this->input, 4, SEEK_CUR); -- cgit v1.2.3 From 0d58b2a9b4a165ddd55e4798c56f1aa05d89f989 Mon Sep 17 00:00:00 2001 From: Chris Rankin Date: Tue, 4 Oct 2011 09:32:32 +0100 Subject: Import xine_private.h as needed, not as part of xine_internal.h. --- src/xine-engine/broadcaster.c | 1 + src/xine-engine/xine_internal.h | 1 - src/xine-utils/utils.c | 3 +++ 3 files changed, 4 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/xine-engine/broadcaster.c b/src/xine-engine/broadcaster.c index 3f943171f..435ec2df6 100644 --- a/src/xine-engine/broadcaster.c +++ b/src/xine-engine/broadcaster.c @@ -64,6 +64,7 @@ #include "xine_internal.h" #include "buffer.h" #include "xineutils.h" +#include "xine_private.h" #define QLEN 5 /* maximum connection queue length */ #define _BUFSIZ 512 diff --git a/src/xine-engine/xine_internal.h b/src/xine-engine/xine_internal.h index bb2113831..7566c83e0 100644 --- a/src/xine-engine/xine_internal.h +++ b/src/xine-engine/xine_internal.h @@ -48,7 +48,6 @@ extern "C" { # include "io_helper.h" # include "info_helper.h" # include "alphablend.h" -# include "xine_private.h" #else # include # include diff --git a/src/xine-utils/utils.c b/src/xine-utils/utils.c index 25b275f26..3d21a2935 100644 --- a/src/xine-utils/utils.c +++ b/src/xine-utils/utils.c @@ -29,7 +29,10 @@ #include "xineutils.h" #include "xineintl.h" +#ifdef _MSC_VER #include "xine_internal.h" +#endif +#include "xine_private.h" #include #include -- cgit v1.2.3 From b1e7541d8541f424a374ad8f996b104ffcab7ab9 Mon Sep 17 00:00:00 2001 From: Petri Hintukainen Date: Fri, 22 Jul 2011 17:11:03 +0300 Subject: demux_ts: packet content should be checked for AC3 syncword after checking all descriptors --- src/demuxers/demux_ts.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/demuxers/demux_ts.c b/src/demuxers/demux_ts.c index 491942adc..60cdb9ff2 100644 --- a/src/demuxers/demux_ts.c +++ b/src/demuxers/demux_ts.c @@ -804,9 +804,8 @@ static int demux_ts_parse_pes_header (xine_t *xine, demux_ts_media *m, m->type |= BUF_AUDIO_EAC3; return 1; - } else if((m->descriptor_tag == STREAM_AUDIO_AC3) || /* ac3 - raw */ - (packet_len > 1 && p[0] == 0x0B && p[1] == 0x77)) { /* ac3 - syncword */ - m->content = p; + } else if(m->descriptor_tag == STREAM_AUDIO_AC3) { /* ac3 - raw */ + m->content = p; m->size = packet_len; m->type |= BUF_AUDIO_A52; return 1; @@ -854,6 +853,13 @@ static int demux_ts_parse_pes_header (xine_t *xine, demux_ts_media *m, m->type |= BUF_SPU_DVB; m->buf->decoder_info[2] = payload_len; return 1; + + } else if (p[0] == 0x0B && p[1] == 0x77) { /* ac3 - syncword */ + m->content = p; + m->size = packet_len; + m->type |= BUF_AUDIO_A52; + return 1; + } else if ((p[0] & 0xE0) == 0x20) { spu_id = (p[0] & 0x1f); -- cgit v1.2.3 From 10d79495d21c47a6c890d501d461b62cb46081e1 Mon Sep 17 00:00:00 2001 From: Petri Hintukainen Date: Mon, 18 Jul 2011 22:38:54 +0300 Subject: demux_ts: commented out PCM inside PS1 Demuxer does not send PCM header. Decoder can't handle raw PCM stream without configuration. --- src/demuxers/demux_ts.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/demuxers/demux_ts.c b/src/demuxers/demux_ts.c index 60cdb9ff2..8ec2b60eb 100644 --- a/src/demuxers/demux_ts.c +++ b/src/demuxers/demux_ts.c @@ -878,9 +878,11 @@ static int demux_ts_parse_pes_header (xine_t *xine, demux_ts_media *m, m->type |= BUF_AUDIO_A52; return 1; +#if 0 + /* commented out: does not set PCM type. Decoder can't handle raw PCM stream without configuration. */ } else if ((p[0]&0xf0) == 0xa0) { - int pcm_offset; + unsigned int pcm_offset; for (pcm_offset=0; ++pcm_offset < packet_len-1 ; ){ if (p[pcm_offset] == 0x01 && p[pcm_offset+1] == 0x80 ) { /* START */ @@ -897,6 +899,7 @@ static int demux_ts_parse_pes_header (xine_t *xine, demux_ts_media *m, m->size = packet_len-pcm_offset; m->type |= BUF_AUDIO_LPCM_BE; return 1; +#endif } } else if ((stream_id & 0xf0) == 0xe0) { -- cgit v1.2.3