diff options
author | Marton Balint <cus@passwd.hu> | 2016-02-16 03:10:43 +0100 |
---|---|---|
committer | Marton Balint <cus@passwd.hu> | 2016-02-19 21:50:19 +0100 |
commit | 6c905dd3c24afd65fdb42b6f28217af85a35105a (patch) | |
tree | 4ad764ba4ee2c56ca4b8fbc061d7fbe4506a0caa /libavcodec | |
parent | 51afd9f4e1f79144d0ff2874c55f55eaba012343 (diff) | |
download | ffmpeg-6c905dd3c24afd65fdb42b6f28217af85a35105a.tar.gz |
avcodec/libzvbi-teletextdec: use common functions for matching data_unit_id and data_identifier
Signed-off-by: Marton Balint <cus@passwd.hu>
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/libzvbi-teletextdec.c | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/libavcodec/libzvbi-teletextdec.c b/libavcodec/libzvbi-teletextdec.c index 308f735ba4..667cd28cb3 100644 --- a/libavcodec/libzvbi-teletextdec.c +++ b/libavcodec/libzvbi-teletextdec.c @@ -20,6 +20,7 @@ #include "avcodec.h" #include "libavcodec/ass.h" +#include "libavcodec/dvbtxt.h" #include "libavutil/opt.h" #include "libavutil/bprint.h" #include "libavutil/internal.h" @@ -368,12 +369,6 @@ static void handler(vbi_event *ev, void *user_data) vbi_unref_page(&page); } -static inline int data_identifier_is_teletext(int data_identifier) { - /* See EN 301 775 section 4.4.2. */ - return (data_identifier >= 0x10 && data_identifier <= 0x1F || - data_identifier >= 0x99 && data_identifier <= 0x9B); -} - static int slice_to_vbi_lines(TeletextContext *ctx, uint8_t* buf, int size) { int lines = 0; @@ -382,7 +377,7 @@ static int slice_to_vbi_lines(TeletextContext *ctx, uint8_t* buf, int size) int data_unit_length = buf[1]; if (data_unit_length + 2 > size) return AVERROR_INVALIDDATA; - if (data_unit_id == 0x02 || data_unit_id == 0x03) { + if (ff_data_unit_id_is_teletext(data_unit_id)) { if (data_unit_length != 0x2c) return AVERROR_INVALIDDATA; else { @@ -434,7 +429,7 @@ static int teletext_decode_frame(AVCodecContext *avctx, void *data, int *data_si ctx->handler_ret = pkt->size; - if (data_identifier_is_teletext(*pkt->data)) { + if (ff_data_identifier_is_teletext(*pkt->data)) { if ((lines = slice_to_vbi_lines(ctx, pkt->data + 1, pkt->size - 1)) < 0) return lines; ff_dlog(avctx, "ctx=%p buf_size=%d lines=%u pkt_pts=%7.3f\n", |