#ifndef BSETTOP_HDMI_H__ #define BSETTOP_HDMI_H__ #include "bsettop_types.h" #include "bsettop_display.h" #include "bsettop_decode_audio.h" #define boutput_hdmi_cec_max_transmit_length 15 /* + 1 for CEC header length */ #define boutput_hdmi_cec_broadcast_address 0xF /* CEC Broadcast address */ #define CEC_CMD_ABORT 0x00 #define CEC_CMD_IMAGE_VIEW_ON 0x04 #define CEC_CMD_TEXT_VIEW_ON 0x0d #define CEC_CMD_STANDBY 0x36 #define CEC_CMD_GIVE_AUDIO_STATUS 0x71 #define CEC_CMD_REPORT_AUDIO_STATUS 0x7a #define CEC_CMD_ACTIVE_SOURCE 0x82 #define CEC_CMD_GET_PHYSICAL_ADDRESS 0x83 #define CEC_CMD_REPORT_PHYSICAL_ADDRESS 0x84 #define CEC_CMD_REQUEST_ACTIVE_SOURCE 0x85 #define CEC_CMD_DEVICE_VENDOR_ID 0x87 #define CEC_CMD_DEVICE_VENDOR_CMD 0x89 /* vendor specific command */ #define CEC_CMD_GIVE_DEVICE_VENDOR_ID 0x8c #define CEC_CMD_GIVE_DEVICE_POWER_STATUS 0x8f #define CEC_CMD_REPORT_POWER_STATUS 0x90 #define CEC_CMD_INACTIVE_SOURCE 0x9d #define CEC_CMD_CEC_VERSION 0x9e #define CEC_CMD_GET_CEC_VERSION 0x9f /* Summary: HDMI output handle returned by boutput_hdmi_open() */ typedef struct boutput_hdmi *boutput_hdmi_t; /** Summary: Settings for SPDIF output **/ typedef struct boutput_spdif_channel_status { bool professional_mode; /* [0:0] The professional mode flag. TRUE: Professional mode. Other user options will not be considered. FALSE: Consumer mode. - Read Only*/ bool pcm; /* [1:1] For output Linear bLinear_PCM=true, If output is Compressed bLinear_PCM=false - Read Only */ bool copyright; /* [2:2] Software CopyRight assert. TRUE: CopyRight is asserted FALSE: CopyRight is not asserted */ uint8_t pre_emphasis; /*[3:5] pre-emphasis */ uint8_t channel_status_mode;/* [6:7] Gives channel status - Read Only*/ uint8_t category_code; /* [8:15] Category code in spdif channel status, including L-bit */ uint8_t source_number; /*[16:19] Source number*/ bool channel_num; /*[20:23] TRUE: Left channel num = 0000 Right Channel Num = 0000 FALSE: Left channel num = 1000 Right Channel Num = 0100 */ uint8_t sampling_frequency; /*[24:27]Sampling frequency - Read Only*/ uint8_t clock_accuracy; /* [28:29] Clock Accuracy */ bool max_word_length; /* [32:32] For setting of 32bit of Channel Status Bit 32 0 Maximum audio sample word length is 20 bits 1 Maximum audio sample word length is 24 bits */ uint8_t sample_word_length; /* [33:35] Sample word length */ uint8_t original_sampling_frequency;/* [36:39] Original sampling frequency*/ uint8_t cgms_a; /* [40:41] */ } boutput_spdif_channel_status; /* Summary: Settings returned by bdisplay_get_format_settings */ typedef struct bvideo_format_settings { unsigned width; /* height of video format in pixels */ unsigned height; /* width of video format in lines */ unsigned refresh_rate; /* 20061213 DEPRECATED -- refresh rate of video format in Hz */ bvideo_frame_rate frame_rate; /* 20061213 bandrews - replaces refresh_rate */ bool interlaced; } bvideo_format_settings; /* Summary: HDMI HDCP Status */ typedef enum boutput_hdmi_hdcp_state { boutput_hdmi_hdcp_state_internal_err, boutput_hdmi_hdcp_state_disabled, boutput_hdmi_hdcp_state_init, boutput_hdmi_hdcp_state_auth_fail, boutput_hdmi_hdcp_state_ri_fail, boutput_hdmi_hdcp_state_pj_fail, boutput_hdmi_hdcp_state_repeater_fail, boutput_hdmi_hdcp_state_enabled } boutput_hdmi_hdcp_state; /* Summary: HDMI CEC message type */ typedef enum boutput_hdmi_cec_message_type { boutput_hdmi_cec_message_type_transmit = 0, boutput_hdmi_cec_message_type_receive = 1 } boutput_hdmi_cec_message_type ; /* Summary: All information from a received CEC message or to transmit a CEC message */ typedef struct boutput_hdmi_cec_message_data { boutput_hdmi_cec_message_type message_type; uint8_t initiator_addr; uint8_t destination_addr; uint8_t opcode; uint8_t message_buffer[boutput_hdmi_cec_max_transmit_length]; uint8_t message_length; } boutput_hdmi_cec_message_data; /* Summary: All CEC related information from the device. */ typedef struct boutput_hdmi_cec_configuration { uint8_t logical_address; uint8_t physical_address[2]; uint8_t device_type; } boutput_hdmi_cec_configuration; typedef struct bsettop_hdmi *bsettop_hdmi_t; typedef void (*bsettop_hdcp_authentication_cb_t)( bool authenticated /* authenticated or not */ ); #ifdef __cplusplus extern "C" { #endif /* Summary: HDMI deep color mode enum */ typedef enum boutput_hdmi_color_depth { boutput_hdmi_color_depth_8bit, boutput_hdmi_color_depth_10bit, boutput_hdmi_color_depth_12bit, boutput_hdmi_color_depth_16bit } boutput_hdmi_color_depth; #if 0 /** Summary: Settings for HDMI output **/ typedef struct boutput_hdmi_settings { bvideo_format edid_preferred_format ; /* format preferred by attached DVI/HDMI device */ bvideo_format_settings vesa_settings ; /* if format == bvideo_format_vesa, then these settings are used. */ bool hdcp ; uint16_t hdcp_failure_retry_delay ; bool hdcp_pj_checking_enable ; bool preemphasis_support ; bool hdcp_disable_blue_screen; /* If true, upon HDCP failure, a OSD message will be displayed on HDMI instead of blue screen */ bool validate_edid_format; /* If true, bdisplay_set will only accept formats that are valid in the attached device's EDID data. */ unsigned hdmi_avmute_delay_pre_format_change; /* Delay (in ms) after sending AVMute and before the format change */ unsigned hdmi_avmute_delay_post_format_change; /* Delay (in ms) before sending AVUnMute and after the format change */ bsettop_callback hdmi_hotplug_callback; /* Called when a device connects */ bsettop_callback hdmi_disconnect_callback; /* Called when a device disconnects */ bsettop_callback hdmi_hdcp_status_callback; /* Called when HDCP status changes */ bsettop_callback hdmi_cec_message_callback; /* Called when a CEC message is received */ void *callback_context; /* all callbacks share this context */ boutput_hdmi_audio_mode hdmi_audio_mode; /* Audio mode for HDMI */ baudio_format compressed_audio_format; /* compressed output format. If hdmi_audio_mode = compressed and this is set to a valid format (e.g. baudio_format_dts), output will be transcoded to that format. By default this is baudio_format_unknown, which will leave the compressed data in the original format. */ boutput_spdif_channel_status hdmi_spdif_channel_status; /* HDMI's Spdif audio output's Channel status */ unsigned audio_delay; /* delay, in ms, applied to the HDMI audio output */ boutput_hdmi_color_depth hdmi_color_depth; /* color depth settings 8, 10, 12, or 16bits */ } boutput_hdmi_settings; /** Summary: Set new HDMI settings. Description: These settings will not be applied until bdisplay_set is called with the HDMI handle assigned. **/ bresult boutput_hdmi_set(boutput_hdmi_t dvi, const boutput_hdmi_settings *settings); /** Summary: Get the current HDMI settings. **/ void boutput_hdmi_get(boutput_hdmi_t dvi, boutput_hdmi_settings *settings /* [out] */ ); /** Summary: DVI/HDMI device capabilities **/ typedef struct boutput_hdmi_capabilities { bvideo_format preferred_video_format; bool video_format_is_supported[bvideo_format_count]; boutput_hdmi_audio_mode preferred_audio_mode; bool audio_mode_is_supported[boutput_hdmi_audio_mode_count]; bool hdmi; /* True if HDMI, false if DVI */ boutput_hdmi_rx_edid_info rx_edid_info; /* contians HDMI Rx EDID info. */ } boutput_hdmi_capabilities; /** Summary: Get the current HDMI device capabilities. **/ bresult boutput_hdmi_get_capabilities(boutput_hdmi_t dvi, boutput_hdmi_capabilities *caps /* [out] */ ); #endif /** Summary: The current HDMI status **/ typedef struct boutput_hdmi_status { bool connected; bvideo_format preferred; bool is_hdmi; boutput_hdmi_hdcp_state hdcp_state; } boutput_hdmi_status; /** Summary: Get the current HDCP status **/ bresult boutput_hdmi_get_status(bsettop_hdmi_t h_hdmi, boutput_hdmi_status *status /* [out] */ ); /** Summary: Get the received CEC message **/ bresult boutput_hdmi_cec_get_message(boutput_hdmi_t dvi, boutput_hdmi_cec_message_data *cec_message_data /* [out] */ ); /** Summary: Send CEC message **/ bresult boutput_hdmi_cec_send_message(boutput_hdmi_t dvi, const boutput_hdmi_cec_message_data *cec_message_data ); /** Summary: Get the CEC configuration from the device **/ bresult boutput_hdmi_cec_get_configuration(boutput_hdmi_t dvi, boutput_hdmi_cec_configuration *cec_configuration /* [out] */ ); /** Summary: Check the current status of the device **/ bool boutput_hdmi_cec_is_device_ready(boutput_hdmi_t dvi); /** Summary: Enable CEC core to receive CEC messages **/ bresult boutput_hdmi_cec_enable_receive(boutput_hdmi_t dvi); bresult bsettop_hdmi_open( bsettop_hdmi_t *h_hdmi, bdisplay_t display, /* display on which the graphics are displayed */ baudio_decode_t audio_decode, bsettop_hdcp_authentication_cb_t hdcp_authentication_cb ); void bsettop_hdmi_close(bsettop_hdmi_t h_hdmi); void bsettop_hdmi_disconnect_audio(bsettop_hdmi_t h_hdmi); void bsettop_hdmi_connect_audio(bsettop_hdmi_t h_hdmi); BERR_Code bsettop_hdmi_cec_cmd(int cecCmd, int destinationAddr); bool bsettop_hdmi_get_RGB_output(void); bresult bsettop_hdmi_set_RGB_output(bool bRGB); bool bsettop_hdmi_get_native_audio_mode(void); BERR_Code bsettop_hdmi_set_native_audio_mode(bool native); bool bsettop_hdmi_is_video_fmt_supported(bsettop_display_format_t fmt); bvideo_format bsettop_hdmi_get_preferred_format(bsettop_hdmi_t h_hdmi); bool bsettop_hdmi_is_dvi(bsettop_hdmi_t h_hdmi); void bsettop_hdmi_mark_dsp_fmt_valid(bsettop_hdmi_t h_hdmi); /** Summary: check if HDCP authentication is successful or not **/ bool bsettop_hdmi_check_hdcp_authentication_status(bsettop_hdmi_t h_hdmi); #ifdef __cplusplus } #endif #endif /* BSETTOP_HDMI_H */