mirror of
https://github.com/nyanmisaka/ffmpeg-rockchip.git
synced 2025-10-15 05:11:37 +08:00
avcodec/cbs: add API to discard units by AVDiscard
This commit is contained in:
@@ -1026,3 +1026,24 @@ int ff_cbs_make_unit_writable(CodedBitstreamContext *ctx,
|
||||
av_buffer_unref(&ref);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void ff_cbs_discard_units(CodedBitstreamContext *ctx,
|
||||
CodedBitstreamFragment *frag,
|
||||
enum AVDiscard skip,
|
||||
int flags)
|
||||
{
|
||||
if (!ctx->codec->discarded_unit)
|
||||
return;
|
||||
|
||||
for (int i = frag->nb_units - 1; i >= 0; i--) {
|
||||
if (ctx->codec->discarded_unit(ctx, &frag->units[i], skip)) {
|
||||
// discard all units
|
||||
if (!(flags & DISCARD_FLAG_KEEP_NON_VCL)) {
|
||||
ff_cbs_fragment_free(frag);
|
||||
return;
|
||||
}
|
||||
|
||||
ff_cbs_delete_unit(frag, i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user