The documentation of av_fourcc_make_string states the passed in buffer must be of at least the size of AV_FOURCC_MAX_STRING_SIZE . Using av_fourcc2str uses the correct buffer size and moves the buffer into a nested scope while also being shorter.
Unified · Split
| @@ -68,7 +68,6 @@ static int dnxuc_parse(AVCodecParserContext *s, · 67 unmodified lines | |||
| 68 | const uint8_t **poutbuf, int *poutbuf_size, | 68 | const uint8_t **poutbuf, int *poutbuf_size, |
| 69 | const uint8_t *buf, int buf_size) | 69 | const uint8_t *buf, int buf_size) |
| 70 | { | 70 | { |
| 71 | char fourcc_buf[5]; | ||
| 72 | const int HEADER_SIZE = 37; | 71 | const int HEADER_SIZE = 37; |
| 73 | int icmp_offset = 0; | 72 | int icmp_offset = 0; |
| 74 | 73 | ||
| @@ -96,9 +95,8 @@ static int dnxuc_parse(AVCodecParserContext *s, · 21 unmodified lines | |||
| 96 | pc->nr_bytes = AV_RL32(buf+29+icmp_offset) - 8; | 95 | pc->nr_bytes = AV_RL32(buf+29+icmp_offset) - 8; |
| 97 | 96 | ||
| 98 | if (!avctx->codec_tag) { | 97 | if (!avctx->codec_tag) { |
| 99 | av_fourcc_make_string(fourcc_buf, pc->fourcc_tag); | ||
| 100 | av_log(avctx, AV_LOG_INFO, "dnxuc_parser: '%s' %dx%d %dbpp %d\n", | 98 | av_log(avctx, AV_LOG_INFO, "dnxuc_parser: '%s' %dx%d %dbpp %d\n", |
| 101 | fourcc_buf, | 99 | av_fourcc2str(pc->fourcc_tag), |
| 102 | pc->width, pc->height, | 100 | pc->width, pc->height, |
| 103 | (pc->nr_bytes*8)/(pc->width*pc->height), | 101 | (pc->nr_bytes*8)/(pc->width*pc->height), |
| 104 | pc->nr_bytes); | 102 | pc->nr_bytes); |