mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-23 02:01:12 +00:00
closedcaption: move cdp framerate table to common file
shared by both cccombiner and ccconverter Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3211>
This commit is contained in:
parent
5dd199f7e8
commit
067185e7da
6 changed files with 108 additions and 77 deletions
59
subprojects/gst-plugins-bad/ext/closedcaption/ccutils.c
Normal file
59
subprojects/gst-plugins-bad/ext/closedcaption/ccutils.c
Normal file
|
@ -0,0 +1,59 @@
|
|||
/*
|
||||
* 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;
|
||||
}
|
46
subprojects/gst-plugins-bad/ext/closedcaption/ccutils.h
Normal file
46
subprojects/gst-plugins-bad/ext/closedcaption/ccutils.h
Normal file
|
@ -0,0 +1,46 @@
|
|||
/*
|
||||
* 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
|
|
@ -28,6 +28,7 @@
|
|||
#include <gst/video/video.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "ccutils.h"
|
||||
#include "gstcccombiner.h"
|
||||
|
||||
GST_DEBUG_CATEGORY_STATIC (gst_cc_combiner_debug);
|
||||
|
@ -192,30 +193,6 @@ done:
|
|||
#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)
|
||||
|
|
|
@ -40,15 +40,6 @@ G_BEGIN_DECLS
|
|||
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;
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
#include <gst/video/video.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "ccutils.h"
|
||||
#include "gstccconverter.h"
|
||||
|
||||
GST_DEBUG_CATEGORY_STATIC (gst_cc_converter_debug);
|
||||
|
@ -471,49 +472,6 @@ invalid_caps:
|
|||
}
|
||||
}
|
||||
|
||||
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)
|
||||
|
|
|
@ -12,7 +12,7 @@ zvbi_sources = [
|
|||
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,
|
||||
|
|
Loading…
Reference in a new issue