mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-23 12:43:46 +02:00
avcodec/cbs: Remove unused function parameters
Several cbs-functions had an unused CodedBitstreamContext parameter. This commit removes these. Reviewed-by: Mark Thompson <sw@jkqxz.net> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
This commit is contained in:
parent
fc3f5cd149
commit
1bdbc50bf4
@ -34,8 +34,8 @@ static void av1_frame_merge_flush(AVBSFContext *bsf)
|
||||
{
|
||||
AV1FMergeContext *ctx = bsf->priv_data;
|
||||
|
||||
ff_cbs_fragment_reset(ctx->cbc, &ctx->frag[0]);
|
||||
ff_cbs_fragment_reset(ctx->cbc, &ctx->frag[1]);
|
||||
ff_cbs_fragment_reset(&ctx->frag[0]);
|
||||
ff_cbs_fragment_reset(&ctx->frag[1]);
|
||||
av_packet_unref(ctx->in);
|
||||
av_packet_unref(ctx->pkt);
|
||||
}
|
||||
@ -93,7 +93,7 @@ eof:
|
||||
ctx->idx = !ctx->idx;
|
||||
} else {
|
||||
for (i = 0; i < frag->nb_units; i++) {
|
||||
err = ff_cbs_insert_unit_content(ctx->cbc, tu, -1, frag->units[i].type,
|
||||
err = ff_cbs_insert_unit_content(tu, -1, frag->units[i].type,
|
||||
frag->units[i].content, frag->units[i].content_ref);
|
||||
if (err < 0)
|
||||
goto fail;
|
||||
@ -108,7 +108,7 @@ eof:
|
||||
else
|
||||
av_packet_unref(in);
|
||||
|
||||
ff_cbs_fragment_reset(ctx->cbc, &ctx->frag[ctx->idx]);
|
||||
ff_cbs_fragment_reset(&ctx->frag[ctx->idx]);
|
||||
|
||||
fail:
|
||||
if (err < 0 && err != AVERROR(EAGAIN))
|
||||
@ -133,8 +133,8 @@ static void av1_frame_merge_close(AVBSFContext *bsf)
|
||||
{
|
||||
AV1FMergeContext *ctx = bsf->priv_data;
|
||||
|
||||
ff_cbs_fragment_free(ctx->cbc, &ctx->frag[0]);
|
||||
ff_cbs_fragment_free(ctx->cbc, &ctx->frag[1]);
|
||||
ff_cbs_fragment_free(&ctx->frag[0]);
|
||||
ff_cbs_fragment_free(&ctx->frag[1]);
|
||||
av_packet_free(&ctx->in);
|
||||
av_packet_free(&ctx->pkt);
|
||||
ff_cbs_close(&ctx->cbc);
|
||||
|
@ -172,7 +172,7 @@ static int av1_frame_split_filter(AVBSFContext *ctx, AVPacket *out)
|
||||
|
||||
if (s->cur_frame == s->nb_frames) {
|
||||
av_packet_unref(s->buffer_pkt);
|
||||
ff_cbs_fragment_reset(s->cbc, td);
|
||||
ff_cbs_fragment_reset(td);
|
||||
}
|
||||
|
||||
return 0;
|
||||
@ -187,7 +187,7 @@ fail:
|
||||
av_packet_unref(out);
|
||||
av_packet_unref(s->buffer_pkt);
|
||||
}
|
||||
ff_cbs_fragment_reset(s->cbc, td);
|
||||
ff_cbs_fragment_reset(td);
|
||||
|
||||
return ret;
|
||||
}
|
||||
@ -224,7 +224,7 @@ static int av1_frame_split_init(AVBSFContext *ctx)
|
||||
if (ret < 0)
|
||||
av_log(ctx, AV_LOG_WARNING, "Failed to parse extradata.\n");
|
||||
|
||||
ff_cbs_fragment_reset(s->cbc, td);
|
||||
ff_cbs_fragment_reset(td);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -234,7 +234,7 @@ static void av1_frame_split_flush(AVBSFContext *ctx)
|
||||
AV1FSplitContext *s = ctx->priv_data;
|
||||
|
||||
av_packet_unref(s->buffer_pkt);
|
||||
ff_cbs_fragment_reset(s->cbc, &s->temporal_unit);
|
||||
ff_cbs_fragment_reset(&s->temporal_unit);
|
||||
}
|
||||
|
||||
static void av1_frame_split_close(AVBSFContext *ctx)
|
||||
@ -242,7 +242,7 @@ static void av1_frame_split_close(AVBSFContext *ctx)
|
||||
AV1FSplitContext *s = ctx->priv_data;
|
||||
|
||||
av_packet_free(&s->buffer_pkt);
|
||||
ff_cbs_fragment_free(s->cbc, &s->temporal_unit);
|
||||
ff_cbs_fragment_free(&s->temporal_unit);
|
||||
ff_cbs_close(&s->cbc);
|
||||
}
|
||||
|
||||
|
@ -151,7 +151,7 @@ static int av1_metadata_update_side_data(AVBSFContext *bsf, AVPacket *pkt)
|
||||
return AVERROR(ENOMEM);
|
||||
memcpy(side_data, frag->data, frag->data_size);
|
||||
|
||||
ff_cbs_fragment_reset(ctx->cbc, frag);
|
||||
ff_cbs_fragment_reset(frag);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -195,13 +195,13 @@ static int av1_metadata_filter(AVBSFContext *bsf, AVPacket *pkt)
|
||||
// If a Temporal Delimiter is present, it must be the first OBU.
|
||||
if (frag->units[0].type == AV1_OBU_TEMPORAL_DELIMITER) {
|
||||
if (ctx->td == REMOVE)
|
||||
ff_cbs_delete_unit(ctx->cbc, frag, 0);
|
||||
ff_cbs_delete_unit(frag, 0);
|
||||
} else if (ctx->td == INSERT) {
|
||||
td = (AV1RawOBU) {
|
||||
.header.obu_type = AV1_OBU_TEMPORAL_DELIMITER,
|
||||
};
|
||||
|
||||
err = ff_cbs_insert_unit_content(ctx->cbc, frag, 0, AV1_OBU_TEMPORAL_DELIMITER,
|
||||
err = ff_cbs_insert_unit_content(frag, 0, AV1_OBU_TEMPORAL_DELIMITER,
|
||||
&td, NULL);
|
||||
if (err < 0) {
|
||||
av_log(bsf, AV_LOG_ERROR, "Failed to insert Temporal Delimiter.\n");
|
||||
@ -212,7 +212,7 @@ static int av1_metadata_filter(AVBSFContext *bsf, AVPacket *pkt)
|
||||
if (ctx->delete_padding) {
|
||||
for (i = frag->nb_units - 1; i >= 0; i--) {
|
||||
if (frag->units[i].type == AV1_OBU_PADDING)
|
||||
ff_cbs_delete_unit(ctx->cbc, frag, i);
|
||||
ff_cbs_delete_unit(frag, i);
|
||||
}
|
||||
}
|
||||
|
||||
@ -224,7 +224,7 @@ static int av1_metadata_filter(AVBSFContext *bsf, AVPacket *pkt)
|
||||
|
||||
err = 0;
|
||||
fail:
|
||||
ff_cbs_fragment_reset(ctx->cbc, frag);
|
||||
ff_cbs_fragment_reset(frag);
|
||||
|
||||
if (err < 0)
|
||||
av_packet_unref(pkt);
|
||||
@ -268,7 +268,7 @@ static int av1_metadata_init(AVBSFContext *bsf)
|
||||
|
||||
err = 0;
|
||||
fail:
|
||||
ff_cbs_fragment_reset(ctx->cbc, frag);
|
||||
ff_cbs_fragment_reset(frag);
|
||||
return err;
|
||||
}
|
||||
|
||||
@ -276,7 +276,7 @@ static void av1_metadata_close(AVBSFContext *bsf)
|
||||
{
|
||||
AV1MetadataContext *ctx = bsf->priv_data;
|
||||
|
||||
ff_cbs_fragment_free(ctx->cbc, &ctx->access_unit);
|
||||
ff_cbs_fragment_free(&ctx->access_unit);
|
||||
ff_cbs_close(&ctx->cbc);
|
||||
}
|
||||
|
||||
|
@ -78,7 +78,7 @@ static int av1_parser_parse(AVCodecParserContext *ctx,
|
||||
av_log(avctx, AV_LOG_WARNING, "Failed to parse extradata.\n");
|
||||
}
|
||||
|
||||
ff_cbs_fragment_reset(s->cbc, td);
|
||||
ff_cbs_fragment_reset(td);
|
||||
}
|
||||
|
||||
ret = ff_cbs_read(s->cbc, td, data, size);
|
||||
@ -191,7 +191,7 @@ static int av1_parser_parse(AVCodecParserContext *ctx,
|
||||
avctx->time_base = av_inv_q(av_mul_q(avctx->framerate, (AVRational){avctx->ticks_per_frame, 1}));
|
||||
|
||||
end:
|
||||
ff_cbs_fragment_reset(s->cbc, td);
|
||||
ff_cbs_fragment_reset(td);
|
||||
|
||||
s->cbc->log_ctx = NULL;
|
||||
|
||||
@ -225,7 +225,7 @@ static void av1_parser_close(AVCodecParserContext *ctx)
|
||||
{
|
||||
AV1ParseContext *s = ctx->priv_data;
|
||||
|
||||
ff_cbs_fragment_free(s->cbc, &s->temporal_unit);
|
||||
ff_cbs_fragment_free(&s->temporal_unit);
|
||||
ff_cbs_close(&s->cbc);
|
||||
}
|
||||
|
||||
|
@ -127,8 +127,7 @@ void ff_cbs_close(CodedBitstreamContext **ctx_ptr)
|
||||
av_freep(ctx_ptr);
|
||||
}
|
||||
|
||||
static void cbs_unit_uninit(CodedBitstreamContext *ctx,
|
||||
CodedBitstreamUnit *unit)
|
||||
static void cbs_unit_uninit(CodedBitstreamUnit *unit)
|
||||
{
|
||||
av_buffer_unref(&unit->content_ref);
|
||||
unit->content = NULL;
|
||||
@ -139,13 +138,12 @@ static void cbs_unit_uninit(CodedBitstreamContext *ctx,
|
||||
unit->data_bit_padding = 0;
|
||||
}
|
||||
|
||||
void ff_cbs_fragment_reset(CodedBitstreamContext *ctx,
|
||||
CodedBitstreamFragment *frag)
|
||||
void ff_cbs_fragment_reset(CodedBitstreamFragment *frag)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < frag->nb_units; i++)
|
||||
cbs_unit_uninit(ctx, &frag->units[i]);
|
||||
cbs_unit_uninit(&frag->units[i]);
|
||||
frag->nb_units = 0;
|
||||
|
||||
av_buffer_unref(&frag->data_ref);
|
||||
@ -154,10 +152,9 @@ void ff_cbs_fragment_reset(CodedBitstreamContext *ctx,
|
||||
frag->data_bit_padding = 0;
|
||||
}
|
||||
|
||||
void ff_cbs_fragment_free(CodedBitstreamContext *ctx,
|
||||
CodedBitstreamFragment *frag)
|
||||
void ff_cbs_fragment_free(CodedBitstreamFragment *frag)
|
||||
{
|
||||
ff_cbs_fragment_reset(ctx, frag);
|
||||
ff_cbs_fragment_reset(frag);
|
||||
|
||||
av_freep(&frag->units);
|
||||
frag->nb_units_allocated = 0;
|
||||
@ -200,8 +197,7 @@ static int cbs_read_fragment_content(CodedBitstreamContext *ctx,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int cbs_fill_fragment_data(CodedBitstreamContext *ctx,
|
||||
CodedBitstreamFragment *frag,
|
||||
static int cbs_fill_fragment_data(CodedBitstreamFragment *frag,
|
||||
const uint8_t *data, size_t size)
|
||||
{
|
||||
av_assert0(!frag->data && !frag->data_ref);
|
||||
@ -227,7 +223,7 @@ int ff_cbs_read_extradata(CodedBitstreamContext *ctx,
|
||||
{
|
||||
int err;
|
||||
|
||||
err = cbs_fill_fragment_data(ctx, frag, par->extradata,
|
||||
err = cbs_fill_fragment_data(frag, par->extradata,
|
||||
par->extradata_size);
|
||||
if (err < 0)
|
||||
return err;
|
||||
@ -254,7 +250,7 @@ int ff_cbs_read_packet(CodedBitstreamContext *ctx,
|
||||
frag->data_size = pkt->size;
|
||||
|
||||
} else {
|
||||
err = cbs_fill_fragment_data(ctx, frag, pkt->data, pkt->size);
|
||||
err = cbs_fill_fragment_data(frag, pkt->data, pkt->size);
|
||||
if (err < 0)
|
||||
return err;
|
||||
}
|
||||
@ -272,7 +268,7 @@ int ff_cbs_read(CodedBitstreamContext *ctx,
|
||||
{
|
||||
int err;
|
||||
|
||||
err = cbs_fill_fragment_data(ctx, frag, data, size);
|
||||
err = cbs_fill_fragment_data(frag, data, size);
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
||||
@ -328,7 +324,7 @@ static int cbs_write_unit_data(CodedBitstreamContext *ctx,
|
||||
|
||||
flush_put_bits(&pbc);
|
||||
|
||||
ret = ff_cbs_alloc_unit_data(ctx, unit, put_bits_count(&pbc) / 8);
|
||||
ret = ff_cbs_alloc_unit_data(unit, put_bits_count(&pbc) / 8);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
@ -641,8 +637,7 @@ int ff_cbs_write_signed(CodedBitstreamContext *ctx, PutBitContext *pbc,
|
||||
}
|
||||
|
||||
|
||||
int ff_cbs_alloc_unit_content(CodedBitstreamContext *ctx,
|
||||
CodedBitstreamUnit *unit,
|
||||
int ff_cbs_alloc_unit_content(CodedBitstreamUnit *unit,
|
||||
size_t size,
|
||||
void (*free)(void *opaque, uint8_t *data))
|
||||
{
|
||||
@ -662,8 +657,7 @@ int ff_cbs_alloc_unit_content(CodedBitstreamContext *ctx,
|
||||
return 0;
|
||||
}
|
||||
|
||||
int ff_cbs_alloc_unit_data(CodedBitstreamContext *ctx,
|
||||
CodedBitstreamUnit *unit,
|
||||
int ff_cbs_alloc_unit_data(CodedBitstreamUnit *unit,
|
||||
size_t size)
|
||||
{
|
||||
av_assert0(!unit->data && !unit->data_ref);
|
||||
@ -680,8 +674,7 @@ int ff_cbs_alloc_unit_data(CodedBitstreamContext *ctx,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int cbs_insert_unit(CodedBitstreamContext *ctx,
|
||||
CodedBitstreamFragment *frag,
|
||||
static int cbs_insert_unit(CodedBitstreamFragment *frag,
|
||||
int position)
|
||||
{
|
||||
CodedBitstreamUnit *units;
|
||||
@ -719,8 +712,7 @@ static int cbs_insert_unit(CodedBitstreamContext *ctx,
|
||||
return 0;
|
||||
}
|
||||
|
||||
int ff_cbs_insert_unit_content(CodedBitstreamContext *ctx,
|
||||
CodedBitstreamFragment *frag,
|
||||
int ff_cbs_insert_unit_content(CodedBitstreamFragment *frag,
|
||||
int position,
|
||||
CodedBitstreamUnitType type,
|
||||
void *content,
|
||||
@ -742,7 +734,7 @@ int ff_cbs_insert_unit_content(CodedBitstreamContext *ctx,
|
||||
content_ref = NULL;
|
||||
}
|
||||
|
||||
err = cbs_insert_unit(ctx, frag, position);
|
||||
err = cbs_insert_unit(frag, position);
|
||||
if (err < 0) {
|
||||
av_buffer_unref(&content_ref);
|
||||
return err;
|
||||
@ -756,8 +748,7 @@ int ff_cbs_insert_unit_content(CodedBitstreamContext *ctx,
|
||||
return 0;
|
||||
}
|
||||
|
||||
int ff_cbs_insert_unit_data(CodedBitstreamContext *ctx,
|
||||
CodedBitstreamFragment *frag,
|
||||
int ff_cbs_insert_unit_data(CodedBitstreamFragment *frag,
|
||||
int position,
|
||||
CodedBitstreamUnitType type,
|
||||
uint8_t *data, size_t data_size,
|
||||
@ -781,7 +772,7 @@ int ff_cbs_insert_unit_data(CodedBitstreamContext *ctx,
|
||||
return AVERROR(ENOMEM);
|
||||
}
|
||||
|
||||
err = cbs_insert_unit(ctx, frag, position);
|
||||
err = cbs_insert_unit(frag, position);
|
||||
if (err < 0) {
|
||||
av_buffer_unref(&data_ref);
|
||||
return err;
|
||||
@ -796,14 +787,13 @@ int ff_cbs_insert_unit_data(CodedBitstreamContext *ctx,
|
||||
return 0;
|
||||
}
|
||||
|
||||
void ff_cbs_delete_unit(CodedBitstreamContext *ctx,
|
||||
CodedBitstreamFragment *frag,
|
||||
void ff_cbs_delete_unit(CodedBitstreamFragment *frag,
|
||||
int position)
|
||||
{
|
||||
av_assert0(0 <= position && position < frag->nb_units
|
||||
&& "Unit to be deleted not in fragment.");
|
||||
|
||||
cbs_unit_uninit(ctx, &frag->units[position]);
|
||||
cbs_unit_uninit(&frag->units[position]);
|
||||
|
||||
--frag->nb_units;
|
||||
|
||||
|
@ -330,23 +330,20 @@ int ff_cbs_write_packet(CodedBitstreamContext *ctx,
|
||||
* Free the units contained in a fragment as well as the fragment's
|
||||
* own data buffer, but not the units array itself.
|
||||
*/
|
||||
void ff_cbs_fragment_reset(CodedBitstreamContext *ctx,
|
||||
CodedBitstreamFragment *frag);
|
||||
void ff_cbs_fragment_reset(CodedBitstreamFragment *frag);
|
||||
|
||||
/**
|
||||
* Free the units array of a fragment in addition to what
|
||||
* ff_cbs_fragment_reset does.
|
||||
*/
|
||||
void ff_cbs_fragment_free(CodedBitstreamContext *ctx,
|
||||
CodedBitstreamFragment *frag);
|
||||
void ff_cbs_fragment_free(CodedBitstreamFragment *frag);
|
||||
|
||||
/**
|
||||
* Allocate a new internal content buffer of the given size in the unit.
|
||||
*
|
||||
* The content will be zeroed.
|
||||
*/
|
||||
int ff_cbs_alloc_unit_content(CodedBitstreamContext *ctx,
|
||||
CodedBitstreamUnit *unit,
|
||||
int ff_cbs_alloc_unit_content(CodedBitstreamUnit *unit,
|
||||
size_t size,
|
||||
void (*free)(void *opaque, uint8_t *content));
|
||||
|
||||
@ -355,8 +352,7 @@ int ff_cbs_alloc_unit_content(CodedBitstreamContext *ctx,
|
||||
*
|
||||
* The data buffer will have input padding.
|
||||
*/
|
||||
int ff_cbs_alloc_unit_data(CodedBitstreamContext *ctx,
|
||||
CodedBitstreamUnit *unit,
|
||||
int ff_cbs_alloc_unit_data(CodedBitstreamUnit *unit,
|
||||
size_t size);
|
||||
|
||||
/**
|
||||
@ -365,8 +361,7 @@ int ff_cbs_alloc_unit_data(CodedBitstreamContext *ctx,
|
||||
* The content structure continues to be owned by the caller if
|
||||
* content_buf is not supplied.
|
||||
*/
|
||||
int ff_cbs_insert_unit_content(CodedBitstreamContext *ctx,
|
||||
CodedBitstreamFragment *frag,
|
||||
int ff_cbs_insert_unit_content(CodedBitstreamFragment *frag,
|
||||
int position,
|
||||
CodedBitstreamUnitType type,
|
||||
void *content,
|
||||
@ -379,8 +374,7 @@ int ff_cbs_insert_unit_content(CodedBitstreamContext *ctx,
|
||||
* av_malloc() and will on success become owned by the unit after this
|
||||
* call or freed on error.
|
||||
*/
|
||||
int ff_cbs_insert_unit_data(CodedBitstreamContext *ctx,
|
||||
CodedBitstreamFragment *frag,
|
||||
int ff_cbs_insert_unit_data(CodedBitstreamFragment *frag,
|
||||
int position,
|
||||
CodedBitstreamUnitType type,
|
||||
uint8_t *data, size_t data_size,
|
||||
@ -391,8 +385,7 @@ int ff_cbs_insert_unit_data(CodedBitstreamContext *ctx,
|
||||
*
|
||||
* Requires position to be >= 0 and < frag->nb_units.
|
||||
*/
|
||||
void ff_cbs_delete_unit(CodedBitstreamContext *ctx,
|
||||
CodedBitstreamFragment *frag,
|
||||
void ff_cbs_delete_unit(CodedBitstreamFragment *frag,
|
||||
int position);
|
||||
|
||||
|
||||
|
@ -794,7 +794,7 @@ static int cbs_av1_split_fragment(CodedBitstreamContext *ctx,
|
||||
goto fail;
|
||||
}
|
||||
|
||||
err = ff_cbs_insert_unit_data(ctx, frag, -1, header.obu_type,
|
||||
err = ff_cbs_insert_unit_data(frag, -1, header.obu_type,
|
||||
data, obu_length, frag->data_ref);
|
||||
if (err < 0)
|
||||
goto fail;
|
||||
@ -887,7 +887,7 @@ static int cbs_av1_read_unit(CodedBitstreamContext *ctx,
|
||||
GetBitContext gbc;
|
||||
int err, start_pos, end_pos;
|
||||
|
||||
err = ff_cbs_alloc_unit_content(ctx, unit, sizeof(*obu),
|
||||
err = ff_cbs_alloc_unit_content(unit, sizeof(*obu),
|
||||
&cbs_av1_free_obu);
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
@ -472,8 +472,7 @@ typedef struct CodedBitstreamH264Context {
|
||||
* On success, the payload will be owned by a unit in access_unit;
|
||||
* on failure, the content of the payload will be freed.
|
||||
*/
|
||||
int ff_cbs_h264_add_sei_message(CodedBitstreamContext *ctx,
|
||||
CodedBitstreamFragment *access_unit,
|
||||
int ff_cbs_h264_add_sei_message(CodedBitstreamFragment *access_unit,
|
||||
H264RawSEIPayload *payload);
|
||||
|
||||
/**
|
||||
@ -485,8 +484,7 @@ int ff_cbs_h264_add_sei_message(CodedBitstreamContext *ctx,
|
||||
* Requires nal_unit to be a unit in access_unit and position to be >= 0
|
||||
* and < the payload count of the SEI nal_unit.
|
||||
*/
|
||||
void ff_cbs_h264_delete_sei_message(CodedBitstreamContext *ctx,
|
||||
CodedBitstreamFragment *access_unit,
|
||||
void ff_cbs_h264_delete_sei_message(CodedBitstreamFragment *access_unit,
|
||||
CodedBitstreamUnit *nal_unit,
|
||||
int position);
|
||||
|
||||
|
@ -591,7 +591,7 @@ static int cbs_h2645_fragment_add_nals(CodedBitstreamContext *ctx,
|
||||
ref = (nal->data == nal->raw_data) ? frag->data_ref
|
||||
: packet->rbsp.rbsp_buffer_ref;
|
||||
|
||||
err = ff_cbs_insert_unit_data(ctx, frag, -1, nal->type,
|
||||
err = ff_cbs_insert_unit_data(frag, -1, nal->type,
|
||||
(uint8_t*)nal->data, size, ref);
|
||||
if (err < 0)
|
||||
return err;
|
||||
@ -807,7 +807,7 @@ static int cbs_h264_read_nal_unit(CodedBitstreamContext *ctx,
|
||||
{
|
||||
H264RawSPS *sps;
|
||||
|
||||
err = ff_cbs_alloc_unit_content(ctx, unit, sizeof(*sps), NULL);
|
||||
err = ff_cbs_alloc_unit_content(unit, sizeof(*sps), NULL);
|
||||
if (err < 0)
|
||||
return err;
|
||||
sps = unit->content;
|
||||
@ -824,7 +824,7 @@ static int cbs_h264_read_nal_unit(CodedBitstreamContext *ctx,
|
||||
|
||||
case H264_NAL_SPS_EXT:
|
||||
{
|
||||
err = ff_cbs_alloc_unit_content(ctx, unit,
|
||||
err = ff_cbs_alloc_unit_content(unit,
|
||||
sizeof(H264RawSPSExtension),
|
||||
NULL);
|
||||
if (err < 0)
|
||||
@ -840,7 +840,7 @@ static int cbs_h264_read_nal_unit(CodedBitstreamContext *ctx,
|
||||
{
|
||||
H264RawPPS *pps;
|
||||
|
||||
err = ff_cbs_alloc_unit_content(ctx, unit, sizeof(*pps),
|
||||
err = ff_cbs_alloc_unit_content(unit, sizeof(*pps),
|
||||
&cbs_h264_free_pps);
|
||||
if (err < 0)
|
||||
return err;
|
||||
@ -863,7 +863,7 @@ static int cbs_h264_read_nal_unit(CodedBitstreamContext *ctx,
|
||||
H264RawSlice *slice;
|
||||
int pos, len;
|
||||
|
||||
err = ff_cbs_alloc_unit_content(ctx, unit, sizeof(*slice),
|
||||
err = ff_cbs_alloc_unit_content(unit, sizeof(*slice),
|
||||
&cbs_h264_free_slice);
|
||||
if (err < 0)
|
||||
return err;
|
||||
@ -890,7 +890,7 @@ static int cbs_h264_read_nal_unit(CodedBitstreamContext *ctx,
|
||||
|
||||
case H264_NAL_AUD:
|
||||
{
|
||||
err = ff_cbs_alloc_unit_content(ctx, unit,
|
||||
err = ff_cbs_alloc_unit_content(unit,
|
||||
sizeof(H264RawAUD), NULL);
|
||||
if (err < 0)
|
||||
return err;
|
||||
@ -903,7 +903,7 @@ static int cbs_h264_read_nal_unit(CodedBitstreamContext *ctx,
|
||||
|
||||
case H264_NAL_SEI:
|
||||
{
|
||||
err = ff_cbs_alloc_unit_content(ctx, unit, sizeof(H264RawSEI),
|
||||
err = ff_cbs_alloc_unit_content(unit, sizeof(H264RawSEI),
|
||||
&cbs_h264_free_sei);
|
||||
if (err < 0)
|
||||
return err;
|
||||
@ -916,7 +916,7 @@ static int cbs_h264_read_nal_unit(CodedBitstreamContext *ctx,
|
||||
|
||||
case H264_NAL_FILLER_DATA:
|
||||
{
|
||||
err = ff_cbs_alloc_unit_content(ctx, unit,
|
||||
err = ff_cbs_alloc_unit_content(unit,
|
||||
sizeof(H264RawFiller), NULL);
|
||||
if (err < 0)
|
||||
return err;
|
||||
@ -930,7 +930,7 @@ static int cbs_h264_read_nal_unit(CodedBitstreamContext *ctx,
|
||||
case H264_NAL_END_SEQUENCE:
|
||||
case H264_NAL_END_STREAM:
|
||||
{
|
||||
err = ff_cbs_alloc_unit_content(ctx, unit,
|
||||
err = ff_cbs_alloc_unit_content(unit,
|
||||
sizeof(H264RawNALUnitHeader),
|
||||
NULL);
|
||||
if (err < 0)
|
||||
@ -966,7 +966,7 @@ static int cbs_h265_read_nal_unit(CodedBitstreamContext *ctx,
|
||||
{
|
||||
H265RawVPS *vps;
|
||||
|
||||
err = ff_cbs_alloc_unit_content(ctx, unit, sizeof(*vps),
|
||||
err = ff_cbs_alloc_unit_content(unit, sizeof(*vps),
|
||||
&cbs_h265_free_vps);
|
||||
if (err < 0)
|
||||
return err;
|
||||
@ -985,7 +985,7 @@ static int cbs_h265_read_nal_unit(CodedBitstreamContext *ctx,
|
||||
{
|
||||
H265RawSPS *sps;
|
||||
|
||||
err = ff_cbs_alloc_unit_content(ctx, unit, sizeof(*sps),
|
||||
err = ff_cbs_alloc_unit_content(unit, sizeof(*sps),
|
||||
&cbs_h265_free_sps);
|
||||
if (err < 0)
|
||||
return err;
|
||||
@ -1005,7 +1005,7 @@ static int cbs_h265_read_nal_unit(CodedBitstreamContext *ctx,
|
||||
{
|
||||
H265RawPPS *pps;
|
||||
|
||||
err = ff_cbs_alloc_unit_content(ctx, unit, sizeof(*pps),
|
||||
err = ff_cbs_alloc_unit_content(unit, sizeof(*pps),
|
||||
&cbs_h265_free_pps);
|
||||
if (err < 0)
|
||||
return err;
|
||||
@ -1041,7 +1041,7 @@ static int cbs_h265_read_nal_unit(CodedBitstreamContext *ctx,
|
||||
H265RawSlice *slice;
|
||||
int pos, len;
|
||||
|
||||
err = ff_cbs_alloc_unit_content(ctx, unit, sizeof(*slice),
|
||||
err = ff_cbs_alloc_unit_content(unit, sizeof(*slice),
|
||||
&cbs_h265_free_slice);
|
||||
if (err < 0)
|
||||
return err;
|
||||
@ -1068,7 +1068,7 @@ static int cbs_h265_read_nal_unit(CodedBitstreamContext *ctx,
|
||||
|
||||
case HEVC_NAL_AUD:
|
||||
{
|
||||
err = ff_cbs_alloc_unit_content(ctx, unit,
|
||||
err = ff_cbs_alloc_unit_content(unit,
|
||||
sizeof(H265RawAUD), NULL);
|
||||
if (err < 0)
|
||||
return err;
|
||||
@ -1082,7 +1082,7 @@ static int cbs_h265_read_nal_unit(CodedBitstreamContext *ctx,
|
||||
case HEVC_NAL_SEI_PREFIX:
|
||||
case HEVC_NAL_SEI_SUFFIX:
|
||||
{
|
||||
err = ff_cbs_alloc_unit_content(ctx, unit, sizeof(H265RawSEI),
|
||||
err = ff_cbs_alloc_unit_content(unit, sizeof(H265RawSEI),
|
||||
&cbs_h265_free_sei);
|
||||
|
||||
if (err < 0)
|
||||
@ -1531,8 +1531,7 @@ const CodedBitstreamType ff_cbs_type_h265 = {
|
||||
.close = &cbs_h265_close,
|
||||
};
|
||||
|
||||
int ff_cbs_h264_add_sei_message(CodedBitstreamContext *ctx,
|
||||
CodedBitstreamFragment *au,
|
||||
int ff_cbs_h264_add_sei_message(CodedBitstreamFragment *au,
|
||||
H264RawSEIPayload *payload)
|
||||
{
|
||||
H264RawSEI *sei = NULL;
|
||||
@ -1577,7 +1576,7 @@ int ff_cbs_h264_add_sei_message(CodedBitstreamContext *ctx,
|
||||
break;
|
||||
}
|
||||
|
||||
err = ff_cbs_insert_unit_content(ctx, au, i, H264_NAL_SEI,
|
||||
err = ff_cbs_insert_unit_content(au, i, H264_NAL_SEI,
|
||||
sei, sei_ref);
|
||||
av_buffer_unref(&sei_ref);
|
||||
if (err < 0)
|
||||
@ -1593,8 +1592,7 @@ fail:
|
||||
return err;
|
||||
}
|
||||
|
||||
void ff_cbs_h264_delete_sei_message(CodedBitstreamContext *ctx,
|
||||
CodedBitstreamFragment *au,
|
||||
void ff_cbs_h264_delete_sei_message(CodedBitstreamFragment *au,
|
||||
CodedBitstreamUnit *nal,
|
||||
int position)
|
||||
{
|
||||
@ -1612,7 +1610,7 @@ void ff_cbs_h264_delete_sei_message(CodedBitstreamContext *ctx,
|
||||
break;
|
||||
}
|
||||
|
||||
ff_cbs_delete_unit(ctx, au, i);
|
||||
ff_cbs_delete_unit(au, i);
|
||||
} else {
|
||||
cbs_h264_free_sei_payload(&sei->payload[position]);
|
||||
|
||||
|
@ -225,7 +225,7 @@ static int cbs_jpeg_split_fragment(CodedBitstreamContext *ctx,
|
||||
data_ref = frag->data_ref;
|
||||
}
|
||||
|
||||
err = ff_cbs_insert_unit_data(ctx, frag, unit, marker,
|
||||
err = ff_cbs_insert_unit_data(frag, unit, marker,
|
||||
data, data_size, data_ref);
|
||||
if (err < 0)
|
||||
return err;
|
||||
@ -251,7 +251,7 @@ static int cbs_jpeg_read_unit(CodedBitstreamContext *ctx,
|
||||
|
||||
if (unit->type >= JPEG_MARKER_SOF0 &&
|
||||
unit->type <= JPEG_MARKER_SOF3) {
|
||||
err = ff_cbs_alloc_unit_content(ctx, unit,
|
||||
err = ff_cbs_alloc_unit_content(unit,
|
||||
sizeof(JPEGRawFrameHeader),
|
||||
NULL);
|
||||
if (err < 0)
|
||||
@ -263,7 +263,7 @@ static int cbs_jpeg_read_unit(CodedBitstreamContext *ctx,
|
||||
|
||||
} else if (unit->type >= JPEG_MARKER_APPN &&
|
||||
unit->type <= JPEG_MARKER_APPN + 15) {
|
||||
err = ff_cbs_alloc_unit_content(ctx, unit,
|
||||
err = ff_cbs_alloc_unit_content(unit,
|
||||
sizeof(JPEGRawApplicationData),
|
||||
&cbs_jpeg_free_application_data);
|
||||
if (err < 0)
|
||||
@ -277,7 +277,7 @@ static int cbs_jpeg_read_unit(CodedBitstreamContext *ctx,
|
||||
JPEGRawScan *scan;
|
||||
int pos;
|
||||
|
||||
err = ff_cbs_alloc_unit_content(ctx, unit,
|
||||
err = ff_cbs_alloc_unit_content(unit,
|
||||
sizeof(JPEGRawScan),
|
||||
&cbs_jpeg_free_scan);
|
||||
if (err < 0)
|
||||
@ -303,7 +303,7 @@ static int cbs_jpeg_read_unit(CodedBitstreamContext *ctx,
|
||||
#define SEGMENT(marker, type, func, free) \
|
||||
case JPEG_MARKER_ ## marker: \
|
||||
{ \
|
||||
err = ff_cbs_alloc_unit_content(ctx, unit, \
|
||||
err = ff_cbs_alloc_unit_content(unit, \
|
||||
sizeof(type), free); \
|
||||
if (err < 0) \
|
||||
return err; \
|
||||
|
@ -207,7 +207,7 @@ static int cbs_mpeg2_split_fragment(CodedBitstreamContext *ctx,
|
||||
final = 1;
|
||||
}
|
||||
|
||||
err = ff_cbs_insert_unit_data(ctx, frag, i, unit_type, (uint8_t*)start,
|
||||
err = ff_cbs_insert_unit_data(frag, i, unit_type, (uint8_t*)start,
|
||||
unit_size, frag->data_ref);
|
||||
if (err < 0)
|
||||
return err;
|
||||
@ -235,7 +235,7 @@ static int cbs_mpeg2_read_unit(CodedBitstreamContext *ctx,
|
||||
MPEG2RawSlice *slice;
|
||||
int pos, len;
|
||||
|
||||
err = ff_cbs_alloc_unit_content(ctx, unit, sizeof(*slice),
|
||||
err = ff_cbs_alloc_unit_content(unit, sizeof(*slice),
|
||||
&cbs_mpeg2_free_slice);
|
||||
if (err < 0)
|
||||
return err;
|
||||
@ -265,7 +265,7 @@ static int cbs_mpeg2_read_unit(CodedBitstreamContext *ctx,
|
||||
case start_code: \
|
||||
{ \
|
||||
type *header; \
|
||||
err = ff_cbs_alloc_unit_content(ctx, unit, \
|
||||
err = ff_cbs_alloc_unit_content(unit, \
|
||||
sizeof(*header), free_func); \
|
||||
if (err < 0) \
|
||||
return err; \
|
||||
|
@ -451,7 +451,7 @@ static int cbs_vp9_split_fragment(CodedBitstreamContext *ctx,
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
err = ff_cbs_insert_unit_data(ctx, frag, -1, 0,
|
||||
err = ff_cbs_insert_unit_data(frag, -1, 0,
|
||||
frag->data + pos,
|
||||
sfi.frame_sizes[i],
|
||||
frag->data_ref);
|
||||
@ -469,7 +469,7 @@ static int cbs_vp9_split_fragment(CodedBitstreamContext *ctx,
|
||||
return 0;
|
||||
|
||||
} else {
|
||||
err = ff_cbs_insert_unit_data(ctx, frag, -1, 0,
|
||||
err = ff_cbs_insert_unit_data(frag, -1, 0,
|
||||
frag->data, frag->data_size,
|
||||
frag->data_ref);
|
||||
if (err < 0)
|
||||
@ -497,7 +497,7 @@ static int cbs_vp9_read_unit(CodedBitstreamContext *ctx,
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
||||
err = ff_cbs_alloc_unit_content(ctx, unit, sizeof(*frame),
|
||||
err = ff_cbs_alloc_unit_content(unit, sizeof(*frame),
|
||||
&cbs_vp9_free_frame);
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
@ -125,7 +125,7 @@ static int filter_units_filter(AVBSFContext *bsf, AVPacket *pkt)
|
||||
}
|
||||
if (ctx->mode == REMOVE ? j < ctx->nb_types
|
||||
: j >= ctx->nb_types)
|
||||
ff_cbs_delete_unit(ctx->cbc, frag, i);
|
||||
ff_cbs_delete_unit(frag, i);
|
||||
}
|
||||
|
||||
if (frag->nb_units == 0) {
|
||||
@ -143,7 +143,7 @@ static int filter_units_filter(AVBSFContext *bsf, AVPacket *pkt)
|
||||
fail:
|
||||
if (err < 0)
|
||||
av_packet_unref(pkt);
|
||||
ff_cbs_fragment_reset(ctx->cbc, frag);
|
||||
ff_cbs_fragment_reset(frag);
|
||||
|
||||
return err;
|
||||
}
|
||||
@ -199,7 +199,7 @@ static int filter_units_init(AVBSFContext *bsf)
|
||||
av_log(bsf, AV_LOG_ERROR, "Failed to write extradata.\n");
|
||||
}
|
||||
|
||||
ff_cbs_fragment_reset(ctx->cbc, frag);
|
||||
ff_cbs_fragment_reset(frag);
|
||||
}
|
||||
|
||||
return err;
|
||||
@ -211,7 +211,7 @@ static void filter_units_close(AVBSFContext *bsf)
|
||||
|
||||
av_freep(&ctx->type_list);
|
||||
|
||||
ff_cbs_fragment_free(ctx->cbc, &ctx->fragment);
|
||||
ff_cbs_fragment_free(&ctx->fragment);
|
||||
ff_cbs_close(&ctx->cbc);
|
||||
}
|
||||
|
||||
|
@ -314,7 +314,7 @@ static int h264_metadata_update_side_data(AVBSFContext *bsf, AVPacket *pkt)
|
||||
return AVERROR(ENOMEM);
|
||||
memcpy(side_data, au->data, au->data_size);
|
||||
|
||||
ff_cbs_fragment_reset(ctx->cbc, au);
|
||||
ff_cbs_fragment_reset(au);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -349,7 +349,7 @@ static int h264_metadata_filter(AVBSFContext *bsf, AVPacket *pkt)
|
||||
// If an AUD is present, it must be the first NAL unit.
|
||||
if (au->units[0].type == H264_NAL_AUD) {
|
||||
if (ctx->aud == REMOVE)
|
||||
ff_cbs_delete_unit(ctx->cbc, au, 0);
|
||||
ff_cbs_delete_unit(au, 0);
|
||||
} else {
|
||||
if (ctx->aud == INSERT) {
|
||||
static const int primary_pic_type_table[] = {
|
||||
@ -390,7 +390,7 @@ static int h264_metadata_filter(AVBSFContext *bsf, AVPacket *pkt)
|
||||
.primary_pic_type = j,
|
||||
};
|
||||
|
||||
err = ff_cbs_insert_unit_content(ctx->cbc, au,
|
||||
err = ff_cbs_insert_unit_content(au,
|
||||
0, H264_NAL_AUD, &aud, NULL);
|
||||
if (err < 0) {
|
||||
av_log(bsf, AV_LOG_ERROR, "Failed to insert AUD.\n");
|
||||
@ -448,7 +448,7 @@ static int h264_metadata_filter(AVBSFContext *bsf, AVPacket *pkt)
|
||||
udu->data_length = len + 1;
|
||||
memcpy(udu->data, ctx->sei_user_data + i + 1, len + 1);
|
||||
|
||||
err = ff_cbs_h264_add_sei_message(ctx->cbc, au, &payload);
|
||||
err = ff_cbs_h264_add_sei_message(au, &payload);
|
||||
if (err < 0) {
|
||||
av_log(bsf, AV_LOG_ERROR, "Failed to add user data SEI "
|
||||
"message to access unit.\n");
|
||||
@ -467,7 +467,7 @@ static int h264_metadata_filter(AVBSFContext *bsf, AVPacket *pkt)
|
||||
if (ctx->delete_filler) {
|
||||
for (i = au->nb_units - 1; i >= 0; i--) {
|
||||
if (au->units[i].type == H264_NAL_FILLER_DATA) {
|
||||
ff_cbs_delete_unit(ctx->cbc, au, i);
|
||||
ff_cbs_delete_unit(au, i);
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -478,8 +478,7 @@ static int h264_metadata_filter(AVBSFContext *bsf, AVPacket *pkt)
|
||||
for (j = sei->payload_count - 1; j >= 0; j--) {
|
||||
if (sei->payload[j].payload_type ==
|
||||
H264_SEI_TYPE_FILLER_PAYLOAD)
|
||||
ff_cbs_h264_delete_sei_message(ctx->cbc, au,
|
||||
&au->units[i], j);
|
||||
ff_cbs_h264_delete_sei_message(au, &au->units[i], j);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -503,8 +502,7 @@ static int h264_metadata_filter(AVBSFContext *bsf, AVPacket *pkt)
|
||||
|
||||
if (ctx->display_orientation == REMOVE ||
|
||||
ctx->display_orientation == INSERT) {
|
||||
ff_cbs_h264_delete_sei_message(ctx->cbc, au,
|
||||
&au->units[i], j);
|
||||
ff_cbs_h264_delete_sei_message(au, &au->units[i], j);
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -595,7 +593,7 @@ static int h264_metadata_filter(AVBSFContext *bsf, AVPacket *pkt)
|
||||
if (write) {
|
||||
disp->display_orientation_repetition_period = 1;
|
||||
|
||||
err = ff_cbs_h264_add_sei_message(ctx->cbc, au, &payload);
|
||||
err = ff_cbs_h264_add_sei_message(au, &payload);
|
||||
if (err < 0) {
|
||||
av_log(bsf, AV_LOG_ERROR, "Failed to add display orientation "
|
||||
"SEI message to access unit.\n");
|
||||
@ -614,7 +612,7 @@ static int h264_metadata_filter(AVBSFContext *bsf, AVPacket *pkt)
|
||||
|
||||
err = 0;
|
||||
fail:
|
||||
ff_cbs_fragment_reset(ctx->cbc, au);
|
||||
ff_cbs_fragment_reset(au);
|
||||
|
||||
if (err < 0)
|
||||
av_packet_unref(pkt);
|
||||
@ -656,7 +654,7 @@ static int h264_metadata_init(AVBSFContext *bsf)
|
||||
|
||||
err = 0;
|
||||
fail:
|
||||
ff_cbs_fragment_reset(ctx->cbc, au);
|
||||
ff_cbs_fragment_reset(au);
|
||||
return err;
|
||||
}
|
||||
|
||||
@ -664,7 +662,7 @@ static void h264_metadata_close(AVBSFContext *bsf)
|
||||
{
|
||||
H264MetadataContext *ctx = bsf->priv_data;
|
||||
|
||||
ff_cbs_fragment_free(ctx->cbc, &ctx->access_unit);
|
||||
ff_cbs_fragment_free(&ctx->access_unit);
|
||||
ff_cbs_close(&ctx->cbc);
|
||||
}
|
||||
|
||||
|
@ -95,7 +95,7 @@ static int h264_redundant_pps_filter(AVBSFContext *bsf, AVPacket *pkt)
|
||||
if (!au_has_sps) {
|
||||
av_log(bsf, AV_LOG_VERBOSE, "Deleting redundant PPS "
|
||||
"at %"PRId64".\n", pkt->pts);
|
||||
ff_cbs_delete_unit(ctx->input, au, i);
|
||||
ff_cbs_delete_unit(au, i);
|
||||
i--;
|
||||
continue;
|
||||
}
|
||||
@ -113,7 +113,7 @@ static int h264_redundant_pps_filter(AVBSFContext *bsf, AVPacket *pkt)
|
||||
|
||||
err = 0;
|
||||
fail:
|
||||
ff_cbs_fragment_reset(ctx->output, au);
|
||||
ff_cbs_fragment_reset(au);
|
||||
if (err < 0)
|
||||
av_packet_unref(pkt);
|
||||
|
||||
@ -161,7 +161,7 @@ static int h264_redundant_pps_init(AVBSFContext *bsf)
|
||||
|
||||
err = 0;
|
||||
fail:
|
||||
ff_cbs_fragment_reset(ctx->output, au);
|
||||
ff_cbs_fragment_reset(au);
|
||||
return err;
|
||||
}
|
||||
|
||||
@ -175,7 +175,7 @@ static void h264_redundant_pps_close(AVBSFContext *bsf)
|
||||
{
|
||||
H264RedundantPPSContext *ctx = bsf->priv_data;
|
||||
|
||||
ff_cbs_fragment_free(ctx->input, &ctx->access_unit);
|
||||
ff_cbs_fragment_free(&ctx->access_unit);
|
||||
ff_cbs_close(&ctx->input);
|
||||
ff_cbs_close(&ctx->output);
|
||||
}
|
||||
|
@ -383,7 +383,7 @@ static int h265_metadata_update_side_data(AVBSFContext *bsf, AVPacket *pkt)
|
||||
return AVERROR(ENOMEM);
|
||||
memcpy(side_data, au->data, au->data_size);
|
||||
|
||||
ff_cbs_fragment_reset(ctx->cbc, au);
|
||||
ff_cbs_fragment_reset(au);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -417,7 +417,7 @@ static int h265_metadata_filter(AVBSFContext *bsf, AVPacket *pkt)
|
||||
// If an AUD is present, it must be the first NAL unit.
|
||||
if (au->units[0].type == HEVC_NAL_AUD) {
|
||||
if (ctx->aud == REMOVE)
|
||||
ff_cbs_delete_unit(ctx->cbc, au, 0);
|
||||
ff_cbs_delete_unit(au, 0);
|
||||
} else {
|
||||
if (ctx->aud == INSERT) {
|
||||
H265RawAUD *aud = &ctx->aud_nal;
|
||||
@ -449,8 +449,7 @@ static int h265_metadata_filter(AVBSFContext *bsf, AVPacket *pkt)
|
||||
};
|
||||
aud->pic_type = pic_type;
|
||||
|
||||
err = ff_cbs_insert_unit_content(ctx->cbc, au,
|
||||
0, HEVC_NAL_AUD, aud, NULL);
|
||||
err = ff_cbs_insert_unit_content(au, 0, HEVC_NAL_AUD, aud, NULL);
|
||||
if (err < 0) {
|
||||
av_log(bsf, AV_LOG_ERROR, "Failed to insert AUD.\n");
|
||||
goto fail;
|
||||
@ -482,7 +481,7 @@ static int h265_metadata_filter(AVBSFContext *bsf, AVPacket *pkt)
|
||||
|
||||
err = 0;
|
||||
fail:
|
||||
ff_cbs_fragment_reset(ctx->cbc, au);
|
||||
ff_cbs_fragment_reset(au);
|
||||
|
||||
if (err < 0)
|
||||
av_packet_unref(pkt);
|
||||
@ -532,7 +531,7 @@ static int h265_metadata_init(AVBSFContext *bsf)
|
||||
|
||||
err = 0;
|
||||
fail:
|
||||
ff_cbs_fragment_reset(ctx->cbc, au);
|
||||
ff_cbs_fragment_reset(au);
|
||||
return err;
|
||||
}
|
||||
|
||||
@ -540,7 +539,7 @@ static void h265_metadata_close(AVBSFContext *bsf)
|
||||
{
|
||||
H265MetadataContext *ctx = bsf->priv_data;
|
||||
|
||||
ff_cbs_fragment_free(ctx->cbc, &ctx->access_unit);
|
||||
ff_cbs_fragment_free(&ctx->access_unit);
|
||||
ff_cbs_close(&ctx->cbc);
|
||||
}
|
||||
|
||||
|
@ -137,7 +137,7 @@ static int mpeg2_metadata_update_fragment(AVBSFContext *bsf,
|
||||
se->vertical_size_extension << 12 | sh->vertical_size_value,
|
||||
};
|
||||
|
||||
err = ff_cbs_insert_unit_content(ctx->cbc, frag, se_pos + 1,
|
||||
err = ff_cbs_insert_unit_content(frag, se_pos + 1,
|
||||
MPEG2_START_EXTENSION,
|
||||
&ctx->sequence_display_extension,
|
||||
NULL);
|
||||
@ -200,7 +200,7 @@ static int mpeg2_metadata_filter(AVBSFContext *bsf, AVPacket *pkt)
|
||||
|
||||
err = 0;
|
||||
fail:
|
||||
ff_cbs_fragment_reset(ctx->cbc, frag);
|
||||
ff_cbs_fragment_reset(frag);
|
||||
|
||||
if (err < 0)
|
||||
av_packet_unref(pkt);
|
||||
@ -252,7 +252,7 @@ static int mpeg2_metadata_init(AVBSFContext *bsf)
|
||||
|
||||
err = 0;
|
||||
fail:
|
||||
ff_cbs_fragment_reset(ctx->cbc, frag);
|
||||
ff_cbs_fragment_reset(frag);
|
||||
return err;
|
||||
}
|
||||
|
||||
@ -260,7 +260,7 @@ static void mpeg2_metadata_close(AVBSFContext *bsf)
|
||||
{
|
||||
MPEG2MetadataContext *ctx = bsf->priv_data;
|
||||
|
||||
ff_cbs_fragment_free(ctx->cbc, &ctx->fragment);
|
||||
ff_cbs_fragment_free(&ctx->fragment);
|
||||
ff_cbs_close(&ctx->cbc);
|
||||
}
|
||||
|
||||
|
@ -52,7 +52,7 @@ static int trace_headers_init(AVBSFContext *bsf)
|
||||
|
||||
err = ff_cbs_read_extradata(ctx->cbc, frag, bsf->par_in);
|
||||
|
||||
ff_cbs_fragment_reset(ctx->cbc, frag);
|
||||
ff_cbs_fragment_reset(frag);
|
||||
}
|
||||
|
||||
return err;
|
||||
@ -62,7 +62,7 @@ static void trace_headers_close(AVBSFContext *bsf)
|
||||
{
|
||||
TraceHeadersContext *ctx = bsf->priv_data;
|
||||
|
||||
ff_cbs_fragment_free(ctx->cbc, &ctx->fragment);
|
||||
ff_cbs_fragment_free(&ctx->fragment);
|
||||
ff_cbs_close(&ctx->cbc);
|
||||
}
|
||||
|
||||
@ -97,7 +97,7 @@ static int trace_headers(AVBSFContext *bsf, AVPacket *pkt)
|
||||
|
||||
err = ff_cbs_read_packet(ctx->cbc, frag, pkt);
|
||||
|
||||
ff_cbs_fragment_reset(ctx->cbc, frag);
|
||||
ff_cbs_fragment_reset(frag);
|
||||
|
||||
if (err < 0)
|
||||
av_packet_unref(pkt);
|
||||
|
@ -135,11 +135,10 @@ static int vaapi_encode_h264_add_nal(AVCodecContext *avctx,
|
||||
CodedBitstreamFragment *au,
|
||||
void *nal_unit)
|
||||
{
|
||||
VAAPIEncodeH264Context *priv = avctx->priv_data;
|
||||
H264RawNALUnitHeader *header = nal_unit;
|
||||
int err;
|
||||
|
||||
err = ff_cbs_insert_unit_content(priv->cbc, au, -1,
|
||||
err = ff_cbs_insert_unit_content(au, -1,
|
||||
header->nal_unit_type, nal_unit, NULL);
|
||||
if (err < 0) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Failed to add NAL unit: "
|
||||
@ -174,7 +173,7 @@ static int vaapi_encode_h264_write_sequence_header(AVCodecContext *avctx,
|
||||
|
||||
err = vaapi_encode_h264_write_access_unit(avctx, data, data_len, au);
|
||||
fail:
|
||||
ff_cbs_fragment_reset(priv->cbc, au);
|
||||
ff_cbs_fragment_reset(au);
|
||||
return err;
|
||||
}
|
||||
|
||||
@ -200,7 +199,7 @@ static int vaapi_encode_h264_write_slice_header(AVCodecContext *avctx,
|
||||
|
||||
err = vaapi_encode_h264_write_access_unit(avctx, data, data_len, au);
|
||||
fail:
|
||||
ff_cbs_fragment_reset(priv->cbc, au);
|
||||
ff_cbs_fragment_reset(au);
|
||||
return err;
|
||||
}
|
||||
|
||||
@ -264,7 +263,7 @@ static int vaapi_encode_h264_write_extra_header(AVCodecContext *avctx,
|
||||
if (err < 0)
|
||||
goto fail;
|
||||
|
||||
ff_cbs_fragment_reset(priv->cbc, au);
|
||||
ff_cbs_fragment_reset(au);
|
||||
|
||||
*type = VAEncPackedHeaderRawData;
|
||||
return 0;
|
||||
@ -286,7 +285,7 @@ static int vaapi_encode_h264_write_extra_header(AVCodecContext *avctx,
|
||||
}
|
||||
|
||||
fail:
|
||||
ff_cbs_fragment_reset(priv->cbc, au);
|
||||
ff_cbs_fragment_reset(au);
|
||||
return err;
|
||||
}
|
||||
|
||||
@ -1242,7 +1241,7 @@ static av_cold int vaapi_encode_h264_close(AVCodecContext *avctx)
|
||||
{
|
||||
VAAPIEncodeH264Context *priv = avctx->priv_data;
|
||||
|
||||
ff_cbs_fragment_free(priv->cbc, &priv->current_access_unit);
|
||||
ff_cbs_fragment_free(&priv->current_access_unit);
|
||||
ff_cbs_close(&priv->cbc);
|
||||
av_freep(&priv->sei_identifier_string);
|
||||
|
||||
|
@ -116,11 +116,10 @@ static int vaapi_encode_h265_add_nal(AVCodecContext *avctx,
|
||||
CodedBitstreamFragment *au,
|
||||
void *nal_unit)
|
||||
{
|
||||
VAAPIEncodeH265Context *priv = avctx->priv_data;
|
||||
H265RawNALUnitHeader *header = nal_unit;
|
||||
int err;
|
||||
|
||||
err = ff_cbs_insert_unit_content(priv->cbc, au, -1,
|
||||
err = ff_cbs_insert_unit_content(au, -1,
|
||||
header->nal_unit_type, nal_unit, NULL);
|
||||
if (err < 0) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Failed to add NAL unit: "
|
||||
@ -159,7 +158,7 @@ static int vaapi_encode_h265_write_sequence_header(AVCodecContext *avctx,
|
||||
|
||||
err = vaapi_encode_h265_write_access_unit(avctx, data, data_len, au);
|
||||
fail:
|
||||
ff_cbs_fragment_reset(priv->cbc, au);
|
||||
ff_cbs_fragment_reset(au);
|
||||
return err;
|
||||
}
|
||||
|
||||
@ -185,7 +184,7 @@ static int vaapi_encode_h265_write_slice_header(AVCodecContext *avctx,
|
||||
|
||||
err = vaapi_encode_h265_write_access_unit(avctx, data, data_len, au);
|
||||
fail:
|
||||
ff_cbs_fragment_reset(priv->cbc, au);
|
||||
ff_cbs_fragment_reset(au);
|
||||
return err;
|
||||
}
|
||||
|
||||
@ -242,7 +241,7 @@ static int vaapi_encode_h265_write_extra_header(AVCodecContext *avctx,
|
||||
if (err < 0)
|
||||
goto fail;
|
||||
|
||||
ff_cbs_fragment_reset(priv->cbc, au);
|
||||
ff_cbs_fragment_reset(au);
|
||||
|
||||
*type = VAEncPackedHeaderRawData;
|
||||
return 0;
|
||||
@ -251,7 +250,7 @@ static int vaapi_encode_h265_write_extra_header(AVCodecContext *avctx,
|
||||
}
|
||||
|
||||
fail:
|
||||
ff_cbs_fragment_reset(priv->cbc, au);
|
||||
ff_cbs_fragment_reset(au);
|
||||
return err;
|
||||
}
|
||||
|
||||
@ -1188,7 +1187,7 @@ static av_cold int vaapi_encode_h265_close(AVCodecContext *avctx)
|
||||
{
|
||||
VAAPIEncodeH265Context *priv = avctx->priv_data;
|
||||
|
||||
ff_cbs_fragment_free(priv->cbc, &priv->current_access_unit);
|
||||
ff_cbs_fragment_free(&priv->current_access_unit);
|
||||
ff_cbs_close(&priv->cbc);
|
||||
|
||||
return ff_vaapi_encode_close(avctx);
|
||||
|
@ -90,34 +90,34 @@ static int vaapi_encode_mjpeg_write_image_header(AVCodecContext *avctx,
|
||||
int err;
|
||||
|
||||
if (priv->jfif) {
|
||||
err = ff_cbs_insert_unit_content(priv->cbc, frag, -1,
|
||||
err = ff_cbs_insert_unit_content(frag, -1,
|
||||
JPEG_MARKER_APPN + 0,
|
||||
&priv->jfif_header, NULL);
|
||||
if (err < 0)
|
||||
goto fail;
|
||||
}
|
||||
|
||||
err = ff_cbs_insert_unit_content(priv->cbc, frag, -1,
|
||||
err = ff_cbs_insert_unit_content(frag, -1,
|
||||
JPEG_MARKER_DQT,
|
||||
&priv->quant_tables, NULL);
|
||||
if (err < 0)
|
||||
goto fail;
|
||||
|
||||
err = ff_cbs_insert_unit_content(priv->cbc, frag, -1,
|
||||
err = ff_cbs_insert_unit_content(frag, -1,
|
||||
JPEG_MARKER_SOF0,
|
||||
&priv->frame_header, NULL);
|
||||
if (err < 0)
|
||||
goto fail;
|
||||
|
||||
if (priv->huffman) {
|
||||
err = ff_cbs_insert_unit_content(priv->cbc, frag, -1,
|
||||
err = ff_cbs_insert_unit_content(frag, -1,
|
||||
JPEG_MARKER_DHT,
|
||||
&priv->huffman_tables, NULL);
|
||||
if (err < 0)
|
||||
goto fail;
|
||||
}
|
||||
|
||||
err = ff_cbs_insert_unit_content(priv->cbc, frag, -1,
|
||||
err = ff_cbs_insert_unit_content(frag, -1,
|
||||
JPEG_MARKER_SOS,
|
||||
&priv->scan, NULL);
|
||||
if (err < 0)
|
||||
@ -142,7 +142,7 @@ static int vaapi_encode_mjpeg_write_image_header(AVCodecContext *avctx,
|
||||
|
||||
err = 0;
|
||||
fail:
|
||||
ff_cbs_fragment_reset(priv->cbc, frag);
|
||||
ff_cbs_fragment_reset(frag);
|
||||
return err;
|
||||
}
|
||||
|
||||
@ -519,7 +519,7 @@ static av_cold int vaapi_encode_mjpeg_close(AVCodecContext *avctx)
|
||||
{
|
||||
VAAPIEncodeMJPEGContext *priv = avctx->priv_data;
|
||||
|
||||
ff_cbs_fragment_free(priv->cbc, &priv->current_fragment);
|
||||
ff_cbs_fragment_free(&priv->current_fragment);
|
||||
ff_cbs_close(&priv->cbc);
|
||||
|
||||
return ff_vaapi_encode_close(avctx);
|
||||
|
@ -93,10 +93,9 @@ static int vaapi_encode_mpeg2_add_header(AVCodecContext *avctx,
|
||||
CodedBitstreamFragment *frag,
|
||||
int type, void *header)
|
||||
{
|
||||
VAAPIEncodeMPEG2Context *priv = avctx->priv_data;
|
||||
int err;
|
||||
|
||||
err = ff_cbs_insert_unit_content(priv->cbc, frag, -1, type, header, NULL);
|
||||
err = ff_cbs_insert_unit_content(frag, -1, type, header, NULL);
|
||||
if (err < 0) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Failed to add header: "
|
||||
"type = %d.\n", type);
|
||||
@ -135,7 +134,7 @@ static int vaapi_encode_mpeg2_write_sequence_header(AVCodecContext *avctx,
|
||||
|
||||
err = vaapi_encode_mpeg2_write_fragment(avctx, data, data_len, frag);
|
||||
fail:
|
||||
ff_cbs_fragment_reset(priv->cbc, frag);
|
||||
ff_cbs_fragment_reset(frag);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -159,7 +158,7 @@ static int vaapi_encode_mpeg2_write_picture_header(AVCodecContext *avctx,
|
||||
|
||||
err = vaapi_encode_mpeg2_write_fragment(avctx, data, data_len, frag);
|
||||
fail:
|
||||
ff_cbs_fragment_reset(priv->cbc, frag);
|
||||
ff_cbs_fragment_reset(frag);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -633,7 +632,7 @@ static av_cold int vaapi_encode_mpeg2_close(AVCodecContext *avctx)
|
||||
{
|
||||
VAAPIEncodeMPEG2Context *priv = avctx->priv_data;
|
||||
|
||||
ff_cbs_fragment_free(priv->cbc, &priv->current_fragment);
|
||||
ff_cbs_fragment_free(&priv->current_fragment);
|
||||
ff_cbs_close(&priv->cbc);
|
||||
|
||||
return ff_vaapi_encode_close(avctx);
|
||||
|
@ -98,7 +98,7 @@ static int vp9_metadata_filter(AVBSFContext *bsf, AVPacket *pkt)
|
||||
|
||||
err = 0;
|
||||
fail:
|
||||
ff_cbs_fragment_reset(ctx->cbc, frag);
|
||||
ff_cbs_fragment_reset(frag);
|
||||
|
||||
if (err < 0)
|
||||
av_packet_unref(pkt);
|
||||
@ -117,7 +117,7 @@ static void vp9_metadata_close(AVBSFContext *bsf)
|
||||
{
|
||||
VP9MetadataContext *ctx = bsf->priv_data;
|
||||
|
||||
ff_cbs_fragment_free(ctx->cbc, &ctx->fragment);
|
||||
ff_cbs_fragment_free(&ctx->fragment);
|
||||
ff_cbs_close(&ctx->cbc);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user