MCPcopy Create free account
hub / github.com/FFmpeg/FFmpeg / av_bsf_alloc

Function av_bsf_alloc

libavcodec/bsf.c:104–147  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

102}
103
104int av_bsf_alloc(const AVBitStreamFilter *filter, AVBSFContext **pctx)
105{
106 AVBSFContext *ctx;
107 FFBSFContext *bsfi;
108 int ret;
109
110 bsfi = av_mallocz(sizeof(*bsfi));
111 if (!bsfi)
112 return AVERROR(ENOMEM);
113 ctx = &bsfi->pub;
114
115 ctx->av_class = &bsf_class;
116 ctx->filter = filter;
117
118 ctx->par_in = avcodec_parameters_alloc();
119 ctx->par_out = avcodec_parameters_alloc();
120 if (!ctx->par_in || !ctx->par_out) {
121 ret = AVERROR(ENOMEM);
122 goto fail;
123 }
124 /* allocate priv data and init private options */
125 if (ff_bsf(filter)->priv_data_size) {
126 ctx->priv_data = av_mallocz(ff_bsf(filter)->priv_data_size);
127 if (!ctx->priv_data) {
128 ret = AVERROR(ENOMEM);
129 goto fail;
130 }
131 if (filter->priv_class) {
132 *(const AVClass **)ctx->priv_data = filter->priv_class;
133 av_opt_set_defaults(ctx->priv_data);
134 }
135 }
136 bsfi->buffer_pkt = av_packet_alloc();
137 if (!bsfi->buffer_pkt) {
138 ret = AVERROR(ENOMEM);
139 goto fail;
140 }
141
142 *pctx = ctx;
143 return 0;
144fail:
145 av_bsf_free(&ctx);
146 return ret;
147}
148
149int av_bsf_init(AVBSFContext *ctx)
150{

Callers 11

LLVMFuzzerTestOneInputFunction · 0.85
extract_extradata_initFunction · 0.85
av1_read_headerFunction · 0.85
evc_read_headerFunction · 0.85
detect_stream_specificFunction · 0.85
bsf_list_append_internalFunction · 0.85
av_bsf_list_finalizeFunction · 0.85
av_bsf_get_null_filterFunction · 0.85
qsv_enc_initFunction · 0.85
aom_initFunction · 0.85

Calls 6

avcodec_parameters_allocFunction · 0.85
ff_bsfFunction · 0.85
av_opt_set_defaultsFunction · 0.85
av_packet_allocFunction · 0.85
av_bsf_freeFunction · 0.85
av_malloczFunction · 0.50

Tested by

no test coverage detected