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

Function opt_serialize

libavutil/opt.c:2733–2774  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2731}
2732
2733static int opt_serialize(void *obj, int opt_flags, int flags, int *cnt,
2734 AVBPrint *bprint, const char key_val_sep, const char pairs_sep)
2735{
2736 const AVOption *o = NULL;
2737 void *child = NULL;
2738 uint8_t *buf;
2739 int ret;
2740 const char special_chars[] = {pairs_sep, key_val_sep, '\0'};
2741
2742 if (flags & AV_OPT_SERIALIZE_SEARCH_CHILDREN)
2743 while (child = av_opt_child_next(obj, child)) {
2744 ret = opt_serialize(child, opt_flags, flags, cnt, bprint,
2745 key_val_sep, pairs_sep);
2746 if (ret < 0)
2747 return ret;
2748 }
2749
2750 while (o = av_opt_next(obj, o)) {
2751 if (o->type == AV_OPT_TYPE_CONST)
2752 continue;
2753 if ((flags & AV_OPT_SERIALIZE_OPT_FLAGS_EXACT) && o->flags != opt_flags)
2754 continue;
2755 else if (((o->flags & opt_flags) != opt_flags))
2756 continue;
2757 if (flags & AV_OPT_SERIALIZE_SKIP_DEFAULTS && av_opt_is_set_to_default(obj, o) > 0)
2758 continue;
2759 if ((ret = av_opt_get(obj, o->name, 0, &buf)) < 0) {
2760 av_bprint_finalize(bprint, NULL);
2761 return ret;
2762 }
2763 if (buf) {
2764 if ((*cnt)++)
2765 av_bprint_append_data(bprint, &pairs_sep, 1);
2766 av_bprint_escape(bprint, o->name, special_chars, AV_ESCAPE_MODE_BACKSLASH, 0);
2767 av_bprint_append_data(bprint, &key_val_sep, 1);
2768 av_bprint_escape(bprint, buf, special_chars, AV_ESCAPE_MODE_BACKSLASH, 0);
2769 av_freep(&buf);
2770 }
2771 }
2772
2773 return 0;
2774}
2775
2776int av_opt_serialize(void *obj, int opt_flags, int flags, char **buffer,
2777 const char key_val_sep, const char pairs_sep)

Callers 1

av_opt_serializeFunction · 0.85

Calls 8

av_opt_child_nextFunction · 0.85
av_opt_nextFunction · 0.85
av_opt_is_set_to_defaultFunction · 0.85
av_opt_getFunction · 0.85
av_bprint_finalizeFunction · 0.85
av_bprint_append_dataFunction · 0.85
av_bprint_escapeFunction · 0.85
av_freepFunction · 0.85

Tested by

no test coverage detected