diff options
author | jstebbins <[email protected]> | 2012-03-30 18:30:00 +0000 |
---|---|---|
committer | jstebbins <[email protected]> | 2012-03-30 18:30:00 +0000 |
commit | 53ac2667e27811f96e3d82da706c3371405125e9 (patch) | |
tree | bcf3cf1602b265c93fd635693bce0a8953e4f429 /libhb/stream.c | |
parent | 98e391e23b53f93a9460ce895d7a4b04a43f36b9 (diff) |
libhb: Fix problem with TS streams that have no PAT or PMT
Fall back to using libav in this case.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4560 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'libhb/stream.c')
-rw-r--r-- | libhb/stream.c | 36 |
1 files changed, 22 insertions, 14 deletions
diff --git a/libhb/stream.c b/libhb/stream.c index 9f1bba283..3f5680ef2 100644 --- a/libhb/stream.c +++ b/libhb/stream.c @@ -250,10 +250,10 @@ static void hb_stream_duration(hb_stream_t *stream, hb_title_t *inTitle); static off_t align_to_next_packet(hb_stream_t *stream); static int64_t pes_timestamp( const uint8_t *pes ); -static void hb_ts_stream_init(hb_stream_t *stream); +static int hb_ts_stream_init(hb_stream_t *stream); static hb_buffer_t * hb_ts_stream_decode(hb_stream_t *stream); static void hb_init_audio_list(hb_stream_t *stream, hb_title_t *title); -static void hb_ts_stream_find_pids(hb_stream_t *stream); +static int hb_ts_stream_find_pids(hb_stream_t *stream); static void hb_ps_stream_init(hb_stream_t *stream); static hb_buffer_t * hb_ps_stream_decode(hb_stream_t *stream); @@ -614,10 +614,10 @@ static int hb_stream_get_type(hb_stream_t *stream) " offset %d bytes", psize, offset); stream->packetsize = psize; stream->hb_stream_type = transport; - hb_ts_stream_init(stream); - return 1; + if (hb_ts_stream_init(stream) == 0) + return 1; } - if ( hb_stream_check_for_ps(stream) != 0 ) + else if ( hb_stream_check_for_ps(stream) != 0 ) { hb_log("file is MPEG Program Stream"); stream->hb_stream_type = program; @@ -2132,7 +2132,7 @@ static void hb_init_audio_list(hb_stream_t *stream, hb_title_t *title) * **********************************************************************/ -static void hb_ts_stream_init(hb_stream_t *stream) +static int hb_ts_stream_init(hb_stream_t *stream) { int i; @@ -2160,7 +2160,10 @@ static void hb_ts_stream_init(hb_stream_t *stream) stream->ts.packet = malloc( stream->packetsize ); // Find the audio and video pids in the stream - hb_ts_stream_find_pids(stream); + if (hb_ts_stream_find_pids(stream) < 0) + { + return -1; + } // hb_ts_resolve_pid_types reads some data, so the TS buffers // are needed here. @@ -2228,6 +2231,7 @@ static void hb_ts_stream_init(hb_stream_t *stream) hb_stream_delete_ts_entry(stream, i); } } + return 0; } static void hb_ps_stream_init(hb_stream_t *stream) @@ -3830,7 +3834,6 @@ static void hb_ps_stream_find_streams(hb_stream_t *stream) } hb_stream_seek( stream, 0.2 ); } -done: hb_buffer_close( &buf ); } @@ -4259,7 +4262,7 @@ static void hb_ps_resolve_stream_types(hb_stream_t *stream) } -static void hb_ts_stream_find_pids(hb_stream_t *stream) +static int hb_ts_stream_find_pids(hb_stream_t *stream) { // To be different from every other broadcaster in the world, New Zealand TV // changes PMTs (and thus video & audio PIDs) when 'programs' change. Since @@ -4288,8 +4291,8 @@ static void hb_ts_stream_find_pids(hb_stream_t *stream) if ((pid == 0x0000) && (stream->ts_number_pat_entries == 0)) { - decode_PAT(buf, stream); - continue; + decode_PAT(buf, stream); + continue; } int pat_index = 0; @@ -4314,16 +4317,21 @@ static void hb_ts_stream_find_pids(hb_stream_t *stream) if (stream->pat_info[pat_index].program_number != 0 && pid == stream->pat_info[pat_index].program_map_PID) { - if (build_program_map(buf, stream) > 0) - break; + if (build_program_map(buf, stream) > 0) + { + break; + } } } // Keep going until we have a complete set of PIDs if ( ts_index_of_video( stream ) >= 0 ) break; } + if ( ts_index_of_video( stream ) < 0 ) + return -1; update_ts_streams( stream, stream->pmt_info.PCR_PID, 0, -1, P, NULL ); - } + return 0; +} // convert a PES PTS or DTS to an int64 |