- err = ff_cbs_write_packet(ctx->output, out, au);
- if (err < 0)
- goto fail;
-
-
- err = av_packet_copy_props(out, in);
- if (err < 0)
- goto fail;
-
- err = 0;
-fail:
- ff_cbs_fragment_uninit(ctx->output, au);
- av_packet_free(&in);
- if (err < 0)
- av_packet_unref(out);
-
- return err;
-}
-
-static int h264_redundant_pps_init(AVBSFContext *bsf)
-{
- H264RedundantPPSContext *ctx = bsf->priv_data;
- CodedBitstreamFragment *au = &ctx->access_unit;
- int err, i;
-
- err = ff_cbs_init(&ctx->input, AV_CODEC_ID_H264, bsf);
- if (err < 0)
- return err;
-
- err = ff_cbs_init(&ctx->output, AV_CODEC_ID_H264, bsf);
- if (err < 0)
- return err;
-
- ctx->global_pic_init_qp = 26;
-
- if (bsf->par_in->extradata) {
- err = ff_cbs_read_extradata(ctx->input, au, bsf->par_in);
- if (err < 0) {
- av_log(bsf, AV_LOG_ERROR, "Failed to read extradata.\n");
- goto fail;
- }
-
- for (i = 0; i < au->nb_units; i++) {
- if (au->units[i].type == H264_NAL_PPS) {
- err = h264_redundant_pps_fixup_pps(ctx, au->units[i].content);
- if (err < 0)
- goto fail;
- }
- }
-
- ctx->extradata_pic_init_qp = ctx->current_pic_init_qp;
- err = ff_cbs_write_extradata(ctx->output, bsf->par_out, au);
- if (err < 0) {
- av_log(bsf, AV_LOG_ERROR, "Failed to write extradata.\n");
- goto fail;
- }
- }
-
- err = 0;
-fail:
- ff_cbs_fragment_uninit(ctx->output, au);
- return err;