summaryrefslogtreecommitdiff
path: root/src/demuxers/demux_ts.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/demuxers/demux_ts.c')
-rw-r--r--src/demuxers/demux_ts.c317
1 files changed, 144 insertions, 173 deletions
diff --git a/src/demuxers/demux_ts.c b/src/demuxers/demux_ts.c
index aea0c8ca1..e80e8af70 100644
--- a/src/demuxers/demux_ts.c
+++ b/src/demuxers/demux_ts.c
@@ -15,9 +15,7 @@
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
- *
- * $Id: demux_ts.c,v 1.129 2007/04/02 10:46:08 dgp85 Exp $
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
*
* Demultiplexer for MPEG2 Transport Streams.
*
@@ -149,9 +147,9 @@
#define LOG
*/
-#include "xine_internal.h"
-#include "xineutils.h"
-#include "demux.h"
+#include <xine/xine_internal.h>
+#include <xine/xineutils.h>
+#include <xine/demux.h>
/*
#define TS_LOG
@@ -180,6 +178,8 @@
#define MAX_PES_BUF_SIZE 2048
+#define CORRUPT_PES_THRESHOLD 10
+
#define NULL_PID 0x1fff
#define INVALID_PID ((unsigned int)(-1))
#define INVALID_PROGRAM ((unsigned int)(-1))
@@ -296,7 +296,7 @@ typedef struct {
uint32_t pmt_pid[MAX_PMTS];
uint8_t *pmt[MAX_PMTS];
uint8_t *pmt_write_ptr[MAX_PMTS];
- uint32_t crc32_table[256];
+ uint32_t last_pmt_crc;
/*
* Stuff to do with the transport header. As well as the video
* and audio PIDs, we keep the index of the corresponding entry
@@ -337,9 +337,10 @@ typedef struct {
int32_t packet_number;
/* NEW: var to keep track of number of last read packets */
int32_t npkt_read;
- int32_t read_zero;
uint8_t buf[BUF_SIZE]; /* == PKT_SIZE * NPKT_PER_READ */
+
+ int numPreview;
} demux_ts_t;
@@ -354,28 +355,6 @@ typedef struct {
} demux_ts_class_t;
-static void demux_ts_build_crc32_table(demux_ts_t*this) {
- uint32_t i, j, k;
-
- for( i = 0 ; i < 256 ; i++ ) {
- k = 0;
- for (j = (i << 24) | 0x800000 ; j != 0x80000000 ; j <<= 1) {
- k = (k << 1) ^ (((k ^ j) & 0x80000000) ? 0x04c11db7 : 0);
- }
- this->crc32_table[i] = k;
- }
-}
-
-static uint32_t demux_ts_compute_crc32(demux_ts_t*this, uint8_t *data,
- uint32_t length, uint32_t crc32) {
- uint32_t i;
-
- for(i = 0; i < length; i++) {
- crc32 = (crc32 << 8) ^ this->crc32_table[(crc32 >> 24) ^ data[i]];
- }
- return crc32;
-}
-
/* redefine abs as macro to handle 64-bit diffs.
i guess llabs may not be available everywhere */
#define abs(x) ( ((x)<0) ? -(x) : (x) )
@@ -443,6 +422,17 @@ static void check_newpts( demux_ts_t *this, int64_t pts, int video )
}
}
+/* Send a BUF_SPU_DVB to let xine know of that channel. */
+static void demux_send_special_spu_buf( demux_ts_t *this, int spu_channel )
+{
+ buf_element_t *buf;
+
+ buf = this->video_fifo->buffer_pool_alloc( this->video_fifo );
+ buf->type = BUF_SPU_DVB|spu_channel;
+ buf->content = buf->mem;
+ buf->size = 0;
+ this->video_fifo->put( this->video_fifo, buf );
+}
/*
* demux_ts_update_spu_channel
@@ -452,7 +442,6 @@ static void check_newpts( demux_ts_t *this, int64_t pts, int video )
*/
static void demux_ts_update_spu_channel(demux_ts_t *this)
{
- xine_event_t ui_event;
buf_element_t *buf;
this->current_spu_channel = this->stream->spu_channel;
@@ -471,6 +460,7 @@ static void demux_ts_update_spu_channel(demux_ts_t *this)
buf->decoder_info[2] = sizeof(lang->desc);
buf->decoder_info_ptr[2] = &(lang->desc);
+ buf->type |= this->current_spu_channel;
this->spu_pid = lang->pid;
this->spu_media = lang->media_index;
@@ -492,11 +482,6 @@ static void demux_ts_update_spu_channel(demux_ts_t *this)
}
this->video_fifo->put(this->video_fifo, buf);
-
- /* Inform UI of SPU channel changes */
- ui_event.type = XINE_EVENT_UI_CHANNELS_CHANGED;
- ui_event.data_length = 0;
- xine_event_send(this->stream, &ui_event);
}
/*
@@ -513,7 +498,7 @@ static void demux_ts_parse_pat (demux_ts_t*this, unsigned char *original_pkt,
unsigned char *pkt, unsigned int pusi) {
uint32_t table_id;
uint32_t section_syntax_indicator;
- uint32_t section_length;
+ int32_t section_length;
uint32_t transport_stream_id;
uint32_t version_number;
uint32_t current_next_indicator;
@@ -588,8 +573,7 @@ static void demux_ts_parse_pat (demux_ts_t*this, unsigned char *original_pkt,
}
/* Check CRC. */
- calc_crc32 = demux_ts_compute_crc32 (this, pkt+5, section_length+3-4,
- 0xffffffff);
+ calc_crc32 = _x_compute_crc32 (pkt+5, section_length+3-4, 0xffffffff);
if (crc32 != calc_crc32) {
xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG,
"demux_ts: demux error! PAT with invalid CRC32: packet_crc32: %.8x calc_crc32: %.8x\n",
@@ -636,6 +620,7 @@ static void demux_ts_parse_pat (demux_ts_t*this, unsigned char *original_pkt,
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;
}
@@ -683,7 +668,11 @@ static int demux_ts_parse_pes_header (xine_t *xine, demux_ts_media *m,
stream_id = p[3];
if (packet_len==0)
+ {
+ xprintf (xine, XINE_VERBOSITY_DEBUG,
+ "demux_ts: error pes length 0\n");
return 0;
+ }
#ifdef TS_LOG
printf ("demux_ts: packet stream id: %.2x len: %d (%x)\n",
@@ -730,12 +719,11 @@ static int demux_ts_parse_pes_header (xine_t *xine, demux_ts_media *m,
if (stream_id == 0xbd) {
- int track, spu_id;
+ int spu_id;
lprintf ("audio buf = %02X %02X %02X %02X %02X %02X %02X %02X\n",
p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7]);
- track = p[0] & 0x0F; /* hack : ac3 track */
/*
* we check the descriptor tag first because some stations
* do not include any of the ac3 header info in their audio tracks
@@ -755,7 +743,7 @@ static int demux_ts_parse_pes_header (xine_t *xine, demux_ts_media *m,
m->content = p;
m->size = packet_len;
- m->type = BUF_SPU_DVB;
+ m->type |= BUF_SPU_DVB;
m->buf->decoder_info[2] = payload_len;
return 1;
} else if ((p[0] & 0xE0) == 0x20) {
@@ -769,7 +757,7 @@ static int demux_ts_parse_pes_header (xine_t *xine, demux_ts_media *m,
m->content = p+4;
m->size = packet_len - 4;
- m->type |= BUF_AUDIO_A52 + track;
+ m->type |= BUF_AUDIO_A52;
return 1;
} else if ((p[0]&0xf0) == 0xa0) {
@@ -785,7 +773,7 @@ static int demux_ts_parse_pes_header (xine_t *xine, demux_ts_media *m,
m->content = p+pcm_offset;
m->size = packet_len-pcm_offset;
- m->type |= BUF_AUDIO_LPCM_BE + track;
+ m->type |= BUF_AUDIO_LPCM_BE;
return 1;
}
@@ -816,26 +804,22 @@ static int demux_ts_parse_pes_header (xine_t *xine, demux_ts_media *m,
} else if ((stream_id & 0xe0) == 0xc0) {
- int track;
-
- track = stream_id & 0x1f;
-
m->content = p;
m->size = packet_len;
switch (m->descriptor_tag) {
case ISO_11172_AUDIO:
case ISO_13818_AUDIO:
lprintf ("demux_ts: found MPEG audio track.\n");
- m->type |= BUF_AUDIO_MPEG + track;
+ m->type |= BUF_AUDIO_MPEG;
break;
case ISO_13818_PART7_AUDIO:
case ISO_14496_PART3_AUDIO:
lprintf ("demux_ts: found AAC audio track.\n");
- m->type |= BUF_AUDIO_AAC + track;
+ m->type |= BUF_AUDIO_AAC;
break;
default:
lprintf ("demux_ts: unknown audio type: %d, defaulting to MPEG.\n", m->descriptor_tag);
- m->type |= BUF_AUDIO_MPEG + track;
+ m->type |= BUF_AUDIO_MPEG;
break;
}
return 1;
@@ -890,6 +874,16 @@ static void demux_ts_buffer_pes(demux_ts_t*this, unsigned char *ts,
m->buf->decoder_info[1] = BUF_SPECIAL_SPU_DVD_SUBTYPE;
m->buf->decoder_info[2] = SPU_DVD_SUBTYPE_PACKAGE;
}
+ else {
+ if (this->numPreview<5)
+ ++this->numPreview;
+ if ( this->numPreview==1 )
+ m->buf->decoder_flags=BUF_FLAG_HEADER | BUF_FLAG_FRAME_END;
+ else if ( this->numPreview<5 )
+ m->buf->decoder_flags=BUF_FLAG_PREVIEW;
+ else
+ m->buf->decoder_flags=BUF_FLAG_FRAME_END;
+ }
m->buf->pts = m->pts;
m->buf->decoder_info[0] = 1;
@@ -910,12 +904,17 @@ static void demux_ts_buffer_pes(demux_ts_t*this, unsigned char *ts,
m->buf = m->fifo->buffer_pool_alloc(m->fifo);
if (!demux_ts_parse_pes_header(this->stream->xine, m, ts, len, this->stream)) {
- m->corrupted_pes = 1;
m->buf->free_buffer(m->buf);
m->buf = NULL;
- xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG,
+
+ if (m->corrupted_pes > CORRUPT_PES_THRESHOLD) {
+ if (this->videoPid == m->pid)
+ this->videoPid = INVALID_PID;
+ } else {
+ m->corrupted_pes++;
+ xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG,
"demux_ts: PID 0x%.4x: corrupted pes encountered\n", m->pid);
-
+ }
} else {
m->corrupted_pes = 0;
@@ -1073,7 +1072,7 @@ static void demux_ts_parse_pmt (demux_ts_t *this,
unsigned char *stream;
unsigned int i;
int count;
- char *ptr = NULL;
+ uint8_t *ptr = NULL;
unsigned char len;
unsigned int offset=0;
@@ -1180,20 +1179,32 @@ printf("Program Number is %i, looking for %i\n",program_number,this->program_num
crc32 |= (uint32_t) this->pmt[program_count][section_length+3-1] ;
/* Check CRC. */
- calc_crc32 = demux_ts_compute_crc32 (this,
- this->pmt[program_count],
- section_length+3-4, 0xffffffff);
+ calc_crc32 = _x_compute_crc32 (this->pmt[program_count],
+ section_length+3-4, 0xffffffff);
if (crc32 != calc_crc32) {
xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG,
"demux_ts: demux error! PMT with invalid CRC32: packet_crc32: %#.8x calc_crc32: %#.8x\n",
crc32,calc_crc32);
return;
}
-#ifdef TS_PMT_LOG
else {
+#ifdef TS_PMT_LOG
printf ("demux_ts: PMT CRC32 ok.\n");
- }
#endif
+ if ( crc32==this->last_pmt_crc ) {
+#ifdef TS_PMT_LOG
+ printf("demux_ts: PMT with CRC32=%d already parsed. Skipping.\n", crc32);
+#endif
+ return;
+ }
+ else {
+#ifdef TS_PMT_LOG
+ printf("demux_ts: new PMT, parsing...\n");
+#endif
+ this->last_pmt_crc = crc32;
+ }
+ }
+
/*
* ES definitions start here...we are going to learn upto one video
@@ -1244,7 +1255,7 @@ printf("Program Number is %i, looking for %i\n",program_number,this->program_num
case ISO_14496_PART10_VIDEO:
if (this->videoPid == INVALID_PID) {
#ifdef TS_PMT_LOG
- printf ("demux_ts: PMT video pid 0x%.4x\n", pid);
+ 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;
@@ -1266,7 +1277,7 @@ printf("Program Number is %i, looking for %i\n",program_number,this->program_num
}
if(!found) {
#ifdef TS_PMT_LOG
- printf ("demux_ts: PMT audio pid 0x%.4x\n", pid);
+ 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;
@@ -1280,7 +1291,7 @@ printf("Program Number is %i, looking for %i\n",program_number,this->program_num
break;
case ISO_13818_PRIVATE:
#ifdef TS_PMT_LOG
- printf ("demux_ts: PMT streamtype 13818_PRIVATE, pid: 0x%.4x\n", pid);
+ printf ("demux_ts: PMT streamtype 13818_PRIVATE, pid: 0x%.4x type %2.2x\n", pid, stream[0]);
for (i = 5; i < coded_length; i++)
printf ("%.2x ", stream[i]);
@@ -1289,13 +1300,12 @@ printf("Program Number is %i, looking for %i\n",program_number,this->program_num
break;
case ISO_13818_TYPE_C: /* data carousel */
#ifdef TS_PMT_LOG
- printf ("demux_ts: PMT streamtype 13818_TYPE_C, pid: 0x%.4x\n", pid);
+ printf ("demux_ts: PMT streamtype 13818_TYPE_C, pid: 0x%.4x type %2.2x\n", pid, stream[0]);
#endif
break;
case ISO_13818_PES_PRIVATE:
for (i = 5; i < coded_length; i += stream[i+1] + 2) {
if ((stream[i] == 0x6a) && (this->audio_tracks_count < MAX_AUDIO_TRACKS)) {
- uint32_t format_identifier=0;
int i, found = 0;
for(i = 0; i < this->audio_tracks_count; i++) {
if(this->audio_tracks[i].pid == pid) {
@@ -1305,7 +1315,7 @@ printf("Program Number is %i, looking for %i\n",program_number,this->program_num
}
if(!found) {
#ifdef TS_PMT_LOG
- printf ("demux_ts: PMT AC3 audio pid 0x%.4x\n", pid);
+ printf ("demux_ts: PMT AC3 audio pid 0x%.4x type %2.2x\n", pid, stream[0]);
#endif
demux_ts_pes_new(this, this->media_num, pid,
this->audio_fifo, 0x81);
@@ -1323,7 +1333,7 @@ printf("Program Number is %i, looking for %i\n",program_number,this->program_num
else if (stream[i] == 0x56)
{
#ifdef TS_PMT_LOG
- printf ("demux_ts: PMT Teletext, pid: 0x%.4x\n", pid);
+ printf ("demux_ts: PMT Teletext, pid: 0x%.4x type %2.2x\n", pid, stream[0]);
for (i = 5; i < coded_length; i++)
printf ("%.2x ", stream[i]);
@@ -1354,14 +1364,15 @@ printf("Program Number is %i, looking for %i\n",program_number,this->program_num
(stream[pos + 6] << 8) | stream[pos + 7];
lang->pid = pid;
lang->media_index = this->media_num;
- demux_ts_pes_new(this, this->media_num,
- pid, this->video_fifo,
- stream[0]);
+ this->media[this->media_num].type = no;
+ demux_ts_pes_new(this, this->media_num, pid, this->video_fifo, stream[0]);
+ demux_send_special_spu_buf( this, no );
#ifdef TS_LOG
- printf("demux_ts: DVBSUB: pid 0x%.4x: %s page %ld %ld\n",
+ printf("demux_ts: DVBSUB: pid 0x%.4x: %s page %ld %ld type %2.2x\n",
pid, lang->desc.lang,
lang->desc.comp_page_id,
- lang->desc.aux_page_id);
+ lang->desc.aux_page_id,
+ stream[0]);
#endif
}
}
@@ -1433,8 +1444,14 @@ printf("Program Number is %i, looking for %i\n",program_number,this->program_num
this->pcrPid = pid;
}
- /* DVBSUB: update spu decoder */
- demux_ts_update_spu_channel(this);
+ if ( this->stream->spu_channel>=0 && this->spu_langs_count>0 )
+ demux_ts_update_spu_channel( this );
+
+ /* Inform UI of channels changes */
+ xine_event_t ui_event;
+ ui_event.type = XINE_EVENT_UI_CHANNELS_CHANGED;
+ ui_event.data_length = 0;
+ xine_event_send( this->stream, &ui_event );
}
static int sync_correct(demux_ts_t*this, uint8_t *buf, int32_t npkt_read) {
@@ -1531,12 +1548,7 @@ static unsigned char * demux_synchronise(demux_ts_t* this) {
*/
if (this->npkt_read == 0) {
- /* printf ("demux_ts: read 0 packets! (%d)\n", this->read_zero); */
- this->read_zero++;
- } else this->read_zero = 0;
-
- if (this->read_zero > 200) {
- xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, "demux_ts: read 0 packets too many times!\n");
+ xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, "demux_ts: read 0 packets\n");
this->status = DEMUX_FINISHED;
return NULL;
}
@@ -1785,13 +1797,27 @@ static void demux_ts_parse_packet (demux_ts_t*this) {
if ( (pes_stream_id >= VIDEO_STREAM_S) && (pes_stream_id <= VIDEO_STREAM_E) ) {
if ( this->videoPid == INVALID_PID) {
-
- xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG,
- "demux_ts: auto-detected video pid 0x%.4x\n", pid);
-
- this->videoPid = pid;
- this->videoMedia = this->media_num;
- demux_ts_pes_new(this, this->media_num++, pid, this->video_fifo, pes_stream_id);
+ int i, found = 0;
+ for(i = 0; i < this->media_num; i++) {
+ if (this->media[i].pid == pid) {
+ found = 1;
+ break;
+ }
+ }
+
+ if (found && (this->media[i].corrupted_pes == 0)) {
+ this->videoPid = pid;
+ this->videoMedia = i;
+ } else if (!found) {
+ this->videoPid = pid;
+ this->videoMedia = this->media_num;
+ demux_ts_pes_new(this, this->media_num++, pid, this->video_fifo, pes_stream_id);
+ }
+
+ if (this->videoPid != INVALID_PID) {
+ xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG,
+ "demux_ts: auto-detected video pid 0x%.4x\n", pid);
+ }
}
} else if ( (pes_stream_id >= AUDIO_STREAM_S) && (pes_stream_id <= AUDIO_STREAM_E) ) {
if (this->audio_tracks_count < MAX_AUDIO_TRACKS) {
@@ -1891,6 +1917,7 @@ static void demux_ts_event_handler (demux_ts_t *this) {
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;
@@ -1966,6 +1993,7 @@ static void demux_ts_send_headers (demux_plugin_t *this_gen) {
this->videoPid = INVALID_PID;
this->audio_tracks_count = 0;
this->media_num= 0;
+ this->last_pmt_crc = 0;
_x_demux_control_start (this->stream);
@@ -1973,8 +2001,6 @@ static void demux_ts_send_headers (demux_plugin_t *this_gen) {
this->send_newpts = 1;
- demux_ts_build_crc32_table (this);
-
this->status = DEMUX_OK ;
this->send_end_buffers = 1;
@@ -1983,7 +2009,7 @@ static void demux_ts_send_headers (demux_plugin_t *this_gen) {
/* DVBSUB */
this->spu_pid = INVALID_PID;
this->spu_langs_count = 0;
- this->current_spu_channel = this->stream->spu_channel;
+ this->current_spu_channel = -1;
/* FIXME ? */
_x_stream_info_set(this->stream, XINE_STREAM_INFO_HAS_VIDEO, 1);
@@ -2061,7 +2087,6 @@ static int demux_ts_get_optional_data(demux_plugin_t *this_gen,
demux_ts_t *this = (demux_ts_t *) this_gen;
char *str = data;
int channel = *((int *)data);
- int track_num;
/* be a bit paranoid */
if (this == NULL || this->stream == NULL)
@@ -2072,31 +2097,21 @@ static int demux_ts_get_optional_data(demux_plugin_t *this_gen,
case DEMUX_OPTIONAL_DATA_AUDIOLANG:
if ((channel >= 0) && (channel < this->audio_tracks_count)) {
if(this->audio_tracks[channel].lang)
- strcpy(str, this->audio_tracks[channel].lang);
+ strcpy(str, this->audio_tracks[channel].lang);
else
- sprintf(str, "%3i", _x_get_audio_channel(this->stream));
+ sprintf(str, "%3i", _x_get_audio_channel(this->stream));
+ }
+ else {
+ snprintf(str, XINE_LANG_MAX, "%3i", _x_get_audio_channel(this->stream));
}
- else
- {
- snprintf(str, XINE_LANG_MAX, "%3i", _x_get_audio_channel(this->stream));
- }
return DEMUX_OPTIONAL_SUCCESS;
case DEMUX_OPTIONAL_DATA_SPULANG:
- if (this->current_spu_channel >= 0
- && this->current_spu_channel < this->spu_langs_count)
- {
- memcpy(str, this->spu_langs[this->current_spu_channel].desc.lang, 3);
- str[3] = 0;
- }
- else if (this->current_spu_channel == -1)
- {
- strcpy(str, "none");
- }
- else
- {
- snprintf(str, XINE_LANG_MAX, "%3i", this->current_spu_channel);
- }
+ if (channel>=0 && channel<this->spu_langs_count) {
+ memcpy(str, this->spu_langs[channel].desc.lang, 3);
+ str[3] = 0;}
+ else
+ strcpy(str, "none");
return DEMUX_OPTIONAL_SUCCESS;
default:
@@ -2147,34 +2162,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen,
}
break;
- case METHOD_BY_EXTENSION: {
- const char *const mrl = input->get_mrl (input);
-
- /* check extension */
- const char *const extensions = class_gen->get_extensions (class_gen);
-
- if (_x_demux_check_extension (mrl, extensions))
- break;
-
- /* accept dvb streams */
- /*
- * Also handle the special dvbs,dvbt and dvbc mrl formats:
- * the content is exactly the same but the input plugin
- * uses a different tuning algorithm [Pragma]
- */
-
- if (!strncasecmp (mrl, "dvb://", 6))
- break;
- if (!strncasecmp (mrl, "dvbs://", 7))
- break;
- if (!strncasecmp (mrl, "dvbc://", 7))
- break;
- if (!strncasecmp (mrl, "dvbt://", 7))
- break;
-
- return NULL;
- }
-
+ case METHOD_BY_MRL:
case METHOD_EXPLICIT:
break;
@@ -2221,55 +2209,32 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen,
this->scrambled_npids = 0;
this->videoPid = INVALID_PID;
this->audio_tracks_count = 0;
+ this->last_pmt_crc = 0;
this->rate = 16000; /* FIXME */
this->status = DEMUX_FINISHED;
#ifdef TS_READ_STATS
- for (i=0; i<=NPKT_PER_READ; i++) {
- this->rstat[i] = 0;
- }
+ memset(this-rstat, 0, sizeof(*this->rstat)*NPKT_PER_READ);
#endif
/* DVBSUB */
this->spu_pid = INVALID_PID;
this->spu_langs_count = 0;
- this->current_spu_channel = this->stream->spu_channel;
+ this->current_spu_channel = -1;
/* dvb */
this->event_queue = xine_event_new_queue (this->stream);
+ this->numPreview=0;
+
return &this->demux_plugin;
}
/*
* ts demuxer class
*/
-
-static const char *get_description (demux_class_t *this_gen) {
- return "MPEG Transport Stream demuxer";
-}
-
-static const char *get_identifier (demux_class_t *this_gen) {
- return "MPEG_TS";
-}
-
-static const char *get_extensions (demux_class_t *this_gen) {
- return "ts m2t trp";
-}
-
-static const char *get_mimetypes (demux_class_t *this_gen) {
- return NULL;
-}
-
-static void class_dispose (demux_class_t *this_gen) {
-
- demux_ts_class_t *this = (demux_ts_class_t *) this_gen;
-
- free (this);
-}
-
static void *init_class (xine_t *xine, void *data) {
demux_ts_class_t *this;
@@ -2279,11 +2244,16 @@ static void *init_class (xine_t *xine, void *data) {
this->xine = xine;
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_("MPEG Transport Stream demuxer");
+ this->demux_class.identifier = "MPEG_TS";
+ this->demux_class.mimetypes = NULL;
+
+ /* accept dvb streams; also handle the special dvbs,dvbt and dvbc
+ * mrl formats: the content is exactly the same but the input plugin
+ * uses a different tuning algorithm [Pragma]
+ */
+ this->demux_class.extensions = "ts m2t trp dvb:// dvbs:// dvbc:// dvbt://";
+ this->demux_class.dispose = default_demux_class_dispose;
return this;
}
@@ -2298,6 +2268,7 @@ static const demuxer_info_t demux_info_ts = {
const plugin_info_t xine_plugin_info[] EXPORTED = {
/* type, API, "name", version, special_info, init_function */
- { PLUGIN_DEMUX, 26, "mpeg-ts", XINE_VERSION_CODE, &demux_info_ts, init_class },
+ { PLUGIN_DEMUX, 27, "mpeg-ts", XINE_VERSION_CODE, &demux_info_ts, init_class },
{ PLUGIN_NONE, 0, "", 0, NULL, NULL }
};
+