/******************************************************************** * * PSI_AtscPsip.h - ATSC A/65 Program and System Information Protocol (PSIP). * * Copyright 2004~ TeraLogic, Inc. * All Rights Reserved * * _Id: PSI_AtscPsip.h ,v 1.0 2004/015/28 jina Exp ********************************************************************/ #ifndef DST_ATSC_PSIP_H #define DST_ATSC_PSIP_H #ifdef __cplusplus extern "C" { #endif #ifndef DST_PSI_PROCESS_H #include "dsthalPsiProcess.h" #endif #ifndef _DSTHALERROR_H_ #include "dsthalerror.h" #endif /* definitions */ #define PSIP_PROTOCOL_VERSION 0x00 #define PSIP_BASE_PID 0x1FFB #define MAX_SECTION_LENGTH 4093 #define CEA_PROTOCOL_VERSION 0x00 /*============================================================================== ATSC Stream Types ==============================================================================*/ typedef enum { atsc_a53_audio = 0x81, atsc_program_identifier = 0x85 } ATSC_stream_type_k; /*============================================================================== ATSC Format Identifiers (for registration_descriptor) ==============================================================================*/ typedef enum { atsc_format_identifier = 0x47413934, ac3_format_identifier = 0x41432D33 } ATSC_format_identifier_k; /*============================================================================== Multiple String Structure ==============================================================================*/ /* Multiple String Structure */ typedef enum { cm_None = 0x00, cm_Huffman_C4C5 = 0x01, cm_Huffman_C6C7 = 0x02 } compress_type_k; typedef enum { tm_ISO10646_1_Page_0x00 = 0x00, tm_ISO10646_1_Page_0x01 = 0x01, tm_ISO10646_1_Page_0x02 = 0x02, tm_ISO10646_1_Page_0x03 = 0x03, tm_ISO10646_1_Page_0x04 = 0x04, tm_ISO10646_1_Page_0x05 = 0x05, tm_ISO10646_1_Page_0x06 = 0x06, /* 0x07-0x08 Reserved */ tm_ISO10646_1_Page_0x09 = 0x09, tm_ISO10646_1_Page_0x0A = 0x0A, tm_ISO10646_1_Page_0x0B = 0x0B, tm_ISO10646_1_Page_0x0C = 0x0C, tm_ISO10646_1_Page_0x0D = 0x0D, tm_ISO10646_1_Page_0x0E = 0x0E, /* 0x0F Reserved */ tm_ISO10646_1_Page_0x10 = 0x10, /* 0x11-0x1F Reserved */ tm_ISO10646_1_Page_0x20 = 0x20, tm_ISO10646_1_Page_0x21 = 0x21, tm_ISO10646_1_Page_0x22 = 0x22, tm_ISO10646_1_Page_0x23 = 0x23, tm_ISO10646_1_Page_0x24 = 0x24, tm_ISO10646_1_Page_0x25 = 0x25, tm_ISO10646_1_Page_0x26 = 0x26, tm_ISO10646_1_Page_0x27 = 0x27, /* 0x28-0x2F Reserved */ tm_ISO10646_1_Page_0x30 = 0x30, tm_ISO10646_1_Page_0x31 = 0x31, tm_ISO10646_1_Page_0x32 = 0x32, tm_ISO10646_1_Page_0x33 = 0x33, /* 0x34-0x3E Reserved */ tm_ISO10646_1_16_bit = 0x3F, /* 0x40-0xDF Reserved */ /* 0xE0-0xFE Private */ tm_Not_applicable = 0xFF } text_mode_k; typedef struct msSegment { compress_type_k compression_type; text_mode_k mode; DS_U8 number_bytes; DS_U8* compress_string_byte; } msSegment_t, *msSegmentPtr_t; typedef struct msString { DS_U32 ISO639_language_code; DS_U8 number_segments; msSegmentPtr_t segment; /* array of size 'number_segments' */ } msString_t, *msStringPtr_t; typedef struct multipleString { DS_U8 number_strings; msStringPtr_t msString; /* array of size 'number_strings' */ } multipleString_t, *multipleStringPtr_t; /*============================================================================== PSIP Table IDs ==============================================================================*/ typedef enum { tid_master_guide_table = 0xC7, tid_terr_virtual_chan_table = 0xC8, tid_cable_virtual_chan_table = 0xC9, tid_rating_region_table = 0xCA, tid_event_information_table = 0xCB, tid_extended_text_table = 0xCC, tid_system_time_table = 0xCD, tid_directed_channel_change_table = 0xD3, tid_dcc_selection_code_table = 0xD4, tid_cable_emergency_alert = 0xD8, // DSMCC PID [Defined in MPEG13818-6, A/90] tid_dsmcc_download_info_indication = 0x3B, tid_dsmcc_download_server_initiate = 0x3B, tid_dsmcc_download_data_block = 0x3C } table_id_k; /*============================================================================== PSIP Tables ==============================================================================*/ /* System Time Table (STT) */ typedef struct daylightSavings { DS_U8 DS_status; DS_U8 DS_day_of_month; DS_U8 DS_hour; } daylightSavings_t, *daylightSavingsPtr_t; typedef struct sttSection { DS_U32 system_time; DS_U8 GPS_UTC_offset; daylightSavings_t daylight_savings; DS_U16 descriptor_length; DS_U8* descriptors; /* un-parsed descriptors */ } sttSection_t, *sttSectionPtr_t; typedef sttSection_t STT; /* Master Guide Table (MGT) */ typedef enum { tt_terrestrial_VCT_cni_1 = 0x0000, tt_terrestrial_VCT_cni_0 = 0x0001, tt_cable_VCT_cni_1 = 0x0002, /* same for LVCT in OOB */ tt_cable_VCT_cni_0 = 0x0003, /* same for LVCT in OOB */ tt_channel_ETT = 0x0004, /* 0x0005-0x00FF Reserved */ tt_SVCT_VCM = 0x0010, tt_SVCT_DCM = 0x0011, tt_SVCT_ICM = 0x0012, /* 0x0013 - 0x001F Reserved */ tt_NIT_CDS = 0x0020, tt_NIT_MMS = 0x0021, /* 0x0022 - 0x002F reserved */ tt_NTT_SNS = 0x0030, /* 0x0031 - 0x00FF reserved */ tt_EIT_min = 0x0100, tt_EIT_max = 0x017F, /* 0x0180-0x01FF Reserved */ tt_event_ETT_min = 0x0200, tt_event_ETT_max = 0x027F, /* 0x0280-0x0300 Reserved */ tt_RRT_region_1 = 0x0301, tt_RRT_region_255 = 0x03FF, /* 0x0400-0x0FFF User Private */ tt_AEIT_min = 0x1000, tt_AEIT_max = 0x10FF, tt_AETT_min = 0x1100, tt_AETT_max = 0x11FF /* 0x1200-0xFFFF Reserved */ } table_type_k; typedef struct mgtTable { table_type_k table_type; DS_U16 table_type_PID; DS_U8 table_type_version_number; DS_U32 number_bytes; DS_U16 descriptor_length; DS_U8* descriptors; /* un-parsed descriptors */ } mgtTable_t, *mgtTablePtr_t; typedef struct mgtSection { DS_U16 map_id; /* only used in OOB */ DS_U8 version_number; DS_U16 tables_defined; mgtTablePtr_t table; /* array of size 'tables_defined' */ DS_U16 descriptor_length; DS_U8* descriptors; /* un-parsed descriptors */ DS_U32 CRC32; } mgtSection_t, *mgtSectionPtr_t; typedef mgtSection_t MGT; /* Terrestrial Virtual Channel Table (TVCT) */ typedef enum { mm_analog = 0x01, mm_SCTE_mode_1 = 0x02, mm_SCTE_mode_2 = 0x03, mm_ATSC_8VSB = 0x04, mm_ATSC_16VSB = 0x05, /* 0x06-0x7F reserved */ mm_private_descriptor = 0x80 /* 0x81-0xFF private */ } modulation_mode_k; typedef enum { ETM_none = 0x00, ETM_in_this_PTC = 0x01, ETM_in_channel_TSID_PTC = 0x02 } ETM_location_k; typedef enum { /* 0x00 reserved */ st_analog_television = 0x01, st_ATSC_digital_television = 0x02, st_ATSC_audio_only = 0x03, st_ATSC_data_broadcast_service = 0x04 /* 0x05-0x3F reserved */ } service_type_k; typedef struct tvctChannel { DS_U16 short_name[7]; DS_U16 major_channel_number; DS_U16 minor_channel_number; modulation_mode_k modulation_mode; DS_U32 carrier_frequency; DS_U16 channel_TSID; DS_U16 program_number; ETM_location_k ETM_location; DS_BOOL access_controlled; DS_BOOL hidden; DS_BOOL show_guide; service_type_k service_type; DS_U16 source_id; DS_U16 descriptor_length; DS_U8* descriptors; /* un-parsed descriptors */ } tvctChannel_t, *tvctChannelPtr_t; typedef struct tvctSection { DS_U16 transport_stream_id; DS_U8 version_number; DS_U8 current_next_indicator; DS_U8 section_number; DS_U8 last_section_number; DS_U8 num_channels_in_section; tvctChannelPtr_t channel; DS_U16 additional_descriptor_length; DS_U8* additional_descriptors; /* un-parsed descriptors */ } tvctSection_t, *tvctSectionPtr_t; typedef struct tvct { DS_U16 transport_stream_id; DS_U8 version_number; DS_U8 numChannels; tvctChannelPtr_t channel; DS_U16 additional_descriptor_length; DS_U8* additional_descriptors; /* un-parsed descriptors */ } tvct_t, *tvctPtr_t; typedef tvct_t TVCT; /* Cable Virtual Channel Table (CVCT) */ typedef enum { ps_path1 = 0, ps_path2 = 1 } path_select_k; typedef struct cvctChannel { DS_U16 short_name[7]; DS_U16 major_channel_number; DS_U16 minor_channel_number; modulation_mode_k modulation_mode; DS_U32 carrier_frequency; DS_U16 channel_TSID; DS_U16 program_number; ETM_location_k ETM_location; DS_BOOL access_controlled; DS_BOOL hidden; path_select_k path_select; DS_BOOL out_of_band; DS_BOOL show_guide; service_type_k service_type; DS_U16 source_id; DS_U16 descriptor_length; DS_U8* descriptors; /* un-parsed descriptors */ } cvctChannel_t, *cvctChannelPtr_t; typedef struct cvctSection { DS_U16 transport_stream_id; DS_U8 version_number; DS_U8 current_next_indicator; DS_U8 section_number; DS_U8 last_section_number; DS_U8 num_channels_in_section; cvctChannelPtr_t channel; DS_U16 additional_descriptor_length; DS_U8* additional_descriptors; /* un-parsed descriptors */ } cvctSection_t, *cvctSectionPtr_t; typedef struct cvct { DS_U16 transport_stream_id; DS_U8 version_number; DS_U8 numChannels; cvctChannelPtr_t channel; DS_U16 additional_descriptor_length; DS_U8* additional_descriptors; /* un-parsed descriptors */ } cvct_t, *cvctPtr_t; typedef cvct_t CVCT; /* Rating Region Table (RRT) */ typedef enum { rr_Forbidden = 0x00, rr_United_States = 0x01 /* 0x02-0xFF reserved */ } rating_region_k; typedef struct rrtValue { DS_U16 abbrev_rating_value_length; DS_U8 *abbrev_rating_value; DS_U16 rating_value_length; DS_U8 *rating_value; } rrtValue_t, *rrtValuePtr_t; typedef struct rrtDimension { DS_U16 dimension_name_length; DS_U8 *dimension_name; DS_BOOL graduated_scale; DS_U8 values_defined; rrtValuePtr_t value; /* array of size 'values_defined' */ } rrtDimension_t, *rrtDimensionPtr_t; typedef struct rrtSection { rating_region_k rating_region; DS_U8 version_number; DS_U16 rating_region_name_length; DS_U8 *rating_region_name; DS_U8 dimensions_defined; rrtDimensionPtr_t dimension; /* array of size 'dimensions_defined' */ DS_U16 descriptor_length; DS_U8* descriptors; /* un-parsed descriptors */ } rrtSection_t, *rrtSectionPtr_t; typedef rrtSection_t RRT; /* Event Information Table (EIT) */ typedef struct eitEvent { DS_U16 event_id; DS_U32 start_time; ETM_location_k ETM_location; DS_U32 length_in_seconds; DS_U16 title_length; DS_U8 *title; DS_U16 descriptor_length; DS_U8* descriptors; /* un-parsed descriptors */ } eitEvent_t, *eitEventPtr_t; typedef struct eitSection { DS_U16 source_id; DS_U8 version_number; DS_U8 section_number; DS_U8 last_section_number; DS_U8 num_events_in_section; eitEventPtr_t event; /* array of size 'num_events_in_section' */ } eitSection_t, *eitSectionPtr_t; typedef struct eit { DS_U16 source_id; DS_U8 version_number; DS_U8 numEvents; eitEventPtr_t event; /* array of size 'numEvents' */ } eit_t, *eitPtr_t; typedef eit_t EIT; /* Extended Text Table (ETT) */ typedef struct ett { DS_U8 version_number; DS_U32 ETM_id; DS_U16 extended_text_message_length; DS_U8 *extended_text_message; } ettSection_t, *ettSectionPtr_t; typedef ettSection_t ETT; /* Directed Channel Change */ typedef struct dcctTerm { DS_U8 dcc_selection_type; DS_U64 dcc_selection_id; DS_U16 dcc_term_desc_length; DS_U8 *term_descriptor; }dcctTerm_t,*dcctTermPtr_t; typedef struct dcctTest { DS_U8 dcc_context; DS_U16 dcc_from_major_channel; DS_U16 dcc_from_minor_channel; DS_U16 dcc_to_major_channel; DS_U16 dcc_to_minor_channel; DS_U32 dcc_start_time; DS_U32 dcc_end_time; DS_U8 dcc_term_count; dcctTermPtr_t dcctTerm; DS_U16 dcc_test_desc_length; DS_U8 *test_descriptor; }dcctTest_t, *dcctTestPtr_t; typedef struct dcctSection { DS_U8 dcc_subtype; DS_U8 dcc_id; DS_U8 version_number; DS_U8 protocol_version; DS_U8 dcc_test_count; dcctTestPtr_t dcctTest; DS_U8 add_desc_length; DS_U8 *add_descriptor; }dcctSection_t, *dcctSectionPtr_t; typedef dcctSection_t DCCT; /* Directed Channel Change Selection Code Table */ typedef enum { reserved = 0x00, new_genre_category = 0x01, new_state = 0x02, new_county = 0x03 } dccsct_update_type ; typedef struct dccsctUpdate { DS_U8 updateType; DS_U8 updateDataLength; DS_U8 genre_cat_code; DS_U8 *genre_cat_name_text; DS_U8 dcc_state_locat_code; DS_U8 *dcc_state_locat_code_text; DS_U8 state_code; DS_U16 dcc_county_locat_code; DS_U8 *dcc_county_locat_code_text; DS_U16 dccsct_desc_length; DS_U8 *dccsct_desc; }dccsctUpdate_t,*dccsctUpdatePtr_t; typedef struct dccsctSection { DS_U8 dccsct_type; DS_U8 version_number; DS_U8 protocol_version; DS_U8 update_defined; dccsctUpdatePtr_t dccsctUpdate; DS_U8 add_desc_length; DS_U8 *add_desc; }dccsctSection_t, *dccsctSectionPtr_t; typedef dccsctSection_t DCCSCT; typedef enum alertPriority { AP_TestMessage, /*discarded by terminal devices*/ AP_LowPriority, /*disregarded if processing the alert would interrupt viewing of an access-controlled service*/ AP_MediumPriority, /*disregarded if processing the alert would interrupt viewing of a pay-per-view event*/ AP_HightPriority, /*processed unconditionally, but can involve text-only display if no audio is available*/ AP_MaximumPriority /*processed unconditionally...with audio service.*/ } alertPriority; typedef enum countrySubDivision { CSD_AllorUnspecified, CSD_Northwest, CSD_NortCentral, CSD_NorthEast, CSD_WestCentral, CSD_Central, CSD_EastCentral, CSD_SouthWest, CSD_SouthCentral, CSD_SouthEast } countrySubDivision; typedef struct locationCode { DS_U8 state_code; /*8bits : 0...99*/ DS_U8 county_subdivision; /*4bits : 0...9*/ DS_U16 county_code; /*10bits : 0...999*/ } locatioinCode_t , *locationCodePtr_t; typedef struct _exception { DS_U8 in_band_reference; /*1bit*/ DS_U16 exception_major_channel_number; /*10bits*/ DS_U16 exception_minor_channel_number; /*10bits*/ DS_U16 exception_OOB_source_ID; /*10bits*/ } exception_t , exceptionPtr_t; typedef struct cableEmergencyAlertSection { DS_U8 sequence_number; /*5bits*/ DS_U8 protocol_version; DS_U16 EAS_Event_ID; DS_U32 EAS_originator_code; /*24bits. ASCII characters*/ DS_U8 EAS_event_code_length; DS_U8* EAS_event_code; DS_U8 nature_of_activation_text_length; DS_U8* nature_of_activation_text ; DS_U8 alert_message_time_remaining; /*seconds range 0...120*/ DS_U32 event_start_time; DS_U16 event_duration; /*seconds range 0...120*/ DS_U8 alert_priority; /*4 bits*/ DS_U16 details_OOB_source_ID; DS_U16 details_major_channel_number; /*10 bits*/ DS_U16 details_minor_channel_number; /*10 bits*/ DS_U16 audio_OOB_source_ID; /*16 bits*/ DS_U16 alert_text_length; /*16 bits*/ DS_U8 *alert_text; /*multiple string structure*/ DS_U8 location_code_count; locatioinCode_t *location_code; DS_U8 exception_count; exception_t *exception; DS_U16 descriptors_length; /*10bits*/ DS_U8* descriptor; } ceaSection_t, *ceaSectionPtr_t; typedef ceaSection_t CEA; /*============================================================================== PSIP Descriptors ==============================================================================*/ /* AC-3 Audio Descriptor */ typedef enum { sr_48kHz = 0x0, sr_44kHz = 0x1, sr_32kHz = 0x2, /* 0x3 reserved */ sr_48kHz_or_44kHz = 0x4, sr_48kHz_or_32kHz = 0x5, sr_44kHz_or_32kHz = 0x6, sr_48kHz_or_44kHz_or_32kHz = 0x7 } sample_rate_code_k; typedef enum { br_32kbps = 0x00, br_le_32kbps = 0x20, br_40kbps = 0x01, br_le_40kbps = 0x21, br_48kbps = 0x02, br_le_48kbps = 0x22, br_56kbps = 0x03, br_le_56kbps = 0x23, br_64kbps = 0x04, br_le_64kbps = 0x24, br_80kbps = 0x05, br_le_80kbps = 0x25, br_96kbps = 0x06, br_le_96kbps = 0x26, br_112kbps = 0x07, br_le_112kbps = 0x27, br_128kbps = 0x08, br_le_128kbps = 0x28, br_160kbps = 0x09, br_le_160kbps = 0x29, br_192kbps = 0x0A, br_le_192kbps = 0x2A, br_224kbps = 0x0B, br_le_224kbps = 0x2B, br_256kbps = 0x0C, br_le_256kbps = 0x2C, br_320kbps = 0x0D, br_le_320kbps = 0x2D, br_384kbps = 0x0E, br_le_384kbps = 0x2E, br_448kbps = 0x0F, br_le_448kbps = 0x2F, br_512kbps = 0x10, br_le_512kbps = 0x30, br_576kbps = 0x11, br_le_576kbps = 0x31, br_640kbps = 0x12, br_le_640kbps = 0x32 } bit_rate_code_k; typedef enum { sm_not_indicated = 0x0, sm_not_Dolby_Surround = 0x1, sm_Dolby_Surround = 0x2 /* 0x3 reserved */ } surround_mode_k; typedef enum { bm_main_audio_serv_CM = 0x0, /* Complete Main */ bm_main_audio_serv_ME = 0x1, /* Music and Effects */ bm_associated_serv_VI = 0x2, /* Visually Impaired */ bm_associated_serv_HI = 0x3, /* Hearing Impaired */ bm_associated_serv_D = 0x4, /* Dialog */ bm_associated_serv_C = 0x5, /* Commentary */ bm_associated_serv_E = 0x6, /* Emergency */ bm_as_VO_or_ma_K = 0x7 /* Voice Over (acmod=001) or Karaoke (acmod=010-111) */ } bit_stream_mode_k; typedef enum { nc_acmod_1_1 = 0x0, nc_acmod_1_0 = 0x1, nc_acmod_2_0 = 0x2, nc_acmod_3_0 = 0x3, nc_acmod_2_1 = 0x4, nc_acmod_3_1 = 0x5, nc_acmod_2_2 = 0x6, nc_acmod_3_2 = 0x7, nc_encoded_1 = 0x8, nc_encoded_le_2 = 0x9, nc_encoded_le_3 = 0xA, nc_encoded_le_4 = 0xB, nc_encoded_le_5 = 0xC, nc_encoded_le_6 = 0xD /* 0xE-0xF reserved */ } num_channels_k; typedef enum { lc_unknown = 0x00, lc_Polish = 0x20, lc_background = 0x40, lc_Moldavian = 0x60, lc_Albanian = 0x01, lc_Portuguese = 0x21, lc_Malaysian = 0x61, lc_Breton = 0x02, lc_Romanian = 0x22, lc_Malagasay = 0x62, lc_Catalan = 0x03, lc_Romansh = 0x23, lc_Macedonian = 0x63, lc_Croatian = 0x04, lc_Serbian = 0x24, lc_Laotian = 0x64, lc_Welsh = 0x05, lc_Slovak = 0x25, lc_Zulu = 0x45, lc_Korean = 0x65, lc_Czech = 0x06, lc_Slovene = 0x26, lc_Vietnamese = 0x46, lc_Khmer = 0x66, lc_Danish = 0x07, lc_Finnish = 0x27, lc_Uzbek = 0x47, lc_Kazakh = 0x67, lc_German = 0x08, lc_Swedish = 0x28, lc_Urdu = 0x48, lc_Kannada = 0x68, lc_English = 0x09, lc_Turkish = 0x29, lc_Ukrainian = 0x49, lc_Japanese = 0x69, lc_Spanish = 0x0A, lc_Flemish = 0x2A, lc_Thai = 0x4A, lc_Indonesian = 0x6A, lc_Esperanto = 0x0B, lc_Walloon = 0x2B, lc_Telugu = 0x4B, lc_Hindi = 0x6B, lc_Estonian = 0x0C, lc_Tatar = 0x4C, lc_Hebrew = 0x6C, lc_Basque = 0x0D, lc_Tamil = 0x4D, lc_Hausa = 0x6D, lc_Faroese = 0x0E, lc_Tadzhik = 0x4E, lc_Gurani = 0x6E, lc_French = 0x0F, lc_Swahili = 0x4F, lc_Gujurati = 0x6F, lc_Frisian = 0x10, lc_Sranan_Tongo = 0x50, lc_Greek = 0x70, lc_Irish = 0x11, lc_Somali = 0x51, lc_Georgian = 0x71, lc_Gaelic = 0x12, lc_Sinhalese = 0x52, lc_Fulani = 0x72, lc_Galician = 0x13, lc_Shona = 0x53, lc_Dari = 0x73, lc_Icelandic = 0x14, lc_Serbo_Croat = 0x54, lc_Churash = 0x74, lc_Italian = 0x15, lc_Ruthenian = 0x55, lc_Chinese = 0x75, lc_Lappish = 0x16, lc_Russian = 0x56, lc_Burmese = 0x76, lc_Latin = 0x17, lc_Quechua = 0x57, lc_Bulgarian = 0x77, lc_Latvian = 0x18, lc_Pustu = 0x58, lc_Bengali = 0x78, lc_Luxembourgian = 0x19, lc_Punjabi = 0x59, lc_Belorussian = 0x79, lc_Lithuanian = 0x1A, lc_Persian = 0x5A, lc_Bambora = 0x7A, lc_Hungarian = 0x1B, lc_Papamiento = 0x5B, lc_Azerbijani = 0x7B, lc_Maltese = 0x1C, lc_Oriya = 0x5C, lc_Assamese = 0x7C, lc_Dutch = 0x1D, lc_Nepali = 0x5D, lc_Armenian = 0x7D, lc_Norwegian = 0x1E, lc_Ndebele = 0x5E, lc_Arabic = 0x7E, lc_Occitan = 0x1F, lc_Marathi = 0x5F, lc_Amharic = 0x7F } language_code_k; typedef enum { tc_UNICODE_2_Byte = 0, tc_ISO8859_1 = 1 } text_code_k; typedef struct ac3AudioStreamDescriptor { sample_rate_code_k sample_rate_code; DS_U8 bsid; bit_rate_code_k bit_rate_code; surround_mode_k surround_mode; bit_stream_mode_k bsmod; num_channels_k num_channels; DS_BOOL full_svc; DS_BOOL additional_elements1; /* indicates that more elements are present */ language_code_k langcod; language_code_k langcod2; /* present if 1+1 mode */ DS_BOOL additional_elements2; /* indicates that more elements are present */ union { DS_U8 mainid; DS_U8 asvcflags; } bsmod_ext; DS_U8 textlen; /* always zero for ATSC */ text_code_k text_code; DS_U8* text; } ac3AudioStreamDescriptor_t, *ac3AudioStreamDescriptorPtr_t; /* Caption Service Descriptor */ typedef enum { cct_line21 = 0, cct_advanced = 1 } cc_type_k; typedef enum { l21f_field1 = 0, l21f_field2 = 1 } line21_field_k; typedef struct captionService { DS_U32 language; cc_type_k cc_type; union { line21_field_k line21_field; DS_U8 caption_service_number; } cc_id; DS_BOOL easy_reader; DS_BOOL wide_aspect_ratio; DS_BOOL korean_code; } captionService_t, *captionServicePtr_t; typedef struct captionServiceDescriptor { DS_U8 number_of_services; captionServicePtr_t service; /* array of size 'number_of_services' */ } captionServiceDescriptor_t, *captionServiceDescriptorPtr_t; /* Content Advisory Descriptor */ typedef struct ratingDimension { DS_U8 rating_dimension_j; DS_U8 rating_value; } ratingDimension_t, *ratingDimensionPtr_t; typedef struct ratingRegion { DS_U8 rating_region; DS_U8 rated_dimensions; ratingDimensionPtr_t dimension; /* array of size 'rated_dimensions' */ DS_U16 rating_description_length; DS_U8 *rating_description; } ratingRegion_t, *ratingRegionPtr_t; typedef struct contentAdvisoryDescriptor { DS_U8 rating_region_count; ratingRegionPtr_t rating_region; /* array of size 'rating_region_count' */ } contentAdvisoryDescriptor_t, *contentAdvisoryDescriptorPtr_t; /* Extended Channel Name Descriptor */ typedef struct extendedChannelNameDescriptor { DS_U16 long_channel_name_length; DS_U8 *long_channel_name; } extendedChannelNameDescriptor_t, *extendedChannelNameDescriptorPtr_t; /* Service Location Descriptor */ typedef struct slElement { DS_U8 stream_type; DS_U16 elementary_PID; DS_U32 ISO639_language_code; } slElement_t, *slElementPtr_t; typedef struct serviceLocationDescriptor { DS_U16 PCR_PID; DS_U8 number_elements; slElementPtr_t element; /* array of size 'number_elements' */ } serviceLocationDescriptor_t, *serviceLocationDescriptorPtr_t; /* Time Shifted Service Descriptor */ typedef struct tsService { DS_U16 time_shift; DS_U16 major_channel_number; DS_U16 minor_channel_number; } tsService_t, *tsServicePtr_t; typedef struct timeShiftedServiceDescriptor { DS_U8 number_of_services; tsServicePtr_t service; /* array of size 'number_of_services' */ } timeShiftedServiceDescriptor_t, *timeShiftedServiceDescriptorPtr_t; /* Component Name Descriptor */ typedef struct componentNameDescriptor { DS_U16 component_name_length; DS_U8 *component_name; } componentNameDescriptor_t, *componentNameDescriptorPtr_t; /* DCC Departing Request Descriptor */ typedef struct dccDRDescriptor { DS_U8 dcc_dep_type; DS_U8 dcc_dep_text_length; DS_U8 *dcc_dep_text; } *dccDRDescriptorPtr_t,dccDRDescriptor_t; /* DCC Arriving Request Descriptor */ typedef struct dccARDescriptor { DS_U8 dcc_arr_type; DS_U8 dcc_arr_text_length; DS_U8 *dcc_arr_text; } *dccARDescriptorPtr_t,dccARDescriptor_t; /* Redistribution Control Descriptor */ typedef struct rcDescriptor { DS_U8 *rc_information; } *rcDescriptorPtr_t,rcDescriptor_t; /* Emergency Information Descriptor */ typedef enum { ac_dummy_1 = 0x00, ac_dummy_2 = 0x01, ac_dummy_3 = 0x02, ac_dummy_4 = 0x03, ac_dummy_5 = 0x04, ac_dummy_6 = 0x05, ac_dummy_7 = 0x06, ac_dummy_8 = 0x07, ac_dummy_9 = 0x08 } area_code_k; typedef struct areaElement { area_code_k code; } areaElement_t, *areaElementPtr_t; typedef struct emergencyService { DS_U16 service_id; DS_U8 start_end_flag; DS_U8 signal_level; DS_U8 area_code_length; areaElementPtr_t area_code; } emergencyService_t, *emergencyServicePtr_t; typedef struct eiDescriptor { DS_U16 num_services; emergencyServicePtr_t services; } *eiDescriptorPtr_t,eiDescriptor_t; typedef struct privateSection { DS_U8 section_syntax_indicator; /*1bit*/ /*in case of (section_syntax_indicator == '1')*/ DS_U16 table_id_extension; /*16bits*/ DS_U8 version_number; /*5bits*/ DS_U8 current_next_indicator; /*1bit*/ DS_U8 section_number; /*8bits*/ DS_U8 last_section_number; /*8bits*/ DS_U32 private_data_length; /*12bits*/ DS_U8* private_data_byte; } prvtSection_t, *prvtSectionPtr_t; typedef struct privateTable { DS_U8 version_number; /*5bits*/ DS_U16 table_id_extension; /*16bits*/ DS_U32 private_data_length; /*12bits*/ DS_U8 *private_data_byte; } prvt_t , *prvtPtr_t; typedef prvt_t PRVT; /*============================================================================== API Functions ==============================================================================*/ /* Section Parsing functions */ /*------------------------------------------------------------------------------ The section parsing functions take an unparsed section (as an array of bytes) and parses it into a structure representing the fields as defined in the PSIP specification. These section structures are found in this header file before the API functions. For the STT, MGT, RRT, and ETT tables the parsed section represents the complete table because these are specified to be contained entirely in a single section. For the multi-section TVCT, CVCT, and EIT tables, corresponding table parsing functions (below) exist to offer the option of parsing complete tables. The FreeAtscSection() function frees the memory associated with a PARSED section structure. It is the responsibility of the ParseXxxSection() caller to free the resulting parsed section structure. ------------------------------------------------------------------------------*/ DHL_RESULT DHL_PSI_ParseSTTSection (DS_U8 *section, sttSectionPtr_t *sttSectionPtr); DHL_RESULT DHL_PSI_ParseMGTSection (DS_U8 *section, mgtSectionPtr_t *mgtSectionPtr); DHL_RESULT DHL_PSI_ParseTVCTSection (DS_U8 *section, tvctSectionPtr_t *tvctSectionPtr); DHL_RESULT DHL_PSI_ParseCVCTSection (DS_U8 *section, cvctSectionPtr_t *cvctSectionPtr); DHL_RESULT DHL_PSI_ParseRRTSection (DS_U8 *section, rrtSectionPtr_t *rrtSectionPtr); DHL_RESULT DHL_PSI_ParseEITSection (DS_U8 *section, eitSectionPtr_t *eitSectionPtr); DHL_RESULT DHL_PSI_ParseETTSection (DS_U8 *section, ettSectionPtr_t *ettSectionPtr); DHL_RESULT DHL_PSI_ParseDCCTSection (DS_U8 *section, dcctSectionPtr_t *dccSectionPtr); DHL_RESULT DHL_PSI_ParseDCCSCTSection (DS_U8 *section, dccsctSectionPtr_t *dccsctSectionPtr); DHL_RESULT DHL_PSI_ParseCEASection(DS_U8 *section , ceaSectionPtr_t *cesSectionPtr ); /* Table Parsing functions */ /*------------------------------------------------------------------------------ The table parsing functions take an array of unparsed sections (as an array of bytes) and parses it into a structure representing the fields as defined in the PSIP specification. These table structures are found in this header file before the API functions. Table parsing function exist only for the multi-section Tvct, Cvct, and Eit tables. For the single-section Stt, Mgt, Rrt, and Ett tables, the section parsing function should be used. The FreeAtscTable() function frees the memory associated with a PARSED table structure. It is the responsibility of the ParseXxx() caller to free the resulting parsed table structure. ------------------------------------------------------------------------------*/ DHL_RESULT DHL_PSI_ParseTVCT (DS_U8 **sectionArr, tvctPtr_t *tvctPtr); DHL_RESULT DHL_PSI_ParseCVCT (DS_U8 **sectionArr, cvctPtr_t *cvctPtr); DHL_RESULT DHL_PSI_ParseEIT (DS_U8 **sectionArr, eitPtr_t *eitPtr); DHL_RESULT DHL_PSI_ParsePRVT (DS_U8 **sectionArr, prvtPtr_t *prvtPtr); DHL_RESULT DHL_PSI_ParsePRVTSection (DS_U8 *section, prvtSectionPtr_t *prvtSectionPtr); /* Descriptor Parsing functions */ /*------------------------------------------------------------------------------ The descriptor parsing functions take an unparsed descriptor (as an array of bytes) and parses it into a structure representing the fields as defined in the PSIP specification. These descriptor structures are found in this header file before the API functions. The FreeMpegDescriptor() function (part of the MPEG_SI API) frees the memory associated with a PARSED descriptor structure. It is the responsibility of the ParseXxxDescriptor() caller to free the resulting parsed descriptor structure. ------------------------------------------------------------------------------*/ DHL_RESULT DHL_PSI_ParseAc3AudioStreamDescriptor (DS_U8* p, ac3AudioStreamDescriptorPtr_t *descripPtr); DHL_RESULT DHL_PSI_ParseCaptionServiceDescriptor (DS_U8* p, captionServiceDescriptorPtr_t *descripPtr); DHL_RESULT DHL_PSI_ParseContentAdvisoryDescriptor (DS_U8* p, contentAdvisoryDescriptorPtr_t *descripPtr); DHL_RESULT DHL_PSI_ParseExtendedChannelNameDescriptor (DS_U8* p, extendedChannelNameDescriptorPtr_t *descripPtr); DHL_RESULT DHL_PSI_ParseServiceLocationDescriptor (DS_U8* p, serviceLocationDescriptorPtr_t *descripPtr); DHL_RESULT DHL_PSI_ParseTimeShiftedServiceDescriptor (DS_U8* p, timeShiftedServiceDescriptorPtr_t *descripPtr); DHL_RESULT DHL_PSI_ParseComponentNameDescriptor (DS_U8* p, componentNameDescriptorPtr_t *descripPtr); DHL_RESULT DHL_PSI_ParseDccDepartingRequestDescriptor (DS_U8* p, dccDRDescriptorPtr_t *descripPtr); DHL_RESULT DHL_PSI_ParseDccArrivingRequestDescriptor (DS_U8* p, dccARDescriptorPtr_t *descripPtr); DHL_RESULT DHL_PSI_ParseRedistributionControlDescriptor (DS_U8* p, rcDescriptorPtr_t *descripPtr); DHL_RESULT DHL_PSI_ParseConditionalAccessDescriptor ( DS_U8* p, CA_descriptor **desc); DHL_RESULT DHL_PSI_ParseEmergencyInformationDescriptorAlter (DS_U8* p, eiDescriptorPtr_t *descripPtr); /* Multiple String Parsing */ /*------------------------------------------------------------------------------ The ParseMultipleString() function is used to parse a MultipleString byte array. The FreeMultipleString() function frees the memory associated with a PARSED MultipleString structure. It is the responsibility of the ParseMultipleString() caller to free the parsed MultipleString structure. ------------------------------------------------------------------------------*/ DHL_RESULT DHL_PSI_ParseMultipleString (DS_U8 *buffer, DS_U16 len, multipleStringPtr_t *mStringPtr); void DHL_PSI_FreeMultipleString (multipleStringPtr_t multipleStringPtr); /* Huffman Decoding */ /*------------------------------------------------------------------------------ The DecodeHuffmanString() function is used to decode a Huffman-compressed string found in the Multiple String Structure. The Huffman coding supports both types as defined in the PSIP A/65 document (Title and Description type strings). The compression type using to encode the string (as specified in the Multiple String Structure) should be passed to this function. The text buffer is supplied by the caller of this function. The length of the buffer is specified by the 'textlen' parameter. A decompressed string that is shorter than 'textlen' is terminated with a null character. A decompressed string that is longer than 'textlen' is truncated to 'textlen-1' and terminated with a null character. ------------------------------------------------------------------------------*/ DHL_RESULT DHL_PSI_DecodeHuffmanString (DS_U8 *compressedStr, DS_U32 length, compress_type_k type, char *text, DS_U32 textlen); /* Asynchronous Monitor calls */ /*------------------------------------------------------------------------------ The set of asynchronous monitor functions allow continuous or one-time monitoring of ATSC PSIP sections and/or tables. For a detailed description of these parameters, see the explanation in PSI.h. Parameter Description --------------------- tsd - Specifies from which Transport Stream Demultiplexor the monitored stream is coming psiMode - Specifies the notification type for PSIP sections. For PSIP applications, one of the following PSIMode options should be used: sectionMode: Event triggered for each section received. tableMode: Event triggered when a complete table received. eagerTableMode: Event triggered for each new section of a table as well as an event when the table is complete. For the Stt, Mgt, Rrt, and Ett tables, the PSIMode is internally set to sectionMode because these tables reside within a single section. updateMode - Specifies the update frequency of the monitor. For PSIP applications, one of the following PSIUpdateMode options should be used: psiOneShot: Section or table event triggered only once. psiVersionChange:Table trigger reset when version changes. psiContinuous: Sections/Tables continously trigger events. eventProc - The callback function to receive monitor events. userParam - A user-specified field which is sent to the eventProc callback function with events. **psiCtl - Returns a pointer to the Monitor descriptor to the caller. This identifies the specific PSI monitor and can be used to cancel a set monitor. ------------------------------------------------------------------------------*/ DHL_RESULT DHL_PSI_MonitorSTT (DHL_PSI_HANDLE sysInfo, PSIUpdateMode updateMode, PSIEventProc_f eventProc, DS_U32 userData, DHL_TBL_HANDLE *psiCtl); DHL_RESULT DHL_PSI_MonitorMGT (DHL_PSI_HANDLE sysInfo, PSIUpdateMode updateMode, PSIEventProc_f eventProc, DS_U32 userData, DHL_TBL_HANDLE *psiCtl); DHL_RESULT DHL_PSI_MonitorTVCT (DHL_PSI_HANDLE sysInfo, PSIMode psiMode, PSIUpdateMode updateMode, PSIEventProc_f eventProc, DS_U32 userParam, DHL_TBL_HANDLE *psiCtl); DHL_RESULT DHL_PSI_MonitorCVCT (DHL_PSI_HANDLE sysInfo, PSIMode psiMode, PSIUpdateMode updateMode, PSIEventProc_f eventProc, DS_U32 userParam, DHL_TBL_HANDLE *psiCtl); DHL_RESULT DHL_PSI_MonitorRRT (DHL_PSI_HANDLE sysInfo, DS_U8 region, PSIUpdateMode updateMode, PSIEventProc_f eventProc, DS_U32 userData, DHL_TBL_HANDLE *psiCtl); DHL_RESULT DHL_PSI_MonitorEIT (DHL_PSI_HANDLE sysInfo, DS_U16 PID, DS_U16 source_id, PSIMode psiMode, PSIUpdateMode updateMode, PSIEventProc_f eventProc,DS_U32 userParam, DHL_TBL_HANDLE *psiCtl); DHL_RESULT DHL_PSI_MonitorETT (DHL_PSI_HANDLE sysInfo, DS_U16 PID, DS_U32 ETM_id, PSIUpdateMode updateMode, PSIEventProc_f eventProc, DS_U32 userData, DHL_TBL_HANDLE *psiCtl); DHL_RESULT DHL_PSI_MonitorDCCT (DHL_PSI_HANDLE sysInfo, PSIUpdateMode updateMode, PSIEventProc_f eventProc, DS_U32 userData, DHL_TBL_HANDLE *psiCtl); DHL_RESULT DHL_PSI_MonitorDCCSCT (DHL_PSI_HANDLE sysInfo , PSIUpdateMode updateMode, PSIEventProc_f eventProc, DS_U32 userData, DHL_TBL_HANDLE *psiCtl); DHL_RESULT DHL_PSI_MonitorCEA( DHL_PSI_HANDLE sysInfo , PSIUpdateMode updateMode, PSIEventProc_f eventProc, DS_U32 userParam, DHL_TBL_HANDLE *returnPSICtl); DHL_RESULT DHL_PSI_MonitorPRVT ( DHL_PSI_HANDLE sysInfo , DS_U16 pid, DS_U8 tableId, PSIMode psiMode, PSIUpdateMode updateMode, PSIEventProc_f eventProc, DS_U32 userParam, DS_BOOL bNeedBigSi, DHL_TBL_HANDLE *returnPSICtl); DHL_RESULT DHL_PSI_MonitorPRVTEx( DHL_PSI_HANDLE sysInfo , DS_U16 pid , DS_U8 tableId , DS_U16 groupNumber , PSIMode psiMode , PSIUpdateMode updateMode, PSIEventProc_f eventProc, DS_U32 userParam , DS_BOOL bNeedBigSi, DHL_TBL_HANDLE *returnPSICtl); /* Synchronous calls */ /*------------------------------------------------------------------------------ The set of synchronous monitor functions allow one-time retrieval of a PSIP section or table. The function suspends until the data is retrieved from the Transport Stream or until the timeOut period expires. For the Stt, Mgt, Rrt, and Ett a section is returned. For the Tvct, Cvct, and Eit, a table is returned. The timeout period 'timeOut' is specified in milliseconds. The parsed section/table must be freed using FreeAtscSection()/FreeAtscTable(). ------------------------------------------------------------------------------*/ DHL_RESULT DHL_PSI_GetSTTSection (DHL_PSI_HANDLE sysInfo, sttSectionPtr_t *sttSectPtr, int timeOut); DHL_RESULT DHL_PSI_GetMGTSection (DHL_PSI_HANDLE sysInfo, mgtSectionPtr_t *mgtSectPtr, int timeOut); DHL_RESULT DHL_PSI_GetRRTSection (DHL_PSI_HANDLE sysInfo, DS_U8 region, rrtSectionPtr_t *rrtSectPtr, int timeOut); DHL_RESULT DHL_PSI_GetETTSection (DHL_PSI_HANDLE sysInfo, DS_U16 PID, DS_U32 ETM_id, ettSectionPtr_t *ettSectPtr, int timeOut); DHL_RESULT DHL_PSI_GetDCCTSection (DHL_PSI_HANDLE sysInfo, dcctSectionPtr_t *dcctSectPtr, int timeOut); DHL_RESULT DHL_PSI_GetDCCSCTSection (DHL_PSI_HANDLE sysInfo, dccsctSectionPtr_t *dccsctSectPtr, int timeOut); DHL_RESULT DHL_PSI_GetTVCT (DHL_PSI_HANDLE sysInfo, tvctPtr_t *tvctPtr, int timeOut); DHL_RESULT DHL_PSI_GetCVCT (DHL_PSI_HANDLE sysInfo, cvctPtr_t *cvctPtr, int timeOut); DHL_RESULT DHL_PSI_GetEIT (DHL_PSI_HANDLE sysInfo, DS_U16 PID, DS_U16 source_id, eitPtr_t *eitPtr, int timeOut); DHL_RESULT DHL_PSI_GetPRVTEx(DHL_PSI_HANDLE sysInfo, DS_U16 pid, DS_U8 tableId , DS_U16 groupNumber , prvtPtr_t *prvtPtr, int timeOut , DS_BOOL bNeedBigSi ); DHL_RESULT DHL_PSI_GetPRVT(DHL_PSI_HANDLE sysInfo, DS_U16 pid, DS_U8 tableId , prvtPtr_t *prvtPtr, int timeOut , DS_BOOL bNeedBigSi ); DHL_RESULT DHL_PSI_GetCEASection ( DHL_PSI_HANDLE sysInfo, ceaSectionPtr_t *ceaSectPtr, int timeOut); /*Print function for each table.*/ void DHL_PSI_PrintTVCT (tvctPtr_t tvctPtr); void DHL_PSI_PrintCVCT(cvctPtr_t cvctPtr); void DHL_PSI_PrintMGTSection (mgtSectionPtr_t mgtPtr); void DHL_PSI_PrintSTTSection (sttSectionPtr_t sttPtr); void DHL_PSI_PrintEIT (eitPtr_t eitPtr); void DHL_PSI_PrintETTSection (ettSectionPtr_t ettPtr); void DHL_PSI_PrintDCCTSection(dcctSectionPtr_t dcctPtr); void DHL_PSI_PrintDCCSCTSection(dccsctSectionPtr_t dccsctPtr ); void DHL_PSI_PrintMultipleString (DS_U8 *buffer, DS_U16 len); void DHL_PSI_PrintPRVT (prvtPtr_t prvtPtr); void DHL_PSI_PrintAc3AudioStreamDescriptor (ac3AudioStreamDescriptorPtr_t descrip); void DHL_PSI_PrintServiceLocationDescriptor (serviceLocationDescriptorPtr_t descrip); void DHL_PSI_PrintExtendedChannelNameDescriptor (extendedChannelNameDescriptorPtr_t descrip); void DHL_PSI_PrintCaptionServiceDescriptor (captionServiceDescriptorPtr_t descrip); void DHL_PSI_PrintContentAdvisoryDescriptor (contentAdvisoryDescriptorPtr_t descrip); void DHL_PSI_PrintDccArrivingRequestDescriptor (dccARDescriptorPtr_t descrip); void DHL_PSI_PrintTimeShiftedServiceDescriptor (timeShiftedServiceDescriptorPtr_t descrip); void DHL_PSI_PrintCEASection( ceaSectionPtr_t ceaPtr ); void DHL_PSI_PrintConditionalAccessDescriptor(CA_descriptor *d); void DHL_PSI_PrintEmergencyInformationDescriptorAlter (eiDescriptorPtr_t descrip); //void DHL_PSI_Print DHL_RESULT DHL_PSI_ReadPSIData( DHL_TBL_HANDLE hTblHandle , struct PSIDataArray_t **returnPsi); void DHL_PSI_FreeMpegSection (void *sectionPtr); void DHL_PSI_FreeMpegDescriptor (void *descriptorPtr); void DHL_PSI_FreePSIData( PSIDataArray_t *desc ); DHL_RESULT RFU_GetImageSections ( unsigned int pid , unsigned char tableId ); #define DHL_PSI_FreeTVCT(x) DHL_PSI_FreeMpegSection(x) #define DHL_PSI_FreeCVCT(x) DHL_PSI_FreeMpegSection(x) #define DHL_PSI_FreeRRT(x) DHL_PSI_FreeMpegSection(x) #define DHL_PSI_FreeEIT(x) DHL_PSI_FreeMpegSection(x) #define DHL_PSI_FreeMGT(x) DHL_PSI_FreeMpegSection(x) #define DHL_PSI_FreeETT(x) DHL_PSI_FreeMpegSection(x) #define DHL_PSI_FreeSTT(x) DHL_PSI_FreeMpegSection(x) #define DHL_PSI_FreeDCCT(x) DHL_PSI_FreeMpegSection(x) #define DHL_PSI_FreeDCCSCT(x) DHL_PSI_FreeMpegSection(x) #define DHL_PSI_FreeCEA(x) DHL_PSI_FreeMpegSection(x) #define DHL_PSI_FreeAtscTable(x) DHL_PSI_FreeMpegSection(x) #define DHL_PSI_FreeAtscSection(x) DHL_PSI_FreeMpegSection(x) #define DHL_PSI_FreePRVT(x) DHL_PSI_FreeMpegSection(x) #define DHL_PSI_FreeECMEMM(x) DHL_PSI_FreeMpegSection(x) DHL_RESULT DHL_PSI_GetDsmccPIDs( MPEG_PMT *pmt, DS_U32 *returnDsmccPID, int *returnDsmccPIDLen ); #ifdef __cplusplus } #endif #include "dsthalPsiDsmcc.h" #endif /* DST_ATSC_PSIP_H */ /*************************************************************************** * * Modified Version. PSI_AtscPsip.h Revision.1.0 2004/05/28 jina * #Add CEA table defintions. * * * ORIGINAL API Definitions from TL8xx ATSC_PSIP.h Revision.1.3 2002/12/24. * **************************************************************************/