mirror of
https://git.videolan.org/git/ffmpeg.git
synced 2024-09-11 01:47:55 +02:00
libavfilter/decimate: Add pts of first frame to all frames.
Fixes ticket #3019 Reviewed-by: Clément Bœsch
This commit is contained in:
parent
fa6fa2162b
commit
e4b0a77021
@ -43,6 +43,7 @@ typedef struct {
|
|||||||
AVFrame **clean_src; ///< frame queue for the clean source
|
AVFrame **clean_src; ///< frame queue for the clean source
|
||||||
int got_frame[2]; ///< frame request flag for each input stream
|
int got_frame[2]; ///< frame request flag for each input stream
|
||||||
double ts_unit; ///< timestamp units for the output frames
|
double ts_unit; ///< timestamp units for the output frames
|
||||||
|
int64_t start_pts; ///< base for output timestamps
|
||||||
uint32_t eof; ///< bitmask for end of stream
|
uint32_t eof; ///< bitmask for end of stream
|
||||||
int hsub, vsub; ///< chroma subsampling values
|
int hsub, vsub; ///< chroma subsampling values
|
||||||
int depth;
|
int depth;
|
||||||
@ -210,11 +211,14 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
|
|||||||
av_frame_free(&dm->queue[i].frame);
|
av_frame_free(&dm->queue[i].frame);
|
||||||
} else {
|
} else {
|
||||||
AVFrame *frame = dm->queue[i].frame;
|
AVFrame *frame = dm->queue[i].frame;
|
||||||
|
if (frame->pts != AV_NOPTS_VALUE && dm->start_pts == AV_NOPTS_VALUE)
|
||||||
|
dm->start_pts = frame->pts;
|
||||||
if (dm->ppsrc) {
|
if (dm->ppsrc) {
|
||||||
av_frame_free(&frame);
|
av_frame_free(&frame);
|
||||||
frame = dm->clean_src[i];
|
frame = dm->clean_src[i];
|
||||||
}
|
}
|
||||||
frame->pts = outlink->frame_count * dm->ts_unit;
|
frame->pts = outlink->frame_count * dm->ts_unit +
|
||||||
|
(dm->start_pts == AV_NOPTS_VALUE ? 0 : dm->start_pts);
|
||||||
ret = ff_filter_frame(outlink, frame);
|
ret = ff_filter_frame(outlink, frame);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
break;
|
break;
|
||||||
@ -259,7 +263,7 @@ static int config_input(AVFilterLink *inlink)
|
|||||||
|
|
||||||
static av_cold int decimate_init(AVFilterContext *ctx)
|
static av_cold int decimate_init(AVFilterContext *ctx)
|
||||||
{
|
{
|
||||||
const DecimateContext *dm = ctx->priv;
|
DecimateContext *dm = ctx->priv;
|
||||||
AVFilterPad pad = {
|
AVFilterPad pad = {
|
||||||
.name = av_strdup("main"),
|
.name = av_strdup("main"),
|
||||||
.type = AVMEDIA_TYPE_VIDEO,
|
.type = AVMEDIA_TYPE_VIDEO,
|
||||||
@ -285,6 +289,8 @@ static av_cold int decimate_init(AVFilterContext *ctx)
|
|||||||
return AVERROR(EINVAL);
|
return AVERROR(EINVAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dm->start_pts = AV_NOPTS_VALUE;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user