aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/mpeg12.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2009-11-28 14:17:28 +0000
committerMichael Niedermayer <michaelni@gmx.at>2009-11-28 14:17:28 +0000
commit191ad11e91b216627cde3aff6c0d475e477bd301 (patch)
treee22d210dbfc9bc40881aac122689469fe97d1a44 /libavcodec/mpeg12.c
parent8d872e8ac9d17dd004af60787cd69eac69ef8891 (diff)
downloadffmpeg-191ad11e91b216627cde3aff6c0d475e477bd301.tar.gz
Simplify mpeg_decode_user_data()
Originally committed as revision 20640 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/mpeg12.c')
-rw-r--r--libavcodec/mpeg12.c17
1 files changed, 5 insertions, 12 deletions
diff --git a/libavcodec/mpeg12.c b/libavcodec/mpeg12.c
index f226602004..99d5093b22 100644
--- a/libavcodec/mpeg12.c
+++ b/libavcodec/mpeg12.c
@@ -2113,28 +2113,21 @@ static int vcr2_init_sequence(AVCodecContext *avctx)
static void mpeg_decode_user_data(AVCodecContext *avctx,
- const uint8_t *buf, int buf_size)
+ const uint8_t *p, int buf_size)
{
- const uint8_t *p;
- int len, flags;
- p = buf;
- len = buf_size;
+ const uint8_t *buf_end = p+buf_size;
/* we parse the DTG active format information */
- if (len >= 5 &&
+ if (buf_end - p >= 5 &&
p[0] == 'D' && p[1] == 'T' && p[2] == 'G' && p[3] == '1') {
- flags = p[4];
+ int flags = p[4];
p += 5;
- len -= 5;
if (flags & 0x80) {
/* skip event id */
- if (len < 2)
- return;
p += 2;
- len -= 2;
}
if (flags & 0x40) {
- if (len < 1)
+ if (buf_end - p < 1)
return;
avctx->dtg_active_format = p[0] & 0x0f;
}