• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* GStreamer
2  * Copyright (C) <2020> Jan Schmidt <jan@centricular.com>
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Library General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Library General Public License for more details.
13  *
14  * You should have received a copy of the GNU Library General Public
15  * License along with this library; if not, write to the
16  * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
17  * Boston, MA 02110-1301, USA.
18  */
19 
20 #include <gst/gst.h>
21 #include <gst/video/video.h>
22 
23 #define GST_TYPE_DVB_SUB_ENC             (gst_dvb_sub_enc_get_type())
24 #define GST_DVB_SUB_ENC(obj)             (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_DVB_SUB_ENC,GstDvbSubEnc))
25 #define GST_DVB_SUB_ENC_CLASS(klass)     (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_DVB_SUB_ENC,GstDvbSubEncClass))
26 #define GST_IS_DVB_SUB_ENC(obj)          (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_DVB_SUB_ENC))
27 #define GST_IS_DVB_SUB_ENC_CLASS(klass)  (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_DVB_SUB_ENC))
28 
29 GST_DEBUG_CATEGORY_EXTERN (gst_dvb_sub_enc_debug);
30 #define GST_CAT_DEFAULT (gst_dvb_sub_enc_debug)
31 
32 typedef struct _GstDvbSubEnc GstDvbSubEnc;
33 typedef struct _GstDvbSubEncClass GstDvbSubEncClass;
34 typedef struct SubpictureRect SubpictureRect;
35 
36 struct SubpictureRect {
37   /* Paletted 8-bit picture */
38   GstVideoFrame *frame;
39   /* Actual number of colours used from the palette */
40   guint32 nb_colours;
41 
42   guint x, y;
43 };
44 
45 struct _GstDvbSubEnc
46 {
47   GstElement element;
48 
49   GstVideoInfo in_info;
50   GstPad *sinkpad;
51   GstPad *srcpad;
52 
53   int object_version;
54 
55   int max_colours;
56   GstClockTimeDiff ts_offset;
57 
58   GstClockTime current_end_time;
59 };
60 
61 struct _GstDvbSubEncClass
62 {
63   GstElementClass parent_class;
64 };
65 
66 GType gst_dvb_sub_enc_get_type (void);
67 GST_ELEMENT_REGISTER_DECLARE (dvbsubenc);
68 
69 gboolean gst_dvbsubenc_ayuv_to_ayuv8p (GstVideoFrame * src, GstVideoFrame * dest, int max_colours, guint32 *out_num_colours);
70 
71 GstBuffer *gst_dvbenc_encode (int object_version, int page_id, SubpictureRect *s, guint num_subpictures);
72