closedcaption: move cc_data->cdp to shared file
[platform/upstream/gstreamer.git] / subprojects / gst-plugins-bad / ext / closedcaption / ccutils.h
1 /*
2  * GStreamer
3  * Copyright (C) 2022 Matthew Waters <matthew@centricular.com>
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Library General Public
7  * License as published by the Free Software Foundation; either
8  * version 2 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * Library General Public License for more details.
14  *
15  * You should have received a copy of the GNU Library General Public
16  * License along with this library; if not, write to the
17  * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
18  * Boston, MA 02110-1301, USA.
19  */
20
21 #include <gst/gst.h>
22 #include <gst/video/video.h>
23
24 #ifndef __CCUTILS_H__
25 #define __CCUTILS_H__
26
27 G_BEGIN_DECLS
28
29 GST_DEBUG_CATEGORY_EXTERN(ccutils_debug_cat);
30
31 struct cdp_fps_entry
32 {
33   guint8 fps_idx;               /* value stored in cdp */
34   guint fps_n, fps_d;
35   guint max_cc_count;
36   guint max_ccp_count;
37   guint max_cea608_count;
38 };
39
40 G_GNUC_INTERNAL
41 const struct cdp_fps_entry * cdp_fps_entry_from_fps (guint fps_n, guint fps_d);
42 G_GNUC_INTERNAL
43 const struct cdp_fps_entry * cdp_fps_entry_from_id  (guint8 id);
44
45 extern const struct cdp_fps_entry null_fps_entry;
46
47 typedef enum {
48   GST_CC_CDP_MODE_TIME_CODE   = (1<<0),
49   GST_CC_CDP_MODE_CC_DATA     = (1<<1),
50   GST_CC_CDP_MODE_CC_SVC_INFO = (1<<2)
51 } GstCCCDPMode;
52
53 guint           convert_cea708_cc_data_to_cdp  (GstObject * dbg_obj,
54                                                 GstCCCDPMode cdp_mode,
55                                                 guint16 cdp_hdr_sequence_cntr,
56                                                 const guint8 * cc_data,
57                                                 guint cc_data_len,
58                                                 guint8 * cdp,
59                                                 guint cdp_len,
60                                                 const GstVideoTimeCode * tc,
61                                                 const struct cdp_fps_entry *fps_entry);
62
63 G_END_DECLS
64
65 #endif