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

Function dynamic_set_parameter

doc/examples/qsv_transcode.c:82–116  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

80}
81
82static int dynamic_set_parameter(AVCodecContext *avctx)
83{
84 AVDictionary *opts = NULL;
85 int ret = 0;
86 static int frame_number = 0;
87 frame_number++;
88 if (current_setting_number < setting_number &&
89 frame_number == dynamic_setting[current_setting_number].frame_number) {
90 AVDictionaryEntry *e = NULL;
91 ret = str_to_dict(dynamic_setting[current_setting_number++].optstr, &opts);
92 if (ret < 0) {
93 fprintf(stderr, "The dynamic parameter is wrong\n");
94 goto fail;
95 }
96 /* Set common option. The dictionary will be freed and replaced
97 * by a new one containing all options not found in common option list.
98 * Then this new dictionary is used to set private option. */
99 if ((ret = av_opt_set_dict(avctx, &opts)) < 0)
100 goto fail;
101 /* Set codec specific option */
102 if ((ret = av_opt_set_dict(avctx->priv_data, &opts)) < 0)
103 goto fail;
104 /* There is no "framerate" option in common option list. Use "-r" to set
105 * framerate, which is compatible with ffmpeg commandline. The video is
106 * assumed to be average frame rate, so set time_base to 1/framerate. */
107 e = av_dict_get(opts, "r", NULL, 0);
108 if (e) {
109 avctx->framerate = av_d2q(atof(e->value), INT_MAX);
110 encoder_ctx->time_base = av_inv_q(encoder_ctx->framerate);
111 }
112 }
113fail:
114 av_dict_free(&opts);
115 return ret;
116}
117
118static int get_format(AVCodecContext *avctx, const enum AVPixelFormat *pix_fmts)
119{

Callers 1

encode_writeFunction · 0.85

Calls 5

str_to_dictFunction · 0.85
av_opt_set_dictFunction · 0.85
av_dict_getFunction · 0.85
av_d2qFunction · 0.85
av_dict_freeFunction · 0.85

Tested by

no test coverage detected