codeworkx | 62f02ba | 2012-05-20 12:00:36 +0200 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright@ Samsung Electronics Co. LTD |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | #ifndef __HDMI_HAL_V4L2_UTILS_H__ |
| 18 | #define __HDMI_HAL_V4L2_UTILS_H__ |
| 19 | |
| 20 | //#define LOG_NDEBUG 0 |
| 21 | //#define LOG_TAG "libhdmi" |
| 22 | #if defined(BOARD_USE_V4L2) |
| 23 | #include "SecBuffer.h" |
| 24 | #endif |
| 25 | #include "fimd_api.h" |
| 26 | |
| 27 | #ifdef __cplusplus |
| 28 | extern "C" { |
| 29 | #endif |
| 30 | |
| 31 | namespace android { |
| 32 | |
| 33 | void display_menu(void); |
| 34 | |
| 35 | int tvout_open(const char *fp_name); |
| 36 | #if defined(BOARD_USE_V4L2) |
| 37 | int tvout_std_v4l2_init(int fd, unsigned int preset_id); |
| 38 | int tvout_std_v4l2_querycap(int fd, char *node); |
| 39 | int tvout_std_v4l2_enum_dv_presets(int fd); |
| 40 | int tvout_std_v4l2_s_dv_preset(int fd, struct v4l2_dv_preset *preset); |
| 41 | int tvout_std_v4l2_enum_output(int fd, struct v4l2_output *output); |
| 42 | int tvout_std_v4l2_s_output(int fd, int index); |
| 43 | int tvout_std_v4l2_g_output(int fd, int *index); |
| 44 | int tvout_std_v4l2_s_fmt(int fd, enum v4l2_buf_type type, enum v4l2_field field, int w, int h, int colorformat, int num_planes); |
| 45 | int tvout_std_v4l2_s_crop(int fd, enum v4l2_buf_type type, enum v4l2_field field, int x, int y, int w, int h); |
| 46 | int tvout_std_v4l2_s_ctrl(int fd, int id, int value); |
| 47 | int tvout_std_v4l2_reqbuf(int fd, enum v4l2_buf_type type, enum v4l2_memory memory, unsigned int num_bufs); |
| 48 | int tvout_std_v4l2_querybuf(int fd, enum v4l2_buf_type type, enum v4l2_memory memory, unsigned int buf_index, unsigned int num_planes, SecBuffer *secBuf); |
| 49 | int tvout_std_v4l2_qbuf(int fd, enum v4l2_buf_type type, enum v4l2_memory memory, int buf_index, int num_planes, SecBuffer *secBuf); |
| 50 | int tvout_std_v4l2_dqbuf(int fd, enum v4l2_buf_type type, enum v4l2_memory memory, int *buf_index, int num_planes); |
| 51 | int tvout_std_v4l2_streamon(int fd, enum v4l2_buf_type type); |
| 52 | int tvout_std_v4l2_streamoff(int fd, enum v4l2_buf_type type); |
| 53 | #else |
| 54 | int tvout_init(v4l2_std_id std_id); |
| 55 | int tvout_deinit(); |
| 56 | int tvout_v4l2_querycap(int fp); |
| 57 | int tvout_v4l2_g_std(int fp, v4l2_std_id *std_id); |
| 58 | int tvout_v4l2_s_std(int fp, v4l2_std_id std_id); |
| 59 | int tvout_v4l2_enum_std(int fp, struct v4l2_standard *std, v4l2_std_id std_id); |
| 60 | int tvout_v4l2_enum_output(int fp, struct v4l2_output *output); |
| 61 | int tvout_v4l2_s_output(int fp, int index); |
| 62 | int tvout_v4l2_g_output(int fp, int *index); |
| 63 | int tvout_v4l2_enum_fmt(int fp, struct v4l2_fmtdesc *desc); |
| 64 | int tvout_v4l2_g_fmt(int fp, int buf_type, void* ptr); |
| 65 | int tvout_v4l2_s_fmt(int fp, int buf_type, void *ptr); |
| 66 | int tvout_v4l2_g_fbuf(int fp, struct v4l2_framebuffer *frame); |
| 67 | int tvout_v4l2_s_fbuf(int fp, struct v4l2_framebuffer *frame); |
| 68 | int tvout_v4l2_s_baseaddr(int fp, void *base_addr); |
| 69 | int tvout_v4l2_g_crop(int fp, unsigned int type, struct v4l2_rect *rect); |
| 70 | int tvout_v4l2_s_crop(int fp, unsigned int type, struct v4l2_rect *rect); |
| 71 | int tvout_v4l2_start_overlay(int fp); |
| 72 | int tvout_v4l2_stop_overlay(int fp); |
| 73 | #endif |
| 74 | |
| 75 | int hdmi_init_layer(int layer); |
| 76 | int hdmi_deinit_layer(int layer); |
| 77 | #if defined(BOARD_USE_V4L2) |
| 78 | int hdmi_set_v_param(int fd, int layer, |
| 79 | int srcColorFormat, |
| 80 | int src_w, int src_h, |
| 81 | SecBuffer * dstBuffer, |
| 82 | int dst_x, int dst_y, int dst_w, int dst_h); |
| 83 | int hdmi_set_g_param(int fd, int layer, |
| 84 | int srcColorFormat, |
| 85 | int src_w, int src_h, |
| 86 | SecBuffer * dstBuffer, |
| 87 | int dst_x, int dst_y, int dst_w, int dst_h); |
| 88 | int hdmi_set_g_scaling(int layer, |
| 89 | int srcColorFormat, |
| 90 | int src_w, int src_h, |
| 91 | unsigned int src_address, SecBuffer * dstBuffer, |
| 92 | int dst_x, int dst_y, int dst_w, int dst_h, |
| 93 | int rotVal, unsigned int hwc_layer); |
| 94 | #else |
| 95 | int hdmi_set_v_param(int layer, |
| 96 | int src_w, int src_h, int colorFormat, |
| 97 | unsigned int src_y_address, unsigned int src_c_address, |
| 98 | int dst_w, int dst_h); |
| 99 | int hdmi_gl_set_param(int layer, |
| 100 | int srcColorFormat, |
| 101 | int src_w, int src_h, |
| 102 | unsigned int src_y_address, unsigned int src_c_address, |
| 103 | int dst_x, int dst_y, int dst_w, int dst_h, |
| 104 | int rotVal); |
| 105 | #endif |
| 106 | void hdmi_cal_rect(int src_w, int src_h, int dst_w, int dst_h, struct v4l2_rect *dst_rect); |
| 107 | #if defined(BOARD_USE_V4L2) |
| 108 | int hdmi_get_src_plane(int srcColorFormat, unsigned int *num_of_plane); |
| 109 | #endif |
| 110 | int hdmi_cable_status(); |
| 111 | int hdmi_outputmode_2_v4l2_output_type(int output_mode); |
| 112 | int hdmi_v4l2_output_type_2_outputmode(int v4l2_output_type); |
| 113 | int composite_std_2_v4l2_std_id(int std); |
| 114 | |
| 115 | int hdmi_check_output_mode(int v4l2_output_type); |
| 116 | #if defined(BOARD_USE_V4L2) |
| 117 | int hdmi_check_resolution(unsigned int preset_id); |
| 118 | int hdmi_resolution_2_preset_id(unsigned int resolution, int * w, int * h, unsigned int *preset_id); |
| 119 | #else |
| 120 | int hdmi_check_resolution(v4l2_std_id std_id); |
| 121 | int hdmi_resolution_2_std_id(unsigned int resolution, int *w, int *h, v4l2_std_id *std_id); |
| 122 | #endif |
| 123 | int hdmi_enable_hdcp(unsigned int hdcp_en); |
| 124 | int hdmi_check_audio(void); |
| 125 | |
| 126 | #ifdef __cplusplus |
| 127 | } |
| 128 | #endif |
| 129 | |
| 130 | } //namespace android |
| 131 | |
| 132 | #endif //__HDMI_HAL_V4L2_UTILS_H__ |