!(c->pix_fmt != AV_PIX_FMT_NONE || c->got_format_from_params) equals (c->pix_fmt == AV_PIX_FMT_NONE) && !c->got_format_from_params 1. When (c->pix_fmt == AV_PIX_FMT_NONE) is true, got_format_from_params is always false, the flag doesn't contribute to the result. 2. When the first part is false, the second part doesn't matter, the flag doesn't contribute to the result. The result only depends on c->pix_fmt.
Showing the changes to libavfilter (1 of 1 file). Show all
Unified · Split
| @@ -62,7 +62,6 @@ typedef struct BufferSourceContext { · 61 unmodified lines | ||
| 62 | 62 | uint64_t channel_layout; |
| 63 | 63 | char *channel_layout_str; |
| 64 | 64 | |
| 65 | − int got_format_from_params; | |
| 66 | 65 | int eof; |
| 67 | 66 | } BufferSourceContext; |
| 68 | 67 | |
| @@ -104,7 +103,6 @@ int av_buffersrc_parameters_set(AVFilterContext *ctx, AVBufferSrcParameters *par · 35 unmodified lines | ||
| 104 | 103 | switch (ctx->filter->outputs[0].type) { |
| 105 | 104 | case AVMEDIA_TYPE_VIDEO: |
| 106 | 105 | if (param->format != AV_PIX_FMT_NONE) { |
| 107 | − s->got_format_from_params = 1; | |
| 108 | 106 | s->pix_fmt = param->format; |
| 109 | 107 | } |
| 110 | 108 | if (param->width > 0) |
| @@ -124,7 +122,6 @@ int av_buffersrc_parameters_set(AVFilterContext *ctx, AVBufferSrcParameters *par · 13 unmodified lines | ||
| 124 | 122 | break; |
| 125 | 123 | case AVMEDIA_TYPE_AUDIO: |
| 126 | 124 | if (param->format != AV_SAMPLE_FMT_NONE) { |
| 127 | − s->got_format_from_params = 1; | |
| 128 | 125 | s->sample_fmt = param->format; |
| 129 | 126 | } |
| 130 | 127 | if (param->sample_rate > 0) |
| @@ -268,7 +265,7 @@ static av_cold int init_video(AVFilterContext *ctx) · 137 unmodified lines | ||
| 268 | 265 | { |
| 269 | 266 | BufferSourceContext *c = ctx->priv; |
| 270 | 267 | |
| 271 | − if (!(c->pix_fmt != AV_PIX_FMT_NONE || c->got_format_from_params) || !c->w || !c->h || | |
| 268 | + if (c->pix_fmt == AV_PIX_FMT_NONE || !c->w || !c->h || | |
| 272 | 269 | av_q2d(c->time_base) <= 0) { |
| 273 | 270 | av_log(ctx, AV_LOG_ERROR, "Invalid parameters provided.\n"); |
| 274 | 271 | return AVERROR(EINVAL); |
| @@ -321,7 +318,7 @@ static av_cold int init_audio(AVFilterContext *ctx) · 46 unmodified lines | ||
| 321 | 318 | BufferSourceContext *s = ctx->priv; |
| 322 | 319 | int ret = 0; |
| 323 | 320 | |
| 324 | − if (!(s->sample_fmt != AV_SAMPLE_FMT_NONE || s->got_format_from_params)) { | |
| 321 | + if (s->sample_fmt == AV_SAMPLE_FMT_NONE) { | |
| 325 | 322 | av_log(ctx, AV_LOG_ERROR, "Sample format was not set or was invalid\n"); |
| 326 | 323 | return AVERROR(EINVAL); |
| 327 | 324 | } |