On Mon, Jun 14, 2021 at 10:04 AM Paul B Mahol <one...@gmail.com> wrote:
> On Sun, Jun 13, 2021 at 11:50 PM Pavel Koshevoy <pkoshe...@gmail.com> > wrote: > > > On Sat, Jun 5, 2021 at 11:40 AM Pavel Koshevoy <pkoshe...@gmail.com> > > wrote: > > > > > Un-hardcode the 200ms minimum latency between emitting subtitle events > > > so that those that wish to receive a subtitle event for every screen > > > change could do so. > > > > > > The problem with delaying realtime output by any amount is that it is > > > unknown when the next byte pair that would trigger output will happen. > > > It may be within 200ms, or it may be several seconds later -- that's > > > not realtime at all. > > > --- > > > libavcodec/ccaption_dec.c | 4 +++- > > > libavcodec/version.h | 2 +- > > > 2 files changed, 4 insertions(+), 2 deletions(-) > > > > > > diff --git a/libavcodec/ccaption_dec.c b/libavcodec/ccaption_dec.c > > > index de05d037a8..27c61527f6 100644 > > > --- a/libavcodec/ccaption_dec.c > > > +++ b/libavcodec/ccaption_dec.c > > > @@ -238,6 +238,7 @@ struct Screen { > > > typedef struct CCaptionSubContext { > > > AVClass *class; > > > int real_time; > > > + int real_time_latency_msec; > > > int data_field; > > > struct Screen screen[2]; > > > int active_screen; > > > @@ -906,7 +907,7 @@ static int decode(AVCodecContext *avctx, void > *data, > > > int *got_sub, AVPacket *avp > > > } > > > > > > if (ctx->real_time && ctx->screen_touched && > > > - sub->pts > ctx->last_real_time + av_rescale_q(200, ms_tb, > > > AV_TIME_BASE_Q)) { > > > + sub->pts >= ctx->last_real_time + > > > av_rescale_q(ctx->real_time_latency_msec, ms_tb, AV_TIME_BASE_Q)) { > > > ctx->last_real_time = sub->pts; > > > ctx->screen_touched = 0; > > > > > > @@ -927,6 +928,7 @@ static int decode(AVCodecContext *avctx, void > *data, > > > int *got_sub, AVPacket *avp > > > #define SD AV_OPT_FLAG_SUBTITLE_PARAM | AV_OPT_FLAG_DECODING_PARAM > > > static const AVOption options[] = { > > > { "real_time", "emit subtitle events as they are decoded for > > > real-time display", OFFSET(real_time), AV_OPT_TYPE_BOOL, { .i64 = 0 }, > 0, > > > 1, SD }, > > > + { "real_time_latency_msec", "minimum elapsed time between emitting > > > real-time subtitle events", OFFSET(real_time_latency_msec), > > > AV_OPT_TYPE_INT, { .i64 = 200 }, 0, 500, SD }, > > > { "data_field", "select data field", OFFSET(data_field), > > > AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 1, SD, "data_field" }, > > > { "auto", "pick first one that appears", 0, AV_OPT_TYPE_CONST, { > > > .i64 =-1 }, 0, 0, SD, "data_field" }, > > > { "first", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 0 }, 0, 0, SD, > > > "data_field" }, > > > diff --git a/libavcodec/version.h b/libavcodec/version.h > > > index 48165b9ac4..5b1e9e77f3 100644 > > > --- a/libavcodec/version.h > > > +++ b/libavcodec/version.h > > > @@ -29,7 +29,7 @@ > > > > > > #define LIBAVCODEC_VERSION_MAJOR 59 > > > #define LIBAVCODEC_VERSION_MINOR 1 > > > -#define LIBAVCODEC_VERSION_MICRO 100 > > > +#define LIBAVCODEC_VERSION_MICRO 101 > > > > > > #define LIBAVCODEC_VERSION_INT > > AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ > > > > > LIBAVCODEC_VERSION_MINOR, \ > > > -- > > > 2.26.2 > > > > > > > > > > Ping. If there are no objections may this be applied? > > > > > Do you have power to apply it? > > Yes, I have git access, but I'm not the maintainer of libavcodec/ccaption_dec.c Pavel. _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".