Quoting Luca Barbato (2016-01-02 21:48:18)
> On 02/01/16 18:37, Anton Khirnov wrote:
> > Quoting Luca Barbato (2016-01-02 14:43:14)
> >> Make filter_complex-only input produce a report.
> >> ---
> >> avconv.c | 109
> >> +++++++++++++++++++++++++++++++--------------------------------
> >> 1 file changed, 54 insertions(+), 55 deletions(-)
> >>
> >> diff --git a/avconv.c b/avconv.c
> >> index 6b37d6e..edc5e0e 100644
> >> --- a/avconv.c
> >> +++ b/avconv.c
> >> @@ -653,52 +653,6 @@ static void finish_output_stream(OutputStream *ost)
> >> }
> >> }
> >>
> >> -/*
> >> - * Read as many frames from possible from lavfi and encode them.
> >> - *
> >> - * Always read from the active stream with the lowest timestamp. If no
> >> frames
> >> - * are available for it then return EAGAIN and wait for more input. This
> >> way we
> >> - * can use lavfi sources that generate unlimited amount of frames without
> >> memory
> >> - * usage exploding.
> >> - */
> >> -static int poll_filters(void)
> >> -{
> >> - int i, ret = 0;
> >> -
> >> - while (ret >= 0 && !received_sigterm) {
> >> - OutputStream *ost = NULL;
> >> - int64_t min_pts = INT64_MAX;
> >> -
> >> - /* choose output stream with the lowest timestamp */
> >> - for (i = 0; i < nb_output_streams; i++) {
> >> - int64_t pts = output_streams[i]->sync_opts;
> >> -
> >> - if (!output_streams[i]->filter || output_streams[i]->finished)
> >> - continue;
> >> -
> >> - pts = av_rescale_q(pts, output_streams[i]->enc_ctx->time_base,
> >> - AV_TIME_BASE_Q);
> >> - if (pts < min_pts) {
> >> - min_pts = pts;
> >> - ost = output_streams[i];
> >> - }
> >> - }
> >> -
> >> - if (!ost)
> >> - break;
> >> -
> >> - ret = poll_filter(ost);
> >> -
> >> - if (ret == AVERROR_EOF) {
> >> - finish_output_stream(ost);
> >> - ret = 0;
> >> - } else if (ret == AVERROR(EAGAIN))
> >> - return 0;
> >> - }
> >> -
> >> - return ret;
> >> -}
> >> -
> >> static void print_final_stats(int64_t total_size)
> >> {
> >> uint64_t video_size = 0, audio_size = 0, extra_size = 0, other_size
> >> = 0;
> >> @@ -802,7 +756,7 @@ static void print_final_stats(int64_t total_size)
> >> }
> >> }
> >>
> >> -static void print_report(int is_last_report, int64_t timer_start)
> >> +static void print_report(int is_last_report)
> >> {
> >> char buf[1024];
> >> OutputStream *ost;
> >> @@ -812,6 +766,7 @@ static void print_report(int is_last_report, int64_t
> >> timer_start)
> >> int frame_number, vid, i;
> >> double bitrate, ti1, pts;
> >> static int64_t last_time = -1;
> >> + static int64_t timer_start = -1;
> >
> > Static variables are evil. I know there's already one there, but don't
> > add any new ones.
> >
>
> Alternatively I can forward them from the caller's caller, looked not
> exactly nice having
>
> transcode() ->
> pool_filters(&timer_start, &last_timer) ->
> print_report(0, &timer_start, &last_timer)
That's not a reason to add yet more global state.
--
Anton Khirnov
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel