Also produce output video timestamps that are consistent with 10 frames per second.
Showing the changes to libavfilter (1 of 1 file). Show all
Unified · Split
| @@ -295,7 +295,6 @@ static int config_video_output(AVFilterLink *outlink) · 294 unmodified lines | |||
| 295 | int i, x, y; | 295 | int i, x, y; |
| 296 | uint8_t *p; | 296 | uint8_t *p; |
| 297 | AVFilterContext *ctx = outlink->src; | 297 | AVFilterContext *ctx = outlink->src; |
| 298 | AVFilterLink *inlink = ctx->inputs[0]; | ||
| 299 | EBUR128Context *ebur128 = ctx->priv; | 298 | EBUR128Context *ebur128 = ctx->priv; |
| 300 | AVFrame *outpicref; | 299 | AVFrame *outpicref; |
| 301 | 300 | ||
| @@ -308,8 +307,8 @@ static int config_video_output(AVFilterLink *outlink) · 6 unmodified lines | |||
| 308 | outlink->w = ebur128->w; | 307 | outlink->w = ebur128->w; |
| 309 | outlink->h = ebur128->h; | 308 | outlink->h = ebur128->h; |
| 310 | outlink->sample_aspect_ratio = (AVRational){1,1}; | 309 | outlink->sample_aspect_ratio = (AVRational){1,1}; |
| 311 | outlink->time_base = inlink->time_base; | ||
| 312 | outlink->frame_rate = av_make_q(10, 1); | 310 | outlink->frame_rate = av_make_q(10, 1); |
| 311 | outlink->time_base = av_inv_q(outlink->frame_rate); | ||
| 313 | 312 | ||
| 314 | #define PAD 8 | 313 | #define PAD 8 |
| 315 | 314 | ||
| @@ -430,7 +429,7 @@ static int config_audio_input(AVFilterLink *inlink) · 114 unmodified lines | |||
| 430 | * can be more complex to integrate in the one-sample loop of | 429 | * can be more complex to integrate in the one-sample loop of |
| 431 | * filter_frame()). */ | 430 | * filter_frame()). */ |
| 432 | if (ebur128->metadata || (ebur128->peak_mode & PEAK_MODE_TRUE_PEAKS)) | 431 | if (ebur128->metadata || (ebur128->peak_mode & PEAK_MODE_TRUE_PEAKS)) |
| 433 | ebur128->nb_samples = inlink->sample_rate / 10; | 432 | ebur128->nb_samples = FFMAX(inlink->sample_rate / 10, 1); |
| 434 | return 0; | 433 | return 0; |
| 435 | } | 434 | } |
| 436 | 435 | ||
| @@ -735,7 +734,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *insamples) · 298 unmodified lines | |||
| 735 | AVFilterLink *outlink = ctx->outputs[0]; | 734 | AVFilterLink *outlink = ctx->outputs[0]; |
| 736 | const int64_t pts = insamples->pts + | 735 | const int64_t pts = insamples->pts + |
| 737 | av_rescale_q(idx_insample, (AVRational){ 1, inlink->sample_rate }, | 736 | av_rescale_q(idx_insample, (AVRational){ 1, inlink->sample_rate }, |
| 738 | outlink->time_base); | 737 | ctx->outputs[ebur128->do_video]->time_base); |
| 739 | 738 | ||
| 740 | ebur128->sample_count = 0; | 739 | ebur128->sample_count = 0; |
| 741 | 740 | ||
| @@ -887,7 +886,8 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *insamples) · 145 unmodified lines | |||
| 887 | } | 886 | } |
| 888 | 887 | ||
| 889 | /* set pts and push frame */ | 888 | /* set pts and push frame */ |
| 890 | pic->pts = pts; | 889 | pic->pts = av_rescale_q(pts, inlink->time_base, outlink->time_base); |
| 890 | pic->duration = 1; | ||
| 891 | clone = av_frame_clone(pic); | 891 | clone = av_frame_clone(pic); |
| 892 | if (!clone) | 892 | if (!clone) |
| 893 | return AVERROR(ENOMEM); | 893 | return AVERROR(ENOMEM); |