| @@ -36,6 +36,12 @@ typedef struct ThreadData { · 35 unmodified lines |
| 36 | int offset_x; | 36 | int offset_x; |
| 37 | } ThreadData; | 37 | } ThreadData; |
| 38 | | 38 | |
| | 39 | enum FitMode { |
| | 40 | FM_NONE, |
| | 41 | FM_SIZE, |
| | 42 | NB_FITMODES |
| | 43 | }; |
| | 44 | |
| 39 | enum FilterType { | 45 | enum FilterType { |
| 40 | LOWPASS, | 46 | LOWPASS, |
| 41 | FLAT, | 47 | FLAT, |
| @@ -113,6 +119,7 @@ typedef struct WaveformContext { · 71 unmodified lines |
| 113 | int rgb; | 119 | int rgb; |
| 114 | float ftint[2]; | 120 | float ftint[2]; |
| 115 | int tint[2]; | 121 | int tint[2]; |
| | 122 | int fitmode; |
| 116 | | 123 | |
| 117 | int (*waveform_slice)(AVFilterContext *ctx, void *arg, | 124 | int (*waveform_slice)(AVFilterContext *ctx, void *arg, |
| 118 | int jobnr, int nb_jobs); | 125 | int jobnr, int nb_jobs); |
| @@ -184,6 +191,10 @@ static const AVOption waveform_options[] = { · 65 unmodified lines |
| 184 | { "t0", "set 1st tint", OFFSET(ftint[0]), AV_OPT_TYPE_FLOAT, {.dbl=0}, -1, 1, FLAGS}, | 191 | { "t0", "set 1st tint", OFFSET(ftint[0]), AV_OPT_TYPE_FLOAT, {.dbl=0}, -1, 1, FLAGS}, |
| 185 | { "tint1", "set 2nd tint", OFFSET(ftint[1]), AV_OPT_TYPE_FLOAT, {.dbl=0}, -1, 1, FLAGS}, | 192 | { "tint1", "set 2nd tint", OFFSET(ftint[1]), AV_OPT_TYPE_FLOAT, {.dbl=0}, -1, 1, FLAGS}, |
| 186 | { "t1", "set 2nd tint", OFFSET(ftint[1]), AV_OPT_TYPE_FLOAT, {.dbl=0}, -1, 1, FLAGS}, | 193 | { "t1", "set 2nd tint", OFFSET(ftint[1]), AV_OPT_TYPE_FLOAT, {.dbl=0}, -1, 1, FLAGS}, |
| | 194 | { "fitmode", "set fit mode", OFFSET(fitmode), AV_OPT_TYPE_INT, {.i64=0}, 0, NB_FITMODES-1, FLAGS, "fitmode" }, |
| | 195 | { "fm", "set fit mode", OFFSET(fitmode), AV_OPT_TYPE_INT, {.i64=0}, 0, NB_FITMODES-1, FLAGS, "fitmode" }, |
| | 196 | { "none", NULL, 0, AV_OPT_TYPE_CONST, {.i64=FM_NONE}, 0, 0, FLAGS, "fitmode" }, |
| | 197 | { "size", NULL, 0, AV_OPT_TYPE_CONST, {.i64=FM_SIZE}, 0, 0, FLAGS, "fitmode" }, |
| 187 | { NULL } | 198 | { NULL } |
| 188 | }; | 199 | }; |
| 189 | | 200 | |
| @@ -3357,7 +3368,20 @@ static int config_output(AVFilterLink *outlink) · 3167 unmodified lines |
| 3357 | } | 3368 | } |
| 3358 | } | 3369 | } |
| 3359 | | 3370 | |
| 3360 | outlink->sample_aspect_ratio = (AVRational){1,1}; | 3371 | switch (s->fitmode) { |
| | 3372 | case FM_NONE: |
| | 3373 | outlink->sample_aspect_ratio = (AVRational){ 1, 1 }; |
| | 3374 | break; |
| | 3375 | case FM_SIZE: |
| | 3376 | if (s->mode) |
| | 3377 | outlink->sample_aspect_ratio = (AVRational){ s->size * comp, inlink->h }; |
| | 3378 | else |
| | 3379 | outlink->sample_aspect_ratio = (AVRational){ inlink->w, s->size * comp }; |
| | 3380 | break; |
| | 3381 | } |
| | 3382 | |
| | 3383 | av_reduce(&outlink->sample_aspect_ratio.num, &outlink->sample_aspect_ratio.den, |
| | 3384 | outlink->sample_aspect_ratio.num, outlink->sample_aspect_ratio.den, INT_MAX); |
| 3361 | | 3385 | |
| 3362 | return 0; | 3386 | return 0; |
| 3363 | } | 3387 | } |
| @@ -3461,6 +3485,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) · 97 unmodified lines |
| 3461 | s->graticulef(s, out); | 3485 | s->graticulef(s, out); |
| 3462 | | 3486 | |
| 3463 | av_frame_free(&in); | 3487 | av_frame_free(&in); |
| | 3488 | out->sample_aspect_ratio = outlink->sample_aspect_ratio; |
| 3464 | return ff_filter_frame(outlink, out); | 3489 | return ff_filter_frame(outlink, out); |
| 3465 | } | 3490 | } |
| 3466 | | 3491 | |