1 /* GStreamer
2  * Copyright (C) <2005> Jan Schmidt <jan@fluendo.com>
3  * Copyright (C) <2002> Wim Taymans <wim@fluendo.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 #define GST_TYPE_DVD_SUB_DEC             (gst_dvd_sub_dec_get_type())
25 #define GST_DVD_SUB_DEC(obj)             (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_DVD_SUB_DEC,GstDvdSubDec))
26 #define GST_DVD_SUB_DEC_CLASS(klass)     (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_DVD_SUB_DEC,GstDvdSubDecClass))
27 #define GST_IS_DVD_SUB_DEC(obj)          (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_DVD_SUB_DEC))
28 #define GST_IS_DVD_SUB_DEC_CLASS(klass)  (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_DVD_SUB_DEC))
29 
30 typedef struct _GstDvdSubDec GstDvdSubDec;
31 typedef struct _GstDvdSubDecClass GstDvdSubDecClass;
32 
33 /* Hold premultimplied colour values */
34 typedef struct Color_val
35 {
36   guchar Y_R;
37   guchar U_G;
38   guchar V_B;
39   guchar A;
40 
41 } Color_val;
42 
43 struct _GstDvdSubDec
44 {
45   GstElement element;
46 
47   GstPad *sinkpad;
48   GstPad *srcpad;
49 
50   gint in_width, in_height;
51 
52   /* Collect together subtitle buffers until we have a full control sequence */
53   GstBuffer *partialbuf;
54   GstMapInfo partialmap;
55   gboolean have_title;
56 
57   guchar subtitle_index[4];
58   guchar menu_index[4];
59   guchar subtitle_alpha[4];
60   guchar menu_alpha[4];
61 
62   guint32 current_clut[16];
63   Color_val palette_cache_yuv[4];
64   Color_val hl_palette_cache_yuv[4];
65 
66   Color_val palette_cache_rgb[4];
67   Color_val hl_palette_cache_rgb[4];
68 
69   GstVideoInfo info;
70   gboolean use_ARGB;
71   GstClockTime next_ts;
72 
73   /*
74    * State info for the current subpicture
75    * buffer
76    */
77   guchar *parse_pos;
78 
79   guint16 packet_size;
80   guint16 data_size;
81 
82   gint offset[2];
83 
84   gboolean forced_display;
85   gboolean visible;
86 
87   gint left, top, right, bottom;
88   gint hl_left, hl_top, hl_right, hl_bottom;
89 
90   gint current_button;
91 
92   GstClockTime next_event_ts;
93 
94   gboolean buf_dirty;
95 };
96 
97 struct _GstDvdSubDecClass
98 {
99   GstElementClass parent_class;
100 };
101 
102 GType gst_dvd_sub_dec_get_type (void);
103