AVFrame picture;
} SUNRASTContext;
-static int sunrast_init(AVCodecContext *avctx) {
+static av_cold int sunrast_init(AVCodecContext *avctx) {
SUNRASTContext *s = avctx->priv_data;
avcodec_get_frame_defaults(&s->picture);
}
static int sunrast_decode_frame(AVCodecContext *avctx, void *data,
- int *data_size, uint8_t *buf, int buf_size) {
+ int *data_size, const uint8_t *buf, int buf_size) {
SUNRASTContext * const s = avctx->priv_data;
AVFrame *picture = data;
AVFrame * const p = &s->picture;
unsigned int w, h, depth, type, maptype, maplength, stride, x, y, len, alen;
- uint8_t *ptr, *bufstart = buf;
+ uint8_t *ptr;
+ const uint8_t *bufstart = buf;
if (AV_RB32(buf) != 0x59a66a95) {
av_log(avctx, AV_LOG_ERROR, "this is not sunras encoded data\n");
return -1;
}
- av_log(avctx, AV_LOG_DEBUG, "maplength %u\n", len);
-
ptr = p->data[1];
for (x=0; x<len; x++, ptr+=4)
*(uint32_t *)ptr = (buf[x]<<16) + (buf[len+x]<<8) + buf[len+len+x];
return buf - bufstart;
}
-static int sunrast_end(AVCodecContext *avctx) {
+static av_cold int sunrast_end(AVCodecContext *avctx) {
SUNRASTContext *s = avctx->priv_data;
if(s->picture.data[0])
sunrast_end,
sunrast_decode_frame,
0,
- NULL
+ NULL,
+ .long_name = NULL_IF_CONFIG_SMALL("Sun Rasterfile image"),
};