You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-10 06:10:52 +02:00
fftools/ffmpeg: move OutputStream.last_filter_pts to OutputFilter
This value is associated with the filtergraph output rather than the output stream, so this is a more appropriate place for it.
This commit is contained in:
@@ -697,7 +697,7 @@ static int reap_filters(int flush)
|
|||||||
|
|
||||||
if (filtered_frame->pts != AV_NOPTS_VALUE) {
|
if (filtered_frame->pts != AV_NOPTS_VALUE) {
|
||||||
AVRational tb = av_buffersink_get_time_base(filter);
|
AVRational tb = av_buffersink_get_time_base(filter);
|
||||||
ost->last_filter_pts = av_rescale_q(filtered_frame->pts, tb,
|
ost->filter->last_pts = av_rescale_q(filtered_frame->pts, tb,
|
||||||
AV_TIME_BASE_Q);
|
AV_TIME_BASE_Q);
|
||||||
filtered_frame->time_base = tb;
|
filtered_frame->time_base = tb;
|
||||||
|
|
||||||
@@ -2391,8 +2391,8 @@ static OutputStream *choose_output(void)
|
|||||||
for (OutputStream *ost = ost_iter(NULL); ost; ost = ost_iter(ost)) {
|
for (OutputStream *ost = ost_iter(NULL); ost; ost = ost_iter(ost)) {
|
||||||
int64_t opts;
|
int64_t opts;
|
||||||
|
|
||||||
if (ost->filter && ost->last_filter_pts != AV_NOPTS_VALUE) {
|
if (ost->filter && ost->filter->last_pts != AV_NOPTS_VALUE) {
|
||||||
opts = ost->last_filter_pts;
|
opts = ost->filter->last_pts;
|
||||||
} else {
|
} else {
|
||||||
opts = ost->last_mux_dts == AV_NOPTS_VALUE ?
|
opts = ost->last_mux_dts == AV_NOPTS_VALUE ?
|
||||||
INT64_MIN : ost->last_mux_dts;
|
INT64_MIN : ost->last_mux_dts;
|
||||||
|
@@ -314,6 +314,9 @@ typedef struct OutputFilter {
|
|||||||
const int *formats;
|
const int *formats;
|
||||||
const AVChannelLayout *ch_layouts;
|
const AVChannelLayout *ch_layouts;
|
||||||
const int *sample_rates;
|
const int *sample_rates;
|
||||||
|
|
||||||
|
/* pts of the last frame received from this filter, in AV_TIME_BASE_Q */
|
||||||
|
int64_t last_pts;
|
||||||
} OutputFilter;
|
} OutputFilter;
|
||||||
|
|
||||||
typedef struct FilterGraph {
|
typedef struct FilterGraph {
|
||||||
@@ -573,8 +576,6 @@ typedef struct OutputStream {
|
|||||||
AVStream *st; /* stream in the output file */
|
AVStream *st; /* stream in the output file */
|
||||||
/* dts of the last packet sent to the muxing queue, in AV_TIME_BASE_Q */
|
/* dts of the last packet sent to the muxing queue, in AV_TIME_BASE_Q */
|
||||||
int64_t last_mux_dts;
|
int64_t last_mux_dts;
|
||||||
/* pts of the last frame received from the filters, in AV_TIME_BASE_Q */
|
|
||||||
int64_t last_filter_pts;
|
|
||||||
|
|
||||||
// timestamp from which the streamcopied streams should start,
|
// timestamp from which the streamcopied streams should start,
|
||||||
// in AV_TIME_BASE_Q;
|
// in AV_TIME_BASE_Q;
|
||||||
|
@@ -176,6 +176,18 @@ static void choose_channel_layouts(OutputFilter *ofilter, AVBPrint *bprint)
|
|||||||
av_bprint_chars(bprint, ':', 1);
|
av_bprint_chars(bprint, ':', 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static OutputFilter *ofilter_alloc(FilterGraph *fg)
|
||||||
|
{
|
||||||
|
OutputFilter *ofilter;
|
||||||
|
|
||||||
|
ofilter = ALLOC_ARRAY_ELEM(fg->outputs, fg->nb_outputs);
|
||||||
|
ofilter->graph = fg;
|
||||||
|
ofilter->format = -1;
|
||||||
|
ofilter->last_pts = AV_NOPTS_VALUE;
|
||||||
|
|
||||||
|
return ofilter;
|
||||||
|
}
|
||||||
|
|
||||||
int init_simple_filtergraph(InputStream *ist, OutputStream *ost)
|
int init_simple_filtergraph(InputStream *ist, OutputStream *ost)
|
||||||
{
|
{
|
||||||
FilterGraph *fg = av_mallocz(sizeof(*fg));
|
FilterGraph *fg = av_mallocz(sizeof(*fg));
|
||||||
@@ -186,10 +198,8 @@ int init_simple_filtergraph(InputStream *ist, OutputStream *ost)
|
|||||||
report_and_exit(AVERROR(ENOMEM));
|
report_and_exit(AVERROR(ENOMEM));
|
||||||
fg->index = nb_filtergraphs;
|
fg->index = nb_filtergraphs;
|
||||||
|
|
||||||
ofilter = ALLOC_ARRAY_ELEM(fg->outputs, fg->nb_outputs);
|
ofilter = ofilter_alloc(fg);
|
||||||
ofilter->ost = ost;
|
ofilter->ost = ost;
|
||||||
ofilter->graph = fg;
|
|
||||||
ofilter->format = -1;
|
|
||||||
|
|
||||||
ost->filter = ofilter;
|
ost->filter = ofilter;
|
||||||
|
|
||||||
@@ -502,9 +512,8 @@ int init_complex_filtergraph(FilterGraph *fg)
|
|||||||
init_input_filter(fg, cur);
|
init_input_filter(fg, cur);
|
||||||
|
|
||||||
for (cur = outputs; cur;) {
|
for (cur = outputs; cur;) {
|
||||||
OutputFilter *const ofilter = ALLOC_ARRAY_ELEM(fg->outputs, fg->nb_outputs);
|
OutputFilter *const ofilter = ofilter_alloc(fg);
|
||||||
|
|
||||||
ofilter->graph = fg;
|
|
||||||
ofilter->out_tmp = cur;
|
ofilter->out_tmp = cur;
|
||||||
ofilter->type = avfilter_pad_get_type(cur->filter_ctx->output_pads,
|
ofilter->type = avfilter_pad_get_type(cur->filter_ctx->output_pads,
|
||||||
cur->pad_idx);
|
cur->pad_idx);
|
||||||
|
@@ -649,7 +649,6 @@ static OutputStream *new_output_stream(Muxer *mux, const OptionsContext *o,
|
|||||||
ost->ist->st->discard = ost->ist->user_set_discard;
|
ost->ist->st->discard = ost->ist->user_set_discard;
|
||||||
}
|
}
|
||||||
ost->last_mux_dts = AV_NOPTS_VALUE;
|
ost->last_mux_dts = AV_NOPTS_VALUE;
|
||||||
ost->last_filter_pts = AV_NOPTS_VALUE;
|
|
||||||
|
|
||||||
MATCH_PER_STREAM_OPT(copy_initial_nonkeyframes, i,
|
MATCH_PER_STREAM_OPT(copy_initial_nonkeyframes, i,
|
||||||
ost->copy_initial_nonkeyframes, oc, st);
|
ost->copy_initial_nonkeyframes, oc, st);
|
||||||
|
Reference in New Issue
Block a user