summaryrefslogtreecommitdiff
path: root/libavformat/mpeg.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-07-31 19:43:20 +0200
committerMichael Niedermayer <michaelni@gmx.at>2012-08-04 19:37:23 +0200
commitce7cf600be62d81cddefb302c2f098672130774b (patch)
tree4a293a9c321bec174b3b315727dfd3de5196c837 /libavformat/mpeg.c
parentafa6afcc9fac356eb895892511b5d8d9f416af40 (diff)
mpegdemux: move private stream 1 handling out of mpegps_read_pes_header
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/mpeg.c')
-rw-r--r--libavformat/mpeg.c28
1 files changed, 16 insertions, 12 deletions
diff --git a/libavformat/mpeg.c b/libavformat/mpeg.c
index d51a6930e2..904399c113 100644
--- a/libavformat/mpeg.c
+++ b/libavformat/mpeg.c
@@ -349,18 +349,6 @@ static int mpegps_read_pes_header(AVFormatContext *s,
if (startcode == PRIVATE_STREAM_1) {
startcode = avio_r8(s->pb);
len--;
- if (startcode >= 0x80 && startcode <= 0xcf) {
- /* audio: skip header */
- avio_r8(s->pb);
- avio_r8(s->pb);
- avio_r8(s->pb);
- len -= 3;
- if (startcode >= 0xb0 && startcode <= 0xbf) {
- /* MLP/TrueHD audio has a 4-byte header */
- avio_r8(s->pb);
- len--;
- }
- }
}
if(len<0)
goto error_redo;
@@ -397,6 +385,22 @@ static int mpegps_read_packet(AVFormatContext *s,
if (len < 0)
return len;
+ if (startcode >= 0x80 && startcode <= 0xcf) {
+ if(len < 4)
+ goto skip;
+
+ /* audio: skip header */
+ avio_r8(s->pb);
+ avio_r8(s->pb);
+ avio_r8(s->pb);
+ len -= 3;
+ if (startcode >= 0xb0 && startcode <= 0xbf) {
+ /* MLP/TrueHD audio has a 4-byte header */
+ avio_r8(s->pb);
+ len--;
+ }
+ }
+
/* now find stream */
for(i=0;i<s->nb_streams;i++) {
st = s->streams[i];