From c64cc8e73de41316ca83a3135b6e9df34b89da71 Mon Sep 17 00:00:00 2001 From: Chris Rankin Date: Sat, 10 Sep 2011 21:57:45 +0100 Subject: Remove the attempt to auto-detect audio/video streams from the MPEG-TS. The only way to identify which codec a stream is using is to wait for a PMT, at which time we know all the PIDs anyway. The codec ID is in no way related to (0x100 + stream ID), which is what this code was trying to do. Such a codec ID just hits the default path of "Unknown, using MPEG instead". --- src/demuxers/demux_ts.c | 82 +++++-------------------------------------------- 1 file changed, 7 insertions(+), 75 deletions(-) diff --git a/src/demuxers/demux_ts.c b/src/demuxers/demux_ts.c index 1f0640147..ed360ab38 100644 --- a/src/demuxers/demux_ts.c +++ b/src/demuxers/demux_ts.c @@ -274,7 +274,6 @@ typedef struct { int64_t packet_count; int corrupted_pes; uint32_t buffered_bytes; - int autodetected; } demux_ts_media; @@ -1018,16 +1017,9 @@ static void demux_ts_buffer_pes(demux_ts_t*this, unsigned char *ts, 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; - this->last_pmt_crc = 0; - } - } else { - m->corrupted_pes++; - xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, - "demux_ts: PID 0x%.4x: corrupted pes encountered\n", m->pid); - } + 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; @@ -1987,69 +1979,10 @@ 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) { - demux_ts_parse_pat (this, originalPkt, originalPkt+data_offset-4, - payload_unit_start_indicator); - return; - } - program_count = 0; - pes_stream_id = originalPkt[data_offset+3]; - -#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; - 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; - 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, - "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) { - int i, found = 0; - for(i = 0; i < this->audio_tracks_count; i++) { - if(this->audio_tracks[i].pid == pid) { - found = 1; - break; - } - } - if(!found) { -#ifdef TS_PMT_LOG - xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, - "demux_ts: auto-detected audio pid 0x%.4x\n", pid); -#endif - /* store PID, index and stream no. */ - 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_pes_new(this, this->media_num++, pid, - this->audio_fifo, 0x100 + pes_stream_id); - this->audio_tracks_count++; - } - } - } + if (payload_unit_start_indicator && (this->media_num < MAX_PIDS) && (pid == 0)) { + demux_ts_parse_pat(this, originalPkt, originalPkt+data_offset-4, + payload_unit_start_indicator); + return; } if (data_len > PKT_SIZE) { @@ -2448,7 +2381,6 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, for (i = 0; i < MAX_PIDS; i++) { this->media[i].pid = INVALID_PID; this->media[i].buf = NULL; - this->media[i].autodetected = 0; } for (i = 0; i < MAX_PMTS; i++) { -- cgit v1.2.3