1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

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>
This commit is contained in:
James Almer 2020-09-24 17:57:42 -03:00
parent 23d0754165
commit 515b6419ca
3 changed files with 14 additions and 0 deletions

View File

@ -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;

View File

@ -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.
*/

View File

@ -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;