Skip to content

Commit

Permalink
avformat/segafilmenc: Simplify writing two bytes
Browse files Browse the repository at this point in the history
Use avio_wb16() instead of avio_write() to write two zero bytes.

Signed-off-by: Andreas Rheinhardt <[email protected]>
  • Loading branch information
mkver committed Jul 26, 2020
1 parent f71116d commit 37ec33f
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions libavformat/segafilmenc.c
Original file line number Diff line number Diff line change
Expand Up @@ -119,15 +119,14 @@ static int film_write_packet(AVFormatContext *format_context, AVPacket *pkt)
if (encoded_buf_size != pkt->size && (pkt->size % encoded_buf_size) != 0) {
avio_write(pb, pkt->data, pkt->size);
} else {
uint8_t padding[2] = {0, 0};
/* In Sega Cinepak, the reported size in the Cinepak header is
* 8 bytes too short. However, the size in the STAB section of the header
* is correct, taking into account the extra two bytes. */
AV_WB24(&pkt->data[1], pkt->size - 8 + 2);
metadata->size += 2;

avio_write(pb, pkt->data, 10);
avio_write(pb, padding, 2);
avio_wb16(pb, 0);
avio_write(pb, &pkt->data[10], pkt->size - 10);
}
} else {
Expand Down

0 comments on commit 37ec33f

Please sign in to comment.