avcodec: add AVHWAccel.flush callback

pull/389/head
Lynne 2 years ago
parent be07145109
commit 6733a1a456
No known key found for this signature in database
GPG Key ID: A2FEA5F03F034464
  1. 3
      libavcodec/av1dec.c
  2. 5
      libavcodec/avcodec.h
  3. 3
      libavcodec/h264dec.c
  4. 3
      libavcodec/hevcdec.c
  5. 3
      libavcodec/vp8.c
  6. 3
      libavcodec/vp9.c

@ -1452,6 +1452,9 @@ static void av1_decode_flush(AVCodecContext *avctx)
ff_cbs_fragment_reset(&s->current_obu);
ff_cbs_flush(s->cbc);
if (avctx->hwaccel && avctx->hwaccel->flush)
avctx->hwaccel->flush(avctx);
}
#define OFFSET(x) offsetof(AV1DecContext, x)

@ -2267,6 +2267,11 @@ typedef struct AVHWAccel {
* @param data the per-frame hardware accelerator private data to be freed.
*/
void (*free_frame_priv)(void *hwctx, uint8_t *data);
/**
* Callback to flush the hwaccel state.
*/
void (*flush)(AVCodecContext *avctx);
} AVHWAccel;
/**

@ -484,6 +484,9 @@ static void h264_decode_flush(AVCodecContext *avctx)
ff_h264_free_tables(h);
h->context_initialized = 0;
if (avctx->hwaccel && avctx->hwaccel->flush)
avctx->hwaccel->flush(avctx);
}
static int get_last_needed_nal(H264Context *h)

@ -3708,6 +3708,9 @@ static void hevc_decode_flush(AVCodecContext *avctx)
av_buffer_unref(&s->rpu_buf);
s->max_ra = INT_MAX;
s->eos = 1;
if (avctx->hwaccel && avctx->hwaccel->flush)
avctx->hwaccel->flush(avctx);
}
#define OFFSET(x) offsetof(HEVCContext, x)

@ -167,6 +167,9 @@ static void vp8_decode_flush_impl(AVCodecContext *avctx, int free_mem)
if (free_mem)
free_buffers(s);
if (avctx->hwaccel && avctx->hwaccel->flush)
avctx->hwaccel->flush(avctx);
}
static void vp8_decode_flush(AVCodecContext *avctx)

@ -1801,6 +1801,9 @@ static void vp9_decode_flush(AVCodecContext *avctx)
vp9_frame_unref(avctx, &s->s.frames[i]);
for (i = 0; i < 8; i++)
ff_thread_release_ext_buffer(avctx, &s->s.refs[i]);
if (avctx->hwaccel && avctx->hwaccel->flush)
avctx->hwaccel->flush(avctx);
}
static av_cold int vp9_decode_init(AVCodecContext *avctx)

Loading…
Cancel
Save