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

Function read_header_vs

libavformat/vapoursynth.c:221–361  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

219}
220
221static av_cold int read_header_vs(AVFormatContext *s)
222{
223 AVStream *st;
224 AVIOContext *pb = s->pb;
225 VSContext *vs = s->priv_data;
226 VSScriptGetAPIFunc get_vssapi;
227 int64_t sz = avio_size(pb);
228 char *buf = NULL;
229 char dummy;
230 char vsfmt[32];
231 const VSVideoInfo *info;
232 struct VSState *vss_state;
233 int err = 0;
234
235 if (!(vs->vslibrary = vs_load_library(&get_vssapi))) {
236 av_log(s, AV_LOG_ERROR, "Could not open " VSSCRIPT_LIB ". "
237 "Check VapourSynth installation.\n");
238 err = AVERROR_EXTERNAL;
239 goto done;
240 }
241
242 if (!(vs->vssapi = get_vssapi(VSSCRIPT_API_VERSION))) {
243 av_log(s, AV_LOG_ERROR, "Failed to initialize VSScript (possibly PYTHONPATH not set).\n");
244 err = AVERROR_EXTERNAL;
245 goto done;
246 }
247
248 if (!(vs->vsapi = vs->vssapi->getVSAPI(VAPOURSYNTH_API_VERSION))) {
249 av_log(s, AV_LOG_ERROR, "Could not get VSAPI. "
250 "Check VapourSynth installation.\n");
251 err = AVERROR_EXTERNAL;
252 goto done;
253 }
254
255 vss_state = av_mallocz(sizeof(*vss_state));
256 if (!vss_state) {
257 err = AVERROR(ENOMEM);
258 goto done;
259 }
260 vss_state->vssapi = vs->vssapi;
261
262 vs->vss_state = av_buffer_create(NULL, 0, free_vss_state, vss_state, 0);
263 if (!vs->vss_state) {
264 err = AVERROR(ENOMEM);
265 av_free(vss_state);
266 goto done;
267 }
268
269 if (!(vss_state->vss = vs->vssapi->createScript(NULL))) {
270 av_log(s, AV_LOG_ERROR, "Failed to create script instance.\n");
271 err = AVERROR_EXTERNAL;
272 goto done;
273 }
274
275 if (sz < 0 || sz > vs->max_script_size) {
276 if (sz < 0)
277 av_log(s, AV_LOG_WARNING, "Could not determine file size\n");
278 sz = vs->max_script_size;

Callers

nothing calls this directly

Calls 12

avio_sizeFunction · 0.85
vs_load_libraryFunction · 0.85
av_logFunction · 0.85
av_buffer_createFunction · 0.85
avio_readFunction · 0.85
avformat_new_streamFunction · 0.85
avpriv_set_pts_infoFunction · 0.85
match_pixfmtFunction · 0.85
av_get_pix_fmt_nameFunction · 0.85
av_malloczFunction · 0.50
av_freeFunction · 0.50
av_mallocFunction · 0.50

Tested by

no test coverage detected