DVBCore  17.9.0
Open Source DVB Engine
 All Data Structures Files Functions Typedefs Macros Pages
stbds.h
Go to the documentation of this file.
1 /*******************************************************************************
2  * Copyright © 2014 The DTVKit Open Software Foundation Ltd (www.dtvkit.org)
3  * Copyright © 2004 Ocean Blue Software Ltd
4  *
5  * This file is part of a DTVKit Software Component
6  * You are permitted to copy, modify or distribute this file subject to the terms
7  * of the DTVKit 1.0 Licence which can be found in licence.txt or at www.dtvkit.org
8  *
9  * THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
10  * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES
11  * OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
12  *
13  * If you or your organisation is not a member of DTVKit then you have access
14  * to this source code outside of the terms of the licence agreement
15  * and you are expected to delete this and any associated files immediately.
16  * Further information on DTVKit, membership and terms can be found at www.dtvkit.org
17  *******************************************************************************/
25 // pre-processor mechanism so multiple inclusions don't cause compilation error
26 
27 #ifndef _STBDS_H
28 #define _STBDS_H
29 
30 #include "techtype.h"
31 
32 //---Constant and macro definitions for public use-----------------------------
33 
34 // Page states
35 #define NORMAL_CASE 0x00
36 #define ACQUISITION_POINT 0x01
37 #define MODE_CHANGE 0x02
38 #define RES_PAGE_STATE 0x03
39 
40 // Memory allocation trace routines for subtitle debug only.
41 //#define DS_HEAP_USAGE
42 #ifdef DS_HEAP_USAGE
43  #define MAX_ARRAY_INDEX 255
44 #endif
45 
46 //---Enumerations for public use-----------------------------------------------
47 
48 //---Global type defs for public use-------------------------------------------
49 
50 // bits for dvb segment info holding
51 typedef struct object
52 {
53  struct object *next;
54 
55  // ETS 300 743 7.2.4
56  U16BIT object_id;
57  U8BIT object_version_number;
58  U8BIT object_coding_method;
59  U8BIT non_modifying_colour_flag;
60 
61  U8BIT *map_table_2_to_4_bit;
62  U8BIT *map_table_2_to_8_bit;
63  U8BIT *map_table_4_to_8_bit;
64 
65  U8BIT *character_code;
66  U16BIT num_chars;
67 
68  // These are varibles for physical control/settings
69  // Here they where obtained from top_pixel_data_sub_block & bottom_pixel_data_sub_block
70  U8BIT *bitmap;
71  U16BIT width;
72  U16BIT height;
73 } S_OBJECT;
74 
75 typedef struct clut
76 {
77  struct clut *next;
78 
79  // ETS 300 743 7.2.3
80  U8BIT clut_id;
81  U8BIT clut_version_number;
82 
83  U32BIT *clut_2_bit;
84  U32BIT *clut_4_bit;
85  U32BIT *clut_8_bit;
86 
87  // These are varibles for physical control/settings
88  BOOLEAN default_2_bit;
89  BOOLEAN default_4_bit;
90  BOOLEAN default_8_bit;
91 } S_CLUT;
92 
93 typedef struct region_object
94 {
95  struct region_object *next;
96 
97  // ETS 300 743 7.2.2 - RCS object list
98  U16BIT object_id;
99  U8BIT object_type;
100  U8BIT object_provider_flag;
101  U16BIT object_horizontal_position;
102  U16BIT object_vertical_position;
103  U8BIT object_foreground_pixel_code;
104  U8BIT object_background_pixel_code;
106 
107 typedef struct epoch_region
108 {
109  struct epoch_region *next;
110 
111  // ETS 300 743 7.2.2 - from the RCS
112  U8BIT region_id;
113  U8BIT region_version_number;
114  U8BIT region_fill_flag;
115  U16BIT region_width;
116  U16BIT region_height;
117  U8BIT region_level_of_compatibilty;
118  U8BIT region_colour_depth;
119  U8BIT region_clut_id;
120  U8BIT region_8_bit_pixel_code;
121  U8BIT region_4_bit_pixel_code;
122  U8BIT region_2_bit_pixel_code;
123  S_REGION_OBJECT *region_object_list;
125 
126 typedef struct region
127 {
128  struct region *next;
129 // U8BIT region_version_number;
130 
131  // ETS 300 743 7.2.1 - PCS region list
132  U8BIT region_id;
133  U16BIT region_horizontal_address;
134  U16BIT region_vertical_address;
135 } S_REGION;
136 
137 typedef struct page_composition
138 {
139  // ETS 300 743 7.2.1 - from the PCS
140  U8BIT page_time_out;
141  U8BIT page_version_number;
142  U8BIT page_state;
143  S_REGION *region_list;
144 
145  // These are varibles for physical control/settings
146  U8BIT pts[5];
147  U32BIT presentation_time_ms;
148  U32BIT timeout_start;
149  BOOLEAN display_set_shown;
150  BOOLEAN display_set_removed;
151 
152  /* These variables are used for HD subtitles */
153  BOOLEAN dds_present;
154  U8BIT dds_version;
155  U16BIT display_width;
156  U16BIT display_height;
157  BOOLEAN display_window;
158  U16BIT window_x;
159  U16BIT window_y;
160  U16BIT window_width;
161  U16BIT window_height;
163 
164 typedef struct display_set
165 {
166  S_PAGE_COMPOSITION *page_display_buffer;
167  S_PAGE_COMPOSITION *page_composition_buffer;
168  S_EPOCH_REGION *region_list;
169  S_OBJECT *object_list;
170  S_CLUT *clut_list;
171 } S_DISPLAY_SET;
172 
173 //---Global Function prototypes for public use---------------------------------
174 
175 // From the file stbdsfn.c
177 S_CLUT* STB_DSGetClut(S_CLUT *clut_list, U16BIT clut_id);
178 BOOLEAN STB_DSSegmentDDS(U8BIT *data, U16BIT pes_len, U16BIT processed_bytes);
179 BOOLEAN STB_DSSegmentPCS(U8BIT *data, U16BIT pes_len, U16BIT processed_bytes, BOOLEAN force_acquisition);
180 BOOLEAN STB_DSSegmentRCS(U8BIT *data, U16BIT pes_len, U16BIT processed_bytes);
181 BOOLEAN STB_DSSegmentCDS(U8BIT *data, U16BIT pes_len, U16BIT processed_bytes);
182 BOOLEAN STB_DSSegmentODS(U8BIT *data, U16BIT pes_len, U16BIT processed_bytes);
183 BOOLEAN STB_DSSegmentEDS(U8BIT *data, U16BIT pes_len, U16BIT processed_bytes);
184 BOOLEAN STB_DSGetPesPts(U8BIT *data, U8BIT *pts);
185 BOOLEAN STB_DSSetDisplaySetPts(U8BIT path, U8BIT *pts);
187 void STB_DSClearDisplaySetStruct(void);
189 
190 
191 // From the file stbdsdis.c
192 void STB_DSCheckDisplaySetTimeout(S_DISPLAY_SET *subtitle_display_set, BOOLEAN timeout_override);
193 void STB_DSDisplay(U8BIT path, S_DISPLAY_SET *subtitle_display_set);
194 void STB_DSRegisterCharRenderFunction(void (*DSCreateBitmap)(U8BIT *bitmap, U16BIT width, U16BIT height, U8BIT *char_array,
195  U8BIT *tycrcb_palette, U8BIT fgnd_col, U8BIT bkgnd_col));
196 void STB_DSShow(void);
197 void STB_DSHide(void);
200 void STB_DSTerminateDisplayCycle(void);
201 void STB_DSCreateCompositionRegion(S_EPOCH_REGION *region, BOOLEAN page_reset);
202 void STB_DSRenderBitmapToRegion(S_EPOCH_REGION *region_list, S_OBJECT *object, U8BIT *scan_line,
203  U16BIT y, U16BIT w, U16BIT h);
204 void STB_DSFillRegion(U16BIT region_id, U8BIT fillcode);
205 U32BIT STB_DSNumPixelOperations(S_DISPLAY_SET *subtitle_display_set);
206 void STB_DSFillEmptyRegions(S_EPOCH_REGION *epoch_region_list, S_REGION *region_list);
207 
208 // stbdsc.c
209 void STB_SUBInitialise(void);
210 void* STB_DSGetQueue(void);
211 BOOLEAN STB_DSGetNextPesPts(U8BIT *next_pts);
212 
213 #endif // _STBDS_H
214 
215 //*****************************************************************************
216 // End of file
217 //*****************************************************************************
218 
void STB_SUBInitialise(void)
Initialises subtitling control.
Definition: stbdsc.c:943
void STB_DSFillRegion(U16BIT region_id, U8BIT fillcode)
Flood fills the identified region, with the specified colour index.
Definition: stbdsdis.c:1722
void STB_DSHide(void)
Prevents subtitles to display what it has decoded.
Definition: stbdsdis.c:1299
void STB_DSCreateCompositionRegion(S_EPOCH_REGION *region, BOOLEAN page_reset)
By end of call ensures that the specified region has a suitable physical region waiting in the physic...
Definition: stbdsdis.c:1409
void STB_DSResetPhysicalDisplayRegions(void)
Deletes all regions and clears serice_aquired flag.
Definition: stbdsdis.c:1321
BOOLEAN STB_DSInitialiseDVBSubtitlesProcessing(void)
Initilises DVB subtitles, allocates a temporary buffer for use as a scratchpad and zero's the display...
Definition: stbdsfn.c:1760
void STB_DSRegisterCharRenderFunction(void(*DSCreateBitmap)(U8BIT *bitmap, U16BIT width, U16BIT height, U8BIT *char_array, U8BIT *tycrcb_palette, U8BIT fgnd_col, U8BIT bkgnd_col))
Registers a STBUI function to use whatever font tool is present [if any] for the creation of a bitmap...
Definition: stbdsdis.c:1254
S_DISPLAY_SET * STB_DSGetDetails(void)
Gets a pointer to the display set structure.
Definition: stbdsfn.c:2897
void STB_DSDisplay(U8BIT path, S_DISPLAY_SET *subtitle_display_set)
The subtitle display function. Provides timing of display and clean up when necessary.
Definition: stbdsdis.c:1216
S_CLUT * STB_DSGetClut(S_CLUT *clut_list, U16BIT clut_id)
Finds or malloc's a new CLUT and assigns the family pointers to the default data. version_id is set t...
Definition: stbdsfn.c:1814
Definition: stbds.h:93
U32BIT STB_DSNumPixelOperations(S_DISPLAY_SET *subtitle_display_set)
Calculates the number of individual pixels in volved in the next display set.
Definition: stbdsdis.c:1756
BOOLEAN STB_DSGetNextPesPts(U8BIT *next_pts)
Get the PTS of the next PES packet, does not process next PES, but places on the next PES pointer...
Definition: stbdsc.c:1240
Definition: stbds.h:107
BOOLEAN STB_DSSegmentDDS(U8BIT *data, U16BIT pes_len, U16BIT processed_bytes)
Processes the Display Definition segment in accordance with ETSI document ETS 300 743...
Definition: stbdsfn.c:1877
BOOLEAN STB_DSSegmentODS(U8BIT *data, U16BIT pes_len, U16BIT processed_bytes)
Processes the Object Data segment in accordance with ETSI document ETS 300 743.
Definition: stbdsfn.c:2625
Definition: stbds.h:137
Definition: stbds.h:51
BOOLEAN STB_DSSegmentPCS(U8BIT *data, U16BIT pes_len, U16BIT processed_bytes, BOOLEAN force_acquisition)
Processes the Page Composition segment in accordance with ETSI document ETS 300 743.
Definition: stbdsfn.c:1972
BOOLEAN STB_DSSetDisplaySetPts(U8BIT path, U8BIT *pts)
Copies the passed PTS into the display set structure.
Definition: stbdsfn.c:2844
BOOLEAN STB_DSSegmentCDS(U8BIT *data, U16BIT pes_len, U16BIT processed_bytes)
Processes the CLUT Definition segment in accordance with ETSI document ETS 300 743.
Definition: stbdsfn.c:2475
void STB_DSCheckDisplaySetTimeout(S_DISPLAY_SET *subtitle_display_set, BOOLEAN timeout_override)
It checks the timeout of the current display set, and removes if/when necessary.
Definition: stbdsdis.c:1177
Definition: stbds.h:164
void STB_DSTerminateDisplayCycle(void)
Sets flag to exit display wait while loop.
Definition: stbdsdis.c:1387
BOOLEAN STB_DSSegmentRCS(U8BIT *data, U16BIT pes_len, U16BIT processed_bytes)
Processes the Region Composition segment in accordance with ETSI document ETS 300 743...
Definition: stbdsfn.c:2204
Definition: stbds.h:75
BOOLEAN STB_DSGetPesPts(U8BIT *data, U8BIT *pts)
Extracts the PTS from the PES packet header.
Definition: stbdsfn.c:2813
void STB_DSRenderBitmapToRegion(S_EPOCH_REGION *region_list, S_OBJECT *object, U8BIT *scan_line, U16BIT y, U16BIT w, U16BIT h)
For the passed region list [PCS specified] get region handle, load the region with the correct CLUT...
Definition: stbdsdis.c:1576
void STB_DSClearDisplaySetStruct(void)
Clears all information from the display set structure.
Definition: stbdsfn.c:2915
System Wide Global Technical Data Type Definitions.
void STB_DSResetPhysicalCompositionRegions(void)
Deletes all regions and clears serice_aquired flag.
Definition: stbdsdis.c:1354
void STB_DSClearCompositionPageDetails(void)
Clears all information from the display set composition page.
Definition: stbdsfn.c:2961
void STB_DSShow(void)
Allows subtitles to display what it has decoded.
Definition: stbdsdis.c:1277
BOOLEAN STB_DSSegmentEDS(U8BIT *data, U16BIT pes_len, U16BIT processed_bytes)
DTG - Digital Terrestrial Television Requirements for Interoperability Subtitling: 28 August 1998: Ve...
Definition: stbdsfn.c:2760
Definition: stbds.h:126