From 6c63b7159d6c6c7cbb8abe05cff3a439ec9fbf5d Mon Sep 17 00:00:00 2001 From: jethead71 Date: Thu, 29 Jan 2009 02:57:09 +0000 Subject: [PATCH] MPEGPlayer: If valid start AND end timestamps for a stream are not found then neither are considered to be valid which marks the stream as invalid. Also, we do program streams, not transport streams-- use correct terminology in MPEG parser. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19875 a1c6a512-1295-4272-9138-f99709370657 --- apps/plugins/mpegplayer/mpeg_parser.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/apps/plugins/mpegplayer/mpeg_parser.c b/apps/plugins/mpegplayer/mpeg_parser.c index 42c388b37..30793e035 100644 --- a/apps/plugins/mpegplayer/mpeg_parser.c +++ b/apps/plugins/mpegplayer/mpeg_parser.c @@ -332,8 +332,10 @@ static void init_times(struct stream *str) } } - /* End must be greater than start */ - if (str->start_pts >= str->end_pts) + /* End must be greater than start. If the start PTS is found, the end PTS + * must be valid too. If the start PTS was invalid, then the end will never + * be scanned above. */ + if (str->start_pts >= str->end_pts || str->end_pts == INVALID_TIMESTAMP) { str->start_pts = INVALID_TIMESTAMP; str->end_pts = INVALID_TIMESTAMP; @@ -1116,8 +1118,8 @@ int parser_init_stream(void) if (parse_demux(&video_str, STREAM_PM_RANDOM_ACCESS) == STREAM_OK) { - /* Found a video packet - assume transport stream */ - str_parser.format = STREAM_FMT_MPEG_TS; + /* Found a video packet - assume program stream */ + str_parser.format = STREAM_FMT_MPEG_PS; str_parser.next_data = parse_demux; } else @@ -1133,7 +1135,7 @@ int parser_init_stream(void) return STREAM_UNSUPPORTED; } - if (str_parser.format == STREAM_FMT_MPEG_TS) + if (str_parser.format == STREAM_FMT_MPEG_PS) { /* Initalize start_pts and end_pts with the length (in 45kHz units) of * the movie. INVALID_TIMESTAMP if the time could not be determined */ -- 2.11.4.GIT