h264_mp4toannexb: Cosmetics

Mainly reindentation, but some variables were also put into a smaller
scope.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
Andreas Rheinhardt 2019-12-14 23:19:25 +01:00 committed by Michael Niedermayer
parent 824f750880
commit 4a141f8e02
1 changed files with 26 additions and 26 deletions

View File

@ -168,15 +168,13 @@ static int h264_mp4toannexb_init(AVBSFContext *ctx)
static int h264_mp4toannexb_filter(AVBSFContext *ctx, AVPacket *opkt)
{
H264BSFContext *s = ctx->priv_data;
AVPacket *in;
uint8_t unit_type, new_idr, sps_seen, pps_seen;
uint32_t nal_size;
const uint8_t *buf;
const uint8_t *buf_end;
uint8_t *out;
uint64_t out_size;
int ret = 0, i;
int ret;
ret = ff_bsf_get_packet(ctx, &in);
if (ret < 0)
@ -202,8 +200,10 @@ static int h264_mp4toannexb_filter(AVBSFContext *ctx, AVPacket *opkt)
out_size = 0;
do {
uint32_t nal_size = 0;
/* possible overread ok due to padding */
for (nal_size = 0, i = 0; i<s->length_size; i++)
for (int i = 0; i < s->length_size; i++)
nal_size = (nal_size << 8) | buf[i];
buf += s->length_size;
@ -220,22 +220,22 @@ static int h264_mp4toannexb_filter(AVBSFContext *ctx, AVPacket *opkt)
unit_type = *buf & 0x1f;
if (unit_type == H264_NAL_SPS)
if (unit_type == H264_NAL_SPS) {
sps_seen = new_idr = 1;
else if (unit_type == H264_NAL_PPS) {
} else if (unit_type == H264_NAL_PPS) {
pps_seen = new_idr = 1;
/* if SPS has not been seen yet, prepend the AVCC one to PPS */
if (!sps_seen) {
if (!s->sps_size)
if (!s->sps_size) {
LOG_ONCE(ctx, AV_LOG_WARNING, "SPS not present in the stream, nor in AVCC, stream may be unreadable\n");
else {
} else {
count_or_copy(&out, &out_size, s->sps, s->sps_size, -1, j);
sps_seen = 1;
}
}
}
/* if this is a new IDR picture following an IDR picture, reset the idr flag.
/* If this is a new IDR picture following an IDR picture, reset the idr flag.
* Just check first_mb_in_slice to be 0 as this is the simplest solution.
* This could be checking idr_pic_id instead, but would complexify the parsing. */
if (!new_idr && unit_type == H264_NAL_IDR_SLICE && (buf[1] & 0x80))