avcodec/cbs: add a flush callback to CodedBitstreamType

Used to reset the codec's private internal state.

Signed-off-by: James Almer <jamrial@gmail.com>
pull/354/head
James Almer 4 years ago
parent 23d0754165
commit 515b6419ca
  1. 6
      libavcodec/cbs.c
  2. 5
      libavcodec/cbs.h
  3. 3
      libavcodec/cbs_internal.h

@ -112,6 +112,12 @@ int ff_cbs_init(CodedBitstreamContext **ctx_ptr,
return 0;
}
void ff_cbs_flush(CodedBitstreamContext *ctx)
{
if (ctx->codec && ctx->codec->flush)
ctx->codec->flush(ctx);
}
void ff_cbs_close(CodedBitstreamContext **ctx_ptr)
{
CodedBitstreamContext *ctx = *ctx_ptr;

@ -236,6 +236,11 @@ extern const enum AVCodecID ff_cbs_all_codec_ids[];
int ff_cbs_init(CodedBitstreamContext **ctx,
enum AVCodecID codec_id, void *log_ctx);
/**
* Reset all internal state in a context.
*/
void ff_cbs_flush(CodedBitstreamContext *ctx);
/**
* Close a context and free all internal state.
*/

@ -117,6 +117,9 @@ typedef struct CodedBitstreamType {
int (*assemble_fragment)(CodedBitstreamContext *ctx,
CodedBitstreamFragment *frag);
// Reset the codec internal state.
void (*flush)(CodedBitstreamContext *ctx);
// Free the codec internal state.
void (*close)(CodedBitstreamContext *ctx);
} CodedBitstreamType;

Loading…
Cancel
Save