Lines Matching defs:obj

46 const AVOption *av_opt_next(const void *obj, const AVOption *last)
49 if (!obj)
51 class = *(const AVClass**)obj;
102 static int write_number(void *obj, const AVOption *o, void *dst, double num, int den, int64_t intnum)
107 av_log(obj, AV_LOG_ERROR, "Value %f for parameter '%s' out of range [%g - %g]\n",
114 av_log(obj, AV_LOG_ERROR,
189 static int set_string_binary(void *obj, const AVOption *o, const char *val, uint8_t **dst)
223 static int set_string(void *obj, const AVOption *o, const char *val, uint8_t **dst)
238 static int set_string_number(void *obj, void *target_obj, const AVOption *o, const char *val, void *dst)
246 if ((ret = write_number(obj, o, dst, 1, den, num)) >= 0)
277 av_log(obj, AV_LOG_WARNING, "The \"%s\" option is deprecated: %s\n",
286 av_log(obj, AV_LOG_ERROR, "const_values array too small for %s\n", o->unit);
308 const_values, NULL, NULL, NULL, NULL, NULL, 0, obj);
310 av_log(obj, AV_LOG_ERROR, "Unable to parse option value \"%s\"\n", val);
323 if ((ret = write_number(obj, o, dst, d, 1, 1)) < 0)
331 static int set_string_image_size(void *obj, const AVOption *o, const char *val, int *dst)
342 av_log(obj, AV_LOG_ERROR, "Unable to parse option value \"%s\" as image size\n", val);
346 static int set_string_video_rate(void *obj, const AVOption *o, const char *val, AVRational *dst)
350 av_log(obj, AV_LOG_ERROR, "Unable to parse option value \"%s\" as video rate\n", val);
354 static int set_string_color(void *obj, const AVOption *o, const char *val, uint8_t *dst)
361 ret = av_parse_color(dst, val, -1, obj);
363 av_log(obj, AV_LOG_ERROR, "Unable to parse option value \"%s\" as color\n", val);
376 static int set_string_bool(void *obj, const AVOption *o, const char *val, int *dst)
403 av_log(obj, AV_LOG_ERROR, "Unable to parse option value \"%s\" as boolean\n", val);
407 static int set_string_fmt(void *obj, const AVOption *o, const char *val, uint8_t *dst,
420 av_log(obj, AV_LOG_ERROR,
437 av_log(obj, AV_LOG_ERROR,
447 static int set_string_pixel_fmt(void *obj, const AVOption *o, const char *val, uint8_t *dst)
449 return set_string_fmt(obj, o, val, dst,
453 static int set_string_sample_fmt(void *obj, const AVOption *o, const char *val, uint8_t *dst)
455 return set_string_fmt(obj, o, val, dst,
459 static int set_string_dict(void *obj, const AVOption *o, const char *val, uint8_t **dst)
477 static int set_string_channel_layout(void *obj, const AVOption *o,
487 int av_opt_set(void *obj, const char *name, const char *val, int search_flags)
491 const AVOption *o = av_opt_find2(obj, name, NULL, 0, search_flags, &target_obj);
510 av_log(obj, AV_LOG_WARNING, "The \"%s\" option is deprecated: %s\n", name, o->help);
515 return set_string_bool(obj, o, val, dst);
517 return set_string(obj, o, val, dst);
519 return set_string_binary(obj, o, val, dst);
527 return set_string_number(obj, target_obj, o, val, dst);
529 return set_string_image_size(obj, o, val, dst);
532 ret = set_string_video_rate(obj, o, val, &tmp);
535 return write_number(obj, o, dst, 1, tmp.den, tmp.num);
538 return set_string_pixel_fmt(obj, o, val, dst);
540 return set_string_sample_fmt(obj, o, val, dst);
546 av_log(obj, AV_LOG_ERROR, "Unable to parse option value \"%s\" as duration\n", val);
551 av_log(obj, AV_LOG_ERROR, "Value %f for parameter '%s' out of range [%g - %g]\n",
559 return set_string_color(obj, o, val, dst);
568 av_log(obj, AV_LOG_ERROR, "Unable to parse option value \"%s\" as channel layout\n", val);
578 ret = set_string_channel_layout(obj, o, val, dst);
580 av_log(obj, AV_LOG_ERROR, "Unable to parse option value \"%s\" as channel layout\n", val);
585 return set_string_dict(obj, o, val, dst);
588 av_log(obj, AV_LOG_ERROR, "Invalid option type.\n");
593 int av_opt_eval_ ## name(void *obj, const AVOption *o, \
598 return set_string_number(obj, obj, o, val, name ## _out); \
608 static int set_number(void *obj, const char *name, double num, int den, int64_t intnum,
612 const AVOption *o = av_opt_find2(obj, name, NULL, 0, search_flags, &target_obj);
621 return write_number(obj, o, dst, num, den, intnum);
624 int av_opt_set_int(void *obj, const char *name, int64_t val, int search_flags)
626 return set_number(obj, name, 1, 1, val, search_flags);
629 int av_opt_set_double(void *obj, const char *name, double val, int search_flags)
631 return set_number(obj, name, val, 1, 1, search_flags);
634 int av_opt_set_q(void *obj, const char *name, AVRational val, int search_flags)
636 return set_number(obj, name, val.num, val.den, 1, search_flags);
639 int av_opt_set_bin(void *obj, const char *name, const uint8_t *val, int len, int search_flags)
642 const AVOption *o = av_opt_find2(obj, name, NULL, 0, search_flags, &target_obj);
669 int av_opt_set_image_size(void *obj, const char *name, int w, int h, int search_flags)
672 const AVOption *o = av_opt_find2(obj, name, NULL, 0, search_flags, &target_obj);
677 av_log(obj, AV_LOG_ERROR,
682 av_log(obj, AV_LOG_ERROR,
691 int av_opt_set_video_rate(void *obj, const char *name, AVRational val, int search_flags)
694 const AVOption *o = av_opt_find2(obj, name, NULL, 0, search_flags, &target_obj);
699 av_log(obj, AV_LOG_ERROR,
705 return set_number(obj, name, val.num, val.den, 1, search_flags);
708 static int set_format(void *obj, const char *name, int fmt, int search_flags,
712 const AVOption *o = av_opt_find2(obj, name, NULL, 0,
719 av_log(obj, AV_LOG_ERROR,
728 av_log(obj, AV_LOG_ERROR,
737 int av_opt_set_pixel_fmt(void *obj, const char *name, enum AVPixelFormat fmt, int search_flags)
739 return set_format(obj, name, fmt, search_flags, AV_OPT_TYPE_PIXEL_FMT, "pixel", AV_PIX_FMT_NB);
742 int av_opt_set_sample_fmt(void *obj, const char *name, enum AVSampleFormat fmt, int search_flags)
744 return set_format(obj, name, fmt, search_flags, AV_OPT_TYPE_SAMPLE_FMT, "sample", AV_SAMPLE_FMT_NB);
749 int av_opt_set_channel_layout(void *obj, const char *name, int64_t cl, int search_flags)
752 const AVOption *o = av_opt_find2(obj, name, NULL, 0, search_flags, &target_obj);
757 av_log(obj, AV_LOG_ERROR,
767 int av_opt_set_dict_val(void *obj, const char *name, const AVDictionary *val,
772 const AVOption *o = av_opt_find2(obj, name, NULL, 0, search_flags, &target_obj);
786 int av_opt_set_chlayout(void *obj, const char *name,
791 const AVOption *o = av_opt_find2(obj, name, NULL, 0, search_flags, &target_obj);
837 int av_opt_get(void *obj, const char *name, int search_flags, uint8_t **out_val)
840 const AVOption *o = av_opt_find2(obj, name, NULL, 0, search_flags, &target_obj);
849 av_log(obj, AV_LOG_WARNING, "The \"%s\" option is deprecated: %s\n", name, o->help);
958 static int get_number(void *obj, const char *name, const AVOption **o_out, double *num, int *den, int64_t *intnum,
962 const AVOption *o = av_opt_find2(obj, name, NULL, 0, search_flags, &target_obj);
978 int av_opt_get_int(void *obj, const char *name, int search_flags, int64_t *out_val)
984 if ((ret = get_number(obj, name, NULL, &num, &den, &intnum, search_flags)) < 0)
993 int av_opt_get_double(void *obj, const char *name, int search_flags, double *out_val)
999 if ((ret = get_number(obj, name, NULL, &num, &den, &intnum, search_flags)) < 0)
1005 int av_opt_get_q(void *obj, const char *name, int search_flags, AVRational *out_val)
1011 if ((ret = get_number(obj, name, NULL, &num, &den, &intnum, search_flags)) < 0)
1021 int av_opt_get_image_size(void *obj, const char *name, int search_flags, int *w_out, int *h_out)
1024 const AVOption *o = av_opt_find2(obj, name, NULL, 0, search_flags, &target_obj);
1028 av_log(obj, AV_LOG_ERROR,
1039 int av_opt_get_video_rate(void *obj, const char *name, int search_flags, AVRational *out_val)
1045 if ((ret = get_number(obj, name, NULL, &num, &den, &intnum, search_flags)) < 0)
1055 static int get_format(void *obj, const char *name, int search_flags, int *out_fmt,
1059 const AVOption *o = av_opt_find2(obj, name, NULL, 0, search_flags, &target_obj);
1063 av_log(obj, AV_LOG_ERROR,
1073 int av_opt_get_pixel_fmt(void *obj, const char *name, int search_flags, enum AVPixelFormat *out_fmt)
1075 return get_format(obj, name, search_flags, out_fmt, AV_OPT_TYPE_PIXEL_FMT, "pixel");
1078 int av_opt_get_sample_fmt(void *obj, const char *name, int search_flags, enum AVSampleFormat *out_fmt)
1080 return get_format(obj, name, search_flags, out_fmt, AV_OPT_TYPE_SAMPLE_FMT, "sample");
1085 int av_opt_get_channel_layout(void *obj, const char *name, int search_flags, int64_t *cl)
1088 const AVOption *o = av_opt_find2(obj, name, NULL, 0, search_flags, &target_obj);
1092 av_log(obj, AV_LOG_ERROR,
1104 int av_opt_get_chlayout(void *obj, const char *name, int search_flags, AVChannelLayout *cl)
1107 const AVOption *o = av_opt_find2(obj, name, NULL, 0, search_flags, &target_obj);
1111 av_log(obj, AV_LOG_ERROR,
1120 int av_opt_get_dict_val(void *obj, const char *name, int search_flags, AVDictionary **out_val)
1124 const AVOption *o = av_opt_find2(obj, name, NULL, 0, search_flags, &target_obj);
1137 int av_opt_flag_is_set(void *obj, const char *field_name, const char *flag_name)
1139 const AVOption *field = av_opt_find(obj, field_name, NULL, 0, 0);
1140 const AVOption *flag = av_opt_find(obj, flag_name,
1145 av_opt_get_int(obj, field_name, 0, &res) < 0)
1200 static const char *get_opt_const_name(void *obj, const char *unit, int64_t value)
1206 while ((opt = av_opt_next(obj, opt)))
1213 static char *get_opt_flags_string(void *obj, const char *unit, int64_t value)
1221 while ((opt = av_opt_next(obj, opt))) {
1234 static void opt_list(void *obj, void *av_log_obj, const char *unit,
1241 while ((opt = av_opt_next(obj, opt))) {
1347 if (av_opt_query_ranges(&r, obj, opt->name, AV_OPT_SEARCH_FAKE_OBJ) >= 0) {
1382 char *def_flags = get_opt_flags_string(obj, opt->unit, opt->default_val.i64);
1400 const char *def_const = get_opt_const_name(obj, opt->unit, opt->default_val.i64);
1442 opt_list(obj, av_log_obj, opt->unit, req_flags, rej_flags, opt->type);
1446 int av_opt_show2(void *obj, void *av_log_obj, int req_flags, int rej_flags)
1448 if (!obj)
1451 av_log(av_log_obj, AV_LOG_INFO, "%s AVOptions:\n", (*(AVClass **)obj)->class_name);
1453 opt_list(obj, av_log_obj, NULL, req_flags, rej_flags, -1);
1718 void av_opt_free(void *obj)
1721 while ((o = av_opt_next(obj, o))) {
1725 av_freep((uint8_t *)obj + o->offset);
1729 av_dict_free((AVDictionary **)(((uint8_t *)obj) + o->offset));
1733 av_channel_layout_uninit((AVChannelLayout *)(((uint8_t *)obj) + o->offset));
1742 int av_opt_set_dict2(void *obj, AVDictionary **options, int search_flags)
1752 ret = av_opt_set(obj, t->key, t->value, search_flags);
1756 av_log(obj, AV_LOG_ERROR, "Error setting option %s to value %s.\n", t->key, t->value);
1766 int av_opt_set_dict(void *obj, AVDictionary **options)
1768 return av_opt_set_dict2(obj, options, 0);
1771 const AVOption *av_opt_find(void *obj, const char *name, const char *unit,
1774 return av_opt_find2(obj, name, unit, opt_flags, search_flags, NULL);
1777 const AVOption *av_opt_find2(void *obj, const char *name, const char *unit,
1783 if(!obj)
1786 c= *(AVClass**)obj;
1800 while (child = av_opt_child_next(obj, child))
1806 while (o = av_opt_next(obj, o)) {
1812 *target_obj = obj;
1822 void *av_opt_child_next(void *obj, void *prev)
1824 const AVClass *c = *(AVClass **)obj;
1826 return c->child_next(obj, prev);
1837 void *av_opt_ptr(const AVClass *class, void *obj, const char *name)
1842 return (uint8_t*)obj + opt->offset;
1945 int av_opt_query_ranges(AVOptionRanges **ranges_arg, void *obj, const char *key, int flags)
1948 const AVClass *c = *(AVClass**)obj;
1949 int (*callback)(AVOptionRanges **, void *obj, const char *key, int flags) = c->query_ranges;
1954 ret = callback(ranges_arg, obj, key, flags);
1963 int av_opt_query_ranges_default(AVOptionRanges **ranges_arg, void *obj, const char *key, int flags)
1968 const AVOption *field = av_opt_find(obj, key, NULL, 0, flags);
2058 int av_opt_is_set_to_default(void *obj, const AVOption *o)
2068 if (!o || !obj)
2071 dst = ((uint8_t*)obj) + o->offset;
2175 av_log(obj, AV_LOG_WARNING, "Not supported option type: %d, option name: %s\n", o->type, o->name);
2181 int av_opt_is_set_to_default_by_name(void *obj, const char *name, int search_flags)
2185 if (!obj)
2187 o = av_opt_find2(obj, name, NULL, 0, search_flags, &target);
2193 int av_opt_serialize(void *obj, int opt_flags, int flags, char **buffer,
2204 av_log(obj, AV_LOG_ERROR, "Invalid separator(s) found.");
2208 if (!obj || !buffer)
2214 while (o = av_opt_next(obj, o)) {
2221 if (flags & AV_OPT_SERIALIZE_SKIP_DEFAULTS && av_opt_is_set_to_default(obj, o) > 0)
2223 if ((ret = av_opt_get(obj, o->name, 0, &buf)) < 0) {