diff options
Diffstat (limited to 'xine/BluRay/demux_ts.c')
-rw-r--r-- | xine/BluRay/demux_ts.c | 187 |
1 files changed, 94 insertions, 93 deletions
diff --git a/xine/BluRay/demux_ts.c b/xine/BluRay/demux_ts.c index 220ce4f7..411e9665 100644 --- a/xine/BluRay/demux_ts.c +++ b/xine/BluRay/demux_ts.c @@ -1,3 +1,4 @@ + /* * Copyright (C) 2000-2003 the xine project * @@ -39,7 +40,7 @@ * - demux HDMV/BluRay bitmap subtitles * * 28-Nov-2004 Mike Lampard <mlampard> - * - Added support for PMT sections larger than 1 ts packet + * - Added support for PMT sections larger than 1 ts packet * * 28-Aug-2004 James Courtier-Dutton <jcdutton> * - Improve PAT and PMT handling. Added some FIXME comments. @@ -57,7 +58,7 @@ * - dynamic allocation leaks fixes * * 27-May-2002 Giovanni Baronetti and Mauro Borghi <mauro.borghi@tilab.com> - * - fill buffers before putting them in fifos + * - fill buffers before putting them in fifos * - force PMT reparsing when PMT PID changes * - accept non seekable input plugins -- FIX? * - accept dvb as input plugin @@ -183,7 +184,7 @@ #define PKT_SIZE 188 #define BODY_SIZE (188 - 4) /* more PIDS are needed due "auto-detection". 40 spare media entries */ -#define MAX_PIDS ((BODY_SIZE - 1 - 13) / 4) + 40 +#define MAX_PIDS ((BODY_SIZE - 1 - 13) / 4) + 40 #define MAX_PMTS ((BODY_SIZE - 1 - 13) / 4) + 10 #define SYNC_BYTE 0x47 @@ -294,7 +295,7 @@ typedef struct { int pid; int media_index; } demux_ts_spu_lang; - + /* Audio Channels */ #define MAX_AUDIO_TRACKS 32 @@ -346,10 +347,10 @@ typedef struct { unsigned int pid_count; unsigned int videoPid; unsigned int videoMedia; - + demux_ts_audio_track audio_tracks[MAX_AUDIO_TRACKS]; int audio_tracks_count; - + int send_end_buffers; int64_t last_pts[2]; int send_newpts; @@ -377,7 +378,7 @@ typedef struct { int32_t npkt_read; uint8_t buf[BUF_SIZE]; /* == PKT_SIZE * NPKT_PER_READ */ - + int numPreview; } demux_ts_t; @@ -405,7 +406,7 @@ static void demux_ts_build_crc32_table(demux_ts_t*this) { } } -static uint32_t demux_ts_compute_crc32(demux_ts_t*this, uint8_t *data, +static uint32_t demux_ts_compute_crc32(demux_ts_t*this, uint8_t *data, int32_t length, uint32_t crc32) { int32_t i; @@ -450,7 +451,7 @@ static void check_newpts( demux_ts_t *this, int64_t pts, int video ) The original code worked well when the wrap happend like this: V7 A7 V8 V9 A9 Dv V0 V1 da A1 V2 V3 A3 V4 - + Legend: Vn = video packet with timestamp n An = audio packet with timestamp n @@ -468,16 +469,16 @@ static void check_newpts( demux_ts_t *this, int64_t pts, int video ) a delay of almoust 26.5 hours! The new code gives the following sequences for the above examples: - + V7 A7 V8 V9 A9 Dv V0 V1 A1 V2 V3 A3 V4 V7 V8 A7 V9 Dv V0 Da A9 Dv V1 V2 A1 V3 V4 A3 After proving this code it should be cleaned up to use just a single variable "last_pts". */ - + /* this->last_pts[video] = pts; -*/ +*/ this->last_pts[video] = this->last_pts[1-video] = pts; } } @@ -503,7 +504,7 @@ static void demux_send_special_spu_buf( demux_ts_t *this, uint32_t spu_type, int static void demux_ts_update_spu_channel(demux_ts_t *this) { buf_element_t *buf; - + this->current_spu_channel = this->stream->spu_channel; buf = this->video_fifo->buffer_pool_alloc(this->video_fifo); @@ -512,7 +513,7 @@ static void demux_ts_update_spu_channel(demux_ts_t *this) buf->decoder_flags = BUF_FLAG_SPECIAL; buf->decoder_info[1] = BUF_SPECIAL_SPU_DVB_DESCRIPTOR; buf->size = 0; - + if (this->current_spu_channel >= 0 && this->current_spu_channel < this->spu_langs_count) { @@ -581,7 +582,7 @@ static void demux_ts_parse_pat (demux_ts_t*this, unsigned char *original_pkt, * indicator set. */ if (!pusi) { - xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, + xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, "demux_ts: demux error! PAT without payload unit start indicator\n"); return; } @@ -591,7 +592,7 @@ static void demux_ts_parse_pat (demux_ts_t*this, unsigned char *original_pkt, */ pkt += pkt[4]; if (pkt - original_pkt > PKT_SIZE) { - xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, + xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, "demux_ts: demux error! PAT with invalid pointer\n"); return; } @@ -625,13 +626,13 @@ static void demux_ts_parse_pat (demux_ts_t*this, unsigned char *original_pkt, } if (pkt - original_pkt > BODY_SIZE - 1 - 3 - section_length) { - xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, + xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, "demux_ts: FIXME: (unsupported )PAT spans multiple TS packets\n"); return; } if ((section_number != 0) || (last_section_number != 0)) { - xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, + xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, "demux_ts: FIXME: (unsupported) PAT consists of multiple (%d) sections\n", last_section_number); return; } @@ -640,11 +641,11 @@ static void demux_ts_parse_pat (demux_ts_t*this, unsigned char *original_pkt, calc_crc32 = demux_ts_compute_crc32 (this, pkt+5, section_length+3-4, 0xffffffff); if (crc32 != calc_crc32) { - xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, + xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, "demux_ts: demux error! PAT with invalid CRC32: packet_crc32: %.8x calc_crc32: %.8x\n", crc32,calc_crc32); return; - } + } #ifdef TS_PAT_LOG else { printf ("demux_ts: PAT CRC32 ok.\n"); @@ -725,7 +726,7 @@ static int demux_ts_parse_pes_header (xine_t *xine, demux_ts_media *m, /* we should have a PES packet here */ if (p[0] || p[1] || (p[2] != 1)) { - xprintf (xine, XINE_VERBOSITY_DEBUG, + xprintf (xine, XINE_VERBOSITY_DEBUG, "demux_ts: error %02x %02x %02x (should be 0x000001) \n", p[0], p[1], p[2]); return 0 ; } @@ -776,7 +777,7 @@ static int demux_ts_parse_pes_header (xine_t *xine, demux_ts_media *m, /* sometimes corruption on header_len causes segfault in memcpy below */ if (header_len + 9 > pkt_len) { - xprintf (xine, XINE_VERBOSITY_DEBUG, + xprintf (xine, XINE_VERBOSITY_DEBUG, "demux_ts: illegal value for PES_header_data_length (0x%x)\n", header_len); return 0; } @@ -805,7 +806,7 @@ static int demux_ts_parse_pes_header (xine_t *xine, demux_ts_media *m, if (stream_id == 0xbd || stream_id == 0xfd /* HDMV */) { 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]); @@ -815,7 +816,7 @@ 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 == STREAM_AUDIO_AC3) || /* ac3 - raw */ + if((m->descriptor_tag == STREAM_AUDIO_AC3) || /* ac3 - raw */ (p[0] == 0x0B && p[1] == 0x77)) { /* ac3 - syncword */ m->content = p; m->size = packet_len; @@ -909,7 +910,7 @@ static int demux_ts_parse_pes_header (xine_t *xine, demux_ts_media *m, m->content = p; m->size = packet_len; switch (m->descriptor_tag) { - case ISO_11172_AUDIO: + case ISO_11172_AUDIO: case ISO_13818_AUDIO: lprintf ("demux_ts: found MPEG audio track.\n"); m->type |= BUF_AUDIO_MPEG; @@ -958,7 +959,7 @@ static void demux_ts_buffer_pes(demux_ts_t*this, unsigned char *ts, case (i.e. adaptation field only) when it does not get bumped. */ if (m->counter != INVALID_CC) { if ((m->counter & 0x0f) != cc) { - xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "demux_ts: PID 0x%.4x: unexpected cc %d (expected %d)\n", m->pid, cc, m->counter); } } @@ -988,9 +989,9 @@ static void demux_ts_buffer_pes(demux_ts_t*this, unsigned char *ts, } m->buf->pts = m->pts; m->buf->decoder_info[0] = 1; - + if( this->input->get_length (this->input) ) - m->buf->extra_info->input_normpos = (int)( (double) this->input->get_current_pos (this->input) * + m->buf->extra_info->input_normpos = (int)( (double) this->input->get_current_pos (this->input) * 65535 / this->input->get_length (this->input) ); if (this->rate) m->buf->extra_info->input_time = (int)((int64_t)this->input->get_current_pos (this->input) @@ -1008,7 +1009,7 @@ static void demux_ts_buffer_pes(demux_ts_t*this, unsigned char *ts, if (!demux_ts_parse_pes_header(this->stream->xine, m, ts, len, this->stream)) { m->buf->free_buffer(m->buf); m->buf = NULL; - + if (m->corrupted_pes > CORRUPT_PES_THRESHOLD && m->autodetected) { if (this->videoPid == m->pid) { this->videoPid = INVALID_PID; @@ -1016,7 +1017,7 @@ static void demux_ts_buffer_pes(demux_ts_t*this, unsigned char *ts, } } else { m->corrupted_pes++; - xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "demux_ts: PID 0x%.4x: corrupted pes encountered\n", m->pid); } } else { @@ -1035,7 +1036,7 @@ static void demux_ts_buffer_pes(demux_ts_t*this, unsigned char *ts, m->buf->pts = m->pts; m->buf->decoder_info[0] = 1; if( this->input->get_length (this->input) ) - m->buf->extra_info->input_normpos = (int)( (double) this->input->get_current_pos (this->input) * + m->buf->extra_info->input_normpos = (int)( (double) this->input->get_current_pos (this->input) * 65535 / this->input->get_length (this->input) ); if (this->rate) m->buf->extra_info->input_time = (int)((int64_t)this->input->get_current_pos (this->input) @@ -1120,7 +1121,7 @@ static void demux_ts_get_reg_desc(demux_ts_t *this, uint32_t *dest, { *dest = (d[2] << 24) | (d[3] << 16) | (d[4] << 8) | d[5]; - xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "demux_ts: found registration format identifier: 0x%.4x\n", *dest); return; } @@ -1142,7 +1143,7 @@ static inline int ts_payloadsize(unsigned char * tsp) } return 184; } - + /* * NAME demux_ts_parse_pmt @@ -1172,14 +1173,14 @@ static void demux_ts_parse_pmt (demux_ts_t *this, uint32_t crc32; uint32_t calc_crc32; uint32_t coded_length; - unsigned int pid; + unsigned int pid; unsigned char *stream; - unsigned int i; - int count; - char *ptr = NULL; + unsigned int i; + int count; + char *ptr = NULL; unsigned char len; - unsigned int offset=0; - + unsigned int offset=0; + /* * A new section should start with the payload unit start * indicator set. We allocate some mem (max. allowed for a PM section) @@ -1188,7 +1189,7 @@ static void demux_ts_parse_pmt (demux_ts_t *this, if (pusi) { pkt+=pkt[4]; /* pointer to start of section */ offset=1; - + if (this->pmt[program_count] != NULL) free(this->pmt[program_count]); this->pmt[program_count] = (uint8_t *) calloc(4096, sizeof(unsigned char)); this->pmt_write_ptr[program_count] = this->pmt[program_count]; @@ -1232,7 +1233,7 @@ printf("Program Number is %i, looking for %i\n",program_number,this->program_num } if ((section_number != 0) || (last_section_number != 0)) { - xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, + xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, "demux_ts: FIXME (unsupported) PMT consists of multiple (%d) sections\n", last_section_number); return; } @@ -1258,7 +1259,7 @@ printf("Program Number is %i, looking for %i\n",program_number,this->program_num len = count-offset; memcpy (this->pmt_write_ptr[program_count], ptr, len); this->pmt_write_ptr[program_count] +=len; - + #ifdef TS_PMT_LOG printf ("ts_demux: wr_ptr: %p, will be %p when finished\n", this->pmt_write_ptr[program_count], @@ -1296,9 +1297,9 @@ printf("Program Number is %i, looking for %i\n",program_number,this->program_num this->pmt[program_count], section_length+3-4, 0xffffffff); if (crc32 != calc_crc32) { - xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, + 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); + crc32,calc_crc32); return; } else { @@ -1345,7 +1346,7 @@ printf("Program Number is %i, looking for %i\n",program_number,this->program_num stream = &this->pmt[program_count][12] + program_info_length; coded_length = 13 + program_info_length; if (coded_length > section_length) { - xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, + xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, "demux error! PMT with inconsistent progInfo length\n"); return; } @@ -1362,7 +1363,7 @@ printf("Program Number is %i, looking for %i\n",program_number,this->program_num stream_info_length = ((stream[3] << 8) | stream[4]) & 0x0fff; coded_length = 5 + stream_info_length; if (coded_length > section_length) { - xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, + xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, "demux error! PMT with inconsistent streamInfo length\n"); return; } @@ -1477,9 +1478,9 @@ printf("Program Number is %i, looking for %i\n",program_number,this->program_num { int no = this->spu_langs_count; demux_ts_spu_lang *lang = &this->spu_langs[no]; - + this->spu_langs_count++; - + memcpy(lang->desc.lang, &stream[pos], 3); lang->desc.lang[3] = 0; lang->desc.comp_page_id = @@ -1510,7 +1511,7 @@ printf("Program Number is %i, looking for %i\n",program_number,this->program_num if (this->spu_langs_count >= MAX_SPU_LANGS) { xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, - "demux_ts: too many SPU tracks ! ignoring pid 0x%.4x\n", + "demux_ts: too many SPU tracks! ignoring pid 0x%.4x\n", pid); break; } @@ -1541,7 +1542,7 @@ printf("Program Number is %i, looking for %i\n",program_number,this->program_num * then we check the registration format identifier to see if it holds "AC-3" (0x41432d33) and * 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) ) { int i, found = 0; for(i = 0; i < this->audio_tracks_count; i++) { @@ -1642,7 +1643,7 @@ static int sync_correct(demux_ts_t*this, uint8_t *buf, int32_t npkt_read) { n + p * this->pkt_size); /* FIXME: when read_length is not as required... we now stop demuxing */ if (read_length != (n + p * this->pkt_size)) { - xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, + xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, "demux_ts_tsync_correct: sync found, but read failed\n"); return 0; } @@ -1711,7 +1712,7 @@ static unsigned char * demux_synchronise(demux_ts_t* this) { read_length = this->input->read(this->input, this->buf, this->pkt_size * NPKT_PER_READ); if (read_length < 0 || read_length % this->pkt_size) { - xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, + xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, "demux_ts: read returned %d bytes (not a multiple of %d!)\n", read_length, this->pkt_size); this->status = DEMUX_FINISHED; @@ -1750,7 +1751,7 @@ static unsigned char * demux_synchronise(demux_ts_t* this) { } -static int64_t demux_ts_adaptation_field_parse(uint8_t *data, +static int64_t demux_ts_adaptation_field_parse(uint8_t *data, uint32_t adaptation_field_length) { uint32_t discontinuity_indicator=0; @@ -1872,7 +1873,7 @@ static void demux_ts_parse_packet (demux_ts_t*this) { transport_error_indicator = (originalPkt[1] >> 7) & 0x01; payload_unit_start_indicator = (originalPkt[1] >> 6) & 0x01; transport_priority = (originalPkt[1] >> 5) & 0x01; - pid = ((originalPkt[1] << 8) | + pid = ((originalPkt[1] << 8) | originalPkt[2]) & 0x1fff; transport_scrambling_control = (originalPkt[3] >> 6) & 0x03; adaptation_field_control = (originalPkt[3] >> 4) & 0x03; @@ -1893,7 +1894,7 @@ static void demux_ts_parse_packet (demux_ts_t*this) { * Discard packets that are obviously bad. */ if (sync_byte != SYNC_BYTE) { - xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, + xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, "demux error! invalid ts sync byte %.2x\n", sync_byte); return; } @@ -1908,7 +1909,7 @@ static void demux_ts_parse_packet (demux_ts_t*this) { if (transport_scrambling_control) { if (this->videoPid == pid) { - xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, + xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, "demux_ts: selected videoPid is scrambled; skipping...\n"); } for (i=0; i < this->scrambled_npids; i++) { @@ -1933,7 +1934,7 @@ static void demux_ts_parse_packet (demux_ts_t*this) { */ data_offset += adaptation_field_length + 1; } - + if (! (adaptation_field_control & 0x1)) { return; } @@ -1945,10 +1946,10 @@ static void demux_ts_parse_packet (demux_ts_t*this) { */ program_count=0; if(this->media_num<MAX_PMTS) - while ((this->program_number[program_count] != INVALID_PROGRAM) && - (program_count < MAX_PMTS)) { + while ((this->program_number[program_count] != INVALID_PROGRAM) && + (program_count < MAX_PMTS)) { if (pid == this->pmt_pid[program_count]) { - + #ifdef TS_LOG printf ("demux_ts: PMT prog: 0x%.4x pid: 0x%.4x\n", this->program_number[program_count], @@ -1961,7 +1962,7 @@ static void demux_ts_parse_packet (demux_ts_t*this) { } program_count++; } - + if (payload_unit_start_indicator && this->media_num < MAX_PIDS){ int pes_stream_id; if (pid == 0) { @@ -1975,7 +1976,7 @@ static void demux_ts_parse_packet (demux_ts_t*this) { #ifdef TS_HEADER_LOG printf("demux_ts:ts_pes_header:stream_id=0x%.2x\n",pes_stream_id); #endif - + if ( (pes_stream_id >= VIDEO_STREAM_S) && (pes_stream_id <= VIDEO_STREAM_E) ) { if ( this->videoPid == INVALID_PID) { int i, found = 0; @@ -1985,7 +1986,7 @@ static void demux_ts_parse_packet (demux_ts_t*this) { break; } } - + if (found && (this->media[i].corrupted_pes == 0)) { this->videoPid = pid; this->videoMedia = i; @@ -1995,11 +1996,11 @@ static void demux_ts_parse_packet (demux_ts_t*this) { this->media[this->videoMedia].autodetected = 1; demux_ts_pes_new(this, this->media_num++, pid, this->video_fifo, 0x100 + pes_stream_id); } - + if (this->videoPid != INVALID_PID) { - xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, + 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) { @@ -2026,10 +2027,10 @@ static void demux_ts_parse_packet (demux_ts_t*this) { } } } - + if (data_len > PKT_SIZE) { - xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, + xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, "demux_ts: demux error! invalid payload size %d\n", data_len); } else { @@ -2103,7 +2104,7 @@ static void demux_ts_event_handler (demux_ts_t *this) { this->last_pmt_crc = 0; _x_demux_control_start (this->stream); break; - + } xine_event_free (event); @@ -2142,7 +2143,7 @@ static void demux_ts_dispose (demux_plugin_t *this_gen) { } } for (i=0; i < MAX_PIDS; i++) { - if (this->media[i].buf != NULL) { + if (this->media[i].buf != NULL) { this->media[i].buf->free_buffer(this->media[i].buf); this->media[i].buf = NULL; } @@ -2179,23 +2180,23 @@ static void demux_ts_send_headers (demux_plugin_t *this_gen) { this->last_pmt_crc = 0; _x_demux_control_start (this->stream); - + this->input->seek (this->input, 0, SEEK_SET); this->send_newpts = 1; - + demux_ts_build_crc32_table (this); - + this->status = DEMUX_OK ; this->send_end_buffers = 1; this->scrambled_npids = 0; - + /* DVBSUB */ this->spu_pid = INVALID_PID; this->spu_langs_count = 0; this->current_spu_channel = -1; - + /* FIXME ? */ _x_stream_info_set(this->stream, XINE_STREAM_INFO_HAS_VIDEO, 1); _x_stream_info_set(this->stream, XINE_STREAM_INFO_HAS_AUDIO, 1); @@ -2222,11 +2223,11 @@ static int demux_ts_seek (demux_plugin_t *this_gen, } this->send_newpts = 1; - + for (i=0; i<MAX_PIDS; i++) { demux_ts_media *m = &this->media[i]; - if (m->buf != NULL) + if (m->buf != NULL) m->buf->free_buffer(m->buf); m->buf = NULL; m->counter = INVALID_CC; @@ -2235,7 +2236,7 @@ static int demux_ts_seek (demux_plugin_t *this_gen, } if( !playing ) { - + this->status = DEMUX_OK; this->buf_flag_seek = 0; @@ -2245,7 +2246,7 @@ static int demux_ts_seek (demux_plugin_t *this_gen, _x_demux_flush_engine(this->stream); } - + return this->status; } @@ -2254,7 +2255,7 @@ static int demux_ts_get_stream_length (demux_plugin_t *this_gen) { demux_ts_t*this = (demux_ts_t*)this_gen; if (this->rate) - return (int)((int64_t) this->input->get_length (this->input) + return (int)((int64_t) this->input->get_length (this->input) * 1000 / (this->rate * 50)); else return 0; @@ -2276,7 +2277,7 @@ static int demux_ts_get_optional_data(demux_plugin_t *this_gen, /* be a bit paranoid */ if (this == NULL || this->stream == NULL) return DEMUX_OPTIONAL_UNSUPPORTED; - + switch (data_type) { case DEMUX_OPTIONAL_DATA_AUDIOLANG: @@ -2350,10 +2351,10 @@ static int detect_ts(uint8_t *buf, size_t len, int ts_size) return ts_detected; } -static demux_plugin_t *open_plugin (demux_class_t *class_gen, - xine_stream_t *stream, +static demux_plugin_t *open_plugin (demux_class_t *class_gen, + xine_stream_t *stream, input_plugin_t *input) { - + demux_ts_t *this; int i; int hdmv = -1; @@ -2368,9 +2369,9 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, if (detect_ts(buf, sizeof(buf), PKT_SIZE)) hdmv = 0; - else if (detect_ts(buf, sizeof(buf), PKT_SIZE+4)) + else if (detect_ts(buf, sizeof(buf), PKT_SIZE+4)) hdmv = 1; - else + else return NULL; } break; @@ -2439,7 +2440,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, this->demux_plugin.get_capabilities = demux_ts_get_capabilities; this->demux_plugin.get_optional_data = demux_ts_get_optional_data; this->demux_plugin.demux_class = class_gen; - + /* * Initialise our specialised data. */ @@ -2464,7 +2465,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, this->last_pmt_crc = 0; this->rate = 16000; /* FIXME */ - + this->status = DEMUX_FINISHED; /* DVBSUB */ @@ -2481,7 +2482,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, this->pkt_size = PKT_SIZE + this->pkt_offset; this->numPreview=0; - + return &this->demux_plugin; } @@ -2492,7 +2493,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, 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_HDMV"; } @@ -2513,9 +2514,9 @@ static void class_dispose (demux_class_t *this_gen) { } static void *init_class (xine_t *xine, void *data) { - + demux_ts_class_t *this; - + this = calloc(1, sizeof(demux_ts_class_t)); this->config = xine->config; this->xine = xine; @@ -2539,7 +2540,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 */ + /* type, API, "name", version, special_info, init_function */ { PLUGIN_DEMUX, 26, "mpeg-ts-hdmv", XINE_VERSION_CODE, &demux_info_ts, init_class }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; |