AVFilterGraph *graph;
#endif
- int sws_flags;
+ int64_t sws_flags;
AVDictionary *opts;
int is_past_recording_time;
} OutputStream;
snprintf(args, 255, "%d:%d:flags=0x%X",
codec->width,
codec->height,
- ost->sws_flags);
+ (unsigned)ost->sws_flags);
if ((ret = avfilter_graph_create_filter(&filter, avfilter_get_by_name("scale"),
NULL, args, NULL, ost->graph)) < 0)
return ret;
last_filter = filter;
}
- snprintf(args, sizeof(args), "flags=0x%X", ost->sws_flags);
+ snprintf(args, sizeof(args), "flags=0x%X", (unsigned)ost->sws_flags);
ost->graph->scale_sws_opts = av_strdup(args);
if (ost->avfilter) {
if (oc->oformat->flags & AVFMT_GLOBALHEADER)
st->codec->flags |= CODEC_FLAG_GLOBAL_HEADER;
- ost->sws_flags = av_get_int(sws_opts, "sws_flags", NULL);
+ av_opt_get_int(sws_opts, "sws_flags", 0, &ost->sws_flags);
return ost;
}
AVFormatContext *rtpctx;
int ret;
AVOutputFormat *rtp_format = av_guess_format("rtp", NULL, NULL);
+ uint8_t *rtpflags;
+ AVDictionary *opts = NULL;
if (!rtp_format)
return NULL;
/* Copy other stream parameters. */
rtpctx->streams[0]->sample_aspect_ratio = st->sample_aspect_ratio;
- av_set_parameters(rtpctx, NULL);
- /* Copy the rtpflags values straight through */
- if (s->oformat->priv_class &&
- av_find_opt(s->priv_data, "rtpflags", NULL, 0, 0))
- av_set_int(rtpctx->priv_data, "rtpflags",
- av_get_int(s->priv_data, "rtpflags", NULL));
+ if (av_opt_get(s, "rtpflags", AV_OPT_SEARCH_CHILDREN, &rtpflags) >= 0)
+ av_dict_set(&opts, "rtpflags", rtpflags, AV_DICT_DONT_STRDUP_VAL);
/* Set the synchronized start time. */
rtpctx->start_time_realtime = s->start_time_realtime;
ffio_fdopen(&rtpctx->pb, handle);
} else
ffio_open_dyn_packet_buf(&rtpctx->pb, packet_size);
- ret = avformat_write_header(rtpctx, NULL);
+ ret = avformat_write_header(rtpctx, &opts);
+ av_dict_free(&opts);
if (ret) {
if (handle) {
int av_opt_flag_is_set(void *obj, const char *field_name, const char *flag_name)
{
- const AVOption *field = av_find_opt(obj, field_name, NULL, 0, 0);
- const AVOption *flag = av_find_opt(obj, flag_name, NULL, 0, 0);
+ const AVOption *field = av_opt_find(obj, field_name, NULL, 0, 0);
+ const AVOption *flag = av_opt_find(obj, flag_name, NULL, 0, 0);
+ int64_t res;
- if (!field || !flag || flag->type != FF_OPT_TYPE_CONST)
+ if (!field || !flag || flag->type != FF_OPT_TYPE_CONST ||
+ av_opt_get_int(obj, field_name, 0, &res) < 0)
return 0;
- return av_get_int(obj, field_name, NULL) & (int) flag->default_val.dbl;
+ return res & (int) flag->default_val.dbl;
}
static void opt_list(void *obj, void *av_log_obj, const char *unit,
{
const AVOption *opt=NULL;
- while ((opt= av_next_option(obj, opt))) {
+ while ((opt = av_opt_next(obj, opt))) {
if (!(opt->flags & req_flags) || (opt->flags & rej_flags))
continue;
{
#endif
const AVOption *opt = NULL;
- while ((opt = av_next_option(s, opt)) != NULL) {
+ while ((opt = av_opt_next(s, opt)) != NULL) {
#if FF_API_OLD_AVOPTIONS
if ((opt->flags & mask) != flags)
continue;
case FF_OPT_TYPE_INT: {
int val;
val = opt->default_val.dbl;
- av_set_int(s, opt->name, val);
+ av_opt_set_int(s, opt->name, val, 0);
}
break;
case FF_OPT_TYPE_INT64:
if ((double)(opt->default_val.dbl+0.6) == opt->default_val.dbl)
av_log(s, AV_LOG_DEBUG, "loss of precision in default of %s\n", opt->name);
- av_set_int(s, opt->name, opt->default_val.dbl);
+ av_opt_set_int(s, opt->name, opt->default_val.dbl, 0);
break;
case FF_OPT_TYPE_DOUBLE:
case FF_OPT_TYPE_FLOAT: {
double val;
val = opt->default_val.dbl;
- av_set_double(s, opt->name, val);
+ av_opt_set_double(s, opt->name, val, 0);
}
break;
case FF_OPT_TYPE_RATIONAL: {
AVRational val;
val = av_d2q(opt->default_val.dbl, INT_MAX);
- av_set_q(s, opt->name, val);
+ av_opt_set_q(s, opt->name, val, 0);
}
break;
case FF_OPT_TYPE_STRING:
- av_set_string3(s, opt->name, opt->default_val.str, 1, NULL);
+ av_opt_set(s, opt->name, opt->default_val.str, 0);
break;
case FF_OPT_TYPE_BINARY:
/* Cannot set default for binary */
* set, or a negative value corresponding to an AVERROR code in case
* of error:
* AVERROR(EINVAL) if the key/value pair cannot be parsed,
- * the error code issued by av_set_string3() if the key/value pair
+ * the error code issued by av_opt_set() if the key/value pair
* cannot be set
*/
static int parse_key_value_pair(void *ctx, const char **buf,
av_log(ctx, AV_LOG_DEBUG, "Setting value '%s' for key '%s'\n", val, key);
- ret = av_set_string3(ctx, key, val, 1, NULL);
+ ret = av_opt_set(ctx, key, val, 0);
if (ret == AVERROR_OPTION_NOT_FOUND)
av_log(ctx, AV_LOG_ERROR, "Key '%s' not found.\n", key);
void av_opt_free(void *obj)
{
const AVOption *o = NULL;
- while ((o = av_next_option(obj, o)))
+ while ((o = av_opt_next(obj, o)))
if (o->type == FF_OPT_TYPE_STRING || o->type == FF_OPT_TYPE_BINARY)
av_freep((uint8_t *)obj + o->offset);
}
int ret = 0;
while ((t = av_dict_get(*options, "", t, AV_DICT_IGNORE_SUFFIX))) {
- ret = av_set_string3(obj, t->key, t->value, 1, NULL);
+ ret = av_opt_set(obj, t->key, t->value, 0);
if (ret == AVERROR_OPTION_NOT_FOUND)
av_dict_set(&tmp, t->key, t->value, 0);
else if (ret < 0) {
}
}
- while (o = av_next_option(obj, o)) {
+ while (o = av_opt_next(obj, o)) {
if (!strcmp(o->name, name) && (o->flags & opt_flags) == opt_flags &&
((!unit && o->type != FF_OPT_TYPE_CONST) ||
(unit && o->unit && !strcmp(o->unit, unit)))) {