summaryrefslogtreecommitdiff
path: root/src/demuxers
diff options
context:
space:
mode:
Diffstat (limited to 'src/demuxers')
-rw-r--r--src/demuxers/demux_asf.c18
-rw-r--r--src/demuxers/demux_avi.c4
-rw-r--r--src/demuxers/demux_iff.c2
-rw-r--r--src/demuxers/demux_matroska.c6
-rw-r--r--src/demuxers/demux_mpeg_block.c4
-rw-r--r--src/demuxers/demux_mpeg_pes.c5
-rw-r--r--src/demuxers/demux_ogg.c31
-rw-r--r--src/demuxers/demux_real.c4
-rw-r--r--src/demuxers/demux_ts.c483
-rw-r--r--src/demuxers/demux_wc3movie.c3
10 files changed, 377 insertions, 183 deletions
diff --git a/src/demuxers/demux_asf.c b/src/demuxers/demux_asf.c
index 1250ba9a5..d2f0a89de 100644
--- a/src/demuxers/demux_asf.c
+++ b/src/demuxers/demux_asf.c
@@ -513,13 +513,13 @@ static int asf_read_header (demux_asf_t *this) {
* XX bytes : optional palette
*/
uint32_t width, height;
- uint16_t bmiheader_size;
+ /*uint16_t bmiheader_size;*/
xine_bmiheader *bmiheader;
width = _X_LE_32(asf_stream->private_data);
height = _X_LE_32(asf_stream->private_data + 4);
/* there is one unknown byte between height and the bmiheader size */
- bmiheader_size = _X_LE_16(asf_stream->private_data + 9);
+ /*bmiheader_size = _X_LE_16(asf_stream->private_data + 9);*/
/* FIXME: bmiheader_size must be >= sizeof(xine_bmiheader) */
@@ -998,8 +998,10 @@ static int asf_parse_packet_ecd(demux_asf_t *this, uint32_t *p_hdr_size) {
/* return 0 if ok */
static int asf_parse_packet_payload_header(demux_asf_t *this, uint32_t p_hdr_size) {
+#ifdef LOG
int64_t timestamp;
int64_t duration;
+#endif
this->packet_len_flags = get_byte(this); p_hdr_size += 1;
this->packet_prop_flags = get_byte(this); p_hdr_size += 1;
@@ -1038,8 +1040,10 @@ static int asf_parse_packet_payload_header(demux_asf_t *this, uint32_t p_hdr_siz
this->packet_padsize = 0;
}
+#ifdef LOG
timestamp = get_le32(this); p_hdr_size += 4;
duration = get_le16(this); p_hdr_size += 2;
+#endif
lprintf ("timestamp=%"PRId64", duration=%"PRId64"\n", timestamp, duration);
@@ -1581,11 +1585,11 @@ static int demux_asf_parse_asx_references( demux_asf_t *this) {
ENTRYREF, MOREINFO, PARAM, REPEAT, TITLE
*/
- const char *base_href = NULL;
+ /*const char *base_href = NULL;*/
for (asx_entry = xml_tree->child; asx_entry; asx_entry = asx_entry->next)
{
- const char *ref_base_href = base_href;
+ /*const char *ref_base_href = base_href;*/
if (!strcasecmp (asx_entry->name, "ENTRY"))
{
@@ -1641,9 +1645,11 @@ static int demux_asf_parse_asx_references( demux_asf_t *this) {
duration = asx_get_time_value (asx_ref);
}
+#if 0
else if (!strcasecmp (asx_ref->name, "BASE"))
/* Attributes: HREF */
- ref_base_href = xml_parser_get_property (asx_entry, "HREF");
+ ref_base_href = xml_parser_get_property (asx_entry, "HREF");
+#endif
}
/* FIXME: prepend ref_base_href to href */
@@ -1661,9 +1667,11 @@ static int demux_asf_parse_asx_references( demux_asf_t *this) {
_x_demux_send_mrl_reference (this->stream, 0, href, NULL, 0, -1);
}
+#if 0
else if (!strcasecmp (asx_entry->name, "BASE"))
/* Attributes: HREF */
base_href = xml_parser_get_property (asx_entry, "HREF");
+#endif
}
}
else
diff --git a/src/demuxers/demux_avi.c b/src/demuxers/demux_avi.c
index 02c242137..79bfc9f12 100644
--- a/src/demuxers/demux_avi.c
+++ b/src/demuxers/demux_avi.c
@@ -732,8 +732,6 @@ static avi_t *XINE_MALLOC AVI_init(demux_avi_t *this) {
int lasttag = 0;
int vids_strh_seen = 0;
int vids_strf_seen = 0;
- int auds_strh_seen = 0;
- int auds_strf_seen = 0;
int num_stream = 0;
uint8_t data[256];
int strf_size;
@@ -898,7 +896,6 @@ static avi_t *XINE_MALLOC AVI_init(demux_avi_t *this) {
a->dwSampleSize = _X_LE_32(hdrl_data + i + 44);
a->audio_tot = 0;
- auds_strh_seen = 1;
lprintf("audio stream header, num_stream=%d\n", num_stream);
lasttag = 2; /* auds */
@@ -985,7 +982,6 @@ static avi_t *XINE_MALLOC AVI_init(demux_avi_t *this) {
AVI->audio[AVI->n_audio-1]->wavex = wavex;
AVI->audio[AVI->n_audio-1]->wavex_len = n;
lprintf("audio stream format\n");
- auds_strf_seen = 1;
}
} else if(strncasecmp(hdrl_data + i, "indx",4) == 0) {
diff --git a/src/demuxers/demux_iff.c b/src/demuxers/demux_iff.c
index 1785e86d7..fb7d1c748 100644
--- a/src/demuxers/demux_iff.c
+++ b/src/demuxers/demux_iff.c
@@ -689,7 +689,6 @@ static int demux_iff_send_chunk(demux_plugin_t *this_gen) {
int64_t zw_pts;
int64_t zw_rescale;
int j, k;
- int first_buf;
int interleave_index;
int size;
@@ -791,7 +790,6 @@ static int demux_iff_send_chunk(demux_plugin_t *this_gen) {
interleave_index = (current_file_pos *
this->audio_compression_factor);
}
- first_buf = 1;
zw_pts = current_file_pos;
diff --git a/src/demuxers/demux_matroska.c b/src/demuxers/demux_matroska.c
index ff2658a0c..242293502 100644
--- a/src/demuxers/demux_matroska.c
+++ b/src/demuxers/demux_matroska.c
@@ -1846,7 +1846,7 @@ static int parse_block (demux_matroska_t *this, size_t block_size,
uint64_t track_num;
uint8_t *data;
uint8_t flags;
- int gap, lacing, num_len;
+ int lacing, num_len;
int16_t timecode_diff;
int64_t pts, xduration;
int decoder_flags = 0;
@@ -1866,7 +1866,7 @@ static int parse_block (demux_matroska_t *this, size_t block_size,
lprintf("track_num: %" PRIu64 ", timecode_diff: %d, flags: 0x%x\n", track_num, timecode_diff, flags);
- gap = flags & 1;
+ /*gap = flags & 1;*/
lacing = (flags >> 1) & 0x3;
/*fprintf(stderr, "lacing: %x\n", lacing);*/
@@ -2077,7 +2077,6 @@ static int parse_block (demux_matroska_t *this, size_t block_size,
static int parse_simpleblock(demux_matroska_t *this, size_t block_len, uint64_t cluster_timecode, uint64_t block_duration)
{
- int has_block = 0;
off_t block_pos = 0;
off_t file_len = 0;
int normpos = 0;
@@ -2092,7 +2091,6 @@ static int parse_simpleblock(demux_matroska_t *this, size_t block_len, uint64_t
if (!read_block_data(this, block_len, this->compress_maxlen))
return 0;
- has_block = 1;
/* we have the duration, we can parse the block now */
if (!parse_block(this, block_len, cluster_timecode, block_duration,
normpos, is_key))
diff --git a/src/demuxers/demux_mpeg_block.c b/src/demuxers/demux_mpeg_block.c
index aa5294e8b..08655ada9 100644
--- a/src/demuxers/demux_mpeg_block.c
+++ b/src/demuxers/demux_mpeg_block.c
@@ -868,6 +868,7 @@ static int32_t parse_private_stream_1(demux_mpeg_block_t *this, uint8_t *p, buf_
} else if ((p[0]&0xf0) == 0xa0) {
int pcm_offset;
+#if 0
int number_of_frame_headers;
int first_access_unit_pointer;
int audio_frame_number;
@@ -875,6 +876,7 @@ static int32_t parse_private_stream_1(demux_mpeg_block_t *this, uint8_t *p, buf_
int sample_rate;
int num_channels;
int dynamic_range;
+#endif
/*
* found in http://members.freemail.absa.co.za/ginggs/dvd/mpeg2_lpcm.txt
@@ -882,6 +884,7 @@ static int32_t parse_private_stream_1(demux_mpeg_block_t *this, uint8_t *p, buf_
*/
track = p[0] & 0x0F;
+#if 0
number_of_frame_headers = p[1];
/* unknown = p[2]; */
first_access_unit_pointer = p[3];
@@ -906,6 +909,7 @@ static int32_t parse_private_stream_1(demux_mpeg_block_t *this, uint8_t *p, buf_
case 2: bits_per_sample = 24; break;
}
dynamic_range = p[6];
+#endif
/* send lpcm config byte */
buf->decoder_flags |= BUF_FLAG_SPECIAL;
diff --git a/src/demuxers/demux_mpeg_pes.c b/src/demuxers/demux_mpeg_pes.c
index 9ef7221f0..305069b3c 100644
--- a/src/demuxers/demux_mpeg_pes.c
+++ b/src/demuxers/demux_mpeg_pes.c
@@ -975,6 +975,7 @@ static int32_t parse_private_stream_1(demux_mpeg_pes_t *this, uint8_t *p, buf_el
} else if ((p[0]&0xf0) == 0xa0) {
int pcm_offset;
+#if 0
int number_of_frame_headers;
int first_access_unit_pointer;
int audio_frame_number;
@@ -982,13 +983,14 @@ static int32_t parse_private_stream_1(demux_mpeg_pes_t *this, uint8_t *p, buf_el
int sample_rate;
int num_channels;
int dynamic_range;
-
+#endif
/*
* found in http://members.freemail.absa.co.za/ginggs/dvd/mpeg2_lpcm.txt
* appears to be correct.
*/
track = p[0] & 0x0F;
+#if 0
number_of_frame_headers = p[1];
/* unknown = p[2]; */
first_access_unit_pointer = p[3];
@@ -1019,6 +1021,7 @@ static int32_t parse_private_stream_1(demux_mpeg_pes_t *this, uint8_t *p, buf_el
case 2: bits_per_sample = 24; break;
}
dynamic_range = p[6];
+#endif
/* send lpcm config byte */
buf->decoder_flags |= BUF_FLAG_SPECIAL;
diff --git a/src/demuxers/demux_ogg.c b/src/demuxers/demux_ogg.c
index e0abd0cd6..8849e445e 100644
--- a/src/demuxers/demux_ogg.c
+++ b/src/demuxers/demux_ogg.c
@@ -931,21 +931,27 @@ static void decode_video_header (demux_ogg_t *this, const int stream_num, ogg_pa
xine_bmiheader bih;
int channel;
+#ifdef LOG
int16_t locbits_per_sample;
+ int32_t locsize, locdefault_len, locbuffersize;
+ int64_t locsamples_per_unit;
+#endif
uint32_t locsubtype;
- int32_t locsize, locdefault_len, locbuffersize, locwidth, locheight;
- int64_t loctime_unit, locsamples_per_unit;
+ int32_t locwidth, locheight;
+ int64_t loctime_unit;
/* read fourcc with machine endianness */
locsubtype = *((uint32_t *)&op->packet[9]);
/* everything else little endian */
- locsize = _X_LE_32(&op->packet[13]);
loctime_unit = _X_LE_64(&op->packet[17]);
+#ifdef LOG
+ locsize = _X_LE_32(&op->packet[13]);
locsamples_per_unit = _X_LE_64(&op->packet[25]);
locdefault_len = _X_LE_32(&op->packet[33]);
locbuffersize = _X_LE_32(&op->packet[37]);
locbits_per_sample = _X_LE_16(&op->packet[41]);
+#endif
locwidth = _X_LE_32(&op->packet[45]);
locheight = _X_LE_32(&op->packet[49]);
@@ -1014,18 +1020,25 @@ static void decode_audio_header (demux_ogg_t *this, const int stream_num, ogg_pa
char str[5];
int channel;
- int16_t locbits_per_sample, locchannels, locblockalign;
- int32_t locsize, locdefault_len, locbuffersize, locavgbytespersec;
- int64_t loctime_unit, locsamples_per_unit;
+#ifdef LOG
+ int16_t locblockalign;
+ int32_t locsize, locdefault_len, locbuffersize;
+ int64_t loctime_unit;
+#endif
+ int16_t locbits_per_sample, locchannels;
+ int32_t locavgbytespersec;
+ int64_t locsamples_per_unit;
+#ifdef LOG
locsize = _X_LE_32(&op->packet[13]);
loctime_unit = _X_LE_64(&op->packet[17]);
- locsamples_per_unit = _X_LE_64(&op->packet[25]);
- locdefault_len = _X_LE_32(&op->packet[33]);
locbuffersize = _X_LE_32(&op->packet[37]);
+ locdefault_len = _X_LE_32(&op->packet[33]);
+ locblockalign = _X_LE_16(&op->packet[47]);
+#endif
+ locsamples_per_unit = _X_LE_64(&op->packet[25]);
locbits_per_sample = _X_LE_16(&op->packet[41]);
locchannels = _X_LE_16(&op->packet[45]);
- locblockalign = _X_LE_16(&op->packet[47]);
locavgbytespersec= _X_LE_32(&op->packet[49]);
lprintf ("direct show filter created audio stream detected, hexdump:\n");
diff --git a/src/demuxers/demux_real.c b/src/demuxers/demux_real.c
index 19b7794ef..9ecf6b622 100644
--- a/src/demuxers/demux_real.c
+++ b/src/demuxers/demux_real.c
@@ -546,7 +546,7 @@ static void real_parse_headers (demux_real_t *this) {
lprintf("audio version %d detected\n", version);
- char *fourcc_ptr = "\0\0\0";
+ const char *fourcc_ptr = "\0\0\0";
switch(version) {
case 3:
/* Version 3 header stores fourcc after meta info - cheat by reading backwards from the
@@ -1251,7 +1251,7 @@ static int demux_real_send_chunk(demux_plugin_t *this_gen) {
buf->size = 0;
buf->type = this->video_stream->buf_type;
- xine_fast_memcpy(buf->decoder_info_ptr[2], this->fragment_tab,
+ xine_fast_memcpy(buf->content, this->fragment_tab,
this->fragment_count*8);
this->video_fifo->put(this->video_fifo, buf);
diff --git a/src/demuxers/demux_ts.c b/src/demuxers/demux_ts.c
index ef71bdfa5..88ccf49f4 100644
--- a/src/demuxers/demux_ts.c
+++ b/src/demuxers/demux_ts.c
@@ -182,8 +182,6 @@
#define BUF_SIZE (NPKT_PER_READ * (PKT_SIZE + 4))
-#define MAX_PES_BUF_SIZE 2048
-
#define CORRUPT_PES_THRESHOLD 10
#define NULL_PID 0x1fff
@@ -250,6 +248,10 @@
HDMV_SPU_INTERACTIVE = 0x91,
HDMV_SPU_TEXT = 0x92,
+ /* pseudo tags */
+ STREAM_AUDIO_EAC3 = (DESCRIPTOR_EAC3 << 8),
+ STREAM_AUDIO_DTS = (DESCRIPTOR_DTS << 8),
+
} streamType;
#define WRAP_THRESHOLD 270000
@@ -285,13 +287,14 @@
typedef struct {
unsigned int pid;
fifo_buffer_t *fifo;
- uint32_t size;
uint32_t type;
int64_t pts;
buf_element_t *buf;
unsigned int counter;
uint16_t descriptor_tag; /* +0x100 for PES stream IDs (no available TS descriptor tag?) */
+ uint8_t keep; /* used by demux_ts_dynamic_pmt_*() */
int corrupted_pes;
+ int pes_bytes_left; /* butes left if PES packet size is known */
int input_normpos;
int input_time;
@@ -329,6 +332,7 @@ typedef struct {
fifo_buffer_t *video_fifo;
input_plugin_t *input;
+ unsigned int read_retries;
int status;
@@ -408,6 +412,169 @@ typedef struct {
config_values_t *config;
} demux_ts_class_t;
+static void reset_track_map(fifo_buffer_t *fifo)
+{
+ buf_element_t *buf = fifo->buffer_pool_alloc (fifo);
+
+ buf->type = BUF_CONTROL_RESET_TRACK_MAP;
+ buf->decoder_info[1] = -1;
+
+ fifo->put (fifo, buf);
+}
+
+/* TJ. dynamic PMT support. The idea is:
+ First, reuse unchanged pids and add new ones.
+ Then, comb out those who are no longer referenced.
+ For example, the Kaffeine dvb frontend preserves original pids but only
+ sends the currently user selected ones, plus matching generated pat/pmt */
+
+static int demux_ts_dynamic_pmt_find (demux_ts_t *this,
+ int pid, int type, unsigned int descriptor_tag) {
+ unsigned int i;
+ demux_ts_media *m;
+ for (i = 0; i < this->media_num; i++) {
+ m = &this->media[i];
+ if ((m->pid == pid) && ((m->type & BUF_MAJOR_MASK) == type)) {
+ /* mark this media decriptor for reuse */
+ m->keep = 1;
+ return i;
+ }
+ }
+ if (i < MAX_PIDS) {
+ /* prepare new media descriptor */
+#ifdef LOG_DYNAMIC_PMT
+ char *name = "";
+ if (type == BUF_VIDEO_BASE) name = "video";
+ else if (type == BUF_AUDIO_BASE) name = "audio";
+ else if (type == BUF_SPU_BASE) name = "subtitle";
+ printf ("demux_ts: new %s pid %d\n", name, pid);
+#endif
+ m = &this->media[i];
+ if (type == BUF_AUDIO_BASE) {
+ /* allocate new audio track as well */
+ if (this->audio_tracks_count >= MAX_AUDIO_TRACKS) {
+ xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG,
+ "demux_ts: too many audio PIDs, ignoring pid %d\n", pid);
+ return -1;
+ }
+ m->type = type | this->audio_tracks_count;
+ this->audio_tracks[this->audio_tracks_count].pid = pid;
+ this->audio_tracks[this->audio_tracks_count].media_index = i;
+ this->audio_tracks_count++;
+ m->fifo = this->stream->audio_fifo;
+ } else {
+ m->type = type;
+ m->fifo = this->stream->video_fifo;
+ }
+ m->pid = pid;
+
+ if (m->buf) {
+ m->buf->free_buffer(m->buf);
+ m->buf = NULL;
+ }
+ m->counter = INVALID_CC;
+ m->corrupted_pes = 1;
+ m->pts = 0;
+
+ m->descriptor_tag = descriptor_tag;
+
+ m->keep = 1;
+ this->media_num++;
+ return i;
+ }
+ /* table full */
+ return -1;
+}
+
+static void demux_ts_dynamic_pmt_clean (demux_ts_t *this) {
+ int i, count = 0, tracks = 0, spus = 0;
+ /* densify media table */
+ for (i = 0; i < this->media_num; i++) {
+ demux_ts_media *m = &this->media[i];
+ int type = m->type & BUF_MAJOR_MASK;
+ int chan = m->type & 0xff;
+ if (m->keep) {
+ m->keep = 0;
+ if (type == BUF_VIDEO_BASE) {
+ /* adjust single video link */
+ this->videoMedia = count;
+ } else if (type == BUF_AUDIO_BASE) {
+ /* densify audio track table */
+ this->audio_tracks[chan].media_index = count;
+ if (chan > tracks) {
+ m->type = (m->type & ~0xff) | tracks;
+ this->audio_tracks[tracks] = this->audio_tracks[chan];
+ }
+ tracks++;
+ } else if (type == BUF_SPU_BASE) {
+ /* spu language table has already been rebuilt from scratch.
+ Adjust backlinks only */
+ while ((spus < this->spu_langs_count) && (this->spu_langs[spus].pid == m->pid)) {
+ this->spu_langs[spus].media_index = count;
+ spus++;
+ }
+ }
+ if (i > count) {
+ this->media[count] = *m;
+ m->buf = NULL;
+ m->pid = INVALID_PID;
+ }
+ count++;
+ } else {
+ /* drop this no longer needed media descriptor */
+#ifdef LOG_DYNAMIC_PMT
+ char *name = "";
+ if (type == BUF_VIDEO_BASE) name = "video";
+ else if (type == BUF_AUDIO_BASE) name = "audio";
+ else if (type == BUF_SPU_BASE) name = "subtitle";
+ printf ("demux_ts: dropped %s pid %d\n", name, m->pid);
+#endif
+ if (m->buf) {
+ m->buf->free_buffer (m->buf);
+ m->buf = NULL;
+ }
+ m->pid = INVALID_PID;
+ }
+ }
+ if ((tracks < this->audio_tracks_count) && this->audio_fifo) {
+ /* at least 1 audio track removed, tell audio decoder loop */
+ reset_track_map(this->audio_fifo);
+#ifdef LOG_DYNAMIC_PMT
+ printf ("demux_ts: new audio track map\n");
+#endif
+ }
+#ifdef LOG_DYNAMIC_PMT
+ printf ("demux_ts: using %d pids, %d audio %d subtitle channels\n", count, tracks, spus);
+#endif
+ /* adjust table sizes */
+ this->media_num = count;
+ this->audio_tracks_count = tracks;
+ /* should really have no effect */
+ this->spu_langs_count = spus;
+}
+
+static void demux_ts_dynamic_pmt_clear (demux_ts_t *this) {
+ unsigned int i;
+ for (i = 0; i < this->media_num; i++) {
+ if (this->media[i].buf) {
+ this->media[i].buf->free_buffer (this->media[i].buf);
+ this->media[i].buf = NULL;
+ }
+ }
+ this->media_num = 0;
+
+ this->videoPid = INVALID_PID;
+ this->audio_tracks_count = 0;
+ this->spu_pid = INVALID_PID;
+ this->spu_langs_count = 0;
+ this->spu_media = 0;
+
+ this->pcr_pid = INVALID_PID;
+
+ this->last_pmt_crc = 0;
+}
+
+
static void demux_ts_tbre_reset (demux_ts_t *this) {
if (this->tbre_time <= TBRE_TIME) {
this->tbre_pid = INVALID_PID;
@@ -576,6 +743,9 @@ static void demux_ts_update_spu_channel(demux_ts_t *this)
this->spu_pid = lang->pid;
this->spu_media = lang->media_index;
+ /* multiple spu langs can share same media descriptor */
+ this->media[lang->media_index].type =
+ (this->media[lang->media_index].type & ~0xff) | this->current_spu_channel;
#ifdef TS_LOG
printf("demux_ts: DVBSUB: selecting lang: %s page %ld %ld\n",
lang->desc.lang, lang->desc.comp_page_id, lang->desc.aux_page_id);
@@ -630,6 +800,7 @@ static void demux_ts_flush(demux_ts_t *this)
unsigned int i;
for (i = 0; i < this->media_num; ++i) {
demux_ts_flush_media(&this->media[i]);
+ this->media[i].corrupted_pes = 1;
}
}
@@ -645,11 +816,13 @@ static void demux_ts_flush(demux_ts_t *this)
*/
static void demux_ts_parse_pat (demux_ts_t*this, unsigned char *original_pkt,
unsigned char *pkt, unsigned int pusi) {
+#ifdef TS_PAT_LOG
uint32_t table_id;
+ uint32_t version_number;
+#endif
uint32_t section_syntax_indicator;
int32_t section_length;
uint32_t transport_stream_id;
- uint32_t version_number;
uint32_t current_next_indicator;
uint32_t section_number;
uint32_t last_section_number;
@@ -680,11 +853,15 @@ static void demux_ts_parse_pat (demux_ts_t*this, unsigned char *original_pkt,
"demux_ts: demux error! PAT with invalid pointer\n");
return;
}
+#ifdef TS_PAT_LOG
table_id = (unsigned int)pkt[5] ;
+#endif
section_syntax_indicator = (((unsigned int)pkt[6] >> 7) & 1) ;
section_length = (((unsigned int)pkt[6] & 0x03) << 8) | pkt[7];
transport_stream_id = ((uint32_t)pkt[8] << 8) | pkt[9];
+#ifdef TS_PAT_LOG
version_number = ((uint32_t)pkt[10] >> 1) & 0x1f;
+#endif
current_next_indicator = ((uint32_t)pkt[10] & 0x01);
section_number = (uint32_t)pkt[11];
last_section_number = (uint32_t)pkt[12];
@@ -779,11 +956,7 @@ static void demux_ts_parse_pat (demux_ts_t*this, unsigned char *original_pkt,
/* force PMT reparsing when pmt_pid changes */
if (this->pmt_pid[program_count] != pmt_pid) {
this->pmt_pid[program_count] = pmt_pid;
- this->audio_tracks_count = 0;
- this->last_pmt_crc = 0;
- this->videoPid = INVALID_PID;
- this->spu_pid = INVALID_PID;
- this->pcr_pid = INVALID_PID;
+ demux_ts_dynamic_pmt_clear (this);
if (this->pmt[program_count] != NULL) {
free(this->pmt[program_count]);
@@ -834,14 +1007,13 @@ static int demux_ts_parse_pes_header (xine_t *xine, demux_ts_media *m,
return 0 ;
}
- /* packet_len = p[4] << 8 | p[5]; */
stream_id = p[3];
- header_len = p[8];
+ header_len = p[8] + 9;
/* sometimes corruption on header_len causes segfault in memcpy below */
- if (header_len + 9 > packet_len) {
+ if (header_len > packet_len) {
xprintf (xine, XINE_VERBOSITY_DEBUG,
- "demux_ts: illegal value for PES_header_data_length (0x%x)\n", header_len);
+ "demux_ts: illegal value for PES_header_data_length (0x%x)\n", header_len - 9);
return 0;
}
@@ -852,7 +1024,7 @@ static int demux_ts_parse_pes_header (xine_t *xine, demux_ts_media *m,
if (p[7] & 0x80) { /* pts avail */
- if (header_len < 5) {
+ if (header_len < 14) {
return 0;
}
@@ -880,22 +1052,21 @@ static int demux_ts_parse_pes_header (xine_t *xine, demux_ts_media *m,
m->pts = pts;
- p += header_len + 9;
- packet_len -= header_len + 9;
+ m->pes_bytes_left = (int)(p[4] << 8 | p[5]) - header_len + 6;
+ lprintf("PES packet payload left: %d bytes\n", m->pes_bytes_left);
+
+ p += header_len;
+ packet_len -= header_len;
if (m->descriptor_tag == STREAM_VIDEO_VC1) {
- m->size = packet_len;
m->type = BUF_VIDEO_VC1;
- return 1;
+ return header_len;
}
if (m->descriptor_tag == HDMV_SPU_BITMAP) {
- long payload_len = ((buf[4] << 8) | buf[5]) - header_len - 3;
-
- m->size = packet_len;
m->type |= BUF_SPU_HDMV;
- m->buf->decoder_info[2] = payload_len;
- return 1;
+ m->buf->decoder_info[2] = m->pes_bytes_left;
+ return header_len;
} else
@@ -912,27 +1083,25 @@ static int demux_ts_parse_pes_header (xine_t *xine, demux_ts_media *m,
* these "raw" streams may begin with a byte that looks like a stream type.
* For audio streams, m->type already contains the stream no.
*/
- if(m->descriptor_tag == HDMV_AUDIO_84_EAC3) {
- m->size = packet_len;
+ if(m->descriptor_tag == HDMV_AUDIO_84_EAC3 ||
+ m->descriptor_tag == STREAM_AUDIO_EAC3) {
m->type |= BUF_AUDIO_EAC3;
- return 1;
+ return header_len;
} else if(m->descriptor_tag == STREAM_AUDIO_AC3) { /* ac3 - raw */
- m->size = packet_len;
m->type |= BUF_AUDIO_A52;
- return 1;
+ return header_len;
} else if (m->descriptor_tag == HDMV_AUDIO_83_TRUEHD) {
/* TODO: separate AC3 and TrueHD streams ... */
- m->size = packet_len;
m->type |= BUF_AUDIO_A52;
- return 1;
+ return header_len;
- } else if (m->descriptor_tag == HDMV_AUDIO_82_DTS ||
+ } else if (m->descriptor_tag == STREAM_AUDIO_DTS ||
+ m->descriptor_tag == HDMV_AUDIO_82_DTS ||
m->descriptor_tag == HDMV_AUDIO_86_DTS_HD_MA ) {
- m->size = packet_len;
m->type |= BUF_AUDIO_DTS;
- return 1;
+ return header_len;
} else if (packet_len < 2) {
return 0;
@@ -943,45 +1112,42 @@ static int demux_ts_parse_pes_header (xine_t *xine, demux_ts_media *m,
return 0;
}
- m->size = packet_len - 4;
m->type |= BUF_AUDIO_LPCM_BE;
m->buf->decoder_flags |= BUF_FLAG_SPECIAL;
m->buf->decoder_info[1] = BUF_SPECIAL_LPCM_CONFIG;
m->buf->decoder_info[2] = (p[3]<<24) | (p[2]<<16) | (p[1]<<8) | p[0];
- return 1;
+ m->pes_bytes_left -= 4;
+ return header_len + 4;
} else if (m->descriptor_tag == ISO_13818_PES_PRIVATE
&& p[0] == 0x20 && p[1] == 0x00) {
/* DVBSUB */
- long payload_len = ((buf[4] << 8) | buf[5]) - header_len - 3;
-
- m->size = packet_len;
m->type |= BUF_SPU_DVB;
- m->buf->decoder_info[2] = payload_len;
- return 1;
+ m->buf->decoder_info[2] = m->pes_bytes_left;
+ return header_len;
} else if (p[0] == 0x0B && p[1] == 0x77) { /* ac3 - syncword */
- m->size = packet_len;
m->type |= BUF_AUDIO_A52;
- return 1;
+ return header_len;
} else if ((p[0] & 0xE0) == 0x20) {
spu_id = (p[0] & 0x1f);
- m->size = packet_len-1;
m->type = BUF_SPU_DVD + spu_id;
- return 1;
+ m->pes_bytes_left -= 1;
+ return header_len + 1;
+
} else if ((p[0] & 0xF0) == 0x80) {
if (packet_len < 4) {
return 0;
}
- m->size = packet_len - 4;
m->type |= BUF_AUDIO_A52;
- return 1;
+ m->pes_bytes_left -= 4;
+ return header_len + 4;
#if 0
/* commented out: does not set PCM type. Decoder can't handle raw PCM stream without configuration. */
@@ -1000,15 +1166,14 @@ static int demux_ts_parse_pes_header (xine_t *xine, demux_ts_media *m,
return 0;
}
- m->size = packet_len-pcm_offset;
m->type |= BUF_AUDIO_LPCM_BE;
- return 1;
+ m->pes_bytes_left -= pcm_offset;
+ return header_len + pcm_offset;
#endif
}
} else if ((stream_id & 0xf0) == 0xe0) {
- m->size = packet_len;
switch (m->descriptor_tag) {
case ISO_11172_VIDEO:
case ISO_13818_VIDEO:
@@ -1029,11 +1194,10 @@ static int demux_ts_parse_pes_header (xine_t *xine, demux_ts_media *m,
m->type = BUF_VIDEO_MPEG;
break;
}
- return 1;
+ return header_len;
} else if ((stream_id & 0xe0) == 0xc0) {
- m->size = packet_len;
switch (m->descriptor_tag) {
case ISO_11172_AUDIO:
case ISO_13818_AUDIO:
@@ -1053,7 +1217,7 @@ static int demux_ts_parse_pes_header (xine_t *xine, demux_ts_media *m,
m->type |= BUF_AUDIO_MPEG;
break;
}
- return 1;
+ return header_len;
} else {
#ifdef TS_LOG
@@ -1114,7 +1278,9 @@ static void demux_ts_buffer_pes(demux_ts_t*this, unsigned char *ts,
/* allocate the buffer here, as pes_header needs a valid buf for dvbsubs */
m->buf = m->fifo->buffer_pool_alloc(m->fifo);
- if (!demux_ts_parse_pes_header(this->stream->xine, m, ts, len)) {
+ int pes_header_len = demux_ts_parse_pes_header(this->stream->xine, m, ts, len);
+
+ if (pes_header_len <= 0) {
m->buf->free_buffer(m->buf);
m->buf = NULL;
@@ -1124,8 +1290,10 @@ static void demux_ts_buffer_pes(demux_ts_t*this, unsigned char *ts,
} else {
m->corrupted_pes = 0;
- memcpy(m->buf->mem, ts+len-m->size, m->size);
- m->buf->size = m->size;
+
+ /* skip PES header */
+ ts += pes_header_len;
+ len -= pes_header_len;
update_extra_info(this, m);
@@ -1135,41 +1303,29 @@ static void demux_ts_buffer_pes(demux_ts_t*this, unsigned char *ts,
if (m->pid == this->tbre_pid)
demux_ts_tbre_update (this, TBRE_MODE_AUDIO_PTS, m->pts);
}
+ }
- } else if (!m->corrupted_pes) { /* no pus -- PES packet continuation */
+ if (!m->corrupted_pes) {
- if ((m->buf->size + len) > MAX_PES_BUF_SIZE) {
+ if ((m->buf->size + len) > m->buf->max_size) {
+ m->pes_bytes_left -= m->buf->size;
demux_ts_send_buffer(m, 0);
m->buf = m->fifo->buffer_pool_alloc(m->fifo);
}
+
memcpy(m->buf->mem + m->buf->size, ts, len);
m->buf->size += len;
- }
-}
-
-/*
- * Create a buffer for a PES stream.
- */
-static void demux_ts_pes_new(demux_ts_t*this,
- unsigned int mediaIndex,
- unsigned int pid,
- fifo_buffer_t *fifo,
- uint16_t descriptor) {
- demux_ts_media *m = &this->media[mediaIndex];
-
- /* new PID seen - initialise stuff */
- m->pid = pid;
- m->fifo = fifo;
-
- if (m->buf != NULL) m->buf->free_buffer(m->buf);
- m->buf = NULL;
- m->counter = INVALID_CC;
- m->descriptor_tag = descriptor;
- m->corrupted_pes = 1;
+ if (m->pes_bytes_left > 0 && m->buf->size >= m->pes_bytes_left) {
+ /* PES payload complete */
+ m->pes_bytes_left -= m->buf->size;
+ demux_ts_flush_media(m);
+ /* skip rest data - there shouldn't be any */
+ m->corrupted_pes = 1;
+ }
+ }
}
-
/* Find the first ISO 639 language descriptor (tag 10) and
* store the 3-char code in dest, nullterminated. If no
* code is found, zero out dest.
@@ -1260,11 +1416,13 @@ static void demux_ts_parse_pmt (demux_ts_t *this,
unsigned int pusi,
uint32_t program_count) {
+#ifdef TS_PMT_LOG
uint32_t table_id;
+ uint32_t version_number;
+#endif
uint32_t section_syntax_indicator;
uint32_t section_length = 0; /* to calm down gcc */
uint32_t program_number;
- uint32_t version_number;
uint32_t current_next_indicator;
uint32_t section_number;
uint32_t last_section_number;
@@ -1279,6 +1437,7 @@ static void demux_ts_parse_pmt (demux_ts_t *this,
char *ptr = NULL;
unsigned char len;
unsigned int offset=0;
+ int mi;
/*
* A new section should start with the payload unit start
@@ -1293,11 +1452,15 @@ static void demux_ts_parse_pmt (demux_ts_t *this,
this->pmt[program_count] = (uint8_t *) calloc(4096, sizeof(unsigned char));
this->pmt_write_ptr[program_count] = this->pmt[program_count];
+#ifdef TS_PMT_LOG
table_id = pkt[5] ;
+#endif
section_syntax_indicator = (pkt[6] >> 7) & 0x01;
section_length = (((uint32_t) pkt[6] << 8) | pkt[7]) & 0x03ff;
program_number = ((uint32_t) pkt[8] << 8) | pkt[9];
+#ifdef TS_PMT_LOG
version_number = (pkt[10] >> 1) & 0x1f;
+#endif
current_next_indicator = pkt[10] & 0x01;
section_number = pkt[11];
last_section_number = pkt[12];
@@ -1425,10 +1588,12 @@ printf("Program Number is %i, looking for %i\n",program_number,this->program_num
* PMT has changed (e.g. an IPTV streamer that's just changed its source),
* we'll get new PIDs that we should follow.
*/
- this->audio_tracks_count = 0;
this->videoPid = INVALID_PID;
this->spu_pid = INVALID_PID;
+ this->spu_langs_count = 0;
+ reset_track_map(this->video_fifo);
+
/*
* ES definitions start here...we are going to learn upto one video
* PID and one audio PID.
@@ -1454,7 +1619,6 @@ printf("Program Number is %i, looking for %i\n",program_number,this->program_num
/*
* Extract the elementary streams.
*/
- this->spu_langs_count = 0;
while (section_length > 0) {
unsigned int stream_info_length;
@@ -1481,9 +1645,12 @@ printf("Program Number is %i, looking for %i\n",program_number,this->program_num
#ifdef TS_PMT_LOG
printf ("demux_ts: PMT video pid 0x%.4x type %2.2x\n", pid, stream[0]);
#endif
- demux_ts_pes_new(this, this->media_num, pid, this->video_fifo,stream[0]);
- this->videoMedia = this->media_num;
- this->videoPid = pid;
+
+ mi = demux_ts_dynamic_pmt_find (this, pid, BUF_VIDEO_BASE, stream[0]);
+ if (mi >= 0) {
+ this->videoMedia = mi;
+ this->videoPid = pid;
+ }
}
break;
@@ -1492,18 +1659,17 @@ printf("Program Number is %i, looking for %i\n",program_number,this->program_num
case ISO_13818_PART7_AUDIO:
case ISO_14496_PART3_AUDIO:
if (this->audio_tracks_count < MAX_AUDIO_TRACKS) {
- if (apid_check(this, pid) < 0) {
+
+ mi = demux_ts_dynamic_pmt_find (this, pid, BUF_AUDIO_BASE, stream[0]);
+ if (mi >= 0) {
#ifdef TS_PMT_LOG
- printf ("demux_ts: PMT audio pid 0x%.4x type %2.2x\n", pid, stream[0]);
+ printf ("demux_ts: PMT audio pid 0x%.4x type %2.2x\n", pid, stream[0]);
#endif
- demux_ts_pes_new(this, this->media_num, pid, this->audio_fifo,stream[0]);
- this->audio_tracks[this->audio_tracks_count].pid = pid;
- this->audio_tracks[this->audio_tracks_count].media_index = this->media_num;
- this->media[this->media_num].type = this->audio_tracks_count;
- demux_ts_get_lang_desc(this, this->audio_tracks[this->audio_tracks_count].lang,
- stream + 5, stream_info_length);
- this->audio_tracks_count++;
+ demux_ts_get_lang_desc (this,
+ this->audio_tracks[this->media[mi].type & 0xff].lang,
+ stream + 5, stream_info_length);
}
+
}
break;
case ISO_13818_PRIVATE:
@@ -1522,28 +1688,23 @@ printf("Program Number is %i, looking for %i\n",program_number,this->program_num
break;
case ISO_13818_PES_PRIVATE:
for (i = 5; i < coded_length; i += stream[i+1] + 2) {
- if (((stream[i] == DESCRIPTOR_AC3) || (stream[i] == DESCRIPTOR_EAC3)) &&
- (this->audio_tracks_count < MAX_AUDIO_TRACKS)) {
- if (apid_check(this, pid) < 0) {
+
+ if ((stream[i] == DESCRIPTOR_AC3) || (stream[i] == DESCRIPTOR_EAC3) || (stream[i] == DESCRIPTOR_DTS)) {
+ mi = demux_ts_dynamic_pmt_find (this, pid, BUF_AUDIO_BASE,
+ stream[i] == DESCRIPTOR_AC3 ? STREAM_AUDIO_AC3 :
+ stream[i] == DESCRIPTOR_DTS ? STREAM_AUDIO_DTS :
+ STREAM_AUDIO_EAC3);
+ if (mi >= 0) {
#ifdef TS_PMT_LOG
printf ("demux_ts: PMT AC3 audio pid 0x%.4x type %2.2x\n", pid, stream[0]);
#endif
- if (stream[i] == DESCRIPTOR_AC3)
- demux_ts_pes_new(this, this->media_num, pid,
- this->audio_fifo, STREAM_AUDIO_AC3);
- else
- demux_ts_pes_new(this, this->media_num, pid,
- this->audio_fifo, HDMV_AUDIO_84_EAC3);
-
- this->audio_tracks[this->audio_tracks_count].pid = pid;
- this->audio_tracks[this->audio_tracks_count].media_index = this->media_num;
- this->media[this->media_num].type = this->audio_tracks_count;
- demux_ts_get_lang_desc(this, this->audio_tracks[this->audio_tracks_count].lang,
- stream + 5, stream_info_length);
- this->audio_tracks_count++;
+ demux_ts_get_lang_desc (this,
+ this->audio_tracks[this->media[mi].type & 0xff].lang,
+ stream + 5, stream_info_length);
break;
}
}
+
/* Teletext */
else if (stream[i] == DESCRIPTOR_TELETEXT)
{
@@ -1561,6 +1722,10 @@ printf("Program Number is %i, looking for %i\n",program_number,this->program_num
else if (stream[i] == DESCRIPTOR_DVBSUB)
{
int pos;
+
+ mi = demux_ts_dynamic_pmt_find (this, pid, BUF_SPU_BASE, stream[0]);
+ if (mi < 0) break;
+
for (pos = i + 2;
pos + 8 <= i + 2 + stream[i + 1]
&& this->spu_langs_count < MAX_SPU_LANGS;
@@ -1578,9 +1743,7 @@ printf("Program Number is %i, looking for %i\n",program_number,this->program_num
lang->desc.aux_page_id =
(stream[pos + 6] << 8) | stream[pos + 7];
lang->pid = pid;
- lang->media_index = this->media_num;
- this->media[this->media_num].type = no;
- demux_ts_pes_new(this, this->media_num, pid, this->video_fifo, stream[0]);
+ lang->media_index = mi;
demux_send_special_spu_buf( this, BUF_SPU_DVB, no );
#ifdef TS_LOG
printf("demux_ts: DVBSUB: pid 0x%.4x: %s page %ld %ld type %2.2x\n",
@@ -1615,15 +1778,17 @@ printf("Program Number is %i, looking for %i\n",program_number,this->program_num
break;
}
+ mi = demux_ts_dynamic_pmt_find (this, pid, BUF_SPU_BASE, stream[0]);
+ if (mi < 0) break;
+
+
demux_ts_spu_lang *lang = &this->spu_langs[this->spu_langs_count];
memset(lang->desc.lang, 0, sizeof(lang->desc.lang));
/*memcpy(lang->desc.lang, &stream[pos], 3);*/
/*lang->desc.lang[3] = 0;*/
lang->pid = pid;
- lang->media_index = this->media_num;
- this->media[this->media_num].type = this->spu_langs_count;
- demux_ts_pes_new(this, this->media_num, pid, this->video_fifo, stream[0]);
+ lang->media_index = mi;
demux_send_special_spu_buf( this, BUF_SPU_HDMV, this->spu_langs_count );
this->spu_langs_count++;
#ifdef TS_PMT_LOG
@@ -1642,43 +1807,43 @@ printf("Program Number is %i, looking for %i\n",program_number,this->program_num
* if is does, we tag this as an audio stream.
* FIXME: This will need expanding if we ever see a DTS or other media format here.
*/
- if ((this->audio_tracks_count < MAX_AUDIO_TRACKS) && (stream[0] >= 0x80) ) {
- if (apid_check(this,pid) < 0) {
- uint32_t format_identifier=0;
- demux_ts_get_reg_desc(this, &format_identifier,
- stream + 5, stream_info_length);
- /* If no format identifier, assume A52 */
- if (( format_identifier == 0x41432d33) ||
- ( format_identifier == 0) ||
- ((format_identifier == 0x48444d56 || this->hdmv>0) && stream[0] == HDMV_AUDIO_80_PCM) /* BluRay PCM */) {
-
- demux_ts_pes_new(this, this->media_num, pid, this->audio_fifo, stream[0]);
- this->audio_tracks[this->audio_tracks_count].pid = pid;
- this->audio_tracks[this->audio_tracks_count].media_index = this->media_num;
- this->media[this->media_num].type = this->audio_tracks_count;
- demux_ts_get_lang_desc(this, this->audio_tracks[this->audio_tracks_count].lang,
- stream + 5, stream_info_length);
- this->audio_tracks_count++;
- break;
- }
+ if ((this->audio_tracks_count < MAX_AUDIO_TRACKS) && (stream[0] >= 0x80) ) {
+
+ uint32_t format_identifier=0;
+ demux_ts_get_reg_desc(this, &format_identifier, stream + 5, stream_info_length);
+ /* If no format identifier, assume A52 */
+ if (( format_identifier == 0x41432d33) ||
+ ( format_identifier == 0) ||
+ ((format_identifier == 0x48444d56 || this->hdmv>0) && stream[0] == HDMV_AUDIO_80_PCM) /* BluRay PCM */) {
+
+ mi = demux_ts_dynamic_pmt_find (this, pid, BUF_AUDIO_BASE, stream[0]);
+ if (mi >= 0) {
+ demux_ts_get_lang_desc (this,
+ this->audio_tracks[this->media[mi].type & 0xff].lang,
+ stream + 5, stream_info_length);
+#ifdef TS_PMT_LOG
+ printf ("demux_ts: PMT audio pid 0x%.4x type %2.2x\n", pid, stream[0]);
+#endif
+ break;
+ }
}
- } else {
+ }
#ifdef TS_PMT_LOG
- printf ("demux_ts: PMT unknown stream_type: 0x%.2x pid: 0x%.4x\n",
- stream[0], pid);
+ printf ("demux_ts: PMT unknown stream_type: 0x%.2x pid: 0x%.4x\n",
+ stream[0], pid);
- for (i = 5; i < coded_length; i++)
- printf ("%.2x ", stream[i]);
- printf ("\n");
+ for (i = 5; i < coded_length; i++)
+ printf ("%.2x ", stream[i]);
+ printf ("\n");
#endif
- }
break;
}
- this->media_num++;
stream += coded_length;
section_length -= coded_length;
}
+ demux_ts_dynamic_pmt_clean (this);
+
/*
* Get the current PCR PID.
*/
@@ -1812,8 +1977,19 @@ static unsigned char * demux_synchronise(demux_ts_t* this) {
this->frame_pos = this->input->get_current_pos (this->input);
read_length = this->input->read(this->input, this->buf,
- this->pkt_size * NPKT_PER_READ);
- if (read_length < 0 || read_length % this->pkt_size) {
+ this->pkt_size * NPKT_PER_READ);
+
+ if (read_length < 0) {
+ xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG,
+ "demux_ts: read returned %d\n", read_length);
+ if (this->read_retries > 2)
+ this->status = DEMUX_FINISHED;
+ this->read_retries++;
+ return NULL;
+ }
+ this->read_retries = 0;
+
+ if (read_length % this->pkt_size) {
xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG,
"demux_ts: read returned %d bytes (not a multiple of %d!)\n",
read_length, this->pkt_size);
@@ -1832,6 +2008,7 @@ static unsigned char * demux_synchronise(demux_ts_t* this) {
*/
if (this->npkt_read == 0) {
+ demux_ts_flush(this);
xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, "demux_ts: read 0 packets\n");
this->status = DEMUX_FINISHED;
return NULL;
@@ -1964,7 +2141,9 @@ static void demux_ts_parse_packet (demux_ts_t*this) {
unsigned int sync_byte;
unsigned int transport_error_indicator;
unsigned int payload_unit_start_indicator;
+#ifdef TS_HEADER_LOG
unsigned int transport_priority;
+#endif
unsigned int pid;
unsigned int transport_scrambling_control;
unsigned int adaptation_field_control;
@@ -1982,7 +2161,9 @@ static void demux_ts_parse_packet (demux_ts_t*this) {
sync_byte = originalPkt[0];
transport_error_indicator = (originalPkt[1] >> 7) & 0x01;
payload_unit_start_indicator = (originalPkt[1] >> 6) & 0x01;
+#ifdef TS_HEADER_LOG
transport_priority = (originalPkt[1] >> 5) & 0x01;
+#endif
pid = ((originalPkt[1] << 8) |
originalPkt[2]) & 0x1fff;
transport_scrambling_control = (originalPkt[3] >> 6) & 0x03;
@@ -2154,15 +2335,8 @@ 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;
+ demux_ts_dynamic_pmt_clear(this);
this->send_newpts = 1;
- this->spu_pid = INVALID_PID;
- this->spu_media = 0;
- this->spu_langs_count= 0;
- this->last_pmt_crc = 0;
_x_demux_control_start (this->stream);
break;
@@ -2297,6 +2471,7 @@ static int demux_ts_seek (demux_plugin_t *this_gen,
m->buf = NULL;
m->counter = INVALID_CC;
m->corrupted_pes = 1;
+ m->pts = 0;
}
if( !playing ) {
diff --git a/src/demuxers/demux_wc3movie.c b/src/demuxers/demux_wc3movie.c
index 36cc4eabb..3b310e90c 100644
--- a/src/demuxers/demux_wc3movie.c
+++ b/src/demuxers/demux_wc3movie.c
@@ -141,7 +141,6 @@ static int demux_mve_send_chunk(demux_plugin_t *this_gen) {
demux_mve_t *this = (demux_mve_t *) this_gen;
buf_element_t *buf = NULL;
- int64_t text_pts = 0;
int64_t audio_pts = 0;
unsigned char preamble[PREAMBLE_SIZE];
unsigned int chunk_tag;
@@ -264,7 +263,7 @@ static int demux_mve_send_chunk(demux_plugin_t *this_gen) {
}
this->video_pts += WC3_PTS_INC;
} else if (chunk_tag == TEXT_TAG) {
- text_pts = this->video_pts - WC3_PTS_INC;
+ /*text_pts = this->video_pts - WC3_PTS_INC;*/
/* unhandled thus far */
this->input->seek(this->input, chunk_size, SEEK_CUR);