Commit 84c87e41 authored by Andreas Rheinhardt's avatar Andreas Rheinhardt Committed by Michael Niedermayer

h264_mp4toannexb: Consistently use pointer comparisons

h264_mp4toannexb_filter currently uses both indices/offsets as well as
direct pointers comparisons for the checks whether one has reached or
even surpassed the end. This commit removes the offsets.
Signed-off-by: 's avatarAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
parent c177520f
...@@ -176,10 +176,8 @@ static int h264_mp4toannexb_filter(AVBSFContext *ctx, AVPacket *out) ...@@ -176,10 +176,8 @@ static int h264_mp4toannexb_filter(AVBSFContext *ctx, AVPacket *out)
AVPacket *in; AVPacket *in;
uint8_t unit_type; uint8_t unit_type;
int32_t nal_size; int32_t nal_size;
uint32_t cumul_size = 0;
const uint8_t *buf; const uint8_t *buf;
const uint8_t *buf_end; const uint8_t *buf_end;
int buf_size;
int ret = 0, i; int ret = 0, i;
ret = ff_bsf_get_packet(ctx, &in); ret = ff_bsf_get_packet(ctx, &in);
...@@ -194,7 +192,6 @@ static int h264_mp4toannexb_filter(AVBSFContext *ctx, AVPacket *out) ...@@ -194,7 +192,6 @@ static int h264_mp4toannexb_filter(AVBSFContext *ctx, AVPacket *out)
} }
buf = in->data; buf = in->data;
buf_size = in->size;
buf_end = in->data + in->size; buf_end = in->data + in->size;
do { do {
...@@ -262,8 +259,7 @@ static int h264_mp4toannexb_filter(AVBSFContext *ctx, AVPacket *out) ...@@ -262,8 +259,7 @@ static int h264_mp4toannexb_filter(AVBSFContext *ctx, AVPacket *out)
} }
buf += nal_size; buf += nal_size;
cumul_size += nal_size + s->length_size; } while (buf < buf_end);
} while (cumul_size < buf_size);
ret = av_packet_copy_props(out, in); ret = av_packet_copy_props(out, in);
if (ret < 0) if (ret < 0)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment