[FFmpeg-devel] [PATCH] lavc/libzvbi: remove deprecated API usage
Marton Balint
cus at passwd.hu
Sun Feb 12 14:44:12 EET 2017
On Sat, 11 Feb 2017, Josh de Kock wrote:
> Signed-off-by: Josh de Kock <josh at itanimul.li>
> ---
> libavcodec/libzvbi-teletextdec.c | 10 +++++++---
> 1 file changed, 7 insertions(+), 3 deletions(-)
>
> diff --git a/libavcodec/libzvbi-teletextdec.c b/libavcodec/libzvbi-teletextdec.c
> index d1f0a9f..2ed4a82 100644
> --- a/libavcodec/libzvbi-teletextdec.c
> +++ b/libavcodec/libzvbi-teletextdec.c
> @@ -395,7 +395,7 @@ static int teletext_decode_frame(AVCodecContext *avctx, void *data, int *data_si
> if (!ctx->vbi) {
> if (!(ctx->vbi = vbi_decoder_new()))
> return AVERROR(ENOMEM);
> - if (!vbi_event_handler_add(ctx->vbi, VBI_EVENT_TTX_PAGE, handler, ctx)) {
> + if (!vbi_event_handler_register(ctx->vbi, VBI_EVENT_TTX_PAGE, handler, ctx)) {
> vbi_decoder_delete(ctx->vbi);
> ctx->vbi = NULL;
> return AVERROR(ENOMEM);
> @@ -524,8 +524,12 @@ static int teletext_close_decoder(AVCodecContext *avctx)
> subtitle_rect_free(&ctx->pages[--ctx->nb_pages].sub_rect);
> av_freep(&ctx->pages);
>
> - vbi_decoder_delete(ctx->vbi);
> - ctx->vbi = NULL;
> + if (ctx->vbi) {
> + vbi_event_handler_unregister(ctx->vbi, handler, ctx);
> + vbi_decoder_delete(ctx->vbi);
> + ctx->vbi = NULL;
> + }
> +
> ctx->pts = AV_NOPTS_VALUE;
> if (!(avctx->flags2 & AV_CODEC_FLAG2_RO_FLUSH_NOOP))
> ctx->readorder = 0;
> --
LGTM if tested.
Thanks,
Marton
More information about the ffmpeg-devel
mailing list