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

Function opt_copy_array

libavutil/opt.c:2121–2153  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2119}
2120
2121static int opt_copy_array(void *logctx, const AVOption *o,
2122 void **pdst, const void * const *psrc)
2123{
2124 unsigned nb_elems = *opt_array_pcount(psrc);
2125 void *dst = NULL;
2126 int ret;
2127
2128 if (*pdst == *psrc) {
2129 *pdst = NULL;
2130 *opt_array_pcount(pdst) = 0;
2131 }
2132
2133 opt_free_array(o, pdst, opt_array_pcount(pdst));
2134
2135 dst = av_calloc(nb_elems, opt_type_desc[TYPE_BASE(o->type)].size);
2136 if (!dst)
2137 return AVERROR(ENOMEM);
2138
2139 for (unsigned i = 0; i < nb_elems; i++) {
2140 ret = opt_copy_elem(logctx, TYPE_BASE(o->type),
2141 opt_array_pelem(o, dst, i),
2142 opt_array_pelem(o, *(void**)psrc, i));
2143 if (ret < 0) {
2144 opt_free_array(o, &dst, &nb_elems);
2145 return ret;
2146 }
2147 }
2148
2149 *pdst = dst;
2150 *opt_array_pcount(pdst) = nb_elems;
2151
2152 return 0;
2153}
2154
2155int av_opt_copy(void *dst, const void *src)
2156{

Callers 1

av_opt_copyFunction · 0.85

Calls 5

opt_array_pcountFunction · 0.85
opt_free_arrayFunction · 0.85
av_callocFunction · 0.85
opt_copy_elemFunction · 0.85
opt_array_pelemFunction · 0.85

Tested by

no test coverage detected