1 /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
3 * libdvbsub - DVB subtitle decoding
4 * Copyright (C) Mart Raudsepp 2009 <mart.raudsepp@artecdesign.ee>
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
28 typedef struct _DvbSub DvbSub;
32 * @data: the data in the form of palette indices, each byte represents one pixel
33 * as an index into the @palette.
34 * @palette: the palette used for this subtitle rectangle, up to 256 items depending
35 * on the depth of the subpicture; each palette item is in ARGB form, 8-bits per channel.
36 * @palette_bits_count: the amount of bits used in indeces into @palette in @data.
37 * @rowstride: the number of bytes between the start of a row and the start of the next row.
39 * A structure representing the contents of a subtitle rectangle.
41 * FIXME: Expose the depth of the palette, and perhaps also the height in this struct.
43 typedef struct DVBSubtitlePicture {
46 guint8 palette_bits_count;
52 * @x: x coordinate of top left corner
53 * @y: y coordinate of top left corner
54 * @w: the width of this subpicture rectangle
55 * @h: the height of this subpicture rectangle
56 * @pict: the content of this subpicture rectangle
58 * A structure representing one subtitle objects position, dimension and content.
60 typedef struct DVBSubtitleRect {
66 DVBSubtitlePicture pict;
72 * @display_window_flag: window_* are valid
73 * @display_width: assumed width of display
74 * @display_height: assumed height of display
75 * @window_x: x coordinate of top left corner of the subtitle window
76 * @window_y: y coordinate of top left corner of the subtitle window
77 * @window_width: width of the subtitle window
78 * @window_height: height of the subtitle window
80 * A structure presenting display and window information
81 * display definition segment from ETSI EN 300 743 V1.3.1
83 typedef struct DVBSubtitleWindow {
98 * @num_rects: the number of #DVBSubtitleRect in @rects
99 * @rects: dynamic array of #DVBSubtitleRect
101 * A structure representing a set of subtitle objects.
103 typedef struct DVBSubtitles {
105 guint8 page_time_out;
107 DVBSubtitleRect *rects;
108 DVBSubtitleWindow display_def;
113 * @new_data: called when new subpicture data is available for display. @dvb_sub
114 * is the #DvbSub instance this callback originates from; @subs is the set of
115 * subtitle objects that should be display for no more than @page_time_out
116 * seconds at @pts; @user_data is the same user_data as was passed through
117 * dvb_sub_set_callbacks(); The callback handler is responsible for eventually
118 * cleaning up the subpicture data @subs with a call to dvb_subtitles_free()
120 * A set of callbacks that can be installed on the #DvbSub with
121 * dvb_sub_set_callbacks().
124 void (*new_data) (DvbSub *dvb_sub, DVBSubtitles * subs, gpointer user_data);
126 gpointer _dvb_sub_reserved[3];
129 DvbSub *dvb_sub_new (void);
130 void dvb_sub_free (DvbSub * sub);
132 gint dvb_sub_feed_with_pts (DvbSub *dvb_sub, guint64 pts, guint8 *data, gint len);
133 void dvb_sub_set_callbacks (DvbSub *dvb_sub, DvbSubCallbacks *callbacks, gpointer user_data);
134 void dvb_subtitles_free (DVBSubtitles *sub);
138 #endif /* _DVB_SUB_H_ */