From 75503017c24c6d9a4603574b2871c366dea1ac29 Mon Sep 17 00:00:00 2001 From: Matthew Waters Date: Thu, 12 Mar 2020 15:06:46 +1100 Subject: [PATCH] ccconverter: introduce define for max cdp packet length Part-of: --- ext/closedcaption/gstccconverter.c | 14 +++++++------- ext/closedcaption/gstccconverter.h | 2 ++ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/ext/closedcaption/gstccconverter.c b/ext/closedcaption/gstccconverter.c index 6e7aff2..9fead11 100644 --- a/ext/closedcaption/gstccconverter.c +++ b/ext/closedcaption/gstccconverter.c @@ -64,9 +64,9 @@ gst_cc_converter_transform_size (GstBaseTransform * base, /* Assume worst-case here and over-allocate, and in ::transform() we then * downsize the buffer as needed. The worst-case is one CDP packet, which - * can be up to 256 bytes large */ + * can be up to MAX_CDP_PACKET_LEN bytes large */ - *othersize = 256; + *othersize = MAX_CDP_PACKET_LEN; return TRUE; } @@ -583,7 +583,7 @@ convert_cea708_cc_data_cea708_cdp_internal (GstCCConverter * self, /* Converts CDP into raw CEA708 cc_data */ static guint convert_cea708_cdp_cea708_cc_data_internal (GstCCConverter * self, - const guint8 * cdp, guint cdp_len, guint8 cc_data[256], + const guint8 * cdp, guint cdp_len, guint8 cc_data[MAX_CDP_PACKET_LEN], GstVideoTimeCode * tc, const struct cdp_fps_entry ** out_fps_entry) { GstByteReader br; @@ -777,7 +777,7 @@ convert_cea608_raw_cea708_cdp (GstCCConverter * self, GstBuffer * inbuf, { GstMapInfo in, out; guint i, n, len; - guint8 cc_data[256]; + guint8 cc_data[MAX_CDP_PACKET_LEN]; const GstVideoTimeCodeMeta *tc_meta; const struct cdp_fps_entry *fps_entry; @@ -904,7 +904,7 @@ convert_cea608_s334_1a_cea708_cdp (GstCCConverter * self, GstBuffer * inbuf, { GstMapInfo in, out; guint i, n, len; - guint8 cc_data[256]; + guint8 cc_data[MAX_CDP_PACKET_LEN]; const GstVideoTimeCodeMeta *tc_meta; const struct cdp_fps_entry *fps_entry; @@ -1083,7 +1083,7 @@ convert_cea708_cdp_cea608_raw (GstCCConverter * self, GstBuffer * inbuf, GstMapInfo in, out; guint i; GstVideoTimeCode tc; - guint8 cc_data[256]; + guint8 cc_data[MAX_CDP_PACKET_LEN]; guint len, cea608 = 0; const struct cdp_fps_entry *fps_entry; @@ -1130,7 +1130,7 @@ convert_cea708_cdp_cea608_s334_1a (GstCCConverter * self, GstBuffer * inbuf, GstMapInfo in, out; guint i; GstVideoTimeCode tc; - guint8 cc_data[256]; + guint8 cc_data[MAX_CDP_PACKET_LEN]; guint len, cea608 = 0; const struct cdp_fps_entry *fps_entry; diff --git a/ext/closedcaption/gstccconverter.h b/ext/closedcaption/gstccconverter.h index 9475a80..673d2c1 100644 --- a/ext/closedcaption/gstccconverter.h +++ b/ext/closedcaption/gstccconverter.h @@ -40,6 +40,8 @@ G_BEGIN_DECLS typedef struct _GstCCConverter GstCCConverter; typedef struct _GstCCConverterClass GstCCConverterClass; +#define MAX_CDP_PACKET_LEN 256 + struct _GstCCConverter { GstBaseTransform parent; -- 2.7.4