... | ... |
@@ -224,7 +224,7 @@ typedef struct OutputStream { |
224 | 224 |
AVFilterGraph *graph; |
225 | 225 |
#endif |
226 | 226 |
|
227 |
- int sws_flags; |
|
227 |
+ int64_t sws_flags; |
|
228 | 228 |
AVDictionary *opts; |
229 | 229 |
int is_past_recording_time; |
230 | 230 |
} OutputStream; |
... | ... |
@@ -421,7 +421,7 @@ static int configure_video_filters(InputStream *ist, OutputStream *ost) |
421 | 421 |
snprintf(args, 255, "%d:%d:flags=0x%X", |
422 | 422 |
codec->width, |
423 | 423 |
codec->height, |
424 |
- ost->sws_flags); |
|
424 |
+ (unsigned)ost->sws_flags); |
|
425 | 425 |
if ((ret = avfilter_graph_create_filter(&filter, avfilter_get_by_name("scale"), |
426 | 426 |
NULL, args, NULL, ost->graph)) < 0) |
427 | 427 |
return ret; |
... | ... |
@@ -430,7 +430,7 @@ static int configure_video_filters(InputStream *ist, OutputStream *ost) |
430 | 430 |
last_filter = filter; |
431 | 431 |
} |
432 | 432 |
|
433 |
- snprintf(args, sizeof(args), "flags=0x%X", ost->sws_flags); |
|
433 |
+ snprintf(args, sizeof(args), "flags=0x%X", (unsigned)ost->sws_flags); |
|
434 | 434 |
ost->graph->scale_sws_opts = av_strdup(args); |
435 | 435 |
|
436 | 436 |
if (ost->avfilter) { |
... | ... |
@@ -3033,7 +3033,7 @@ static OutputStream *new_output_stream(OptionsContext *o, AVFormatContext *oc, e |
3033 | 3033 |
if (oc->oformat->flags & AVFMT_GLOBALHEADER) |
3034 | 3034 |
st->codec->flags |= CODEC_FLAG_GLOBAL_HEADER; |
3035 | 3035 |
|
3036 |
- ost->sws_flags = av_get_int(sws_opts, "sws_flags", NULL); |
|
3036 |
+ av_opt_get_int(sws_opts, "sws_flags", 0, &ost->sws_flags); |
|
3037 | 3037 |
return ost; |
3038 | 3038 |
} |
3039 | 3039 |
|
... | ... |
@@ -3938,7 +3938,7 @@ static int avserver_opt_default(const char *opt, const char *arg, |
3938 | 3938 |
int ret = 0; |
3939 | 3939 |
const AVOption *o = av_opt_find(avctx, opt, NULL, type, 0); |
3940 | 3940 |
if(o) |
3941 |
- ret = av_set_string3(avctx, opt, arg, 1, NULL); |
|
3941 |
+ ret = av_opt_set(avctx, opt, arg, 0); |
|
3942 | 3942 |
return ret; |
3943 | 3943 |
} |
3944 | 3944 |
|
... | ... |
@@ -361,7 +361,7 @@ int opt_default(const char *opt, const char *arg) |
361 | 361 |
av_dict_set(&format_opts, opt, arg, FLAGS); |
362 | 362 |
else if ((o = av_opt_find(&sc, opt, NULL, 0, AV_OPT_SEARCH_CHILDREN | AV_OPT_SEARCH_FAKE_OBJ))) { |
363 | 363 |
// XXX we only support sws_flags, not arbitrary sws options |
364 |
- int ret = av_set_string3(sws_opts, opt, arg, 1, NULL); |
|
364 |
+ int ret = av_opt_set(sws_opts, opt, arg, 0); |
|
365 | 365 |
if (ret < 0) { |
366 | 366 |
av_log(NULL, AV_LOG_ERROR, "Error setting option %s.\n", opt); |
367 | 367 |
return ret; |
... | ... |
@@ -350,8 +350,8 @@ static int open_input(struct variant *var) |
350 | 350 |
snprintf(url, sizeof(url), "crypto:%s", seg->url); |
351 | 351 |
if ((ret = ffurl_alloc(&var->input, url, AVIO_FLAG_READ)) < 0) |
352 | 352 |
return ret; |
353 |
- av_set_string3(var->input->priv_data, "key", key, 0, NULL); |
|
354 |
- av_set_string3(var->input->priv_data, "iv", iv, 0, NULL); |
|
353 |
+ av_opt_set(var->input->priv_data, "key", key, 0); |
|
354 |
+ av_opt_set(var->input->priv_data, "iv", iv, 0); |
|
355 | 355 |
if ((ret = ffurl_connect(var->input)) < 0) { |
356 | 356 |
ffurl_close(var->input); |
357 | 357 |
var->input = NULL; |
... | ... |
@@ -97,9 +97,9 @@ int ff_rtp_get_payload_type(AVFormatContext *fmt, AVCodecContext *codec) |
97 | 97 |
|
98 | 98 |
/* Was the payload type already specified for the RTP muxer? */ |
99 | 99 |
if (ofmt && ofmt->priv_class) { |
100 |
- int payload_type = av_get_int(fmt->priv_data, "payload_type", NULL); |
|
101 |
- if (payload_type >= 0) |
|
102 |
- return payload_type; |
|
100 |
+ int64_t payload_type; |
|
101 |
+ if (av_opt_get_int(fmt->priv_data, "payload_type", 0, &payload_type) >= 0) |
|
102 |
+ return (int)payload_type; |
|
103 | 103 |
} |
104 | 104 |
|
105 | 105 |
/* static payload type */ |
... | ... |
@@ -31,6 +31,8 @@ AVFormatContext *ff_rtp_chain_mux_open(AVFormatContext *s, AVStream *st, |
31 | 31 |
AVFormatContext *rtpctx; |
32 | 32 |
int ret; |
33 | 33 |
AVOutputFormat *rtp_format = av_guess_format("rtp", NULL, NULL); |
34 |
+ uint8_t *rtpflags; |
|
35 |
+ AVDictionary *opts = NULL; |
|
34 | 36 |
|
35 | 37 |
if (!rtp_format) |
36 | 38 |
return NULL; |
... | ... |
@@ -50,12 +52,8 @@ AVFormatContext *ff_rtp_chain_mux_open(AVFormatContext *s, AVStream *st, |
50 | 50 |
/* Copy other stream parameters. */ |
51 | 51 |
rtpctx->streams[0]->sample_aspect_ratio = st->sample_aspect_ratio; |
52 | 52 |
|
53 |
- av_set_parameters(rtpctx, NULL); |
|
54 |
- /* Copy the rtpflags values straight through */ |
|
55 |
- if (s->oformat->priv_class && |
|
56 |
- av_find_opt(s->priv_data, "rtpflags", NULL, 0, 0)) |
|
57 |
- av_set_int(rtpctx->priv_data, "rtpflags", |
|
58 |
- av_get_int(s->priv_data, "rtpflags", NULL)); |
|
53 |
+ if (av_opt_get(s, "rtpflags", AV_OPT_SEARCH_CHILDREN, &rtpflags) >= 0) |
|
54 |
+ av_dict_set(&opts, "rtpflags", rtpflags, AV_DICT_DONT_STRDUP_VAL); |
|
59 | 55 |
|
60 | 56 |
/* Set the synchronized start time. */ |
61 | 57 |
rtpctx->start_time_realtime = s->start_time_realtime; |
... | ... |
@@ -66,7 +64,8 @@ AVFormatContext *ff_rtp_chain_mux_open(AVFormatContext *s, AVStream *st, |
66 | 66 |
ffio_fdopen(&rtpctx->pb, handle); |
67 | 67 |
} else |
68 | 68 |
ffio_open_dyn_packet_buf(&rtpctx->pb, packet_size); |
69 |
- ret = avformat_write_header(rtpctx, NULL); |
|
69 |
+ ret = avformat_write_header(rtpctx, &opts); |
|
70 |
+ av_dict_free(&opts); |
|
70 | 71 |
|
71 | 72 |
if (ret) { |
72 | 73 |
if (handle) { |
... | ... |
@@ -500,12 +500,14 @@ int av_opt_get_q(void *obj, const char *name, int search_flags, AVRational *out_ |
500 | 500 |
|
501 | 501 |
int av_opt_flag_is_set(void *obj, const char *field_name, const char *flag_name) |
502 | 502 |
{ |
503 |
- const AVOption *field = av_find_opt(obj, field_name, NULL, 0, 0); |
|
504 |
- const AVOption *flag = av_find_opt(obj, flag_name, NULL, 0, 0); |
|
503 |
+ const AVOption *field = av_opt_find(obj, field_name, NULL, 0, 0); |
|
504 |
+ const AVOption *flag = av_opt_find(obj, flag_name, NULL, 0, 0); |
|
505 |
+ int64_t res; |
|
505 | 506 |
|
506 |
- if (!field || !flag || flag->type != FF_OPT_TYPE_CONST) |
|
507 |
+ if (!field || !flag || flag->type != FF_OPT_TYPE_CONST || |
|
508 |
+ av_opt_get_int(obj, field_name, 0, &res) < 0) |
|
507 | 509 |
return 0; |
508 |
- return av_get_int(obj, field_name, NULL) & (int) flag->default_val.dbl; |
|
510 |
+ return res & (int) flag->default_val.dbl; |
|
509 | 511 |
} |
510 | 512 |
|
511 | 513 |
static void opt_list(void *obj, void *av_log_obj, const char *unit, |
... | ... |
@@ -513,7 +515,7 @@ static void opt_list(void *obj, void *av_log_obj, const char *unit, |
513 | 513 |
{ |
514 | 514 |
const AVOption *opt=NULL; |
515 | 515 |
|
516 |
- while ((opt= av_next_option(obj, opt))) { |
|
516 |
+ while ((opt = av_opt_next(obj, opt))) { |
|
517 | 517 |
if (!(opt->flags & req_flags) || (opt->flags & rej_flags)) |
518 | 518 |
continue; |
519 | 519 |
|
... | ... |
@@ -599,7 +601,7 @@ void av_opt_set_defaults2(void *s, int mask, int flags) |
599 | 599 |
{ |
600 | 600 |
#endif |
601 | 601 |
const AVOption *opt = NULL; |
602 |
- while ((opt = av_next_option(s, opt)) != NULL) { |
|
602 |
+ while ((opt = av_opt_next(s, opt)) != NULL) { |
|
603 | 603 |
#if FF_API_OLD_AVOPTIONS |
604 | 604 |
if ((opt->flags & mask) != flags) |
605 | 605 |
continue; |
... | ... |
@@ -612,29 +614,29 @@ void av_opt_set_defaults2(void *s, int mask, int flags) |
612 | 612 |
case FF_OPT_TYPE_INT: { |
613 | 613 |
int val; |
614 | 614 |
val = opt->default_val.dbl; |
615 |
- av_set_int(s, opt->name, val); |
|
615 |
+ av_opt_set_int(s, opt->name, val, 0); |
|
616 | 616 |
} |
617 | 617 |
break; |
618 | 618 |
case FF_OPT_TYPE_INT64: |
619 | 619 |
if ((double)(opt->default_val.dbl+0.6) == opt->default_val.dbl) |
620 | 620 |
av_log(s, AV_LOG_DEBUG, "loss of precision in default of %s\n", opt->name); |
621 |
- av_set_int(s, opt->name, opt->default_val.dbl); |
|
621 |
+ av_opt_set_int(s, opt->name, opt->default_val.dbl, 0); |
|
622 | 622 |
break; |
623 | 623 |
case FF_OPT_TYPE_DOUBLE: |
624 | 624 |
case FF_OPT_TYPE_FLOAT: { |
625 | 625 |
double val; |
626 | 626 |
val = opt->default_val.dbl; |
627 |
- av_set_double(s, opt->name, val); |
|
627 |
+ av_opt_set_double(s, opt->name, val, 0); |
|
628 | 628 |
} |
629 | 629 |
break; |
630 | 630 |
case FF_OPT_TYPE_RATIONAL: { |
631 | 631 |
AVRational val; |
632 | 632 |
val = av_d2q(opt->default_val.dbl, INT_MAX); |
633 |
- av_set_q(s, opt->name, val); |
|
633 |
+ av_opt_set_q(s, opt->name, val, 0); |
|
634 | 634 |
} |
635 | 635 |
break; |
636 | 636 |
case FF_OPT_TYPE_STRING: |
637 |
- av_set_string3(s, opt->name, opt->default_val.str, 1, NULL); |
|
637 |
+ av_opt_set(s, opt->name, opt->default_val.str, 0); |
|
638 | 638 |
break; |
639 | 639 |
case FF_OPT_TYPE_BINARY: |
640 | 640 |
/* Cannot set default for binary */ |
... | ... |
@@ -659,7 +661,7 @@ void av_opt_set_defaults2(void *s, int mask, int flags) |
659 | 659 |
* set, or a negative value corresponding to an AVERROR code in case |
660 | 660 |
* of error: |
661 | 661 |
* AVERROR(EINVAL) if the key/value pair cannot be parsed, |
662 |
- * the error code issued by av_set_string3() if the key/value pair |
|
662 |
+ * the error code issued by av_opt_set() if the key/value pair |
|
663 | 663 |
* cannot be set |
664 | 664 |
*/ |
665 | 665 |
static int parse_key_value_pair(void *ctx, const char **buf, |
... | ... |
@@ -680,7 +682,7 @@ static int parse_key_value_pair(void *ctx, const char **buf, |
680 | 680 |
|
681 | 681 |
av_log(ctx, AV_LOG_DEBUG, "Setting value '%s' for key '%s'\n", val, key); |
682 | 682 |
|
683 |
- ret = av_set_string3(ctx, key, val, 1, NULL); |
|
683 |
+ ret = av_opt_set(ctx, key, val, 0); |
|
684 | 684 |
if (ret == AVERROR_OPTION_NOT_FOUND) |
685 | 685 |
av_log(ctx, AV_LOG_ERROR, "Key '%s' not found.\n", key); |
686 | 686 |
|
... | ... |
@@ -709,7 +711,7 @@ int av_set_options_string(void *ctx, const char *opts, |
709 | 709 |
void av_opt_free(void *obj) |
710 | 710 |
{ |
711 | 711 |
const AVOption *o = NULL; |
712 |
- while ((o = av_next_option(obj, o))) |
|
712 |
+ while ((o = av_opt_next(obj, o))) |
|
713 | 713 |
if (o->type == FF_OPT_TYPE_STRING || o->type == FF_OPT_TYPE_BINARY) |
714 | 714 |
av_freep((uint8_t *)obj + o->offset); |
715 | 715 |
} |
... | ... |
@@ -721,7 +723,7 @@ int av_opt_set_dict(void *obj, AVDictionary **options) |
721 | 721 |
int ret = 0; |
722 | 722 |
|
723 | 723 |
while ((t = av_dict_get(*options, "", t, AV_DICT_IGNORE_SUFFIX))) { |
724 |
- ret = av_set_string3(obj, t->key, t->value, 1, NULL); |
|
724 |
+ ret = av_opt_set(obj, t->key, t->value, 0); |
|
725 | 725 |
if (ret == AVERROR_OPTION_NOT_FOUND) |
726 | 726 |
av_dict_set(&tmp, t->key, t->value, 0); |
727 | 727 |
else if (ret < 0) { |
... | ... |
@@ -761,7 +763,7 @@ const AVOption *av_opt_find2(void *obj, const char *name, const char *unit, |
761 | 761 |
} |
762 | 762 |
} |
763 | 763 |
|
764 |
- while (o = av_next_option(obj, o)) { |
|
764 |
+ while (o = av_opt_next(obj, o)) { |
|
765 | 765 |
if (!strcmp(o->name, name) && (o->flags & opt_flags) == opt_flags && |
766 | 766 |
((!unit && o->type != FF_OPT_TYPE_CONST) || |
767 | 767 |
(unit && o->unit && !strcmp(o->unit, unit)))) { |