History

Allocate per codec options, now that options are freed between inputs and outputs.

Baptiste Coudurier committed 15 years ago

Commit 580fa761 parent 3732c482 files · +15 −8Browse files

Unified · Split

2 files
  1. cmdutils.c +1 −1
  2. libavcodec/libx264.c +14 −7
cmdutils.c+1−1
@@ -435,7 +435,7 @@ void set_context_opts(void *ctx, void *opts_ctx, int flags, AVCodec *codec) · 434 unmodified lines
435435 const char *str;
436436 if (priv_ctx) {
437437 if (av_find_opt(priv_ctx, opt_names[i], NULL, flags, flags)) {
438− if (av_set_string3(priv_ctx, opt_names[i], opt_values[i], 0, NULL) < 0) {
438+ if (av_set_string3(priv_ctx, opt_names[i], opt_values[i], 1, NULL) < 0) {
439439 fprintf(stderr, "Invalid value '%s' for option '%s'\n",
440440 opt_names[i], opt_values[i]);
441441 exit(1);
libavcodec/libx264.c+14−7
@@ -35,13 +35,13 @@ typedef struct X264Context { · 34 unmodified lines
3535 uint8_t *sei;
3636 int sei_size;
3737 AVFrame out_pic;
38− const char *preset;
39− const char *tune;
40− const char *profile;
41− const char *level;
38+ char *preset;
39+ char *tune;
40+ char *profile;
41+ char *level;
4242 int fastfirstpass;
43− const char *stats;
44− const char *weightp;
43+ char *stats;
44+ char *weightp;
4545 } X264Context;
4646
4747 static void X264_log(void *p, int level, const char *fmt, va_list args)
@@ -163,6 +163,13 @@ static av_cold int X264_close(AVCodecContext *avctx) · 115 unmodified lines
163163 if (x4->enc)
164164 x264_encoder_close(x4->enc);
165165
166+ av_free(x4->preset);
167+ av_free(x4->tune);
168+ av_free(x4->profile);
169+ av_free(x4->level);
170+ av_free(x4->stats);
171+ av_free(x4->weightp);
172+
166173 return 0;
167174 }
168175
@@ -185,7 +192,7 @@ static void check_default_settings(AVCodecContext *avctx) · 16 unmodified lines
185192 score += x4->params.analyse.inter == 0 && x4->params.analyse.i_subpel_refine == 8;
186193 if (score >= 5) {
187194 av_log(avctx, AV_LOG_ERROR, "Default settings detected, using medium profile\n");
188− x4->preset = "medium";
195+ x4->preset = av_strdup("medium");
189196 if (avctx->bit_rate == 200*100)
190197 avctx->crf = 23;
191198 }

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t