summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorvan <[email protected]>2008-12-11 01:06:43 +0000
committervan <[email protected]>2008-12-11 01:06:43 +0000
commit0478184d03c30f957befbc3b6f7477c794942660 (patch)
treeb62a36dda79cbad579a71c75152b66aa7f8047a5
parented3d36a9c7f38a0a411f189132d209822f028cb5 (diff)
Don't reject MPEG PS files just because they're missing a SYS header (clips won't have one). The standard says we just need a PACK header followed by some other legal start code.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2018 b64f7644-9d1e-0410-96f1-a4d463321fa5
-rwxr-xr-xlibhb/stream.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/libhb/stream.c b/libhb/stream.c
index 8e66c850a..abe827ede 100755
--- a/libhb/stream.c
+++ b/libhb/stream.c
@@ -301,14 +301,13 @@ static int check_ps_sync(const uint8_t *buf)
(buf[2] == 0x01) && (buf[3] == 0xba);
}
-static int check_ps_sys(const uint8_t *buf)
+static int check_ps_sc(const uint8_t *buf)
{
// a legal MPEG program stream must start with a Pack followed by a
- // SYS. If we've already verified the pack, this skips over it and checks
- // for the sys header.
+ // some other start code. If we've already verified the pack, this skip
+ // it and checks for a start code prefix.
int pos = 14 + ( buf[13] & 0x7 ); // skip over the PACK
- return (buf[pos+0] == 0x00) && (buf[pos+1] == 0x00) &&
- (buf[pos+2] == 0x01) && (buf[pos+3] == 0xbb);
+ return (buf[pos+0] == 0x00) && (buf[pos+1] == 0x00) && (buf[pos+2] == 0x01);
}
static int check_ts_sync(const uint8_t *buf)
@@ -348,8 +347,9 @@ static int hb_stream_check_for_ts(const uint8_t *buf)
static int hb_stream_check_for_ps(const uint8_t *buf)
{
- // program streams should start with a PACK then a SYS header.
- return check_ps_sync(buf) && check_ps_sys(buf);
+ // program streams should start with a PACK then some other mpeg start
+ // code (usually a SYS but that might be missing if we only have a clip).
+ return check_ps_sync(buf) && check_ps_sc(buf);
}
static int hb_stream_check_for_dvd_ps(const uint8_t *buf)