55 #define COLLATION_QUEUE_SIZE 400 61 #define EBU_DBG(x, ...) STB_SPDebugWrite( "%s:%d(%d)" x, __FUNCTION__,__LINE__,STB_OSGetClockMilliseconds(), ##__VA_ARGS__) 62 #define EBU_PRINT(x, ...) STB_SPDebugNoCnWrite(x, ##__VA_ARGS__) 63 #define EBU_TPRINT(x, ...) 65 #define EBU_DBG(x, ...) 66 #define EBU_PRINT(x, ...) 67 #define EBU_TPRINT(x, ...) 74 #define FUNCTION_START(x) STB_SPDebugWrite(">> %s\n", # x) 76 #ifdef FUNCTION_FINISH 77 #undef FUNCTION_FINISH 79 #define FUNCTION_FINISH(x) STB_SPDebugWrite("<< %s\n", # x) 83 #define PES_DATA_FIELD_WIDTH 46 86 #define HAMMING_8_4_DATA_MASK 0x000f 87 #define HAMMING_CORRECTION_MASK 0x03f0 88 #define HAMMING_ERROR_MASK 0xfc00 90 #define HAMMING_CORRECTION_COUNT(a) ((a & HAMMING_CORRECTION_MASK) >> 4) 91 #define HAMMING_ERROR_COUNT(a) ((a & HAMMING_ERROR_MASK) >> 10) 93 #define COLLATION_TASK_PRIORITY 10 94 #define COLLATION_TASK_STACK_SIZE 4096 96 #define DISPLAY_TASK_PRIORITY 10 97 #define DISPLAY_TASK_STACK_SIZE 4096 102 #define CACHE_PAGE_NUMBER_MASK 0x0fff 103 #define CACHE_PAGE_FLOF_REQUESTED 0x8000 104 #define CACHE_PAGE_HISTORY_REQUESTED 0x4000 105 #define CACHE_PAGE_PREVNEXT_REQUESTED 0x2000 106 #define CACHE_PAGE_LOCKED 0x1000 // set when displayed or requested! 109 #define PAGE_SUB_CODE_UNDEFINED 0xffff 112 #define MAX_HISTORY_CACHE_REQUESTS 32 117 #define MAX_EDITORIAL_LINKS 6 123 #define MAX_EDITORIAL_LINK_TIERS 5 127 #define NUM_NEXT_CACHE_REQUESTS 16 128 #define NUM_PREVIOUS_CACHE_REQUESTS 8 130 #define INVALID_PREVNEXT_CACHE_PAGE_NUMBER 0x1000 132 #define MAX_PAGE_HISTORY 32 138 #define PALETTE_BACKGROUND_TRANSPARENT 0 144 #define PALETTE_BACKGROUND_BLACK_FIXED 1 148 #define PALETTE_BACKGROUND_BLACK 2 149 #define PALETTE_BACKGROUND_RED 3 150 #define PALETTE_BACKGROUND_GREEN 4 151 #define PALETTE_BACKGROUND_YELLOW 5 152 #define PALETTE_BACKGROUND_BLUE 6 153 #define PALETTE_BACKGROUND_MAGENTA 7 154 #define PALETTE_BACKGROUND_CYAN 8 155 #define PALETTE_BACKGROUND_WHITE 9 159 #define PALETTE_FOREGROUND_BLACK 10 160 #define PALETTE_FOREGROUND_RED 11 161 #define PALETTE_FOREGROUND_GREEN 12 162 #define PALETTE_FOREGROUND_YELLOW 13 163 #define PALETTE_FOREGROUND_BLUE 14 164 #define PALETTE_FOREGROUND_MAGENTA 15 165 #define PALETTE_FOREGROUND_CYAN 16 166 #define PALETTE_FOREGROUND_WHITE 17 170 #define PALETTE_FOREGROUND_UNBOXED 0 177 #define PALETTE_EFFECT_ORIGIN 18 179 #define NUM_PALETTE_EFFECTS (256 - PALETTE_EFFECT_ORIGIN) 184 #define PALETTE_EFFECT_FLASH 0x01 185 #define PALETTE_EFFECT_CONCEAL 0x02 186 #define PALETTE_EFFECT_UNDEFINED 0 // Used as demarkation of first unused attribute array entry. 190 #define FONT_INDEX_LATIN_G0_SET 0 191 #define FONT_INDEX_LATIN_G2_SUPPLIMENTARY_SET 1 192 #define FONT_INDEX_CYRILLIC_G0_SET_OPTION_1_SERBIAN_CROATIAN 2 193 #define FONT_INDEX_CYRILLIC_G0_SET_OPTION_2_RUSSIAN_BULGARIAN 3 194 #define FONT_INDEX_CYRILLIC_G0_SET_OPTION_3_UKRANIAN 4 195 #define FONT_INDEX_CYRILLIC_G2_SUPPLIMENTARY_SET 5 196 #define FONT_INDEX_GREEK_G0_SET 6 197 #define FONT_INDEX_GREEK_G2_SUPPLIMENTARY_SET 7 198 #define FONT_INDEX_ARABIC_G0_SET 8 199 #define FONT_INDEX_ARABIC_G2_SUPPLIMENTARY_SET 9 200 #define FONT_INDEX_HEBREW_G0_SET 10 201 #define FONT_INDEX_G1_BLOCK_MOSAICS_SET 11 202 #define FONT_INDEX_G3_SMOOTH_MOSAICS_LINE_DRAWING_SET 12 204 #define FONT_INDEX_UNDEFINED 13 207 #define FONT_INDEX_NATIONAL_OPTION_SUBSET 14 208 #define FONT_INDEX_NO_BITMAP 15 214 #define NATIONALITY_INDEX_CZECH_SLOVAK 0 215 #define NATIONALITY_INDEX_ENGLISH 1 216 #define NATIONALITY_INDEX_ESTONIAN 2 217 #define NATIONALITY_INDEX_FRENCH 3 218 #define NATIONALITY_INDEX_GERMAN 4 219 #define NATIONALITY_INDEX_ITALIAN 5 220 #define NATIONALITY_INDEX_LETTISH_LITHUANIAN 6 221 #define NATIONALITY_INDEX_POLISH 7 222 #define NATIONALITY_INDEX_PORTUGUESE_SPANISH 8 223 #define NATIONALITY_INDEX_RUMANIAN 9 224 #define NATIONALITY_INDEX_SERB_CROAT_SLOVENIAN 10 225 #define NATIONALITY_INDEX_SWEDISH_FINNISH 11 226 #define NATIONALITY_INDEX_TURKISH 12 228 #define NATIONALITY_INDEX_UNDEFINED 13 231 #define TELETEXT_CHARACTER_FONT_INDEX_MASK 0x0f00 235 #define TELETEXT_CHARACTER_BITMAP_INDEX_MASK 0x00ff 238 #define TELETEXT_CHARACTER_DOUBLE_HEIGHT 0x8000 239 #define TELETEXT_CHARACTER_SEPERATED_MOSAIC 0x4000 245 #define MAX_DISPLAY_ZOOM_SCALAR 2 247 #define MAX_COLUMN 40 249 #define display_x_scalar 1 250 #define display_y_scalar 2 252 #define SUBTITLE_TIMEOUT 5000 256 typedef enum e_page_control_state
258 PAGE_CONTROL_STATE_IDLE,
261 PAGE_CONTROL_STATE_INPUT,
263 PAGE_CONTROL_STATE_HOLD
265 E_PAGE_CONTROL_STATE;
269 typedef enum e_request_type
271 REQUEST_TYPE_UNDEFINED = 0,
272 REQUEST_TYPE_EXPLICIT,
274 REQUEST_TYPE_NEXT_PREV_AVAILABLE,
275 REQUEST_TYPE_NEXT_PREV_VISITED,
276 REQUEST_TYPE_NEXT_PREV_SUB,
277 REQUEST_TYPE_EDITORIAL_LINK,
286 typedef enum E_PAGE_INDEX_DIGIT
304 PAGE_INDEX_DIGIT_UNDEFINED
310 typedef enum e_page_scale_status
312 PAGE_SCALE_STATUS_NORMAL = 0,
314 PAGE_SCALE_STATUS_ZOOM_TOP,
317 PAGE_SCALE_STATUS_ZOOM_BOTTOM
323 typedef enum e_page_reference_type
325 PAGE_REFERENCE_TYPE_HEADER,
327 PAGE_REFERENCE_TYPE_EDITORIAL_LINK,
329 PAGE_REFERENCE_TYPE_GLOBAL_INDEX
331 E_PAGE_REFERENCE_TYPE;
344 E_PAGE_CONTROL_STATE state;
348 U16BIT page_digit_offset;
352 BOOLEAN reveal_required;
354 BOOLEAN video_mix_required;
356 BOOLEAN clear_required;
375 U16BIT page_sub_code;
384 U16BIT target_page_number;
385 U16BIT target_page_sub_code;
396 BOOLEAN has_designation_code;
399 U8BIT lowest_designation_code;
400 U8BIT highest_designation_code;
408 U8BIT s_data[2][MAX_COLUMN];
409 BOOLEAN is_defined[2];
421 U8BIT header[MAX_COLUMN];
424 U8BIT editorial_page_linking_data[MAX_COLUMN];
428 BOOLEAN is_header_defined;
430 BOOLEAN is_editorial_page_linking_data_defined;
432 U16BIT basic_enhancement_data_defined_mask;
434 U32BIT display_data_defined_mask;
437 U8BIT basic_enhancement_data[16][MAX_COLUMN];
441 U8BIT display_data[MAX_ROWS][MAX_COLUMN];
497 U8BIT m_cache_valid_page_array[32];
511 U16BIT page_sub_code;
514 U16BIT magazine_number;
519 BOOLEAN suppress_header;
520 BOOLEAN update_indicator;
521 BOOLEAN interrupted_sequence;
522 BOOLEAN inhibit_display;
523 BOOLEAN magazine_serial;
524 U8BIT national_option_character_subset;
563 U16BIT link_page_number[MAX_EDITORIAL_LINKS];
564 U16BIT link_sub_code[MAX_EDITORIAL_LINKS];
565 void *link[MAX_EDITORIAL_LINKS];
593 U16BIT diacritic_info;
603 U8BIT foreground_index;
604 U8BIT background_index;
618 BOOLEAN fore_colour_used;
640 U16BIT page_sub_code;
650 BOOLEAN page_clock_valid;
652 BOOLEAN page_updated;
655 void *page_semaphore;
657 E_PAGE_INDEX_DIGIT page_index_digit[3];
658 BOOLEAN page_index_updated;
659 BOOLEAN page_index_held;
662 void *page_index_semaphore;
664 U16BIT carousel_page_number;
665 U8BIT carousel_page_header[MAX_COLUMN];
666 BOOLEAN carousel_page_updated;
669 void *carousel_page_semaphore;
671 U8BIT time_filler_header_data[32];
672 BOOLEAN clock_updated;
675 void *time_filler_header_data_semaphore;
677 E_PAGE_SCALE_STATUS page_scale_status;
678 U16BIT page_scale_start_row;
679 U16BIT page_scale_num_rows;
680 U16BIT page_scale_zoom_scalar;
681 BOOLEAN page_scale_params_defined;
682 BOOLEAN page_rescaled;
685 void *page_scale_semaphore;
699 BOOLEAN render_required;
702 BOOLEAN clear_screen;
711 BOOLEAN valid_row[MAX_ROWS];
712 BOOLEAN render_row[MAX_ROWS];
717 BOOLEAN palette_update_required;
722 BOOLEAN video_mix_set;
723 BOOLEAN video_mix_required;
728 BOOLEAN flash_required;
732 BOOLEAN reveal_required;
734 BOOLEAN reveal_available;
739 BOOLEAN clear_required;
748 U32BIT palette_array[256];
756 U8BIT national_option_subset_index;
763 U16BIT character_offset;
764 U8BIT diacritic_offset;
766 U8BIT alternative_font_index;
767 U16BIT alternative_character_offset;
774 U16BIT character_offset;
776 U16BIT alternative_character_offset;
794 { TRUE, FALSE, 0, 0 },
796 { TRUE, FALSE, 0, 0 }, { TRUE, FALSE, 0, 0 }, { TRUE, FALSE, 0, 0 },
797 { TRUE, FALSE, 0, 0 }, { TRUE, FALSE, 0, 0 }, { TRUE, FALSE, 0, 0 },
798 { TRUE, FALSE, 0, 0 }, { TRUE, FALSE, 0, 0 }, { TRUE, FALSE, 0, 0 },
799 { TRUE, FALSE, 0, 0 }, { TRUE, FALSE, 0, 0 }, { TRUE, FALSE, 0, 0 },
800 { TRUE, FALSE, 0, 0 }, { TRUE, FALSE, 0, 0 }, { TRUE, FALSE, 0, 0 },
801 { TRUE, FALSE, 0, 0 }, { TRUE, FALSE, 0, 0 }, { TRUE, FALSE, 0, 0 },
802 { TRUE, FALSE, 0, 0 }, { TRUE, FALSE, 0, 0 }, { TRUE, FALSE, 0, 0 },
803 { TRUE, FALSE, 0, 0 }, { TRUE, FALSE, 0, 0 }, { TRUE, FALSE, 0, 0 },
804 { TRUE, FALSE, 0, 0 },
806 { TRUE, TRUE, 0, 14 },
808 { TRUE, TRUE, 0, 0 },
811 { TRUE, TRUE, 0, 1 },
813 { TRUE, TRUE, 1, 1 },
815 { TRUE, TRUE, 0, 3 },
817 { FALSE, TRUE, 0, 31 }
830 static const U16BIT hamming_8_4_table[256] =
832 0x0011, 0x040f, 0x040f, 0x0018, 0x040f, 0x001c, 0x0014, 0x040f,
833 0x040f, 0x0018, 0x0018, 0x0008, 0x0016, 0x040f, 0x040f, 0x0018,
834 0x040f, 0x001a, 0x0012, 0x040f, 0x0016, 0x040f, 0x040f, 0x001f,
835 0x0016, 0x040f, 0x040f, 0x0018, 0x0006, 0x0016, 0x0016, 0x040f,
836 0x040f, 0x001a, 0x0014, 0x040f, 0x0014, 0x040f, 0x0004, 0x0014,
837 0x0010, 0x040f, 0x040f, 0x0018, 0x040f, 0x001d, 0x0014, 0x040f,
838 0x001a, 0x000a, 0x040f, 0x001a, 0x040f, 0x001a, 0x0014, 0x040f,
839 0x040f, 0x001a, 0x0013, 0x040f, 0x0016, 0x040f, 0x040f, 0x001e,
840 0x0001, 0x0011, 0x0011, 0x040f, 0x0011, 0x040f, 0x040f, 0x001f,
841 0x0011, 0x040f, 0x040f, 0x0018, 0x040f, 0x001d, 0x0015, 0x040f,
842 0x0011, 0x040f, 0x040f, 0x001f, 0x040f, 0x001f, 0x001f, 0x000f,
843 0x040f, 0x001b, 0x0013, 0x040f, 0x0016, 0x040f, 0x040f, 0x001f,
844 0x0011, 0x040f, 0x040f, 0x0019, 0x040f, 0x001d, 0x0014, 0x040f,
845 0x040f, 0x001d, 0x0013, 0x040f, 0x001d, 0x000d, 0x040f, 0x001d,
846 0x040f, 0x001a, 0x0013, 0x040f, 0x0017, 0x040f, 0x040f, 0x001f,
847 0x0013, 0x040f, 0x0003, 0x0013, 0x040f, 0x001d, 0x0013, 0x040f,
848 0x040f, 0x001c, 0x0012, 0x040f, 0x001c, 0x000c, 0x040f, 0x001c,
849 0x0010, 0x040f, 0x040f, 0x0018, 0x040f, 0x001c, 0x0015, 0x040f,
850 0x0012, 0x040f, 0x0002, 0x0012, 0x040f, 0x001c, 0x0012, 0x040f,
851 0x040f, 0x001b, 0x0012, 0x040f, 0x0016, 0x040f, 0x040f, 0x001e,
852 0x0010, 0x040f, 0x040f, 0x0019, 0x040f, 0x001c, 0x0014, 0x040f,
853 0x0000, 0x0010, 0x0010, 0x040f, 0x0010, 0x040f, 0x040f, 0x001e,
854 0x040f, 0x001a, 0x0012, 0x040f, 0x0017, 0x040f, 0x040f, 0x001e,
855 0x0010, 0x040f, 0x040f, 0x001e, 0x040f, 0x001e, 0x001e, 0x000e,
856 0x0011, 0x040f, 0x040f, 0x0019, 0x040f, 0x001c, 0x0015, 0x040f,
857 0x040f, 0x001b, 0x0015, 0x040f, 0x0015, 0x040f, 0x0005, 0x0015,
858 0x040f, 0x001b, 0x0012, 0x040f, 0x0017, 0x040f, 0x040f, 0x001f,
859 0x001b, 0x000b, 0x040f, 0x001b, 0x040f, 0x001b, 0x0015, 0x040f,
860 0x040f, 0x0019, 0x0019, 0x0009, 0x0017, 0x040f, 0x040f, 0x0019,
861 0x0010, 0x040f, 0x040f, 0x0019, 0x040f, 0x001d, 0x0015, 0x040f,
862 0x0017, 0x040f, 0x040f, 0x0019, 0x0007, 0x0017, 0x0017, 0x040f,
863 0x040f, 0x001b, 0x0013, 0x040f, 0x0017, 0x040f, 0x040f, 0x001e
873 static const U8BIT hamming_24_18_parity_table[3][256] =
876 0, 40, 39, 15, 38, 14, 1, 41, 37, 13, 2, 42, 3, 43, 36, 12,
877 36, 12, 3, 43, 2, 42, 37, 13, 1, 41, 38, 14, 39, 15, 0, 40,
878 35, 11, 4, 44, 5, 45, 34, 10, 6, 46, 33, 9, 32, 8, 7, 47,
879 7, 47, 32, 8, 33, 9, 6, 46, 34, 10, 5, 45, 4, 44, 35, 11,
880 34, 10, 5, 45, 4, 44, 35, 11, 7, 47, 32, 8, 33, 9, 6, 46,
881 6, 46, 33, 9, 32, 8, 7, 47, 35, 11, 4, 44, 5, 45, 34, 10,
882 1, 41, 38, 14, 39, 15, 0, 40, 36, 12, 3, 43, 2, 42, 37, 13,
883 37, 13, 2, 42, 3, 43, 36, 12, 0, 40, 39, 15, 38, 14, 1, 41,
884 33, 9, 6, 46, 7, 47, 32, 8, 4, 44, 35, 11, 34, 10, 5, 45,
885 5, 45, 34, 10, 35, 11, 4, 44, 32, 8, 7, 47, 6, 46, 33, 9,
886 2, 42, 37, 13, 36, 12, 3, 43, 39, 15, 0, 40, 1, 41, 38, 14,
887 38, 14, 1, 41, 0, 40, 39, 15, 3, 43, 36, 12, 37, 13, 2, 42,
888 3, 43, 36, 12, 37, 13, 2, 42, 38, 14, 1, 41, 0, 40, 39, 15,
889 39, 15, 0, 40, 1, 41, 38, 14, 2, 42, 37, 13, 36, 12, 3, 43,
890 32, 8, 7, 47, 6, 46, 33, 9, 5, 45, 34, 10, 35, 11, 4, 44,
891 4, 44, 35, 11, 34, 10, 5, 45, 33, 9, 6, 46, 7, 47, 32, 8
894 0, 48, 47, 31, 46, 30, 1, 49, 45, 29, 2, 50, 3, 51, 44, 28,
895 44, 28, 3, 51, 2, 50, 45, 29, 1, 49, 46, 30, 47, 31, 0, 48,
896 43, 27, 4, 52, 5, 53, 42, 26, 6, 54, 41, 25, 40, 24, 7, 55,
897 7, 55, 40, 24, 41, 25, 6, 54, 42, 26, 5, 53, 4, 52, 43, 27,
898 42, 26, 5, 53, 4, 52, 43, 27, 7, 55, 40, 24, 41, 25, 6, 54,
899 6, 54, 41, 25, 40, 24, 7, 55, 43, 27, 4, 52, 5, 53, 42, 26,
900 1, 49, 46, 30, 47, 31, 0, 48, 44, 28, 3, 51, 2, 50, 45, 29,
901 45, 29, 2, 50, 3, 51, 44, 28, 0, 48, 47, 31, 46, 30, 1, 49,
902 41, 25, 6, 54, 7, 55, 40, 24, 4, 52, 43, 27, 42, 26, 5, 53,
903 5, 53, 42, 26, 43, 27, 4, 52, 40, 24, 7, 55, 6, 54, 41, 25,
904 2, 50, 45, 29, 44, 28, 3, 51, 47, 31, 0, 48, 1, 49, 46, 30,
905 46, 30, 1, 49, 0, 48, 47, 31, 3, 51, 44, 28, 45, 29, 2, 50,
906 3, 51, 44, 28, 45, 29, 2, 50, 46, 30, 1, 49, 0, 48, 47, 31,
907 47, 31, 0, 48, 1, 49, 46, 30, 2, 50, 45, 29, 44, 28, 3, 51,
908 40, 24, 7, 55, 6, 54, 41, 25, 5, 53, 42, 26, 43, 27, 4, 52,
909 4, 52, 43, 27, 42, 26, 5, 53, 41, 25, 6, 54, 7, 55, 40, 24
912 63, 31, 8, 40, 9, 41, 62, 30, 10, 42, 61, 29, 60, 28, 11, 43,
913 11, 43, 60, 28, 61, 29, 10, 42, 62, 30, 9, 41, 8, 40, 63, 31,
914 12, 44, 59, 27, 58, 26, 13, 45, 57, 25, 14, 46, 15, 47, 56, 24,
915 56, 24, 15, 47, 14, 46, 57, 25, 13, 45, 58, 26, 59, 27, 12, 44,
916 13, 45, 58, 26, 59, 27, 12, 44, 56, 24, 15, 47, 14, 46, 57, 25,
917 57, 25, 14, 46, 15, 47, 56, 24, 12, 44, 59, 27, 58, 26, 13, 45,
918 62, 30, 9, 41, 8, 40, 63, 31, 11, 43, 60, 28, 61, 29, 10, 42,
919 10, 42, 61, 29, 60, 28, 11, 43, 63, 31, 8, 40, 9, 41, 62, 30,
920 14, 46, 57, 25, 56, 24, 15, 47, 59, 27, 12, 44, 13, 45, 58, 26,
921 58, 26, 13, 45, 12, 44, 59, 27, 15, 47, 56, 24, 57, 25, 14, 46,
922 61, 29, 10, 42, 11, 43, 60, 28, 8, 40, 63, 31, 62, 30, 9, 41,
923 9, 41, 62, 30, 63, 31, 8, 40, 60, 28, 11, 43, 10, 42, 61, 29,
924 60, 28, 11, 43, 10, 42, 61, 29, 9, 41, 62, 30, 63, 31, 8, 40,
925 8, 40, 63, 31, 62, 30, 9, 41, 61, 29, 10, 42, 11, 43, 60, 28,
926 15, 47, 56, 24, 57, 25, 14, 46, 58, 26, 13, 45, 12, 44, 59, 27,
927 59, 27, 12, 44, 13, 45, 58, 26, 14, 46, 57, 25, 56, 24, 15, 47
934 static const U8BIT hamming_24_18_first_byte_table[256] =
936 0, 0, 8, 8, 4, 4, 12, 12, 2, 2, 10, 10, 6, 6, 14, 14,
937 0, 0, 8, 8, 4, 4, 12, 12, 2, 2, 10, 10, 6, 6, 14, 14,
938 1, 1, 9, 9, 5, 5, 13, 13, 3, 3, 11, 11, 7, 7, 15, 15,
939 1, 1, 9, 9, 5, 5, 13, 13, 3, 3, 11, 11, 7, 7, 15, 15,
940 0, 0, 8, 8, 4, 4, 12, 12, 2, 2, 10, 10, 6, 6, 14, 14,
941 0, 0, 8, 8, 4, 4, 12, 12, 2, 2, 10, 10, 6, 6, 14, 14,
942 1, 1, 9, 9, 5, 5, 13, 13, 3, 3, 11, 11, 7, 7, 15, 15,
943 1, 1, 9, 9, 5, 5, 13, 13, 3, 3, 11, 11, 7, 7, 15, 15,
944 0, 0, 8, 8, 4, 4, 12, 12, 2, 2, 10, 10, 6, 6, 14, 14,
945 0, 0, 8, 8, 4, 4, 12, 12, 2, 2, 10, 10, 6, 6, 14, 14,
946 1, 1, 9, 9, 5, 5, 13, 13, 3, 3, 11, 11, 7, 7, 15, 15,
947 1, 1, 9, 9, 5, 5, 13, 13, 3, 3, 11, 11, 7, 7, 15, 15,
948 0, 0, 8, 8, 4, 4, 12, 12, 2, 2, 10, 10, 6, 6, 14, 14,
949 0, 0, 8, 8, 4, 4, 12, 12, 2, 2, 10, 10, 6, 6, 14, 14,
950 1, 1, 9, 9, 5, 5, 13, 13, 3, 3, 11, 11, 7, 7, 15, 15,
951 1, 1, 9, 9, 5, 5, 13, 13, 3, 3, 11, 11, 7, 7, 15, 15
956 static const U8BIT hamming_24_18_other_bytes_table[256] =
958 0x00, 0x00, 0x40, 0x40, 0x20, 0x20, 0x60, 0x60, 0x10, 0x10, 0x50, 0x50, 0x30, 0x30, 0x70, 0x70,
959 0x08, 0x08, 0x48, 0x48, 0x28, 0x28, 0x68, 0x68, 0x18, 0x18, 0x58, 0x58, 0x38, 0x38, 0x78, 0x78,
960 0x04, 0x04, 0x44, 0x44, 0x24, 0x24, 0x64, 0x64, 0x14, 0x14, 0x54, 0x54, 0x34, 0x34, 0x74, 0x74,
961 0x0c, 0x0c, 0x4c, 0x4c, 0x2c, 0x2c, 0x6c, 0x6c, 0x1c, 0x1c, 0x5c, 0x5c, 0x3c, 0x3c, 0x7c, 0x7c,
962 0x02, 0x02, 0x42, 0x42, 0x22, 0x22, 0x62, 0x62, 0x12, 0x12, 0x52, 0x52, 0x32, 0x32, 0x72, 0x72,
963 0x0a, 0x0a, 0x4a, 0x4a, 0x2a, 0x2a, 0x6a, 0x6a, 0x1a, 0x1a, 0x5a, 0x5a, 0x3a, 0x3a, 0x7a, 0x7a,
964 0x06, 0x06, 0x46, 0x46, 0x26, 0x26, 0x66, 0x66, 0x16, 0x16, 0x56, 0x56, 0x36, 0x36, 0x76, 0x76,
965 0x0e, 0x0e, 0x4e, 0x4e, 0x2e, 0x2e, 0x6e, 0x6e, 0x1e, 0x1e, 0x5e, 0x5e, 0x3e, 0x3e, 0x7e, 0x7e,
966 0x01, 0x01, 0x41, 0x41, 0x21, 0x21, 0x61, 0x61, 0x11, 0x11, 0x51, 0x51, 0x31, 0x31, 0x71, 0x71,
967 0x09, 0x09, 0x49, 0x49, 0x29, 0x29, 0x69, 0x69, 0x19, 0x19, 0x59, 0x59, 0x39, 0x39, 0x79, 0x79,
968 0x05, 0x05, 0x45, 0x45, 0x25, 0x25, 0x65, 0x65, 0x15, 0x15, 0x55, 0x55, 0x35, 0x35, 0x75, 0x75,
969 0x0d, 0x0d, 0x4d, 0x4d, 0x2d, 0x2d, 0x6d, 0x6d, 0x1d, 0x1d, 0x5d, 0x5d, 0x3d, 0x3d, 0x7d, 0x7d,
970 0x03, 0x03, 0x43, 0x43, 0x23, 0x23, 0x63, 0x63, 0x13, 0x13, 0x53, 0x53, 0x33, 0x33, 0x73, 0x73,
971 0x0b, 0x0b, 0x4b, 0x4b, 0x2b, 0x2b, 0x6b, 0x6b, 0x1b, 0x1b, 0x5b, 0x5b, 0x3b, 0x3b, 0x7b, 0x7b,
972 0x07, 0x07, 0x47, 0x47, 0x27, 0x27, 0x67, 0x67, 0x17, 0x17, 0x57, 0x57, 0x37, 0x37, 0x77, 0x77,
973 0x0f, 0x0f, 0x4f, 0x4f, 0x2f, 0x2f, 0x6f, 0x6f, 0x1f, 0x1f, 0x5f, 0x5f, 0x3f, 0x3f, 0x7f, 0x7f
983 static const U16BIT hamming_24_18_error_table[64] =
985 0x0000, 0x0400, 0x0400, 0x0400, 0x0400, 0x0400, 0x0400, 0x0400,
986 0x0400, 0x0400, 0x0400, 0x0400, 0x0400, 0x0400, 0x0400, 0x0400,
987 0x0400, 0x0400, 0x0400, 0x0400, 0x0400, 0x0400, 0x0400, 0x0400,
988 0x0400, 0x0400, 0x0400, 0x0400, 0x0400, 0x0400, 0x0400, 0x0400,
989 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010,
990 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010,
991 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010,
992 0x0400, 0x0400, 0x0400, 0x0400, 0x0400, 0x0400, 0x0400, 0x0400
999 static const U32BIT hamming_24_18_correction_table[64] =
1001 0x00000L, 0x00000L, 0x00000L, 0x00000L, 0x00000L, 0x00000L, 0x00000L, 0x00000L,
1002 0x00000L, 0x00000L, 0x00000L, 0x00000L, 0x00000L, 0x00000L, 0x00000L, 0x00000L,
1003 0x00000L, 0x00000L, 0x00000L, 0x00000L, 0x00000L, 0x00000L, 0x00000L, 0x00000L,
1004 0x00000L, 0x00000L, 0x00000L, 0x00000L, 0x00000L, 0x00000L, 0x00000L, 0x00000L,
1005 0x00000L, 0x00000L, 0x00000L, 0x00001L, 0x00000L, 0x00002L, 0x00004L, 0x00008L,
1006 0x00000L, 0x00010L, 0x00020L, 0x00040L, 0x00080L, 0x00100L, 0x00200L, 0x00400L,
1007 0x00000L, 0x00800L, 0x01000L, 0x02000L, 0x04000L, 0x08000L, 0x10000L, 0x20000L,
1008 0x00000L, 0x00000L, 0x00000L, 0x00000L, 0x00000L, 0x00000L, 0x00000L, 0x00000L
1018 { FONT_INDEX_LATIN_G0_SET, FONT_INDEX_LATIN_G2_SUPPLIMENTARY_SET, NATIONALITY_INDEX_ENGLISH },
1019 { FONT_INDEX_LATIN_G0_SET, FONT_INDEX_LATIN_G2_SUPPLIMENTARY_SET, NATIONALITY_INDEX_GERMAN },
1020 { FONT_INDEX_LATIN_G0_SET, FONT_INDEX_LATIN_G2_SUPPLIMENTARY_SET, NATIONALITY_INDEX_SWEDISH_FINNISH },
1021 { FONT_INDEX_LATIN_G0_SET, FONT_INDEX_LATIN_G2_SUPPLIMENTARY_SET, NATIONALITY_INDEX_ITALIAN },
1022 { FONT_INDEX_LATIN_G0_SET, FONT_INDEX_LATIN_G2_SUPPLIMENTARY_SET, NATIONALITY_INDEX_FRENCH },
1023 { FONT_INDEX_LATIN_G0_SET, FONT_INDEX_LATIN_G2_SUPPLIMENTARY_SET, NATIONALITY_INDEX_PORTUGUESE_SPANISH },
1024 { FONT_INDEX_LATIN_G0_SET, FONT_INDEX_LATIN_G2_SUPPLIMENTARY_SET, NATIONALITY_INDEX_CZECH_SLOVAK },
1025 { FONT_INDEX_LATIN_G0_SET, FONT_INDEX_LATIN_G2_SUPPLIMENTARY_SET, NATIONALITY_INDEX_UNDEFINED },
1027 { FONT_INDEX_LATIN_G0_SET, FONT_INDEX_LATIN_G2_SUPPLIMENTARY_SET, NATIONALITY_INDEX_POLISH },
1028 { FONT_INDEX_LATIN_G0_SET, FONT_INDEX_LATIN_G2_SUPPLIMENTARY_SET, NATIONALITY_INDEX_GERMAN },
1029 { FONT_INDEX_LATIN_G0_SET, FONT_INDEX_LATIN_G2_SUPPLIMENTARY_SET, NATIONALITY_INDEX_SWEDISH_FINNISH },
1030 { FONT_INDEX_LATIN_G0_SET, FONT_INDEX_LATIN_G2_SUPPLIMENTARY_SET, NATIONALITY_INDEX_ITALIAN },
1031 { FONT_INDEX_LATIN_G0_SET, FONT_INDEX_LATIN_G2_SUPPLIMENTARY_SET, NATIONALITY_INDEX_FRENCH },
1032 { FONT_INDEX_LATIN_G0_SET, FONT_INDEX_LATIN_G2_SUPPLIMENTARY_SET, NATIONALITY_INDEX_UNDEFINED },
1033 { FONT_INDEX_LATIN_G0_SET, FONT_INDEX_LATIN_G2_SUPPLIMENTARY_SET, NATIONALITY_INDEX_CZECH_SLOVAK },
1034 { FONT_INDEX_LATIN_G0_SET, FONT_INDEX_LATIN_G2_SUPPLIMENTARY_SET, NATIONALITY_INDEX_UNDEFINED },
1036 { FONT_INDEX_LATIN_G0_SET, FONT_INDEX_LATIN_G2_SUPPLIMENTARY_SET, NATIONALITY_INDEX_ENGLISH },
1037 { FONT_INDEX_LATIN_G0_SET, FONT_INDEX_LATIN_G2_SUPPLIMENTARY_SET, NATIONALITY_INDEX_GERMAN },
1038 { FONT_INDEX_LATIN_G0_SET, FONT_INDEX_LATIN_G2_SUPPLIMENTARY_SET, NATIONALITY_INDEX_SWEDISH_FINNISH },
1039 { FONT_INDEX_LATIN_G0_SET, FONT_INDEX_LATIN_G2_SUPPLIMENTARY_SET, NATIONALITY_INDEX_ITALIAN },
1040 { FONT_INDEX_LATIN_G0_SET, FONT_INDEX_LATIN_G2_SUPPLIMENTARY_SET, NATIONALITY_INDEX_FRENCH },
1041 { FONT_INDEX_LATIN_G0_SET, FONT_INDEX_LATIN_G2_SUPPLIMENTARY_SET, NATIONALITY_INDEX_PORTUGUESE_SPANISH },
1042 { FONT_INDEX_LATIN_G0_SET, FONT_INDEX_LATIN_G2_SUPPLIMENTARY_SET, NATIONALITY_INDEX_TURKISH },
1043 { FONT_INDEX_LATIN_G0_SET, FONT_INDEX_LATIN_G2_SUPPLIMENTARY_SET, NATIONALITY_INDEX_UNDEFINED },
1045 { FONT_INDEX_LATIN_G0_SET, FONT_INDEX_LATIN_G2_SUPPLIMENTARY_SET, NATIONALITY_INDEX_UNDEFINED },
1046 { FONT_INDEX_LATIN_G0_SET, FONT_INDEX_LATIN_G2_SUPPLIMENTARY_SET, NATIONALITY_INDEX_UNDEFINED },
1047 { FONT_INDEX_LATIN_G0_SET, FONT_INDEX_LATIN_G2_SUPPLIMENTARY_SET, NATIONALITY_INDEX_UNDEFINED },
1048 { FONT_INDEX_LATIN_G0_SET, FONT_INDEX_LATIN_G2_SUPPLIMENTARY_SET, NATIONALITY_INDEX_UNDEFINED },
1049 { FONT_INDEX_LATIN_G0_SET, FONT_INDEX_LATIN_G2_SUPPLIMENTARY_SET, NATIONALITY_INDEX_UNDEFINED },
1050 { FONT_INDEX_LATIN_G0_SET, FONT_INDEX_LATIN_G2_SUPPLIMENTARY_SET, NATIONALITY_INDEX_SERB_CROAT_SLOVENIAN },
1051 { FONT_INDEX_LATIN_G0_SET, FONT_INDEX_LATIN_G2_SUPPLIMENTARY_SET, NATIONALITY_INDEX_UNDEFINED },
1052 { FONT_INDEX_LATIN_G0_SET, FONT_INDEX_LATIN_G2_SUPPLIMENTARY_SET, NATIONALITY_INDEX_RUMANIAN },
1054 { FONT_INDEX_CYRILLIC_G0_SET_OPTION_1_SERBIAN_CROATIAN, FONT_INDEX_CYRILLIC_G2_SUPPLIMENTARY_SET, NATIONALITY_INDEX_UNDEFINED },
1055 { FONT_INDEX_LATIN_G0_SET, FONT_INDEX_LATIN_G2_SUPPLIMENTARY_SET, NATIONALITY_INDEX_GERMAN },
1056 { FONT_INDEX_LATIN_G0_SET, FONT_INDEX_LATIN_G2_SUPPLIMENTARY_SET, NATIONALITY_INDEX_ESTONIAN },
1057 { FONT_INDEX_LATIN_G0_SET, FONT_INDEX_LATIN_G2_SUPPLIMENTARY_SET, NATIONALITY_INDEX_LETTISH_LITHUANIAN },
1058 { FONT_INDEX_CYRILLIC_G0_SET_OPTION_2_RUSSIAN_BULGARIAN, FONT_INDEX_CYRILLIC_G2_SUPPLIMENTARY_SET, NATIONALITY_INDEX_UNDEFINED },
1059 { FONT_INDEX_CYRILLIC_G0_SET_OPTION_3_UKRANIAN, FONT_INDEX_CYRILLIC_G2_SUPPLIMENTARY_SET, NATIONALITY_INDEX_UNDEFINED },
1060 { FONT_INDEX_LATIN_G0_SET, FONT_INDEX_LATIN_G2_SUPPLIMENTARY_SET, NATIONALITY_INDEX_CZECH_SLOVAK },
1061 { FONT_INDEX_UNDEFINED, FONT_INDEX_UNDEFINED, NATIONALITY_INDEX_UNDEFINED },
1063 { FONT_INDEX_UNDEFINED, FONT_INDEX_UNDEFINED, NATIONALITY_INDEX_UNDEFINED },
1064 { FONT_INDEX_UNDEFINED, FONT_INDEX_UNDEFINED, NATIONALITY_INDEX_UNDEFINED },
1065 { FONT_INDEX_UNDEFINED, FONT_INDEX_UNDEFINED, NATIONALITY_INDEX_UNDEFINED },
1066 { FONT_INDEX_UNDEFINED, FONT_INDEX_UNDEFINED, NATIONALITY_INDEX_UNDEFINED },
1067 { FONT_INDEX_UNDEFINED, FONT_INDEX_UNDEFINED, NATIONALITY_INDEX_UNDEFINED },
1068 { FONT_INDEX_UNDEFINED, FONT_INDEX_UNDEFINED, NATIONALITY_INDEX_UNDEFINED },
1069 { FONT_INDEX_UNDEFINED, FONT_INDEX_UNDEFINED, NATIONALITY_INDEX_UNDEFINED },
1070 { FONT_INDEX_UNDEFINED, FONT_INDEX_UNDEFINED, NATIONALITY_INDEX_UNDEFINED },
1072 { FONT_INDEX_UNDEFINED, FONT_INDEX_UNDEFINED, NATIONALITY_INDEX_UNDEFINED },
1073 { FONT_INDEX_UNDEFINED, FONT_INDEX_UNDEFINED, NATIONALITY_INDEX_UNDEFINED },
1074 { FONT_INDEX_UNDEFINED, FONT_INDEX_UNDEFINED, NATIONALITY_INDEX_UNDEFINED },
1075 { FONT_INDEX_UNDEFINED, FONT_INDEX_UNDEFINED, NATIONALITY_INDEX_UNDEFINED },
1076 { FONT_INDEX_UNDEFINED, FONT_INDEX_UNDEFINED, NATIONALITY_INDEX_UNDEFINED },
1077 { FONT_INDEX_UNDEFINED, FONT_INDEX_UNDEFINED, NATIONALITY_INDEX_UNDEFINED },
1078 { FONT_INDEX_LATIN_G0_SET, FONT_INDEX_LATIN_G2_SUPPLIMENTARY_SET, NATIONALITY_INDEX_TURKISH },
1079 { FONT_INDEX_GREEK_G0_SET, FONT_INDEX_GREEK_G2_SUPPLIMENTARY_SET, NATIONALITY_INDEX_UNDEFINED },
1081 { FONT_INDEX_UNDEFINED, FONT_INDEX_UNDEFINED, NATIONALITY_INDEX_UNDEFINED },
1082 { FONT_INDEX_UNDEFINED, FONT_INDEX_UNDEFINED, NATIONALITY_INDEX_UNDEFINED },
1083 { FONT_INDEX_UNDEFINED, FONT_INDEX_UNDEFINED, NATIONALITY_INDEX_UNDEFINED },
1084 { FONT_INDEX_UNDEFINED, FONT_INDEX_UNDEFINED, NATIONALITY_INDEX_UNDEFINED },
1085 { FONT_INDEX_UNDEFINED, FONT_INDEX_UNDEFINED, NATIONALITY_INDEX_UNDEFINED },
1086 { FONT_INDEX_UNDEFINED, FONT_INDEX_UNDEFINED, NATIONALITY_INDEX_UNDEFINED },
1087 { FONT_INDEX_UNDEFINED, FONT_INDEX_UNDEFINED, NATIONALITY_INDEX_UNDEFINED },
1088 { FONT_INDEX_UNDEFINED, FONT_INDEX_UNDEFINED, NATIONALITY_INDEX_UNDEFINED },
1090 { FONT_INDEX_LATIN_G0_SET, FONT_INDEX_ARABIC_G2_SUPPLIMENTARY_SET, NATIONALITY_INDEX_ENGLISH },
1091 { FONT_INDEX_UNDEFINED, FONT_INDEX_UNDEFINED, NATIONALITY_INDEX_UNDEFINED },
1092 { FONT_INDEX_UNDEFINED, FONT_INDEX_UNDEFINED, NATIONALITY_INDEX_UNDEFINED },
1093 { FONT_INDEX_UNDEFINED, FONT_INDEX_UNDEFINED, NATIONALITY_INDEX_UNDEFINED },
1094 { FONT_INDEX_LATIN_G0_SET, FONT_INDEX_ARABIC_G2_SUPPLIMENTARY_SET, NATIONALITY_INDEX_FRENCH },
1095 { FONT_INDEX_UNDEFINED, FONT_INDEX_UNDEFINED, NATIONALITY_INDEX_UNDEFINED },
1096 { FONT_INDEX_UNDEFINED, FONT_INDEX_UNDEFINED, NATIONALITY_INDEX_UNDEFINED },
1097 { FONT_INDEX_ARABIC_G0_SET, FONT_INDEX_ARABIC_G2_SUPPLIMENTARY_SET, NATIONALITY_INDEX_UNDEFINED },
1099 { FONT_INDEX_UNDEFINED, FONT_INDEX_UNDEFINED, NATIONALITY_INDEX_UNDEFINED },
1100 { FONT_INDEX_UNDEFINED, FONT_INDEX_UNDEFINED, NATIONALITY_INDEX_UNDEFINED },
1101 { FONT_INDEX_UNDEFINED, FONT_INDEX_UNDEFINED, NATIONALITY_INDEX_UNDEFINED },
1102 { FONT_INDEX_UNDEFINED, FONT_INDEX_UNDEFINED, NATIONALITY_INDEX_UNDEFINED },
1103 { FONT_INDEX_UNDEFINED, FONT_INDEX_UNDEFINED, NATIONALITY_INDEX_UNDEFINED },
1104 { FONT_INDEX_UNDEFINED, FONT_INDEX_UNDEFINED, NATIONALITY_INDEX_UNDEFINED },
1105 { FONT_INDEX_UNDEFINED, FONT_INDEX_UNDEFINED, NATIONALITY_INDEX_UNDEFINED },
1106 { FONT_INDEX_UNDEFINED, FONT_INDEX_UNDEFINED, NATIONALITY_INDEX_UNDEFINED },
1108 { FONT_INDEX_UNDEFINED, FONT_INDEX_ARABIC_G2_SUPPLIMENTARY_SET, NATIONALITY_INDEX_UNDEFINED },
1109 { FONT_INDEX_UNDEFINED, FONT_INDEX_UNDEFINED, NATIONALITY_INDEX_UNDEFINED },
1110 { FONT_INDEX_UNDEFINED, FONT_INDEX_UNDEFINED, NATIONALITY_INDEX_UNDEFINED },
1111 { FONT_INDEX_UNDEFINED, FONT_INDEX_UNDEFINED, NATIONALITY_INDEX_UNDEFINED },
1112 { FONT_INDEX_UNDEFINED, FONT_INDEX_UNDEFINED, NATIONALITY_INDEX_UNDEFINED },
1113 { FONT_INDEX_HEBREW_G0_SET, FONT_INDEX_ARABIC_G2_SUPPLIMENTARY_SET, NATIONALITY_INDEX_UNDEFINED },
1114 { FONT_INDEX_UNDEFINED, FONT_INDEX_UNDEFINED, NATIONALITY_INDEX_UNDEFINED },
1115 { FONT_INDEX_ARABIC_G0_SET, FONT_INDEX_ARABIC_G2_SUPPLIMENTARY_SET, NATIONALITY_INDEX_UNDEFINED },
1117 { FONT_INDEX_UNDEFINED, FONT_INDEX_UNDEFINED, NATIONALITY_INDEX_UNDEFINED },
1118 { FONT_INDEX_UNDEFINED, FONT_INDEX_UNDEFINED, NATIONALITY_INDEX_UNDEFINED },
1119 { FONT_INDEX_UNDEFINED, FONT_INDEX_UNDEFINED, NATIONALITY_INDEX_UNDEFINED },
1120 { FONT_INDEX_UNDEFINED, FONT_INDEX_UNDEFINED, NATIONALITY_INDEX_UNDEFINED },
1121 { FONT_INDEX_UNDEFINED, FONT_INDEX_UNDEFINED, NATIONALITY_INDEX_UNDEFINED },
1122 { FONT_INDEX_UNDEFINED, FONT_INDEX_UNDEFINED, NATIONALITY_INDEX_UNDEFINED },
1123 { FONT_INDEX_UNDEFINED, FONT_INDEX_UNDEFINED, NATIONALITY_INDEX_UNDEFINED },
1124 { FONT_INDEX_UNDEFINED, FONT_INDEX_UNDEFINED, NATIONALITY_INDEX_UNDEFINED },
1126 { FONT_INDEX_UNDEFINED, FONT_INDEX_UNDEFINED, NATIONALITY_INDEX_UNDEFINED },
1127 { FONT_INDEX_UNDEFINED, FONT_INDEX_UNDEFINED, NATIONALITY_INDEX_UNDEFINED },
1128 { FONT_INDEX_UNDEFINED, FONT_INDEX_UNDEFINED, NATIONALITY_INDEX_UNDEFINED },
1129 { FONT_INDEX_UNDEFINED, FONT_INDEX_UNDEFINED, NATIONALITY_INDEX_UNDEFINED },
1130 { FONT_INDEX_UNDEFINED, FONT_INDEX_UNDEFINED, NATIONALITY_INDEX_UNDEFINED },
1131 { FONT_INDEX_UNDEFINED, FONT_INDEX_UNDEFINED, NATIONALITY_INDEX_UNDEFINED },
1132 { FONT_INDEX_UNDEFINED, FONT_INDEX_UNDEFINED, NATIONALITY_INDEX_UNDEFINED },
1133 { FONT_INDEX_UNDEFINED, FONT_INDEX_UNDEFINED, NATIONALITY_INDEX_UNDEFINED },
1135 { FONT_INDEX_UNDEFINED, FONT_INDEX_UNDEFINED, NATIONALITY_INDEX_UNDEFINED },
1136 { FONT_INDEX_UNDEFINED, FONT_INDEX_UNDEFINED, NATIONALITY_INDEX_UNDEFINED },
1137 { FONT_INDEX_UNDEFINED, FONT_INDEX_UNDEFINED, NATIONALITY_INDEX_UNDEFINED },
1138 { FONT_INDEX_UNDEFINED, FONT_INDEX_UNDEFINED, NATIONALITY_INDEX_UNDEFINED },
1139 { FONT_INDEX_UNDEFINED, FONT_INDEX_UNDEFINED, NATIONALITY_INDEX_UNDEFINED },
1140 { FONT_INDEX_UNDEFINED, FONT_INDEX_UNDEFINED, NATIONALITY_INDEX_UNDEFINED },
1141 { FONT_INDEX_UNDEFINED, FONT_INDEX_UNDEFINED, NATIONALITY_INDEX_UNDEFINED },
1142 { FONT_INDEX_UNDEFINED, FONT_INDEX_UNDEFINED, NATIONALITY_INDEX_UNDEFINED },
1144 { FONT_INDEX_UNDEFINED, FONT_INDEX_UNDEFINED, NATIONALITY_INDEX_UNDEFINED },
1145 { FONT_INDEX_UNDEFINED, FONT_INDEX_UNDEFINED, NATIONALITY_INDEX_UNDEFINED },
1146 { FONT_INDEX_UNDEFINED, FONT_INDEX_UNDEFINED, NATIONALITY_INDEX_UNDEFINED },
1147 { FONT_INDEX_UNDEFINED, FONT_INDEX_UNDEFINED, NATIONALITY_INDEX_UNDEFINED },
1148 { FONT_INDEX_UNDEFINED, FONT_INDEX_UNDEFINED, NATIONALITY_INDEX_UNDEFINED },
1149 { FONT_INDEX_UNDEFINED, FONT_INDEX_UNDEFINED, NATIONALITY_INDEX_UNDEFINED },
1150 { FONT_INDEX_UNDEFINED, FONT_INDEX_UNDEFINED, NATIONALITY_INDEX_UNDEFINED },
1151 { FONT_INDEX_UNDEFINED, FONT_INDEX_UNDEFINED, NATIONALITY_INDEX_UNDEFINED },
1153 { FONT_INDEX_UNDEFINED, FONT_INDEX_UNDEFINED, NATIONALITY_INDEX_UNDEFINED },
1154 { FONT_INDEX_UNDEFINED, FONT_INDEX_UNDEFINED, NATIONALITY_INDEX_UNDEFINED },
1155 { FONT_INDEX_UNDEFINED, FONT_INDEX_UNDEFINED, NATIONALITY_INDEX_UNDEFINED },
1156 { FONT_INDEX_UNDEFINED, FONT_INDEX_UNDEFINED, NATIONALITY_INDEX_UNDEFINED },
1157 { FONT_INDEX_UNDEFINED, FONT_INDEX_UNDEFINED, NATIONALITY_INDEX_UNDEFINED },
1158 { FONT_INDEX_UNDEFINED, FONT_INDEX_UNDEFINED, NATIONALITY_INDEX_UNDEFINED },
1159 { FONT_INDEX_UNDEFINED, FONT_INDEX_UNDEFINED, NATIONALITY_INDEX_UNDEFINED },
1160 { FONT_INDEX_UNDEFINED, FONT_INDEX_UNDEFINED, NATIONALITY_INDEX_UNDEFINED }
1172 { FONT_INDEX_LATIN_G0_SET, 0x23, 2, FONT_INDEX_NATIONAL_OPTION_SUBSET, 49 },
1173 { FONT_INDEX_CYRILLIC_G0_SET_OPTION_1_SERBIAN_CROATIAN, 0x33, 2, FONT_INDEX_NATIONAL_OPTION_SUBSET, 49 },
1174 { FONT_INDEX_CYRILLIC_G0_SET_OPTION_2_RUSSIAN_BULGARIAN, 0x33, 2, FONT_INDEX_NATIONAL_OPTION_SUBSET, 49 },
1175 { FONT_INDEX_CYRILLIC_G0_SET_OPTION_3_UKRANIAN, 0x33, 2, FONT_INDEX_NATIONAL_OPTION_SUBSET, 49 },
1176 { FONT_INDEX_GREEK_G2_SUPPLIMENTARY_SET, 0x40, 2, FONT_INDEX_NATIONAL_OPTION_SUBSET, 49 },
1177 { FONT_INDEX_ARABIC_G2_SUPPLIMENTARY_SET, 0x23, 2, FONT_INDEX_NATIONAL_OPTION_SUBSET, 49 },
1178 { FONT_INDEX_HEBREW_G0_SET, 0x23, 2, FONT_INDEX_NATIONAL_OPTION_SUBSET, 49 },
1181 { FONT_INDEX_LATIN_G0_SET, 0x25, 2, FONT_INDEX_NATIONAL_OPTION_SUBSET, 37 },
1182 { FONT_INDEX_CYRILLIC_G0_SET_OPTION_1_SERBIAN_CROATIAN, 0x25, 2, FONT_INDEX_NATIONAL_OPTION_SUBSET, 37 },
1183 { FONT_INDEX_CYRILLIC_G0_SET_OPTION_2_RUSSIAN_BULGARIAN, 0x25, 2, FONT_INDEX_NATIONAL_OPTION_SUBSET, 37 },
1184 { FONT_INDEX_CYRILLIC_G0_SET_OPTION_3_UKRANIAN, 0x25, 2, FONT_INDEX_NATIONAL_OPTION_SUBSET, 37 },
1185 { FONT_INDEX_CYRILLIC_G2_SUPPLIMENTARY_SET, 0x41, 2, FONT_INDEX_NATIONAL_OPTION_SUBSET, 37 },
1186 { FONT_INDEX_ARABIC_G2_SUPPLIMENTARY_SET, 0x25, 2, FONT_INDEX_NATIONAL_OPTION_SUBSET, 37 },
1187 { FONT_INDEX_HEBREW_G0_SET, 0x25, 2, FONT_INDEX_NATIONAL_OPTION_SUBSET, 37 },
1190 { FONT_INDEX_LATIN_G0_SET, 0x2b, 2, FONT_INDEX_CYRILLIC_G0_SET_OPTION_1_SERBIAN_CROATIAN, 0x31 },
1191 { FONT_INDEX_CYRILLIC_G0_SET_OPTION_2_RUSSIAN_BULGARIAN, 0x2b, 2, FONT_INDEX_CYRILLIC_G0_SET_OPTION_1_SERBIAN_CROATIAN, 0x31 },
1192 { FONT_INDEX_CYRILLIC_G0_SET_OPTION_3_UKRANIAN, 0x2b, 2, FONT_INDEX_CYRILLIC_G0_SET_OPTION_1_SERBIAN_CROATIAN, 0x31 },
1193 { FONT_INDEX_CYRILLIC_G2_SUPPLIMENTARY_SET, 0x46, 2, FONT_INDEX_CYRILLIC_G0_SET_OPTION_1_SERBIAN_CROATIAN, 0x31 },
1194 { FONT_INDEX_ARABIC_G2_SUPPLIMENTARY_SET, 0x2b, 2, FONT_INDEX_CYRILLIC_G0_SET_OPTION_1_SERBIAN_CROATIAN, 0x31 },
1195 { FONT_INDEX_HEBREW_G0_SET, 0x2b, 2, FONT_INDEX_CYRILLIC_G0_SET_OPTION_1_SERBIAN_CROATIAN, 0x31 },
1198 { FONT_INDEX_LATIN_G0_SET, 0x33, 2, FONT_INDEX_NATIONAL_OPTION_SUBSET, 59 },
1199 { FONT_INDEX_CYRILLIC_G2_SUPPLIMENTARY_SET, 0x4b, 2, FONT_INDEX_NATIONAL_OPTION_SUBSET, 59 },
1200 { FONT_INDEX_GREEK_G2_SUPPLIMENTARY_SET, 0x48, 2, FONT_INDEX_NATIONAL_OPTION_SUBSET, 59 },
1201 { FONT_INDEX_ARABIC_G2_SUPPLIMENTARY_SET, 0x33, 2, FONT_INDEX_NATIONAL_OPTION_SUBSET, 59 },
1202 { FONT_INDEX_HEBREW_G0_SET, 0x33, 2, FONT_INDEX_NATIONAL_OPTION_SUBSET, 59 },
1205 { FONT_INDEX_LATIN_G0_SET, 0x21, 3, FONT_INDEX_NATIONAL_OPTION_SUBSET, 48 },
1206 { FONT_INDEX_CYRILLIC_G0_SET_OPTION_1_SERBIAN_CROATIAN, 0x21, 3, FONT_INDEX_NATIONAL_OPTION_SUBSET, 48 },
1207 { FONT_INDEX_CYRILLIC_G0_SET_OPTION_2_RUSSIAN_BULGARIAN, 0x21, 3, FONT_INDEX_NATIONAL_OPTION_SUBSET, 48 },
1208 { FONT_INDEX_CYRILLIC_G0_SET_OPTION_3_UKRANIAN, 0x21, 3, FONT_INDEX_NATIONAL_OPTION_SUBSET, 48 },
1209 { FONT_INDEX_GREEK_G0_SET, 0x21, 3, FONT_INDEX_NATIONAL_OPTION_SUBSET, 48 },
1210 { FONT_INDEX_ARABIC_G2_SUPPLIMENTARY_SET, 0x21, 3, FONT_INDEX_NATIONAL_OPTION_SUBSET, 48 },
1211 { FONT_INDEX_HEBREW_G0_SET, 0x21, 3, FONT_INDEX_NATIONAL_OPTION_SUBSET, 48 },
1214 { FONT_INDEX_LATIN_G0_SET, 0x29, 3, FONT_INDEX_NATIONAL_OPTION_SUBSET, 87 },
1215 { FONT_INDEX_CYRILLIC_G2_SUPPLIMENTARY_SET, 0x44, 3, FONT_INDEX_NATIONAL_OPTION_SUBSET, 87 },
1216 { FONT_INDEX_GREEK_G0_SET, 0x29, 3, FONT_INDEX_NATIONAL_OPTION_SUBSET, 87 },
1217 { FONT_INDEX_ARABIC_G2_SUPPLIMENTARY_SET, 0x29, 3, FONT_INDEX_NATIONAL_OPTION_SUBSET, 87 },
1218 { FONT_INDEX_HEBREW_G0_SET, 0x29, 3, FONT_INDEX_NATIONAL_OPTION_SUBSET, 87 },
1221 { FONT_INDEX_LATIN_G0_SET, 0x2f, 4, FONT_INDEX_NATIONAL_OPTION_SUBSET, 93 },
1222 { FONT_INDEX_CYRILLIC_G2_SUPPLIMENTARY_SET, 0x48, 4, FONT_INDEX_NATIONAL_OPTION_SUBSET, 93 },
1223 { FONT_INDEX_ARABIC_G2_SUPPLIMENTARY_SET, 0x2e, 4, FONT_INDEX_NATIONAL_OPTION_SUBSET, 93 },
1224 { FONT_INDEX_HEBREW_G0_SET, 0x2e, 4, FONT_INDEX_NATIONAL_OPTION_SUBSET, 93 },
1227 { FONT_INDEX_LATIN_G0_SET, 0x29, 7, FONT_INDEX_NATIONAL_OPTION_SUBSET, 38 },
1228 { FONT_INDEX_CYRILLIC_G2_SUPPLIMENTARY_SET, 0x44, 7, FONT_INDEX_NATIONAL_OPTION_SUBSET, 38 },
1229 { FONT_INDEX_GREEK_G0_SET, 0x29, 7, FONT_INDEX_NATIONAL_OPTION_SUBSET, 38 },
1230 { FONT_INDEX_ARABIC_G2_SUPPLIMENTARY_SET, 0x29, 7, FONT_INDEX_NATIONAL_OPTION_SUBSET, 38 },
1231 { FONT_INDEX_HEBREW_G0_SET, 0x29, 7, FONT_INDEX_NATIONAL_OPTION_SUBSET, 38 },
1234 { FONT_INDEX_LATIN_G0_SET, 0x21, 8, FONT_INDEX_NATIONAL_OPTION_SUBSET, 41 },
1235 { FONT_INDEX_CYRILLIC_G0_SET_OPTION_1_SERBIAN_CROATIAN, 0x21, 8, FONT_INDEX_NATIONAL_OPTION_SUBSET, 41 },
1236 { FONT_INDEX_CYRILLIC_G0_SET_OPTION_2_RUSSIAN_BULGARIAN, 0x21, 8, FONT_INDEX_NATIONAL_OPTION_SUBSET, 41 },
1237 { FONT_INDEX_CYRILLIC_G0_SET_OPTION_3_UKRANIAN, 0x21, 8, FONT_INDEX_NATIONAL_OPTION_SUBSET, 41 },
1238 { FONT_INDEX_GREEK_G0_SET, 0x21, 8, FONT_INDEX_NATIONAL_OPTION_SUBSET, 41 },
1239 { FONT_INDEX_ARABIC_G2_SUPPLIMENTARY_SET, 0x21, 8, FONT_INDEX_NATIONAL_OPTION_SUBSET, 41 },
1240 { FONT_INDEX_HEBREW_G0_SET, 0x21, 8, FONT_INDEX_NATIONAL_OPTION_SUBSET, 41 },
1243 { FONT_INDEX_LATIN_G0_SET, 0x25, 8, FONT_INDEX_NATIONAL_OPTION_SUBSET, 23 },
1244 { FONT_INDEX_CYRILLIC_G0_SET_OPTION_1_SERBIAN_CROATIAN, 0x25, 8, FONT_INDEX_NATIONAL_OPTION_SUBSET, 23 },
1245 { FONT_INDEX_CYRILLIC_G0_SET_OPTION_2_RUSSIAN_BULGARIAN, 0x25, 8, FONT_INDEX_NATIONAL_OPTION_SUBSET, 23 },
1246 { FONT_INDEX_CYRILLIC_G0_SET_OPTION_3_UKRANIAN, 0x25, 8, FONT_INDEX_NATIONAL_OPTION_SUBSET, 23 },
1247 { FONT_INDEX_CYRILLIC_G2_SUPPLIMENTARY_SET, 0x41, 8, FONT_INDEX_NATIONAL_OPTION_SUBSET, 23 },
1248 { FONT_INDEX_ARABIC_G2_SUPPLIMENTARY_SET, 0x25, 8, FONT_INDEX_NATIONAL_OPTION_SUBSET, 23 },
1249 { FONT_INDEX_HEBREW_G0_SET, 0x25, 8, FONT_INDEX_NATIONAL_OPTION_SUBSET, 23 },
1252 { FONT_INDEX_LATIN_G0_SET, 0x29, 8, FONT_INDEX_CYRILLIC_G0_SET_OPTION_3_UKRANIAN, 0x3f },
1253 { FONT_INDEX_CYRILLIC_G2_SUPPLIMENTARY_SET, 0x44, 8, FONT_INDEX_CYRILLIC_G0_SET_OPTION_3_UKRANIAN, 0x3f },
1254 { FONT_INDEX_GREEK_G0_SET, 0x29, 8, FONT_INDEX_CYRILLIC_G0_SET_OPTION_3_UKRANIAN, 0x3f },
1255 { FONT_INDEX_ARABIC_G2_SUPPLIMENTARY_SET, 0x29, 8, FONT_INDEX_CYRILLIC_G0_SET_OPTION_3_UKRANIAN, 0x3f },
1256 { FONT_INDEX_HEBREW_G0_SET, 0x29, 8, FONT_INDEX_CYRILLIC_G0_SET_OPTION_3_UKRANIAN, 0x3f },
1259 { FONT_INDEX_LATIN_G0_SET, 0x2e, 8, FONT_INDEX_NATIONAL_OPTION_SUBSET, 54 },
1260 { FONT_INDEX_CYRILLIC_G2_SUPPLIMENTARY_SET, 0x48, 8, FONT_INDEX_NATIONAL_OPTION_SUBSET, 54 },
1261 { FONT_INDEX_ARABIC_G2_SUPPLIMENTARY_SET, 0x2e, 8, FONT_INDEX_NATIONAL_OPTION_SUBSET, 54 },
1262 { FONT_INDEX_HEBREW_G0_SET, 0x2e, 8, FONT_INDEX_NATIONAL_OPTION_SUBSET, 54 },
1265 { FONT_INDEX_LATIN_G0_SET, 0x35, 8, FONT_INDEX_NATIONAL_OPTION_SUBSET, 80 },
1266 { FONT_INDEX_CYRILLIC_G2_SUPPLIMENTARY_SET, 0x4c, 8, FONT_INDEX_NATIONAL_OPTION_SUBSET, 80 },
1267 { FONT_INDEX_GREEK_G2_SUPPLIMENTARY_SET, 0x49, 8, FONT_INDEX_NATIONAL_OPTION_SUBSET, 80 },
1268 { FONT_INDEX_ARABIC_G2_SUPPLIMENTARY_SET, 0x35, 8, FONT_INDEX_NATIONAL_OPTION_SUBSET, 80 },
1269 { FONT_INDEX_HEBREW_G0_SET, 0x35, 8, FONT_INDEX_NATIONAL_OPTION_SUBSET, 80 },
1272 { FONT_INDEX_LATIN_G0_SET, 0x21, 10, FONT_INDEX_NATIONAL_OPTION_SUBSET, 76 },
1273 { FONT_INDEX_CYRILLIC_G0_SET_OPTION_1_SERBIAN_CROATIAN, 0x21, 10, FONT_INDEX_NATIONAL_OPTION_SUBSET, 76 },
1274 { FONT_INDEX_CYRILLIC_G0_SET_OPTION_2_RUSSIAN_BULGARIAN, 0x21, 10, FONT_INDEX_NATIONAL_OPTION_SUBSET, 76 },
1275 { FONT_INDEX_CYRILLIC_G0_SET_OPTION_3_UKRANIAN, 0x21, 10, FONT_INDEX_NATIONAL_OPTION_SUBSET, 76 },
1276 { FONT_INDEX_GREEK_G0_SET, 0x21, 10, FONT_INDEX_NATIONAL_OPTION_SUBSET, 76 },
1277 { FONT_INDEX_ARABIC_G2_SUPPLIMENTARY_SET, 0x21, 10, FONT_INDEX_NATIONAL_OPTION_SUBSET, 76 },
1278 { FONT_INDEX_HEBREW_G0_SET, 0x21, 10, FONT_INDEX_NATIONAL_OPTION_SUBSET, 76 },
1281 { FONT_INDEX_LATIN_G0_SET, 0x21, 15, FONT_INDEX_NATIONAL_OPTION_SUBSET, 74 },
1282 { FONT_INDEX_CYRILLIC_G0_SET_OPTION_1_SERBIAN_CROATIAN, 0x21, 15, FONT_INDEX_NATIONAL_OPTION_SUBSET, 74 },
1283 { FONT_INDEX_CYRILLIC_G0_SET_OPTION_2_RUSSIAN_BULGARIAN, 0x21, 15, FONT_INDEX_NATIONAL_OPTION_SUBSET, 74 },
1284 { FONT_INDEX_CYRILLIC_G0_SET_OPTION_3_UKRANIAN, 0x21, 15, FONT_INDEX_NATIONAL_OPTION_SUBSET, 74 },
1285 { FONT_INDEX_GREEK_G0_SET, 0x21, 15, FONT_INDEX_NATIONAL_OPTION_SUBSET, 74 },
1286 { FONT_INDEX_ARABIC_G2_SUPPLIMENTARY_SET, 0x21, 15, FONT_INDEX_NATIONAL_OPTION_SUBSET, 74 },
1287 { FONT_INDEX_HEBREW_G0_SET, 0x21, 15, FONT_INDEX_NATIONAL_OPTION_SUBSET, 74 },
1290 { FONT_INDEX_LATIN_G0_SET, 0x23, 15, FONT_INDEX_NATIONAL_OPTION_SUBSET, 36 },
1291 { FONT_INDEX_CYRILLIC_G0_SET_OPTION_1_SERBIAN_CROATIAN, 0x33, 15, FONT_INDEX_NATIONAL_OPTION_SUBSET, 36 },
1292 { FONT_INDEX_CYRILLIC_G0_SET_OPTION_2_RUSSIAN_BULGARIAN, 0x33, 15, FONT_INDEX_NATIONAL_OPTION_SUBSET, 36 },
1293 { FONT_INDEX_CYRILLIC_G0_SET_OPTION_3_UKRANIAN, 0x33, 15, FONT_INDEX_NATIONAL_OPTION_SUBSET, 36 },
1294 { FONT_INDEX_GREEK_G2_SUPPLIMENTARY_SET, 0x40, 15, FONT_INDEX_NATIONAL_OPTION_SUBSET, 36 },
1295 { FONT_INDEX_ARABIC_G2_SUPPLIMENTARY_SET, 0x23, 15, FONT_INDEX_NATIONAL_OPTION_SUBSET, 36 },
1296 { FONT_INDEX_HEBREW_G0_SET, 0x23, 15, FONT_INDEX_NATIONAL_OPTION_SUBSET, 36 },
1299 { FONT_INDEX_LATIN_G0_SET, 0x33, 15, FONT_INDEX_NATIONAL_OPTION_SUBSET, 32 },
1300 { FONT_INDEX_CYRILLIC_G2_SUPPLIMENTARY_SET, 0x4b, 15, FONT_INDEX_NATIONAL_OPTION_SUBSET, 32 },
1301 { FONT_INDEX_GREEK_G2_SUPPLIMENTARY_SET, 0x48, 15, FONT_INDEX_NATIONAL_OPTION_SUBSET, 32 },
1302 { FONT_INDEX_ARABIC_G2_SUPPLIMENTARY_SET, 0x33, 15, FONT_INDEX_NATIONAL_OPTION_SUBSET, 32 },
1303 { FONT_INDEX_HEBREW_G0_SET, 0x33, 15, FONT_INDEX_NATIONAL_OPTION_SUBSET, 32 },
1306 { FONT_INDEX_LATIN_G0_SET, 0x27, 15, FONT_INDEX_NATIONAL_OPTION_SUBSET, 103 },
1307 { FONT_INDEX_CYRILLIC_G2_SUPPLIMENTARY_SET, 0x43, 15, FONT_INDEX_NATIONAL_OPTION_SUBSET, 103 },
1308 { FONT_INDEX_GREEK_G2_SUPPLIMENTARY_SET, 0x43, 15, FONT_INDEX_NATIONAL_OPTION_SUBSET, 103 },
1309 { FONT_INDEX_ARABIC_G2_SUPPLIMENTARY_SET, 0x27, 15, FONT_INDEX_NATIONAL_OPTION_SUBSET, 103 },
1310 { FONT_INDEX_HEBREW_G0_SET, 0x27, 15, FONT_INDEX_NATIONAL_OPTION_SUBSET, 103 },
1313 { FONT_INDEX_LATIN_G0_SET, 0x3a, 15, FONT_INDEX_NATIONAL_OPTION_SUBSET, 67 },
1314 { FONT_INDEX_CYRILLIC_G2_SUPPLIMENTARY_SET, 0x4f, 15, FONT_INDEX_NATIONAL_OPTION_SUBSET, 67 },
1315 { FONT_INDEX_GREEK_G2_SUPPLIMENTARY_SET, 0x4d, 15, FONT_INDEX_NATIONAL_OPTION_SUBSET, 67 },
1316 { FONT_INDEX_ARABIC_G2_SUPPLIMENTARY_SET, 0x3a, 15, FONT_INDEX_NATIONAL_OPTION_SUBSET, 67 },
1317 { FONT_INDEX_HEBREW_G0_SET, 0x3a, 15, FONT_INDEX_NATIONAL_OPTION_SUBSET, 67 },
1319 { FONT_INDEX_UNDEFINED, 0x00, 0, FONT_INDEX_UNDEFINED, 0 }
1331 { FONT_INDEX_LATIN_G0_SET, 0x21, 0 },
1332 { FONT_INDEX_CYRILLIC_G0_SET_OPTION_1_SERBIAN_CROATIAN, 0x21, 0 },
1333 { FONT_INDEX_CYRILLIC_G0_SET_OPTION_2_RUSSIAN_BULGARIAN, 0x21, 0 },
1334 { FONT_INDEX_CYRILLIC_G0_SET_OPTION_3_UKRANIAN, 0x21, 0 },
1335 { FONT_INDEX_GREEK_G0_SET, 0x21, 0 },
1336 { FONT_INDEX_ARABIC_G2_SUPPLIMENTARY_SET, 0x21, 0 },
1337 { FONT_INDEX_HEBREW_G0_SET, 0x21, 0 },
1340 { FONT_INDEX_LATIN_G0_SET, 0x25, 1 },
1341 { FONT_INDEX_CYRILLIC_G0_SET_OPTION_1_SERBIAN_CROATIAN, 0x25, 1 },
1342 { FONT_INDEX_CYRILLIC_G0_SET_OPTION_2_RUSSIAN_BULGARIAN, 0x25, 1 },
1343 { FONT_INDEX_CYRILLIC_G0_SET_OPTION_3_UKRANIAN, 0x25, 1 },
1344 { FONT_INDEX_CYRILLIC_G2_SUPPLIMENTARY_SET, 0x41, 1 },
1345 { FONT_INDEX_ARABIC_G2_SUPPLIMENTARY_SET, 0x25, 1 },
1346 { FONT_INDEX_HEBREW_G0_SET, 0x25, 1 },
1349 { FONT_INDEX_LATIN_G0_SET, 0x29, 2 },
1350 { FONT_INDEX_CYRILLIC_G2_SUPPLIMENTARY_SET, 0x44, 2 },
1351 { FONT_INDEX_GREEK_G0_SET, 0x29, 2 },
1352 { FONT_INDEX_ARABIC_G2_SUPPLIMENTARY_SET, 0x29, 2 },
1353 { FONT_INDEX_HEBREW_G0_SET, 0x29, 2 },
1356 { FONT_INDEX_LATIN_G0_SET, 0x2f, 3 },
1357 { FONT_INDEX_CYRILLIC_G2_SUPPLIMENTARY_SET, 0x48, 3 },
1358 { FONT_INDEX_ARABIC_G2_SUPPLIMENTARY_SET, 0x2e, 3 },
1359 { FONT_INDEX_HEBREW_G0_SET, 0x2e, 3 },
1362 { FONT_INDEX_LATIN_G0_SET, 0x35, 4 },
1363 { FONT_INDEX_CYRILLIC_G2_SUPPLIMENTARY_SET, 0x4c, 4 },
1364 { FONT_INDEX_GREEK_G2_SUPPLIMENTARY_SET, 0x49, 4 },
1365 { FONT_INDEX_ARABIC_G2_SUPPLIMENTARY_SET, 0x35, 4 },
1366 { FONT_INDEX_HEBREW_G0_SET, 0x35, 4 },
1369 { FONT_INDEX_LATIN_G0_SET, 0x23, 5 },
1370 { FONT_INDEX_CYRILLIC_G0_SET_OPTION_1_SERBIAN_CROATIAN, 0x33, 5 },
1371 { FONT_INDEX_CYRILLIC_G0_SET_OPTION_2_RUSSIAN_BULGARIAN, 0x33, 5 },
1372 { FONT_INDEX_CYRILLIC_G0_SET_OPTION_3_UKRANIAN, 0x33, 5 },
1373 { FONT_INDEX_GREEK_G2_SUPPLIMENTARY_SET, 0x40, 5 },
1374 { FONT_INDEX_ARABIC_G2_SUPPLIMENTARY_SET, 0x23, 5 },
1375 { FONT_INDEX_HEBREW_G0_SET, 0x23, 5 },
1378 { FONT_INDEX_LATIN_G0_SET, 0x33, 6 },
1379 { FONT_INDEX_CYRILLIC_G2_SUPPLIMENTARY_SET, 0x4b, 6 },
1380 { FONT_INDEX_GREEK_G2_SUPPLIMENTARY_SET, 0x48, 6 },
1381 { FONT_INDEX_ARABIC_G2_SUPPLIMENTARY_SET, 0x33, 6 },
1382 { FONT_INDEX_HEBREW_G0_SET, 0x33, 6 },
1385 { FONT_INDEX_LATIN_G0_SET, 0x2b, 7 },
1386 { FONT_INDEX_CYRILLIC_G0_SET_OPTION_2_RUSSIAN_BULGARIAN, 0x2b, 7 },
1387 { FONT_INDEX_CYRILLIC_G0_SET_OPTION_3_UKRANIAN, 0x2b, 7 },
1388 { FONT_INDEX_CYRILLIC_G2_SUPPLIMENTARY_SET, 0x46, 7 },
1389 { FONT_INDEX_ARABIC_G2_SUPPLIMENTARY_SET, 0x2b, 7 },
1390 { FONT_INDEX_HEBREW_G0_SET, 0x2b, 7 },
1393 { FONT_INDEX_LATIN_G0_SET, 0x39, 8 },
1394 { FONT_INDEX_GREEK_G2_SUPPLIMENTARY_SET, 0x4c, 8 },
1395 { FONT_INDEX_ARABIC_G2_SUPPLIMENTARY_SET, 0x39, 8 },
1396 { FONT_INDEX_HEBREW_G0_SET, 0x39, 8 },
1399 { FONT_INDEX_LATIN_G0_SET, 0x3a, 9 },
1400 { FONT_INDEX_CYRILLIC_G2_SUPPLIMENTARY_SET, 0x4f, 9 },
1401 { FONT_INDEX_GREEK_G2_SUPPLIMENTARY_SET, 0x4d, 9 },
1402 { FONT_INDEX_ARABIC_G2_SUPPLIMENTARY_SET, 0x3a, 9 },
1403 { FONT_INDEX_HEBREW_G0_SET, 0x3a, 9 },
1406 { FONT_INDEX_LATIN_G0_SET, 0x27, 10 },
1407 { FONT_INDEX_CYRILLIC_G2_SUPPLIMENTARY_SET, 0x43, 10 },
1408 { FONT_INDEX_GREEK_G2_SUPPLIMENTARY_SET, 0x43, 10 },
1409 { FONT_INDEX_ARABIC_G2_SUPPLIMENTARY_SET, 0x27, 10 },
1410 { FONT_INDEX_HEBREW_G0_SET, 0x27, 10 },
1413 { FONT_INDEX_LATIN_G0_SET, 0x34, 11 },
1414 { FONT_INDEX_ARABIC_G2_SUPPLIMENTARY_SET, 0x34, 11 },
1415 { FONT_INDEX_HEBREW_G0_SET, 0x34, 11 },
1418 { FONT_INDEX_LATIN_G0_SET, 0x2e, 12 },
1419 { FONT_INDEX_CYRILLIC_G2_SUPPLIMENTARY_SET, 0x48, 12 },
1420 { FONT_INDEX_ARABIC_G2_SUPPLIMENTARY_SET, 0x2e, 12 },
1421 { FONT_INDEX_HEBREW_G0_SET, 0x2e, 12 },
1424 { FONT_INDEX_LATIN_G0_SET, 0x49, 13 },
1425 { FONT_INDEX_CYRILLIC_G2_SUPPLIMENTARY_SET, 0x54, 13 },
1426 { FONT_INDEX_ARABIC_G2_SUPPLIMENTARY_SET, 0x49, 13 },
1428 { FONT_INDEX_UNDEFINED, 0x00, 0 }
1431 static const U16BIT cache_removal_priority_mask_array[8] =
1434 CACHE_PAGE_HISTORY_REQUESTED,
1435 CACHE_PAGE_PREVNEXT_REQUESTED,
1436 CACHE_PAGE_HISTORY_REQUESTED | CACHE_PAGE_PREVNEXT_REQUESTED,
1437 CACHE_PAGE_FLOF_REQUESTED,
1438 CACHE_PAGE_HISTORY_REQUESTED | CACHE_PAGE_FLOF_REQUESTED,
1439 CACHE_PAGE_PREVNEXT_REQUESTED | CACHE_PAGE_FLOF_REQUESTED,
1440 CACHE_PAGE_HISTORY_REQUESTED | CACHE_PAGE_PREVNEXT_REQUESTED | CACHE_PAGE_FLOF_REQUESTED
1443 static const U8BIT option_subset_array[96] =
1445 0, 0, 0, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1446 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1447 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1448 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 5, 6, 7, 8,
1449 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1450 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 11, 12, 13, 0
1453 static const U8BIT subset_offset_array[14] =
1455 0, 0, 13, 26, 39, 52, 65, 78, 91, 104, 117, 130, 143, 156
1459 static U32BIT pes_collection_callback_handle;
1463 static BOOLEAN is_initialised;
1464 static BOOLEAN is_shown;
1465 static BOOLEAN is_visible;
1467 static BOOLEAN stream_processing_enabled;
1472 static BOOLEAN history_cache_reset_requested;
1476 static BOOLEAN editorial_link_cache_reset_requested;
1478 static U16BIT next_cache_request_array[NUM_NEXT_CACHE_REQUESTS];
1479 static U16BIT previous_cache_request_array[NUM_PREVIOUS_CACHE_REQUESTS];
1480 static BOOLEAN previousnext_cache_reset_requested;
1481 static U16BIT next_prev_page_number;
1483 static E_EBUTT_CACHING_METHOD caching_method;
1490 static U8BIT broadcast_service_data[2][MAX_COLUMN];
1491 static BOOLEAN is_broadcast_service_data_defined[2];
1493 static BOOLEAN broadcast_index_page_invocation_required;
1494 static BOOLEAN show_header_row;
1496 static BOOLEAN stop_teletext;
1497 static U8BIT teletext_path;
1499 static U8BIT default_character_set_mapping;
1501 static void *display_task_ptr;
1502 static void *display_task_semaphore;
1504 static BOOLEAN palette_reset_required;
1506 static U16BIT display_margin_top;
1507 static U16BIT display_margin_left;
1509 static U8BIT *display_char_buffer_origin;
1510 static U8BIT *display_char_buffer;
1511 static U16BIT display_char_buffer_size;
1513 static U8BIT current_gun_intensity = 223;
1514 static U8BIT current_antialias_level = 8;
1515 static U8BIT current_transparency_level = 255;
1517 static BOOLEAN diacritic_substitutions_avaialable;
1519 static U16BIT page_history_array[MAX_PAGE_HISTORY];
1520 static U16BIT page_history_request_page_number;
1521 static U16BIT page_history_lwm;
1522 static U16BIT page_history_hwm;
1523 static U16BIT page_history_mwm;
1525 static U32BIT subtitle_timeout;
1527 static void *ttxt_osd_region;
1529 static void *collation_start;
1530 static void *collation_stopped;
1531 static BOOLEAN stop_collation;
1532 static BOOLEAN collation_started;
1533 static void *collation_queue;
1534 static U16BIT queue_count;
1535 static U16BIT max_queue_count;
1536 static void *page_free_sem;
1540 static void* GetMemory(U32BIT bytes);
1544 static BOOLEAN GetHamming8Byte(
void *byte, U8BIT *value);
1545 static BOOLEAN GetHamming8Multiple(
void *ptr, U8BIT num_bytes, U32BIT *value);
1546 static BOOLEAN GetHamming8DoubleWord(
void *dword, U16BIT *value);
1547 static BOOLEAN GetHammimg24Value(
void *triplet_ptr, U32BIT *value);
1549 static BOOLEAN GetParity7Byte(U8BIT byte, U8BIT *value);
1554 E_PAGE_REFERENCE_TYPE reference_type, U16BIT base_magazine_number);
1556 static BOOLEAN IsPacketQueueingRequired(
void);
1558 static BOOLEAN GetPacketAddress(U8BIT *packet_number, U8BIT *magazine_number,
1559 U8BIT *teletext_packet_ptr );
1561 static U16BIT GetMagazineIndexFromPageNumber(U16BIT page_number);
1563 static BOOLEAN IsRollingSubCode(U16BIT page_sub_code);
1566 U8BIT *second_setting, BOOLEAN *boxing_required,
1567 BOOLEAN *header_required, BOOLEAN *body_required,
1568 BOOLEAN *default_row_background_colour_defined,
1569 U8BIT *default_row_background_colour);
1572 U8BIT *foreground_index, U8BIT *background_index,
1573 U8BIT foreground_colour, U8BIT background_colour,
1574 BOOLEAN flashing, BOOLEAN conceal,
1575 BOOLEAN boxing_required, BOOLEAN boxed,
1576 BOOLEAN video_mix_overridden);
1580 static void PESCollectionCallback(U32BIT handle, U8BIT data_identifier,
void *data_ptr, U32BIT data_length);
1581 static BOOLEAN AddPESDataToQueue(
void *data_ptr, U32BIT data_length);
1583 static BOOLEAN InitialiseCollation(
void);
1589 static void RequestPage(U16BIT page_number, U16BIT page_sub_code);
1590 static void RequestIndexPage(
void);
1591 static void RequestNextPrevious(E_REQUEST_TYPE request_type, BOOLEAN increment);
1592 static void RequestNextAvailablePage(
void);
1593 static void RequestPreviousAvailablePage(
void);
1594 static void RequestNextVisitedPage(
void);
1595 static void RequestPreviousVisitedPage(
void);
1596 static void RequestEditorialLinkPage(U16BIT index);
1597 static void RequestNextSubPage(
void);
1598 static void RequestPreviousSubPage(
void);
1602 static U16BIT GetMaximumEditorialLinkTiers(
void);
1607 U16BIT page_number);
1612 U16BIT page_number);
1620 static BOOLEAN GetSubPageEditorialLinks(
S_CACHE_SUBPAGE *sub_page_ptr,
1621 U16BIT *page_number_link_array,
1622 U16BIT *page_sub_code_link_array,
1623 U16BIT max_num_links, U16BIT magazine_number);
1626 U16BIT page_number, U16BIT sub_code);
1635 static void UpdateEditorialLinkPageRequest(U16BIT page_number, U16BIT sub_code);
1644 static BOOLEAN SearchRequestArray(U16BIT *array_ptr, U16BIT array_size, BOOLEAN find_highest,
1645 U16BIT **return_array_ptr);
1646 static BOOLEAN SearchPreviousRequestArray(BOOLEAN find_highest, U16BIT **return_array_ptr);
1647 static BOOLEAN SearchNextRequestArray(BOOLEAN find_highest, U16BIT **return_array_ptr);
1649 static BOOLEAN IsInPreviousRequestArray(U16BIT page_number);
1650 static BOOLEAN IsInNextRequestArray(U16BIT page_number);
1654 static BOOLEAN GetGlobalIndexPage(U16BIT *page_number, U16BIT *page_sub_code);
1655 static BOOLEAN GetIndexPage(U16BIT *page_number, U16BIT *page_sub_code);
1656 static BOOLEAN GetAvailablePage(U16BIT *page_number, S16BIT page_increment);
1657 static BOOLEAN GetVisitedPage(U16BIT *page_number, U16BIT *page_sub_code, S16BIT page_increment);
1658 static BOOLEAN GetEditorialLinkPage(U16BIT *page_number, U16BIT *page_sub_code, U16BIT link_index);
1659 static BOOLEAN GetSubPage(U16BIT *new_page_sub_code, U16BIT current_page_number,
1660 U16BIT current_page_sub_code, S16BIT page_increment);
1664 static void CheckPageRequest(BOOLEAN pts_valid, U8BIT *pts);
1668 static BOOLEAN RemoveCachePage(U16BIT magazine_number, U16BIT mask);
1669 static BOOLEAN RemoveCacheContent(U16BIT magazine_number, BOOLEAN exclude_magazine);
1670 static BOOLEAN RemoveUnrequestedCacheContent(U16BIT magazine_number, BOOLEAN exclude_magazine);
1671 static BOOLEAN RemoveUnrequestedCachePage(U16BIT magazine_number);
1674 static void RemoveAllCacheContent(
void);
1679 static void NotifyDisplayUpdate(
S_MAGAZINE_PAGE *collated_page_ptr, U16BIT magazine_number,
1680 U16BIT page_number, U16BIT page_sub_code, BOOLEAN update_clock, BOOLEAN pts_valid, U8BIT *pts);
1687 static void CheckTimeFillingPacket(
S_MAGAZINE_PAGE *collated_page_ptr, U16BIT page_number);
1689 static void CheckHeaderClockContent(
S_MAGAZINE_PAGE *collated_page_ptr);
1693 static void NotifyRequestToPageHistory(U16BIT page_number);
1694 static U16BIT MoveHistoryMarker(U16BIT marker, BOOLEAN advance);
1695 static void NotifyDisplayToPageHistory(U16BIT page_number);
1696 static BOOLEAN GetPreviousPageFromHistory(U16BIT *page_number);
1697 static BOOLEAN GetNextPageFromHistory(U16BIT *page_number);
1699 static void NotifyPageCollated(
S_MAGAZINE_PAGE *collated_page_ptr, U8BIT magazine_number,
1700 BOOLEAN pts_valid, U8BIT *pts);
1702 static BOOLEAN InitialiseDisplayTask(
void);
1703 static void KillDisplayTask(
void);
1705 static BOOLEAN IsNationalOptionSubsetIndex(U8BIT character_index, U8BIT *subset_offset);
1707 static void GetTripletFields(U32BIT triplet_value, U8BIT *address, U8BIT *mode, U8BIT *data);
1709 static void DecodeTeletextPageBody(
S_PAGE_DISPLAY_INFO *display_info_ptr, BOOLEAN enforce_header_display);
1710 static void DecodeTeletextPageNumber(
S_PAGE_DISPLAY_INFO *display_info_ptr, BOOLEAN video_mix_overridden);
1712 static void DecodeTeletextClock(
S_PAGE_DISPLAY_INFO *display_info_ptr, BOOLEAN video_mix_overridden);
1715 U8BIT *aliased_foreground_index, U8BIT *aliased_background_index,
1718 static void RenderCharacter(U16BIT x, U16BIT y, U16BIT x_scalar, U16BIT y_scalar,
1721 static U32BIT GetRGBSetting(BOOLEAN tranparency_required, U8BIT transparency_level,
1722 BOOLEAN red_required, BOOLEAN green_required, BOOLEAN blue_required,
1723 U8BIT gun_intensity);
1725 static U32BIT GetRGBRamping(U32BIT fore_colour, U32BIT back_colour, U32BIT foreground_sixteenths);
1729 static void PerformDisplayUpdate(
void);
1730 static void DisplayUpdateTask(
void *unwanted_ptr);
1731 static void PESCollationTask(
void *param);
1749 static void* GetMemory(U32BIT bytes)
1779 static BOOLEAN GetHamming8Byte(
void *byte, U8BIT *value)
1783 FUNCTION_START(GetHamming8Byte);
1789 *value = hamming_8_4_table[*(U8BIT *)byte] & HAMMING_8_4_DATA_MASK;
1792 if (hamming_8_4_table[*(U8BIT *)byte] & HAMMING_ERROR_MASK)
1797 FUNCTION_FINISH(GetHamming8Byte);
1818 static BOOLEAN GetHamming8Multiple(
void *ptr, U8BIT num_bytes, U32BIT *value)
1820 U8BIT byte_index, byte_value;
1824 FUNCTION_START(GetHamming8Multiple);
1828 if ((num_bytes > 0) &&
1838 byte_ptr = (U8BIT *)ptr;
1839 byte_ptr += num_bytes - 1;
1841 for (byte_index = 0; byte_index < num_bytes; byte_index++)
1843 if (!GetHamming8Byte(byte_ptr, &byte_value))
1851 *value = (*value << 4L) | byte_value;
1858 FUNCTION_FINISH(GetHamming8Multiple);
1879 static BOOLEAN GetHamming8DoubleWord(
void *dword, U16BIT *value)
1884 FUNCTION_START(GetHamming8DoubleWord);
1886 retval = GetHamming8Multiple(dword, 4, &long_value);
1890 *value = (U16BIT)long_value;
1893 FUNCTION_FINISH(GetHamming8DoubleWord);
1914 static BOOLEAN GetHammimg24Value(
void *triplet_ptr, U32BIT *value)
1920 FUNCTION_START(GetHammimg24Value);
1924 byte_ptr = (U8BIT *)triplet_ptr;
1926 parity_index = hamming_24_18_parity_table[0][*byte_ptr] ^
1927 hamming_24_18_parity_table[1][*(byte_ptr + 1)] ^
1928 hamming_24_18_parity_table[2][*(byte_ptr + 2)];
1932 *value = (U32BIT)hamming_24_18_first_byte_table[*byte_ptr];
1933 *value += (U32BIT)(hamming_24_18_other_bytes_table[*(byte_ptr + 1)] & 0x7f) << 4L;
1934 *value += (U32BIT)(hamming_24_18_other_bytes_table[*(byte_ptr + 2)] & 0x7f) << 11L;
1936 *value ^= hamming_24_18_correction_table[parity_index];
1939 if (hamming_24_18_error_table[parity_index] & HAMMING_ERROR_MASK)
1944 FUNCTION_FINISH(GetHammimg24Value);
1963 static BOOLEAN GetParity7Byte(U8BIT byte, U8BIT *value)
1967 FUNCTION_START(GetParity7Byte);
1973 if (hamming_24_18_parity_table[0][byte] & 32)
1978 *value = hamming_24_18_other_bytes_table[byte];
1984 FUNCTION_FINISH(GetParity7Byte);
2010 E_PAGE_REFERENCE_TYPE reference_type, U16BIT base_magazine_number)
2012 U8BIT page_number_units, page_number_tens, control_byte;
2015 static U8BIT reversed_tribit[8] = { 0, 4, 2, 6, 1, 5, 3, 7 };
2017 FUNCTION_START(GetPageReference);
2023 if (GetHamming8Byte(link_ptr, &page_number_units) == TRUE)
2025 if (GetHamming8Byte(link_ptr + 1, &page_number_tens) == TRUE)
2028 if (GetHamming8DoubleWord(link_ptr + 2, &page_reference_data_ptr->page_sub_code) == TRUE)
2031 page_reference_data_ptr->page_sub_code &= 0x3f7f;
2034 page_reference_data_ptr->page_offset = (U16BIT)((page_number_tens << 4) +
2038 switch (reference_type)
2043 case PAGE_REFERENCE_TYPE_HEADER:
2049 page_reference_data_ptr->erase_page = FALSE;
2051 if (GetHamming8Byte(link_ptr + 3, &control_byte) == TRUE)
2053 if (control_byte & 0x08)
2055 page_reference_data_ptr->erase_page = TRUE;
2059 page_reference_data_ptr->newsflash = FALSE;
2060 page_reference_data_ptr->subtitle = FALSE;
2062 if (GetHamming8Byte(link_ptr + 5, &control_byte) == TRUE)
2064 if (control_byte & 0x04)
2066 page_reference_data_ptr->newsflash = TRUE;
2068 if (control_byte & 0x08)
2070 page_reference_data_ptr->subtitle = TRUE;
2074 page_reference_data_ptr->suppress_header = FALSE;
2075 page_reference_data_ptr->update_indicator = FALSE;
2076 page_reference_data_ptr->interrupted_sequence = FALSE;
2077 page_reference_data_ptr->inhibit_display = FALSE;
2079 if (GetHamming8Byte(link_ptr + 6, &control_byte) == TRUE)
2081 if (control_byte & 0x01)
2083 page_reference_data_ptr->suppress_header = TRUE;
2085 if (control_byte & 0x02)
2087 page_reference_data_ptr->update_indicator = TRUE;
2089 if (control_byte & 0x04)
2091 page_reference_data_ptr->interrupted_sequence = TRUE;
2093 if (control_byte & 0x08)
2095 page_reference_data_ptr->inhibit_display = TRUE;
2099 page_reference_data_ptr->magazine_serial = FALSE;
2100 page_reference_data_ptr->national_option_character_subset = 0;
2102 if (GetHamming8Byte(link_ptr + 7, &control_byte) == TRUE)
2104 if (control_byte & 0x01)
2106 page_reference_data_ptr->magazine_serial = TRUE;
2109 page_reference_data_ptr->national_option_character_subset =
2110 reversed_tribit[(control_byte & 0x0e) >> 1];
2119 case PAGE_REFERENCE_TYPE_EDITORIAL_LINK:
2123 if (GetHamming8Byte(link_ptr + 3, &control_byte) == TRUE)
2125 if (control_byte & 0x08)
2127 base_magazine_number ^= 0x01;
2131 if (GetHamming8Byte(link_ptr + 5, &control_byte) == TRUE)
2133 if (control_byte & 0x04)
2135 base_magazine_number ^= 0x02;
2137 if (control_byte & 0x08)
2139 base_magazine_number ^= 0x04;
2147 case PAGE_REFERENCE_TYPE_GLOBAL_INDEX:
2152 base_magazine_number = 0;
2154 if (GetHamming8Byte(link_ptr + 3, &control_byte) == TRUE)
2156 if (control_byte & 0x08)
2158 base_magazine_number |= 0x01;
2162 if (GetHamming8Byte(link_ptr + 5, &control_byte) == TRUE)
2164 if (control_byte & 0x04)
2166 base_magazine_number |= 0x02;
2168 if (control_byte & 0x08)
2170 base_magazine_number |= 0x04;
2178 if (base_magazine_number == 0)
2181 page_reference_data_ptr->page_number =
2182 2048 + page_reference_data_ptr->page_offset;
2188 page_reference_data_ptr->page_number =
2189 ((U16BIT)base_magazine_number << 8) + page_reference_data_ptr->page_offset;
2192 page_reference_data_ptr->magazine_number = base_magazine_number;
2197 switch (reference_type)
2199 case PAGE_REFERENCE_TYPE_EDITORIAL_LINK:
2201 if (page_reference_data_ptr->page_offset == 0x00ff)
2205 else if (page_reference_data_ptr->page_sub_code == 0x3f7f)
2207 page_reference_data_ptr->page_sub_code = PAGE_SUB_CODE_UNDEFINED;
2212 case PAGE_REFERENCE_TYPE_GLOBAL_INDEX:
2214 if (page_reference_data_ptr->page_offset == 0x00ff)
2216 page_reference_data_ptr->page_number = 0x0100;
2217 page_reference_data_ptr->page_sub_code = PAGE_SUB_CODE_UNDEFINED;
2219 else if (page_reference_data_ptr->page_sub_code == 0x3f7f)
2221 page_reference_data_ptr->page_sub_code = PAGE_SUB_CODE_UNDEFINED;
2233 FUNCTION_FINISH(GetPageReference);
2251 static BOOLEAN IsPacketQueueingRequired(
void)
2255 FUNCTION_START(IsPacketQueueingRequired);
2257 retval = stream_processing_enabled;
2259 FUNCTION_FINISH(IsPacketQueueingRequired);
2295 static BOOLEAN GetPacketAddress(U8BIT *packet_number, U8BIT *magazine_number,
2296 U8BIT *teletext_packet_ptr )
2300 U8BIT designation_code;
2302 FUNCTION_START(GetPacketAddress);
2306 if (GetHamming8Byte(teletext_packet_ptr + 1, packet_number))
2308 if (GetHamming8Byte(teletext_packet_ptr, magazine_number))
2311 *packet_number <<= 1;
2313 if (*magazine_number & 0x08)
2315 *packet_number += 1;
2318 *magazine_number &= 0x07;
2320 if (*packet_number < 32)
2322 validation_ptr = packet_validation_array + *packet_number;
2323 if (validation_ptr->is_required == TRUE)
2325 if (validation_ptr->has_designation_code == TRUE)
2329 if (GetHamming8Byte(teletext_packet_ptr + 2, &designation_code))
2332 if ((designation_code >= validation_ptr->lowest_designation_code) &&
2333 (designation_code <= validation_ptr->highest_designation_code))
2349 FUNCTION_FINISH(GetPacketAddress);
2365 static U16BIT GetMagazineIndexFromPageNumber(U16BIT page_number)
2369 FUNCTION_START(GetMagazineIndexFromPageNumber);
2372 if (page_number == 8)
2378 retval = page_number;
2381 FUNCTION_FINISH(GetMagazineIndexFromPageNumber);
2402 static BOOLEAN IsRollingSubCode(U16BIT page_sub_code)
2404 U16BIT sub_code_tens, sub_code_units;
2407 FUNCTION_START(IsRollingSubCode);
2411 if (page_sub_code != PAGE_SUB_CODE_UNDEFINED)
2413 if (!(page_sub_code & 0xff00))
2415 sub_code_tens = (page_sub_code & 0x00f0) >> 4;
2416 if (sub_code_tens <= 7)
2418 sub_code_units = page_sub_code & 0x000f;
2419 if (sub_code_units <= 9)
2421 if ((sub_code_tens != 0) ||
2422 (sub_code_units != 0))
2431 FUNCTION_FINISH(IsRollingSubCode);
2465 U8BIT *second_setting, BOOLEAN *boxing_required,
2466 BOOLEAN *header_required, BOOLEAN *body_required,
2467 BOOLEAN *default_row_background_colour_defined,
2468 U8BIT *default_row_background_colour)
2470 U16BIT magazine_number;
2471 U32BIT triplet_value;
2472 BOOLEAN default_mapping_defined, second_mapping_defined;
2475 FUNCTION_START(GetBasicPageDisplayInfo);
2478 if (default_setting != NULL)
2480 *default_setting = default_character_set_mapping << 3;
2482 if (second_setting != NULL)
2484 *second_setting = default_character_set_mapping << 3;
2487 if (boxing_required != NULL)
2489 *boxing_required = FALSE;
2491 if (header_required != NULL)
2493 *header_required = show_header_row;
2495 if (body_required != NULL)
2497 *body_required = TRUE;
2500 default_mapping_defined = FALSE;
2501 second_mapping_defined = FALSE;
2503 if (default_row_background_colour_defined != NULL)
2505 *default_row_background_colour_defined = FALSE;
2510 if (ptr->page_source.specific_data.is_defined[0] == TRUE)
2512 if (GetHammimg24Value(&ptr->page_source.specific_data.s_data[0][1], &triplet_value) == TRUE)
2514 if (default_setting != NULL)
2516 *default_setting = (U8BIT)((triplet_value & 0x003f80L) >> 7L);
2518 default_mapping_defined = TRUE;
2520 if (second_setting != NULL)
2522 *second_setting = (U8BIT)((triplet_value & 0x03c000L) >> 14L);
2525 if (GetHammimg24Value(&ptr->page_source.specific_data.s_data[0][4], &triplet_value) == TRUE)
2527 if (second_setting != NULL)
2529 *second_setting |= (U8BIT)((triplet_value & 0x000007L) << 4L);
2531 second_mapping_defined = TRUE;
2535 if (GetHammimg24Value(&ptr->page_source.specific_data.s_data[0][37], &triplet_value) == TRUE)
2537 if (triplet_value & 0x004000L)
2539 if (default_row_background_colour_defined != NULL)
2541 if (default_row_background_colour != NULL)
2543 *default_row_background_colour = (U8BIT)((triplet_value & 0x003e00L) >> 9L);
2545 *default_row_background_colour_defined = TRUE;
2551 if (ptr->page_source.specific_data.is_defined[1] == TRUE)
2553 if (default_mapping_defined == FALSE)
2557 if (GetHammimg24Value(&ptr->page_source.specific_data.s_data[1][1], &triplet_value) == TRUE)
2559 if (default_setting != NULL)
2561 *default_setting = (U8BIT)((triplet_value & 0x003f80L) >> 7L);
2563 default_mapping_defined = TRUE;
2565 if (second_setting != NULL)
2567 *second_setting = (U8BIT)((triplet_value & 0x03c000L) >> 14L);
2570 if (GetHammimg24Value(&ptr->page_source.specific_data.s_data[1][4], &triplet_value) == TRUE)
2572 if (second_setting != NULL)
2574 *second_setting |= (U8BIT)((triplet_value & 0x000007L) << 4L);
2576 second_mapping_defined = TRUE;
2580 else if (second_mapping_defined == FALSE)
2582 if (GetHammimg24Value(&ptr->page_source.specific_data.s_data[1][1], &triplet_value) == TRUE)
2584 if (second_setting != NULL)
2586 *second_setting = (U8BIT)((triplet_value & 0x03c000L) >> 14L);
2589 if (GetHammimg24Value(&ptr->page_source.specific_data.s_data[1][4], &triplet_value) == TRUE)
2591 if (second_setting != NULL)
2593 *second_setting |= (U8BIT)((triplet_value & 0x000007L) << 4L);
2595 second_mapping_defined = TRUE;
2600 if (default_row_background_colour_defined != NULL)
2602 if (*default_row_background_colour_defined == FALSE)
2604 if (GetHammimg24Value(&ptr->page_source.specific_data.s_data[1][37], &triplet_value) == TRUE)
2606 if (triplet_value & 0x004000L)
2608 if (default_row_background_colour != NULL)
2610 *default_row_background_colour = (U8BIT)((triplet_value & 0x003e00L) >> 9L);
2612 *default_row_background_colour_defined = TRUE;
2619 if (ptr->mgzn_data.is_defined[0] == TRUE)
2621 if (default_mapping_defined == FALSE)
2625 if (GetHammimg24Value(&ptr->mgzn_data.s_data[0][1], &triplet_value) == TRUE)
2627 if (default_setting != NULL)
2629 *default_setting = (U8BIT)((triplet_value & 0x003f80L) >> 7L);
2631 default_mapping_defined = TRUE;
2633 if (second_setting != NULL)
2635 *second_setting = (U8BIT)((triplet_value & 0x03c000L) >> 14L);
2638 if (GetHammimg24Value(&ptr->mgzn_data.s_data[0][4], &triplet_value) == TRUE)
2640 if (second_setting != NULL)
2642 *second_setting |= (U8BIT)((triplet_value & 0x000007L) << 4L);
2644 second_mapping_defined = TRUE;
2648 else if (second_mapping_defined == FALSE)
2650 if (GetHammimg24Value(&ptr->mgzn_data.s_data[0][1], &triplet_value) == TRUE)
2652 if (second_setting != NULL)
2654 *second_setting = (U8BIT)((triplet_value & 0x03c000L) >> 14L);
2657 if (GetHammimg24Value(&ptr->mgzn_data.s_data[1][4], &triplet_value) == TRUE)
2659 if (second_setting != NULL)
2661 *second_setting |= (U8BIT)((triplet_value & 0x000007L) << 4L);
2663 second_mapping_defined = TRUE;
2668 if (default_row_background_colour_defined != NULL)
2670 if (*default_row_background_colour_defined == FALSE)
2672 if (GetHammimg24Value(&ptr->mgzn_data.s_data[0][37], &triplet_value) == TRUE)
2674 if (triplet_value & 0x004000L)
2676 if (default_row_background_colour != NULL)
2678 *default_row_background_colour = (U8BIT)((triplet_value & 0x003e00L) >> 9L);
2680 *default_row_background_colour_defined = TRUE;
2687 if (ptr->mgzn_data.is_defined[1] == TRUE)
2689 if (default_mapping_defined == FALSE)
2693 if (GetHammimg24Value(&ptr->mgzn_data.s_data[1][1], &triplet_value) == TRUE)
2695 if (default_setting != NULL)
2697 *default_setting = (U8BIT)((triplet_value & 0x003f80L) >> 7L);
2699 default_mapping_defined = TRUE;
2701 if (second_setting != NULL)
2703 *second_setting = (U8BIT)((triplet_value & 0x03c000L) >> 14L);
2706 if (GetHammimg24Value(&ptr->mgzn_data.s_data[1][4], &triplet_value) == TRUE)
2708 if (second_setting != NULL)
2710 *second_setting |= (U8BIT)((triplet_value & 0x000007L) << 4L);
2712 second_mapping_defined = TRUE;
2716 else if (second_mapping_defined == FALSE)
2718 if (GetHammimg24Value(&ptr->mgzn_data.s_data[1][1], &triplet_value) == TRUE)
2720 if (second_setting != NULL)
2722 *second_setting = (U8BIT)((triplet_value & 0x03c000L) >> 14L);
2725 if (GetHammimg24Value(&ptr->mgzn_data.s_data[1][4], &triplet_value) == TRUE)
2727 if (second_setting != NULL)
2729 *second_setting |= (U8BIT)((triplet_value & 0x000007L) << 4L);
2731 second_mapping_defined = TRUE;
2736 if (default_row_background_colour_defined != NULL)
2738 if (*default_row_background_colour_defined == FALSE)
2740 if (GetHammimg24Value(&ptr->mgzn_data.s_data[1][37], &triplet_value) == TRUE)
2742 if (triplet_value & 0x004000L)
2744 if (default_row_background_colour != NULL)
2746 *default_row_background_colour = (U8BIT)((triplet_value & 0x003e00L) >> 9L);
2748 *default_row_background_colour_defined = TRUE;
2757 if (ptr->page_source.is_header_defined == TRUE)
2759 magazine_number = GetMagazineIndexFromPageNumber(page_display_info.page_number);
2761 if (GetPageReference(ptr->page_source.header, &page_reference_data,
2762 PAGE_REFERENCE_TYPE_HEADER, magazine_number) == TRUE)
2764 if (default_setting != NULL)
2766 *default_setting &= 0xf8;
2767 *default_setting |= page_reference_data.national_option_character_subset;
2771 ptr->subtitle = page_reference_data.subtitle;
2773 if ((page_reference_data.newsflash == TRUE) ||
2774 (page_reference_data.subtitle == TRUE))
2776 if (boxing_required != NULL)
2778 *boxing_required = TRUE;
2782 if (page_reference_data.suppress_header == TRUE)
2784 if (header_required != NULL)
2786 *header_required = FALSE;
2790 if (page_reference_data.inhibit_display == TRUE)
2792 if (body_required != NULL)
2794 *body_required = FALSE;
2799 FUNCTION_FINISH(GetBasicPageDisplayInfo);
2829 U8BIT *foreground_index, U8BIT *background_index,
2830 U8BIT foreground_colour, U8BIT background_colour,
2831 BOOLEAN flashing, BOOLEAN conceal,
2832 BOOLEAN boxing_required, BOOLEAN boxed,
2833 BOOLEAN video_mix_overridden)
2835 U8BIT fore_colour, back_colour, effect_mask;
2838 FUNCTION_START(GetCharacterPaletteIndexes);
2840 if ((boxing_required == TRUE) &&
2845 *foreground_index = PALETTE_FOREGROUND_UNBOXED;
2849 if (foreground_colour < 8)
2852 fore_colour = foreground_colour + PALETTE_FOREGROUND_BLACK;
2857 fore_colour = PALETTE_FOREGROUND_WHITE;
2860 if (background_colour < 8)
2863 back_colour = background_colour + PALETTE_BACKGROUND_BLACK;
2868 back_colour = PALETTE_BACKGROUND_BLACK;
2872 effect_mask = PALETTE_EFFECT_UNDEFINED;
2874 if (flashing == TRUE)
2876 effect_mask = PALETTE_EFFECT_FLASH;
2878 if (conceal == TRUE)
2880 effect_mask |= PALETTE_EFFECT_CONCEAL;
2884 if (effect_mask != PALETTE_EFFECT_UNDEFINED)
2886 for (index = 0; index < NUM_PALETTE_EFFECTS; index++)
2888 if (display_info_ptr->palette_attribute_array[index].effect_mask ==
2889 PALETTE_EFFECT_UNDEFINED)
2893 display_info_ptr->palette_attribute_array[index].fore_colour = fore_colour;
2894 display_info_ptr->palette_attribute_array[index].back_colour = back_colour;
2895 display_info_ptr->palette_attribute_array[index].effect_mask = effect_mask;
2897 if (index < (NUM_PALETTE_EFFECTS - 1))
2899 display_info_ptr->palette_attribute_array[index + 1].effect_mask =
2900 PALETTE_EFFECT_UNDEFINED;
2903 fore_colour = index + PALETTE_EFFECT_ORIGIN;
2909 if ((display_info_ptr->palette_attribute_array[index].fore_colour == fore_colour) &&
2910 (display_info_ptr->palette_attribute_array[index].back_colour == back_colour) &&
2911 (display_info_ptr->palette_attribute_array[index].effect_mask == effect_mask))
2913 fore_colour = index + PALETTE_EFFECT_ORIGIN;
2919 *foreground_index = fore_colour;
2921 if ((display_info_ptr->video_mix_set == TRUE) &&
2922 (video_mix_overridden == TRUE))
2924 if (back_colour == PALETTE_BACKGROUND_BLACK)
2926 *background_index = PALETTE_BACKGROUND_BLACK_FIXED;
2931 *background_index = back_colour;
2935 FUNCTION_FINISH(GetCharacterPaletteIndexes);
2938 static BOOLEAN GetPesPts(U8BIT *data, U8BIT *pts)
2942 FUNCTION_START(GetPesPts);
2944 pts[0] = (data[0] & 0x08) >> 3;
2945 pts[1] = ((data[0] & 0x06) << 5) + ((data[1] & 0xfc) >> 2);
2946 pts[2] = ((data[1] & 0x03) << 6) + ((data[2] & 0xfc) >> 2);
2947 pts[3] = ((data[2] & 0x02) << 6) + ((data[3] & 0xfe) >> 1);
2948 pts[4] = ((data[3] & 0x01) << 7) + ((data[4] & 0xfe) >> 1);
2950 retval = (data[0] & 0x01) & (data[2] & 0x01) & (data[4] & 0x01);
2952 FUNCTION_FINISH(GetPesPts);
2975 static void PESCollectionCallback(U32BIT handle, U8BIT data_identifier,
void *data_ptr, U32BIT data_length)
2977 FUNCTION_START(PESCollectionCallback);
2978 USE_UNWANTED_PARAM(handle);
2979 USE_UNWANTED_PARAM(data_identifier);
2981 AddPESDataToQueue(data_ptr, data_length);
2983 FUNCTION_FINISH(PESCollectionCallback);
2986 static BOOLEAN AddPESDataToQueue(
void *data_ptr, U32BIT data_length)
2989 U16BIT data_remaining;
3011 U8BIT *pes_packet_header_ptr;
3046 U8BIT *data_identifier_ptr;
3047 U8BIT *pes_data_field_ptr;
3048 U8BIT pts_dts_flags, pts_present;
3054 static U8BIT pes_packet_header_validator[4] = { 0x00, 0x00, 0x01, 0xbd };
3056 FUNCTION_START(AddPESDataToQueue);
3058 USE_UNWANTED_PARAM(data_length);
3062 if (IsPacketQueueingRequired() == TRUE)
3064 pes_packet_header_ptr = (U8BIT *)data_ptr;
3067 if (!memcmp(pes_packet_header_ptr, pes_packet_header_validator,
sizeof(pes_packet_header_validator)))
3070 data_identifier_ptr = pes_packet_header_ptr + *(pes_packet_header_ptr + 8) + 9;
3073 if ((*data_identifier_ptr >= 0x10) &&
3074 (*data_identifier_ptr <= 0x1f))
3077 pts_dts_flags = (pes_packet_header_ptr[7] & 0xc0) >> 6;
3078 pts_present = ((pts_dts_flags & 0x2) >> 1);
3082 if (!GetPesPts(&pes_packet_header_ptr[9], pts))
3085 memset(pts, 0x00, 5);
3092 data_remaining = (*(pes_packet_header_ptr + 4) << 8) + *(pes_packet_header_ptr + 5) - 4;
3093 data_remaining -= *(pes_packet_header_ptr + 8);
3096 pes_data_field_ptr = data_identifier_ptr + 1;
3100 while (data_remaining >= PES_DATA_FIELD_WIDTH)
3106 if ((*(pes_data_field_ptr + 1) == 0x2c) &&
3107 (*(pes_data_field_ptr + 3) == 0xe4))
3110 if ((queue_item.data =
STB_GetMemory(PES_DATA_FIELD_WIDTH - 4)) != NULL)
3112 memcpy(queue_item.data, pes_data_field_ptr + 4, PES_DATA_FIELD_WIDTH - 4);
3114 queue_item.pts_present = pts_present;
3117 memcpy(queue_item.pts, pts, 5);
3120 if (
STB_OSWriteQueue(collation_queue, (
void *)&queue_item,
sizeof(queue_item), TIMEOUT_NOW))
3123 if (queue_count > max_queue_count)
3125 max_queue_count = queue_count;
3126 EBU_DBG(
"%s: max_queue_count=%u\n", __FUNCTION__, max_queue_count);
3131 EBU_DBG(
"%s: Failed to write to collation queue\n", __FUNCTION__);
3138 pes_data_field_ptr += PES_DATA_FIELD_WIDTH;
3139 data_remaining -= PES_DATA_FIELD_WIDTH;
3145 FUNCTION_FINISH(AddPESDataToQueue);
3150 static void PESCollationTask(
void *param)
3154 USE_UNWANTED_PARAM(param);
3159 collation_started = TRUE;
3160 while (!stop_collation)
3162 if (
STB_OSReadQueue(collation_queue, &queue_item,
sizeof(queue_item), TIMEOUT_NEVER))
3166 if (queue_item.data != NULL)
3178 collation_started = FALSE;
3195 static BOOLEAN InitialiseCollation(
void)
3200 FUNCTION_START(InitialiseCollation);
3206 if (page_request_info.semaphore == NULL)
3211 if (page_display_info.page_semaphore == NULL)
3215 if (page_display_info.page_index_semaphore == NULL)
3219 if (page_display_info.carousel_page_semaphore == NULL)
3223 if (page_display_info.time_filler_header_data_semaphore == NULL)
3227 if (page_display_info.page_scale_semaphore == NULL)
3232 is_broadcast_service_data_defined[0] = FALSE;
3233 is_broadcast_service_data_defined[1] = FALSE;
3239 if ((page_request_info.semaphore != NULL) &&
3240 (page_display_info.page_semaphore != NULL) &&
3241 (page_display_info.page_index_semaphore != NULL) &&
3242 (page_display_info.carousel_page_semaphore != NULL) &&
3243 (page_display_info.time_filler_header_data_semaphore != NULL) &&
3244 (page_display_info.page_scale_semaphore != NULL))
3247 for (i = 0; i != 8; i++)
3250 if (magazine_array[i].m_mutex == NULL)
3253 DBGPRINT(
"STB_OSCreateMutex failed");
3259 FUNCTION_FINISH(InitialiseCollation);
3281 U8BIT packet_number, magazine_number, control_byte;
3282 U8BIT designation_code, magazine_index, format_number;
3283 U32BIT triplet_value;
3284 BOOLEAN retval, update_required;
3290 CheckPageRequest(pts_valid, pts);
3292 if (GetPacketAddress(&packet_number, &magazine_number, data_ptr))
3297 if (packet_number == 0)
3342 if (GetHamming8Byte(data_ptr + 7, &control_byte) == TRUE)
3344 if (control_byte & 0x01)
3351 for (magazine_index = 0; magazine_index != 8; magazine_index++)
3354 if (magazine_array[magazine_index].m_page.is_header_defined == TRUE)
3356 NotifyPageCollated(&magazine_array[magazine_index].m_page, magazine_index,
3359 magazine_array[magazine_index].m_page.is_header_defined = FALSE;
3372 if (magazine_array[magazine_number].m_page.is_header_defined == TRUE)
3374 NotifyPageCollated(&magazine_array[magazine_number].m_page, magazine_number,
3380 memcpy(magazine_array[magazine_number].m_page.header, data_ptr, MAX_COLUMN);
3382 magazine_array[magazine_number].m_page.is_header_defined = TRUE;
3384 if (magazine_array[magazine_number].m_page.display_data_defined_mask)
3386 DBGPRINT(
"reseting mask %#x", magazine_array[magazine_number].m_page.display_data_defined_mask );
3388 magazine_array[magazine_number].m_page.display_data_defined_mask = 0;
3390 magazine_array[magazine_number].m_page.basic_enhancement_data_defined_mask = 0;
3392 magazine_array[magazine_number].m_page.is_editorial_page_linking_data_defined = FALSE;
3394 magazine_array[magazine_number].m_page.specific_data.is_defined[0] = FALSE;
3395 magazine_array[magazine_number].m_page.specific_data.is_defined[1] = FALSE;
3398 else if ((packet_number >= 1) &&
3399 (packet_number <= MAX_ROWS))
3416 memcpy(magazine_array[magazine_number].m_page.display_data[packet_number], data_ptr, MAX_COLUMN);
3419 magazine_array[magazine_number].m_page.display_data_defined_mask |= 1 << packet_number;
3421 else if (packet_number == 26)
3444 if (GetHamming8Byte(data_ptr, &designation_code) == TRUE)
3447 memcpy(magazine_array[magazine_number].m_page.basic_enhancement_data[designation_code],
3448 data_ptr, MAX_COLUMN);
3450 if (designation_code)
3452 magazine_array[magazine_number].m_page.basic_enhancement_data_defined_mask |=
3453 1 << designation_code;
3457 magazine_array[magazine_number].m_page.basic_enhancement_data_defined_mask |= 1;
3461 else if (packet_number == 27)
3510 if (GetHamming8Byte(data_ptr, &designation_code) == TRUE)
3513 if (designation_code == 0)
3517 memcpy(magazine_array[magazine_number].m_page.editorial_page_linking_data,
3518 data_ptr, MAX_COLUMN);
3520 magazine_array[magazine_number].m_page.is_editorial_page_linking_data_defined = TRUE;
3524 else if (packet_number == 28)
3549 if (GetHamming8Byte(data_ptr, &designation_code) == TRUE)
3552 if (designation_code == 0)
3554 if (GetHammimg24Value(data_ptr + 1, &triplet_value) == TRUE)
3558 if ((triplet_value & 0x0fL) == 0)
3561 memcpy(magazine_array[magazine_number].m_page.specific_data.s_data[0],
3562 data_ptr, MAX_COLUMN);
3564 magazine_array[magazine_number].m_page.specific_data.is_defined[0] = TRUE;
3569 else if (designation_code == 1)
3572 memcpy(magazine_array[magazine_number].m_page.specific_data.s_data[1], data_ptr, MAX_COLUMN);
3574 magazine_array[magazine_number].m_page.specific_data.is_defined[1] = TRUE;
3578 else if (packet_number == 29)
3605 if (GetHamming8Byte(data_ptr, &designation_code) == TRUE)
3608 if ((designation_code == 0) ||
3609 (designation_code == 1))
3611 if (GetHammimg24Value(data_ptr + 1, &triplet_value) == TRUE)
3615 if ((triplet_value & 0x0fL) == 0)
3617 update_required = FALSE;
3619 if (magazine_array[magazine_number].m_specific_data.is_defined[designation_code] == TRUE)
3621 if (memcmp(magazine_array[magazine_number].m_specific_data.s_data[designation_code],
3622 data_ptr, MAX_COLUMN))
3624 update_required = TRUE;
3629 update_required = TRUE;
3632 if (update_required == TRUE)
3635 memcpy(magazine_array[magazine_number].m_specific_data.s_data[designation_code],
3636 data_ptr, MAX_COLUMN);
3638 magazine_array[magazine_number].m_specific_data.is_defined[designation_code] = TRUE;
3640 if (page_display_info.page_number)
3642 if (GetMagazineIndexFromPageNumber(page_display_info.page_number) ==
3650 memcpy(page_display_info.mgzn_data.s_data[designation_code],
3651 data_ptr, MAX_COLUMN);
3653 page_display_info.mgzn_data.is_defined[designation_code] = TRUE;
3655 page_display_info.pts_valid = pts_valid;
3658 memcpy(page_display_info.page_pts, pts, 5);
3659 EBU_DBG(
"PageUpdate PTS: 0x%02x%02x%02x%02x%02x", pts[0], pts[1],
3660 pts[2], pts[3], pts[4]);
3663 page_display_info.page_updated = TRUE;
3674 else if ((packet_number == 30) &&
3675 (magazine_number == 0))
3735 if (GetHamming8Byte(data_ptr, &designation_code) == TRUE)
3739 if (designation_code < 4)
3741 format_number = designation_code >> 1;
3743 memcpy(broadcast_service_data[format_number], data_ptr, MAX_COLUMN);
3744 is_broadcast_service_data_defined[format_number] = TRUE;
3746 if (broadcast_index_page_invocation_required == TRUE)
3748 broadcast_index_page_invocation_required = FALSE;
3788 static void RequestPage(U16BIT page_number, U16BIT page_sub_code)
3790 BOOLEAN confirm_request;
3792 FUNCTION_START(RequestPage);
3794 confirm_request = FALSE;
3796 if (page_request_info.type != REQUEST_TYPE_EXPLICIT)
3798 confirm_request = TRUE;
3801 page_number &= CACHE_PAGE_NUMBER_MASK;
3805 if (page_number != page_request_info.page_number)
3807 confirm_request = TRUE;
3810 if (page_sub_code == PAGE_SUB_CODE_UNDEFINED)
3812 if (page_request_info.page_sub_code != PAGE_SUB_CODE_UNDEFINED)
3814 confirm_request = TRUE;
3817 else if ((page_sub_code & 0x3f7f) != page_request_info.page_sub_code)
3819 page_sub_code &= 0x3f7f;
3820 confirm_request = TRUE;
3823 if (confirm_request == TRUE)
3827 page_request_info.type = REQUEST_TYPE_EXPLICIT;
3829 page_request_info.page_number = page_number;
3830 page_request_info.page_sub_code = page_sub_code;
3832 page_request_info.pending = TRUE;
3837 FUNCTION_FINISH(RequestPage);
3853 static void RequestIndexPage(
void)
3855 FUNCTION_START(RequestIndexPage);
3857 if (page_request_info.type != REQUEST_TYPE_INDEX)
3861 page_request_info.type = REQUEST_TYPE_INDEX;
3863 page_request_info.pending = TRUE;
3868 FUNCTION_FINISH(RequestIndexPage);
3889 static void RequestNextPrevious(E_REQUEST_TYPE request_type, BOOLEAN increment)
3891 FUNCTION_START(RequestNextPrevious);
3893 if (page_request_info.type != request_type)
3899 page_request_info.type = request_type;
3902 if (increment == TRUE)
3904 page_request_info.param = 1;
3908 page_request_info.param = -1;
3911 page_request_info.pending = TRUE;
3921 if (page_request_info.pending == TRUE)
3925 if (increment == TRUE)
3927 page_request_info.param++;
3931 page_request_info.param--;
3938 if (increment == TRUE)
3940 page_request_info.param = 1;
3944 page_request_info.param = -1;
3947 page_request_info.pending = TRUE;
3953 FUNCTION_FINISH(RequestNextPrevious);
3971 static void RequestNextAvailablePage(
void)
3973 FUNCTION_START(RequestNextAvailablePage);
3975 RequestNextPrevious(REQUEST_TYPE_NEXT_PREV_AVAILABLE, TRUE);
3977 FUNCTION_FINISH(RequestNextAvailablePage);
3995 static void RequestPreviousAvailablePage(
void)
3997 FUNCTION_START(RequestPreviousAvailablePage);
3999 RequestNextPrevious(REQUEST_TYPE_NEXT_PREV_AVAILABLE, FALSE);
4001 FUNCTION_FINISH(RequestPreviousAvailablePage);
4018 static void RequestNextVisitedPage(
void)
4020 FUNCTION_START(RequestNextVisitedPage);
4022 RequestNextPrevious(REQUEST_TYPE_NEXT_PREV_VISITED, TRUE);
4024 FUNCTION_FINISH(RequestNextVisitedPage);
4041 static void RequestPreviousVisitedPage(
void)
4043 FUNCTION_START(RequestPreviousVisitedPage);
4045 RequestNextPrevious(REQUEST_TYPE_NEXT_PREV_VISITED, FALSE);
4047 FUNCTION_FINISH(RequestPreviousVisitedPage);
4062 static void RequestEditorialLinkPage(U16BIT index)
4064 FUNCTION_START(RequestEditorialLinkPage);
4066 if (index < MAX_EDITORIAL_LINKS)
4068 if (page_request_info.type != REQUEST_TYPE_EDITORIAL_LINK)
4072 page_request_info.type = REQUEST_TYPE_EDITORIAL_LINK;
4074 page_request_info.param = index;
4076 page_request_info.pending = TRUE;
4084 if (page_request_info.param != index)
4086 page_request_info.param = index;
4088 page_request_info.pending = TRUE;
4095 FUNCTION_FINISH(RequestEditorialLinkPage);
4114 static void RequestNextSubPage(
void)
4116 FUNCTION_START(RequestNextSubPage);
4118 RequestNextPrevious(REQUEST_TYPE_NEXT_PREV_SUB, TRUE);
4120 FUNCTION_FINISH(RequestNextSubPage);
4139 static void RequestPreviousSubPage(
void)
4141 FUNCTION_START(RequestPreviousSubPage);
4143 RequestNextPrevious(REQUEST_TYPE_NEXT_PREV_SUB, FALSE);
4145 FUNCTION_FINISH(RequestPreviousSubPage);
4163 static U16BIT GetMaximumEditorialLinkTiers(
void)
4167 FUNCTION_START(GetMaximumEditorialLinkTiers);
4169 if (caching_method == EBUTT_CACHING_METHOD_NAVIGATION)
4179 retval = MAX_EDITORIAL_LINK_TIERS;
4182 FUNCTION_FINISH(GetMaximumEditorialLinkTiers);
4223 FUNCTION_START(FindEditorialLinkRecursive);
4228 if (base_ptr != NULL)
4231 if (base_ptr->page_number == page_number)
4243 sub_page_ptr = base_ptr->sub_page_list;
4245 while (sub_page_ptr != NULL)
4248 if (sub_page_ptr->is_parsed == TRUE)
4251 for (link_index = 0; link_index < MAX_EDITORIAL_LINKS; link_index++)
4256 if (FindEditorialLinkRecursive(
4258 &found_ptr, parent_ptr, page_number) == TRUE)
4266 if (parent_ptr != NULL)
4268 if (*parent_ptr == NULL)
4270 *parent_ptr = base_ptr;
4289 sub_page_ptr = sub_page_ptr->next_ptr;
4294 FUNCTION_FINISH(FindEditorialLinkRecursive);
4331 FUNCTION_START(FindEditorialLinkPageRequest);
4336 if (base_ptr != NULL)
4338 if (parent_ptr != NULL)
4344 if (base_ptr->page_number == page_number)
4357 if (FindEditorialLinkRecursive(base_ptr, ptr, parent_ptr, page_number) == TRUE)
4359 if (parent_ptr != NULL)
4361 if (*parent_ptr == NULL)
4363 *parent_ptr = base_ptr;
4372 FUNCTION_FINISH(FindEditorialLinkPageRequest);
4404 U16BIT magazine_number, link_index;
4409 FUNCTION_START(GetEditorialLink);
4414 if (base_ptr != NULL)
4417 if (base_ptr->page_number == page_number)
4428 magazine_number = GetMagazineIndexFromPageNumber(page_number);
4431 sub_page_ptr = base_ptr->sub_page_list;
4433 while (sub_page_ptr != NULL)
4436 if (sub_page_ptr->is_parsed == TRUE)
4439 for (link_index = 0; link_index < MAX_EDITORIAL_LINKS; link_index++)
4445 &found_ptr, page_number) == TRUE)
4464 if ((sub_page_ptr->link_page_number[link_index] == page_number) &&
4465 (sub_page_ptr->link[link_index] == NULL))
4467 if (base_ptr->tier <= GetMaximumEditorialLinkTiers())
4471 while (*ptr == NULL)
4473 if (RemoveUnrequestedCacheContent(magazine_number, FALSE) == FALSE)
4484 (*ptr)->page_number = sub_page_ptr->link_page_number[link_index];
4485 (*ptr)->tier = base_ptr->tier + 1;
4487 (*ptr)->sub_page_list = NULL;
4489 sub_page_ptr->link[link_index] = (
void *)*ptr;
4508 sub_page_ptr = sub_page_ptr->next_ptr;
4513 FUNCTION_FINISH(GetEditorialLink);
4544 FUNCTION_START(RemoveEditorialLinkPageRequest);
4549 if (*base_ptr != NULL)
4552 if (*base_ptr == ptr)
4561 sub_page_ptr = (*base_ptr)->sub_page_list;
4563 while (sub_page_ptr != NULL)
4566 if (sub_page_ptr->is_parsed == TRUE)
4569 for (link_index = 0; link_index < MAX_EDITORIAL_LINKS; link_index++)
4572 if (sub_page_ptr->link[link_index] != NULL)
4577 if (RemoveEditorialLinkPageRequest(
4597 sub_page_ptr = sub_page_ptr->next_ptr;
4602 FUNCTION_FINISH(RemoveEditorialLinkPageRequest);
4627 static BOOLEAN GetSubPageEditorialLinks(
S_CACHE_SUBPAGE *sub_page_ptr,
4628 U16BIT *page_number_link_array,
4629 U16BIT *page_sub_code_link_array,
4630 U16BIT max_num_links, U16BIT magazine_number)
4637 FUNCTION_START(GetSubPageEditorialLinks);
4642 if (sub_page_ptr->collated_data.is_editorial_page_linking_data_defined == TRUE)
4645 link_ptr = &sub_page_ptr->collated_data.editorial_page_linking_data[1];
4648 for (link_index = 0; link_index < max_num_links; link_index++)
4651 if (GetPageReference(link_ptr, &page_reference_data, PAGE_REFERENCE_TYPE_EDITORIAL_LINK,
4652 magazine_number) == TRUE)
4655 *page_number_link_array = page_reference_data.page_number;
4656 *page_sub_code_link_array = page_reference_data.page_sub_code;
4663 *page_number_link_array = 0;
4664 *page_sub_code_link_array = 0;
4668 page_number_link_array++;
4669 page_sub_code_link_array++;
4675 FUNCTION_FINISH(GetSubPageEditorialLinks);
4696 U16BIT page_number, U16BIT sub_code)
4698 U16BIT magazine_number;
4705 FUNCTION_START(CreateEditorialLinkPageRequest);
4709 magazine_number = GetMagazineIndexFromPageNumber(page_number);
4712 while (*ptr == NULL)
4714 if (RemoveUnrequestedCacheContent(magazine_number, FALSE) == FALSE)
4724 (*ptr)->page_number = page_number;
4726 (*ptr)->sub_page_list = NULL;
4730 page_ptr = magazine_array[magazine_number].m_cache_page_ptr;
4731 while (page_ptr != NULL)
4733 if ((page_ptr->page_number & CACHE_PAGE_NUMBER_MASK) == page_number)
4735 subpage_ptr = page_ptr->subpage_ptr;
4738 while (subpage_ptr != NULL)
4740 if (subpage_ptr->sub_code == sub_code)
4747 while (request_sub_page_ptr == NULL)
4749 if (RemoveUnrequestedCacheContent(magazine_number, TRUE) == FALSE)
4758 if (request_sub_page_ptr != NULL)
4760 if (GetSubPageEditorialLinks(subpage_ptr, request_sub_page_ptr->link_page_number,
4761 request_sub_page_ptr->link_sub_code,
4762 MAX_EDITORIAL_LINKS, magazine_number) == TRUE)
4764 request_sub_page_ptr->sub_code = subpage_ptr->sub_code;
4765 memset(request_sub_page_ptr->link, 0,
sizeof(
void *) * MAX_EDITORIAL_LINKS);
4766 request_sub_page_ptr->is_parsed = TRUE;
4767 request_sub_page_ptr->next_ptr = (*ptr)->sub_page_list;
4768 (*ptr)->sub_page_list = request_sub_page_ptr;
4776 subpage_ptr = subpage_ptr->next_ptr;
4779 if ((is_found == FALSE) &&
4780 (sub_code != PAGE_SUB_CODE_UNDEFINED))
4784 while (request_sub_page_ptr == NULL)
4786 if (RemoveUnrequestedCacheContent(magazine_number, TRUE) == FALSE)
4795 if (request_sub_page_ptr != NULL)
4797 request_sub_page_ptr->sub_code = sub_code;
4798 request_sub_page_ptr->is_parsed = FALSE;
4799 request_sub_page_ptr->next_ptr = (*ptr)->sub_page_list;
4800 (*ptr)->sub_page_list = request_sub_page_ptr;
4807 page_ptr = page_ptr->next_ptr;
4815 FUNCTION_FINISH(CreateEditorialLinkPageRequest);
4837 FUNCTION_START(ReTierEditorialLinkPageRequests);
4844 sub_page_ptr = ptr->sub_page_list;
4845 while (sub_page_ptr != NULL)
4847 if (sub_page_ptr->is_parsed == TRUE)
4849 for (link_index = 0; link_index < MAX_EDITORIAL_LINKS; link_index++)
4851 if (sub_page_ptr->link[link_index] != NULL)
4858 sub_page_ptr = sub_page_ptr->next_ptr;
4862 FUNCTION_FINISH(ReTierEditorialLinkPageRequests);
4884 FUNCTION_START(KillEditorialLinkPageRequests);
4886 if (base_ptr != NULL)
4888 if (*base_ptr != NULL)
4890 sub_page_ptr = (*base_ptr)->sub_page_list;
4891 while (sub_page_ptr != NULL)
4893 if (sub_page_ptr->is_parsed == TRUE)
4895 for (link_index = 0; link_index < MAX_EDITORIAL_LINKS; link_index++)
4901 next_sub_page_ptr = sub_page_ptr->next_ptr;
4905 sub_page_ptr = next_sub_page_ptr;
4914 FUNCTION_FINISH(KillEditorialLinkPageRequests);
4937 FUNCTION_START(UpdateEditorialLinkPageRequestRecursive);
4942 RemoveEditorialLinkPageRequest(&editorial_link_request_root, ptr);
4944 sub_page_ptr = ptr->sub_page_list;
4945 while (sub_page_ptr != NULL)
4947 if (sub_page_ptr->is_parsed == TRUE)
4949 for (link_index = 0; link_index < MAX_EDITORIAL_LINKS; link_index++)
4951 if (sub_page_ptr->link[link_index] == NULL)
4956 if (FindEditorialLinkPageRequest(editorial_link_request_root,
4958 NULL, sub_page_ptr->link_page_number[link_index]) == TRUE)
4962 ReTierEditorialLinkPageRequests(
4969 UpdateEditorialLinkPageRequestRecursive(
4974 else if (FindEditorialLinkPageRequest(temp_editorial_link_request_root, &other_ptr,
4976 sub_page_ptr->link_page_number[link_index]) == TRUE)
4979 if (parent_ptr != NULL)
4981 if (parent_ptr->tier > tier)
4985 RemoveEditorialLinkPageRequest(&parent_ptr, other_ptr);
4989 ReTierEditorialLinkPageRequests(other_ptr, tier);
4991 sub_page_ptr->link[link_index] = other_ptr;
4993 UpdateEditorialLinkPageRequestRecursive(
5000 sub_page_ptr->link[link_index] = NULL;
5005 sub_page_ptr->link[link_index] = NULL;
5010 UpdateEditorialLinkPageRequestRecursive(
5017 sub_page_ptr = sub_page_ptr->next_ptr;
5020 FUNCTION_FINISH(UpdateEditorialLinkPageRequestRecursive);
5035 static void UpdateEditorialLinkPageRequest(U16BIT page_number, U16BIT sub_code)
5039 FUNCTION_START(UpdateEditorialLinkPageRequest);
5042 if (FindEditorialLinkPageRequest(editorial_link_request_root, &ptr, NULL, page_number) == TRUE)
5045 if (ptr == editorial_link_request_root)
5053 if (CreateEditorialLinkPageRequest(&ptr, page_number, sub_code) == FALSE)
5063 temp_editorial_link_request_root = ptr;
5067 UpdateEditorialLinkPageRequestRecursive(ptr, 0);
5070 KillEditorialLinkPageRequests(&editorial_link_request_root);
5073 editorial_link_request_root = temp_editorial_link_request_root;
5074 temp_editorial_link_request_root = NULL;
5077 FUNCTION_FINISH(UpdateEditorialLinkPageRequest);
5080 static void SetPageFlag( U16BIT page_num, U16BIT flag )
5085 mgzn_ptr = magazine_array + GetMagazineIndexFromPageNumber(page_num);
5087 page_ptr = mgzn_ptr->m_cache_page_ptr;
5088 while (page_ptr != NULL)
5090 if ((page_ptr->page_number & CACHE_PAGE_NUMBER_MASK) == page_num)
5092 page_ptr->page_number |= flag;
5095 page_ptr = page_ptr->next_ptr;
5100 static void UnsetPageFlag( U16BIT page_num, U16BIT flag )
5105 mgzn_ptr = magazine_array + GetMagazineIndexFromPageNumber(page_num);
5107 page_ptr = mgzn_ptr->m_cache_page_ptr;
5108 while (page_ptr != NULL)
5110 if ((page_ptr->page_number & CACHE_PAGE_NUMBER_MASK) == page_num)
5112 page_ptr->page_number &= ~flag;
5115 page_ptr = page_ptr->next_ptr;
5136 FUNCTION_START(FlagEditorialLinkPageRequests);
5140 SetPageFlag( ptr->page_number, CACHE_PAGE_FLOF_REQUESTED );
5142 sub_page_ptr = ptr->sub_page_list;
5143 while (sub_page_ptr != NULL)
5145 if (sub_page_ptr->is_parsed == TRUE)
5147 for (link_index = 0; link_index < MAX_EDITORIAL_LINKS; link_index++)
5153 sub_page_ptr = sub_page_ptr->next_ptr;
5157 FUNCTION_FINISH(FlagEditorialLinkPageRequests);
5175 U16BIT magazine_number, link_index;
5181 FUNCTION_START(DeterminePageEditorialLinks);
5183 if ((ptr != NULL) &&
5184 (ptr->tier <= GetMaximumEditorialLinkTiers()))
5186 request_sub_page_ptr = ptr->sub_page_list;
5187 while (request_sub_page_ptr != NULL)
5189 if (request_sub_page_ptr->sub_code == subpage_ptr->sub_code)
5193 request_sub_page_ptr = request_sub_page_ptr->next_ptr;
5196 magazine_number = GetMagazineIndexFromPageNumber(ptr->page_number);
5198 if (request_sub_page_ptr == NULL)
5202 while (request_sub_page_ptr == NULL)
5204 if (RemoveUnrequestedCacheContent(magazine_number, FALSE) == FALSE)
5213 if (request_sub_page_ptr != NULL)
5215 request_sub_page_ptr->sub_code = subpage_ptr->sub_code;
5216 request_sub_page_ptr->is_parsed = FALSE;
5217 request_sub_page_ptr->next_ptr = ptr->sub_page_list;
5218 ptr->sub_page_list = request_sub_page_ptr;
5222 if (request_sub_page_ptr != NULL)
5224 if (request_sub_page_ptr->is_parsed == FALSE)
5226 if (GetSubPageEditorialLinks(subpage_ptr, request_sub_page_ptr->link_page_number,
5227 request_sub_page_ptr->link_sub_code, MAX_EDITORIAL_LINKS,
5228 magazine_number) == TRUE)
5230 memset(request_sub_page_ptr->link, 0,
sizeof(
void *) * MAX_EDITORIAL_LINKS);
5231 request_sub_page_ptr->is_parsed = TRUE;
5233 for (link_index = 0; link_index < MAX_EDITORIAL_LINKS; link_index++)
5235 if (request_sub_page_ptr->link_page_number[link_index] != 0)
5242 magazine_number = GetMagazineIndexFromPageNumber(request_sub_page_ptr->link_page_number[link_index]);
5246 page_ptr = magazine_array[magazine_number].m_cache_page_ptr;
5247 while (page_ptr != NULL)
5249 if ((page_ptr->page_number & CACHE_PAGE_NUMBER_MASK) ==
5250 request_sub_page_ptr->link_page_number[link_index])
5252 subpage_ptr = page_ptr->subpage_ptr;
5254 while (subpage_ptr != NULL)
5256 if ((subpage_ptr->sub_code == request_sub_page_ptr->link_sub_code[link_index]) ||
5257 (request_sub_page_ptr->link_sub_code[link_index] == PAGE_SUB_CODE_UNDEFINED))
5263 subpage_ptr = subpage_ptr->next_ptr;
5266 if (is_found == TRUE)
5272 page_ptr = page_ptr->next_ptr;
5276 if (is_found == TRUE)
5278 if (FindEditorialLinkPageRequest(editorial_link_request_root, NULL, NULL,
5279 request_sub_page_ptr->link_page_number[link_index]) == FALSE)
5284 while (new_ptr == NULL)
5286 if (RemoveUnrequestedCacheContent(magazine_number, FALSE) == FALSE)
5295 if (new_ptr != NULL)
5297 new_ptr->page_number =
5298 request_sub_page_ptr->link_page_number[link_index];
5299 new_ptr->tier = ptr->tier + 1;
5301 new_ptr->sub_page_list = NULL;
5303 request_sub_page_ptr->link[link_index] = (
void *)new_ptr;
5305 DeterminePageEditorialLinks(new_ptr, subpage_ptr);
5316 FUNCTION_FINISH(DeterminePageEditorialLinks);
5333 static BOOLEAN SearchRequestArray(U16BIT *array_ptr, U16BIT array_size, BOOLEAN find_highest,
5334 U16BIT **return_array_ptr)
5336 U16BIT index, found_page_number;
5339 FUNCTION_START(SearchRequestArray);
5345 found_page_number = 0;
5349 found_page_number = INVALID_PREVNEXT_CACHE_PAGE_NUMBER;
5352 for (index = 0; index < array_size; index++)
5356 if (array_ptr[index] > found_page_number)
5358 found_page_number = array_ptr[index];
5359 *return_array_ptr = &array_ptr[index];
5365 if (array_ptr[index] < found_page_number)
5367 found_page_number = array_ptr[index];
5368 *return_array_ptr = &array_ptr[index];
5374 if (retval == FALSE)
5376 *return_array_ptr = &array_ptr[0];
5379 FUNCTION_FINISH(SearchRequestArray);
5396 static BOOLEAN SearchPreviousRequestArray(BOOLEAN find_highest, U16BIT **return_array_ptr)
5400 FUNCTION_START(SearchPreviousRequestArray);
5402 retval = SearchRequestArray(previous_cache_request_array, NUM_PREVIOUS_CACHE_REQUESTS, find_highest, return_array_ptr);
5404 FUNCTION_FINISH(SearchPreviousRequestArray);
5421 static BOOLEAN SearchNextRequestArray(BOOLEAN find_highest, U16BIT **return_array_ptr)
5426 FUNCTION_START(SearchNextRequestArray);
5428 if (next_cache_request_array[0] == 0)
5430 for (index = 0; index < NUM_NEXT_CACHE_REQUESTS; index++)
5432 next_cache_request_array[index] = INVALID_PREVNEXT_CACHE_PAGE_NUMBER;
5436 retval = SearchRequestArray(next_cache_request_array, NUM_NEXT_CACHE_REQUESTS, find_highest,
5439 FUNCTION_FINISH(SearchNextRequestArray);
5455 static BOOLEAN IsInPreviousRequestArray(U16BIT page_number)
5460 FUNCTION_START(IsInPreviousRequestArray);
5464 for (index = 0; index < NUM_PREVIOUS_CACHE_REQUESTS; index++)
5466 if (previous_cache_request_array[index] == page_number)
5473 FUNCTION_FINISH(IsInPreviousRequestArray);
5489 static BOOLEAN IsInNextRequestArray(U16BIT page_number)
5494 FUNCTION_START(IsInNextRequestArray);
5498 if (next_cache_request_array[0] == 0)
5500 for (index = 0; index < NUM_NEXT_CACHE_REQUESTS; index++)
5502 next_cache_request_array[index] = INVALID_PREVNEXT_CACHE_PAGE_NUMBER;
5506 for (index = 0; index < NUM_NEXT_CACHE_REQUESTS; index++)
5508 if (next_cache_request_array[index] == page_number)
5515 FUNCTION_FINISH(IsInNextRequestArray);
5532 static BOOLEAN GetGlobalIndexPage(U16BIT *page_number, U16BIT *page_sub_code)
5537 FUNCTION_START(GetGlobalIndexPage);
5541 if (is_broadcast_service_data_defined[0] == TRUE)
5543 if (GetPageReference(&broadcast_service_data[0][1], &page_reference_data,
5544 PAGE_REFERENCE_TYPE_GLOBAL_INDEX, 0) == TRUE)
5550 if (retval == FALSE)
5552 if (is_broadcast_service_data_defined[1] == TRUE)
5554 if (GetPageReference(&broadcast_service_data[1][1], &page_reference_data,
5555 PAGE_REFERENCE_TYPE_GLOBAL_INDEX, 0) == TRUE)
5564 *page_number = page_reference_data.page_number;
5565 *page_sub_code = page_reference_data.page_sub_code;
5568 FUNCTION_FINISH(GetGlobalIndexPage);
5585 static BOOLEAN GetIndexPage(U16BIT *page_number, U16BIT *page_sub_code)
5587 U16BIT magazine_number;
5591 FUNCTION_START(GetIndexPage);
5597 if (page_display_info.page_number)
5599 if (page_display_info.page_source.is_editorial_page_linking_data_defined == TRUE)
5601 magazine_number = GetMagazineIndexFromPageNumber(page_display_info.page_number);
5603 if (GetPageReference(&page_display_info.page_source.editorial_page_linking_data[31],
5604 &page_reference_data,
5605 PAGE_REFERENCE_TYPE_EDITORIAL_LINK, magazine_number) == TRUE)
5607 *page_number = page_reference_data.page_number;
5608 *page_sub_code = page_reference_data.page_sub_code;
5615 if (retval == FALSE)
5617 retval = GetGlobalIndexPage(page_number, page_sub_code);
5620 FUNCTION_FINISH(GetIndexPage);
5637 static BOOLEAN GetAvailablePage(U16BIT *page_number, S16BIT page_increment)
5640 U16BIT page_tens, page_units, magazine_number, num_page_tests, page_offset;
5643 FUNCTION_START(GetAvailablePage);
5647 if (page_number != NULL)
5649 magazine_number = GetMagazineIndexFromPageNumber(*page_number);
5651 page_tens = (*page_number & 0x00f0) >> 4;
5652 page_units = *page_number & 0x000f;
5656 while ((page_increment != 0) &&
5657 (num_page_tests < 800))
5659 if (page_increment > 0)
5661 if (page_units == 9)
5669 if (magazine_number == 7)
5671 magazine_number = 0;
5690 if (page_units == 0)
5698 if (magazine_number == 0)
5700 magazine_number = 7;
5718 page_offset = (page_tens << 4) + page_units;
5720 flag = magazine_array[magazine_number].m_cache_valid_page_array[page_offset >> 3] & 1 <<
5721 (page_offset & 0x07);
5725 if (page_increment > 0)
5734 if (page_increment == 0)
5736 if (magazine_number == 0)
5738 *page_number = 0x800 + page_offset;
5742 *page_number = (magazine_number << 8) + page_offset;
5754 FUNCTION_FINISH(GetAvailablePage);
5772 static BOOLEAN GetVisitedPage(U16BIT *page_number, U16BIT *page_sub_code, S16BIT page_increment)
5776 FUNCTION_START(GetVisitedPage);
5778 USE_UNWANTED_PARAM(page_sub_code);
5782 while (page_increment != 0)
5784 if (page_increment > 0)
5786 if (GetNextPageFromHistory(page_number) == FALSE)
5794 if (GetPreviousPageFromHistory(page_number) == FALSE)
5804 FUNCTION_FINISH(GetVisitedPage);
5822 static BOOLEAN GetEditorialLinkPage(U16BIT *page_number, U16BIT *page_sub_code, U16BIT link_index)
5824 U16BIT magazine_number;
5829 FUNCTION_START(GetEditorialLinkPage);
5834 if (page_display_info.page_source.is_editorial_page_linking_data_defined == TRUE)
5837 link_ptr = &page_display_info.page_source.editorial_page_linking_data[1];
5839 link_ptr += link_index * 6;
5841 magazine_number = GetMagazineIndexFromPageNumber(page_display_info.page_number);
5844 if (GetPageReference(link_ptr, &page_reference_data, PAGE_REFERENCE_TYPE_EDITORIAL_LINK,
5845 magazine_number) == TRUE)
5848 *page_number = page_reference_data.page_number;
5849 *page_sub_code = page_reference_data.page_sub_code;
5855 FUNCTION_FINISH(GetEditorialLinkPage);
5874 static BOOLEAN GetSubPage(U16BIT *new_page_sub_code, U16BIT current_page_number,
5875 U16BIT current_page_sub_code, S16BIT page_increment)
5878 U16BIT magazine_number, num_sub_pages, ref_index1, ref_index2;
5884 FUNCTION_START(GetSubPage);
5888 if (IsRollingSubCode(current_page_sub_code) == TRUE)
5890 magazine_number = GetMagazineIndexFromPageNumber(current_page_number);
5894 page_ptr = magazine_array[magazine_number].m_cache_page_ptr;
5896 while (page_ptr != NULL)
5898 if ((page_ptr->page_number & CACHE_PAGE_NUMBER_MASK) == current_page_number)
5901 subpage_ptr = page_ptr->subpage_ptr;
5902 while (subpage_ptr != NULL)
5904 if (IsRollingSubCode(subpage_ptr->sub_code) == TRUE)
5908 subpage_ptr = subpage_ptr->next_ptr;
5911 if (num_sub_pages < 2)
5918 if (sub_page_ref_array == NULL)
5924 subpage_ptr = page_ptr->subpage_ptr;
5925 while (subpage_ptr != NULL)
5927 if (IsRollingSubCode(subpage_ptr->sub_code) == TRUE)
5929 sub_page_ref_array[ref_index1] = subpage_ptr;
5932 subpage_ptr = subpage_ptr->next_ptr;
5935 for (ref_index1 = 0; ref_index1 < (num_sub_pages - 1); ref_index1++)
5937 for (ref_index2 = ref_index1 + 1; ref_index2 < num_sub_pages; ref_index2++)
5939 if (sub_page_ref_array[ref_index1]->sub_code >
5940 sub_page_ref_array[ref_index2]->sub_code)
5942 temp_sub_page_ref = sub_page_ref_array[ref_index1];
5943 sub_page_ref_array[ref_index1] = sub_page_ref_array[ref_index2];
5944 sub_page_ref_array[ref_index2] = temp_sub_page_ref;
5949 for (ref_index1 = 0; ref_index1 < num_sub_pages; ref_index1++)
5951 if (sub_page_ref_array[ref_index1]->sub_code == current_page_sub_code)
5953 if (page_increment > 0)
5955 ref_index1 += (U16BIT)page_increment;
5959 ref_index1 += num_sub_pages - ((U16BIT)-page_increment % num_sub_pages);
5962 ref_index1 %= num_sub_pages;
5964 *new_page_sub_code = sub_page_ref_array[ref_index1]->sub_code;
5974 if (retval == FALSE)
5977 subpage_ptr = page_ptr->subpage_ptr;
5978 while (subpage_ptr != NULL)
5980 if (subpage_ptr->sub_code == current_page_sub_code)
5984 subpage_ptr = subpage_ptr->next_ptr;
5987 if (subpage_ptr != NULL)
5990 subpage_ptr = subpage_ptr->next_ptr;
5992 while (subpage_ptr != NULL)
5994 if (IsRollingSubCode(subpage_ptr->sub_code) == TRUE)
5996 *new_page_sub_code = subpage_ptr->sub_code;
6000 subpage_ptr = subpage_ptr->next_ptr;
6003 if (subpage_ptr == NULL)
6007 subpage_ptr = page_ptr->subpage_ptr;
6009 while (subpage_ptr != NULL)
6011 if (subpage_ptr->sub_code == current_page_sub_code)
6017 if (IsRollingSubCode(subpage_ptr->sub_code) == TRUE)
6019 *new_page_sub_code = subpage_ptr->sub_code;
6023 subpage_ptr = subpage_ptr->next_ptr;
6032 page_ptr = page_ptr->next_ptr;
6037 FUNCTION_FINISH(GetSubPage);
6053 static void DriverReset(
void)
6055 U16BIT magazine_number;
6061 FUNCTION_START(DriverReset);
6063 DBGPRINT(
" ****** CLEARING DATA ****** ");
6065 for (magazine_number = 0; magazine_number != 8; magazine_number++)
6069 page_ptr = magazine_array[magazine_number].m_cache_page_ptr;
6071 while (page_ptr != NULL)
6073 subpage_ptr = page_ptr->subpage_ptr;
6074 while (subpage_ptr != NULL)
6076 next_subpage_ptr = subpage_ptr->next_ptr;
6080 subpage_ptr = next_subpage_ptr;
6083 next_page_ptr = page_ptr->next_ptr;
6087 page_ptr = next_page_ptr;
6090 memset(magazine_array[magazine_number].m_cache_valid_page_array, 0, 32);
6092 magazine_array[magazine_number].m_cache_page_ptr = NULL;
6094 magazine_array[magazine_number].m_specific_data.is_defined[0] = FALSE;
6095 magazine_array[magazine_number].m_specific_data.is_defined[1] = FALSE;
6097 memset( &magazine_array[magazine_number].m_page, 0x00,
sizeof(
S_MAGAZINE_PAGE));
6102 is_broadcast_service_data_defined[0] = FALSE;
6103 is_broadcast_service_data_defined[1] = FALSE;
6105 page_history_lwm = 0;
6106 page_history_hwm = 0;
6107 page_history_mwm = 0;
6108 page_history_request_page_number = 0xffff;
6110 history_cache_reset_requested = TRUE;
6111 editorial_link_cache_reset_requested = TRUE;
6113 page_control_info.state = PAGE_CONTROL_STATE_IDLE;
6114 page_control_info.reveal_required = FALSE;
6116 page_control_info.clear_required = FALSE;
6118 page_display_info.page_number = 0;
6119 page_display_info.page_sub_code = 0;
6120 page_display_info.subtitle = FALSE;
6121 page_display_info.pts_valid = FALSE;
6122 page_display_info.time_offset = 0;
6125 memset( page_display_info.character_map, 0x00,
sizeof(page_display_info.character_map));
6126 memset( &page_display_info.page_source, 0x00,
sizeof(
S_MAGAZINE_PAGE));
6129 page_display_copy.page_number = 0;
6130 page_display_copy.page_sub_code = 0;
6131 page_display_copy.subtitle = FALSE;
6132 page_display_copy.pts_valid = FALSE;
6133 page_display_copy.time_offset = 0;
6135 memset( page_display_copy.character_map, 0x00,
sizeof(page_display_copy.character_map));
6136 memset( &page_display_copy.page_source, 0x00,
sizeof(
S_MAGAZINE_PAGE));
6138 subtitle_timeout = 0;
6140 FUNCTION_FINISH(DriverReset);
6154 static void CheckPageRequest(BOOLEAN pts_valid, U8BIT *pts)
6160 U16BIT magazine_index, page_number, page_sub_code, item_count;
6161 BOOLEAN update_cache_requests;
6164 FUNCTION_START(CheckPageRequest);
6166 update_cache_requests = FALSE;
6170 if (page_request_info.pending == TRUE)
6172 page_request_info.pending = FALSE;
6174 switch (page_request_info.type)
6176 case REQUEST_TYPE_EXPLICIT:
6178 page_request_info.target_page_number = page_request_info.page_number;
6179 page_request_info.target_page_sub_code = page_request_info.page_sub_code;
6180 update_cache_requests = TRUE;
6182 NotifyRequestToPageHistory(page_request_info.target_page_number);
6185 case REQUEST_TYPE_INDEX:
6187 if (GetIndexPage(&page_request_info.target_page_number,
6188 &page_request_info.target_page_sub_code) == TRUE)
6190 update_cache_requests = TRUE;
6192 NotifyRequestToPageHistory(page_request_info.target_page_number);
6196 case REQUEST_TYPE_NEXT_PREV_AVAILABLE:
6198 page_request_info.target_page_sub_code = PAGE_SUB_CODE_UNDEFINED;
6200 if (page_request_info.target_page_number == 0)
6205 if (!page_display_info.page_number)
6211 page_request_info.target_page_number = page_display_info.page_number;
6214 if (GetAvailablePage(&page_request_info.target_page_number,
6215 page_request_info.param) == TRUE)
6217 NotifyRequestToPageHistory(page_request_info.target_page_number);
6219 update_cache_requests = TRUE;
6224 case REQUEST_TYPE_NEXT_PREV_VISITED:
6226 if (GetVisitedPage(&page_request_info.target_page_number,
6227 &page_request_info.target_page_sub_code,
6228 page_request_info.param) == TRUE)
6230 update_cache_requests = TRUE;
6234 case REQUEST_TYPE_EDITORIAL_LINK:
6236 if (page_display_info.page_number)
6238 if (GetEditorialLinkPage(&page_request_info.target_page_number,
6239 &page_request_info.target_page_sub_code,
6240 page_request_info.param) == TRUE)
6242 NotifyRequestToPageHistory(page_request_info.target_page_number);
6244 update_cache_requests = TRUE;
6249 case REQUEST_TYPE_NEXT_PREV_SUB:
6251 if (page_display_info.page_number)
6253 if (GetSubPage(&page_request_info.target_page_sub_code, page_display_info.page_number,
6254 page_display_info.page_sub_code,
6255 page_request_info.param) == TRUE)
6257 page_request_info.target_page_number = page_display_info.page_number;
6258 update_cache_requests = TRUE;
6263 case REQUEST_TYPE_CANCEL:
6265 page_request_info.target_page_number = page_display_info.page_number;
6266 page_request_info.target_page_sub_code = page_display_info.page_sub_code;
6268 NotifyRequestToPageHistory(0xffff);
6273 page_request_info.pending = FALSE;
6281 if (previousnext_cache_reset_requested == TRUE)
6283 for (index = 0; index < NUM_PREVIOUS_CACHE_REQUESTS; index++)
6285 previous_cache_request_array[index] = 0;
6287 for (index = 0; index < NUM_NEXT_CACHE_REQUESTS; index++)
6289 next_cache_request_array[index] = INVALID_PREVNEXT_CACHE_PAGE_NUMBER;
6292 previousnext_cache_reset_requested = FALSE;
6295 if (history_cache_reset_requested == TRUE)
6297 while (history_cache_request_list != NULL)
6299 history_ptr = history_cache_request_list->next_ptr;
6303 history_cache_request_list = history_ptr;
6306 update_cache_requests = TRUE;
6308 history_cache_reset_requested = FALSE;
6311 if (editorial_link_cache_reset_requested == TRUE)
6313 KillEditorialLinkPageRequests(&editorial_link_request_root);
6315 update_cache_requests = TRUE;
6317 editorial_link_cache_reset_requested = FALSE;
6320 if (update_cache_requests == TRUE)
6322 page_number = page_request_info.target_page_number;
6323 page_sub_code = page_request_info.target_page_sub_code;
6327 page_display_info.page_index_digit[0] = ((page_number & 0x0f00) >> 8) + PAGE_INDEX_DIGIT_0;
6328 page_display_info.page_index_digit[1] = ((page_number & 0x00f0) >> 4) + PAGE_INDEX_DIGIT_0;
6329 page_display_info.page_index_digit[2] = (page_number & 0x000f) + PAGE_INDEX_DIGIT_0;
6331 page_display_info.page_index_updated = TRUE;
6336 magazine_index = GetMagazineIndexFromPageNumber(page_number);
6341 page_ptr = magazine_array[magazine_index].m_cache_page_ptr;
6342 while (page_ptr != NULL)
6344 if ((page_ptr->page_number & CACHE_PAGE_NUMBER_MASK) == page_number)
6346 if (page_sub_code == PAGE_SUB_CODE_UNDEFINED)
6348 if (page_ptr->latest_subpage_ptr != NULL)
6350 NotifyDisplayUpdate(&page_ptr->latest_subpage_ptr->collated_data, magazine_index,
6351 page_number, page_ptr->latest_subpage_ptr->sub_code, FALSE, pts_valid, pts);
6357 subpage_ptr = page_ptr->subpage_ptr;
6359 while (subpage_ptr != NULL)
6361 if (subpage_ptr->sub_code == page_sub_code)
6363 NotifyDisplayUpdate(&subpage_ptr->collated_data, magazine_index, page_number,
6364 page_sub_code, FALSE, pts_valid, pts);
6368 subpage_ptr = subpage_ptr->next_ptr;
6371 if (subpage_ptr != NULL)
6378 page_ptr = page_ptr->next_ptr;
6387 for (magazine_index = 0; magazine_index != 8; magazine_index++)
6390 page_ptr = magazine_array[magazine_index].m_cache_page_ptr;
6392 while (page_ptr != NULL)
6394 page_ptr->page_number &= ~(CACHE_PAGE_FLOF_REQUESTED |
6395 CACHE_PAGE_HISTORY_REQUESTED |
6398 page_ptr = page_ptr->next_ptr;
6410 history_ptr = history_cache_request_list;
6411 prev_history_ptr = NULL;
6414 while (history_ptr != NULL)
6419 if (history_ptr->page_number == page_number)
6422 if (history_ptr != history_cache_request_list)
6425 prev_history_ptr->next_ptr = history_ptr->next_ptr;
6431 prev_history_ptr = history_ptr;
6432 history_ptr = history_ptr->next_ptr;
6435 switch (caching_method)
6437 case EBUTT_CACHING_METHOD_HISTORY:
6438 case EBUTT_CACHING_METHOD_NAVIGATION:
6439 case EBUTT_CACHING_METHOD_NAVIGATION_TREE:
6440 case EBUTT_CACHING_METHOD_ALL:
6446 if (history_ptr == NULL)
6448 if (item_count < MAX_HISTORY_CACHE_REQUESTS)
6451 while (history_ptr == NULL)
6454 magazine_index = GetMagazineIndexFromPageNumber(page_number);
6456 if (RemoveUnrequestedCacheContent(magazine_index, FALSE) == FALSE)
6467 if (history_ptr == NULL)
6469 if (history_cache_request_list != NULL)
6471 if (history_cache_request_list->next_ptr == NULL)
6474 history_cache_request_list->page_number = page_number;
6479 history_ptr = history_cache_request_list;
6480 prev_history_ptr = NULL;
6481 while (history_ptr->next_ptr != NULL)
6483 prev_history_ptr = history_ptr;
6484 history_ptr = history_ptr->next_ptr;
6487 if (prev_history_ptr != NULL)
6490 prev_history_ptr->next_ptr = NULL;
6505 if ((history_ptr != NULL) &&
6506 (history_ptr != history_cache_request_list))
6508 history_ptr->page_number = page_number;
6509 history_ptr->next_ptr = history_cache_request_list;
6510 history_cache_request_list = history_ptr;
6516 history_ptr = history_cache_request_list;
6518 while (history_ptr != NULL)
6520 SetPageFlag( history_ptr->page_number, CACHE_PAGE_HISTORY_REQUESTED );
6522 history_ptr = history_ptr->next_ptr;
6529 switch (caching_method)
6531 case EBUTT_CACHING_METHOD_NAVIGATION:
6532 case EBUTT_CACHING_METHOD_NAVIGATION_TREE:
6533 case EBUTT_CACHING_METHOD_ALL:
6538 UpdateEditorialLinkPageRequest(page_number, page_sub_code);
6542 FlagEditorialLinkPageRequests(editorial_link_request_root);
6551 SetPageFlag( page_number, CACHE_PAGE_LOCKED );
6553 if (page_display_info.page_number)
6555 SetPageFlag( page_display_info.page_number, CACHE_PAGE_LOCKED );
6559 FUNCTION_FINISH(CheckPageRequest);
6574 static BOOLEAN RemoveCachePage(U16BIT magazine_number, U16BIT mask)
6584 FUNCTION_START(RemoveCachePage);
6589 search_page_ptr = magazine_array[magazine_number].m_cache_page_ptr;
6590 search_last_page_ptr = NULL;
6592 last_page_ptr = NULL;
6594 while (search_page_ptr != NULL)
6596 if (!(search_page_ptr->page_number & ~(CACHE_PAGE_NUMBER_MASK | mask)))
6598 page_ptr = search_page_ptr;
6599 last_page_ptr = search_last_page_ptr;
6602 search_last_page_ptr = search_page_ptr;
6603 search_page_ptr = search_page_ptr->next_ptr;
6606 if (page_ptr != NULL)
6609 subpage_ptr = page_ptr->subpage_ptr;
6610 while (subpage_ptr != NULL)
6612 temp_subpage_ptr = subpage_ptr->next_ptr;
6616 subpage_ptr = temp_subpage_ptr;
6619 if (last_page_ptr == NULL)
6621 magazine_array[magazine_number].m_cache_page_ptr = page_ptr->next_ptr;
6625 last_page_ptr->next_ptr = page_ptr->next_ptr;
6634 FUNCTION_FINISH(RemoveCachePage);
6650 static BOOLEAN RemoveUnrequestedCachePage(U16BIT magazine_number)
6660 FUNCTION_START(RemoveUnrequestedCachePage);
6667 search_page_ptr = magazine_array[magazine_number].m_cache_page_ptr;
6668 search_last_page_ptr = NULL;
6670 last_page_ptr = NULL;
6672 while (search_page_ptr != NULL)
6674 if (!(search_page_ptr->page_number & ~CACHE_PAGE_NUMBER_MASK))
6676 page_ptr = search_page_ptr;
6677 last_page_ptr = search_last_page_ptr;
6680 search_last_page_ptr = search_page_ptr;
6681 search_page_ptr = search_page_ptr->next_ptr;
6684 if (page_ptr != NULL)
6687 subpage_ptr = page_ptr->subpage_ptr;
6688 while (subpage_ptr != NULL)
6690 temp_subpage_ptr = subpage_ptr->next_ptr;
6694 subpage_ptr = temp_subpage_ptr;
6697 if (last_page_ptr == NULL)
6699 magazine_array[magazine_number].m_cache_page_ptr = page_ptr->next_ptr;
6703 last_page_ptr->next_ptr = page_ptr->next_ptr;
6714 FUNCTION_FINISH(RemoveUnrequestedCachePage);
6731 static BOOLEAN RemoveCacheContent(U16BIT magazine_number, BOOLEAN exclude_magazine)
6733 U16BIT mask_index, offset, mgzn_ndx;
6736 FUNCTION_START(RemoveCacheContent);
6740 for (mask_index = 0; (mask_index != 8) && (retval == FALSE); mask_index++)
6742 if (exclude_magazine == FALSE)
6744 retval = RemoveCachePage(magazine_number, cache_removal_priority_mask_array[mask_index]);
6747 for (offset = 1; retval == FALSE && offset != 8; offset++)
6749 mgzn_ndx = (magazine_number + offset) % 8;
6751 retval = RemoveCachePage(mgzn_ndx, cache_removal_priority_mask_array[mask_index]);
6756 FUNCTION_FINISH(RemoveCacheContent);
6773 static BOOLEAN RemoveUnrequestedCacheContent(U16BIT magazine_number, BOOLEAN exclude_magazine)
6775 U16BIT magazine_offset;
6778 FUNCTION_START(RemoveUnrequestedCacheContent);
6782 if (exclude_magazine == FALSE)
6784 retval = RemoveUnrequestedCachePage(magazine_number);
6787 for (magazine_offset = 1; retval == FALSE && magazine_offset != 8; magazine_offset++)
6789 retval = RemoveUnrequestedCachePage((magazine_number + magazine_offset) % 8);
6792 FUNCTION_FINISH(RemoveUnrequestedCacheContent);
6809 static void RemoveAllCacheContent(
void)
6811 U16BIT magazine_number;
6817 FUNCTION_START(RemoveAllCacheContent);
6819 for (magazine_number = 0; magazine_number != 8; magazine_number++)
6823 page_ptr = magazine_array[magazine_number].m_cache_page_ptr;
6825 while (page_ptr != NULL)
6827 subpage_ptr = page_ptr->subpage_ptr;
6828 while (subpage_ptr != NULL)
6830 next_subpage_ptr = subpage_ptr->next_ptr;
6834 subpage_ptr = next_subpage_ptr;
6837 next_page_ptr = page_ptr->next_ptr;
6841 page_ptr = next_page_ptr;
6844 memset(magazine_array[magazine_number].m_cache_valid_page_array, 0,
sizeof(U8BIT) * 32);
6845 magazine_array[magazine_number].m_cache_page_ptr = NULL;
6850 FUNCTION_FINISH(RemoveAllCacheContent);
6870 static void NotifyDisplayUpdate(
S_MAGAZINE_PAGE *collated_page_ptr, U16BIT magazine_number,
6871 U16BIT page_number, U16BIT page_sub_code, BOOLEAN update_clock, BOOLEAN pts_valid, U8BIT *pts)
6875 FUNCTION_START(NotifyDisplayUpdate);
6880 broadcast_index_page_invocation_required = FALSE;
6882 NotifyDisplayToPageHistory(page_number);
6884 DBGPRINT(
"%03x:%04x\n", page_number, page_sub_code);
6891 memcpy(&page_display_info.page_source, collated_page_ptr,
sizeof(
S_MAGAZINE_PAGE));
6893 if (page_display_info.page_number)
6895 if (GetMagazineIndexFromPageNumber(page_display_info.page_number) != magazine_number)
6899 for (index = 0; index != 2; index++)
6901 if (magazine_array[magazine_number].m_specific_data.is_defined[index] == TRUE)
6903 memcpy(page_display_info.mgzn_data.s_data[index],
6904 magazine_array[magazine_number].m_specific_data.s_data[index], MAX_COLUMN);
6906 page_display_info.mgzn_data.is_defined[index] = TRUE;
6914 if ((page_display_info.page_number != page_number) ||
6915 (page_display_info.page_sub_code != page_sub_code))
6917 page_display_info.reveal_set = FALSE;
6920 page_display_info.clear_set = FALSE;
6921 page_control_info.clear_required = FALSE;
6922 page_display_info.clear_required = FALSE;
6924 page_display_info.page_number = page_number;
6925 page_display_info.page_sub_code = page_sub_code;
6927 page_display_info.page_clock_valid = update_clock;
6929 page_display_info.pts_valid = pts_valid;
6932 memcpy(page_display_info.page_pts, pts, 5);
6935 page_display_info.page_updated = TRUE;
6939 if (!show_header_row)
6942 DBGPRINT(
"set Subtitle Timeout @ %lu", subtitle_timeout);
6945 FUNCTION_FINISH(NotifyDisplayUpdate);
6961 BOOLEAN pts_valid, U8BIT *pts)
6963 U16BIT flag, index, page_sub_code, magazine_index, num_unrequested_pages;
6964 BOOLEAN caching_required;
6965 BOOLEAN caching_successful;
6966 U16BIT *next_request_array_ptr;
6967 U16BIT *previous_request_array_ptr;
6973 FUNCTION_START(CheckPageCaching);
6976 caching_required = FALSE;
6977 editorial_link_ptr = NULL;
6979 if ((caching_method == EBUTT_CACHING_METHOD_NAVIGATION) ||
6980 (caching_method == EBUTT_CACHING_METHOD_NAVIGATION_TREE) ||
6981 (caching_method == EBUTT_CACHING_METHOD_ALL))
6983 if (GetEditorialLink(editorial_link_request_root, &editorial_link_ptr,
6984 reference_data_ptr->page_number) == TRUE)
6986 flag = CACHE_PAGE_FLOF_REQUESTED;
6987 caching_required = TRUE;
6991 if ((caching_method == EBUTT_CACHING_METHOD_HISTORY) ||
6992 (caching_method == EBUTT_CACHING_METHOD_NAVIGATION) ||
6993 (caching_method == EBUTT_CACHING_METHOD_NAVIGATION_TREE) ||
6994 (caching_method == EBUTT_CACHING_METHOD_ALL))
6996 history_ptr = history_cache_request_list;
6998 while (history_ptr != NULL)
7000 if (history_ptr->page_number == reference_data_ptr->page_number)
7002 flag |= CACHE_PAGE_HISTORY_REQUESTED;
7003 caching_required = TRUE;
7007 history_ptr = history_ptr->next_ptr;
7011 for (index = 0; index < NUM_PREVIOUS_CACHE_REQUESTS; index++)
7013 if (previous_cache_request_array[index] == reference_data_ptr->page_number)
7015 flag |= CACHE_PAGE_PREVNEXT_REQUESTED;
7016 caching_required = TRUE;
7021 if (page_display_info.page_number)
7023 if (page_display_info.page_number != next_prev_page_number)
7028 SearchNextRequestArray(FALSE, &next_request_array_ptr);
7032 if (page_display_info.page_number < *next_request_array_ptr)
7039 if (page_display_info.page_number == *next_request_array_ptr)
7043 UnsetPageFlag( *next_request_array_ptr, CACHE_PAGE_PREVNEXT_REQUESTED );
7046 *next_request_array_ptr = INVALID_PREVNEXT_CACHE_PAGE_NUMBER;
7054 SearchPreviousRequestArray(FALSE, &previous_request_array_ptr);
7056 if (*previous_request_array_ptr != 0)
7060 UnsetPageFlag( *previous_request_array_ptr, CACHE_PAGE_PREVNEXT_REQUESTED );
7064 *previous_request_array_ptr = *next_request_array_ptr;
7066 *next_request_array_ptr = INVALID_PREVNEXT_CACHE_PAGE_NUMBER;
7074 SearchPreviousRequestArray(TRUE, &previous_request_array_ptr);
7078 if (page_display_info.page_number > *previous_request_array_ptr)
7084 if (page_display_info.page_number == *previous_request_array_ptr)
7088 UnsetPageFlag( *previous_request_array_ptr, CACHE_PAGE_PREVNEXT_REQUESTED );
7091 *previous_request_array_ptr = 0;
7099 SearchNextRequestArray(TRUE, &next_request_array_ptr);
7101 if (*next_request_array_ptr != INVALID_PREVNEXT_CACHE_PAGE_NUMBER)
7105 UnsetPageFlag( *next_request_array_ptr, CACHE_PAGE_PREVNEXT_REQUESTED );
7109 *next_request_array_ptr = *previous_request_array_ptr;
7111 *previous_request_array_ptr = 0;
7116 next_prev_page_number = page_display_info.page_number;
7119 if (reference_data_ptr->page_number > page_display_info.page_number)
7122 SearchNextRequestArray(TRUE, &next_request_array_ptr);
7124 if (reference_data_ptr->page_number < *next_request_array_ptr)
7126 if (IsInNextRequestArray(reference_data_ptr->page_number) == FALSE)
7128 if (*next_request_array_ptr != INVALID_PREVNEXT_CACHE_PAGE_NUMBER)
7130 UnsetPageFlag( *next_request_array_ptr, CACHE_PAGE_PREVNEXT_REQUESTED );
7133 *next_request_array_ptr = reference_data_ptr->page_number;
7135 SetPageFlag( *next_request_array_ptr, CACHE_PAGE_PREVNEXT_REQUESTED );
7139 else if (reference_data_ptr->page_number < page_display_info.page_number)
7142 SearchPreviousRequestArray(FALSE, &previous_request_array_ptr);
7144 if (reference_data_ptr->page_number > *previous_request_array_ptr)
7146 if (IsInPreviousRequestArray(reference_data_ptr->page_number) == FALSE)
7148 if (*previous_request_array_ptr != 0)
7150 UnsetPageFlag( *previous_request_array_ptr, CACHE_PAGE_PREVNEXT_REQUESTED );
7153 *previous_request_array_ptr = reference_data_ptr->page_number;
7155 SetPageFlag( *previous_request_array_ptr, CACHE_PAGE_PREVNEXT_REQUESTED );
7161 for (index = 0; index < NUM_NEXT_CACHE_REQUESTS; index++)
7163 if (next_cache_request_array[index] == reference_data_ptr->page_number)
7165 flag |= CACHE_PAGE_PREVNEXT_REQUESTED;
7166 caching_required = TRUE;
7171 if (caching_method == EBUTT_CACHING_METHOD_ALL)
7173 caching_required = TRUE;
7179 if (page_request_info.target_page_number == reference_data_ptr->page_number)
7181 flag |= CACHE_PAGE_LOCKED;
7182 caching_required = TRUE;
7189 if (page_display_info.page_number == reference_data_ptr->page_number)
7191 flag |= CACHE_PAGE_LOCKED;
7194 if (caching_required == TRUE)
7197 magazine_index = GetMagazineIndexFromPageNumber(reference_data_ptr->page_number);
7199 caching_successful = FALSE;
7201 if (GetHamming8DoubleWord(collated_page_ptr->header + 2, &page_sub_code) == TRUE)
7203 page_sub_code &= 0x3f7f;
7208 page_ptr = magazine_array[magazine_index].m_cache_page_ptr;
7209 while (page_ptr != NULL)
7212 if ((page_ptr->page_number & CACHE_PAGE_NUMBER_MASK) == reference_data_ptr->page_number)
7215 page_ptr->page_number &= CACHE_PAGE_NUMBER_MASK;
7216 page_ptr->page_number |= flag;
7218 subpage_ptr = page_ptr->subpage_ptr;
7220 while (subpage_ptr != NULL)
7222 if (subpage_ptr->sub_code == page_sub_code)
7224 if (reference_data_ptr->erase_page == TRUE)
7226 memcpy(&subpage_ptr->collated_data, collated_page_ptr,
7231 memcpy(subpage_ptr->collated_data.header, collated_page_ptr->header, MAX_COLUMN);
7232 subpage_ptr->collated_data.is_header_defined = TRUE;
7234 for (index = 1; index != MAX_ROWS; index++)
7236 if (collated_page_ptr->display_data_defined_mask & (1 << index))
7238 memcpy(subpage_ptr->collated_data.display_data[index],
7239 collated_page_ptr->display_data[index], MAX_COLUMN);
7240 subpage_ptr->collated_data.display_data_defined_mask |= 1 << index;
7244 for (index = 0; index != 16; index++)
7246 if (collated_page_ptr->basic_enhancement_data_defined_mask & (1 << index))
7248 memcpy(subpage_ptr->collated_data.basic_enhancement_data[index],
7249 collated_page_ptr->basic_enhancement_data[index], MAX_COLUMN);
7250 subpage_ptr->collated_data.basic_enhancement_data_defined_mask |=
7255 if (collated_page_ptr->is_editorial_page_linking_data_defined == TRUE)
7257 memcpy(subpage_ptr->collated_data.editorial_page_linking_data,
7258 collated_page_ptr->editorial_page_linking_data, MAX_COLUMN);
7259 subpage_ptr->collated_data.is_editorial_page_linking_data_defined = TRUE;
7262 for (index = 0; index != 2; index++)
7264 if (collated_page_ptr->specific_data.is_defined[index] == TRUE)
7266 memcpy(subpage_ptr->collated_data.specific_data.s_data[index],
7267 collated_page_ptr->specific_data.s_data[index], MAX_COLUMN);
7268 subpage_ptr->collated_data.specific_data.is_defined[index] = TRUE;
7273 page_ptr->latest_subpage_ptr = subpage_ptr;
7275 DeterminePageEditorialLinks(editorial_link_ptr, subpage_ptr);
7277 caching_successful = TRUE;
7281 subpage_ptr = subpage_ptr->next_ptr;
7284 if (subpage_ptr == NULL)
7287 while (subpage_ptr == NULL)
7290 if (RemoveCacheContent(magazine_index, TRUE) == FALSE)
7297 if (subpage_ptr != NULL)
7299 subpage_ptr->sub_code = page_sub_code;
7300 memcpy(&subpage_ptr->collated_data, collated_page_ptr,
7302 subpage_ptr->next_ptr = page_ptr->subpage_ptr;
7304 page_ptr->subpage_ptr = subpage_ptr;
7305 page_ptr->latest_subpage_ptr = subpage_ptr;
7307 DeterminePageEditorialLinks(editorial_link_ptr, subpage_ptr);
7309 caching_successful = TRUE;
7316 page_ptr = page_ptr->next_ptr;
7319 if (page_ptr == NULL)
7324 while (page_ptr == NULL)
7327 if (RemoveCacheContent(magazine_index, FALSE) == FALSE)
7334 if (page_ptr != NULL)
7336 page_ptr->page_number = reference_data_ptr->page_number | flag;
7339 while (subpage_ptr == NULL)
7342 if (RemoveCacheContent(magazine_index, TRUE) == FALSE)
7349 if (subpage_ptr != NULL)
7351 subpage_ptr->sub_code = page_sub_code;
7352 memcpy(&subpage_ptr->collated_data, collated_page_ptr,
sizeof(
S_MAGAZINE_PAGE));
7353 subpage_ptr->next_ptr = NULL;
7355 page_ptr->subpage_ptr = subpage_ptr;
7356 page_ptr->latest_subpage_ptr = subpage_ptr;
7358 page_ptr->next_ptr = magazine_array[magazine_index].m_cache_page_ptr;
7360 magazine_array[magazine_index].m_cache_page_ptr = page_ptr;
7362 caching_successful = TRUE;
7374 if (caching_successful == TRUE)
7376 if (page_display_info.page_number == reference_data_ptr->page_number)
7380 if (page_control_info.state == PAGE_CONTROL_STATE_HOLD)
7384 if (page_display_info.page_sub_code == page_sub_code)
7386 NotifyDisplayUpdate(collated_page_ptr, magazine_index,
7387 reference_data_ptr->page_number, page_sub_code, TRUE, pts_valid, pts);
7392 if (page_control_info.state != PAGE_CONTROL_STATE_INPUT)
7394 if (page_request_info.target_page_number == reference_data_ptr->page_number)
7398 if (page_display_info.page_sub_code != page_sub_code)
7400 if ((IsRollingSubCode(page_display_info.page_sub_code) == TRUE) &&
7401 (collated_page_ptr->display_data_defined_mask != 0))
7403 NotifyDisplayUpdate(collated_page_ptr, magazine_index,
7404 reference_data_ptr->page_number, page_sub_code, TRUE, pts_valid, pts);
7409 if (collated_page_ptr->display_data_defined_mask != 0)
7411 NotifyDisplayUpdate(collated_page_ptr, magazine_index,
7412 reference_data_ptr->page_number, page_sub_code, TRUE, pts_valid, pts);
7423 if (page_request_info.target_page_number == reference_data_ptr->page_number)
7426 NotifyDisplayUpdate(collated_page_ptr, magazine_index,
7427 reference_data_ptr->page_number, page_sub_code, TRUE, pts_valid, pts);
7433 if (caching_method != EBUTT_CACHING_METHOD_ALL)
7435 for (magazine_index = 0; magazine_index != 8; magazine_index++)
7438 page_ptr = magazine_array[magazine_index].m_cache_page_ptr;
7439 num_unrequested_pages = 0;
7441 while (page_ptr != NULL)
7443 if (!(page_ptr->page_number & ~CACHE_PAGE_NUMBER_MASK))
7445 num_unrequested_pages++;
7448 page_ptr = page_ptr->next_ptr;
7452 while (num_unrequested_pages > 10)
7454 if (RemoveUnrequestedCachePage(magazine_index) == FALSE)
7459 num_unrequested_pages--;
7465 FUNCTION_FINISH(CheckPageCaching);
7480 static void CheckTimeFillingPacket(
S_MAGAZINE_PAGE *collated_page_ptr, U16BIT page_number)
7482 FUNCTION_START(CheckTimeFillingPacket);
7486 if ((page_display_info.page_number & 0x0f00) == (page_number & 0x0f00))
7490 memcpy(page_display_info.time_filler_header_data, &collated_page_ptr->header[8], 32);
7492 page_display_info.clock_updated = TRUE;
7497 FUNCTION_FINISH(CheckTimeFillingPacket);
7511 static void CheckHeaderClockContent(
S_MAGAZINE_PAGE *collated_page_ptr)
7513 FUNCTION_START(CheckHeaderClockContent);
7515 if (memcmp(&page_display_info.time_filler_header_data[24], &collated_page_ptr->header[32], 8))
7519 memcpy(page_display_info.time_filler_header_data, &collated_page_ptr->header[8], 32);
7521 page_display_info.clock_updated = TRUE;
7526 FUNCTION_FINISH(CheckHeaderClockContent);
7543 static void NotifyRequestToPageHistory(U16BIT page_number)
7545 FUNCTION_START(NotifyRequestToPageHistory);
7547 page_history_request_page_number = page_number;
7549 FUNCTION_FINISH(NotifyRequestToPageHistory);
7564 static U16BIT MoveHistoryMarker(U16BIT marker, BOOLEAN advance)
7566 FUNCTION_START(MoveHistoryMarker);
7568 if (advance == TRUE)
7571 if (marker >= MAX_PAGE_HISTORY)
7580 marker = MAX_PAGE_HISTORY - 1;
7588 FUNCTION_FINISH(MoveHistoryMarker);
7608 static void NotifyDisplayToPageHistory(U16BIT page_number)
7610 FUNCTION_START(NotifyDisplayToPageHistory);
7615 if (page_number == page_history_request_page_number)
7619 page_history_array[page_history_hwm] = page_number;
7622 page_history_hwm = MoveHistoryMarker(page_history_hwm, TRUE);
7626 if (page_history_hwm == page_history_lwm)
7628 page_history_lwm = MoveHistoryMarker(page_history_lwm, TRUE);
7631 page_history_mwm = page_history_hwm;
7634 page_history_request_page_number = 0xffff;
7637 FUNCTION_FINISH(NotifyDisplayToPageHistory);
7651 static BOOLEAN GetPreviousPageFromHistory(U16BIT *page_number)
7656 FUNCTION_START(GetPreviousPageFromHistory);
7660 if (page_history_hwm != page_history_lwm)
7662 temp_mwm = MoveHistoryMarker(page_history_mwm, FALSE);
7664 if (temp_mwm != page_history_lwm)
7666 temp_mwm = MoveHistoryMarker(temp_mwm, FALSE);
7668 *page_number = page_history_array[temp_mwm];
7670 page_history_mwm = MoveHistoryMarker(temp_mwm, TRUE);
7676 FUNCTION_FINISH(GetPreviousPageFromHistory);
7692 static BOOLEAN GetNextPageFromHistory(U16BIT *page_number)
7696 FUNCTION_START(GetNextPageFromHistory);
7700 if (page_history_mwm != page_history_hwm)
7702 *page_number = page_history_array[page_history_mwm];
7704 page_history_mwm = MoveHistoryMarker(page_history_mwm, TRUE);
7709 FUNCTION_FINISH(GetNextPageFromHistory);
7737 static void NotifyPageCollated(
S_MAGAZINE_PAGE *collated_page_ptr, U8BIT magazine_number,
7738 BOOLEAN pts_valid, U8BIT *pts)
7740 BOOLEAN update_carousel_display;
7743 FUNCTION_START(NotifyPageCollated);
7745 if (GetPageReference(collated_page_ptr->header, &page_reference_data, PAGE_REFERENCE_TYPE_HEADER,
7746 magazine_number) == TRUE)
7748 if (page_reference_data.page_offset == 0xff)
7750 if (page_reference_data.page_sub_code <= 0x3f7e)
7752 CheckTimeFillingPacket(collated_page_ptr, page_reference_data.page_number);
7758 if ((page_display_info.page_number >> 8) == magazine_number)
7760 EBU_DBG(
"PageCollated: #=%03x:%04x, display_data_defined=0x%08x",
7761 page_reference_data.page_number, page_reference_data.page_sub_code,
7762 collated_page_ptr->display_data_defined_mask);
7766 CheckHeaderClockContent(collated_page_ptr);
7770 magazine_array[magazine_number].m_cache_valid_page_array[page_reference_data.page_offset >> 3] |=
7771 1 << (page_reference_data.page_offset & 0x07);
7775 if (page_reference_data.interrupted_sequence == FALSE)
7777 if (page_control_info.state != PAGE_CONTROL_STATE_HOLD)
7779 update_carousel_display = FALSE;
7781 if (page_request_info.target_page_number)
7783 if (page_request_info.target_page_sub_code == PAGE_SUB_CODE_UNDEFINED)
7785 if (page_request_info.target_page_number != page_display_info.page_number)
7787 if (page_reference_data.magazine_serial == TRUE)
7789 update_carousel_display = TRUE;
7793 if (GetMagazineIndexFromPageNumber(page_reference_data.page_number) ==
7794 GetMagazineIndexFromPageNumber(page_request_info.target_page_number))
7796 update_carousel_display = TRUE;
7803 if ((page_request_info.target_page_number != page_display_info.page_number) ||
7804 (page_request_info.target_page_sub_code != page_display_info.page_sub_code))
7806 if (page_reference_data.magazine_serial == TRUE)
7808 update_carousel_display = TRUE;
7812 if (GetMagazineIndexFromPageNumber(page_reference_data.page_number) ==
7813 GetMagazineIndexFromPageNumber(page_request_info.target_page_number))
7815 update_carousel_display = TRUE;
7823 update_carousel_display = TRUE;
7826 if (update_carousel_display == TRUE && show_header_row == TRUE)
7830 page_display_info.carousel_page_number = page_reference_data.page_number;
7832 if (collated_page_ptr->is_header_defined == TRUE)
7834 memcpy(page_display_info.carousel_page_header, collated_page_ptr->header, MAX_COLUMN);
7836 page_display_info.carousel_page_updated = TRUE;
7843 CheckPageCaching(collated_page_ptr, &page_reference_data, pts_valid, pts);
7847 FUNCTION_FINISH(NotifyPageCollated);
7862 static BOOLEAN InitialiseDisplayTask(
void)
7866 FUNCTION_START(InitialiseDisplayTask);
7870 if (display_task_semaphore == NULL)
7874 if (display_task_semaphore != NULL)
7878 display_task_ptr =
STB_OSCreateTask(DisplayUpdateTask, NULL, DISPLAY_TASK_STACK_SIZE,
7879 DISPLAY_TASK_PRIORITY, (U8BIT *)
"EBUTT_DISPLAY");
7880 if (display_task_ptr)
7886 FUNCTION_FINISH(InitialiseDisplayTask);
7903 static void KillDisplayTask(
void)
7905 FUNCTION_START(KillDisplayTask);
7907 if (display_task_ptr != NULL)
7912 display_task_ptr = NULL;
7915 FUNCTION_FINISH(KillDisplayTask);
7930 static BOOLEAN IsNationalOptionSubsetIndex(U8BIT character_index, U8BIT *subset_offset)
7932 U8BIT option_subset;
7935 FUNCTION_START(IsNationalOptionSubsetIndex);
7939 if ((character_index >= 0x20) &&
7940 (character_index <= 0x7f))
7942 option_subset = option_subset_array[character_index - 0x20];
7946 *subset_offset = subset_offset_array[option_subset];
7952 FUNCTION_FINISH(IsNationalOptionSubsetIndex);
7971 static void GetTripletFields(U32BIT triplet_value, U8BIT *address, U8BIT *mode, U8BIT *data)
7973 FUNCTION_START(GetTripletFields);
7975 *address = (U8BIT) (triplet_value & 0x00003fL);
7976 *mode = (U8BIT)((triplet_value & 0x0007c0L) >> 6L);
7977 *data = (U8BIT)((triplet_value & 0x03f800L) >> 11L);
7979 FUNCTION_FINISH(GetTripletFields);
7996 static void DecodeTeletextPageBody(
S_PAGE_DISPLAY_INFO *display_info_ptr, BOOLEAN enforce_header_display)
7998 U8BIT foreground_colour, background_colour, foreground_index, background_index;
7999 U8BIT default_mapping, second_mapping, hold_mosaics_char;
8000 U8BIT subset_offset, current_source_char, previous_source_char;
8001 U8BIT default_row_background_colour;
8002 U8BIT triplet_address, triplet_mode, triplet_data;
8003 U16BIT row, column, last_column;
8004 U16BIT packet_index, triplet_index, font_index, character_offset, diacritic_offset, equivalence_index;
8005 U32BIT triplet_value;
8006 U8BIT *source_data_ptr;
8008 BOOLEAN double_height, flashing, concealed, boxed, boxing_required;
8009 BOOLEAN mosaic_enabled, contiguous_mosaic_enabled, hold_mosaic_enabled;
8010 BOOLEAN header_required, body_required, valid_row;
8011 BOOLEAN default_row_background_colour_defined, double_height_in_previous_line, terminated;
8017 static const U8BIT diacritic_substitution_offset[16] = { 0, 0x30, 0x30, 0x20, 0x20, 0x20, 0x30, 0x20,
8018 0x20, 0x30, 0, 0x20, 0, 0, 0, 0x30 };
8020 FUNCTION_START(DecodeTeletextPageBody);
8022 current_mapping_ptr = NULL;
8025 GetBasicPageDisplayInfo(display_info_ptr, &default_mapping, &second_mapping, &boxing_required,
8026 &header_required, &body_required,
8027 &default_row_background_colour_defined,
8028 &default_row_background_colour);
8030 default_mapping_ptr = &character_set_mapping_array[default_mapping];
8031 if (second_mapping == 0xff)
8033 second_mapping_ptr = NULL;
8037 second_mapping_ptr = &character_set_mapping_array[second_mapping];
8040 display_info_ptr->render_required = TRUE;
8042 if ((boxing_required || !show_header_row) && (page_control_info.state == PAGE_CONTROL_STATE_IDLE))
8044 display_info_ptr->screen_colour = PALETTE_BACKGROUND_TRANSPARENT;
8048 display_info_ptr->screen_colour = PALETTE_BACKGROUND_BLACK;
8051 display_info_ptr->clear_screen = TRUE;
8053 display_info_ptr->palette_update_required = TRUE;
8055 double_height_in_previous_line = FALSE;
8057 display_info_ptr->palette_attribute_array[0].effect_mask = PALETTE_EFFECT_UNDEFINED;
8058 display_info_ptr->palette_alias_array[0].fore_colour = PALETTE_BACKGROUND_TRANSPARENT;
8060 for (row = 0; row <= 24; row++)
8066 if (display_info_ptr->page_source.is_header_defined == TRUE)
8068 if ((header_required == TRUE) ||
8069 (enforce_header_display == TRUE))
8077 if ((double_height_in_previous_line == FALSE) &&
8078 (body_required == TRUE) &&
8079 (display_info_ptr->page_source.display_data_defined_mask & (1 << row)))
8085 if (valid_row == TRUE)
8087 display_info_ptr->valid_row[row] = TRUE;
8088 display_info_ptr->render_row[row] = TRUE;
8092 current_mapping_ptr = default_mapping_ptr;
8096 if (boxing_required == TRUE)
8098 for (column = 0; column != 8; column++)
8100 display_info_ptr->character_map[0][column].foreground_index = PALETTE_FOREGROUND_UNBOXED;
8105 for (column = 0; column != 8; column++)
8107 display_info_ptr->character_map[0][column].background_index = PALETTE_BACKGROUND_BLACK;
8112 if (display_info_ptr->page_clock_valid == TRUE)
8126 foreground_colour = 7;
8127 if (default_row_background_colour_defined == TRUE)
8129 background_colour = default_row_background_colour;
8133 background_colour = 0;
8136 double_height = FALSE;
8140 mosaic_enabled = FALSE;
8141 contiguous_mosaic_enabled = TRUE;
8142 hold_mosaic_enabled = FALSE;
8143 hold_mosaics_char = 0;
8144 previous_source_char = 0;
8146 GetCharacterPaletteIndexes(display_info_ptr,
8147 &foreground_index, &background_index,
8148 foreground_colour, background_colour,
8149 flashing, concealed,
8150 boxing_required, boxed, FALSE);
8154 source_data_ptr = &display_info_ptr->page_source.header[8];
8155 destination_data_ptr = &display_info_ptr->character_map[row][8];
8159 source_data_ptr = display_info_ptr->page_source.display_data[row];
8160 destination_data_ptr = display_info_ptr->character_map[row];
8164 while (column <= last_column)
8167 if (mosaic_enabled == TRUE)
8169 if (hold_mosaic_enabled == TRUE)
8171 destination_data_ptr->info = (FONT_INDEX_G1_BLOCK_MOSAICS_SET << 8) +
8176 destination_data_ptr->info = FONT_INDEX_G1_BLOCK_MOSAICS_SET << 8;
8179 if (contiguous_mosaic_enabled == FALSE)
8181 destination_data_ptr->info |= TELETEXT_CHARACTER_SEPERATED_MOSAIC;
8186 if (current_mapping_ptr->G0_index == FONT_INDEX_UNDEFINED)
8188 destination_data_ptr->info = FONT_INDEX_LATIN_G0_SET << 8;
8192 destination_data_ptr->info = current_mapping_ptr->G0_index << 8;
8196 if (double_height == TRUE)
8198 destination_data_ptr->info |= TELETEXT_CHARACTER_DOUBLE_HEIGHT;
8201 destination_data_ptr->diacritic_info = 0;
8203 destination_data_ptr->foreground_index = foreground_index;
8204 destination_data_ptr->background_index = background_index;
8206 if (GetParity7Byte(*source_data_ptr, ¤t_source_char) == TRUE)
8208 switch (current_source_char & 0x70)
8212 switch (current_source_char & 0x0f)
8217 GetCharacterPaletteIndexes(display_info_ptr,
8218 &foreground_index, &background_index,
8219 foreground_colour, background_colour,
8220 flashing, concealed,
8221 boxing_required, boxed, FALSE);
8223 display_info_ptr->flash_required = TRUE;
8229 GetCharacterPaletteIndexes(display_info_ptr,
8230 &foreground_index, &background_index,
8231 foreground_colour, background_colour,
8232 flashing, concealed,
8233 boxing_required, boxed, FALSE);
8235 destination_data_ptr->foreground_index = foreground_index;
8240 if ((boxing_required == TRUE) &&
8244 GetCharacterPaletteIndexes(display_info_ptr,
8245 &foreground_index, &background_index,
8246 foreground_colour, background_colour,
8247 flashing, concealed,
8248 boxing_required, boxed, FALSE);
8254 if ((boxing_required == TRUE) &&
8257 if (previous_source_char == 0x0b)
8260 GetCharacterPaletteIndexes(display_info_ptr,
8261 &foreground_index, &background_index,
8262 foreground_colour, background_colour,
8263 flashing, concealed,
8264 boxing_required, boxed, FALSE);
8271 if (double_height == TRUE)
8273 double_height = FALSE;
8274 destination_data_ptr->info &= ~TELETEXT_CHARACTER_DOUBLE_HEIGHT;
8276 hold_mosaics_char = 0;
8282 if (double_height == FALSE)
8284 if ((row > 0) && (row < 24))
8286 double_height = TRUE;
8287 double_height_in_previous_line = TRUE;
8289 hold_mosaics_char = 0;
8301 foreground_colour = current_source_char & 0x07;
8303 mosaic_enabled = FALSE;
8304 hold_mosaic_enabled = FALSE;
8305 hold_mosaics_char = 0;
8307 GetCharacterPaletteIndexes(display_info_ptr,
8308 &foreground_index, &background_index,
8309 foreground_colour, background_colour,
8310 flashing, concealed,
8311 boxing_required, boxed, FALSE);
8319 switch (current_source_char & 0x0f)
8324 GetCharacterPaletteIndexes(display_info_ptr,
8325 &foreground_index, &background_index,
8326 foreground_colour, background_colour,
8327 flashing, concealed,
8328 boxing_required, boxed, FALSE);
8330 destination_data_ptr->foreground_index = foreground_index;
8332 display_info_ptr->reveal_available = TRUE;
8337 contiguous_mosaic_enabled = TRUE;
8339 destination_data_ptr->info &= ~TELETEXT_CHARACTER_SEPERATED_MOSAIC;
8344 contiguous_mosaic_enabled = FALSE;
8346 destination_data_ptr->info |= TELETEXT_CHARACTER_SEPERATED_MOSAIC;
8352 if (second_mapping_ptr != NULL)
8354 if (current_mapping_ptr == default_mapping_ptr)
8356 current_mapping_ptr = second_mapping_ptr;
8360 current_mapping_ptr = default_mapping_ptr;
8367 if (default_row_background_colour_defined == TRUE)
8369 background_colour = default_row_background_colour;
8373 background_colour = 0;
8376 GetCharacterPaletteIndexes(display_info_ptr,
8377 &foreground_index, &background_index,
8378 foreground_colour, background_colour,
8379 flashing, concealed,
8380 boxing_required, boxed, FALSE);
8384 destination_data_ptr->foreground_index = foreground_index;
8385 destination_data_ptr->background_index = background_index;
8390 background_colour = foreground_colour;
8392 GetCharacterPaletteIndexes(display_info_ptr,
8393 &foreground_index, &background_index,
8394 foreground_colour, background_colour,
8395 flashing, concealed,
8396 boxing_required, boxed, FALSE);
8400 destination_data_ptr->foreground_index = foreground_index;
8401 destination_data_ptr->background_index = background_index;
8406 if (hold_mosaic_enabled == FALSE)
8408 destination_data_ptr->info &= ~(TELETEXT_CHARACTER_FONT_INDEX_MASK |
8409 TELETEXT_CHARACTER_BITMAP_INDEX_MASK);
8410 destination_data_ptr->info |= (FONT_INDEX_G1_BLOCK_MOSAICS_SET << 8) +
8413 hold_mosaic_enabled = TRUE;
8419 if (mosaic_enabled == TRUE)
8421 hold_mosaic_enabled = FALSE;
8427 foreground_colour = current_source_char & 0x07;
8429 mosaic_enabled = TRUE;
8431 GetCharacterPaletteIndexes(display_info_ptr,
8432 &foreground_index, &background_index,
8433 foreground_colour, background_colour,
8434 flashing, concealed,
8435 boxing_required, boxed, FALSE);
8443 destination_data_ptr->info &= ~TELETEXT_CHARACTER_BITMAP_INDEX_MASK;
8444 destination_data_ptr->info |= current_source_char - 0x20;
8446 if (mosaic_enabled == TRUE)
8448 if (((current_source_char & 0x70) == 0x40) ||
8449 ((current_source_char & 0x70) == 0x50))
8451 if ((IsNationalOptionSubsetIndex(current_source_char, &subset_offset) == TRUE) &&
8452 (current_mapping_ptr->national_option_subset_index != NATIONALITY_INDEX_UNDEFINED))
8454 destination_data_ptr->info &= ~(TELETEXT_CHARACTER_FONT_INDEX_MASK |
8455 TELETEXT_CHARACTER_BITMAP_INDEX_MASK |
8456 TELETEXT_CHARACTER_SEPERATED_MOSAIC);
8458 destination_data_ptr->info |= FONT_INDEX_NATIONAL_OPTION_SUBSET << 8;
8460 destination_data_ptr->info |= subset_offset +
8461 current_mapping_ptr->national_option_subset_index;
8465 destination_data_ptr->info &= ~(TELETEXT_CHARACTER_FONT_INDEX_MASK |
8466 TELETEXT_CHARACTER_SEPERATED_MOSAIC);
8468 if (current_mapping_ptr->G0_index == FONT_INDEX_UNDEFINED)
8470 destination_data_ptr->info |= FONT_INDEX_LATIN_G0_SET << 8;
8474 destination_data_ptr->info |= current_mapping_ptr->G0_index << 8;
8480 hold_mosaics_char = current_source_char - 0x20;
8485 if ((current_mapping_ptr->G0_index == FONT_INDEX_LATIN_G0_SET) ||
8486 (current_mapping_ptr->G0_index == FONT_INDEX_UNDEFINED))
8488 if ((IsNationalOptionSubsetIndex(current_source_char, &subset_offset) == TRUE) &&
8489 (current_mapping_ptr->national_option_subset_index != NATIONALITY_INDEX_UNDEFINED))
8491 destination_data_ptr->info &= ~(TELETEXT_CHARACTER_FONT_INDEX_MASK |
8492 TELETEXT_CHARACTER_BITMAP_INDEX_MASK);
8494 destination_data_ptr->info |= FONT_INDEX_NATIONAL_OPTION_SUBSET << 8;
8496 destination_data_ptr->info |= subset_offset +
8497 current_mapping_ptr->national_option_subset_index;
8507 previous_source_char = current_source_char;
8509 destination_data_ptr++;
8515 if (boxing_required == FALSE)
8517 for (column = last_column + 1; column != MAX_COLUMN; column++)
8519 display_info_ptr->character_map[0][column].foreground_index =
8520 display_info_ptr->character_map[0][31].foreground_index;
8521 display_info_ptr->character_map[0][column].background_index =
8522 display_info_ptr->character_map[0][31].background_index;
8529 if (double_height_in_previous_line == TRUE)
8531 for (column = 0; column != MAX_COLUMN; column++)
8533 display_info_ptr->character_map[row][column].info = 0;
8534 display_info_ptr->character_map[row][column].foreground_index =
8535 display_info_ptr->character_map[row - 1][column].foreground_index;
8536 display_info_ptr->character_map[row][column].background_index =
8537 display_info_ptr->character_map[row - 1][column].background_index;
8540 display_info_ptr->valid_row[row] = TRUE;
8541 display_info_ptr->render_row[row] = TRUE;
8543 double_height_in_previous_line = FALSE;
8547 DBGPRINT(
"Clear row %d [%d,%d]", row, display_info_ptr->valid_row[row], display_info_ptr->render_row[row]);
8549 display_info_ptr->valid_row[row] = FALSE;
8558 if (display_info_ptr->page_source.basic_enhancement_data_defined_mask)
8560 for (packet_index = 0; (packet_index != 16) && (terminated == FALSE); packet_index++)
8562 if (display_info_ptr->page_source.basic_enhancement_data_defined_mask & (1 << packet_index))
8564 triplet_ptr = &display_info_ptr->page_source.basic_enhancement_data[packet_index][1];
8566 for (triplet_index = 0; (triplet_index != 13) && (terminated == FALSE); triplet_index++)
8568 if (GetHammimg24Value((
void *)triplet_ptr, &triplet_value) == TRUE)
8570 GetTripletFields(triplet_value, &triplet_address, &triplet_mode, &triplet_data);
8572 if (triplet_address >= MAX_COLUMN)
8575 switch (triplet_mode)
8579 if (triplet_address == MAX_COLUMN)
8585 row = triplet_address - MAX_COLUMN;
8587 if (triplet_data < MAX_COLUMN)
8589 column = triplet_data;
8609 switch (triplet_mode)
8613 column = triplet_address;
8618 if (triplet_data >= 0x20)
8620 if (((triplet_data & 0x70) == 0x40) ||
8621 ((triplet_data & 0x70) == 0x50))
8627 destination_data_ptr = &display_info_ptr->character_map[row][column];
8629 destination_data_ptr->info &= ~(TELETEXT_CHARACTER_FONT_INDEX_MASK |
8630 TELETEXT_CHARACTER_BITMAP_INDEX_MASK);
8632 destination_data_ptr->info |= FONT_INDEX_G1_BLOCK_MOSAICS_SET << 8;
8633 destination_data_ptr->info |= triplet_data - 0x20;
8641 column = triplet_address;
8646 if (triplet_data >= 0x20)
8648 if ((triplet_data != 0x6e) &&
8649 (triplet_data != 0x6f) &&
8650 (triplet_data != 0x7e) &&
8651 (triplet_data != 0x7f))
8653 destination_data_ptr = &display_info_ptr->character_map[row][column];
8655 destination_data_ptr->info &= ~(TELETEXT_CHARACTER_FONT_INDEX_MASK |
8656 TELETEXT_CHARACTER_BITMAP_INDEX_MASK);
8658 destination_data_ptr->info |= FONT_INDEX_G3_SMOOTH_MOSAICS_LINE_DRAWING_SET << 8;
8659 destination_data_ptr->info |= triplet_data - 0x20;
8667 column = triplet_address;
8669 if (triplet_data >= 0x20)
8671 destination_data_ptr = &display_info_ptr->character_map[row][column];
8673 destination_data_ptr->info &= ~TELETEXT_CHARACTER_BITMAP_INDEX_MASK;
8675 destination_data_ptr->info |= triplet_data - 0x20;
8681 column = triplet_address;
8683 if (triplet_data >= 0x20)
8685 destination_data_ptr = &display_info_ptr->character_map[row][column];
8687 destination_data_ptr->info &= ~(TELETEXT_CHARACTER_FONT_INDEX_MASK |
8688 TELETEXT_CHARACTER_BITMAP_INDEX_MASK);
8690 if (current_mapping_ptr->G2_index == FONT_INDEX_UNDEFINED)
8692 destination_data_ptr->info |= FONT_INDEX_LATIN_G2_SUPPLIMENTARY_SET << 8;
8696 destination_data_ptr->info |= current_mapping_ptr->G2_index << 8;
8698 destination_data_ptr->info |= triplet_data - 0x20;
8704 if (triplet_mode >= 16)
8706 column = triplet_address;
8708 destination_data_ptr = &display_info_ptr->character_map[row][column];
8710 destination_data_ptr->info &= ~TELETEXT_CHARACTER_BITMAP_INDEX_MASK;
8712 if (triplet_mode == 16)
8714 if (triplet_data == 0x2a)
8716 font_index = (destination_data_ptr->info & TELETEXT_CHARACTER_FONT_INDEX_MASK) >> 8;
8718 if ((font_index == FONT_INDEX_LATIN_G0_SET) ||
8719 (font_index == FONT_INDEX_CYRILLIC_G0_SET_OPTION_1_SERBIAN_CROATIAN) ||
8720 (font_index == FONT_INDEX_CYRILLIC_G0_SET_OPTION_2_RUSSIAN_BULGARIAN) ||
8721 (font_index == FONT_INDEX_CYRILLIC_G0_SET_OPTION_3_UKRANIAN) ||
8722 (font_index == FONT_INDEX_GREEK_G0_SET) ||
8723 (font_index == FONT_INDEX_ARABIC_G0_SET) ||
8724 (font_index == FONT_INDEX_HEBREW_G0_SET))
8726 destination_data_ptr->info &= ~TELETEXT_CHARACTER_FONT_INDEX_MASK;
8728 destination_data_ptr->info |= FONT_INDEX_LATIN_G0_SET << 8;
8730 destination_data_ptr->info |= 0x20;
8734 destination_data_ptr->info |= 0x0a;
8737 destination_data_ptr->diacritic_info = 0;
8739 else if (triplet_data >= 0x20)
8741 destination_data_ptr->info |= triplet_data - 0x20;
8743 destination_data_ptr->diacritic_info = 0;
8748 if (triplet_data >= 0x20)
8750 font_index = (destination_data_ptr->info & TELETEXT_CHARACTER_FONT_INDEX_MASK) >> 8;
8751 character_offset = triplet_data - 0x20;
8752 diacritic_offset = triplet_mode - 16;
8754 for (equivalence_index = 0; diacritic_equivalent_array[equivalence_index].font_index != FONT_INDEX_UNDEFINED; equivalence_index++)
8756 if ((diacritic_equivalent_array[equivalence_index].font_index == font_index) &&
8757 (diacritic_equivalent_array[equivalence_index].character_offset == character_offset) &&
8758 (diacritic_equivalent_array[equivalence_index].diacritic_offset == diacritic_offset))
8760 destination_data_ptr->info &= ~TELETEXT_CHARACTER_FONT_INDEX_MASK;
8762 destination_data_ptr->info |= diacritic_equivalent_array[equivalence_index].alternative_font_index << 8;
8764 destination_data_ptr->info |= diacritic_equivalent_array[equivalence_index].alternative_character_offset;
8766 destination_data_ptr->diacritic_info = 0;
8771 if (diacritic_equivalent_array[equivalence_index].font_index == FONT_INDEX_UNDEFINED)
8773 if ((diacritic_substitutions_avaialable == TRUE) &&
8774 (diacritic_substitution_offset[diacritic_offset] != 0))
8776 for (equivalence_index = 0; diacritic_substitution_array[equivalence_index].font_index != FONT_INDEX_UNDEFINED; equivalence_index++)
8778 if ((diacritic_substitution_array[equivalence_index].font_index == font_index) &&
8779 (diacritic_substitution_array[equivalence_index].character_offset == character_offset))
8781 destination_data_ptr->info &= ~TELETEXT_CHARACTER_FONT_INDEX_MASK;
8783 destination_data_ptr->info |= FONT_INDEX_G1_BLOCK_MOSAICS_SET << 8;
8785 destination_data_ptr->info |= diacritic_substitution_offset[diacritic_offset] +
8786 diacritic_substitution_array[equivalence_index].alternative_character_offset;
8788 if (current_mapping_ptr->G2_index == FONT_INDEX_UNDEFINED)
8790 destination_data_ptr->diacritic_info = FONT_INDEX_LATIN_G2_SUPPLIMENTARY_SET << 8;
8794 destination_data_ptr->diacritic_info = current_mapping_ptr->G2_index << 8;
8796 destination_data_ptr->diacritic_info |= 0x20 + diacritic_offset;
8803 if (diacritic_substitution_array[equivalence_index].font_index == FONT_INDEX_UNDEFINED)
8805 destination_data_ptr->info |= character_offset;
8807 if (current_mapping_ptr->G2_index == FONT_INDEX_UNDEFINED)
8809 destination_data_ptr->diacritic_info = FONT_INDEX_LATIN_G2_SUPPLIMENTARY_SET << 8;
8813 destination_data_ptr->diacritic_info = current_mapping_ptr->G2_index << 8;
8815 destination_data_ptr->diacritic_info |= 0x20 + diacritic_offset;
8832 FUNCTION_FINISH(DecodeTeletextPageBody);
8847 static void DecodeTeletextPageNumber(
S_PAGE_DISPLAY_INFO *display_info_ptr, BOOLEAN video_mix_overridden)
8850 BOOLEAN default_row_background_colour_defined;
8851 U8BIT default_row_background_colour;
8852 BOOLEAN set_background;
8854 static U8BIT index_digit_mapping[17] =
8856 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19,
8857 0X21, 0X22, 0X23, 0X24, 0X25, 0X26,
8861 FUNCTION_START(DecodeTeletextPageNumber);
8863 GetBasicPageDisplayInfo(display_info_ptr, NULL, NULL, NULL, NULL, NULL,
8864 &default_row_background_colour_defined,
8865 &default_row_background_colour);
8867 display_info_ptr->render_required = TRUE;
8869 if (display_info_ptr->page_index_held == TRUE)
8871 for (column = 0; column != 8; column++)
8873 display_info_ptr->character_map[0][column].info = FONT_INDEX_LATIN_G0_SET << 8;
8874 display_info_ptr->character_map[0][column].foreground_index = PALETTE_FOREGROUND_RED;
8875 if (default_row_background_colour_defined == TRUE)
8877 display_info_ptr->character_map[0][column].background_index = default_row_background_colour;
8881 display_info_ptr->character_map[0][column].background_index = PALETTE_BACKGROUND_BLACK;
8884 display_info_ptr->character_map[0][2].info |= 0x28;
8885 display_info_ptr->character_map[0][3].info |= 0x2f;
8886 display_info_ptr->character_map[0][4].info |= 0x2c;
8887 display_info_ptr->character_map[0][5].info |= 0x24;
8889 display_info_ptr->palette_update_required = TRUE;
8894 for (column = 0; column != 8; column++)
8896 display_info_ptr->character_map[0][column].info = FONT_INDEX_LATIN_G0_SET << 8;
8897 display_info_ptr->character_map[0][column].foreground_index = PALETTE_FOREGROUND_WHITE;
8898 if ((display_info_ptr->video_mix_set == TRUE) &&
8899 (video_mix_overridden == TRUE))
8901 display_info_ptr->character_map[0][column].background_index = PALETTE_BACKGROUND_BLACK_FIXED;
8905 if (default_row_background_colour_defined == TRUE)
8907 display_info_ptr->character_map[0][column].background_index = default_row_background_colour;
8911 display_info_ptr->character_map[0][column].background_index = PALETTE_BACKGROUND_BLACK;
8916 for (column = 0; column != 3; column++)
8918 display_info_ptr->character_map[0][column + 3].info |= index_digit_mapping[display_info_ptr->page_index_digit[column] - PAGE_INDEX_DIGIT_0];
8929 set_background = TRUE;
8930 for (column = 8; column != MAX_COLUMN; column++)
8932 if ((display_info_ptr->character_map[0][column].info != 0x00) &&
8933 (page_display_info.character_map[0][column].info != 0x00))
8935 set_background = FALSE;
8938 if (set_background != FALSE)
8940 for (column = 8; column != MAX_COLUMN; column++)
8942 display_info_ptr->character_map[0][column].foreground_index = display_info_ptr->character_map[0][0].foreground_index;
8943 display_info_ptr->character_map[0][column].background_index = display_info_ptr->character_map[0][0].background_index;
8947 display_info_ptr->valid_row[0] = TRUE;
8948 display_info_ptr->render_row[0] = TRUE;
8950 FUNCTION_FINISH(DecodeTeletextPageNumber);
8966 U8BIT foreground_colour, background_colour, foreground_index, background_index;
8967 U8BIT default_mapping, second_mapping, hold_mosaics_char;
8968 U8BIT subset_offset, current_source_char;
8969 U8BIT default_row_background_colour;
8971 U8BIT *source_data_ptr;
8972 BOOLEAN flashing, concealed;
8973 BOOLEAN mosaic_enabled, contiguous_mosaic_enabled, hold_mosaic_enabled;
8974 BOOLEAN default_row_background_colour_defined;
8980 FUNCTION_START(DecodeTeletextCarouselHeader);
8983 GetBasicPageDisplayInfo(display_info_ptr, &default_mapping, &second_mapping, NULL,
8985 &default_row_background_colour_defined,
8986 &default_row_background_colour);
8988 default_mapping_ptr = &character_set_mapping_array[default_mapping];
8989 if (second_mapping == 0xff)
8991 second_mapping_ptr = NULL;
8995 second_mapping_ptr = &character_set_mapping_array[second_mapping];
8998 display_info_ptr->render_required = TRUE;
8999 display_info_ptr->palette_update_required = TRUE;
9001 display_info_ptr->valid_row[0] = TRUE;
9002 display_info_ptr->render_row[0] = TRUE;
9006 current_mapping_ptr = default_mapping_ptr;
9008 foreground_colour = 2;
9009 if (default_row_background_colour_defined == TRUE)
9011 background_colour = default_row_background_colour;
9015 background_colour = 0;
9020 mosaic_enabled = FALSE;
9021 contiguous_mosaic_enabled = TRUE;
9022 hold_mosaic_enabled = FALSE;
9023 hold_mosaics_char = 0;
9025 GetCharacterPaletteIndexes(display_info_ptr,
9026 &foreground_index, &background_index,
9027 foreground_colour, background_colour,
9028 flashing, concealed,
9029 FALSE, FALSE, TRUE);
9031 source_data_ptr = &display_info_ptr->carousel_page_header[8];
9032 destination_data_ptr = &display_info_ptr->character_map[0][8];
9034 for (column = 8; column != MAX_COLUMN; column++)
9037 if (mosaic_enabled == TRUE)
9039 if (hold_mosaic_enabled == TRUE)
9041 destination_data_ptr->info = (FONT_INDEX_G1_BLOCK_MOSAICS_SET << 8) +
9046 destination_data_ptr->info = FONT_INDEX_G1_BLOCK_MOSAICS_SET << 8;
9049 if (contiguous_mosaic_enabled == FALSE)
9051 destination_data_ptr->info |= TELETEXT_CHARACTER_SEPERATED_MOSAIC;
9056 if (current_mapping_ptr->G0_index == FONT_INDEX_UNDEFINED)
9058 destination_data_ptr->info = FONT_INDEX_LATIN_G0_SET << 8;
9062 destination_data_ptr->info = current_mapping_ptr->G0_index << 8;
9066 destination_data_ptr->foreground_index = foreground_index;
9067 destination_data_ptr->background_index = background_index;
9069 if (GetParity7Byte(*source_data_ptr, ¤t_source_char) == TRUE)
9071 switch (current_source_char & 0x70)
9075 switch (current_source_char & 0x0f)
9080 GetCharacterPaletteIndexes(display_info_ptr,
9081 &foreground_index, &background_index,
9082 foreground_colour, background_colour,
9083 flashing, concealed,
9084 FALSE, FALSE, TRUE);
9090 GetCharacterPaletteIndexes(display_info_ptr,
9091 &foreground_index, &background_index,
9092 foreground_colour, background_colour,
9093 flashing, concealed,
9094 FALSE, FALSE, TRUE);
9096 destination_data_ptr->foreground_index = foreground_index;
9109 hold_mosaics_char = 0;
9114 hold_mosaics_char = 0;
9125 foreground_colour = current_source_char & 0x07;
9127 mosaic_enabled = FALSE;
9128 hold_mosaic_enabled = FALSE;
9129 hold_mosaics_char = 0;
9131 GetCharacterPaletteIndexes(display_info_ptr,
9132 &foreground_index, &background_index,
9133 foreground_colour, background_colour,
9134 flashing, concealed,
9135 FALSE, FALSE, TRUE);
9143 switch (current_source_char & 0x0f)
9148 GetCharacterPaletteIndexes(display_info_ptr,
9149 &foreground_index, &background_index,
9150 foreground_colour, background_colour,
9151 flashing, concealed,
9152 FALSE, FALSE, TRUE);
9154 destination_data_ptr->foreground_index = foreground_index;
9159 contiguous_mosaic_enabled = TRUE;
9161 destination_data_ptr->info &= ~TELETEXT_CHARACTER_SEPERATED_MOSAIC;
9166 contiguous_mosaic_enabled = FALSE;
9168 destination_data_ptr->info |= TELETEXT_CHARACTER_SEPERATED_MOSAIC;
9174 if (second_mapping_ptr != NULL)
9176 if (current_mapping_ptr == default_mapping_ptr)
9178 current_mapping_ptr = second_mapping_ptr;
9182 current_mapping_ptr = default_mapping_ptr;
9189 if (default_row_background_colour_defined == TRUE)
9191 background_colour = default_row_background_colour;
9195 background_colour = 0;
9198 GetCharacterPaletteIndexes(display_info_ptr,
9199 &foreground_index, &background_index,
9200 foreground_colour, background_colour,
9201 flashing, concealed,
9202 FALSE, FALSE, TRUE);
9206 destination_data_ptr->foreground_index = foreground_index;
9207 destination_data_ptr->background_index = background_index;
9212 background_colour = foreground_colour;
9214 GetCharacterPaletteIndexes(display_info_ptr,
9215 &foreground_index, &background_index,
9216 foreground_colour, background_colour,
9217 flashing, concealed,
9218 FALSE, FALSE, TRUE);
9222 destination_data_ptr->foreground_index = foreground_index;
9223 destination_data_ptr->background_index = background_index;
9228 if (mosaic_enabled == FALSE)
9230 if (hold_mosaic_enabled == FALSE)
9232 destination_data_ptr->info &= ~(TELETEXT_CHARACTER_FONT_INDEX_MASK |
9233 TELETEXT_CHARACTER_BITMAP_INDEX_MASK);
9234 destination_data_ptr->info |= (FONT_INDEX_G1_BLOCK_MOSAICS_SET << 8) +
9237 hold_mosaic_enabled = TRUE;
9244 if (mosaic_enabled == TRUE)
9246 hold_mosaic_enabled = FALSE;
9252 foreground_colour = current_source_char & 0x07;
9254 mosaic_enabled = TRUE;
9256 GetCharacterPaletteIndexes(display_info_ptr,
9257 &foreground_index, &background_index,
9258 foreground_colour, background_colour,
9259 flashing, concealed,
9260 FALSE, FALSE, TRUE);
9268 destination_data_ptr->info &= ~TELETEXT_CHARACTER_BITMAP_INDEX_MASK;
9269 destination_data_ptr->info |= current_source_char - 0x20;
9271 if (mosaic_enabled == TRUE)
9273 if (((current_source_char & 0x70) == 0x40) ||
9274 ((current_source_char & 0x70) == 0x50))
9276 if ((IsNationalOptionSubsetIndex(current_source_char, &subset_offset) == TRUE) &&
9277 (current_mapping_ptr->national_option_subset_index != NATIONALITY_INDEX_UNDEFINED))
9279 destination_data_ptr->info &= ~(TELETEXT_CHARACTER_FONT_INDEX_MASK |
9280 TELETEXT_CHARACTER_BITMAP_INDEX_MASK |
9281 TELETEXT_CHARACTER_SEPERATED_MOSAIC);
9283 destination_data_ptr->info |= FONT_INDEX_NATIONAL_OPTION_SUBSET << 8;
9285 destination_data_ptr->info |= subset_offset +
9286 current_mapping_ptr->national_option_subset_index;
9290 destination_data_ptr->info &= ~(TELETEXT_CHARACTER_FONT_INDEX_MASK |
9291 TELETEXT_CHARACTER_SEPERATED_MOSAIC);
9293 if (current_mapping_ptr->G0_index == FONT_INDEX_UNDEFINED)
9295 destination_data_ptr->info |= FONT_INDEX_LATIN_G0_SET << 8;
9299 destination_data_ptr->info |= current_mapping_ptr->G0_index << 8;
9305 hold_mosaics_char = current_source_char - 0x20;
9310 if ((current_mapping_ptr->G0_index == FONT_INDEX_LATIN_G0_SET) ||
9311 (current_mapping_ptr->G0_index == FONT_INDEX_UNDEFINED))
9313 if ((IsNationalOptionSubsetIndex(current_source_char, &subset_offset) == TRUE) &&
9314 (current_mapping_ptr->national_option_subset_index != NATIONALITY_INDEX_UNDEFINED))
9316 destination_data_ptr->info &= ~(TELETEXT_CHARACTER_FONT_INDEX_MASK |
9317 TELETEXT_CHARACTER_BITMAP_INDEX_MASK);
9319 destination_data_ptr->info |= FONT_INDEX_NATIONAL_OPTION_SUBSET << 8;
9321 destination_data_ptr->info |= subset_offset +
9322 current_mapping_ptr->national_option_subset_index;
9332 destination_data_ptr++;
9335 if (display_info_ptr->character_map[0][8].background_index == PALETTE_BACKGROUND_BLACK_FIXED)
9337 for (column = 0; column != 8; column++)
9339 display_info_ptr->character_map[0][column].background_index = PALETTE_BACKGROUND_BLACK_FIXED;
9341 for (column = 32; column != MAX_COLUMN; column++)
9343 display_info_ptr->character_map[0][column].background_index = PALETTE_BACKGROUND_BLACK_FIXED;
9347 FUNCTION_FINISH(DecodeTeletextCarouselHeader);
9362 static void DecodeTeletextClock(
S_PAGE_DISPLAY_INFO *display_info_ptr, BOOLEAN video_mix_overridden)
9364 U8BIT foreground_colour, background_colour, foreground_index, background_index;
9365 U8BIT default_mapping, second_mapping, hold_mosaics_char;
9366 U8BIT subset_offset, current_source_char;
9367 U8BIT default_row_background_colour;
9369 U8BIT *source_data_ptr;
9370 BOOLEAN flashing, concealed, header_required;
9371 BOOLEAN mosaic_enabled, contiguous_mosaic_enabled, hold_mosaic_enabled;
9372 BOOLEAN default_row_background_colour_defined;
9378 FUNCTION_START(DecodeTeletextClock);
9381 GetBasicPageDisplayInfo(display_info_ptr, &default_mapping, &second_mapping, NULL,
9382 &header_required, NULL,
9383 &default_row_background_colour_defined,
9384 &default_row_background_colour);
9386 if (header_required == TRUE)
9388 default_mapping_ptr = &character_set_mapping_array[default_mapping];
9389 if (second_mapping == 0xff)
9391 second_mapping_ptr = NULL;
9395 second_mapping_ptr = &character_set_mapping_array[second_mapping];
9398 display_info_ptr->render_required = TRUE;
9399 display_info_ptr->palette_update_required = TRUE;
9401 display_info_ptr->valid_row[0] = TRUE;
9402 display_info_ptr->render_row[0] = TRUE;
9406 current_mapping_ptr = default_mapping_ptr;
9408 foreground_colour = 2;
9409 background_colour = 0;
9413 mosaic_enabled = FALSE;
9414 contiguous_mosaic_enabled = TRUE;
9415 hold_mosaic_enabled = FALSE;
9416 hold_mosaics_char = 0;
9418 GetCharacterPaletteIndexes(display_info_ptr,
9419 &foreground_index, &background_index,
9420 foreground_colour, background_colour,
9421 flashing, concealed,
9422 FALSE, FALSE, video_mix_overridden);
9424 source_data_ptr = &display_info_ptr->time_filler_header_data[24];
9425 destination_data_ptr = &display_info_ptr->character_map[0][32];
9427 for (column = 32; column != MAX_COLUMN; column++)
9430 if (mosaic_enabled == TRUE)
9432 if (hold_mosaic_enabled == TRUE)
9434 destination_data_ptr->info = (FONT_INDEX_G1_BLOCK_MOSAICS_SET << 8) +
9439 destination_data_ptr->info = FONT_INDEX_G1_BLOCK_MOSAICS_SET << 8;
9442 if (contiguous_mosaic_enabled == FALSE)
9444 destination_data_ptr->info |= TELETEXT_CHARACTER_SEPERATED_MOSAIC;
9449 if (current_mapping_ptr->G0_index == FONT_INDEX_UNDEFINED)
9451 destination_data_ptr->info = FONT_INDEX_LATIN_G0_SET << 8;
9455 destination_data_ptr->info = current_mapping_ptr->G0_index << 8;
9459 if (GetParity7Byte(*source_data_ptr, ¤t_source_char) == TRUE)
9461 switch (current_source_char & 0x70)
9465 switch (current_source_char & 0x0f)
9470 GetCharacterPaletteIndexes(display_info_ptr,
9471 &foreground_index, &background_index,
9472 foreground_colour, background_colour,
9473 flashing, concealed,
9474 FALSE, FALSE, video_mix_overridden);
9480 GetCharacterPaletteIndexes(display_info_ptr,
9481 &foreground_index, &background_index,
9482 foreground_colour, background_colour,
9483 flashing, concealed,
9484 FALSE, FALSE, video_mix_overridden);
9486 destination_data_ptr->foreground_index = foreground_index;
9530 switch (current_source_char & 0x0f)
9535 GetCharacterPaletteIndexes(display_info_ptr,
9536 &foreground_index, &background_index,
9537 foreground_colour, background_colour,
9538 flashing, concealed,
9539 FALSE, FALSE, video_mix_overridden);
9541 destination_data_ptr->foreground_index = foreground_index;
9546 contiguous_mosaic_enabled = TRUE;
9548 destination_data_ptr->info &= ~TELETEXT_CHARACTER_SEPERATED_MOSAIC;
9553 contiguous_mosaic_enabled = FALSE;
9555 destination_data_ptr->info |= TELETEXT_CHARACTER_SEPERATED_MOSAIC;
9561 if (second_mapping_ptr != NULL)
9563 if (current_mapping_ptr == default_mapping_ptr)
9565 current_mapping_ptr = second_mapping_ptr;
9569 current_mapping_ptr = default_mapping_ptr;
9615 if (mosaic_enabled == FALSE)
9617 if (hold_mosaic_enabled == FALSE)
9619 destination_data_ptr->info &= ~(TELETEXT_CHARACTER_FONT_INDEX_MASK |
9620 TELETEXT_CHARACTER_BITMAP_INDEX_MASK);
9621 destination_data_ptr->info |= (FONT_INDEX_G1_BLOCK_MOSAICS_SET << 8) +
9624 hold_mosaic_enabled = TRUE;
9631 if (mosaic_enabled == TRUE)
9633 hold_mosaic_enabled = FALSE;
9655 destination_data_ptr->info |= current_source_char - 0x20;
9657 if (mosaic_enabled == TRUE)
9659 if (((current_source_char & 0x70) == 0x40) ||
9660 ((current_source_char & 0x70) == 0x50))
9662 if ((IsNationalOptionSubsetIndex(current_source_char, &subset_offset) == TRUE) &&
9663 (current_mapping_ptr->national_option_subset_index != NATIONALITY_INDEX_UNDEFINED))
9665 destination_data_ptr->info &= ~(TELETEXT_CHARACTER_FONT_INDEX_MASK |
9666 TELETEXT_CHARACTER_BITMAP_INDEX_MASK |
9667 TELETEXT_CHARACTER_SEPERATED_MOSAIC);
9669 destination_data_ptr->info |= FONT_INDEX_NATIONAL_OPTION_SUBSET << 8;
9671 destination_data_ptr->info |= subset_offset +
9672 current_mapping_ptr->national_option_subset_index;
9676 destination_data_ptr->info &= ~(TELETEXT_CHARACTER_FONT_INDEX_MASK |
9677 TELETEXT_CHARACTER_SEPERATED_MOSAIC);
9679 if (current_mapping_ptr->G0_index == FONT_INDEX_UNDEFINED)
9681 destination_data_ptr->info |= FONT_INDEX_LATIN_G0_SET << 8;
9685 destination_data_ptr->info |= current_mapping_ptr->G0_index << 8;
9692 if ((current_mapping_ptr->G0_index == FONT_INDEX_LATIN_G0_SET) ||
9693 (current_mapping_ptr->G0_index == FONT_INDEX_UNDEFINED))
9695 if ((IsNationalOptionSubsetIndex(current_source_char, &subset_offset) == TRUE) &&
9696 (current_mapping_ptr->national_option_subset_index != NATIONALITY_INDEX_UNDEFINED))
9698 destination_data_ptr->info &= ~(TELETEXT_CHARACTER_FONT_INDEX_MASK |
9699 TELETEXT_CHARACTER_BITMAP_INDEX_MASK);
9701 destination_data_ptr->info |= FONT_INDEX_NATIONAL_OPTION_SUBSET << 8;
9703 destination_data_ptr->info |= subset_offset +
9704 current_mapping_ptr->national_option_subset_index;
9714 destination_data_ptr++;
9718 FUNCTION_FINISH(DecodeTeletextClock);
9737 U8BIT *aliased_foreground_index, U8BIT *aliased_background_index,
9740 U16BIT effect_index, alias_index, max_aliases;
9742 FUNCTION_START(GetAliasedColourIndexes);
9744 *aliased_foreground_index = character_ptr->foreground_index;
9745 *aliased_background_index = character_ptr->background_index;
9747 if (*bitmap_ptr & 4)
9749 for (effect_index = 0; effect_index != NUM_PALETTE_EFFECTS; effect_index++)
9751 if (display_info_ptr->palette_attribute_array[effect_index].effect_mask ==
9752 PALETTE_EFFECT_UNDEFINED)
9758 if (effect_index != NUM_PALETTE_EFFECTS)
9760 max_aliases = (NUM_PALETTE_EFFECTS - effect_index) / 2;
9762 for (alias_index = 0; alias_index < max_aliases; alias_index++)
9764 if (display_info_ptr->palette_alias_array[alias_index].fore_colour ==
9765 PALETTE_BACKGROUND_TRANSPARENT)
9767 display_info_ptr->palette_alias_array[alias_index].fore_colour =
9768 character_ptr->foreground_index;
9769 display_info_ptr->palette_alias_array[alias_index].back_colour =
9770 character_ptr->background_index;
9772 if (alias_index < (max_aliases - 1))
9774 display_info_ptr->palette_alias_array[alias_index + 1].fore_colour =
9775 PALETTE_BACKGROUND_TRANSPARENT;
9778 *aliased_foreground_index = PALETTE_EFFECT_ORIGIN + effect_index + (alias_index * 2);
9779 *aliased_background_index =
9780 PALETTE_EFFECT_ORIGIN + effect_index + (alias_index * 2) + 1;
9785 if ((display_info_ptr->palette_alias_array[alias_index].fore_colour ==
9786 character_ptr->foreground_index) &&
9787 (display_info_ptr->palette_alias_array[alias_index].back_colour ==
9788 character_ptr->background_index))
9790 *aliased_foreground_index = PALETTE_EFFECT_ORIGIN + effect_index + (alias_index * 2);
9791 *aliased_background_index =
9792 PALETTE_EFFECT_ORIGIN + effect_index + (alias_index * 2) + 1;
9800 FUNCTION_FINISH(GetAliasedColourIndexes);
9819 static void RenderCharacter(U16BIT x, U16BIT y, U16BIT x_scalar, U16BIT y_scalar,
9822 U8BIT row_index, column_index, repeat_index;
9823 U8BIT aliased_foreground_index, aliased_background_index;
9824 U16BIT font_index, bitmap_index, output_row_increment, output_repeat_increment;
9825 BOOLEAN render_done;
9826 U8BIT *output_row_ptr;
9827 U8BIT *output_column_ptr;
9828 U8BIT *output_repeat_ptr;
9830 U8BIT *diacritic_bitmap_ptr;
9833 FUNCTION_START(RenderCharacter);
9835 render_done = FALSE;
9837 if (character_ptr->foreground_index == PALETTE_FOREGROUND_UNBOXED)
9839 if (character_ptr->info & TELETEXT_CHARACTER_DOUBLE_HEIGHT)
9845 ebutt_font_ptr->character_width * x_scalar,
9846 ebutt_font_ptr->character_height * y_scalar,
9847 PALETTE_BACKGROUND_TRANSPARENT );
9853 font_index = (character_ptr->info & TELETEXT_CHARACTER_FONT_INDEX_MASK) >> 8;
9855 if (font_index != FONT_INDEX_NO_BITMAP)
9857 if (font_index != FONT_INDEX_NATIONAL_OPTION_SUBSET)
9859 bitmap_ptr = ebutt_font_ptr->font_table_set_ptr[font_index];
9863 bitmap_ptr = ebutt_font_ptr->font_table_option_subset_ptr;
9866 if (bitmap_ptr != NULL)
9868 bitmap_index = character_ptr->info & TELETEXT_CHARACTER_BITMAP_INDEX_MASK;
9870 bitmap_ptr += ebutt_font_ptr->character_width * ebutt_font_ptr->character_height *
9873 GetAliasedColourIndexes(character_ptr, bitmap_ptr,
9874 &aliased_foreground_index, &aliased_background_index,
9877 if (character_ptr->diacritic_info)
9879 font_index = (character_ptr->diacritic_info & TELETEXT_CHARACTER_FONT_INDEX_MASK) >> 8;
9881 diacritic_bitmap_ptr = ebutt_font_ptr->font_table_set_ptr[font_index];
9883 if (diacritic_bitmap_ptr != NULL)
9885 bitmap_index = character_ptr->diacritic_info & TELETEXT_CHARACTER_BITMAP_INDEX_MASK;
9887 diacritic_bitmap_ptr += ebutt_font_ptr->character_width *
9888 ebutt_font_ptr->character_height * bitmap_index;
9893 diacritic_bitmap_ptr = NULL;
9896 memset(display_char_buffer, character_ptr->background_index, display_char_buffer_size);
9898 if (character_ptr->info & TELETEXT_CHARACTER_DOUBLE_HEIGHT)
9903 output_row_ptr = display_char_buffer;
9905 output_row_increment = ebutt_font_ptr->character_width * x_scalar * y_scalar;
9906 output_repeat_increment = ebutt_font_ptr->character_width * x_scalar;
9908 for (row_index = 0; row_index != ebutt_font_ptr->character_height; row_index++)
9910 output_column_ptr = output_row_ptr;
9912 if (character_ptr->info & TELETEXT_CHARACTER_SEPERATED_MOSAIC)
9914 if (ebutt_font_ptr->seperator_row_mask & (1L << (U32BIT)row_index))
9916 output_row_ptr += output_row_increment;
9917 bitmap_ptr += ebutt_font_ptr->character_width;
9918 if (diacritic_bitmap_ptr != NULL)
9920 diacritic_bitmap_ptr += ebutt_font_ptr->character_width;
9926 for (column_index = 0; column_index != ebutt_font_ptr->character_width;
9929 if (character_ptr->info & TELETEXT_CHARACTER_SEPERATED_MOSAIC)
9931 if (ebutt_font_ptr->seperator_column_mask & (1L << (U32BIT)column_index))
9933 output_column_ptr += x_scalar;
9935 if (diacritic_bitmap_ptr != NULL)
9937 diacritic_bitmap_ptr++;
9943 if ((*bitmap_ptr) & 1)
9945 output_repeat_ptr = output_column_ptr;
9947 if (*bitmap_ptr == 3)
9949 for (repeat_index = 0; repeat_index != y_scalar; repeat_index++)
9951 memset(output_repeat_ptr, character_ptr->foreground_index, x_scalar);
9953 *output_repeat_ptr = aliased_foreground_index;
9955 output_repeat_ptr += output_repeat_increment;
9960 for (repeat_index = 0; repeat_index != y_scalar; repeat_index++)
9962 memset(output_repeat_ptr, character_ptr->foreground_index, x_scalar);
9964 output_repeat_ptr += output_repeat_increment;
9970 if (*bitmap_ptr == 2)
9972 output_repeat_ptr = output_column_ptr;
9973 pixel_colour = aliased_background_index;
9975 for (repeat_index = 0; repeat_index != y_scalar; repeat_index++)
9977 *output_repeat_ptr = pixel_colour;
9979 output_repeat_ptr += output_repeat_increment;
9984 if (diacritic_bitmap_ptr != NULL)
9986 if ((*diacritic_bitmap_ptr) & 1)
9988 output_repeat_ptr = output_column_ptr;
9990 if ((*diacritic_bitmap_ptr == 3) &&
9991 (*output_repeat_ptr != character_ptr->foreground_index))
9993 for (repeat_index = 0; repeat_index != y_scalar; repeat_index++)
9995 memset(output_repeat_ptr, character_ptr->foreground_index, x_scalar);
9997 *output_repeat_ptr = aliased_foreground_index;
9999 output_repeat_ptr += output_repeat_increment;
10004 for (repeat_index = 0; repeat_index != y_scalar; repeat_index++)
10006 memset(output_repeat_ptr, character_ptr->foreground_index, x_scalar);
10008 output_repeat_ptr += output_repeat_increment;
10014 output_repeat_ptr = output_column_ptr;
10016 if ((*diacritic_bitmap_ptr == 2) &&
10017 (*output_repeat_ptr != character_ptr->foreground_index))
10019 pixel_colour = aliased_background_index;
10021 for (repeat_index = 0; repeat_index != y_scalar; repeat_index++)
10023 *output_repeat_ptr = pixel_colour;
10025 output_repeat_ptr += output_repeat_increment;
10031 output_column_ptr += x_scalar;
10033 if (diacritic_bitmap_ptr != NULL)
10035 diacritic_bitmap_ptr++;
10039 output_row_ptr += output_row_increment;
10041 DBGPRINT(
"x=%d y=%d c=%c", x, y, bitmap_index ? bitmap_index + 0x20 : 176);
10043 ebutt_font_ptr->character_height * y_scalar, display_char_buffer, FALSE);
10045 render_done = TRUE;
10050 if (render_done == FALSE)
10052 if (character_ptr->info & TELETEXT_CHARACTER_DOUBLE_HEIGHT)
10058 ebutt_font_ptr->character_width * x_scalar,
10059 ebutt_font_ptr->character_height * y_scalar,
10060 character_ptr->background_index );
10063 FUNCTION_FINISH(RenderCharacter);
10082 static U32BIT GetRGBSetting(BOOLEAN tranparency_required, U8BIT transparency_level,
10083 BOOLEAN red_required, BOOLEAN green_required, BOOLEAN blue_required,
10084 U8BIT gun_intensity)
10088 FUNCTION_START(GetRGBSetting);
10090 if (tranparency_required == TRUE)
10092 retval = (U32BIT)transparency_level << 24L;
10099 if (red_required == TRUE)
10101 retval |= (U32BIT)gun_intensity << 16L;
10104 if (green_required == TRUE)
10106 retval |= (U32BIT)gun_intensity << 8L;
10109 if (blue_required == TRUE)
10111 retval |= (U32BIT)gun_intensity;
10114 FUNCTION_FINISH(GetRGBSetting);
10132 static U32BIT GetRGBRamping(U32BIT fore_colour, U32BIT back_colour, U32BIT foreground_sixteenths)
10135 U32BIT retval, gun_mask, fore_gun_value, back_gun_value, temp;
10137 FUNCTION_START(GetRGBRamping);
10140 gun_mask = 0x00ff0000L;
10142 for (index = 0; index != 3; index++)
10144 fore_gun_value = fore_colour & gun_mask;
10145 back_gun_value = back_colour & gun_mask;
10147 if (fore_gun_value >= back_gun_value)
10149 temp = (fore_gun_value * foreground_sixteenths) + (back_gun_value *
10150 (16 - foreground_sixteenths));
10154 temp = (back_gun_value * (16 - foreground_sixteenths)) +
10155 (fore_gun_value * foreground_sixteenths);
10159 retval |= temp & gun_mask;
10164 FUNCTION_FINISH(GetRGBRamping);
10182 U8BIT fore_colour_index, back_colour_index;
10183 U16BIT row_index, y, y_scalar, column_index, x, character_width, character_height;
10184 U16BIT effect_index, alias_index, max_aliases;
10185 U16BIT display_zoom_scalar, display_start_row, display_num_rows;
10186 U32BIT alias_colour_value;
10189 U32BIT pts_timestamp;
10190 U32BIT stc_timestamp;
10191 BOOLEAN render_required;
10193 static U32BIT normal_palette_array[PALETTE_EFFECT_ORIGIN];
10194 static U32BIT mixed_palette_array[PALETTE_EFFECT_ORIGIN];
10195 static U8BIT gun_intensity;
10196 static U8BIT antialias_level;
10197 static U8BIT transparency_level;
10199 FUNCTION_START(RenderDisplay);
10201 display_zoom_scalar = display_info_ptr->page_scale_zoom_scalar;
10202 display_start_row = display_info_ptr->page_scale_start_row;
10203 display_num_rows = display_info_ptr->page_scale_num_rows;
10204 if (display_start_row == 0 && !show_header_row)
10206 display_start_row++;
10207 display_num_rows--;
10210 render_required = FALSE;
10212 if (display_info_ptr->render_required == TRUE)
10215 if (display_info_ptr->clear_screen || display_info_ptr->render_row[display_start_row + 1])
10217 EBU_PRINT(
"RenderDisplay: start=%u, num=%u, clear=%u\n", display_start_row, display_num_rows,
10218 display_info_ptr->clear_screen);
10220 EBU_PRINT(
" valid =");
10221 for (row_index = display_start_row; row_index < (display_start_row + display_num_rows);
10224 EBU_PRINT(
"%c", display_info_ptr->valid_row[row_index] ?
'1' :
'0');
10227 EBU_PRINT(
" render=");
10228 for (row_index = display_start_row; row_index < (display_start_row + display_num_rows);
10231 EBU_PRINT(
"%c", display_info_ptr->render_row[row_index] ?
'1' :
'0');
10237 if (display_info_ptr->subtitle && display_info_ptr->pts_valid)
10240 if (!display_info_ptr->clear_set)
10242 for (row_index = display_start_row;
10243 (row_index != (display_start_row + display_num_rows)) && !render_required; row_index++)
10245 if ((display_info_ptr->valid_row[row_index] == TRUE) &&
10246 (display_info_ptr->render_row[row_index] == TRUE))
10248 render_required = TRUE;
10253 if (render_required)
10255 pts_timestamp = (display_info_ptr->page_pts[0] << 24) + (display_info_ptr->page_pts[1] << 16) +
10256 (display_info_ptr->page_pts[2] << 8) + display_info_ptr->page_pts[3];
10259 stc_timestamp = (stc[0] << 24) + (stc[1] << 16) + (stc[2] << 8) + stc[3];
10261 if ((stc[0] == 0) && (display_info_ptr->page_pts[0] == 1))
10264 EBU_DBG(
"Clearing top bit of PTS 0x%08lx, STC=0x%08lx", pts_timestamp, stc_timestamp);
10265 pts_timestamp &= 0x00ffffff;
10267 else if ((stc[0] == 1) && (display_info_ptr->page_pts[0] == 0))
10270 EBU_DBG(
"Setting top bit of PTS 0x%08lx, STC=0x%08lx", pts_timestamp, stc_timestamp);
10271 pts_timestamp |= 0x01000000;
10274 if (display_info_ptr->time_offset == 0)
10278 if ((stc_timestamp != 0) && (pts_timestamp != 0))
10280 display_info_ptr->time_offset = (S32BIT)((pts_timestamp - stc_timestamp) & 0xffffff00);
10281 if ((display_info_ptr->time_offset < -0x10000) || (display_info_ptr->time_offset > 0x10000))
10283 EBU_DBG(
"Using offset 0x%08lx, PTS 0x%08lx, STC 0x%08lx",
10284 display_info_ptr->time_offset, pts_timestamp, stc_timestamp);
10286 pts_timestamp -= display_info_ptr->time_offset;
10290 display_info_ptr->time_offset = 0;
10296 pts_timestamp -= display_info_ptr->time_offset;
10303 stc_timestamp = (stc[0] << 24) + (stc[1] << 16) + (stc[2] << 8) + stc[3];
10305 if ((stc_timestamp < pts_timestamp) && !stop_teletext)
10307 EBU_DBG(
"Wait to display..., PTS=0x%08lx, STC=0x%08lx", pts_timestamp, stc_timestamp);
10311 while ((stc_timestamp < pts_timestamp) && !stop_teletext);
10313 EBU_DBG(
"Display now: PTS=0x%08lx, STC=0x%08lx", pts_timestamp, stc_timestamp);
10320 if (display_info_ptr->clear_screen == TRUE)
10322 if (display_info_ptr->clear_set == TRUE)
10331 display_info_ptr->clear_screen = FALSE;
10334 if (ebutt_font_ptr != NULL)
10336 character_width = ebutt_font_ptr->character_width * display_x_scalar;
10338 y_scalar = display_y_scalar * display_zoom_scalar;
10340 character_height = ebutt_font_ptr->character_height * y_scalar;
10342 y = display_margin_top;
10344 if (display_info_ptr->clear_set == TRUE)
10346 character_ptr = &display_info_ptr->character_map[0][2];
10348 x = display_margin_left;
10349 x += character_width * 2;
10351 for (column_index = 2; column_index != 6; column_index++)
10353 RenderCharacter(x, y, display_x_scalar, y_scalar, character_ptr, display_info_ptr);
10354 x += character_width;
10361 EBU_PRINT(
"%s: ", __FUNCTION__);
10363 for (row_index = display_start_row; row_index != (display_start_row + display_num_rows);
10366 if ((display_info_ptr->valid_row[row_index] == TRUE) &&
10367 (display_info_ptr->render_row[row_index] == TRUE))
10369 character_ptr = &display_info_ptr->character_map[row_index][0];
10371 x = display_margin_left;
10373 for (column_index = 0; column_index != MAX_COLUMN; column_index++)
10377 if ((display_info_ptr->valid_row[row_index - 1] == TRUE) &&
10378 (display_info_ptr->character_map[row_index - 1][column_index].info &
10379 TELETEXT_CHARACTER_DOUBLE_HEIGHT))
10381 x += character_width;
10388 if ((character_ptr->info & 0xff) < 0x5f)
10389 EBU_PRINT(
"%c", (character_ptr->info & 0xff) + 0x20);
10391 RenderCharacter(x, y, display_x_scalar, y_scalar, character_ptr, display_info_ptr);
10392 x += character_width;
10396 display_info_ptr->render_row[row_index] = FALSE;
10399 y += character_height;
10407 display_info_ptr->render_required = FALSE;
10410 if (gun_intensity != current_gun_intensity)
10412 gun_intensity = current_gun_intensity;
10414 normal_palette_array[PALETTE_BACKGROUND_TRANSPARENT] =
10415 GetRGBSetting(TRUE, current_transparency_level, FALSE, FALSE, FALSE, 0);
10416 normal_palette_array[PALETTE_BACKGROUND_BLACK_FIXED] =
10417 GetRGBSetting(FALSE, 0, FALSE, FALSE, FALSE, 0);
10419 normal_palette_array[PALETTE_BACKGROUND_BLACK] =
10420 GetRGBSetting(FALSE, 0, FALSE, FALSE, FALSE, 0);
10421 normal_palette_array[PALETTE_BACKGROUND_RED] =
10422 GetRGBSetting(FALSE, 0, TRUE, FALSE, FALSE, gun_intensity);
10423 normal_palette_array[PALETTE_BACKGROUND_GREEN] =
10424 GetRGBSetting(FALSE, 0, FALSE, TRUE, FALSE, gun_intensity);
10425 normal_palette_array[PALETTE_BACKGROUND_YELLOW] =
10426 GetRGBSetting(FALSE, 0, TRUE, TRUE, FALSE, gun_intensity);
10427 normal_palette_array[PALETTE_BACKGROUND_BLUE] =
10428 GetRGBSetting(FALSE, 0, FALSE, FALSE, TRUE, gun_intensity);
10429 normal_palette_array[PALETTE_BACKGROUND_MAGENTA] =
10430 GetRGBSetting(FALSE, 0, TRUE, FALSE, TRUE, gun_intensity);
10431 normal_palette_array[PALETTE_BACKGROUND_CYAN] =
10432 GetRGBSetting(FALSE, 0, FALSE, TRUE, TRUE, gun_intensity);
10433 normal_palette_array[PALETTE_BACKGROUND_WHITE] =
10434 GetRGBSetting(FALSE, 0, TRUE, TRUE, TRUE, gun_intensity);
10436 normal_palette_array[PALETTE_FOREGROUND_BLACK] =
10437 normal_palette_array[PALETTE_BACKGROUND_BLACK];
10438 normal_palette_array[PALETTE_FOREGROUND_RED] =
10439 normal_palette_array[PALETTE_BACKGROUND_RED];
10440 normal_palette_array[PALETTE_FOREGROUND_GREEN] =
10441 normal_palette_array[PALETTE_BACKGROUND_GREEN];
10442 normal_palette_array[PALETTE_FOREGROUND_YELLOW] =
10443 normal_palette_array[PALETTE_BACKGROUND_YELLOW];
10444 normal_palette_array[PALETTE_FOREGROUND_BLUE] =
10445 normal_palette_array[PALETTE_BACKGROUND_BLUE];
10446 normal_palette_array[PALETTE_FOREGROUND_MAGENTA] =
10447 normal_palette_array[PALETTE_BACKGROUND_MAGENTA];
10448 normal_palette_array[PALETTE_FOREGROUND_CYAN] =
10449 normal_palette_array[PALETTE_BACKGROUND_CYAN];
10450 normal_palette_array[PALETTE_FOREGROUND_WHITE] =
10451 normal_palette_array[PALETTE_BACKGROUND_WHITE];
10453 mixed_palette_array[PALETTE_BACKGROUND_TRANSPARENT] =
10454 GetRGBSetting(TRUE, current_transparency_level, FALSE, FALSE, FALSE, 0);
10455 mixed_palette_array[PALETTE_BACKGROUND_BLACK_FIXED] =
10456 GetRGBSetting(FALSE, 0, FALSE, FALSE, FALSE, 0);
10458 mixed_palette_array[PALETTE_BACKGROUND_BLACK] =
10459 mixed_palette_array[PALETTE_BACKGROUND_TRANSPARENT];
10460 mixed_palette_array[PALETTE_BACKGROUND_RED] =
10461 mixed_palette_array[PALETTE_BACKGROUND_TRANSPARENT];
10462 mixed_palette_array[PALETTE_BACKGROUND_GREEN] =
10463 mixed_palette_array[PALETTE_BACKGROUND_TRANSPARENT];
10464 mixed_palette_array[PALETTE_BACKGROUND_YELLOW] =
10465 mixed_palette_array[PALETTE_BACKGROUND_TRANSPARENT];
10466 mixed_palette_array[PALETTE_BACKGROUND_BLUE] =
10467 mixed_palette_array[PALETTE_BACKGROUND_TRANSPARENT];
10468 mixed_palette_array[PALETTE_BACKGROUND_MAGENTA] =
10469 mixed_palette_array[PALETTE_BACKGROUND_TRANSPARENT];
10470 mixed_palette_array[PALETTE_BACKGROUND_CYAN] =
10471 mixed_palette_array[PALETTE_BACKGROUND_TRANSPARENT];
10472 mixed_palette_array[PALETTE_BACKGROUND_WHITE] =
10473 mixed_palette_array[PALETTE_BACKGROUND_TRANSPARENT];
10475 mixed_palette_array[PALETTE_FOREGROUND_BLACK] =
10476 normal_palette_array[PALETTE_FOREGROUND_BLACK];
10477 mixed_palette_array[PALETTE_FOREGROUND_RED] =
10478 normal_palette_array[PALETTE_FOREGROUND_RED];
10479 mixed_palette_array[PALETTE_FOREGROUND_GREEN] =
10480 normal_palette_array[PALETTE_FOREGROUND_GREEN];
10481 mixed_palette_array[PALETTE_FOREGROUND_YELLOW] =
10482 normal_palette_array[PALETTE_FOREGROUND_YELLOW];
10483 mixed_palette_array[PALETTE_FOREGROUND_BLUE] =
10484 normal_palette_array[PALETTE_FOREGROUND_BLUE];
10485 mixed_palette_array[PALETTE_FOREGROUND_MAGENTA] =
10486 normal_palette_array[PALETTE_FOREGROUND_MAGENTA];
10487 mixed_palette_array[PALETTE_FOREGROUND_CYAN] =
10488 normal_palette_array[PALETTE_FOREGROUND_CYAN];
10489 mixed_palette_array[PALETTE_FOREGROUND_WHITE] =
10490 normal_palette_array[PALETTE_FOREGROUND_WHITE];
10492 display_info_ptr->palette_update_required = TRUE;
10495 if (antialias_level != current_antialias_level)
10497 antialias_level = current_antialias_level;
10499 display_info_ptr->palette_update_required = TRUE;
10502 if (transparency_level != current_transparency_level)
10504 transparency_level = current_transparency_level;
10506 display_info_ptr->palette_update_required = TRUE;
10509 if (palette_reset_required == TRUE)
10511 if (display_info_ptr->video_mix_set == TRUE)
10513 memcpy(display_info_ptr->palette_array, mixed_palette_array,
10514 PALETTE_EFFECT_ORIGIN *
sizeof(U32BIT));
10518 memcpy(display_info_ptr->palette_array, normal_palette_array,
10519 PALETTE_EFFECT_ORIGIN *
sizeof(U32BIT));
10524 palette_reset_required = FALSE;
10527 if (display_info_ptr->palette_update_required == TRUE)
10529 if (display_info_ptr->video_mix_set == TRUE)
10531 memcpy(display_info_ptr->palette_array, mixed_palette_array,
10532 PALETTE_EFFECT_ORIGIN *
sizeof(U32BIT));
10536 memcpy(display_info_ptr->palette_array, normal_palette_array,
10537 PALETTE_EFFECT_ORIGIN *
sizeof(U32BIT));
10540 for (effect_index = 0; effect_index < NUM_PALETTE_EFFECTS; effect_index++)
10542 if (display_info_ptr->palette_attribute_array[effect_index].effect_mask ==
10543 PALETTE_EFFECT_UNDEFINED)
10548 display_info_ptr->palette_array[effect_index + PALETTE_EFFECT_ORIGIN] =
10549 display_info_ptr->palette_array[display_info_ptr->palette_attribute_array[effect_index].fore_colour];
10550 display_info_ptr->palette_attribute_array[effect_index].fore_colour_used = TRUE;
10552 if (display_info_ptr->palette_attribute_array[effect_index].effect_mask & PALETTE_EFFECT_CONCEAL)
10554 if (display_info_ptr->reveal_set == TRUE)
10556 if (display_info_ptr->palette_attribute_array[effect_index].effect_mask & PALETTE_EFFECT_FLASH)
10558 if (display_info_ptr->flash_set == FALSE)
10560 display_info_ptr->palette_array[effect_index + PALETTE_EFFECT_ORIGIN] =
10561 display_info_ptr->palette_array[display_info_ptr->palette_attribute_array[effect_index].back_colour];
10562 display_info_ptr->palette_attribute_array[effect_index].fore_colour_used = FALSE;
10568 display_info_ptr->palette_array[effect_index + PALETTE_EFFECT_ORIGIN] =
10569 display_info_ptr->palette_array[display_info_ptr->palette_attribute_array[effect_index].back_colour];
10570 display_info_ptr->palette_attribute_array[effect_index].fore_colour_used = FALSE;
10573 else if (display_info_ptr->palette_attribute_array[effect_index].effect_mask & PALETTE_EFFECT_FLASH)
10575 if (display_info_ptr->flash_set == FALSE)
10577 display_info_ptr->palette_array[effect_index + PALETTE_EFFECT_ORIGIN] =
10578 display_info_ptr->palette_array[display_info_ptr->palette_attribute_array[effect_index].back_colour];
10579 display_info_ptr->palette_attribute_array[effect_index].fore_colour_used = FALSE;
10584 if (effect_index != NUM_PALETTE_EFFECTS)
10586 max_aliases = (NUM_PALETTE_EFFECTS - effect_index) / 2;
10588 for (alias_index = 0; alias_index < max_aliases; alias_index++)
10590 if (display_info_ptr->palette_alias_array[alias_index].fore_colour ==
10591 PALETTE_BACKGROUND_TRANSPARENT)
10596 fore_colour_index = display_info_ptr->palette_alias_array[alias_index].fore_colour;
10597 back_colour_index = display_info_ptr->palette_alias_array[alias_index].back_colour;
10599 if (fore_colour_index >= PALETTE_EFFECT_ORIGIN)
10601 if (display_info_ptr->palette_attribute_array[fore_colour_index - PALETTE_EFFECT_ORIGIN].fore_colour_used == TRUE)
10603 fore_colour_index = display_info_ptr->palette_attribute_array[fore_colour_index - PALETTE_EFFECT_ORIGIN].fore_colour;
10607 fore_colour_index = display_info_ptr->palette_attribute_array[fore_colour_index - PALETTE_EFFECT_ORIGIN].back_colour;
10611 if (display_info_ptr->palette_array[back_colour_index] & 0xff000000L)
10613 display_info_ptr->palette_array[PALETTE_EFFECT_ORIGIN + effect_index + (alias_index * 2)] =
10614 display_info_ptr->palette_array[fore_colour_index];
10615 display_info_ptr->palette_array[PALETTE_EFFECT_ORIGIN + effect_index + (alias_index * 2) + 1] =
10616 display_info_ptr->palette_array[back_colour_index];
10620 alias_colour_value = GetRGBRamping(display_info_ptr->palette_array[fore_colour_index],
10621 display_info_ptr->palette_array[back_colour_index],
10622 16L - (U32BIT)antialias_level);
10624 display_info_ptr->palette_array[PALETTE_EFFECT_ORIGIN + effect_index + (alias_index * 2)] = alias_colour_value;
10626 alias_colour_value = GetRGBRamping(display_info_ptr->palette_array[fore_colour_index],
10627 display_info_ptr->palette_array[back_colour_index],
10628 (U32BIT)antialias_level);
10630 display_info_ptr->palette_array[PALETTE_EFFECT_ORIGIN + effect_index + (alias_index * 2) + 1] = alias_colour_value;
10638 display_info_ptr->palette_update_required = FALSE;
10648 if (!stop_teletext)
10650 if (render_required)
10655 EBU_DBG(
"Start subtitle timeout @ %lu", subtitle_timeout);
10662 FUNCTION_FINISH(RenderDisplay);
10682 static void PerformDisplayUpdate(
void)
10685 BOOLEAN enforce_header_display;
10686 BOOLEAN override_header_backcolor;
10688 static U16BIT flash_counter;
10690 FUNCTION_START(PerformDisplayUpdate);
10692 enforce_header_display = FALSE;
10695 if (page_display_info.video_mix_required != page_control_info.video_mix_required)
10697 page_display_info.video_mix_required = page_control_info.video_mix_required;
10699 page_display_info.video_mix_set = !page_display_info.video_mix_set;
10702 if (page_display_copy.video_mix_set != page_display_info.video_mix_set)
10704 page_display_copy.video_mix_set = page_display_info.video_mix_set;
10706 page_display_copy.palette_update_required = TRUE;
10709 if (page_display_info.clear_required != page_control_info.clear_required)
10711 page_display_info.clear_required = page_control_info.clear_required;
10713 page_display_info.clear_set = !page_display_info.clear_set;
10716 if (page_display_copy.clear_set != page_display_info.clear_set)
10718 page_display_copy.clear_set = page_display_info.clear_set;
10720 if (page_display_copy.clear_set == TRUE)
10722 page_display_copy.render_required = TRUE;
10723 page_display_copy.clear_screen = TRUE;
10727 if (page_display_info.page_number)
10729 page_display_info.page_updated = TRUE;
10734 override_header_backcolor = FALSE;
10735 if (show_header_row)
10739 if (page_display_info.carousel_page_updated == TRUE)
10741 page_display_copy.carousel_page_number = page_display_info.carousel_page_number;
10743 memcpy(&page_display_copy.carousel_page_header, &page_display_info.carousel_page_header, MAX_COLUMN);
10745 page_display_info.carousel_page_updated = FALSE;
10749 DecodeTeletextCarouselHeader(&page_display_copy);
10751 override_header_backcolor = TRUE;
10752 enforce_header_display = TRUE;
10762 if (page_display_info.page_updated == TRUE)
10764 page_display_copy.page_number = page_display_info.page_number;
10765 page_display_copy.page_sub_code = page_display_info.page_sub_code;
10767 memcpy(&page_display_copy.page_source, &page_display_info.page_source,
sizeof(
S_MAGAZINE_PAGE));
10768 memcpy(&page_display_copy.mgzn_data, &page_display_info.mgzn_data,
sizeof(
S_SPECIFIC_DATA));
10770 page_display_copy.page_clock_valid = page_display_info.page_clock_valid;
10772 page_display_info.page_updated = FALSE;
10776 page_display_copy.flash_set = TRUE;
10777 page_display_copy.flash_required = FALSE;
10779 page_display_copy.reveal_available = FALSE;
10781 DecodeTeletextPageBody(&page_display_copy, enforce_header_display);
10783 override_header_backcolor = FALSE;
10792 if (page_display_info.page_index_updated == TRUE)
10794 memcpy(&page_display_copy.page_index_digit, &page_display_info.page_index_digit,
10795 sizeof(E_PAGE_INDEX_DIGIT) * 3);
10797 page_display_copy.page_index_held = page_display_info.page_index_held;
10799 page_display_info.page_index_updated = FALSE;
10803 if (show_header_row)
10805 if ((override_header_backcolor == TRUE) ||
10806 (page_control_info.state == PAGE_CONTROL_STATE_INPUT))
10808 DecodeTeletextPageNumber(&page_display_copy, TRUE);
10812 DecodeTeletextPageNumber(&page_display_copy, FALSE);
10823 if (page_display_info.clock_updated == TRUE)
10825 memcpy(&page_display_copy.time_filler_header_data, &page_display_info.time_filler_header_data, 32);
10827 page_display_info.clock_updated = FALSE;
10831 DecodeTeletextClock(&page_display_copy, override_header_backcolor);
10840 if (page_display_info.page_scale_params_defined == FALSE)
10842 page_display_copy.page_scale_zoom_scalar = 1;
10843 page_display_copy.page_scale_start_row = 0;
10844 page_display_copy.page_scale_num_rows = MAX_ROWS;
10848 page_display_copy.page_scale_zoom_scalar = page_display_info.page_scale_zoom_scalar;
10849 page_display_copy.page_scale_start_row = page_display_info.page_scale_start_row;
10850 page_display_copy.page_scale_num_rows = page_display_info.page_scale_num_rows;
10853 if (page_display_info.page_rescaled == TRUE)
10855 page_display_info.page_rescaled = FALSE;
10859 for (row_index = page_display_copy.page_scale_start_row;
10860 row_index < (page_display_copy.page_scale_start_row + page_display_copy.page_scale_num_rows);
10863 page_display_copy.render_row[row_index] = page_display_copy.valid_row[row_index];
10866 page_display_copy.render_required = TRUE;
10867 page_display_copy.clear_screen = TRUE;
10874 if (page_display_copy.flash_required == TRUE)
10877 if (flash_counter == 3)
10879 page_display_copy.flash_set = !page_display_copy.flash_set;
10880 page_display_copy.palette_update_required = TRUE;
10886 if (page_display_copy.reveal_available == TRUE)
10888 if (page_display_info.reveal_required != page_control_info.reveal_required)
10890 page_display_info.reveal_required = page_control_info.reveal_required;
10892 page_display_info.reveal_set = !page_display_info.reveal_set;
10895 if (page_display_copy.reveal_set != page_display_info.reveal_set)
10897 page_display_copy.reveal_set = page_display_info.reveal_set;
10899 page_display_copy.palette_update_required = TRUE;
10903 page_display_copy.pts_valid = page_display_info.pts_valid;
10904 if (page_display_copy.pts_valid)
10906 memcpy(page_display_copy.page_pts, page_display_info.page_pts, 5);
10909 if (page_display_copy.render_required)
10914 RenderDisplay(&page_display_copy);
10917 FUNCTION_FINISH(PerformDisplayUpdate);
10920 static BOOLEAN InitialiseDisplay(
void)
10923 U16BIT ch_width, ch_height;
10926 FUNCTION_START(InitialiseDisplay);
10929 ch_width = (U16BIT)ebutt_font_ptr->character_width;
10930 ch_height = (U16BIT)ebutt_font_ptr->character_height;
10934 if (ttxt_osd_region != NULL)
10938 display_margin_left = (SD_WIDTH - (ch_width * display_x_scalar * MAX_COLUMN)) / 2;
10939 display_margin_top = (SD_HEIGHT - (ch_height * display_y_scalar * MAX_ROWS)) / 2;
10944 display_char_buffer_size = ch_width * ch_height * display_x_scalar * display_y_scalar *
10945 MAX_DISPLAY_ZOOM_SCALAR * 2;
10947 if (display_char_buffer != NULL)
10951 display_char_buffer = NULL;
10959 display_char_buffer_origin = (U8BIT *)
STB_GetMemory(display_char_buffer_size + 6);
10960 if (display_char_buffer_origin != NULL)
10962 display_char_buffer = display_char_buffer_origin + 6;
10964 diacritic_substitutions_avaialable = FALSE;
10971 bitmap_ptr = ebutt_font_ptr->font_table_set_ptr[FONT_INDEX_G1_BLOCK_MOSAICS_SET];
10973 if (bitmap_ptr != NULL)
10975 bitmap_ptr += ch_width * ch_height * 0x20;
10977 memset(display_char_buffer, 0, display_char_buffer_size);
10979 if (memcmp(bitmap_ptr, display_char_buffer, ch_width * ch_height))
10981 diacritic_substitutions_avaialable = TRUE;
10988 FUNCTION_FINISH(InitialiseDisplay);
11008 static void DisplayUpdateTask(
void *unwanted_ptr)
11010 FUNCTION_START(DisplayUpdateTask);
11012 USE_UNWANTED_PARAM(unwanted_ptr);
11014 if (InitialiseDisplay())
11021 if ((subtitle_timeout != 0) && (
STB_OSGetClockDiff(subtitle_timeout) > SUBTITLE_TIMEOUT))
11031 PerformDisplayUpdate();
11039 FUNCTION_FINISH(DisplayUpdateTask);
11069 if (is_initialised == FALSE)
11071 if (InitialiseCollation() == TRUE)
11073 if (InitialiseDisplayTask() == TRUE)
11075 pes_collection_callback_handle =
11077 if (pes_collection_callback_handle)
11079 is_initialised = TRUE;
11097 if ((collation_start != NULL) && (collation_stopped != NULL) && (collation_queue != NULL))
11103 stop_collation = FALSE;
11105 max_queue_count = 0;
11106 collation_started = FALSE;
11108 STB_OSCreateTask(PESCollationTask, NULL, DISPLAY_TASK_STACK_SIZE, DISPLAY_TASK_PRIORITY,
11109 (U8BIT *)
"EBUTT_Collate");
11136 if (is_initialised == TRUE)
11139 STB_EBUTT_Stop(path, TRUE);
11143 if (display_char_buffer != NULL)
11147 display_char_buffer = NULL;
11150 is_initialised = FALSE;
11172 if ((data_ptr != NULL) && (data_length > 5))
11177 while (retval && (data_length > 5))
11180 pes_size = (*(data_ptr + 4) << 8) + *(data_ptr + 5) + 6;
11182 if (data_length >= pes_size)
11185 retval = AddPESDataToQueue(data_ptr, pes_size);
11187 data_length -= pes_size;
11188 data_ptr += pes_size;
11226 if (is_initialised == TRUE)
11232 page_request_info.type = REQUEST_TYPE_EXPLICIT;
11236 page_request_info.page_number = 0x800 + page;
11240 page_request_info.page_number = (magazine << 8) + page;
11243 page_request_info.page_sub_code = PAGE_SUB_CODE_UNDEFINED;
11245 page_request_info.pending = TRUE;
11249 teletext_path = path;
11250 broadcast_index_page_invocation_required = TRUE;
11251 show_header_row = FALSE;
11252 subtitle_timeout = 0;
11253 stop_teletext = FALSE;
11255 stream_processing_enabled = TRUE;
11257 stop_collation = FALSE;
11266 void STB_EBUTT_Stop(U8BIT path, BOOLEAN reset_cache)
11270 FUNCTION_START(STB_EBUTT_Stop);
11272 if (is_initialised == TRUE)
11274 stop_teletext = TRUE;
11278 stream_processing_enabled = FALSE;
11284 if (!stop_collation && collation_started)
11287 stop_collation = TRUE;
11291 queue_item.data = NULL;
11292 if (
STB_OSWriteQueue(collation_queue, &queue_item,
sizeof(queue_item), TIMEOUT_NOW))
11308 max_queue_count = 0;
11311 while (
STB_OSReadQueue(collation_queue, &queue_item,
sizeof(queue_item), TIMEOUT_NOW))
11313 if (queue_item.data != NULL)
11319 if (is_shown == TRUE && is_initialised == TRUE)
11328 FUNCTION_FINISH(STB_EBUTT_Stop);
11357 BOOLEAN navigate_to_index_page, BOOLEAN show_header)
11365 if ((is_initialised == TRUE) &&
11366 (is_shown == FALSE))
11368 broadcast_index_page_invocation_required = navigate_to_index_page;
11369 show_header_row = show_header;
11371 default_character_set_mapping = (U8BIT)character_set_designation;
11373 page_control_info.video_mix_required = FALSE;
11374 page_control_info.clear_required = FALSE;
11378 palette_reset_required = TRUE;
11381 is_visible = FALSE;
11382 stop_teletext = FALSE;
11407 if ((is_initialised == TRUE) &&
11408 (is_shown == TRUE))
11410 stop_teletext = TRUE;
11420 is_visible = FALSE;
11447 switch (ebutt_caching_method)
11449 case EBUTT_CACHING_METHOD_PREVIOUS_NEXT:
11454 history_cache_reset_requested = TRUE;
11456 caching_method = EBUTT_CACHING_METHOD_PREVIOUS_NEXT;
11460 case EBUTT_CACHING_METHOD_HISTORY:
11466 editorial_link_cache_reset_requested = TRUE;
11468 caching_method = EBUTT_CACHING_METHOD_HISTORY;
11472 case EBUTT_CACHING_METHOD_NAVIGATION:
11478 editorial_link_cache_reset_requested = TRUE;
11480 caching_method = EBUTT_CACHING_METHOD_NAVIGATION;
11484 case EBUTT_CACHING_METHOD_NAVIGATION_TREE:
11491 caching_method = EBUTT_CACHING_METHOD_NAVIGATION_TREE;
11495 case EBUTT_CACHING_METHOD_ALL:
11499 caching_method = EBUTT_CACHING_METHOD_ALL;
11507 history_cache_reset_requested = TRUE;
11508 editorial_link_cache_reset_requested = TRUE;
11510 caching_method = EBUTT_CACHING_METHOD_NONE;
11533 U16BIT page_number, index;
11534 BOOLEAN reset_state;
11538 if (is_initialised == TRUE)
11540 reset_state = TRUE;
11542 switch (event_type)
11546 case EBUTT_EVENT_QUICK_NAVIGATE_1:
11547 case EBUTT_EVENT_QUICK_NAVIGATE_2:
11548 case EBUTT_EVENT_QUICK_NAVIGATE_3:
11549 case EBUTT_EVENT_QUICK_NAVIGATE_4:
11551 RequestEditorialLinkPage((U16BIT)(event_type - EBUTT_EVENT_QUICK_NAVIGATE_1));
11555 case EBUTT_EVENT_0:
11556 case EBUTT_EVENT_1:
11557 case EBUTT_EVENT_2:
11558 case EBUTT_EVENT_3:
11559 case EBUTT_EVENT_4:
11560 case EBUTT_EVENT_5:
11561 case EBUTT_EVENT_6:
11562 case EBUTT_EVENT_7:
11563 case EBUTT_EVENT_8:
11564 case EBUTT_EVENT_9:
11566 if (page_control_info.state != PAGE_CONTROL_STATE_INPUT)
11568 if ((event_type != EBUTT_EVENT_0) &&
11569 (event_type != EBUTT_EVENT_9))
11571 page_control_info.page_digit[0] = (U8BIT)(event_type - EBUTT_EVENT_0);
11572 page_control_info.page_digit_offset = 1;
11576 page_display_info.page_index_digit[0] = page_control_info.page_digit[0] +
11577 PAGE_INDEX_DIGIT_0;
11578 page_display_info.page_index_digit[1] = PAGE_INDEX_DIGIT_UNDEFINED;
11579 page_display_info.page_index_digit[2] = PAGE_INDEX_DIGIT_UNDEFINED;
11581 page_display_info.page_index_updated = TRUE;
11582 page_display_info.page_index_held = FALSE;
11584 page_control_info.state = PAGE_CONTROL_STATE_INPUT;
11588 reset_state = FALSE;
11593 page_control_info.page_digit[page_control_info.page_digit_offset] =
11594 (U8BIT)(event_type - EBUTT_EVENT_0);
11598 page_display_info.page_index_digit[page_control_info.page_digit_offset] =
11599 page_control_info.page_digit[page_control_info.page_digit_offset] +
11600 PAGE_INDEX_DIGIT_0;
11602 page_display_info.page_index_updated = TRUE;
11604 page_control_info.page_digit_offset++;
11606 if (page_control_info.page_digit_offset == 3)
11608 page_control_info.state = PAGE_CONTROL_STATE_IDLE;
11610 for (index = 0, page_number = 0; index < 3; index++)
11613 page_number += (U16BIT)page_control_info.page_digit[index];
11616 RequestPage(page_number, PAGE_SUB_CODE_UNDEFINED);
11620 reset_state = FALSE;
11630 case EBUTT_EVENT_INDEXPAGE:
11632 RequestIndexPage();
11636 case EBUTT_EVENT_NEXTPAGE:
11638 RequestNextAvailablePage();
11641 case EBUTT_EVENT_PREVIOUSPAGE:
11643 RequestPreviousAvailablePage();
11647 case EBUTT_EVENT_NEXTSUBPAGE:
11649 if (page_control_info.state == PAGE_CONTROL_STATE_HOLD)
11651 RequestNextSubPage();
11653 reset_state = FALSE;
11657 case EBUTT_EVENT_PREVIOUSSUBPAGE:
11659 if (page_control_info.state == PAGE_CONTROL_STATE_HOLD)
11661 RequestPreviousSubPage();
11663 reset_state = FALSE;
11668 case EBUTT_EVENT_BACKPAGE:
11670 RequestPreviousVisitedPage();
11673 case EBUTT_EVENT_FORWARDPAGE:
11675 RequestNextVisitedPage();
11679 case EBUTT_EVENT_HOLD:
11681 if (page_control_info.clear_required == FALSE)
11683 if (page_control_info.state == PAGE_CONTROL_STATE_HOLD)
11685 page_control_info.state = PAGE_CONTROL_STATE_IDLE;
11689 page_request_info.target_page_sub_code = PAGE_SUB_CODE_UNDEFINED;
11691 page_request_info.pending = FALSE;
11697 page_number = page_display_info.page_number;
11698 if (page_number == 0)
11700 page_number = page_request_info.target_page_number;
11703 page_display_info.page_index_digit[0] =
11704 ((page_number & 0x0f00) >> 8) + PAGE_INDEX_DIGIT_0;
11705 page_display_info.page_index_digit[1] =
11706 ((page_number & 0x00f0) >> 4) + PAGE_INDEX_DIGIT_0;
11707 page_display_info.page_index_digit[2] =
11708 (page_number & 0x000f) + PAGE_INDEX_DIGIT_0;
11710 page_display_info.page_index_updated = TRUE;
11711 page_display_info.page_index_held = FALSE;
11717 page_control_info.state = PAGE_CONTROL_STATE_HOLD;
11722 page_request_info.type = REQUEST_TYPE_CANCEL;
11724 page_request_info.pending = TRUE;
11733 page_display_info.page_index_updated = TRUE;
11734 page_display_info.page_index_held = TRUE;
11740 reset_state = FALSE;
11745 case EBUTT_EVENT_REVEAL:
11747 page_control_info.reveal_required = !page_control_info.reveal_required;
11748 reset_state = FALSE;
11752 case EBUTT_EVENT_CLEAR:
11754 page_control_info.clear_required = !page_control_info.clear_required;
11756 if (page_control_info.state == PAGE_CONTROL_STATE_HOLD)
11758 page_control_info.state = PAGE_CONTROL_STATE_IDLE;
11762 page_request_info.target_page_sub_code = PAGE_SUB_CODE_UNDEFINED;
11764 page_request_info.pending = FALSE;
11770 page_display_info.page_index_updated = TRUE;
11771 page_display_info.page_index_held = FALSE;
11776 reset_state = FALSE;
11780 case EBUTT_EVENT_MIX_VIDEO:
11782 page_control_info.video_mix_required = !page_control_info.video_mix_required;
11783 reset_state = FALSE;
11787 case EBUTT_EVENT_DOUBLE_HEIGHT:
11789 if (page_display_info.page_scale_params_defined == FALSE)
11792 page_display_info.page_scale_status = PAGE_SCALE_STATUS_ZOOM_TOP;
11793 page_display_info.page_scale_start_row = 0;
11794 page_display_info.page_scale_num_rows = 13;
11795 page_display_info.page_scale_zoom_scalar = 2;
11796 page_display_info.page_rescaled = TRUE;
11799 page_display_info.page_scale_params_defined = TRUE;
11804 switch (page_display_info.page_scale_status)
11806 case PAGE_SCALE_STATUS_NORMAL:
11808 page_display_info.page_scale_status = PAGE_SCALE_STATUS_ZOOM_TOP;
11809 page_display_info.page_scale_start_row = 0;
11810 page_display_info.page_scale_num_rows = 13;
11811 page_display_info.page_scale_zoom_scalar = 2;
11812 page_display_info.page_rescaled = TRUE;
11815 case PAGE_SCALE_STATUS_ZOOM_TOP:
11817 if (page_display_info.page_scale_start_row == 0)
11819 page_display_info.page_scale_status = PAGE_SCALE_STATUS_ZOOM_BOTTOM;
11820 page_display_info.page_scale_start_row = 13;
11821 page_display_info.page_scale_num_rows = 12;
11822 page_display_info.page_scale_zoom_scalar = 2;
11823 page_display_info.page_rescaled = TRUE;
11827 page_display_info.page_scale_status = PAGE_SCALE_STATUS_NORMAL;
11828 page_display_info.page_scale_start_row = 0;
11829 page_display_info.page_scale_num_rows = MAX_ROWS;
11830 page_display_info.page_scale_zoom_scalar = 1;
11831 page_display_info.page_rescaled = TRUE;
11835 case PAGE_SCALE_STATUS_ZOOM_BOTTOM:
11837 page_display_info.page_scale_status = PAGE_SCALE_STATUS_NORMAL;
11838 page_display_info.page_scale_start_row = 0;
11839 page_display_info.page_scale_num_rows = MAX_ROWS;
11840 page_display_info.page_scale_zoom_scalar = 1;
11841 page_display_info.page_rescaled = TRUE;
11848 reset_state = FALSE;
11852 case EBUTT_EVENT_DOUBLE_SCROLL_UP:
11854 if (page_display_info.page_scale_params_defined == FALSE)
11857 page_display_info.page_scale_status = PAGE_SCALE_STATUS_NORMAL;
11858 page_display_info.page_scale_start_row = 0;
11859 page_display_info.page_scale_num_rows = MAX_ROWS;
11860 page_display_info.page_scale_zoom_scalar = 1;
11861 page_display_info.page_rescaled = FALSE;
11864 page_display_info.page_scale_params_defined = TRUE;
11869 switch (page_display_info.page_scale_status)
11871 case PAGE_SCALE_STATUS_NORMAL:
11875 case PAGE_SCALE_STATUS_ZOOM_TOP:
11876 case PAGE_SCALE_STATUS_ZOOM_BOTTOM:
11878 if (page_display_info.page_scale_start_row > 0)
11880 page_display_info.page_scale_start_row--;
11881 page_display_info.page_rescaled = TRUE;
11889 reset_state = FALSE;
11892 case EBUTT_EVENT_DOUBLE_SCROLL_DOWN:
11894 if (page_display_info.page_scale_params_defined == FALSE)
11897 page_display_info.page_scale_status = PAGE_SCALE_STATUS_NORMAL;
11898 page_display_info.page_scale_start_row = 0;
11899 page_display_info.page_scale_num_rows = MAX_ROWS;
11900 page_display_info.page_scale_zoom_scalar = 1;
11901 page_display_info.page_rescaled = FALSE;
11904 page_display_info.page_scale_params_defined = TRUE;
11909 switch (page_display_info.page_scale_status)
11911 case PAGE_SCALE_STATUS_NORMAL:
11915 case PAGE_SCALE_STATUS_ZOOM_TOP:
11916 case PAGE_SCALE_STATUS_ZOOM_BOTTOM:
11918 if ((page_display_info.page_scale_start_row +
11919 page_display_info.page_scale_num_rows) < MAX_ROWS)
11921 page_display_info.page_scale_start_row++;
11922 page_display_info.page_rescaled = TRUE;
11930 reset_state = FALSE;
11934 case EBUTT_EVENT_TIMER:
11936 reset_state = FALSE;
11941 if (reset_state == TRUE)
11943 page_control_info.state = PAGE_CONTROL_STATE_IDLE;
11948 page_display_info.page_index_updated = TRUE;
11949 page_display_info.page_index_held = FALSE;
11996 if (gun_intensity < 127)
11998 current_gun_intensity = 127;
12002 current_gun_intensity = gun_intensity;
12023 if (current_gun_intensity <= 247)
12025 current_gun_intensity += 8;
12031 void STB_EBUTT_DecreaseDisplayBrightness(
void)
12033 FUNCTION_START(STB_EBUTT_DecreaseDisplayBrightness);
12035 if (current_gun_intensity >= 135)
12037 current_gun_intensity -= 8;
12040 FUNCTION_FINISH(STB_EBUTT_DecreaseDisplayBrightness);
12060 if (antialias_level > 8)
12062 current_antialias_level = 8;
12066 current_antialias_level = antialias_level;
12087 if (current_antialias_level < 8)
12089 current_antialias_level++;
12095 void STB_EBUTT_DecreaseDisplayAntiAliasing(
void)
12097 FUNCTION_START(STB_EBUTT_DecreaseDisplayAntiAliasing);
12099 if (current_antialias_level > 0)
12101 current_antialias_level--;
12104 FUNCTION_FINISH(STB_EBUTT_DecreaseDisplayAntiAliasing);
12123 if (transparency_level < 31)
12125 current_transparency_level = 31;
12129 current_transparency_level = ((transparency_level - 31) & 0xf8) + 31;
12150 if (current_transparency_level < 248)
12152 current_transparency_level += 8;
12156 current_transparency_level = 255;
12162 void STB_EBUTT_DecreaseDisplayMixTransparency(
void)
12164 FUNCTION_START(STB_EBUTT_DecreaseDisplayMixTransparency);
12166 if (current_transparency_level > 38)
12168 current_transparency_level -= 8;
12172 current_transparency_level = 31;
12175 FUNCTION_FINISH(STB_EBUTT_DecreaseDisplayMixTransparency);
12197 if (page_control_info.state == PAGE_CONTROL_STATE_HOLD)
12230 if (page_display_info.page_scale_status == PAGE_SCALE_STATUS_NORMAL)
BOOLEAN STB_EBUTT_Initialise(void)
This must be called to invoke the EBU TeleText driver module before all other functionality can be ac...
void STB_EBUTT_SetDisplayAntiAliasing(U8BIT antialias_level)
Called to adjust the display anti-aliasing level of the Teletext pages. This is used to control 'flic...
void * STB_GetMemory(U32BIT bytes)
Attempts to allocate memory from the heap.
void STB_EBUTT_SetDisplayMixTransparency(U8BIT transparency_level)
Called to adjust the display video-mix transparency level of the Teletext pages.
BOOLEAN STB_EBUTT_IsDisplayDoubleHeight(void)
Called to ascertain whether the present page is in 'double height' mode or not. Thus function is usef...
U32BIT STB_OSGetClockDiff(U32BIT timestamp)
Get Difference between Given Time and Current Time.
Header file - macros and function prototypes for public use.
void * STB_OSCreateSemaphore(void)
Create a Semaphore.
void STB_EBUTT_IncreaseDisplayBrightness(void)
Called to adjust the display brightness (colour intensity) of the Teletext pages. ...
void STB_OSDUpdateRegions(void)
Updates the display of all subtitle regions.
Header file - Function prototypes for OSD control.
void STB_EBUTT_IncreaseDisplayAntiAliasing(void)
Called to adjust the display anti-aliasing level of the Teletext pages.
BOOLEAN STB_EBUTT_Show(E_EBUTT_CHARACTER_SET_DESIGNATION character_set_designation, BOOLEAN navigate_to_index_page, BOOLEAN show_header)
Called to initiate continuous display of TeleText page content. This will result in either the index ...
void STB_AVGetSTC(U8BIT path, U8BIT stc[5])
Returns the current 33-bit System Time Clock from the PCR PES. On some systems, this information may ...
U8BIT STB_DPGetPathVideoDecoder(U8BIT path)
Returns the video decoder ID acquired by the given decode path.
void STB_OSDFillRegion(void *handle, U8BIT colour)
Fill a region with a colour.
BOOLEAN STB_OSSemaphoreWaitTimeout(void *semaphore, U16BIT timeout)
Wait on Semaphore for Set Time Period in an Attempt to Acquire.
Header file - Function prototypes for A/V control.
void STB_EBUTT_Hide(void)
Called to halt the continuous display of TeleText page content, and to clear the relevant area of the...
void STB_EBUTT_Kill(U8BIT path)
This is the accompanying function to STB_EBUTT_Initialise( ), and is called to shut-down the EBU Tele...
void STB_OSSemaphoreSignal(void *semaphore)
Signal a Semaphore to Release it by decrementing its counter.
void STB_ChangePesCollectionPID(U8BIT path, U16BIT text_pid)
Changes the PID that the DMX is using to gather data on.
void STB_OSDSetRGBPalette(void *handle, U32BIT *trgb)
Sets the RGB palette for the given region. This function is used for Teletext.
BOOLEAN STB_OSDDisableUIRegion(void)
Disables (makes invisible) the OSD. This function needs to be implemented on platforms that cannot di...
U32BIT STB_RegisterPesCollectionCallback(void(*callback_function)(U32BIT, U8BIT, void *, U32BIT), U8BIT lowest_data_identifier, U8BIT highest_data_identifier)
Used to register a callback function that will receive specific PES data packets. In theory...
void STB_OSDestroyTask(void *task)
Delete Task must be called upon termination of each task as it frees all OS specific resources alloca...
void STB_OSMutexUnlock(void *mutex)
Unlock a mutex (a.k.a. 'leave', 'signal' or 'release')
void STB_OSSemaphoreWait(void *semaphore)
Wait on Semaphore Indefinity or Until Released.
void STB_OSDShowRegion(void *handle)
Makes a region visible.
void STB_EBUTT_SetCacheMethod(E_EBUTT_CACHING_METHOD ebutt_caching_method)
Called to define the strategy used to determine what page content is to be displayed form the TeleTex...
void STB_OSDDrawBitmapInRegion(void *handle, U16BIT x, U16BIT y, U16BIT w, U16BIT h, U8BIT *bitmap, BOOLEAN non_modifying_colour)
Draw a bitmap in a specified region.
void STB_FreeMemory(void *addr)
Releases previously allocated heap memory.
BOOLEAN STB_EBUTT_InjectData(U8BIT *data_ptr, U32BIT data_length)
Allows teletext PES data packets to be injected by an external module, which will be decoded and disp...
Header file - EBU Teletext driver.
U8BIT STB_MEMSysRAMUsed(void)
Returns the amount of available system memory consumed.
Debug functions header file.
void STB_OSMutexLock(void *mutex)
Lock a mutex (a.k.a. 'enter', 'wait' or 'get').
BOOLEAN PerformPESCollation(U8BIT *packet_ptr, BOOLEAN pts_valid, U8BIT *pts)
This process is called to service the queue populated with Teletext packets by the PES collectiom cal...
Header file - Function prototypes for NVM and Heap.
BOOLEAN STB_OSWriteQueue(void *queue, void *msg, U16BIT msg_size, U16BIT timeout)
Write a message to the queue.
Header file - Function prototypes for operating system.
System Wide Global Technical Data Type Definitions.
void STB_EBUTT_NotifyEvent(E_EBUTT_EVENT event_type)
Called whenever a TeleText-specific event being invoked. This is used to pass relevant user input to ...
void * STB_OSDCreateRegion(U16BIT width, U16BIT height, U8BIT depth)
Creates a new OSD region (for subtitling)
void * STB_OSCreateTask(void(*function)(void *), void *param, U32BIT stack, U8BIT priority, U8BIT *name)
Create a New Task to the calling process. Upon success, the created task runs on its own stack...
void * STB_OSCreateQueue(U16BIT msg_size, U16BIT msg_max)
Create Queue of given number of messages and size of message.
void STB_OSDSetRegionDisplaySize(U16BIT width, U16BIT height)
Should be called to set the size of the display so that SD subtitles can be scaled correctly for an H...
Header file - Function prototypes for heap memory.
void STB_EBUTT_SetDisplayBrightness(U8BIT gun_intensity)
Called to adjust the display brightness (colour intensity) of the Teletext pages. ...
void * STB_OSCreateMutex(void)
Create a mutex.
void STB_EBUTT_Start(U8BIT path, U16BIT text_pid, U8BIT magazine, U8BIT page)
These functions are called to control whether received TeleText data is processed. Using this functionality ensures that the process of collating page information can be halted when processing resources are a consideration. It is envisaged that some implementations may wish only to collate TeleText content only when the display is being shown, whilst other designs may which to cache significant page content as a background process. Abstracting this functionality from the initialisation routines gives the option to support both solution types.
void STB_OSDHideRegion(void *handle)
Makes a region invisible.
BOOLEAN STB_OSReadQueue(void *queue, void *msg, U16BIT msg_size, U16BIT timeout)
Read a message from a queue.
void STB_OSDRegionFillRect(void *handle, U16BIT left, U16BIT top, U16BIT width, U16BIT height, U8BIT colour)
Fill the rectangle within the given region with the given colour.
void STB_UnregisterPesCollectionCallback(U32BIT handle)
Used to un-register a callback function that will receive specific PES data packets.
void STB_OSTaskDelay(U16BIT timeout)
Delay Task for Specifed Time Period.
Header file - Function prototypes for PES collection task.
BOOLEAN STB_OSDEnableUIRegion(void)
Disables (makes invisible) the OSD. This function needs to be implemented on platforms that cannot di...
void STB_EBUTT_NotifyServiceChange(void)
Called whenever the application permits a TV/Radio service change during a TeleText display session...
U32BIT STB_OSGetClockMilliseconds(void)
Get Current Computer Clock Time.
BOOLEAN STB_EBUTT_IsDisplayHeld(void)
Called to ascertain whether the present page is in 'hold' mode or not. Thus function is useful when a...
void STB_EBUTT_IncreaseDisplayMixTransparency(void)
Called to adjust the display video-mix transparency level of the Teletext pages.