avformat/smacker: Cosmetics

Mainly reindentation.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
This commit is contained in:
Andreas Rheinhardt
2020-06-24 13:53:10 +02:00
parent e40ad1c0d4
commit d534009f76

View File

@ -50,14 +50,14 @@ typedef struct SmackerContext {
/* internal variables */ /* internal variables */
int64_t next_frame_pos; int64_t next_frame_pos;
int cur_frame; int cur_frame;
int videoindex;
int indexes[7];
/* current frame for demuxing */ /* current frame for demuxing */
uint32_t frame_size; uint32_t frame_size;
int flags; int flags;
int next_audio_index; int next_audio_index;
int new_palette; int new_palette;
uint8_t pal[768]; uint8_t pal[768];
int indexes[7];
int videoindex;
int64_t aud_pts[7]; int64_t aud_pts[7];
} SmackerContext; } SmackerContext;
@ -226,7 +226,6 @@ static int smacker_read_header(AVFormatContext *s)
return 0; return 0;
} }
static int smacker_read_packet(AVFormatContext *s, AVPacket *pkt) static int smacker_read_packet(AVFormatContext *s, AVPacket *pkt)
{ {
SmackerContext *smk = s->priv_data; SmackerContext *smk = s->priv_data;
@ -243,7 +242,7 @@ static int smacker_read_packet(AVFormatContext *s, AVPacket *pkt)
flags = smk->frm_flags[smk->cur_frame]; flags = smk->frm_flags[smk->cur_frame];
smk->flags = flags >> 1; smk->flags = flags >> 1;
/* handle palette change event */ /* handle palette change event */
if(flags & SMACKER_PAL){ if (flags & SMACKER_PAL) {
int size, sz, t, off, j, pos; int size, sz, t, off, j, pos;
uint8_t *pal = smk->pal; uint8_t *pal = smk->pal;
uint8_t oldpal[768]; uint8_t oldpal[768];
@ -258,12 +257,12 @@ static int smacker_read_packet(AVFormatContext *s, AVPacket *pkt)
smk->frame_size -= size--; smk->frame_size -= size--;
sz = 0; sz = 0;
pos = avio_tell(s->pb) + size; pos = avio_tell(s->pb) + size;
while(sz < 256){ while (sz < 256) {
t = avio_r8(s->pb); t = avio_r8(s->pb);
if(t & 0x80){ /* skip palette entries */ if (t & 0x80) { /* skip palette entries */
sz += (t & 0x7F) + 1; sz += (t & 0x7F) + 1;
pal += ((t & 0x7F) + 1) * 3; pal += ((t & 0x7F) + 1) * 3;
} else if(t & 0x40){ /* copy with offset */ } else if (t & 0x40) { /* copy with offset */
off = avio_r8(s->pb); off = avio_r8(s->pb);
j = (t & 0x3F) + 1; j = (t & 0x3F) + 1;
if (off + j > 0x100) { if (off + j > 0x100) {
@ -274,7 +273,7 @@ static int smacker_read_packet(AVFormatContext *s, AVPacket *pkt)
goto next_frame; goto next_frame;
} }
off *= 3; off *= 3;
while(j-- && sz < 256) { while (j-- && sz < 256) {
*pal++ = oldpal[off + 0]; *pal++ = oldpal[off + 0];
*pal++ = oldpal[off + 1]; *pal++ = oldpal[off + 1];
*pal++ = oldpal[off + 2]; *pal++ = oldpal[off + 2];
@ -329,7 +328,7 @@ static int smacker_read_packet(AVFormatContext *s, AVPacket *pkt)
if ((ret = av_new_packet(pkt, smk->frame_size + 769)) < 0) if ((ret = av_new_packet(pkt, smk->frame_size + 769)) < 0)
goto next_frame; goto next_frame;
flags = smk->new_palette; flags = smk->new_palette;
if(smk->frm_size[smk->cur_frame] & 1) if (smk->frm_size[smk->cur_frame] & 1)
flags |= 2; flags |= 2;
pkt->data[0] = flags; pkt->data[0] = flags;
memcpy(pkt->data + 1, smk->pal, 768); memcpy(pkt->data + 1, smk->pal, 768);
@ -338,7 +337,6 @@ static int smacker_read_packet(AVFormatContext *s, AVPacket *pkt)
goto next_frame; goto next_frame;
pkt->stream_index = smk->videoindex; pkt->stream_index = smk->videoindex;
pkt->pts = smk->cur_frame; pkt->pts = smk->cur_frame;
pkt->size = ret + 769;
smk->next_audio_index = 0; smk->next_audio_index = 0;
smk->new_palette = 0; smk->new_palette = 0;
smk->cur_frame++; smk->cur_frame++;