Message ID | 20170212143526.95303-1-josh@itanimul.li |
---|---|
State | Accepted |
Headers | show |
2017-02-12 15:35 GMT+01:00 Josh de Kock <josh@itanimul.li>: > I'm not sure, 0.2.28 doesn't compile on my system. It has > been tested with the latest version 0.2.38. > > Does the updated patch look better? I prefer it if nobody wants to test old versions. > - vbi_decoder_delete(ctx->vbi); > - ctx->vbi = NULL; > + if (ctx->vbi) { Is this unrelated? > +#if VBI_VERSION >= 234 // 0.2.34 > + vbi_event_handler_unregister(ctx->vbi, handler, ctx); > +#endif > + vbi_decoder_delete(ctx->vbi); > + ctx->vbi = NULL; > + } Carl Eugen
On Sun, 12 Feb 2017, Josh de Kock wrote: > Hi Carl, > > I'm not sure, 0.2.28 doesn't compile on my system. It has been tested with the > latest version 0.2.38. I only checked the source code, and in 0.2.28 the function is already deprecated. So the original patch should be fine, I prefer that. Regards, Marton
On Sun, 12 Feb 2017, Carl Eugen Hoyos wrote: > 2017-02-12 15:35 GMT+01:00 Josh de Kock <josh@itanimul.li>: >> I'm not sure, 0.2.28 doesn't compile on my system. It has >> been tested with the latest version 0.2.38. >> >> Does the updated patch look better? > > I prefer it if nobody wants to test old versions. > >> - vbi_decoder_delete(ctx->vbi); >> - ctx->vbi = NULL; > >> + if (ctx->vbi) { > > Is this unrelated? Hmm, you are right, it seems this hunk is unneeded even in the original patch, because vbi_encoder_delete unregisters all handlers. Josh, could you remove this hunk then from the original patch? Thanks, Marton
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA512 On 12/02/2017 15:28, Marton Balint wrote: > > On Sun, 12 Feb 2017, Josh de Kock wrote: > >> Hi Carl, >> >> I'm not sure, 0.2.28 doesn't compile on my system. It has been >> tested with the latest version 0.2.38. > > I only checked the source code, and in 0.2.28 the function is > already deprecated. So the original patch should be fine, I prefer > that. > > Regards, Marton Applied without the last bit Thanks, - -- Josh PGP fingerprint: A93A602D7A6D3C5388D792BCD052D40DDEF9703D -----BEGIN PGP SIGNATURE----- Comment: GPGTools - https://gpgtools.org iQIcBAEBCgAGBQJYoNZHAAoJENBS1A3e+XA9j3YP/0EzW4l6ffB9Ty9Hw5/z1XmY bXxexmgpKbYaAx3ZOGyKAI/dk1AV+wKVMZP+5SJdMcocUDRcU5IUaQoM/hM926Ml 3ypv5DuymsEzUe4vRPHFdRb2ggLsp+2muv0fYZQEFq1eYBjFwQ6ELT7OiYuLVkUS 2vRxCkuPF/jIlKY4NAu7X8feO3LOc6pXxkn/k1qW665PMyxR+RzCwXKgRsAnpBGy PbPxniZgK75XfJPNkX2tnUh+3JNeEOFlIA52kOqKa1cxAMQ15EJhvTSvi6NsRbG2 m5b1wkJfG4uLipaawk4w4DwddI6r0/O0M4HN8DO7c3isPYujZhNT133ZGEBzE161 lmv4AeGJUbuIqXnoJaLVqinQDxTY+FsGXX/2f66fBBwgxSjZigm/Hn0JX55xhlu/ ETidTppUM5SQyC1NGXz2iDTPvApagW5NMn/SBpqaIfOOrZPJfTel9yesx2xBR83h YuU9Q8AplC0967Udbkw175zMxKW3/moxcX1R6AMGLUOwz+O70QOuFWcTUOqA4Ron tO0nzuf/MvPxSDIRaCsEH+PoCNmrRQ5NpomeqPQQF0amt3s0jYoMRrJsr5k6dATE 4zqDcMjjZCLn/GvORPp+NlaifM++OhQNYwvJXvw/4g5LBDzSO9B7XtfobatWHJks 7/l2XOOwh2mYSDc3dIPi =rMSh -----END PGP SIGNATURE-----
diff --git a/libavcodec/libzvbi-teletextdec.c b/libavcodec/libzvbi-teletextdec.c index d1f0a9f..290e89f 100644 --- a/libavcodec/libzvbi-teletextdec.c +++ b/libavcodec/libzvbi-teletextdec.c @@ -41,6 +41,7 @@ #define BITMAP_CHAR_WIDTH 12 #define BITMAP_CHAR_HEIGHT 10 #define MAX_SLICES 64 +#define VBI_VERSION (VBI_VERSION_MAJOR * 10000 + VBI_VERSION_MINOR * 100 + VBI_VERSION_MICRO) typedef struct TeletextPage { @@ -395,7 +396,11 @@ 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_VERSION >= 234 // 0.2.34 + if (!vbi_event_handler_register(ctx->vbi, VBI_EVENT_TTX_PAGE, handler, ctx)) { +#else if (!vbi_event_handler_add(ctx->vbi, VBI_EVENT_TTX_PAGE, handler, ctx)) { +#endif vbi_decoder_delete(ctx->vbi); ctx->vbi = NULL; return AVERROR(ENOMEM); @@ -524,8 +529,14 @@ 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) { +#if VBI_VERSION >= 234 // 0.2.34 + vbi_event_handler_unregister(ctx->vbi, handler, ctx); +#endif + 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;
Hi Carl, I'm not sure, 0.2.28 doesn't compile on my system. It has been tested with the latest version 0.2.38. Does the updated patch look better? Josh Signed-off-by: Josh de Kock <josh@itanimul.li> --- libavcodec/libzvbi-teletextdec.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-)