diff options
author | Paul B Mahol <onemda@gmail.com> | 2022-09-24 11:40:07 +0200 |
---|---|---|
committer | Paul B Mahol <onemda@gmail.com> | 2022-09-24 12:23:33 +0200 |
commit | eb9045455d7f4d5696320c92ae378c8221d26f79 (patch) | |
tree | acc3f8775b931027ba2b8a4e32da20b54c18fbb5 /libavcodec/hdrdec.c | |
parent | 1e079525d5ae692bc0470bc5f6bcc04b11fc8b1d (diff) | |
download | ffmpeg-eb9045455d7f4d5696320c92ae378c8221d26f79.tar.gz |
avcodec/hdrdec: implement FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM
Diffstat (limited to 'libavcodec/hdrdec.c')
-rw-r--r-- | libavcodec/hdrdec.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/libavcodec/hdrdec.c b/libavcodec/hdrdec.c index 7727826e2a..21d3e7f693 100644 --- a/libavcodec/hdrdec.c +++ b/libavcodec/hdrdec.c @@ -88,14 +88,13 @@ static int decompress(uint8_t *scanline, int w, GetByteContext *gb, const uint8_ static int hdr_decode_frame(AVCodecContext *avctx, AVFrame *p, int *got_frame, AVPacket *avpkt) { - const uint8_t *buf = avpkt->data; - int ret, buf_size = avpkt->size; int width = 0, height = 0; GetByteContext gb; uint8_t line[512]; float sar; + int ret; - bytestream2_init(&gb, buf, buf_size); + bytestream2_init(&gb, avpkt->data, avpkt->size); hdr_get_line(&gb, line, sizeof(line)); if (memcmp("#?RADIANCE\n", line, 11)) return AVERROR_INVALIDDATA; @@ -129,6 +128,10 @@ static int hdr_decode_frame(AVCodecContext *avctx, AVFrame *p, return ret; avctx->pix_fmt = AV_PIX_FMT_GBRPF32; + + if (avctx->skip_frame >= AVDISCARD_ALL) + return avpkt->size; + if ((ret = ff_thread_get_buffer(avctx, p, 0)) < 0) return ret; @@ -206,7 +209,7 @@ convert: *got_frame = 1; - return buf_size; + return avpkt->size; } const FFCodec ff_hdr_decoder = { @@ -215,5 +218,6 @@ const FFCodec ff_hdr_decoder = { .p.type = AVMEDIA_TYPE_VIDEO, .p.id = AV_CODEC_ID_RADIANCE_HDR, .p.capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_FRAME_THREADS, + .caps_internal = FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM, FF_CODEC_DECODE_CB(hdr_decode_frame), }; |