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

Function get_video_private_data

tools/ismindex.c:464–493  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

462}
463
464static int get_video_private_data(struct Track *track, AVCodecParameters *codecpar)
465{
466 AVIOContext *io = NULL;
467 uint16_t sps_size, pps_size;
468 int err;
469
470 if (codecpar->codec_id == AV_CODEC_ID_VC1)
471 return get_private_data(track, codecpar);
472
473 if ((err = avio_open_dyn_buf(&io)) < 0)
474 goto fail;
475 err = AVERROR(EINVAL);
476 if (codecpar->extradata_size < 11 || codecpar->extradata[0] != 1)
477 goto fail;
478 sps_size = AV_RB16(&codecpar->extradata[6]);
479 if (11 + sps_size > codecpar->extradata_size)
480 goto fail;
481 avio_wb32(io, 0x00000001);
482 avio_write(io, &codecpar->extradata[8], sps_size);
483 pps_size = AV_RB16(&codecpar->extradata[9 + sps_size]);
484 if (11 + sps_size + pps_size > codecpar->extradata_size)
485 goto fail;
486 avio_wb32(io, 0x00000001);
487 avio_write(io, &codecpar->extradata[11 + sps_size], pps_size);
488 err = 0;
489
490fail:
491 track->codec_private_size = avio_close_dyn_buf(io, &track->codec_private);
492 return err;
493}
494
495static int handle_file(struct Tracks *tracks, const char *file, int split,
496 int ismf, const char *basename,

Callers 1

handle_fileFunction · 0.85

Calls 5

avio_open_dyn_bufFunction · 0.85
avio_wb32Function · 0.85
avio_writeFunction · 0.85
avio_close_dyn_bufFunction · 0.85
get_private_dataFunction · 0.70

Tested by

no test coverage detected