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
435 const char *str;435 const char *str;
436 if (priv_ctx) {436 if (priv_ctx) {
437 if (av_find_opt(priv_ctx, opt_names[i], NULL, flags, flags)) {437 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) {
439 fprintf(stderr, "Invalid value '%s' for option '%s'\n",439 fprintf(stderr, "Invalid value '%s' for option '%s'\n",
440 opt_names[i], opt_values[i]);440 opt_names[i], opt_values[i]);
441 exit(1);441 exit(1);
libavcodec/libx264.c+14−7
@@ -35,13 +35,13 @@ typedef struct X264Context { · 34 unmodified lines
35 uint8_t *sei;35 uint8_t *sei;
36 int sei_size;36 int sei_size;
37 AVFrame out_pic;37 AVFrame out_pic;
38 const char *preset;38 char *preset;
39 const char *tune;39 char *tune;
40 const char *profile;40 char *profile;
41 const char *level;41 char *level;
42 int fastfirstpass;42 int fastfirstpass;
43 const char *stats;43 char *stats;
44 const char *weightp;44 char *weightp;
45} X264Context;45} X264Context;
46 46
47static void X264_log(void *p, int level, const char *fmt, va_list args)47static 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
163 if (x4->enc)163 if (x4->enc)
164 x264_encoder_close(x4->enc);164 x264_encoder_close(x4->enc);
165 165
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
166 return 0;173 return 0;
167}174}
168 175
@@ -185,7 +192,7 @@ static void check_default_settings(AVCodecContext *avctx) · 16 unmodified lines
185 score += x4->params.analyse.inter == 0 && x4->params.analyse.i_subpel_refine == 8;192 score += x4->params.analyse.inter == 0 && x4->params.analyse.i_subpel_refine == 8;
186 if (score >= 5) {193 if (score >= 5) {
187 av_log(avctx, AV_LOG_ERROR, "Default settings detected, using medium profile\n");194 av_log(avctx, AV_LOG_ERROR, "Default settings detected, using medium profile\n");
188 x4->preset = "medium";195 x4->preset = av_strdup("medium");
189 if (avctx->bit_rate == 200*100)196 if (avctx->bit_rate == 200*100)
190 avctx->crf = 23;197 avctx->crf = 23;
191 }198 }

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