--- /dev/null
+/*
+ * GStreamer
+ * Copyright (C) 2022 Matthew Waters <matthew@centricular.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include "ccutils.h"
+
+static const struct cdp_fps_entry cdp_fps_table[] = {
+ {0x1f, 24000, 1001, 25, 22, 3 /* FIXME: alternating max cea608 count! */ },
+ {0x2f, 24, 1, 25, 22, 2},
+ {0x3f, 25, 1, 24, 22, 2},
+ {0x4f, 30000, 1001, 20, 18, 2},
+ {0x5f, 30, 1, 20, 18, 2},
+ {0x6f, 50, 1, 12, 11, 1},
+ {0x7f, 60000, 1001, 10, 9, 1},
+ {0x8f, 60, 1, 10, 9, 1},
+};
+const struct cdp_fps_entry null_fps_entry = { 0, 0, 0, 0 };
+
+const struct cdp_fps_entry *
+cdp_fps_entry_from_fps (guint fps_n, guint fps_d)
+{
+ int i;
+ for (i = 0; i < G_N_ELEMENTS (cdp_fps_table); i++) {
+ if (cdp_fps_table[i].fps_n == fps_n && cdp_fps_table[i].fps_d == fps_d)
+ return &cdp_fps_table[i];
+ }
+ return &null_fps_entry;
+}
+
+const struct cdp_fps_entry *
+cdp_fps_entry_from_id (guint8 id)
+{
+ int i;
+ for (i = 0; i < G_N_ELEMENTS (cdp_fps_table); i++) {
+ if (cdp_fps_table[i].fps_idx == id)
+ return &cdp_fps_table[i];
+ }
+ return &null_fps_entry;
+}
--- /dev/null
+/*
+ * GStreamer
+ * Copyright (C) 2022 Matthew Waters <matthew@centricular.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include <gst/gst.h>
+
+#ifndef __CCUTILS_H__
+#define __CCUTILS_H__
+
+G_BEGIN_DECLS
+
+struct cdp_fps_entry
+{
+ guint8 fps_idx; /* value stored in cdp */
+ guint fps_n, fps_d;
+ guint max_cc_count;
+ guint max_ccp_count;
+ guint max_cea608_count;
+};
+
+G_GNUC_INTERNAL
+const struct cdp_fps_entry * cdp_fps_entry_from_fps (guint fps_n, guint fps_d);
+G_GNUC_INTERNAL
+const struct cdp_fps_entry * cdp_fps_entry_from_id (guint8 id);
+
+extern const struct cdp_fps_entry null_fps_entry;
+
+G_END_DECLS
+
+#endif
#include <gst/video/video.h>
#include <string.h>
+#include "ccutils.h"
#include "gstcccombiner.h"
GST_DEBUG_CATEGORY_STATIC (gst_cc_combiner_debug);
#define MAX_CDP_PACKET_LEN 256
#define MAX_CEA608_LEN 32
-static const struct cdp_fps_entry cdp_fps_table[] = {
- {0x1f, 24000, 1001, 25, 22, 3 /* FIXME: alternating max cea608 count! */ },
- {0x2f, 24, 1, 25, 22, 2},
- {0x3f, 25, 1, 24, 22, 2},
- {0x4f, 30000, 1001, 20, 18, 2},
- {0x5f, 30, 1, 20, 18, 2},
- {0x6f, 50, 1, 12, 11, 1},
- {0x7f, 60000, 1001, 10, 9, 1},
- {0x8f, 60, 1, 10, 9, 1},
-};
-static const struct cdp_fps_entry null_fps_entry = { 0, 0, 0, 0 };
-
-static const struct cdp_fps_entry *
-cdp_fps_entry_from_fps (guint fps_n, guint fps_d)
-{
- int i;
- for (i = 0; i < G_N_ELEMENTS (cdp_fps_table); i++) {
- if (cdp_fps_table[i].fps_n == fps_n && cdp_fps_table[i].fps_d == fps_d)
- return &cdp_fps_table[i];
- }
- return &null_fps_entry;
-}
-
-
static GstBuffer *
make_cdp (GstCCCombiner * self, const guint8 * cc_data, guint cc_data_len,
const struct cdp_fps_entry *fps_entry, const GstVideoTimeCode * tc)
typedef struct _GstCCCombiner GstCCCombiner;
typedef struct _GstCCCombinerClass GstCCCombinerClass;
-struct cdp_fps_entry
-{
- guint8 fps_idx;
- guint fps_n, fps_d;
- guint max_cc_count;
- guint max_ccp_count;
- guint max_cea608_count;
-};
-
struct _GstCCCombiner
{
GstAggregator parent;
#include <gst/video/video.h>
#include <string.h>
+#include "ccutils.h"
#include "gstccconverter.h"
GST_DEBUG_CATEGORY_STATIC (gst_cc_converter_debug);
}
}
-struct cdp_fps_entry
-{
- guint8 fps_idx;
- guint fps_n, fps_d;
- guint max_cc_count;
- guint max_ccp_count;
- guint max_cea608_count;
-};
-
-static const struct cdp_fps_entry cdp_fps_table[] = {
- {0x1f, 24000, 1001, 25, 22, 3 /* FIXME: alternating max cea608 count! */ },
- {0x2f, 24, 1, 25, 22, 2},
- {0x3f, 25, 1, 24, 22, 2},
- {0x4f, 30000, 1001, 20, 18, 2},
- {0x5f, 30, 1, 20, 18, 2},
- {0x6f, 50, 1, 12, 11, 1},
- {0x7f, 60000, 1001, 10, 9, 1},
- {0x8f, 60, 1, 10, 9, 1},
-};
-static const struct cdp_fps_entry null_fps_entry = { 0, 0, 0, 0 };
-
-static const struct cdp_fps_entry *
-cdp_fps_entry_from_id (guint8 id)
-{
- int i;
- for (i = 0; i < G_N_ELEMENTS (cdp_fps_table); i++) {
- if (cdp_fps_table[i].fps_idx == id)
- return &cdp_fps_table[i];
- }
- return &null_fps_entry;
-}
-
-static const struct cdp_fps_entry *
-cdp_fps_entry_from_fps (guint fps_n, guint fps_d)
-{
- int i;
- for (i = 0; i < G_N_ELEMENTS (cdp_fps_table); i++) {
- if (cdp_fps_table[i].fps_n == fps_n && cdp_fps_table[i].fps_d == fps_d)
- return &cdp_fps_table[i];
- }
- return &null_fps_entry;
-}
-
static void
get_framerate_output_scale (GstCCConverter * self,
const struct cdp_fps_entry *in_fps_entry, gint * scale_n, gint * scale_d)
if closedcaption_dep.found()
gstclosedcaption = library('gstclosedcaption',
'gstcccombiner.c', 'gstccextractor.c', 'gstccconverter.c', 'gstclosedcaption.c',
- 'gstline21dec.c', 'gstcea708decoder.c', 'gstceaccoverlay.c', 'gstline21enc.c',
+ 'gstline21dec.c', 'gstcea708decoder.c', 'gstceaccoverlay.c', 'gstline21enc.c', 'ccutils.c',
zvbi_sources,
c_args : gst_plugins_bad_args,
link_args : noseh_link_args,