History

lavc/hevcdec: switch to receive_frame()

Required by following commits, where we will want to output multiple frames per packet.

Anton Khirnov committed 2 years ago

Commit 2fdecbb1 parent 4e7b5ac1 file · +16 −13Browse files

Unified · Split

libavcodec/hevc/hevcdec.c+16−13
@@ -3405,22 +3405,25 @@ static int hevc_decode_extradata(HEVCContext *s, uint8_t *buf, int length, int f · 3404 unmodified lines
3405 return 0;3405 return 0;
3406}3406}
3407 3407
3408static int hevc_decode_frame(AVCodecContext *avctx, AVFrame *rframe,3408static int hevc_receive_frame(AVCodecContext *avctx, AVFrame *frame)
3409 int *got_output, AVPacket *avpkt)
3410{3409{
3410 HEVCContext *s = avctx->priv_data;
3411 AVCodecInternal *avci = avctx->internal;
3412 AVPacket *avpkt = avci->in_pkt;
3413
3411 int ret;3414 int ret;
3412 uint8_t *sd;3415 uint8_t *sd;
3413 size_t sd_size;3416 size_t sd_size;
3414 HEVCContext *s = avctx->priv_data;
3415 3417
3416 if (!avpkt->size) {3418 av_packet_unref(avpkt);
3417 ret = ff_hevc_output_frame(s, rframe, 1);3419 ret = ff_decode_get_packet(avctx, avpkt);
3420 if (ret == AVERROR_EOF) {
3421 ret = ff_hevc_output_frame(s, frame, 1);
3418 if (ret < 0)3422 if (ret < 0)
3419 return ret;3423 return ret;
3420 3424 return (ret > 0) ? 0 : AVERROR_EOF;
3421 *got_output = ret;3425 } else if (ret < 0)
3422 return 0;3426 return ret;
3423 }
3424 3427
3425 sd = av_packet_get_side_data(avpkt, AV_PKT_DATA_NEW_EXTRADATA, &sd_size);3428 sd = av_packet_get_side_data(avpkt, AV_PKT_DATA_NEW_EXTRADATA, &sd_size);
3426 if (sd && sd_size > 0) {3429 if (sd && sd_size > 0) {
@@ -3444,11 +3447,11 @@ static int hevc_decode_frame(AVCodecContext *avctx, AVFrame *rframe, · 17 unmodified lines
3444 return ret;3447 return ret;
3445 3448
3446 if (s->output_frame->buf[0]) {3449 if (s->output_frame->buf[0]) {
3447 av_frame_move_ref(rframe, s->output_frame);3450 av_frame_move_ref(frame, s->output_frame);
3448 *got_output = 1;3451 return 0;
3449 }3452 }
3450 3453
3451 return avpkt->size;3454 return AVERROR(EAGAIN);
3452}3455}
3453 3456
3454static int hevc_ref_frame(HEVCFrame *dst, const HEVCFrame *src)3457static int hevc_ref_frame(HEVCFrame *dst, const HEVCFrame *src)
@@ -3725,7 +3728,7 @@ const FFCodec ff_hevc_decoder = { · 270 unmodified lines
3725 .p.priv_class = &hevc_decoder_class,3728 .p.priv_class = &hevc_decoder_class,
3726 .init = hevc_decode_init,3729 .init = hevc_decode_init,
3727 .close = hevc_decode_free,3730 .close = hevc_decode_free,
3728 FF_CODEC_DECODE_CB(hevc_decode_frame),3731 FF_CODEC_RECEIVE_FRAME_CB(hevc_receive_frame),
3729 .flush = hevc_decode_flush,3732 .flush = hevc_decode_flush,
3730 UPDATE_THREAD_CONTEXT(hevc_update_thread_context),3733 UPDATE_THREAD_CONTEXT(hevc_update_thread_context),
3731 .p.capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_DELAY |3734 .p.capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_DELAY |

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t