/* * This file is part of FFmpeg. * * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * FFmpeg is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
if (ctx->priv_data) { if (ff_bsf(ctx->filter)->close)
ff_bsf(ctx->filter)->close(ctx); if (ctx->filter->priv_class)
av_opt_free(ctx->priv_data);
av_freep(&ctx->priv_data);
}
av_packet_free(&bsfi->buffer_pkt);
/* check that the codec is supported */ if (ctx->filter->codec_ids) { for (i = 0; ctx->filter->codec_ids[i] != AV_CODEC_ID_NONE; i++) if (ctx->par_in->codec_id == ctx->filter->codec_ids[i]) break; if (ctx->filter->codec_ids[i] == AV_CODEC_ID_NONE) { const AVCodecDescriptor *desc = avcodec_descriptor_get(ctx->par_in->codec_id);
av_log(ctx, AV_LOG_ERROR, "Codec '%s' (%d) is not supported by the " "bitstream filter '%s'. Supported codecs are: ",
desc ? desc->name : "unknown", ctx->par_in->codec_id, ctx->filter->name); for (i = 0; ctx->filter->codec_ids[i] != AV_CODEC_ID_NONE; i++) { enum AVCodecID codec_id = ctx->filter->codec_ids[i];
av_log(ctx, AV_LOG_ERROR, "%s (%d) ",
avcodec_get_name(codec_id), codec_id);
}
av_log(ctx, AV_LOG_ERROR, "\n"); return AVERROR(EINVAL);
}
}
/* initialize output parameters to be the same as input
* init below might overwrite that */
ret = avcodec_parameters_copy(ctx->par_out, ctx->par_in); if (ret < 0) return ret;
ctx->time_base_out = ctx->time_base_in;
if (ff_bsf(ctx->filter)->init) {
ret = ff_bsf(ctx->filter)->init(ctx); if (ret < 0) return ret;
}
if (!lst->nb_bsfs) return ff_bsf_get_packet_ref(bsf, out);
while (1) { /* get a packet from the previous filter up the chain */ if (lst->idx)
ret = av_bsf_receive_packet(lst->bsfs[lst->idx-1], out); else
ret = ff_bsf_get_packet_ref(bsf, out); if (ret == AVERROR(EAGAIN)) { if (!lst->idx) return ret;
lst->idx--; continue;
} elseif (ret == AVERROR_EOF) {
eof = 1;
} elseif (ret < 0) return ret;
/* send it to the next filter down the chain */ if (lst->idx < lst->nb_bsfs) {
ret = av_bsf_send_packet(lst->bsfs[lst->idx], eof ? NULL : out);
av_assert1(ret != AVERROR(EAGAIN)); if (ret < 0) {
av_packet_unref(out); return ret;
}
lst->idx++;
eof = 0;
} elseif (eof) { return ret;
} else { return 0;
}
}
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.