From 31e8afad6f747713b369ccb265ca7746994b9b53 Mon Sep 17 00:00:00 2001 From: Tellen Yu Date: Thu, 18 Feb 2016 10:07:55 +0000 Subject: remove the tv input warning and optimize the code Change-Id: I9f67161449a3d2d0b449bdc3e645156ef6fc9878 --- diff --git a/tv_input.cpp b/tv_input.cpp index 0fa778c..320c46c 100644 --- a/tv_input.cpp +++ b/tv_input.cpp @@ -106,11 +106,11 @@ void TvIputHal_ChannelConl(tv_input_private_t *priv, int ops_type, int device_id { if (priv->mpTv) { if (ops_type) { - LOGD ( "%s\, OpenSourceSwitchInput id = %d\n", __FUNCTION__, device_id ); + LOGD ( "%s, OpenSourceSwitchInput id = %d\n", __FUNCTION__, device_id ); priv->mpTv->StartTv(); priv->mpTv->SwitchSourceInput((tv_source_input_t) device_id); } else if (priv->mpTv->GetCurrentSourceInput() == device_id) { - LOGD ( "%s\, StopSourceSwitchInput id = %d\n", __FUNCTION__, device_id ); + LOGD ( "%s, StopSourceSwitchInput id = %d\n", __FUNCTION__, device_id ); priv->mpTv->StopTv(); } } @@ -338,6 +338,8 @@ author: "Amlogic" , methods: &tv_input_module_methods, +dso: NULL, +reserved: {0}, } }; @@ -418,7 +420,7 @@ static int tv_input_initialize(struct tv_input_device *dev, return 0; } -static int tv_input_get_stream_configurations(const struct tv_input_device *dev, +static int tv_input_get_stream_configurations(const struct tv_input_device *dev __unused, int device_id, int *num_configurations, const tv_stream_config_t **configs) { @@ -460,7 +462,8 @@ static int tv_input_close_stream(struct tv_input_device *dev, int device_id, } static int tv_input_request_capture( - struct tv_input_device *dev, int device_id, int stream_id, buffer_handle_t buffer, uint32_t seq) + struct tv_input_device *dev __unused, int device_id __unused, + int stream_id __unused, buffer_handle_t buffer __unused, uint32_t seq __unused) { return -EINVAL; } diff --git a/tvapi/android/jni/com_droidlogic_app_tv_TvControlManager.cpp b/tvapi/android/jni/com_droidlogic_app_tv_TvControlManager.cpp index f0fb381..0cc30df 100644 --- a/tvapi/android/jni/com_droidlogic_app_tv_TvControlManager.cpp +++ b/tvapi/android/jni/com_droidlogic_app_tv_TvControlManager.cpp @@ -22,11 +22,6 @@ struct fields_t { jmethodID post_event; }; -#ifdef LOG_TAG -#undef LOG_TAG -#define LOG_TAG "TvJNI" -#endif - static fields_t fields; static Mutex sLock; class JNITvContext: public TvListener { @@ -453,7 +448,7 @@ int register_com_droidlogic_app_tv_TvControlManager(JNIEnv *env) } -jint JNI_OnLoad(JavaVM *vm, void *reserved) +jint JNI_OnLoad(JavaVM *vm, void *reserved __unused) { JNIEnv *env = NULL; jint result = -1; diff --git a/tvapi/android/libtvbinder/TvClient.cpp b/tvapi/android/libtvbinder/TvClient.cpp index 432be8b..5babae8 100644 --- a/tvapi/android/libtvbinder/TvClient.cpp +++ b/tvapi/android/libtvbinder/TvClient.cpp @@ -168,13 +168,13 @@ void TvClient::notifyCallback(int32_t msgType, const Parcel &p) } } -void TvClient::binderDied(const wp &who) +void TvClient::binderDied(const wp &who __unused) { ALOGW("ITv died"); //notifyCallback(1, 2, 0); } -void TvClient::DeathNotifier::binderDied(const wp &who) +void TvClient::DeathNotifier::binderDied(const wp &who __unused) { ALOGW("-----------------binderDied"); Mutex::Autolock _l(TvClient::mLock); diff --git a/tvapi/android/tvserver/TvService.cpp b/tvapi/android/tvserver/TvService.cpp index 082c876..7cd5907 100644 --- a/tvapi/android/tvserver/TvService.cpp +++ b/tvapi/android/tvserver/TvService.cpp @@ -1,3 +1,5 @@ +#define LOG_TAG "TvService" + #include #include #include @@ -29,7 +31,6 @@ extern "C" { #include "make_ext4fs.h" #include "am_ver.h" } -#define LOG_TAG "TvService" #define PICTURE_TIMEOUT seconds(5) @@ -608,8 +609,8 @@ void TvService::Client::disconnect() status_t TvService::Client::createVideoFrame(const sp &share_mem, int iSourceMode, int iCapVideoLayerOnly) { - LOGD(" mem=%p size=%d", share_mem->pointer() == NULL, share_mem->size()); - LOGD("iSourceMode :%d iCapVideoLayerOnly = %d \n", iSourceMode, iCapVideoLayerOnly); + LOGD(" mem=%d size=%d", share_mem->pointer() == NULL, share_mem->size()); + LOGD("iSourceMode :%d iCapVideoLayerOnly = %d \n", iSourceMode, iCapVideoLayerOnly); int Len = 0; Mutex::Autolock lock(mLock); mTvService->mCapVidFrame.InitVCap(share_mem); @@ -2947,20 +2948,20 @@ status_t TvService::Client::processCmd(const Parcel &p, Parcel *r) break; } case MISC_SERIAL_SEND_DATA: { - int i = 0, tmp_buf_size = 0, ret = 0; + int i = 0, bufSize = 0, ret = 0; int dev_id = p.readInt32(); - tmp_buf_size = p.readInt32(); - if (tmp_buf_size > sizeof(tmp_uc_buf)) { - tmp_buf_size = sizeof(tmp_uc_buf); + bufSize = p.readInt32(); + if (bufSize > (int)sizeof(tmp_uc_buf)) { + bufSize = sizeof(tmp_uc_buf); } - for (i = 0; i < tmp_buf_size; i++) { + for (i = 0; i < bufSize; i++) { tmp_uc_buf[i] = p.readInt32() & 0xFF; } - ret = mpTv->SendSerialData(dev_id, tmp_buf_size, tmp_uc_buf); + ret = mpTv->SendSerialData(dev_id, bufSize, tmp_uc_buf); r->writeInt32(ret); break; } @@ -3114,7 +3115,7 @@ status_t TvService::Client::processCmd(const Parcel &p, Parcel *r) } case DTV_GET_SCAN_FREQUENCY_LIST: { Vector > out; - int tmpRet = CTvRegion::getChannelListByName("CHINA,Default DTMB ALL", out); + int tmpRet = CTvRegion::getChannelListByName((char *)"CHINA,Default DTMB ALL", out); r->writeInt32(out.size()); for (int i = 0; i < (int)out.size(); i++) { r->writeInt32(out[i]->getID()); @@ -4394,6 +4395,8 @@ sp TvService::Client::getClientFromCookie(void *user) LOGE("getClientFromCookie: got callback but client was NULL"); } }*/ + + user = user;//for warning return client; } @@ -4419,6 +4422,10 @@ void TvService::Client::notifyCallback(int32_t msgType, int32_t ext1, int32_t ex break; } + //for warning + ext1 = ext1; + ext2 = ext2; + #if DEBUG_CLIENT_REFERENCES if (client->getStrongCount() == 1) { LOGE("++++++++++++++++ (NOTIFY CALLBACK) THIS WILL CAUSE A LOCKUP!"); diff --git a/tvapi/android/tvserver/main.cpp b/tvapi/android/tvserver/main.cpp index 0218dbe..f26b7cb 100644 --- a/tvapi/android/tvserver/main.cpp +++ b/tvapi/android/tvserver/main.cpp @@ -9,7 +9,7 @@ using namespace android; -int main(int argc, char **argv) +int main(int argc __unused, char **argv __unused) { sp proc(ProcessState::self()); sp sm = defaultServiceManager(); diff --git a/tvapi/libtv/audio/CTvAudio.cpp b/tvapi/libtv/audio/CTvAudio.cpp index ffa9149..9b1f0fa 100644 --- a/tvapi/libtv/audio/CTvAudio.cpp +++ b/tvapi/libtv/audio/CTvAudio.cpp @@ -1,3 +1,5 @@ +#define LOG_TAG "CTvAudio" + #include #include #include @@ -14,15 +16,13 @@ #include "audio_effect.h" #include "CTvAudio.h" -#define LOG_TAG "CTvAudio" #include "CTvLog.h" CTvAudio::CTvAudio() { - } CTvAudio::~CTvAudio() { - } + diff --git a/tvapi/libtv/audio/audio_alsa.cpp b/tvapi/libtv/audio/audio_alsa.cpp index 8e8bb78..ab3014f 100644 --- a/tvapi/libtv/audio/audio_alsa.cpp +++ b/tvapi/libtv/audio/audio_alsa.cpp @@ -1,3 +1,5 @@ +#define LOG_TAG "CAudioAlsa" + #include #include #include @@ -15,7 +17,6 @@ #include "tvsetting/audio_cfg.h" #include "audio_alsa.h" #include -#define LOG_TAG "CAudioAlsa" #include "CTvLog.h" #include "audio_amaudio.h" @@ -206,7 +207,7 @@ int CAudioAlsa::HandleUSBAudioControlValue(int val_count, int data_buf[], int ma goto err_exit; } - for (match_index = 0; match_index < match_count; match_index++) { + for (match_index = 0; match_index < (unsigned int)match_count; match_index++) { pctl = mixer_get_ctl_by_name(mpUsbMixer, match_names[match_index]); if (NULL == pctl) { LOGE("[%s:%d] Failed to get mixer control for:%s\n", __FUNCTION__, __LINE__, match_names[match_index]); @@ -230,11 +231,9 @@ err_exit: return -1; } -int CAudioAlsa::CheckVolume(int digit_vol, int digit_min, int digit_max, int hd_min, - int hd_max) +int CAudioAlsa::CheckVolume(int digit_vol, int digit_min __unused, int digit_max __unused, + int hd_min, int hd_max) { - int tmp_val = digit_vol; - if (digit_vol < hd_min) { return hd_min; } else if (digit_vol > hd_max) { @@ -244,9 +243,11 @@ int CAudioAlsa::CheckVolume(int digit_vol, int digit_min, int digit_max, int hd_ return digit_vol; } -int CAudioAlsa::GetTwoChannelVolume(int vol_buf[], int l_min_vol, int l_max_vol, - int r_min_vol, int r_max_vol, char *match_names, int hd_min, - int hd_max) +int CAudioAlsa::GetTwoChannelVolume(int vol_buf[], + int l_min_vol __unused, int l_max_vol __unused, + int r_min_vol __unused, int r_max_vol __unused, + char *match_names, + int hd_min __unused, int hd_max __unused) { vol_buf[0] = 0; vol_buf[1] = 0; @@ -255,13 +256,11 @@ int CAudioAlsa::GetTwoChannelVolume(int vol_buf[], int l_min_vol, int l_max_vol, int CAudioAlsa::GetLineInMaxVol() { - return 127; } int CAudioAlsa::GetLineOutMaxVol() { - return 255; } @@ -676,27 +675,22 @@ int CAudioAlsa::SetMixerDacSwitch(int switch_val) int CAudioAlsa::GetMixerDacSwitch(void) { - char *match_names = "Output Mixer DAC Switch" ; int ctl_buf[2]; - - AudioControlGetValue(2, ctl_buf, match_names); - + AudioControlGetValue(2, ctl_buf, (char *)"Output Mixer DAC Switch"); return ctl_buf[0]; } int CAudioAlsa::TransVolumeBarVolToDigitalVol(int digit_lut_buf[], int digit_vol) { - return digit_lut_buf[digit_vol]; } -int CAudioAlsa::TransDigitalVolToVolumeBarVol(int digit_lut_buf[], int hd_vol, int hd_min, - int hd_max, int digit_min, int digit_max) +int CAudioAlsa::TransDigitalVolToVolumeBarVol(int digit_lut_buf[], int hd_vol, + int hd_min __unused, int hd_max __unused, + int digit_min __unused, int digit_max) { - int i; - - - for (i = 0; i < CC_VOL_TRANS_LUT_BUF_SIZE - 1; i++) { + int i = 0; + for (; i < CC_VOL_TRANS_LUT_BUF_SIZE - 1; i++) { if (digit_lut_buf[i] >= hd_vol && digit_lut_buf[i + 1] < hd_vol) break; } @@ -756,7 +750,6 @@ int CAudioAlsa::CalculateBalanceVol(int max_vol, int balance_val, int vol_buf[]) int bal_mid_vol = 0, bal_cal_len = 0; int tmp_val = 0; - vol_buf[0] = max_vol; vol_buf[1] = max_vol; diff --git a/tvapi/libtv/audio/audio_effect.cpp b/tvapi/libtv/audio/audio_effect.cpp index 05a0ee3..8992f5f 100644 --- a/tvapi/libtv/audio/audio_effect.cpp +++ b/tvapi/libtv/audio/audio_effect.cpp @@ -19,6 +19,7 @@ CAudioEffect::CAudioEffect() { } + CAudioEffect::~CAudioEffect() { } @@ -28,7 +29,6 @@ int CAudioEffect::GetEQBandCount() return CC_BAND_ITEM_CNT; } - int CAudioEffect::SetEQSwitch(int switch_val) { int tmp_ret = 0; @@ -49,9 +49,8 @@ int CAudioEffect::SetEQValue(int gain_val_buf[]) return tmp_ret; } -int CAudioEffect::GetEQValue(int gain_val_buf[]) +int CAudioEffect::GetEQValue(int gain_val_buf[] __unused) { - int tmp_ret = 0; return 0; } @@ -75,6 +74,7 @@ int CAudioEffect::SetSrsInputOutputGain(int input_gain_val, int output_gain_val) tmp_ret |= amAudioSetSRSGain(input_gain_val, output_gain_val); return tmp_ret; } + int CAudioEffect::SetSrsTruBassSwitch(int switch_val) { int tmp_ret = 0; @@ -117,11 +117,15 @@ int CAudioEffect::SetSrsTrubassSpeakerSize(int set_val) return tmp_ret; } -int CAudioEffect::DbxTv_SetMode(int mode, int son_value, int vol_value, int sur_value) +int CAudioEffect::DbxTv_SetMode(int mode __unused, int son_value, int vol_value, int sur_value) { + son_value = son_value; + vol_value = vol_value; + sur_value = sur_value; + int ret = 0; #ifdef TV_AUDIO_USE_DBX_TV - ret |= amAudioSetDBXTVParameter( son_value, vol_value, sur_value); + ret |= amAudioSetDBXTVParameter( son_value, vol_value, sur_value); #endif return ret; } diff --git a/tvapi/libtv/tv/AutoBackLight.cpp b/tvapi/libtv/tv/AutoBackLight.cpp index ae13228..db15955 100644 --- a/tvapi/libtv/tv/AutoBackLight.cpp +++ b/tvapi/libtv/tv/AutoBackLight.cpp @@ -1,3 +1,5 @@ +#define LOG_TAG "AutoBackLight" + #include "AutoBackLight.h" #include "../tvsetting/CTvSetting.h" #include "../tvconfig/tvconfig.h" @@ -15,11 +17,6 @@ #include #include -#ifdef LOG_TAG -#undef LOG_TAG -#define LOG_TAG "AutoBackLight" -#endif - AutoBackLight::AutoBackLight() { mAutoBacklightSource = SOURCE_TYPE_TV; diff --git a/tvapi/libtv/tv/CAutoPQparam.cpp b/tvapi/libtv/tv/CAutoPQparam.cpp index 18b36bd..fe4fc59 100644 --- a/tvapi/libtv/tv/CAutoPQparam.cpp +++ b/tvapi/libtv/tv/CAutoPQparam.cpp @@ -1,3 +1,5 @@ +#define LOG_TAG "CAutoPQ" + #include "CAutoPQparam.h" #include "../tvsetting/CTvSetting.h" #include "../tvconfig/tvconfig.h" @@ -15,11 +17,6 @@ #include #include -#ifdef LOG_TAG -#undef LOG_TAG -#define LOG_TAG "CAutoPQ" -#endif - CAutoPQparam::CAutoPQparam() { preFmtType = 0; @@ -96,9 +93,9 @@ int CAutoPQparam::adjustPQparameters() if (new_frame_count != 0) { - fd = open("/sys/class/video/frame_height", O_RDONLY); + fd = open(SYS_VIDEO_FRAME_HEIGHT, O_RDONLY); if (fd <= 0) { - LOGE("open /sys/class/video/frame_height ERROR!!error = -%s- \n", strerror ( errno )); + LOGE("open %s ERROR!!error = -%s- \n",SYS_VIDEO_FRAME_HEIGHT, strerror ( errno )); return -1; } memset(s, 0, sizeof(s)); diff --git a/tvapi/libtv/tv/CAv.cpp b/tvapi/libtv/tv/CAv.cpp index 54f44e2..e8421c7 100644 --- a/tvapi/libtv/tv/CAv.cpp +++ b/tvapi/libtv/tv/CAv.cpp @@ -1,5 +1,6 @@ -#include "CAv.h" #define LOG_TAG "CAv" + +#include "CAv.h" #include "../tvutils/tvutils.h" #include "../tvconfig/tvconfig.h" #include @@ -9,6 +10,7 @@ #include #include #include + CAv::CAv() { mpObserver = NULL; @@ -211,13 +213,13 @@ int CAv::EnableVideoWhenVideoPlaying(int minFrameCount, int waitTime) bool CAv::videoIsPlaying(int minFrameCount) { - int value[3]; + int value[3] = {0}; value[0] = getVideoFrameCount(); usleep(20 * 1000); value[1] = getVideoFrameCount(); //usleep(20*1000); //value[2] = getVideoFrameCount(); - LOGD("---videoIsPlaying framecount =%d = %d = %d", value[0], value[1], value[2]); + LOGD("---videoIsPlaying framecount =%d = %d = %d", value[0], value[1], value[2]); if (value[1] >= minFrameCount && (value[1] > value[0])) return true; else return false; } @@ -241,7 +243,7 @@ int CAv::getVideoFrameCount() tvin_sig_fmt_t CAv::getVideoResolutionToFmt() { tvin_sig_fmt_e sig_fmt = TVIN_SIG_FMT_HDMI_1920X1080P_60HZ; - int height = CFile::getFileAttrValue(PATH_VIDEO_HEIGHT); + int height = CFile::getFileAttrValue(SYS_VIDEO_FRAME_HEIGHT); LOGD("---------getVideoResolutionToFmt -------- height = %d", height); if (height <= 576) { sig_fmt = TVIN_SIG_FMT_HDMI_720X480P_60HZ; @@ -410,7 +412,8 @@ void CAv::av_evt_callback ( long dev_no, int event_type, void *param, void *user default: break; } - LOGD ( "%s, av_evt_callback : dev_no %d type %d param = %d\n", __FUNCTION__, dev_no, pAv->mCurAvEvent.type , (int)param); + LOGD ( "%s, av_evt_callback : dev_no %ld type %d param = %d\n", + __FUNCTION__, dev_no, pAv->mCurAvEvent.type , (int)param); } int CAv::set3DMode(VIDEO_3D_MODE_T mode, int LR_switch, int mode_3D_TO_2D) diff --git a/tvapi/libtv/tv/CAv.h b/tvapi/libtv/tv/CAv.h index b95b490..eb16a1b 100644 --- a/tvapi/libtv/tv/CAv.h +++ b/tvapi/libtv/tv/CAv.h @@ -15,7 +15,6 @@ static const char *PATH_3D_SCALER = "/sys/module/amvideo/parameters/force_3d_sca static const char *PATH_VIDEO_SCALER = "/sys/class/video/stereo_scaler"; static const char *PATH_MEPG_DTMB_LOOKUP_PTS_FLAG = "/sys/module/amvdec_mpeg12/parameters/dtmb_flag"; -static const char *PATH_VIDEO_HEIGHT = "/sys/class/video/frame_height"; /*cmd use for 3d operation*/ #define MODE_3D_DISABLE 0x00000000 #define MODE_3D_ENABLE 0x00000001 diff --git a/tvapi/libtv/tv/CFbcCommunication.cpp b/tvapi/libtv/tv/CFbcCommunication.cpp index 1e4749d..8ca5391 100644 --- a/tvapi/libtv/tv/CFbcCommunication.cpp +++ b/tvapi/libtv/tv/CFbcCommunication.cpp @@ -1,9 +1,10 @@ +#define LOG_TAG "FBC" + #include #include "CFbcCommunication.h" #include "CTvLog.h" #include "../tvconfig/tvconfig.h" #include "../tvutils/tvutils.h" -#define LOG_TAG "FBC" static CFbcCommunication *gSingletonFBC = NULL; CFbcCommunication *GetSingletonFBC() @@ -121,17 +122,17 @@ void CFbcCommunication::showTime(struct timeval *_time) curTime.tv_usec = _time->tv_usec; } if (curTime.tv_usec > 100000) { - LOGD("[%d.%d]", curTime.tv_sec, curTime.tv_usec); + LOGD("[%ld.%ld]", curTime.tv_sec, curTime.tv_usec); } else if (curTime.tv_usec > 10000) { - LOGD("[%d.0%d]", curTime.tv_sec, curTime.tv_usec); + LOGD("[%ld.0%ld]", curTime.tv_sec, curTime.tv_usec); } else if (curTime.tv_usec > 1000) { - LOGD("[%d.00%d]", curTime.tv_sec, curTime.tv_usec); + LOGD("[%ld.00%ld]", curTime.tv_sec, curTime.tv_usec); } else if (curTime.tv_usec > 100) { - LOGD("[%d.000%d]", curTime.tv_sec, curTime.tv_usec); + LOGD("[%ld.000%ld]", curTime.tv_sec, curTime.tv_usec); } else if (curTime.tv_usec > 10) { - LOGD("[%d.0000%d]", curTime.tv_sec, curTime.tv_usec); + LOGD("[%ld.0000%ld]", curTime.tv_sec, curTime.tv_usec); } else if (curTime.tv_usec > 1) { - LOGD("[%d.00000%d]", curTime.tv_sec, curTime.tv_usec); + LOGD("[%ld.00000%ld]", curTime.tv_sec, curTime.tv_usec); } } long CFbcCommunication::getTime(void) @@ -191,7 +192,7 @@ unsigned int CFbcCommunication::GetCrc32(unsigned char *InStr, unsigned int len) { //开始计算CRC32校验便 unsigned int Crc = 0xffffffff; - for (int i = 0; i < len; i++) { + for (int i = 0; i < (int)len; i++) { Crc = (Crc >> 8) ^ mCrc32Table[(Crc & 0xFF) ^ InStr[i]]; } @@ -205,8 +206,8 @@ unsigned int CFbcCommunication::Calcrc32(unsigned int crc, const unsigned char * 0xedb88320, 0xf00f9344, 0xd6d6a3e8, 0xcb61b38c, 0x9b64c2b0, 0x86d3d2d4, 0xa00ae278, 0xbdbdf21c }; unsigned int crcu32 = crc; - if (buf_len < 0) - return 0; + //if (buf_len < 0) + // return 0; if (!ptr) return 0; crcu32 = ~crcu32; while (buf_len--) { @@ -217,7 +218,7 @@ unsigned int CFbcCommunication::Calcrc32(unsigned int crc, const unsigned char * return ~crcu32; } -int CFbcCommunication::sendDataOneway(int devno, unsigned char *pData, int dataLen, int flags) +int CFbcCommunication::sendDataOneway(int devno, unsigned char *pData, int dataLen, int flags __unused) { int ret = -1; switch (devno) { @@ -244,6 +245,7 @@ int CFbcCommunication::addToRequestList() { return 0; } + //timeout ms int CFbcCommunication::sendDataAndWaitReply(int devno, int waitForDevno, int waitForCmd, unsigned char *pData, int dataLen, int timeout, unsigned char *pReData, int *reDataLen, int flags) { @@ -260,7 +262,7 @@ int CFbcCommunication::sendDataAndWaitReply(int devno, int waitForDevno, int wai mLock.lock(); ret = mReplyList.WaitReplyCondition.waitRelative(mLock, timeout);//wait reply - LOGD("wait reply return = %d", __FUNCTION__, __LINE__, ret); + LOGD("%s, %d, wait reply return = %d", __FUNCTION__, __LINE__, ret); mLock.unlock(); // @@ -310,12 +312,14 @@ int CFbcCommunication::handleCmd(COMM_DEV_TYPE_E fromDev, int *pData, int *pRetV cfbc_Set_Gain_Red(fromDev, pData[2]); break; - case VPU_CMD_RED_GAIN_DEF|0x80: + /* + //case value '192' not in enumerated type 'fbc_command_t + case (VPU_CMD_RED_GAIN_DEF|0x80): cfbc_Get_Gain_Red(fromDev, &ret_value); pRetValue[0] = VPU_CMD_RED_GAIN_DEF | 0x80; pRetValue[1] = 3; pRetValue[2] = ret_value; - break; + break;*/ case VPU_CMD_PATTEN_SEL: cfbc_Set_Test_Pattern(fromDev, pData[2]); @@ -325,12 +329,14 @@ int CFbcCommunication::handleCmd(COMM_DEV_TYPE_E fromDev, int *pData, int *pRetV cfbc_Set_Backlight(fromDev, pData[2]); break; - case VPU_CMD_PATTEN_SEL|0x80: + /* + //case value '170' not in enumerated type 'fbc_command_t + case (VPU_CMD_PATTEN_SEL|0x80): cfbc_Get_Test_Pattern(fromDev, &ret_value); pRetValue[0] = VPU_CMD_RED_GAIN_DEF | 0x80; pRetValue[1] = 3; pRetValue[2] = ret_value; - break; + break;*/ default: return -1; @@ -817,8 +823,6 @@ bool CFbcCommunication::threadLoop() return false; } - - int CFbcCommunication::Fbc_Set_Value_INT8(COMM_DEV_TYPE_E toDev, int cmd_type, int value) { if (mUpgradeFlag == 1) { @@ -1479,11 +1483,13 @@ int CFbcCommunication::cfbc_Set_FBC_User_Setting_Default(COMM_DEV_TYPE_E fromDev return Fbc_Set_BatchValue(fromDev, cmd, 2); } + int CFbcCommunication::cfbc_SendRebootToUpgradeCmd(COMM_DEV_TYPE_E fromDev, int value) { return Fbc_Set_Value_INT32(fromDev, FBC_REBOOT_UPGRADE, value); } -int CFbcCommunication::cfbc_FBC_Send_Key_To_Fbc(COMM_DEV_TYPE_E fromDev, int keycode, int param) + +int CFbcCommunication::cfbc_FBC_Send_Key_To_Fbc(COMM_DEV_TYPE_E fromDev, int keycode __unused, int param __unused) { unsigned char cmd[512]; @@ -1793,7 +1799,7 @@ int CFbcCommunication::cfbc_Set_AUTO_ELEC_MODE(COMM_DEV_TYPE_E fromDev, int valu return Fbc_Set_Value_INT8(fromDev, VPU_CMD_SET_ELEC_MODE, value); } -int CFbcCommunication::cfbc_Get_AUTO_ELEC_MODE(COMM_DEV_TYPE_E fromDev, int *value) +int CFbcCommunication::cfbc_Get_AUTO_ELEC_MODE(COMM_DEV_TYPE_E fromDev __unused, int *value __unused) { return 0; } @@ -1811,7 +1817,7 @@ int CFbcCommunication::cfbc_Set_LightSensor_N310(COMM_DEV_TYPE_E fromDev, int va // return Fbc_Set_Value_INT8(fromDev, CMD_LIGHT_SENSOR, value); } -int CFbcCommunication::cfbc_Get_LightSensor_N310(COMM_DEV_TYPE_E fromDev, int *value) +int CFbcCommunication::cfbc_Get_LightSensor_N310(COMM_DEV_TYPE_E fromDev __unused, int *value __unused) { // return Fbc_Get_Value_INT8(fromDev, CMD_LIGHT_SENSOR|0x80, value); return 0; @@ -1823,7 +1829,7 @@ int CFbcCommunication::cfbc_Set_Dream_Panel_N310(COMM_DEV_TYPE_E fromDev, int va // return Fbc_Set_Value_INT8(fromDev, CMD_DREAM_PANEL, value); } -int CFbcCommunication::cfbc_Get_Dream_Panel_N310(COMM_DEV_TYPE_E fromDev, int *value) +int CFbcCommunication::cfbc_Get_Dream_Panel_N310(COMM_DEV_TYPE_E fromDev __unused, int *value __unused) { // return Fbc_Get_Value_INT8(fromDev, CMD_DREAM_PANEL|0x80, value); return 0; @@ -1835,7 +1841,7 @@ int CFbcCommunication::cfbc_Set_MULT_PQ_N310(COMM_DEV_TYPE_E fromDev, int value) // return Fbc_Set_Value_INT8(fromDev, CMD_MUTI_PQ, value); } -int CFbcCommunication::cfbc_Get_MULT_PQ_N310(COMM_DEV_TYPE_E fromDev, int *value) +int CFbcCommunication::cfbc_Get_MULT_PQ_N310(COMM_DEV_TYPE_E fromDev __unused, int *value __unused) { // return Fbc_Get_Value_INT8(fromDev, CMD_MUTI_PQ|0x80, value); return 0; @@ -1847,11 +1853,12 @@ int CFbcCommunication::cfbc_Set_MEMC_N310(COMM_DEV_TYPE_E fromDev, int value) // return Fbc_Set_Value_INT8(fromDev, CMD_MEMC, value); } -int CFbcCommunication::cfbc_Get_MEMC_N310(COMM_DEV_TYPE_E fromDev, int *value) +int CFbcCommunication::cfbc_Get_MEMC_N310(COMM_DEV_TYPE_E fromDev __unused, int *value __unused) { // return Fbc_Get_Value_INT8(fromDev, CMD_MEMC|0x80, value); return 0; } + int CFbcCommunication::cfbc_Set_Bluetooth_IIS_onoff(COMM_DEV_TYPE_E fromDev, int value) { return Fbc_Set_Value_INT8(fromDev, CMD_BLUETOOTH_I2S_STATUS, value); @@ -1861,6 +1868,7 @@ int CFbcCommunication::cfbc_Get_Bluetooth_IIS_onoff(COMM_DEV_TYPE_E fromDev, int { return Fbc_Get_Value_INT8(fromDev, CMD_BLUETOOTH_I2S_STATUS | 0x80, value); } + int CFbcCommunication::cfbc_Set_Led_onoff(COMM_DEV_TYPE_E fromDev, int val_1, int val_2, int val_3) { unsigned char cmd[512]; diff --git a/tvapi/libtv/tv/CFrontEnd.cpp b/tvapi/libtv/tv/CFrontEnd.cpp index 5453a26..c45e62b 100644 --- a/tvapi/libtv/tv/CFrontEnd.cpp +++ b/tvapi/libtv/tv/CFrontEnd.cpp @@ -1,3 +1,5 @@ +#define LOG_TAG "CFrontEnd" + #include #include #include @@ -20,7 +22,6 @@ extern "C" { #include "linux/videodev2.h" #include "am_fend_ctrl.h" } -#define LOG_TAG "CFrontEnd" CFrontEnd::CFrontEnd() { @@ -193,7 +194,7 @@ int CFrontEnd::GetTSSource(AM_DMX_Source_t *src) return 0; } -void CFrontEnd::dmd_fend_callback(long dev_no, int event_type, void *param, void *user_data) +void CFrontEnd::dmd_fend_callback(long dev_no __unused, int event_type __unused, void *param, void *user_data) { CFrontEnd *pFront = (CFrontEnd *)user_data; if (NULL == pFront) { @@ -468,7 +469,7 @@ int CFrontEnd::setThreadDelay(int delay) } } -int CFrontEnd::lock(int frequency, int symbol_rate, int modulation, int bandwidth) +int CFrontEnd::lock(int frequency, int symbol_rate, int modulation, int bandwidth __unused) { int rt = -1; struct dvb_frontend_parameters fparam; diff --git a/tvapi/libtv/tv/CTv.cpp b/tvapi/libtv/tv/CTv.cpp index ca6510e..e435be7 100644 --- a/tvapi/libtv/tv/CTv.cpp +++ b/tvapi/libtv/tv/CTv.cpp @@ -6,6 +6,8 @@ // @ File Name : CTv.cpp // @ Date : 2013-11 // @ Author : +#define LOG_TAG "CTv" + #include #include #include @@ -58,9 +60,6 @@ extern "C" { #include "CTv.h" -#define LOG_TAG "CTv" - - using namespace android; // Called each time a message is logged. @@ -449,29 +448,6 @@ void CTv::CTvMsgQueue::handleMessage ( CMessage &msg ) } } -void CTv::onHdmiSrChanged(int sr, bool bInit) -{ - if (bInit) { - LOGD ( "%s, Init HDMI audio, sampling rate:%d", __FUNCTION__, sr ); - sr = HanldeAudioInputSr(sr); - InitTvAudio (sr, CC_IN_USE_SPDIF_DEVICE); - } else { - LOGD ( "%s, Reset HDMI sampling rate to %d", __FUNCTION__, sr ); - AudioChangeSampleRate ( sr ); - } -} - -void CTv::onHMDIAudioStatusChanged(int status) -{ - if (status == 0) {//change to no audio data - SetAudioMuteForTv ( CC_AUDIO_MUTE ); - } else if (status == 1) {//change to audio data come - Tv_SetAudioInSource(m_source_input); - usleep(200 * 1000); - SetAudioMuteForTv ( CC_AUDIO_UNMUTE ); - } -} - void CTv::CTvMsgQueue::onEvent ( const CTvScanner::ScannerEvent &ev ) { CMessage msg; @@ -508,6 +484,29 @@ void CTv::CTvMsgQueue::onEvent(const CAv::AVEvent &ev) this->sendMsg ( msg ); } +void CTv::onHdmiSrChanged(int sr, bool bInit) +{ + if (bInit) { + LOGD ( "%s, Init HDMI audio, sampling rate:%d", __FUNCTION__, sr ); + sr = HanldeAudioInputSr(sr); + InitTvAudio (sr, CC_IN_USE_SPDIF_DEVICE); + } else { + LOGD ( "%s, Reset HDMI sampling rate to %d", __FUNCTION__, sr ); + AudioChangeSampleRate ( sr ); + } +} + +void CTv::onHMDIAudioStatusChanged(int status) +{ + if (status == 0) {//change to no audio data + SetAudioMuteForTv ( CC_AUDIO_MUTE ); + } else if (status == 1) {//change to audio data come + Tv_SetAudioInSource(m_source_input); + usleep(200 * 1000); + SetAudioMuteForTv ( CC_AUDIO_UNMUTE ); + } +} + int CTv::setTvObserver ( TvIObserver *ob ) { mpObserver = ob; @@ -615,7 +614,7 @@ int CTv::dtvAutoScanAtscLock(int attenna, int videoStd, int audioStd) } //searchType 0:not 256 1:is 256 Program -int CTv::atvAutoScan(int videoStd, int audioStd, int searchType) +int CTv::atvAutoScan(int videoStd __unused, int audioStd __unused, int searchType) { int minScanFreq, maxScanFreq, vStd, aStd; AutoMutex lock ( mLock ); @@ -662,7 +661,7 @@ int CTv::atvAutoScan(int videoStd, int audioStd, int searchType) return 0; } -int CTv::clearAllProgram(int arg0) +int CTv::clearAllProgram(int arg0 __unused) { CTvProgram::CleanAllProgramBySrvType ( CTvProgram::TYPE_ATV ); CTvProgram::CleanAllProgramBySrvType ( CTvProgram::TYPE_TV ); @@ -805,6 +804,8 @@ int CTv::playProgramLock ( int progId ) channel = AM_AOUT_OUTPUT_DUAL_RIGHT; } setAudioChannel((int)channel);*/ + + progId = progId; return 0; } @@ -902,10 +903,9 @@ int CTv::getAudioInfoByIndex ( int progId, int idx, int *pAFmt, String8 &lang ) return iOutRet; } -int CTv::switchAudioTrack ( int aPid, int aFmt, int aParam ) +int CTv::switchAudioTrack (int aPid, int aFmt, int aParam __unused) { int iOutRet = 0; - do { if ( aPid < 0 || aFmt < 0 ) { break; @@ -971,7 +971,7 @@ int CTv::ResetAudioDecoderForPCMOutput() } int CTv::playDtvProgram ( int mode, int freq, int para1, int para2, - int vpid, int vfmt, int apid, int afmt, int pcr, int audioCompetation) + int vpid, int vfmt, int apid, int afmt, int pcr __unused, int audioCompetation) { AutoMutex lock ( mLock ); mTvAction |= TV_ACTION_PLAYING; @@ -984,7 +984,7 @@ int CTv::playDtvProgram ( int mode, int freq, int para1, int para2, mFrontDev.setPara ( mode, freq, para1, para2); mTvAction |= TV_ACTION_PLAYING; startPlayTv ( SOURCE_DTV, vpid, apid, vfmt, afmt ); - // + CMessage msg; msg.mDelayMs = 2000; msg.mType = CTvMsgQueue::TV_MSG_CHECK_FE_DELAY; @@ -1043,7 +1043,7 @@ int CTv::playDtmbProgram ( int progId ) return 0; } -int CTv::playAtvProgram (int freq, int videoStd, int audioStd, int fineTune, int audioCompetation) +int CTv::playAtvProgram (int freq, int videoStd, int audioStd, int fineTune __unused, int audioCompetation) { mTvAction |= TV_ACTION_PLAYING; if ( m_blackout_enable == 1 ) { @@ -1144,7 +1144,7 @@ int CTv::SetCurProgramAudioVolumeCompensationVal ( int tmpVal ) return 0; } -int CTv::GetAudioVolumeCompensationVal(int progxxId) +int CTv::GetAudioVolumeCompensationVal(int progxxId __unused) { int tmpVolValue = 0; CTvProgram prog; @@ -1296,7 +1296,7 @@ int CTv::getChannelInfoBydbID ( int dbID, channel_info_t &chan_info ) if ( CTvProgram::TYPE_ATV == prog.getProgType() ) { chan_info.freq = channel.getFrequency(); chan_info.uInfo.atvChanInfo.finefreq = channel.getAfcData(); - LOGD("%s, get channel std = %lld", __FUNCTION__, channel.getStd()); + LOGD("%s, get channel std = %d", __FUNCTION__, channel.getStd()); chan_info.uInfo.atvChanInfo.videoStd = ( atv_video_std_t ) CFrontEnd::stdAndColorToVideoEnum ( channel.getStd() ); chan_info.uInfo.atvChanInfo.audioStd = @@ -1365,22 +1365,20 @@ int CTv::getDTVProgramID ( void ) int CTv::getATVMinMaxFreq ( int *scanMinFreq, int *scanMaxFreq ) { - int tmpVal, i = 0; - const char *config_value; const char *strDelimit = ","; char *token = NULL; *scanMinFreq = 44250000; *scanMaxFreq = 868250000; - config_value = config_get_str ( CFG_SECTION_ATV, "atv.get.min.max.freq", "null" ); - if ( strcmp ( config_value, "null" ) == 0 ) { - LOGD ( "%s, atv.get.min.max.freq not set config\n", __FUNCTION__ ); + const char *freqList = config_get_str ( CFG_SECTION_ATV, CFG_ATV_FREQ_LIST, "null" ); + if ( strcmp ( freqList, "null" ) == 0 ) { + LOGE( "%s, atv freq list is null \n", __FUNCTION__ ); return -1; } char data_str[512] = {0}; - strncpy ( data_str, config_value, sizeof ( data_str ) - 1 ); + strncpy ( data_str, freqList, sizeof ( data_str ) - 1 ); char *pSave; token = strtok_r ( data_str, strDelimit, &pSave); @@ -1416,22 +1414,18 @@ tv_source_input_t CTv::GetLastSourceInput ( void ) int CTv::isVgaFmtInHdmi ( void ) { - tvin_sig_fmt_t fmt = mSigDetectThread.getCurSigInfo().fmt; - if ( CTvin::Tvin_SourceInputToSourceInputType(m_source_input) != SOURCE_TYPE_HDMI ) { return -1; } - return CTvin::isVgaFmtInHdmi ( fmt ); + return CTvin::isVgaFmtInHdmi (mSigDetectThread.getCurSigInfo().fmt); } int CTv::isSDFmtInHdmi ( void ) { - tvin_sig_fmt_t fmt = mSigDetectThread.getCurSigInfo().fmt; - if ( CTvin::Tvin_SourceInputToSourceInputType(m_source_input) != SOURCE_TYPE_HDMI ) { return -1; } - return CTvin::isSDFmtInHdmi ( fmt ); + return CTvin::isSDFmtInHdmi (mSigDetectThread.getCurSigInfo().fmt); } void CTv::print_version_info ( void ) @@ -1456,35 +1450,35 @@ int CTv::Tvin_GetTvinConfig ( void ) { const char *config_value; - config_value = config_get_str ( CFG_SECTION_TV, "tvin.kernelpet_disable", "null" ); + config_value = config_get_str ( CFG_SECTION_TV, CFG_TVIN_KERNELPET_DISABLE, "null" ); if ( strcmp ( config_value, "disable" ) == 0 ) { gTvinConfig.kernelpet_disable = true; } else { gTvinConfig.kernelpet_disable = false; } - config_value = config_get_str ( CFG_SECTION_TV, "tvin.kernelpet.timeout", "null" ); + config_value = config_get_str ( CFG_SECTION_TV, CFG_TVIN_KERNELPET_TIMEROUT, "null" ); gTvinConfig.userpet_timeout = ( unsigned int ) strtol ( config_value, NULL, 10 ); if ( gTvinConfig.kernelpet_timeout <= 0 || gTvinConfig.kernelpet_timeout > 40 ) { gTvinConfig.kernelpet_timeout = 10; } - config_value = config_get_str ( CFG_SECTION_TV, "tvin.userpet", "null" ); + config_value = config_get_str ( CFG_SECTION_TV, CFG_TVIN_USERPET, "null" ); if ( strcmp ( config_value, "enable" ) == 0 ) { gTvinConfig.userpet = true; } else { gTvinConfig.userpet = false; } - config_value = config_get_str ( CFG_SECTION_TV, "tvin.userpet.timeout", "null" ); + config_value = config_get_str ( CFG_SECTION_TV, CFG_TVIN_USERPET_TIMEROUT, "null" ); gTvinConfig.userpet_timeout = ( unsigned int ) strtol ( config_value, NULL, 10 ); if ( gTvinConfig.userpet_timeout <= 0 || gTvinConfig.userpet_timeout > 100 ) { gTvinConfig.userpet_timeout = 10; } - config_value = config_get_str ( CFG_SECTION_TV, "tvin.userpet.reset", "null" ); + config_value = config_get_str ( CFG_SECTION_TV, CFG_TVIN_USERPET_RESET, "null" ); if ( strcmp ( config_value, "disable" ) == 0 ) { gTvinConfig.userpet_reset = 0; } else { @@ -1504,7 +1498,7 @@ int CTv::OpenTv ( void ) const char *value; Tv_Spread_Spectrum(); //reboot system by fbc setting. - value = config_get_str ( CFG_SECTION_TV, "fbc.get.panelinfo", "null" ); + value = config_get_str ( CFG_SECTION_TV, CFG_FBC_PANEL_INFO, "null" ); LOGD("open tv, get fbc panel info:%s\n", value); if ( strcmp ( value, "edid" ) == 0 ) { reboot_sys_by_fbc_edid_info(); @@ -1531,7 +1525,7 @@ int CTv::OpenTv ( void ) //set color filter // SetFileAttrValue ( "/sys/module/amvideo/parameters/filt_mode", "0x2100" ); - value = config_get_str ( CFG_SECTION_TV, "tvin.autoset.displayfreq", "null" ); + value = config_get_str ( CFG_SECTION_TV, CFG_TVIN_DISPLAY_FREQ_AUTO, "null" ); if ( strcmp ( value, "enable" ) == 0 ) { mAutoSetDisplayFreq = true; } else { @@ -1540,19 +1534,19 @@ int CTv::OpenTv ( void ) Tv_HandeHDMIEDIDFilePathConfig(); - value = config_get_str ( CFG_SECTION_TV, "ssm.handle.hdmi.edid.en", "null" ); + value = config_get_str ( CFG_SECTION_TV, CFG_SSM_HDMI_EDID_EN, "null" ); if ( strtoul(value, NULL, 10) == 1 ) { - LOGD( "%s, get config \"%s\" is \"%s\".\n", __FUNCTION__, "ssm.handle.hdmi.edid.en", value ); + LOGD( "%s, get config \"%s\" is \"%s\".\n", __FUNCTION__, CFG_SSM_HDMI_EDID_EN, value ); //get hdmi edid use mode char prop_value[256] = {0}; char *pEdid = NULL; - property_get( "ubootenv.var.outputmode", prop_value, "null" ); - LOGD( "%s, get property \"%s\" is \"%s\".\n", __FUNCTION__, "ubootenv.var.outputmode", prop_value ); + property_get( UBOOTENV_OUTPUTMODE, prop_value, "null" ); + LOGD( "%s, get property [%s]:[%s]\n", __FUNCTION__, UBOOTENV_OUTPUTMODE, prop_value ); if ( strcmp ( prop_value, "null" ) != 0 ) pEdid = prop_value; else - pEdid = "hdmi_edid";//set default hdmi edid + pEdid = (char *)"hdmi_edid";//set default hdmi edid config_set_str ( CFG_SECTION_TV, CS_HDMI_EDID_USE_CFG, pEdid ); //set file's path for hdmi edid of each port @@ -1752,7 +1746,7 @@ int CTv::StopTvLock ( void ) const char *CTv::getPqDbPath() { - return config_get_str(CFG_SECTION_TV, "pq_db_path", "/param/pq.db"); + return config_get_str(CFG_SECTION_TV, CFG_PQ_DB_PATH, DEF_VALUE_PQ_DB_PATH); } int CTv::Tv_MiscSetBySource ( tv_source_input_t source_input ) @@ -1762,7 +1756,7 @@ int CTv::Tv_MiscSetBySource ( tv_source_input_t source_input ) switch ( source_input ) { case SOURCE_TV: CVpp::getInstance()->VPP_SetScalerPathSel(1); - ret = SetFileAttrValue ( "/sys/module/am_vecm/parameters/dnlp_adj_level", "4" ); + ret = SetFileAttrValue ( SYS_VECM_DNLP_ADJ_LEVEL, "4" ); break; case SOURCE_HDMI1: @@ -1770,7 +1764,7 @@ int CTv::Tv_MiscSetBySource ( tv_source_input_t source_input ) case SOURCE_HDMI3: CVpp::getInstance()->VPP_SetScalerPathSel(0); //ret = CVpp::getInstance()->Tv_SavePanoramaMode ( VPP_PANORAMA_MODE_FULL, SOURCE_TYPE_HDMI ); - ret |= SetFileAttrValue ( "/sys/module/am_vecm/parameters/dnlp_adj_level", "5" ); + ret |= SetFileAttrValue ( SYS_VECM_DNLP_ADJ_LEVEL, "5" ); break; case SOURCE_DTV: @@ -1780,7 +1774,7 @@ int CTv::Tv_MiscSetBySource ( tv_source_input_t source_input ) case SOURCE_AV2: case SOURCE_VGA: CVpp::getInstance()->VPP_SetScalerPathSel(1); - ret |= SetFileAttrValue ( "/sys/module/am_vecm/parameters/dnlp_adj_level", "5" ); + ret |= SetFileAttrValue ( SYS_VECM_DNLP_ADJ_LEVEL, "5" ); break; case SOURCE_SVIDEO: @@ -1788,7 +1782,7 @@ int CTv::Tv_MiscSetBySource ( tv_source_input_t source_input ) CVpp::getInstance()->VPP_SetScalerPathSel(1); default: CVpp::getInstance()->VPP_SetScalerPathSel(0); - ret |= SetFileAttrValue ( "/sys/module/am_vecm/parameters/dnlp_adj_level", "5" ); + ret |= SetFileAttrValue ( SYS_VECM_DNLP_ADJ_LEVEL, "5" ); break; } return ret; @@ -1899,7 +1893,7 @@ int CTv::SetSourceSwitchInput (tv_source_input_t source_input ) //only DTV->TVIN or TVIN->DTV need start resource detect thread if ( ( pre_source_input == SOURCE_DTV || cur_source_input == SOURCE_DTV ) && ( cur_source_input != pre_source_input ) ) { - LOGD ( "%s, dtv need resource detect\n", __FUNCTION__ ); + LOGD ( "%s, dtv need resource detect\n", __FUNCTION__ ); int isNeedCheckD2D3 = ( gTvinConfig.memory512m) ? 1 : 0; static int sigchkcnt = 0; while ( true ) { @@ -1949,7 +1943,7 @@ int CTv::SetSourceSwitchInput (tv_source_input_t source_input ) //for HDMI source connect detect CTvin::getInstance()->VDIN_OpenHDMIPinMuxOn(true); CVpp::getInstance()->Vpp_ResetLastVppSettingsSourceType(); - //========================================== + m_sig_stable_nums = 0; mSigDetectThread.setObserver ( this ); mSigDetectThread.initSigState(); @@ -2021,7 +2015,7 @@ void CTv::onSigStillStable() LOGD("still stable , to start decoder"); int startdec_status = CTvin::getInstance()->Tvin_StartDecoder ( mSigDetectThread.getCurSigInfo() ); if ( startdec_status == 0 ) { //showboz codes from start decode fun - const char *value = config_get_str ( CFG_SECTION_TV, "tvin.db.reg.en", "null" ); + const char *value = config_get_str ( CFG_SECTION_TV, CFG_TVIN_DB_REG, "null" ); if ( strcmp ( value, "enable" ) == 0 ) { usleep ( 20 * 1000 ); Tvin_SetPLLValues (); @@ -2046,11 +2040,9 @@ void CTv::onEnableVideoLater(int framecount) { LOGD("onEnableVideoLater framecount = %d", framecount); mAv.EnableVideoWhenVideoPlaying(2); - //if(CTvin::Tvin_SourceInputToSourceInputType(m_source_input) != SOURCE_TYPE_HDMI ){ if (CTvin::Tvin_SourceInputToSourceInputType(m_source_input) != SOURCE_TYPE_HDMI ) { SetAudioMuteForTv ( CC_AUDIO_UNMUTE ); Tv_SetAudioInSource(m_source_input); - //} } } @@ -2222,7 +2214,7 @@ void CTv::onSigStillNosig() void CTv::onSigStillNoSupport() { - return;//change for gxtvbb, don't send event when sitll not support + LOGD ( "%s, gxtvbb, don't send event when sitll not support", __FUNCTION__); /* tvin_info_t info = mSigDetectThread.getCurSigInfo(); TvEvent::SignalInfoEvent SigEv; @@ -2282,7 +2274,7 @@ void CTv::onSigDetectLoop() if (( CTvin::Tvin_SourceInputToSourceInputType(m_source_input) == SOURCE_TYPE_HDMI ) ) { int sr = CTvin::getInstance()->get_hdmi_sampling_rate(); if ( ( sr > 0 ) && ( sr != m_hdmi_sampling_rate ) ) { - LOGD("HDMI SR CHANGED"); + LOGD("HDMI SR CHANGED"); CMessage msg; msg.mDelayMs = 0; msg.mType = CTvMsgQueue::TV_MSG_HDMI_SR_CHANGED; @@ -2359,7 +2351,7 @@ void CTv::CTvDetectObserverForScanner::onSigStillStable() LOGD("%s still stable , to start decoder", __FUNCTION__); int startdec_status = CTvin::getInstance()->Tvin_StartDecoder (mpTv->mSigDetectThread.getCurSigInfo() ); if ( startdec_status == 0 ) { - const char *value = config_get_str ( CFG_SECTION_TV, "tvin.db.reg.en", "null" ); + const char *value = config_get_str ( CFG_SECTION_TV, CFG_TVIN_DB_REG, "null" ); if ( strcmp ( value, "enable" ) == 0 ) { usleep ( 20 * 1000 ); mpTv->Tvin_SetPLLValues (); @@ -2454,7 +2446,7 @@ VIDEO_3D_MODE_T CTv::Tv_Get3DMode ( void ) int CTv::Tv_Set3DLRSwith ( int on_off) { - LOGW ( "%s,Set3D LRSwith on_off %d ,status %d !!! ", __FUNCTION__, on_off); + LOGW ( "%s,Set3D LRSwith on_off %d", __FUNCTION__, on_off); mAv.set3DMode(m_mode_3d, on_off, 0); SSMSave3DLRSwitch(on_off); return 0; @@ -2469,7 +2461,7 @@ int CTv::Tv_Get3DLRSwith ( void ) int CTv::Tv_Set3DTo2DMode ( int mode) { - LOGW ( "%s,Set3D to 2D mode %d ,status %d !!! ", __FUNCTION__ , mode); + LOGW ( "%s,Set3D to 2D mode %d", __FUNCTION__ , mode); mAv.set3DMode(m_mode_3d, 0, mode); SSMSave3DTO2D ( mode ); return 0; @@ -2644,7 +2636,7 @@ int CTv::Tv_SetAudioInSource (tv_source_input_t source_input) AudioSetAudioInSource(CC_AUDIO_IN_SOURCE_HDMI); vol = GetAudioInternalDACDigitalPlayBackVolume_Cfg(CC_AUDIO_IN_SOURCE_HDMI); } else if (source_input == SOURCE_YPBPR1 || source_input == SOURCE_YPBPR2 || - source_input == SOURCE_TYPE_VGA) { + source_input == SOURCE_VGA) { AudioSetAudioInSource(CC_AUDIO_IN_SOURCE_LINEIN); vol = GetAudioInternalDACDigitalPlayBackVolume_Cfg(CC_AUDIO_IN_SOURCE_LINEIN); } else if (source_input == SOURCE_MPEG) { @@ -2672,7 +2664,7 @@ int CTv::Tv_SetAudioSourceType (tv_source_input_t source_input) source_input == SOURCE_HDMI3) { audio_source = AUDIO_HDMI_SOURCE; } else if (source_input == SOURCE_YPBPR1 || source_input == SOURCE_YPBPR2 || - source_input == SOURCE_TYPE_VGA) { + source_input == SOURCE_VGA) { audio_source = AUDIO_AV_SOURCE; } else if (source_input == SOURCE_DTV) { audio_source = AUDIO_MPEG_SOURCE; @@ -3019,7 +3011,7 @@ int CTv::GetHdmiHdcpKeyKsvInfo(int data_buf[]) bool CTv::hdmiOutWithFbc() { - const char *value = config_get_str(CFG_SECTION_TV, "platform.havefbc", "true"); + const char *value = config_get_str(CFG_SECTION_TV, CFG_FBC_USED, "true"); if (strcmp(value, "true") == 0) { return true; } @@ -3086,51 +3078,47 @@ void CTv::onHeadSetDetect(int state, int para) void CTv::onThermalDetect(int state) { const char *value; - const char *value_normal; - const char *value_cold; - int threshold = 0, val = 0; - static int pre_val = -1; + int val = 0; + static int preValue = -1; - value = config_get_str ( CFG_SECTION_TV, "tvin.thermal.threshold.enable", "null" ); + value = config_get_str ( CFG_SECTION_TV, CFG_TVIN_THERMAL_THRESHOLD_ENABLE, "null" ); if ( strcmp ( value, "enable" ) == 0 ) { - value = config_get_str ( CFG_SECTION_TV, "tvin.thermal.threshold.value", "null" ); - threshold = atoi(value); + value = config_get_str ( CFG_SECTION_TV, CFG_TVIN_THERMAL_THRESHOLD_VALUE, "null" ); + int threshold = atoi(value); LOGD ( "%s, threshold value: %d\n", __FUNCTION__, threshold); if (state > threshold) { - value_normal = config_get_str ( CFG_SECTION_TV, "tvin.thermal.fbc.normal.value", "null" ); - val = atoi(value_normal); + const char *valueNormal = config_get_str ( CFG_SECTION_TV, CFG_TVIN_THERMAL_FBC_NORMAL_VALUE, "null" ); + val = atoi(valueNormal); if (val == 0) { val = 0x4210000; //normal default } LOGD ( "%s, current temp: %d set 1\n", __FUNCTION__, state); } else { - value_cold = config_get_str ( CFG_SECTION_TV, "tvin.thermal.fbc.cold.value", "null" ); - val = atoi(value_cold); + const char *valueCold = config_get_str ( CFG_SECTION_TV, CFG_TVIN_THERMAL_FBC_COLD_VALUE, "null" ); + val = atoi(valueCold); if (val == 0) { val = 0x8210000; //cold default } LOGD ( "%s, current temp: 0x%x set 0\n", __FUNCTION__, state); } - if (pre_val == val) { - LOGD ( "%s, pre_val == val : 0x%x,bypass\n", __FUNCTION__, val); - } else { - pre_val = val; + if (preValue != val) { + LOGD ( "%s, pre value :0x%x, new value :0x%x, bypass\n", __FUNCTION__, preValue, val); + preValue = val; Tv_FactorySet_FBC_Thermal_State(val); - LOGD ( "%s, pre_val :0x%x,bypass\n", __FUNCTION__, pre_val); } } else { - LOGD ( "%s, tvin.thermal.threshold.enable == disable\n", __FUNCTION__); + LOGD ( "%s, tvin thermal threshold disable\n", __FUNCTION__); } } int CTv::SetDebugSerialOnOff(int on_off) { if (on_off) { - property_set("ubootenv.var.console", "ttyS0,115200n8"); + property_set(UBOOTENV_CONSOLE, "ttyS0,115200n8"); } else { - property_set("ubootenv.var.console", "off"); + property_set(UBOOTENV_CONSOLE, "off"); } return 0; } @@ -3138,7 +3126,7 @@ int CTv::SetDebugSerialOnOff(int on_off) int CTv::GetDebugSerialOnOff() { char prop[256] = {0}; - property_get("ubootenv.var.console", prop, "null" ); + property_get(UBOOTENV_CONSOLE, prop, "null" ); if (!strcmp(prop, "ttyS0,115200n8")) { return 1; } else { @@ -3202,16 +3190,15 @@ int CTv::SendSerialData(int dev_id, int data_len, unsigned char data_buf[]) int CTv::ChannelExport(const char *destPath) { char tmp[256]; - FILE *fp = NULL; if (destPath == NULL) { destPath = "/storage/external_storage/sda1/"; } - sprintf(tmp, "cp /param/dtv.db %s", destPath); + sprintf(tmp, "cp %s %s", DEF_VALUE_CAHNNEL_DB, destPath); if (system(tmp) >= 0) { LOGD("%s, copy dtv.db from /param to udisk success !", __FUNCTION__); system("sync"); - fp = fopen(destPath, "r"); + FILE *fp = fopen(destPath, "r"); if (fp != NULL) { fclose(fp); fp = NULL; @@ -3230,9 +3217,9 @@ int CTv::ChannelImport(const char *srcPath) if (Tv_Utils_IsFileExist(srcPath)) { char tmp[256]; - const char *destPath = config_get_str(CFG_SECTION_TV, "tv.channel.db", (char *) "/param/dtv.db"); + const char *destPath = config_get_str(CFG_SECTION_TV, CFG_CAHNNEL_DB, (char *) DEF_VALUE_CAHNNEL_DB); - LOGD("%s, file exist !" , srcPath); + LOGD("%s, file exist !" , srcPath); CTvDatabase::GetTvDb()->UnInitTvDb(); sprintf(tmp, "rm %s", destPath); if (system(tmp) >= 0) { @@ -3282,13 +3269,13 @@ int CTv::Tv_HandeHDMIEDIDFilePathConfig() char edid_path_cfg[256]; bool fileExist = false; - const char *value = config_get_str(CFG_SECTION_TV, "ssm.handle.hdmi.edid.en", "null"); + const char *value = config_get_str(CFG_SECTION_TV, CFG_SSM_HDMI_EDID_EN, "null"); if (strtoul(value, NULL, 10) == 1) { - LOGD( "%s, get config [ssm.handle.hdmi.edid.en]:[%s]\n", __FUNCTION__, value); + LOGD( "%s, get config [%s]:[%s]\n", __FUNCTION__, CFG_SSM_HDMI_EDID_EN, value); //get hdmi edid use mode char propValue[256] = {0}; - property_get("ubootenv.var.outputmode", propValue, "null"); - LOGD( "%s, get property [ubootenv.var.outputmode]:[%s]\n", __FUNCTION__, propValue); + property_get(UBOOTENV_OUTPUTMODE, propValue, "null"); + LOGD( "%s, get property [%s]:[%s]\n", __FUNCTION__, UBOOTENV_OUTPUTMODE, propValue); if (strcmp(propValue, "null") != 0) { fileExist = true; @@ -3333,11 +3320,11 @@ int CTv::Tv_SetDDDRCMode(tv_source_input_t source_input) { if (source_input == SOURCE_DTV) { if (GetPlatformHaveDDFlag() == 1) { - Tv_Utils_SetFileAttrStr("/sys/class/audiodsp/ac3_drc_control", (char *)"drcmode 3"); + Tv_Utils_SetFileAttrStr(SYS_AUIDO_DSP_AC3_DRC, (char *)"drcmode 3"); } } else { if (GetPlatformHaveDDFlag() == 1) { - Tv_Utils_SetFileAttrStr("/sys/class/audiodsp/ac3_drc_control", (char *)"drcmode 2"); + Tv_Utils_SetFileAttrStr(SYS_AUIDO_DSP_AC3_DRC, (char *)"drcmode 2"); } } return 0; @@ -3627,9 +3614,9 @@ int CTv::Tv_Set2k4k_ScalerUp_Mode ( int value ) if ( CTvin::Tvin_SourceInputToSourceInputType(m_source_input) != SOURCE_TYPE_HDMI && CTvin::Tvin_SourceInputToSourceInputType(m_source_input) != SOURCE_TYPE_AV && CTvin::Tvin_SourceInputToSourceInputType(m_source_input) != SOURCE_TYPE_TV) { - int fd = open("/sys/class/video/frame_height", O_RDONLY); + int fd = open(SYS_VIDEO_FRAME_HEIGHT, O_RDONLY); if (fd <= 0) { - LOGE("open /sys/class/video/frame_height ERROR!!error = -%s- \n", strerror ( errno )); + LOGE("open %s ERROR!!error = -%s- \n",SYS_VIDEO_FRAME_HEIGHT, strerror ( errno )); return -1; } read(fd, s, sizeof(s)); @@ -3654,21 +3641,18 @@ int CTv::Tv_Set2k4k_ScalerUp_Mode ( int value ) switch (value) { case 1: // on if (fmt_hd_sd) { - ret = Tv_Utils_SetFileAttrStr("/sys/class/video/video_scaler_path_sel", (char *)"0"); - //LOGD("%s, enable, set 0.\n", __FUNCTION__); + ret = Tv_Utils_SetFileAttrStr(SYS_VIDEO_SCALER_PATH_SEL, (char *)"0"); } else { - ret = Tv_Utils_SetFileAttrStr("/sys/class/video/video_scaler_path_sel", (char *)"1"); + ret = Tv_Utils_SetFileAttrStr(SYS_VIDEO_SCALER_PATH_SEL, (char *)"1"); } break; case 0: // off default: if (fmt_hd_sd) { - ret = Tv_Utils_SetFileAttrStr("/sys/class/video/video_scaler_path_sel", (char *)"1"); - //LOGD("%s, disable, set 1.\n", __FUNCTION__); + ret = Tv_Utils_SetFileAttrStr(SYS_VIDEO_SCALER_PATH_SEL, (char *)"1"); } else { - ret = Tv_Utils_SetFileAttrStr("/sys/class/video/video_scaler_path_sel", (char *)"0"); - //LOGD("%s, disable, set 0.\n", __FUNCTION__); + ret = Tv_Utils_SetFileAttrStr(SYS_VIDEO_SCALER_PATH_SEL, (char *)"0"); } break; } @@ -3687,9 +3671,9 @@ int CTv::Tv_Get2k4k_ScalerUp_Mode ( void ) if ( CTvin::Tvin_SourceInputToSourceInputType(m_source_input) != SOURCE_TYPE_HDMI && CTvin::Tvin_SourceInputToSourceInputType(m_source_input) != SOURCE_TYPE_AV && CTvin::Tvin_SourceInputToSourceInputType(m_source_input) != SOURCE_TYPE_TV) { - int fd = open("/sys/class/video/frame_height", O_RDONLY); + int fd = open(SYS_VIDEO_FRAME_HEIGHT, O_RDONLY); if (fd <= 0) { - LOGE("open /sys/class/video/frame_height ERROR!!error = -%s- \n", strerror ( errno )); + LOGE("open %s ERROR!!error = -%s- \n",SYS_VIDEO_FRAME_HEIGHT, strerror ( errno )); return -1; } read(fd, s, sizeof(s)); @@ -3710,8 +3694,7 @@ int CTv::Tv_Get2k4k_ScalerUp_Mode ( void ) fmt_hd_sd = 0; } - Tv_Utils_GetFileAttrStr("/sys/class/video/video_scaler_path_sel", 64, attrV); - //LOGD("%s, 11111111scaler_path_sel[%s].\n", __FUNCTION__ , attrV); + Tv_Utils_GetFileAttrStr(SYS_VIDEO_SCALER_PATH_SEL, 64, attrV); if (strncasecmp(attrV, "1", strlen ("1")) == 0) { if (fmt_hd_sd) { ret = 0; @@ -3736,11 +3719,11 @@ int CTv::Tv_SetSplitScreenDemoStatus(tv_source_input_type_t source_type, int ono int ret = 0; LOGD("%s, split screen demo status source[%d],onoff_stauts[%d]\n", __FUNCTION__ , source_type, onoff_status); if (1 == onoff_status) { - ret = Tv_Utils_SetFileAttrStr("/sys/class/amlogic/debug", (char *)"w 0x503c0 v 0x31d6");//sharpness screen left - ret |= Tv_Utils_SetFileAttrStr("/sys/class/amlogic/debug", (char *)"w 0x07 v 0x174d");//nr screen left + ret = Tv_Utils_SetFileAttrStr(SYS_DROILOGIC_DEBUG, (char *)"w 0x503c0 v 0x31d6");//sharpness screen left + ret |= Tv_Utils_SetFileAttrStr(SYS_DROILOGIC_DEBUG, (char *)"w 0x07 v 0x174d");//nr screen left } else if (0 == onoff_status) { - ret = Tv_Utils_SetFileAttrStr("/sys/class/amlogic/debug", (char *)"w 0x503c0 v 0x31d6");//sharpness screen left - ret |= Tv_Utils_SetFileAttrStr("/sys/class/amlogic/debug", (char *)"w 0x07 v 0x174d");//nr screen left + ret = Tv_Utils_SetFileAttrStr(SYS_DROILOGIC_DEBUG, (char *)"w 0x503c0 v 0x31d6");//sharpness screen left + ret |= Tv_Utils_SetFileAttrStr(SYS_DROILOGIC_DEBUG, (char *)"w 0x07 v 0x174d");//nr screen left } if (fbcIns != NULL && 0 == ret) { @@ -4534,7 +4517,7 @@ int CTv::Tv_FactorySetWhiteBalanceRedGain(int source_type, int colortemp_mode, i if (!mHdmiOutFbc) { // not use fbc store the white balance params ret = CVpp::getInstance()->FactorySetColorTemp_Rgain(source_type, colortemp_mode, value); if (ret != -1) { - LOGD("save the red gain to flash") + LOGD("save the red gain to flash"); ret = CVpp::getInstance()->FactorySaveColorTemp_Rgain(source_type, colortemp_mode, value); } } else { //use fbc store the white balance params @@ -4555,7 +4538,7 @@ int CTv::Tv_FactorySetWhiteBalanceGreenGain(int source_type, int colortemp_mode, if (!mHdmiOutFbc) { // not use fbc store the white balance params ret = CVpp::getInstance()->FactorySetColorTemp_Ggain(source_type, colortemp_mode, value); if (ret != -1) { - LOGD("save the green gain to flash") + LOGD("save the green gain to flash"); ret = CVpp::getInstance()->FactorySaveColorTemp_Ggain(source_type, colortemp_mode, value); } } else { //use fbc store the white balance params @@ -4576,7 +4559,7 @@ int CTv::Tv_FactorySetWhiteBalanceBlueGain(int source_type, int colortemp_mode, if (!mHdmiOutFbc) { // not use fbc store the white balance params ret = CVpp::getInstance()->FactorySetColorTemp_Bgain(source_type, colortemp_mode, value); if (ret != -1) { - LOGD("save the blue gain to flash") + LOGD("save the blue gain to flash"); ret = CVpp::getInstance()->FactorySaveColorTemp_Bgain(source_type, colortemp_mode, value); } } else { //use fbc store the white balance params @@ -4597,7 +4580,7 @@ int CTv::Tv_FactorySetWhiteBalanceRedOffset(int source_type, int colortemp_mode, if (!mHdmiOutFbc) { // not use fbc store the white balance params ret = CVpp::getInstance()->FactorySetColorTemp_Roffset(source_type, colortemp_mode, value); if (ret != -1) { - LOGD("save the red offset to flash") + LOGD("save the red offset to flash"); ret = CVpp::getInstance()->FactorySaveColorTemp_Roffset(source_type, colortemp_mode, value); } } else { //use fbc store the white balance params @@ -4618,7 +4601,7 @@ int CTv::Tv_FactorySetWhiteBalanceGreenOffset(int source_type, int colortemp_mod if (!mHdmiOutFbc) { // not use fbc store the white balance params ret = CVpp::getInstance()->FactorySetColorTemp_Goffset(source_type, colortemp_mode, value); if (ret != -1) { - LOGD("save the green offset to flash") + LOGD("save the green offset to flash"); ret = CVpp::getInstance()->FactorySaveColorTemp_Goffset(source_type, colortemp_mode, value); } } else { //use fbc store the white balance params @@ -4639,7 +4622,7 @@ int CTv::Tv_FactorySetWhiteBalanceBlueOffset(int source_type, int colortemp_mode if (!mHdmiOutFbc) { // not use fbc store the white balance params ret = CVpp::getInstance()->FactorySetColorTemp_Boffset(source_type, colortemp_mode, value); if (ret != -1) { - LOGD("save the blue offset to flash") + LOGD("save the blue offset to flash"); ret = CVpp::getInstance()->FactorySaveColorTemp_Boffset(source_type, colortemp_mode, value); } } else { //use fbc store the white balance params @@ -5366,12 +5349,12 @@ int CTv::Tv_FactorySet_VbyOne_Spread_Spectrum_N311 ( int value ) switch (value) { case 0: - //SetFileAttrValue ( "/sys/class/amlogic/debug" ,"w 0x135c5091 c 0x10ca"); - //SetFileAttrValue ( "/sys/class/amlogic/debug" ,"w 0x801da72c c 0x10cb"); + //SetFileAttrValue ( SYS_DROILOGIC_DEBUG ,"w 0x135c5091 c 0x10ca"); + //SetFileAttrValue ( SYS_DROILOGIC_DEBUG ,"w 0x801da72c c 0x10cb"); break; case 1: - SetFileAttrValue ( "/sys/class/amlogic/debug" , "w 0x1ba05091 c 0x10ca"); - SetFileAttrValue ( "/sys/class/amlogic/debug" , "w 0x80bda72c c 0x10cb"); + SetFileAttrValue ( SYS_DROILOGIC_DEBUG, "w 0x1ba05091 c 0x10ca"); + SetFileAttrValue ( SYS_DROILOGIC_DEBUG, "w 0x80bda72c c 0x10cb"); break; default: LOGD("%s, Set spectrum for T868 V-by-one....%d....\n", __FUNCTION__ , value); @@ -5591,8 +5574,8 @@ int CTv::SetAudioI2sMute(int muteStatus) } else { vol = 256; } - CFile::setFileAttrValue("/sys/class/amaudio2/aml_direct_right_gain", vol); - CFile::setFileAttrValue("/sys/class/amaudio2/aml_direct_left_gain", vol); + CFile::setFileAttrValue(SYS_AUIDO_DIRECT_RIGHT_GAIN, vol); + CFile::setFileAttrValue(SYS_AUIDO_DIRECT_LEFT_GAIN, vol); return 0; } @@ -5604,7 +5587,7 @@ int CTv::SetDacMute(int muteStatus, int mute_type) } if (mute_type & CC_DAC_MUTE_TYPE_EXTERNAL) { - int tmp_ret = 0, set_val = 0; + int set_val = 0; int aud_arch_type = GetAudioArchitectureTypeCFG(); if (aud_arch_type == CC_DAC_G9TV_EXTERNAL_DAC_ON_BOARD) { @@ -5691,8 +5674,7 @@ int CTv::SetAudioSPDIFMode(int tmp_val) { LOGD("%s : tmp_val = %d\n", __FUNCTION__, tmp_val); mCurAudioSPDIFMode = tmp_val; - - SetSPDIFMode(mCurAudioSPDIFMode); + SetSPDIFMode(tmp_val); return 0; } @@ -6119,20 +6101,20 @@ void CTv::RefreshSrsEffectAndDacGain() if (surround_switch == CC_SWITCH_ON) { mAudioEffect.SetSrsSurroundSwitch(CC_SWITCH_ON); - tmp_gain_val = GetAudioSRSGainCfg("audio.srs.sourround.gain", 50); + tmp_gain_val = GetAudioSRSGainCfg(CFG_AUDIO_SRS_SOURROUND_GAIN, 50); mAudioEffect.SetSrsSurroundGain(tmp_gain_val); - int input_gain_val = GetAudioSRSGainCfg("audio.srs.input.gain", 50); - int out_gain_val = GetAudioSRSGainCfg("audio.srs.output.gain", 50); + int input_gain_val = GetAudioSRSGainCfg(CFG_AUDIO_SRS_INPUT_GAIN, 50); + int out_gain_val = GetAudioSRSGainCfg(CFG_AUDIO_SRS_OUTPUT_GAIN, 50); mAudioEffect.SetSrsInputOutputGain(input_gain_val, out_gain_val); if (trubass_switch == CC_SWITCH_ON && dialogclarity_switch == CC_SWITCH_OFF) { mAudioEffect.SetSrsTruBassSwitch (CC_SWITCH_ON); - tmp_gain_val = GetAudioSRSGainCfg("audio.srs.trubass.gain", 50); + tmp_gain_val = GetAudioSRSGainCfg(CFG_AUDIO_SRS_TRUBASS_GAIN, 50); mAudioEffect.SetSrsTruBassGain(tmp_gain_val); - tmp_gain_val = GetAudioSRSGainCfg("audio.srs.trubass.speakersize", 2); + tmp_gain_val = GetAudioSRSGainCfg(CFG_AUDIO_SRS_TRUBASS_SPEAKERSIZE, 2); mAudioEffect.SetSrsTrubassSpeakerSize(tmp_gain_val); mAudioEffect.SetSrsDialogClaritySwitch (CC_SWITCH_OFF); @@ -6141,9 +6123,9 @@ void CTv::RefreshSrsEffectAndDacGain() && dialogclarity_switch == CC_SWITCH_ON) { mAudioEffect.SetSrsDialogClaritySwitch (CC_SWITCH_ON); - tmp_gain_val = GetAudioSRSGainCfg("audio.srs.dialogclarity.gain", 30); + tmp_gain_val = GetAudioSRSGainCfg(CFG_AUDIO_SRS_CLARITY_GAIN, 30); mAudioEffect.SetSrsDialogClarityGain(tmp_gain_val); - tmp_gain_val = GetAudioSRSGainCfg("audio.srs.definition.gain", 20); + tmp_gain_val = GetAudioSRSGainCfg(CFG_AUDIO_SRS_DEFINITION_GAIN, 20); mAudioEffect.SetSrsDefinitionGain(tmp_gain_val); mAudioEffect.SetSrsTruBassSwitch (CC_SWITCH_OFF); @@ -6152,15 +6134,15 @@ void CTv::RefreshSrsEffectAndDacGain() && dialogclarity_switch == CC_SWITCH_ON) { mAudioEffect.SetSrsTruBassSwitch (CC_SWITCH_ON); - tmp_gain_val = GetAudioSRSGainCfg("audio.srs.trubass.gain", 50); + tmp_gain_val = GetAudioSRSGainCfg(CFG_AUDIO_SRS_TRUBASS_GAIN, 50); mAudioEffect.SetSrsTruBassGain(tmp_gain_val); - tmp_gain_val = GetAudioSRSGainCfg("audio.srs.trubass.speakersize", 2); + tmp_gain_val = GetAudioSRSGainCfg(CFG_AUDIO_SRS_TRUBASS_SPEAKERSIZE, 2); mAudioEffect.SetSrsTrubassSpeakerSize(tmp_gain_val); mAudioEffect.SetSrsDialogClaritySwitch(CC_SWITCH_ON); - tmp_gain_val = GetAudioSRSGainCfg("audio.srs.dialogclarity.gain", 30); + tmp_gain_val = GetAudioSRSGainCfg(CFG_AUDIO_SRS_CLARITY_GAIN, 30); mAudioEffect.SetSrsDialogClarityGain(tmp_gain_val); - tmp_gain_val = GetAudioSRSGainCfg("audio.srs.definition.gain", 20); + tmp_gain_val = GetAudioSRSGainCfg(CFG_AUDIO_SRS_DEFINITION_GAIN, 20); mAudioEffect.SetSrsDefinitionGain(tmp_gain_val); } else if (trubass_switch == CC_SWITCH_OFF @@ -6177,16 +6159,16 @@ void CTv::RefreshSrsEffectAndDacGain() //Refesh DAC gain int main_gain_val = 0; if (surround_switch == CC_SWITCH_ON) { - main_gain_val = GetAudioEffectAmplifierGainCfg("audio.srs.sourround.ampmaster.gain", 6, 24); + main_gain_val = GetAudioEffectAmplifierGainCfg(CFG_AUDIO_SRS_SOURROUND_MASTER_GAIN, 6, 24); if (dialogclarity_switch == CC_SWITCH_ON && trubass_switch == CC_SWITCH_OFF) { - main_gain_val = GetAudioEffectAmplifierGainCfg("audio.srs.dialogclarity.ampmaster.gain", 6, 24); + main_gain_val = GetAudioEffectAmplifierGainCfg(CFG_AUDIO_SRS_CLARITY_MASTER_GAIN, 6, 24); } else if (dialogclarity_switch == CC_SWITCH_OFF && trubass_switch == CC_SWITCH_ON) { - main_gain_val = GetAudioEffectAmplifierGainCfg("audio.srs.trubass.ampmaster.gain", 6, 24); + main_gain_val = GetAudioEffectAmplifierGainCfg(CFG_AUDIO_SRS_TRUBASS_MASTER_GAIN, 6, 24); } else if (dialogclarity_switch == CC_SWITCH_ON && trubass_switch == CC_SWITCH_ON) { - main_gain_val = GetAudioEffectAmplifierGainCfg("audio.srs.trubass.dialogclarity.ampmaster.gain", 6, 24); + main_gain_val = GetAudioEffectAmplifierGainCfg(CFG_AUDIO_SRS_TRUBASS_CLARITY_MASTER_GAIN, 6, 24); } } mAudioAlsa.SetMainVolumeGain(main_gain_val); @@ -6757,7 +6739,7 @@ int CTv::SetAtvInGain(int gain_val) char set_str[32] = {0}; sprintf ( set_str, "audio_gain_set %x", gain_val ); - return SetFileAttrValue ( "/sys/class/amlatvdemod/atvdemod_debug", set_str ); + return SetFileAttrValue ( SYS_ATV_DEMOD_DEBUG, set_str ); } int CTv::SetSpecialModeEQGain(int tmp_val) @@ -6810,7 +6792,7 @@ int CTv::SaveSpecialIndexEQGain(int buf_index, int w_val) // amAudio int CTv::OpenAmAudio(unsigned int sr, int input_device, int output_device) { - LOGD("OpenAmAudio input_device = %d", input_device); + LOGD("OpenAmAudio input_device = %d", input_device); return amAudioOpen(sr, input_device, output_device); } @@ -6821,7 +6803,7 @@ int CTv::CloseAmAudio(void) int CTv::SetAmAudioInputSr(unsigned int sr, int output_device) { - LOGD("SetAmAudioInputSr "); + LOGD("SetAmAudioInputSr"); return amAudioSetInputSr(sr, CC_IN_USE_SPDIF_DEVICE, output_device); } @@ -6856,31 +6838,11 @@ int CTv::SetAudioDumpDataFlag(int tmp_flag) return amAudioSetDumpDataFlag(tmp_flag); } -int GetAudioDumpDataFlag() +int CTv::GetAudioDumpDataFlag() { return amAudioGetDumpDataFlag(); } -static int RealCalVolDigitLUTBuf(int start_ind, int end_ind, int start_val, - int end_val, int lut_buf[]) -{ - int i = 0; - float tmp_step = 0; - - if (end_ind < start_ind) { - return 0; - } - - tmp_step = (float) (end_val - start_val) / (float) (end_ind - start_ind); - - for (i = start_ind; i < end_ind; i++) { - lut_buf[i] = start_val + (int) (tmp_step * (i - start_ind)); - } - - lut_buf[end_ind] = end_val; - return 1; -} - void CTv::AudioSetVolumeDigitLUTBuf(int lut_table_index, int *MainVolLutBuf) { int tmpDefDigitLutBuf[CC_LUT_BUF_SIZE] = { 0 }; @@ -7157,91 +7119,75 @@ int CTv::AudioSSMRestoreDefaultSetting() return 0; } -static const char *gDefCapturePropName = "snd.card.default.card.capture"; - int CTv::InitSetTvAudioCard() { - int i = 0, totle_num = 0, capture_ind = 0; - char tmp_buf[32] = { 0 }; - char tv_card_name[64] = { 0 }; - char prop_value[PROPERTY_VALUE_MAX]; + int captureIdx = -1; + char buf[32] = { 0 }; + char propValue[PROPERTY_VALUE_MAX]; #ifndef BOARD_ALSA_AUDIO_TINY snd_card_refresh_info(); #endif if (GetTvAudioCardNeedSet()) { - memset(prop_value, '\0', PROPERTY_VALUE_MAX); - property_get("snd.card.totle.num", prop_value, "0"); - - totle_num = strtoul(prop_value, NULL, 10); - LOGD("%s, totle number = %d\n", __FUNCTION__, totle_num); - totle_num = 8; - - GetTvAudioCardName(tv_card_name); - - for (i = 0; i < totle_num; i++) { - sprintf(tmp_buf, "snd.card.%d.name", i); - memset(prop_value, '\0', PROPERTY_VALUE_MAX); - property_get(tmp_buf, prop_value, "null"); - - LOGD("%s, key string \"%s\", value string \"%s\".\n", __FUNCTION__, tmp_buf, prop_value); - - if (strcmp(prop_value, tv_card_name) == 0) { + int totleNum = 0; + char cardName[64] = { 0 }; + + GetTvAudioCardName(cardName); + /* + memset(propValue, '\0', PROPERTY_VALUE_MAX); + property_get(PROP_AUDIO_CARD_NUM, propValue, "0"); + + totleNum = strtoul(propValue, NULL, 10); + LOGD("%s, totle number = %d\n", __FUNCTION__, totleNum); + */ + totleNum = 8; + + for (int i = 0; i < totleNum; i++) { + sprintf(buf, "snd.card.%d.name", i); + memset(propValue, '\0', PROPERTY_VALUE_MAX); + property_get(buf, propValue, "null"); + + LOGD("%s, key string \"%s\", value string \"%s\".\n", __FUNCTION__, buf, propValue); + if (strcmp(propValue, cardName) == 0) { + captureIdx = i; break; } } - - capture_ind = i; - - if (capture_ind == totle_num) { - capture_ind = -1; - LOGE("%s, can't find tv card \"%s\".\n", __FUNCTION__, tv_card_name); - } - } else { - capture_ind = -1; } - sprintf(tmp_buf, "%d", capture_ind); - property_set(gDefCapturePropName, tmp_buf); - LOGD("%s, set \"%s\" as \"%s\".\n", __FUNCTION__, gDefCapturePropName, tmp_buf); + sprintf(buf, "%d", captureIdx); + property_set(PROP_DEF_CAPTURE_NAME, buf); + LOGD("%s, set \"%s\" as \"%s\".\n", __FUNCTION__, PROP_DEF_CAPTURE_NAME, buf); return 0; } int CTv::UnInitSetTvAudioCard() { - char tmp_buf[32] = { 0 }; - #ifndef BOARD_ALSA_AUDIO_TINY snd_card_refresh_info(); #endif - sprintf(tmp_buf, "%d", -1); - property_set(gDefCapturePropName, tmp_buf); - LOGD("%s, set \"%s\" as \"%s\".\n", __FUNCTION__, gDefCapturePropName, tmp_buf); + property_set(PROP_DEF_CAPTURE_NAME, "-1"); + LOGD("%s, set [%s]:[-1]\n", __FUNCTION__, PROP_DEF_CAPTURE_NAME); return 0; } -#define CS_SPDIF_MODE_DEV_PATH "/sys/class/audiodsp/digital_raw" - int CTv::SetSPDIFMode(int mode_val) { - FILE *spdif_mode_fp = NULL; - - spdif_mode_fp = fopen(CS_SPDIF_MODE_DEV_PATH, "w"); - if (spdif_mode_fp == NULL) { - LOGE("%s, Open file %s error(%s)!\n", __FUNCTION__, CS_SPDIF_MODE_DEV_PATH, strerror(errno)); + FILE *fp = fopen(SYS_SPDIF_MODE_DEV_PATH, "w"); + if (fp == NULL) { + LOGE("%s, Open file %s error(%s)!\n", __FUNCTION__, SYS_SPDIF_MODE_DEV_PATH, strerror(errno)); return -1; } if (mode_val == CC_SPDIF_MODE_PCM) { - fprintf(spdif_mode_fp, "%d", 0); + fprintf(fp, "%d", 0); } else if (mode_val == CC_SPDIF_MODE_RAW ) { - fprintf(spdif_mode_fp, "%d", 1); + fprintf(fp, "%d", 1); } - fclose(spdif_mode_fp); - spdif_mode_fp = NULL; - + fclose(fp); + fp = NULL; return 0; } @@ -7298,7 +7244,7 @@ int CTv::SendCmdToOffBoardFBCExternalDac(int cmd, int para) int CTv::GetHdmiAvHotplugDetectOnoff() { - const char *value = config_get_str ( CFG_SECTION_TV, "ssm.hdmi_av.hotplug.detect.en", "null" ); + const char *value = config_get_str ( CFG_SECTION_TV, CFG_SSM_HDMI_AV_DETECT, "null" ); if ( strtoul(value, NULL, 10) == 1 ) { return 1; } diff --git a/tvapi/libtv/tv/CTvBooking.cpp b/tvapi/libtv/tv/CTvBooking.cpp index 1ad45db..220d25e 100644 --- a/tvapi/libtv/tv/CTvBooking.cpp +++ b/tvapi/libtv/tv/CTvBooking.cpp @@ -1,11 +1,8 @@ +#define LOG_TAG "CTvBooking" #include "CTvBooking.h" #include "CTvDatabase.h" -#ifdef LOG_TAG -#undef LOG_TAG -#define LOG_TAG "CTvBooking" -#endif int CTvBooking::InitFromCursor(CTvDatabase::Cursor &c) { int col; @@ -99,7 +96,7 @@ int CTvBooking::bookProgram(CTvProgram &prog, CTvEvent &evt) + String8("sub_pids,sub_types,sub_composition_page_ids,sub_ancillary_page_ids,sub_languages,") + String8("ttx_pids,ttx_types,ttx_magazine_numbers,ttx_page_numbers,ttx_languages, other_pids,from_storage,repeat)") + String8("values(") + String8::format("%d,", prog.getID()) + String8::format("%d,", evt.getEventId()) + progName.string() + String8(",") + evtName.string() - + String8::format("%d,", evt.getStartTime()) + String8::format("%d,", evt.getEndTime() - evt.getStartTime()) + String8::format("%d,", flag) + + String8::format("%ld,", evt.getStartTime()) + String8::format("%ld,", evt.getEndTime() - evt.getStartTime()) + String8::format("%d,", flag) + String8::format("%d,", status) + String8(",") + String8::format("%d,", prog.getVideo()->getPID()) + String8::format("%d,", prog.getVideo()->getFormat()) + String8::format("%d,", prog.getAudio(0)->getPID()) + String8::format("%d,", prog.getAudio(0)->getFormat()) + prog.getAudio(0)->getLang().string() + String8(" , , , , , , , , , , , , ,)"); diff --git a/tvapi/libtv/tv/CTvBooking.h b/tvapi/libtv/tv/CTvBooking.h index d724a7e..c744af6 100644 --- a/tvapi/libtv/tv/CTvBooking.h +++ b/tvapi/libtv/tv/CTvBooking.h @@ -20,9 +20,7 @@ #include #include #include "CTvLog.h" -#define LOG_TAG "CTvBooking" -// ??????/ ??? class CTvBooking : public LightRefBase { public: CTvBooking(CTvDatabase::Cursor &c); diff --git a/tvapi/libtv/tv/CTvEpg.cpp b/tvapi/libtv/tv/CTvEpg.cpp index a46f9a9..d1ead7f 100644 --- a/tvapi/libtv/tv/CTvEpg.cpp +++ b/tvapi/libtv/tv/CTvEpg.cpp @@ -4,14 +4,12 @@ *@ Date : 2013-12 *@ Author : */ +#define LOG_TAG "CTvEpg" + #include "CTvEpg.h" #include "CTvChannel.h" -#ifdef LOG_TAG -#undef LOG_TAG -#define LOG_TAG "CTvEpg" -#endif -void CTvEpg::epg_evt_callback(long dev_no, int event_type, void *param, void *user_data) +void CTvEpg::epg_evt_callback(long dev_no, int event_type, void *param, void *user_data __unused) { CTvEpg *pEpg; diff --git a/tvapi/libtv/tv/CTvLog.h b/tvapi/libtv/tv/CTvLog.h index 79c6fc7..fd34289 100644 --- a/tvapi/libtv/tv/CTvLog.h +++ b/tvapi/libtv/tv/CTvLog.h @@ -12,18 +12,11 @@ #if !defined(_CTVLOG_H) #define _CTVLOG_H -#define LOGD(...) \ -{ \ -__android_log_print(ANDROID_LOG_DEBUG, LOG_TAG, __VA_ARGS__); } +#define LOGD(...) __android_log_print(ANDROID_LOG_DEBUG, LOG_TAG, __VA_ARGS__) +#define LOGE(...) __android_log_print(ANDROID_LOG_ERROR, LOG_TAG, __VA_ARGS__) -#define LOGE(...) \ -{ \ -__android_log_print(ANDROID_LOG_ERROR, LOG_TAG, __VA_ARGS__); } - -#define LOGW(...) \ -{ \ -__android_log_print(ANDROID_LOG_WARN, LOG_TAG, __VA_ARGS__); } +#define LOGW(...) __android_log_print(ANDROID_LOG_WARN, LOG_TAG, __VA_ARGS__) //class CTvLog{ diff --git a/tvapi/libtv/tv/CTvRecord.cpp b/tvapi/libtv/tv/CTvRecord.cpp index 564f4f3..16ea23e 100644 --- a/tvapi/libtv/tv/CTvRecord.cpp +++ b/tvapi/libtv/tv/CTvRecord.cpp @@ -1,3 +1,5 @@ +#define LOG_TAG "CTvRecord" + #include #include #include @@ -14,11 +16,6 @@ #include "../tvconfig/tvconfig.h" #include "CTvRecord.h" -#ifdef LOG_TAG -#undef LOG_TAG -#endif -#define LOG_TAG "CTvRecord" - #define FEND_DEV_NO 0 #define DVR_DEV_NO 0 #define DVR_BUF_SIZE 1024*1024 diff --git a/tvapi/libtv/tv/CTvScanner.cpp b/tvapi/libtv/tv/CTvScanner.cpp index 0477fb7..e029b6d 100644 --- a/tvapi/libtv/tv/CTvScanner.cpp +++ b/tvapi/libtv/tv/CTvScanner.cpp @@ -7,15 +7,12 @@ // @ Date : 2013-11 // @ Author : // -// +#define LOG_TAG "CTvScanner" + #include "CTvScanner.h" #include "CTvProgram.h" #include "CTvRegion.h" #include "CFrontEnd.h" -#ifdef LOG_TAG -#undef LOG_TAG -#define LOG_TAG "CTvScanner" -#endif CTvScanner *CTvScanner::m_s_Scanner = NULL; //int CTvScanner::getStartPara() @@ -57,7 +54,7 @@ AM_Bool_t CTvScanner::atv_cvbs_lock_check(v4l2_std_id *colorStd) tvin_info_t info; CTvin::getInstance()->VDIN_GetSignalInfo(&info); *colorStd = CTvin::CvbsFtmToV4l2ColorStd(info.fmt); - LOGD("atv_cvbs_lock_check locked and cvbs fmt = 0x%x std = 0x%x", info.fmt, *colorStd); + LOGD("atv_cvbs_lock_check locked and cvbs fmt = %d std = 0x%p", info.fmt, colorStd); return true; } usleep(50 * 1000); @@ -438,7 +435,7 @@ dvbpsi_pat_t *CTvScanner::get_valid_pats(AM_SCAN_TS_t *ts) return valid_pat; } -void CTvScanner::scan_process_ts_info(AM_SCAN_Result_t *result, AM_SCAN_TS_t *ts, ScannerEvent *evt) +void CTvScanner::scan_process_ts_info(AM_SCAN_Result_t *result __unused, AM_SCAN_TS_t *ts, ScannerEvent *evt) { dvbpsi_nit_t *nit; dvbpsi_descriptor_t *descr; @@ -694,7 +691,7 @@ void CTvScanner::scan_store_dvb_ts_evt_service(SCAN_ServiceInfo_t *srv) for (int i = 0; i < srv->ttx_info.teletext_count; i++) { if (srv->ttx_info.teletexts[i].type == 0x2 || srv->ttx_info.teletexts[i].type == 0x5) { - if (scnt >= (sizeof(m_s_Scanner->mCurEv.mStype) / sizeof(int))) + if (scnt >= (int)(sizeof(m_s_Scanner->mCurEv.mStype) / sizeof(int))) break; m_s_Scanner->mCurEv.mStype[scnt] = TYPE_DTV_TELETEXT; m_s_Scanner->mCurEv.mSid[scnt] = srv->ttx_info.teletexts[i].pid; @@ -866,7 +863,7 @@ int CTvScanner::manualDtmbScan(int beginFreq, int endFreq, int modulation) para.dtv_para.dmx_dev_id = 0;//default 0 Vector > vcp; - CTvRegion::getChannelListByNameAndFreqRange("CHINA,Default DTMB ALL", beginFreq, endFreq, vcp); + CTvRegion::getChannelListByNameAndFreqRange((char *)"CHINA,Default DTMB ALL", beginFreq, endFreq, vcp); int size = vcp.size(); //@author:hao.fu @@ -1136,14 +1133,14 @@ int CTvScanner::autoDtmbScan() para.dtv_para.dmx_dev_id = 0;//default 0 Vector > vcp; //CTvDatabase::getChannelParaList("/data/tv_default.xml", vcp);//channel list from xml or db - CTvRegion::getChannelListByName("CHINA,Default DTMB ALL", vcp); + CTvRegion::getChannelListByName((char *)"CHINA,Default DTMB ALL", vcp); int size = vcp.size(); LOGD("channel list size = %d", size); //showboz if (size == 0) { CTvDatabase::GetTvDb()->importXmlToDB("/etc/tv_default.xml"); - CTvRegion::getChannelListByName("CHINA,Default DTMB ALL", vcp); + CTvRegion::getChannelListByName((char *)"CHINA,Default DTMB ALL", vcp); size = vcp.size(); } @@ -1321,7 +1318,7 @@ int CTvScanner::autoDtmbScan() int CTvScanner::stopScan() { - LOGD("StopScan mScanHandle=%d", mScanHandle); + LOGD("StopScan"); //requestExit(); if (mbScanStart) { //if start ok and not stop int ret = AM_SCAN_Destroy(mScanHandle, AM_TRUE); @@ -1337,7 +1334,7 @@ int CTvScanner::stopScan() return 0; } -void CTvScanner::tv_scan_evt_callback(long dev_no, int event_type, void *param, void *data) +void CTvScanner::tv_scan_evt_callback(long dev_no, int event_type, void *param, void *data __unused) { CTvScanner *pT = NULL; long long tmpFreq = 0; @@ -1612,16 +1609,16 @@ int CTvScanner::getAtscChannelPara(int attennaType, Vector > &vcp { switch (attennaType) { //region name should be remove to config file and read here case 1: - CTvRegion::getChannelListByName("U.S.,ATSC Air", vcp); + CTvRegion::getChannelListByName((char *)"U.S.,ATSC Air", vcp); break; case 2: - CTvRegion::getChannelListByName("U.S.,ATSC Cable Standard", vcp); + CTvRegion::getChannelListByName((char *)"U.S.,ATSC Cable Standard", vcp); break; case 3: - CTvRegion::getChannelListByName("U.S.,ATSC Cable IRC", vcp); + CTvRegion::getChannelListByName((char *)"U.S.,ATSC Cable IRC", vcp); break; case 4: - CTvRegion::getChannelListByName("U.S.,ATSC Cable HRC", vcp); + CTvRegion::getChannelListByName((char *)"U.S.,ATSC Cable HRC", vcp); break; default: return -1; diff --git a/tvapi/libtv/tv/CTvScreenCapture.cpp b/tvapi/libtv/tv/CTvScreenCapture.cpp index 396c1d5..57e2234 100644 --- a/tvapi/libtv/tv/CTvScreenCapture.cpp +++ b/tvapi/libtv/tv/CTvScreenCapture.cpp @@ -36,13 +36,18 @@ using namespace android; int CTvScreenCapture::xioctl(int fd, int request, void *arg) { - /* int r = 0; + /* + int r = 0; + do { + r = ioctl(fd, request, arg); + } while (-1 == r && EINTR == errno); - do { - r = ioctl(fd, request, arg); - } while (-1 == r && EINTR == errno); + return r;*/ - return r;*/ + //for warning + fd = fd; + request = request; + arg = arg; return 0; } @@ -74,177 +79,189 @@ int CTvScreenCapture::OpenCamera(struct camera *pCameraDev) } while (FALSE); return iOutRet;*/ + + //for warning + pCameraDev = pCameraDev; return 0; } int CTvScreenCapture::InitVCap(sp Mem) { - /* int iOutRet = FAILED; + /* + int iOutRet = FAILED; + + do { + m_pMem = Mem; + m_pData = (char *)m_pMem->pointer(); + LOGD("VVVVVVVVVVVVVVVVVVVVVVVVVVVVV %p\n", m_pData); + //default + } while (FALSE); - do { - m_pMem = Mem; - m_pData = (char *)m_pMem->pointer(); - LOGD("VVVVVVVVVVVVVVVVVVVVVVVVVVVVV %p\n", m_pData); - //default - } while (FALSE); + return iOutRet;*/ - return iOutRet;*/ + //for warning + Mem = Mem; return 0; } int CTvScreenCapture::InitMmap(struct camera *cam) { - /* int iOutRet = SUCCEED, iRet; - struct v4l2_requestbuffers req; - - do { - CLEAR(req); - - req.count = 4; - req.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; - req.memory = V4L2_MEMORY_MMAP; - - iRet = xioctl(cam->fd, VIDIOC_REQBUFS, &req); - if (FAILED == iRet) { - if (EINVAL == errno) { - LOGD("VIDIOC_REQBUFS %s does not support memory mapping\n", cam->device_name); - } - iOutRet = iRet; - break; - } + /* + int iOutRet = SUCCEED, iRet; + struct v4l2_requestbuffers req; - if (req.count < 2) { - LOGD("Insufficient buffer memory on %s\n", cam->device_name); - iOutRet = FAILED; - break; - } + do { + CLEAR(req); - cam->buffers = (struct buffer *)calloc(req.count, sizeof(*(cam->buffers))); - if (!cam->buffers) { - LOGD("Out of memory\n"); - iOutRet = FAILED; - break; + req.count = 4; + req.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; + req.memory = V4L2_MEMORY_MMAP; + + iRet = xioctl(cam->fd, VIDIOC_REQBUFS, &req); + if (FAILED == iRet) { + if (EINVAL == errno) { + LOGD("VIDIOC_REQBUFS %s does not support memory mapping\n", cam->device_name); } + iOutRet = iRet; + break; + } - for (m_capNumBuffers = 0; m_capNumBuffers < req.count; ++m_capNumBuffers) { - struct v4l2_buffer buf; + if (req.count < 2) { + LOGD("Insufficient buffer memory on %s\n", cam->device_name); + iOutRet = FAILED; + break; + } - CLEAR(buf); + cam->buffers = (struct buffer *)calloc(req.count, sizeof(*(cam->buffers))); + if (!cam->buffers) { + LOGD("Out of memory\n"); + iOutRet = FAILED; + break; + } - buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; - buf.memory = V4L2_MEMORY_MMAP; - buf.index = m_capNumBuffers; + for (m_capNumBuffers = 0; m_capNumBuffers < req.count; ++m_capNumBuffers) { + struct v4l2_buffer buf; - if (FAILED == xioctl(cam->fd, VIDIOC_QUERYBUF, &buf)) { - LOGD("VIDIOC_QUERYBUF ERROR\n"); - iOutRet = FAILED; - goto IS_ERROR; - } + CLEAR(buf); - cam->buffers[m_capNumBuffers].length = buf.length; - cam->buffers[m_capNumBuffers].start = mmap(NULL \, - buf.length, PROT_READ | PROT_WRITE, - MAP_SHARED, cam->fd, buf.m.offset); + buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; + buf.memory = V4L2_MEMORY_MMAP; + buf.index = m_capNumBuffers; - if (MAP_FAILED == cam->buffers[m_capNumBuffers].start) { - iOutRet = FAILED; - break; - } + if (FAILED == xioctl(cam->fd, VIDIOC_QUERYBUF, &buf)) { + LOGD("VIDIOC_QUERYBUF ERROR\n"); + iOutRet = FAILED; + goto IS_ERROR; + } + cam->buffers[m_capNumBuffers].length = buf.length; + cam->buffers[m_capNumBuffers].start = mmap(NULL \, + buf.length, PROT_READ | PROT_WRITE, + MAP_SHARED, cam->fd, buf.m.offset); + if (MAP_FAILED == cam->buffers[m_capNumBuffers].start) { + iOutRet = FAILED; + break; } - LOGD("END m_capNumBuffers : %d\n", m_capNumBuffers); - } while (FALSE); - IS_ERROR: - return iOutRet;*/ + + } + + LOGD("END m_capNumBuffers : %d\n", m_capNumBuffers); + } while (FALSE); +IS_ERROR: + return iOutRet;*/ + + //for warning + cam = cam; return 0; } int CTvScreenCapture::InitCamera(struct camera *cam) { /* - int iOutRet = SUCCEED, iRet; - struct v4l2_capability *cap = &(cam->v4l2_cap); - struct v4l2_cropcap *cropcap = &(cam->v4l2_cropcap); - struct v4l2_crop *crop = &(cam->crop); - struct v4l2_format *fmt = &(cam->v4l2_fmt); - unsigned int min; - - do { - iRet = xioctl(cam->fd, VIDIOC_QUERYCAP, cap); - if (FAILED == iRet) { - if (EINVAL == errno) { - LOGD("%s is no V4L2 device\n", cam->device_name); - } - iOutRet = iRet; - break; - } - - if (!(cap->capabilities & V4L2_CAP_VIDEO_CAPTURE)) { - LOGD("%s is no video capture device\n", cam->device_name); - iOutRet = FAILED; - break; - } + int iOutRet = SUCCEED, iRet; + struct v4l2_capability *cap = &(cam->v4l2_cap); + struct v4l2_cropcap *cropcap = &(cam->v4l2_cropcap); + struct v4l2_crop *crop = &(cam->crop); + struct v4l2_format *fmt = &(cam->v4l2_fmt); + unsigned int min; - if (!(cap->capabilities & V4L2_CAP_STREAMING)) { - LOGD("%s does not support streaming i/o\n", cam->device_name); - iOutRet = FAILED; - break; - } + do { + iRet = xioctl(cam->fd, VIDIOC_QUERYCAP, cap); + if (FAILED == iRet) { + if (EINVAL == errno) { + LOGD("%s is no V4L2 device\n", cam->device_name); + } + iOutRet = iRet; + break; + } - LOGD("VIDOOC_QUERYCAP camera driver is [%s] card is [%s] businfo is [%s] version is [%d]\n", cap->driver, - cap->card, cap->bus_info, cap->version); - - //* Select video input, video standard and tune here. - - CLEAR(*cropcap); - cropcap->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; - - crop->c.width = cam->width; - crop->c.height = cam->height; - crop->c.left = 0; - crop->c.top = 0; - crop->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; - - CLEAR(*fmt); - fmt->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; - fmt->fmt.pix.width = cam->width; - fmt->fmt.pix.height = cam->height; - fmt->fmt.pix.pixelformat = V4L2_PIX_FMT_NV21; - fmt->fmt.pix.field = V4L2_FIELD_INTERLACED; - iRet = xioctl(cam->fd, VIDIOC_S_FMT, fmt); - if (FAILED == iRet) { - iOutRet = iRet; - LOGD("VIDIOC_S_FMT is ERROR\n"); - break; - } + if (!(cap->capabilities & V4L2_CAP_VIDEO_CAPTURE)) { + LOGD("%s is no video capture device\n", cam->device_name); + iOutRet = FAILED; + break; + } - //* Note VIDIOC_S_FMT may change width and height. - //* Buggy driver paranoia. - min = fmt->fmt.pix.width * 2; - LOGD("bytesperline : %d w:h [%d %d]\n", fmt->fmt.pix.bytesperline, fmt->fmt.pix.width, fmt->fmt.pix.height); - if (fmt->fmt.pix.bytesperline < min) { - fmt->fmt.pix.bytesperline = min; - } + if (!(cap->capabilities & V4L2_CAP_STREAMING)) { + LOGD("%s does not support streaming i/o\n", cam->device_name); + iOutRet = FAILED; + break; + } - min = fmt->fmt.pix.bytesperline * fmt->fmt.pix.height; - if (fmt->fmt.pix.sizeimage < min) { - fmt->fmt.pix.sizeimage = min; - } + LOGD("VIDOOC_QUERYCAP camera driver is [%s] card is [%s] businfo is [%s] version is [%d]\n", cap->driver, + cap->card, cap->bus_info, cap->version); + + // Select video input, video standard and tune here. + + CLEAR(*cropcap); + cropcap->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; + + crop->c.width = cam->width; + crop->c.height = cam->height; + crop->c.left = 0; + crop->c.top = 0; + crop->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; + + CLEAR(*fmt); + fmt->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; + fmt->fmt.pix.width = cam->width; + fmt->fmt.pix.height = cam->height; + fmt->fmt.pix.pixelformat = V4L2_PIX_FMT_NV21; + fmt->fmt.pix.field = V4L2_FIELD_INTERLACED; + iRet = xioctl(cam->fd, VIDIOC_S_FMT, fmt); + if (FAILED == iRet) { + iOutRet = iRet; + LOGD("VIDIOC_S_FMT is ERROR\n"); + break; + } - iRet = InitMmap(cam); - if (FAILED == iRet) { - LOGD("INIT MMAP FAILED\n"); - iOutRet = iRet; - break; - } + // Note VIDIOC_S_FMT may change width and height. + // Buggy driver paranoia. + min = fmt->fmt.pix.width * 2; + LOGD("bytesperline : %d w:h [%d %d]\n", fmt->fmt.pix.bytesperline, fmt->fmt.pix.width, fmt->fmt.pix.height); + if (fmt->fmt.pix.bytesperline < min) { + fmt->fmt.pix.bytesperline = min; + } - } while (FALSE); + min = fmt->fmt.pix.bytesperline * fmt->fmt.pix.height; + if (fmt->fmt.pix.sizeimage < min) { + fmt->fmt.pix.sizeimage = min; + } - return iOutRet; + iRet = InitMmap(cam); + if (FAILED == iRet) { + LOGD("INIT MMAP FAILED\n"); + iOutRet = iRet; + break; + } + } while (FALSE); + return iOutRet; */ + + //for warning + cam = cam; return 0; } @@ -252,498 +269,528 @@ int CTvScreenCapture::InitCamera(struct camera *cam) int CTvScreenCapture::SetVideoParameter(int width, int height, int frame) { /* - int iOutRet = SUCCEED, iRet; - - do { - m_capV4l2Cam.device_name = "/dev/video11"; - m_capV4l2Cam.buffers = NULL; - m_capV4l2Cam.width = 1280; - m_capV4l2Cam.height = 720; - m_capV4l2Cam.display_depth = 24; //5; //* RGB24 - m_capV4l2Cam.frame_number = 1; //fps - iOutRet = OpenCamera(&m_capV4l2Cam) ; - if (SUCCEED != iOutRet) { - LOGD("ERROR:::Open Camera device failed\n"); - break; - } - m_capV4l2Cam.width = width; - m_capV4l2Cam.height = height; - m_capV4l2Cam.frame_number = frame; + int iOutRet = SUCCEED, iRet; + + do { + m_capV4l2Cam.device_name = "/dev/video11"; + m_capV4l2Cam.buffers = NULL; + m_capV4l2Cam.width = 1280; + m_capV4l2Cam.height = 720; + m_capV4l2Cam.display_depth = 24; //5; //RGB24 + m_capV4l2Cam.frame_number = 1; //fps + iOutRet = OpenCamera(&m_capV4l2Cam) ; + if (SUCCEED != iOutRet) { + LOGD("ERROR:::Open Camera device failed\n"); + break; + } + m_capV4l2Cam.width = width; + m_capV4l2Cam.height = height; + m_capV4l2Cam.frame_number = frame; - iRet = InitCamera(&m_capV4l2Cam); - if (SUCCEED != iRet) { - iOutRet = iRet; - break; - } + iRet = InitCamera(&m_capV4l2Cam); + if (SUCCEED != iRet) { + iOutRet = iRet; + break; + } + + } while (FALSE); - } while (FALSE); + return iOutRet ;*/ - return iOutRet ;*/ + //for warning + width = width; + height = height; + frame = frame; return 0; } int CTvScreenCapture::StartCapturing(struct camera *cam) { /* - unsigned int i; - int iOutRet = SUCCEED, iRet; - enum v4l2_buf_type type; + unsigned int i; + int iOutRet = SUCCEED, iRet; + enum v4l2_buf_type type; - do { - for (i = 0; i < m_capNumBuffers; ++i) { - struct v4l2_buffer buf; + do { + for (i = 0; i < m_capNumBuffers; ++i) { + struct v4l2_buffer buf; - //CLEAR(buf); + //CLEAR(buf); - buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; - buf.memory = V4L2_MEMORY_MMAP; - buf.index = i; + buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; + buf.memory = V4L2_MEMORY_MMAP; + buf.index = i; - iRet = xioctl(cam->fd, VIDIOC_QBUF, &buf); - if (FAILED == iRet) { - iOutRet = iRet; - goto IS_ERROR; - } - } + iRet = xioctl(cam->fd, VIDIOC_QBUF, &buf); + if (FAILED == iRet) { + iOutRet = iRet; + goto IS_ERROR; + } + } + type = V4L2_BUF_TYPE_VIDEO_CAPTURE; + iRet = xioctl(cam->fd, VIDIOC_STREAMON, &type); + if (FAILED == iRet) { + iOutRet = iRet; + break; + } + } while (FALSE); - type = V4L2_BUF_TYPE_VIDEO_CAPTURE; - iRet = xioctl(cam->fd, VIDIOC_STREAMON, &type); - if (FAILED == iRet) { - iOutRet = iRet; - break; - } - } while (FALSE); - IS_ERROR: +IS_ERROR: + return iOutRet;*/ - return iOutRet;*/ + //for warning + cam = cam; return 0; } int CTvScreenCapture::VideoStart() { /* - int iOutRet = SUCCEED, iRet; - - do { - iRet = StartCapturing(&m_capV4l2Cam); - if (FAILED == iRet) { - iOutRet = iRet; - break; - } + int iOutRet = SUCCEED, iRet; + do { + iRet = StartCapturing(&m_capV4l2Cam); + if (FAILED == iRet) { + iOutRet = iRet; + break; + } + } while (FALSE); - } while (FALSE); + return iOutRet;*/ - return iOutRet;*/ return 0; } void CTvScreenCapture::yuv_to_rgb32(unsigned char y, unsigned char u, unsigned char v, unsigned char *rgb) { /* - register int r, g, b; - int rgb24; - - r = (1192 * (y - 16) + 1634 * (v - 128) ) >> 10; - g = (1192 * (y - 16) - 833 * (v - 128) - 400 * (u - 128) ) >> 10; - b = (1192 * (y - 16) + 2066 * (u - 128) ) >> 10; - - r = r > 255 ? 255 : r < 0 ? 0 : r; - g = g > 255 ? 255 : g < 0 ? 0 : g; - b = b > 255 ? 255 : b < 0 ? 0 : b; - - rgb24 = (int)((r << 16) | (g << 8) | b); - - //*ARGB - *rgb = (unsigned char)r; - rgb ++; - *rgb = (unsigned char)g; - rgb++; - *rgb = (unsigned char)b; - rgb++; - *rgb = 0xff;*/ - return; + register int r, g, b; + int rgb24; + + r = (1192 * (y - 16) + 1634 * (v - 128) ) >> 10; + g = (1192 * (y - 16) - 833 * (v - 128) - 400 * (u - 128) ) >> 10; + b = (1192 * (y - 16) + 2066 * (u - 128) ) >> 10; + + r = r > 255 ? 255 : r < 0 ? 0 : r; + g = g > 255 ? 255 : g < 0 ? 0 : g; + b = b > 255 ? 255 : b < 0 ? 0 : b; + + rgb24 = (int)((r << 16) | (g << 8) | b); + + //ARGB + *rgb = (unsigned char)r; + rgb ++; + *rgb = (unsigned char)g; + rgb++; + *rgb = (unsigned char)b; + rgb++; + *rgb = 0xff;*/ + + //for warning + y = y; + u = u; + v = v; + rgb = rgb; } - void CTvScreenCapture::nv21_to_rgb32(unsigned char *buf, unsigned char *rgb, int width, int height, int *len) { /* - int x, y, z = 0; - int h, w; - int blocks; - unsigned char Y1, Y2, U, V; - - *len = 0; - - blocks = (width * height) * 2; - - for (h = 0, z = 0; h < height; h += 2) { - for (y = 0; y < width * 2; y += 2) { - - Y1 = buf[ h * width + y + 0]; - V = buf[ blocks / 2 + h * width / 2 + y % width + 0 ]; - Y2 = buf[ h * width + y + 1]; - U = buf[ blocks / 2 + h * width / 2 + y % width + 1 ]; + int x, y, z = 0; + int h, w; + int blocks; + unsigned char Y1, Y2, U, V; + + *len = 0; + blocks = (width * height) * 2; + for (h = 0, z = 0; h < height; h += 2) { + for (y = 0; y < width * 2; y += 2) { + Y1 = buf[ h * width + y + 0]; + V = buf[ blocks / 2 + h * width / 2 + y % width + 0 ]; + Y2 = buf[ h * width + y + 1]; + U = buf[ blocks / 2 + h * width / 2 + y % width + 1 ]; + + yuv_to_rgb32(Y1, U, V, &rgb[z]); + yuv_to_rgb32(Y2, U, V, &rgb[z + 4]); + z += 8; + } + } + *len = z; + */ - yuv_to_rgb32(Y1, U, V, &rgb[z]); - yuv_to_rgb32(Y2, U, V, &rgb[z + 4]); - z += 8; - } - } - *len = z; - LOGD("z +++++++++++++++++++++++++++++++++ z %d\n", z);*/ - return; + //for warning + buf = buf; + rgb = rgb; + width = width; + height = height; + len = len; } - int CTvScreenCapture::GetVideoData(int *length) { /* - int iOutRet = SUCCEED, iRet; - - *length = 0; - while (true) { - fd_set fds; - struct timeval tv; - FD_ZERO(&fds); - FD_SET(m_capV4l2Cam.fd, &fds); - //* Timeout. - tv.tv_sec = 0; - tv.tv_usec = 30000; - iRet = select(m_capV4l2Cam.fd + 1, &fds, NULL, NULL, &tv); - if (FAILED == iRet) { - LOGD("select FAILED\n"); - if (EINTR == errno) { - LOGD("select FAILED Continue\n"); - continue; - } - - } - - if (0 == iRet) { - LOGD("select timeout\n"); - continue ; - } - - struct v4l2_buffer buf; - CLEAR(buf); - - buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; - buf.memory = V4L2_MEMORY_MMAP; - iRet = xioctl(m_capV4l2Cam.fd, VIDIOC_DQBUF, &buf); - if (FAILED == iRet) { - if (errno == EAGAIN) { - LOGD("GetVideoData EAGAIN \n"); - } - - continue; - } + int iOutRet = SUCCEED, iRet; + + *length = 0; + while (true) { + fd_set fds; + struct timeval tv; + FD_ZERO(&fds); + FD_SET(m_capV4l2Cam.fd, &fds); + // Timeout. + tv.tv_sec = 0; + tv.tv_usec = 30000; + iRet = select(m_capV4l2Cam.fd + 1, &fds, NULL, NULL, &tv); + if (FAILED == iRet) { + LOGD("select FAILED\n"); + if (EINTR == errno) { + LOGD("select FAILED Continue\n"); + continue; + } + } - LOGD("DDDDDDDDDDAAAAAAAAAAAAAAAAAAAATTTTTTTTTTTTTTAAAAAAAAAAAAAAAAAAAAAAAAAAAAA %d %d [width:%d] [height:%d]\n", buf.length, iRet, - m_capV4l2Cam.width, m_capV4l2Cam.height); - int tmpLen = 0; - nv21_to_rgb32((unsigned char *)m_capV4l2Cam.buffers[buf.index].start, (unsigned char *)m_pData, m_capV4l2Cam.width, m_capV4l2Cam.height, &tmpLen); - //memcpy(m_pData,m_capV4l2Cam.buffers[buf.index].start, buf.length +1); - *length = buf.length; - break; + if (0 == iRet) { + LOGD("select timeout\n"); + continue ; + } - } + struct v4l2_buffer buf; + CLEAR(buf); + + buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; + buf.memory = V4L2_MEMORY_MMAP; + iRet = xioctl(m_capV4l2Cam.fd, VIDIOC_DQBUF, &buf); + if (FAILED == iRet) { + if (errno == EAGAIN) { + LOGD("GetVideoData EAGAIN \n"); + } + continue; + } - if (*length > 0) { - mCapEvt.mFrameWide = m_capV4l2Cam.width; - mCapEvt.mFrameHeight = m_capV4l2Cam.height; - mCapEvt.mFrameNum = 1; - mCapEvt.mFrameSize = *length; - } else { - mCapEvt.mFrameWide = 0; - mCapEvt.mFrameHeight = 0; - mCapEvt.mFrameNum = 0; - mCapEvt.mFrameSize = 0; - } + LOGD("DDDDDDDDDDAAAAAAAAAAAAAAAAAAAATTTTTTTTTTTTTTAAAAAAAAAAAAAAAAAAAAAAAAAAAAA %d %d [width:%d] [height:%d]\n", buf.length, iRet, + m_capV4l2Cam.width, m_capV4l2Cam.height); + int tmpLen = 0; + nv21_to_rgb32((unsigned char *)m_capV4l2Cam.buffers[buf.index].start, (unsigned char *)m_pData, m_capV4l2Cam.width, m_capV4l2Cam.height, &tmpLen); + //memcpy(m_pData,m_capV4l2Cam.buffers[buf.index].start, buf.length +1); + *length = buf.length; + break; + } + + if (*length > 0) { + mCapEvt.mFrameWide = m_capV4l2Cam.width; + mCapEvt.mFrameHeight = m_capV4l2Cam.height; + mCapEvt.mFrameNum = 1; + mCapEvt.mFrameSize = *length; + } else { + mCapEvt.mFrameWide = 0; + mCapEvt.mFrameHeight = 0; + mCapEvt.mFrameNum = 0; + mCapEvt.mFrameSize = 0; + } + + if (NULL != mpObserver) { + mpObserver->onTvEvent(mCapEvt); + } - if (NULL != mpObserver) { - mpObserver->onTvEvent(mCapEvt); - } + return iOutRet;*/ - return iOutRet;*/ + //for warning + length = length; return 0; } int CTvScreenCapture::StopCapturing(struct camera *cam) { /* - int iOutRet = SUCCEED, iRet; - enum v4l2_buf_type type; + int iOutRet = SUCCEED, iRet; + enum v4l2_buf_type type; - do { - type = V4L2_BUF_TYPE_VIDEO_CAPTURE; + do { + type = V4L2_BUF_TYPE_VIDEO_CAPTURE; - iRet = xioctl(cam->fd, VIDIOC_STREAMOFF, &type); - if (FAILED == iRet) { - iOutRet = iRet; - break; - } - } while (FALSE); + iRet = xioctl(cam->fd, VIDIOC_STREAMOFF, &type); + if (FAILED == iRet) { + iOutRet = iRet; + break; + } + } while (FALSE); + return iOutRet;*/ - return iOutRet;*/ + //for warning + cam = cam; return 0; } -int CTvScreenCapture::VideoStop() +int CTvScreenCapture::VideoStop() { /* - StopCapturing(&m_capV4l2Cam); - UninitCamera(&m_capV4l2Cam); - return SUCCEED;*/ + StopCapturing(&m_capV4l2Cam); + UninitCamera(&m_capV4l2Cam); + return SUCCEED;*/ return 0; } int CTvScreenCapture::UninitCamera(struct camera *cam) { /* - unsigned int i; + unsigned int i; - for (i = 0; i < m_capNumBuffers; ++i) { - if (cam->buffers[i].start == NULL) { - break; - } - - if (FAILED == munmap(cam->buffers[i].start, cam->buffers[i].length)) { - LOGD("ERROR::munmap cam buffer failed\n"); - break; - } - } + for (i = 0; i < m_capNumBuffers; ++i) { + if (cam->buffers[i].start == NULL) { + break; + } - if (NULL != cam->buffers) - free(cam->buffers); + if (FAILED == munmap(cam->buffers[i].start, cam->buffers[i].length)) { + LOGD("ERROR::munmap cam buffer failed\n"); + break; + } + } - cam->buffers = NULL; + if (NULL != cam->buffers) + free(cam->buffers); + cam->buffers = NULL; + return SUCCEED;*/ - return SUCCEED;*/ + //for warning + cam = cam; return 0; } int CTvScreenCapture::CloseCamera(struct camera *cam) { /* - int iOutRet = SUCCEED, iRet; + int iOutRet = SUCCEED, iRet; - do { - if (cam->fd > 0) { - iRet = close(cam->fd); - if (FAILED == iRet) { - iOutRet = iRet; - break; - } + do { + if (cam->fd > 0) { + iRet = close(cam->fd); + if (FAILED == iRet) { + iOutRet = iRet; + break; + } + + cam->fd = -1; + } + } while (FALSE); - cam->fd = -1; - } - } while (FALSE); + return iOutRet;*/ - return iOutRet;*/ + //for warning + cam = cam; return 0; } int CTvScreenCapture::DeinitVideoCap() { /* - CloseCamera(&m_capV4l2Cam); - return SUCCEED ; - */ + CloseCamera(&m_capV4l2Cam); + return SUCCEED ; + */ return 0; } int CTvScreenCapture::AmvideocapCapFrame(char *buf, int size, int *w, int *h, int *ret_size) { /* - int iOutRet = SUCCEED, iRet; - int iDevFd = -1; - int format = FORMAT_S32_ABGR; - - do { - iDevFd = open(VIDEOCAPDEV, O_RDWR); - if (iDevFd < 0) { - LOGD("ERROR,open amvideocap0 failed\n"); - iOutRet = FAILED; - break; - } + int iOutRet = SUCCEED, iRet; + int iDevFd = -1; + int format = FORMAT_S32_ABGR; - if ((w != NULL) && (*w > 0)) { - iRet = ioctl(iDevFd, AMVIDEOCAP_IOW_SET_WANTFRAME_WIDTH, *w); - if (iRet < 0) { - iOutRet = iRet; - break; - } - } + do { + iDevFd = open(VIDEOCAPDEV, O_RDWR); + if (iDevFd < 0) { + LOGD("ERROR,open amvideocap0 failed\n"); + iOutRet = FAILED; + break; + } - if ((h != NULL) && (*h > 0)) { + if ((w != NULL) && (*w > 0)) { + iRet = ioctl(iDevFd, AMVIDEOCAP_IOW_SET_WANTFRAME_WIDTH, *w); + if (iRet < 0) { + iOutRet = iRet; + break; + } + } - iRet = ioctl(iDevFd, AMVIDEOCAP_IOW_SET_WANTFRAME_HEIGHT, *h); - if (iRet < 0) { - iOutRet = iRet; - break; - } - } + if ((h != NULL) && (*h > 0)) { + iRet = ioctl(iDevFd, AMVIDEOCAP_IOW_SET_WANTFRAME_HEIGHT, *h); + if (iRet < 0) { + iOutRet = iRet; + break; + } + } - iRet = ioctl(iDevFd, AMVIDEOCAP_IOW_SET_WANTFRAME_FORMAT, format); - if (iRet < 0) { - iOutRet = iRet; - break; - } + iRet = ioctl(iDevFd, AMVIDEOCAP_IOW_SET_WANTFRAME_FORMAT, format); + if (iRet < 0) { + iOutRet = iRet; + break; + } - *ret_size = read(iDevFd, buf, size); - if (0 == *ret_size) { - LOGD("ERROR:: Cann't Read video data\n"); - iOutRet = FAILED; - *ret_size = 0; - break; - } + *ret_size = read(iDevFd, buf, size); + if (0 == *ret_size) { + LOGD("ERROR:: Cann't Read video data\n"); + iOutRet = FAILED; + *ret_size = 0; + break; + } - LOGD("========== Got Data Size : %d ==============\n", *ret_size); - #if 0 - if (w != NULL) { - iRet = ioctl(iDevFd, AMVIDEOCAP_IOR_GET_FRAME_WIDTH, w); - } + LOGD("========== Got Data Size : %d ==============\n", *ret_size); +#if 0 + if (w != NULL) { + iRet = ioctl(iDevFd, AMVIDEOCAP_IOR_GET_FRAME_WIDTH, w); + } - if (h != NULL) { - iRet = ioctl(iDevFd, AMVIDEOCAP_IOR_GET_FRAME_HEIGHT, h); - } - #endif - } while (FALSE); + if (h != NULL) { + iRet = ioctl(iDevFd, AMVIDEOCAP_IOR_GET_FRAME_HEIGHT, h); + } +#endif + } while (FALSE); - close(iDevFd); + close(iDevFd); + return iOutRet;*/ - return iOutRet;*/ + //for warning + buf = buf; + size = size; + w = w; + h = h; + ret_size = ret_size; return 0; } int CTvScreenCapture::CapOsdAndVideoLayer(int width, int height) { /* - int iOutRet = SUCCEED, iRet; - status_t iStatus; - ScreenCatch *mScreenCatch = NULL; - MetaData *pMeta = NULL; - MediaBuffer *buffer = NULL; - int dataLen = 0; - - do { - mScreenCatch = new ScreenCatch(width, height, 32); - if (NULL == mScreenCatch) { - LOGD("ERROR!!! mScreenCatch is NULL\n"); - iOutRet = FAILED; - break; - } + int iOutRet = SUCCEED, iRet; + status_t iStatus; + ScreenCatch *mScreenCatch = NULL; + MetaData *pMeta = NULL; + MediaBuffer *buffer = NULL; + int dataLen = 0; - pMeta = new MetaData(); - if (NULL == pMeta) { - LOGD("ERROR!!! pMeta is NULL\n"); - iOutRet = FAILED; - break; - } - pMeta->setInt32(kKeyColorFormat, OMX_COLOR_Format32bitARGB8888); - - mScreenCatch->start(pMeta); + do { + mScreenCatch = new ScreenCatch(width, height, 32); + if (NULL == mScreenCatch) { + LOGD("ERROR!!! mScreenCatch is NULL\n"); + iOutRet = FAILED; + break; + } - while (true) { - iStatus = mScreenCatch->read(&buffer); - if (iStatus != OK ) { - usleep(1000); - continue; - } + pMeta = new MetaData(); + if (NULL == pMeta) { + LOGD("ERROR!!! pMeta is NULL\n"); + iOutRet = FAILED; + break; + } + pMeta->setInt32(kKeyColorFormat, OMX_COLOR_Format32bitARGB8888); - if (NULL == buffer) { - iOutRet = FAILED; - break; - } + mScreenCatch->start(pMeta); - LOGD("DDDDDDDDDDAAAAAAAAAAAAAAAAAAAATTTTTTTTTTTTTTAAAAAAAAAAAAAAAAAAAAAAAAAAAAA %d %d\n", buffer->size(), iStatus); - //nv21_to_rgb32((unsigned char*)buffer->data(),(unsigned char *)m_pData,width,height,&dataLen); - memcpy((unsigned char *)m_pData, (unsigned char *)buffer->data(), buffer->size()); - break; - } + while (true) { + iStatus = mScreenCatch->read(&buffer); + if (iStatus != OK ) { + usleep(1000); + continue; + } - } while (FALSE); - - if (dataLen > 0) { - mCapEvt.mFrameWide = width; - mCapEvt.mFrameHeight = height; - mCapEvt.mFrameNum = 1; - mCapEvt.mFrameSize = dataLen; - } else { - mCapEvt.mFrameWide = 0; - mCapEvt.mFrameHeight = 0; - mCapEvt.mFrameNum = 0; - mCapEvt.mFrameSize = 0; - } + if (NULL == buffer) { + iOutRet = FAILED; + break; + } - if (NULL != mpObserver) { - mpObserver->onTvEvent(mCapEvt); - } + LOGD("DDDDDDDDDDAAAAAAAAAAAAAAAAAAAATTTTTTTTTTTTTTAAAAAAAAAAAAAAAAAAAAAAAAAAAAA %d %d\n", buffer->size(), iStatus); + //nv21_to_rgb32((unsigned char*)buffer->data(),(unsigned char *)m_pData,width,height,&dataLen); + memcpy((unsigned char *)m_pData, (unsigned char *)buffer->data(), buffer->size()); + break; + } + } while (FALSE); - mScreenCatch->stop(); + if (dataLen > 0) { + mCapEvt.mFrameWide = width; + mCapEvt.mFrameHeight = height; + mCapEvt.mFrameNum = 1; + mCapEvt.mFrameSize = dataLen; + } else { + mCapEvt.mFrameWide = 0; + mCapEvt.mFrameHeight = 0; + mCapEvt.mFrameNum = 0; + mCapEvt.mFrameSize = 0; + } + + if (NULL != mpObserver) { + mpObserver->onTvEvent(mCapEvt); + } + + mScreenCatch->stop(); + + mScreenCatch->free(buffer); + buffer = NULL; + return iOutRet;*/ - mScreenCatch->free(buffer); - buffer = NULL; - return iOutRet;*/ + //for warning + width = width; + height = height; return 0; } int CTvScreenCapture::CapMediaPlayerVideoLayerOnly(int width, int height) { /* - int iOutRet = SUCCEED, iRet; - int ibufSize, iDataSize = 0; - int w, h; - - do { - ibufSize = width * height * 4; - w = width; - h = height; - - iRet = AmvideocapCapFrame(m_pData, ibufSize, &w, &h, &iDataSize); - if (SUCCEED != iRet) { - LOGD("AmvideocapCapFrame Cannt CapFram\n"); - iOutRet = iRet; - break; - } + int iOutRet = SUCCEED, iRet; + int ibufSize, iDataSize = 0; + int w, h; - LOGD("GOT DDDDDDDDDAAAAAAAATTTTTTTTTTTAAAAAA Size : %d w:%d h: %d\n", iDataSize, w, h); - - if (iDataSize > 0) { - mCapEvt.mFrameWide = w; - mCapEvt.mFrameHeight = h; - mCapEvt.mFrameNum = 1; - mCapEvt.mFrameSize = iDataSize; - } else { - mCapEvt.mFrameWide = 0; - mCapEvt.mFrameHeight = 0; - mCapEvt.mFrameNum = 0; - mCapEvt.mFrameSize = 0; - } + do { + ibufSize = width * height * 4; + w = width; + h = height; + + iRet = AmvideocapCapFrame(m_pData, ibufSize, &w, &h, &iDataSize); + if (SUCCEED != iRet) { + LOGD("AmvideocapCapFrame Cannt CapFram\n"); + iOutRet = iRet; + break; + } - if (NULL != mpObserver) { - mpObserver->onTvEvent(mCapEvt); - } - } while (FALSE); + LOGD("GOT DDDDDDDDDAAAAAAAATTTTTTTTTTTAAAAAA Size : %d w:%d h: %d\n", iDataSize, w, h); + + if (iDataSize > 0) { + mCapEvt.mFrameWide = w; + mCapEvt.mFrameHeight = h; + mCapEvt.mFrameNum = 1; + mCapEvt.mFrameSize = iDataSize; + } else { + mCapEvt.mFrameWide = 0; + mCapEvt.mFrameHeight = 0; + mCapEvt.mFrameNum = 0; + mCapEvt.mFrameSize = 0; + } - return iOutRet;*/ + if (NULL != mpObserver) { + mpObserver->onTvEvent(mCapEvt); + } + } while (FALSE); + + return iOutRet;*/ + + //for warning + width = width; + height = height; return 0; } CTvScreenCapture::CTvScreenCapture() { /* - m_capNumBuffers = 0; - memset(&m_capV4l2Cam, 0x00, sizeof(camera)); - mpObserver = NULL;*/ - return ; + m_capNumBuffers = 0; + memset(&m_capV4l2Cam, 0x00, sizeof(camera)); + mpObserver = NULL;*/ } + CTvScreenCapture::~CTvScreenCapture() { /* - memset(&m_capV4l2Cam, 0x00, sizeof(camera)); - m_pData = NULL;*/ + memset(&m_capV4l2Cam, 0x00, sizeof(camera)); + m_pData = NULL;*/ } diff --git a/tvapi/libtv/tv/CTvScreenCapture.h b/tvapi/libtv/tv/CTvScreenCapture.h index 7bbf57e..c72ca8e 100644 --- a/tvapi/libtv/tv/CTvScreenCapture.h +++ b/tvapi/libtv/tv/CTvScreenCapture.h @@ -26,7 +26,6 @@ struct buffer { size_t length; }; - struct camera { char *device_name; int fd; @@ -48,19 +47,19 @@ format see linux/ge2d/ge2d.h like: GE2D_FORMAT_S24_RGB */ -#define ENDIAN_SHIFT 24 -#define LITTLE_ENDIAN (1 << ENDIAN_SHIFT) -#define FMT_S24_RGB (LITTLE_ENDIAN|0x00200) /* 10_00_0_00_0_00 */ -#define FMT_S16_RGB (LITTLE_ENDIAN|0x00100) /* 01_00_0_00_0_00 */ -#define FMT_S32_RGBA (LITTLE_ENDIAN|0x00300) /* 11_00_0_00_0_00 */ - -#define COLOR_MAP_SHIFT 20 -#define COLOR_MAP_MASK (0xf << COLOR_MAP_SHIFT) +#define ENDIAN_SHIFT 24 +#define TV_LITTLE_ENDIAN (1 << ENDIAN_SHIFT) +#define FMT_S24_RGB (TV_LITTLE_ENDIAN|0x00200) /* 10_00_0_00_0_00 */ +#define FMT_S16_RGB (TV_LITTLE_ENDIAN|0x00100) /* 01_00_0_00_0_00 */ +#define FMT_S32_RGBA (TV_LITTLE_ENDIAN|0x00300) /* 11_00_0_00_0_00 */ + +#define COLOR_MAP_SHIFT 20 +#define COLOR_MAP_MASK (0xf << COLOR_MAP_SHIFT) /* 16 bit */ -#define COLOR_MAP_RGB565 (5 << COLOR_MAP_SHIFT) +#define COLOR_MAP_RGB565 (5 << COLOR_MAP_SHIFT) /* 24 bit */ -#define COLOR_MAP_RGB888 (0 << COLOR_MAP_SHIFT) -#define COLOR_MAP_BGR888 (5 << COLOR_MAP_SHIFT) +#define COLOR_MAP_RGB888 (0 << COLOR_MAP_SHIFT) +#define COLOR_MAP_BGR888 (5 << COLOR_MAP_SHIFT) /* 32 bit */ #define COLOR_MAP_RGBA8888 (0 << COLOR_MAP_SHIFT) #define COLOR_MAP_ARGB8888 (1 << COLOR_MAP_SHIFT) diff --git a/tvapi/libtv/tv/CTvSubtitle.cpp b/tvapi/libtv/tv/CTvSubtitle.cpp index bd84703..2b9505e 100644 --- a/tvapi/libtv/tv/CTvSubtitle.cpp +++ b/tvapi/libtv/tv/CTvSubtitle.cpp @@ -6,31 +6,38 @@ // @ Date : 2013-11 // @ Author : // -// +#define LOG_TAG "CTvSubtitle" + #include "CTvSubtitle.h" #include "am_misc.h" #include "am_dmx.h" + CTvSubtitle::CTvSubtitle() { mpObser = NULL; } + CTvSubtitle::~CTvSubtitle() { } + void CTvSubtitle::setObserver(IObserver *pObser) { isSubOpen = false; mpObser = pObser; } + void CTvSubtitle::setBuffer(char *share_mem) { pthread_mutex_lock(&lock); buffer = (unsigned char *)share_mem; pthread_mutex_unlock(&lock); } + void CTvSubtitle::stopDecoder() { } + /** * 开始字幕信息解析showboz sync */ @@ -50,7 +57,6 @@ void CTvSubtitle::stop() */ void CTvSubtitle::clear() { - } /** @@ -58,7 +64,6 @@ void CTvSubtitle::clear() */ void CTvSubtitle::nextPage() { - } /** @@ -66,16 +71,14 @@ void CTvSubtitle::nextPage() */ void CTvSubtitle::previousPage() { - } /** * 在图文模式下跳转到指定页 * @param page 要跳转到的页号 */ -void CTvSubtitle::gotoPage(int page) +void CTvSubtitle::gotoPage(int page __unused) { - } /** @@ -83,16 +86,14 @@ void CTvSubtitle::gotoPage(int page) */ void CTvSubtitle::goHome() { - } /** * 在图文模式下根据颜色跳转到指定链接 * @param color 颜色,COLOR_RED/COLOR_GREEN/COLOR_YELLOW/COLOR_BLUE */ -void CTvSubtitle::colorLink(int color) +void CTvSubtitle::colorLink(int color __unused) { - } /** @@ -100,9 +101,8 @@ void CTvSubtitle::colorLink(int color) * @param pattern 搜索匹配字符串 * @param casefold 是否区分大小写 */ -void CTvSubtitle::setSearchPattern(char *pattern, bool casefold) +void CTvSubtitle::setSearchPattern(char *pattern __unused, bool casefold __unused) { - } /** @@ -161,7 +161,6 @@ static void clear_bitmap(CTvSubtitle *pSub) memset(ptr, 0, pSub->bmp_pitch); ptr += pSub->bmp_pitch; } - } static void show_sub_cb(AM_SUB2_Handle_t handle, AM_SUB2_Picture_t *pic) @@ -253,7 +252,7 @@ static void show_sub_cb(AM_SUB2_Handle_t handle, AM_SUB2_Picture_t *pic) } -static uint64_t get_pts_cb(void *handle, uint64_t pts) +static uint64_t get_pts_cb(void *handle __unused, uint64_t pts __unused) { char buf[32]; AM_ErrorCode_t ret; @@ -275,7 +274,8 @@ static uint64_t get_pts_cb(void *handle, uint64_t pts) return r; } -static void pes_data_cb(int dev_no, int fhandle, const uint8_t *data, int len, void *user_data) +static void pes_data_cb(int dev_no __unused, int fhandle __unused, + const uint8_t *data, int len, void *user_data) { CTvSubtitle *pSub = ((CTvSubtitle *) user_data); AM_PES_Decode(pSub->pes_handle, (uint8_t *)data, len); @@ -328,7 +328,7 @@ static int open_dmx(CTvSubtitle *pSub, int dmx_id, int pid) ret = AM_DMX_SetPesFilter(dmx_id, pSub->filter_handle, &pesp); if (ret != AM_SUCCESS) { - LOGD("error AM_DMX_SetPesFilter != AM_SUCCESS, err = %d", strerror(errno)); + LOGD("error AM_DMX_SetPesFilter != AM_SUCCESS, err = %s", strerror(errno)); goto error; } @@ -420,7 +420,8 @@ error: return -1; } -int CTvSubtitle::sub_start_dtv_tt(int dmx_id, int region_id, int pid, int page, int sub_page, bool is_sub) +int CTvSubtitle::sub_start_dtv_tt(int dmx_id __unused, int region_id __unused, int pid __unused, + int page __unused, int sub_page __unused, bool is_sub __unused) { return 0; } @@ -447,12 +448,12 @@ int CTvSubtitle::sub_stop_dtv_tt() return 0; } -int CTvSubtitle::sub_tt_goto(int page) +int CTvSubtitle::sub_tt_goto(int page __unused) { return 0; } -int CTvSubtitle::sub_tt_color_link(int color) +int CTvSubtitle::sub_tt_color_link(int color __unused) { return 0; } @@ -462,17 +463,17 @@ int CTvSubtitle::sub_tt_home_link() return 0; } -int CTvSubtitle::sub_tt_next(int dir) +int CTvSubtitle::sub_tt_next(int dir __unused) { return 0; } -int CTvSubtitle::sub_tt_set_search_pattern(char *pattern, bool casefold) +int CTvSubtitle::sub_tt_set_search_pattern(char *pattern __unused, bool casefold __unused) { return 0; } -int CTvSubtitle::sub_tt_search(int dir) +int CTvSubtitle::sub_tt_search(int dir __unused) { return 0; } @@ -601,22 +602,24 @@ int CTvSubtitle::sub_stop_atsc_cc() AM_CC_Cmd(CMD_CC_STOP); return 0; } + int CTvSubtitle::ResetVchipChgStat() { avchip_chg = 0; AM_CC_Cmd(CMD_VCHIP_RST_CHGSTAT); return 0; } + int CTvSubtitle::IsVchipChange() { return avchip_chg; } + //cnt :data buf len //databuf len is max 512 //cmdbuf len is max 128 void CTvSubtitle::close_caption_callback(char *str, int cnt, int data_buf[], int cmd_buf[], void *user_data) { - /* CTvSubtitle *pSub = (CTvSubtitle *)user_data; @@ -635,9 +638,17 @@ void CTvSubtitle::close_caption_callback(char *str, int cnt, int data_buf[], int pSub->mpObser->onEvent(pSub->mCurCCEv); */ + + str = str; + cnt = cnt; + data_buf = data_buf; + cmd_buf = cmd_buf; + user_data = user_data; } + void CTvSubtitle::atv_vchip_callback(int Is_chg, void *user_data) { CTvSubtitle *pSub = (CTvSubtitle *)user_data; pSub->avchip_chg = Is_chg; } + diff --git a/tvapi/libtv/tv/CTvSubtitle.h b/tvapi/libtv/tv/CTvSubtitle.h index ee8e9e6..284f982 100644 --- a/tvapi/libtv/tv/CTvSubtitle.h +++ b/tvapi/libtv/tv/CTvSubtitle.h @@ -17,20 +17,18 @@ using namespace android; #include "am_sub2.h" #include "am_pes.h" #include "CTvEv.h" -#define LOG_TAG "CTvSubtitle" - -typedef enum cc_param_country { +enum cc_param_country { CC_PARAM_COUNTRY_USA = 0, CC_PARAM_COUNTRY_KOREA, }; -typedef enum cc_param_source_type { +enum cc_param_source_type { CC_PARAM_SOURCE_VBIDATA = 0, CC_PARAM_SOURCE_USERDATA, }; -typedef enum cc_param_caption_type { +enum cc_param_caption_type { CC_PARAM_ANALOG_CAPTION_TYPE_CC1 = 0, CC_PARAM_ANALOG_CAPTION_TYPE_CC2, CC_PARAM_ANALOG_CAPTION_TYPE_CC3, @@ -47,6 +45,7 @@ typedef enum cc_param_caption_type { CC_PARAM_DIGITAL_CAPTION_TYPE_SERVICE5, CC_PARAM_DIGITAL_CAPTION_TYPE_SERVICE6, }; + class CTvSubtitle { public: class IObserver { diff --git a/tvapi/libtv/tv/CTvTime.cpp b/tvapi/libtv/tv/CTvTime.cpp index e0ec5b4..10b9f7a 100644 --- a/tvapi/libtv/tv/CTvTime.cpp +++ b/tvapi/libtv/tv/CTvTime.cpp @@ -7,9 +7,58 @@ // @ Date : 2013-11 // @ Author : // -// -#include "CTvTime.h" -#ifdef LOG_TAG -#undef LOG_TAG #define LOG_TAG "CTvTime" -#endif + +#include "CTvTime.h" + +/** + *设定当前时间 + *@param time 当前时间(毫秒单位) + */ +long CTvTime::getSysUTCTime() +{ + //struct tm tm; + //time_t t; + //int64_t r = mktime_tz(&(tm), NULL); + //time_t t = time(NULL); + //LOGD("---------utc t = %ld time t=%ld", r, t); + return 0; +} + +void CTvTime::setTime(long t) +{ + //long utcMS; + //time(&utcMS); + //nsecs_t ns = systemTime(CLOCK_REALTIME); + //nsecs_t tm = ns2s(ns); + //unsigned long ticks = times(NULL); + //long tm = ticks/mHZ; + struct sysinfo s_info; + int error; + error = sysinfo(&s_info); + + mDiff = t - s_info.uptime; + LOGD("--- mDiff=%ld", mDiff); +} + +/** + *取得当前时间 + *@return 返回当前时间 + */ +long CTvTime::getTime() +{ + //long utcMS; + //time(&utcMS); + //nsecs_t ns = systemTime(CLOCK_REALTIME); + //nsecs_t sec = ns2s(ns); + + //unsigned long ticks = times(NULL); + //long sec = ticks/mHZ; + struct sysinfo s_info; + int error; + error = sysinfo(&s_info); + + + LOGD("--- mDiff=%ld, sec=%ld", mDiff, s_info.uptime); + return s_info.uptime + mDiff; +} diff --git a/tvapi/libtv/tv/CTvTime.h b/tvapi/libtv/tv/CTvTime.h index 7588704..ef41ddb 100644 --- a/tvapi/libtv/tv/CTvTime.h +++ b/tvapi/libtv/tv/CTvTime.h @@ -8,6 +8,10 @@ // @ Author : // // + +#ifndef _C_TV_TIME_H_ +#define _C_TV_TIME_H_ + #include #include "CTvLog.h" #include @@ -15,87 +19,38 @@ #include #include -#define LOG_TAG "CTVTIME" /** *TV时间管理 */ class CTvTime { public: - CTvTime() - { + CTvTime() { mDiff = 0; mHZ = sysconf( _SC_CLK_TCK ); } - /** - *设定当前时间 - *@param time 当前时间(毫秒单位) - */ - long getSysUTCTime() - { - //struct tm tm; - //time_t t; - //int64_t r = mktime_tz(&(tm), NULL); - //time_t t = time(NULL); - //LOGD("---------utc t = %ld time t=%ld", r, t); - return 0; - } - void setTime(long t) - { - //long utcMS; - //time(&utcMS); - //nsecs_t ns = systemTime(CLOCK_REALTIME); - //nsecs_t tm = ns2s(ns); - //unsigned long ticks = times(NULL); - //long tm = ticks/mHZ; - struct sysinfo s_info; - int error; - error = sysinfo(&s_info); - - mDiff = t - s_info.uptime; - LOGD("--- mDiff=%ld", mDiff); - } - - /** - *取得当前时间 - *@return 返回当前时间 - */ - long getTime() - { - //long utcMS; - //time(&utcMS); - //nsecs_t ns = systemTime(CLOCK_REALTIME); - //nsecs_t sec = ns2s(ns); - - //unsigned long ticks = times(NULL); - //long sec = ticks/mHZ; - struct sysinfo s_info; - int error; - error = sysinfo(&s_info); - - - LOGD("--- mDiff=%ld, sec=%ld", mDiff, s_info.uptime); - return s_info.uptime + mDiff; - } + long getSysUTCTime(); + void setTime(long t); + long getTime(); /** *取得TDT/STT与系统时间的差值 *@return 返回差值时间 */ - long getDiffTime() - { + long getDiffTime() { return mDiff; } /** *设置TDT/STT与系统时间的差值 */ - void setDiffTime(long diff) - { - this->mDiff = diff; + void setDiffTime(long diff) { + mDiff = diff; } private: long mDiff; unsigned long mHZ; }; +#endif/*_C_TV_TIME_H_*/ + diff --git a/tvapi/libtv/tv/CTvVchipCheck.cpp b/tvapi/libtv/tv/CTvVchipCheck.cpp index 2eb81dd..e83afcb 100644 --- a/tvapi/libtv/tv/CTvVchipCheck.cpp +++ b/tvapi/libtv/tv/CTvVchipCheck.cpp @@ -2,9 +2,11 @@ CTvVchipCheck:: CTvVchipCheck() { } + CTvVchipCheck:: ~CTvVchipCheck() { } + bool CTvVchipCheck::CheckProgramBlock(int id) { bool lock = false; @@ -27,7 +29,7 @@ bool CTvVchipCheck::CheckProgramBlock(int id) if (prog.isATSCMode()) { // ATSC V-Chip Vector definedRatings = ev.getVChipRatings(); - for (int i = 0; i < definedRatings.size(); i++) { + for (int i = 0; i < (int)definedRatings.size(); i++) { CTvDimension dm; if (dm.isBlocked(dm, definedRatings[i])) { lock = true; @@ -49,7 +51,7 @@ bool CTvVchipCheck::CheckProgramBlock(int id) return lock; } -void *CTvVchipCheck::VchipCheckingThread ( void *arg ) +void *CTvVchipCheck::VchipCheckingThread (void *arg __unused) { /*CTv *pt = static_cast ( arg ); diff --git a/tvapi/libtv/tv/CUpgradeFBC.cpp b/tvapi/libtv/tv/CUpgradeFBC.cpp index 0adad5a..6847a55 100644 --- a/tvapi/libtv/tv/CUpgradeFBC.cpp +++ b/tvapi/libtv/tv/CUpgradeFBC.cpp @@ -1,3 +1,5 @@ +#define LOG_TAG "CUpgradeFBC" + #include #include #include @@ -10,11 +12,6 @@ #include "CUpgradeFBC.h" -#ifdef LOG_TAG -#undef LOG_TAG -#define LOG_TAG "CUpgradeFBC" -#endif - CUpgradeFBC::CUpgradeFBC() { mUpgradeMode = CC_UPGRADE_MODE_MAIN; diff --git a/tvapi/libtv/tv/CUpgradeFBC.h b/tvapi/libtv/tv/CUpgradeFBC.h index 70b8057..dbe61fc 100644 --- a/tvapi/libtv/tv/CUpgradeFBC.h +++ b/tvapi/libtv/tv/CUpgradeFBC.h @@ -97,7 +97,10 @@ public: public: IUpgradeFBCObserver() {}; virtual ~IUpgradeFBCObserver() {}; - virtual void onUpgradeStatus(int state, int param) {}; + virtual void onUpgradeStatus(int state, int param) { + state = state; + param = param; + }; }; void setObserver(IUpgradeFBCObserver *pOb) { diff --git a/tvapi/libtv/tvconfig/CIniFile.cpp b/tvapi/libtv/tvconfig/CIniFile.cpp index da448a5..3016252 100644 --- a/tvapi/libtv/tvconfig/CIniFile.cpp +++ b/tvapi/libtv/tvconfig/CIniFile.cpp @@ -114,7 +114,7 @@ void CIniFile::printAll() return; } -int CIniFile::LoadFromString(const char *str) +int CIniFile::LoadFromString(const char *str __unused) { return 0; } diff --git a/tvapi/libtv/tvconfig/tvconfig.h b/tvapi/libtv/tvconfig/tvconfig.h index 5415dbd..750141c 100644 --- a/tvapi/libtv/tvconfig/tvconfig.h +++ b/tvapi/libtv/tvconfig/tvconfig.h @@ -4,7 +4,7 @@ #define CC_CFG_KEY_STR_MAX_LEN (128) #define CC_CFG_VALUE_STR_MAX_LEN (512) - +//for tv config #define CFG_SECTION_TV "TV" #define CFG_SECTION_ATV "ATV" #define CFG_SECTION_SRC_INPUT "SourceInputMap" @@ -13,6 +13,71 @@ #define CFG_BLUE_SCREEN_COLOR "tvin.bluescreen.color" + +#define CFG_SSM_HDMI_AV_DETECT "ssm.hdmi_av.hotplug.detect.en" +#define CFG_SSM_HDMI_EDID_EN "ssm.handle.hdmi.edid.en" + + +#define CFG_ATV_FREQ_LIST "atv.get.min.max.freq" + + +#define CFG_TVIN_KERNELPET_DISABLE "tvin.kernelpet_disable" +#define CFG_TVIN_KERNELPET_TIMEROUT "tvin.kernelpet.timeout" +#define CFG_TVIN_USERPET "tvin.userpet" +#define CFG_TVIN_USERPET_TIMEROUT "tvin.userpet.timeout" +#define CFG_TVIN_USERPET_RESET "tvin.userpet.reset" + +#define CFG_TVIN_DISPLAY_FREQ_AUTO "tvin.autoset.displayfreq" +#define CFG_TVIN_DB_REG "tvin.db.reg.en" +#define CFG_TVIN_THERMAL_THRESHOLD_ENABLE "tvin.thermal.threshold.enable" +#define CFG_TVIN_THERMAL_THRESHOLD_VALUE "tvin.thermal.threshold.value" +#define CFG_TVIN_THERMAL_FBC_NORMAL_VALUE "tvin.thermal.fbc.normal.value" +#define CFG_TVIN_THERMAL_FBC_COLD_VALUE "tvin.thermal.fbc.cold.value" + +#define CFG_AUDIO_SRS_SOURROUND_GAIN "audio.srs.sourround.gain" +#define CFG_AUDIO_SRS_INPUT_GAIN "audio.srs.input.gain" +#define CFG_AUDIO_SRS_OUTPUT_GAIN "audio.srs.output.gain" +#define CFG_AUDIO_SRS_TRUBASS_GAIN "audio.srs.trubass.gain" +#define CFG_AUDIO_SRS_TRUBASS_SPEAKERSIZE "audio.srs.trubass.speakersize" +#define CFG_AUDIO_SRS_CLARITY_GAIN "audio.srs.dialogclarity.gain" +#define CFG_AUDIO_SRS_DEFINITION_GAIN "audio.srs.definition.gain" + +#define CFG_AUDIO_SRS_SOURROUND_MASTER_GAIN "audio.srs.sourround.ampmaster.gain" +#define CFG_AUDIO_SRS_CLARITY_MASTER_GAIN "audio.srs.dialogclarity.ampmaster.gain" +#define CFG_AUDIO_SRS_TRUBASS_MASTER_GAIN "audio.srs.trubass.ampmaster.gain" +#define CFG_AUDIO_SRS_TRUBASS_CLARITY_MASTER_GAIN "audio.srs.trubass.dialogclarity.ampmaster.gain" + + +#define CFG_FBC_PANEL_INFO "fbc.get.panelinfo" +#define CFG_FBC_USED "platform.havefbc" + +#define CFG_PQ_DB_PATH "pq_db_path" +#define DEF_VALUE_PQ_DB_PATH "/param/pq.db" + +#define CFG_CAHNNEL_DB "tv.channel.db" +#define DEF_VALUE_CAHNNEL_DB "/param/dtv.db" + +//for tv property +#define PROP_DEF_CAPTURE_NAME "snd.card.default.card.capture" +#define PROP_AUDIO_CARD_NUM "snd.card.totle.num" + +#define UBOOTENV_OUTPUTMODE "ubootenv.var.outputmode" +#define UBOOTENV_CONSOLE "ubootenv.var.console" + +//for tv sysfs +#define SYS_SPDIF_MODE_DEV_PATH "/sys/class/audiodsp/digital_raw" +#define SYS_VECM_DNLP_ADJ_LEVEL "/sys/module/am_vecm/parameters/dnlp_adj_level" + +#define SYS_AUIDO_DSP_AC3_DRC "/sys/class/audiodsp/ac3_drc_control" +#define SYS_AUIDO_DIRECT_RIGHT_GAIN "/sys/class/amaudio2/aml_direct_right_gain" +#define SYS_AUIDO_DIRECT_LEFT_GAIN "/sys/class/amaudio2/aml_direct_left_gain" + +#define SYS_VIDEO_FRAME_HEIGHT "/sys/class/video/frame_height" +#define SYS_VIDEO_SCALER_PATH_SEL "/sys/class/video/video_scaler_path_sel" + +#define SYS_DROILOGIC_DEBUG "/sys/class/amlogic/debug" +#define SYS_ATV_DEMOD_DEBUG "/sys/class/amlatvdemod/atvdemod_debug" + extern int tv_config_load(const char *file_name); extern int tv_config_unload(); extern int tv_config_save(); diff --git a/tvapi/libtv/tvdb/CTvChannel.cpp b/tvapi/libtv/tvdb/CTvChannel.cpp index d39d025..a40eb85 100644 --- a/tvapi/libtv/tvdb/CTvChannel.cpp +++ b/tvapi/libtv/tvdb/CTvChannel.cpp @@ -8,15 +8,10 @@ // @ Author : // // - +#define LOG_TAG "CTvChannel" #include "CTvChannel.h" -#ifdef LOG_TAG -#undef LOG_TAG -#define LOG_TAG "CTvChannel" -#endif - void CTvChannel::createFromCursor(CTvDatabase::Cursor &c) { int col; @@ -106,18 +101,16 @@ void CTvChannel::createFromCursor(CTvDatabase::Cursor &c) this->fendID = 0; } - CTvChannel::CTvChannel() { - } -CTvChannel::CTvChannel(int dbID, int mode, int freq, int bw, int mod, int symb, int ofdm, int channelNum) +CTvChannel::CTvChannel(int dbID, int mode, int freq, int bw, int mod, int symb, int ofdm __unused, int channelNum) { //other member not init,just a paras if (mode == MODE_QAM) { id = dbID; - frequency = freq; + frequency = freq; modulation = mod; symbolRate = symb; mode = MODE_QAM; @@ -128,7 +121,7 @@ CTvChannel::CTvChannel(int dbID, int mode, int freq, int bw, int mod, int symb, mode = MODE_OFDM; } else if (mode == MODE_ATSC) { id = dbID; - frequency = freq; + frequency = freq; modulation = mod; logicalChannelNum = channelNum; mod = MODE_ATSC; @@ -149,12 +142,11 @@ CTvChannel::CTvChannel(int dbID, int mode, int freq, int bw, int mod, int symb, CTvChannel::~CTvChannel() { - } -Vector CTvChannel::tvChannelList(int sat_id) +Vector CTvChannel::tvChannelList(int sat_id __unused) { - Vector v_channel; + Vector v_channel; return v_channel; } @@ -255,6 +247,7 @@ int CTvChannel::getChannelListBySrc(int src, Vector< sp > &v_channel return 0; } + int CTvChannel::updateByID(int progID, int std, int freq, int fineFreq) { @@ -268,15 +261,12 @@ int CTvChannel::updateByID(int progID, int std, int freq, int fineFreq) return 0; } - void CTvChannel::tvChannelDel() { - } -void CTvChannel::tvChannelDelBySatID(int id) +void CTvChannel::tvChannelDelBySatID(int id __unused) { - } int CTvChannel::getDVBTSID() @@ -286,62 +276,49 @@ int CTvChannel::getDVBTSID() void CTvChannel::getDVBOrigNetID() { - } void CTvChannel::getFrontendID() { - } void CTvChannel::getTSSourceID() { - } - void CTvChannel::isDVBCMode() { - } void CTvChannel::setFrequency() { - } void CTvChannel::setSymbolRate() { - } void CTvChannel::setPolarisation() { - } void CTvChannel::setATVAudio() { - } void CTvChannel::setATVVideoFormat() { - } void CTvChannel::setATVAudioFormat() { - } void CTvChannel::setATVFreq() { - } void CTvChannel::setATVAfcData() { - } diff --git a/tvapi/libtv/tvdb/CTvDatabase.cpp b/tvapi/libtv/tvdb/CTvDatabase.cpp index 6113ad9..ef36364 100644 --- a/tvapi/libtv/tvdb/CTvDatabase.cpp +++ b/tvapi/libtv/tvdb/CTvDatabase.cpp @@ -7,18 +7,14 @@ // @ Date : 2013-11 // @ Author : // -// +#define LOG_TAG "CTvDatabase" + #include #include #include "CTvDatabase.h" #include "tvutils/tvutils.h" #include "../tvconfig/tvconfig.h" -#ifdef LOG_TAG -#undef LOG_TAG -#define LOG_TAG "CTvDatabase" -#endif - const char *CTvDatabase::DEFAULT_DB_PATH = "/param/tv_default.xml"; const char *CTvDatabase::DB_VERSION_FIELD = "DATABASE_VERSION"; @@ -144,7 +140,7 @@ int CTvDatabase::getChannelParaList(char *path, Vector > &vcp) int CTvDatabase::ClearDbTable() { - LOGD(LOG_TAG, "Clearing database ..."); + LOGD("Clearing database ..."); exeSql("delete from net_table"); exeSql("delete from ts_table"); exeSql("delete from srv_table"); @@ -160,7 +156,7 @@ int CTvDatabase::ClearDbTable() int CTvDatabase::clearDbAllProgramInfoTable() { - LOGD(LOG_TAG, "Clearing clearDbAllProgramInfoTable ..."); + LOGD("Clearing clearDbAllProgramInfoTable ..."); exeSql("delete from net_table"); exeSql("delete from ts_table"); exeSql("delete from srv_table"); diff --git a/tvapi/libtv/tvdb/CTvDimension.cpp b/tvapi/libtv/tvdb/CTvDimension.cpp index 176dde8..0432a83 100644 --- a/tvapi/libtv/tvdb/CTvDimension.cpp +++ b/tvapi/libtv/tvdb/CTvDimension.cpp @@ -1,3 +1,4 @@ +#define LOG_TAG "CTvDimension" #include "CTvDimension.h" #include "CTvProgram.h" @@ -5,12 +6,6 @@ #include "CTvEvent.h" #include "../tvconfig/tvconfig.h" - -#ifdef LOG_TAG -#undef LOG_TAG -#endif -#define LOG_TAG "CTvDimension" - /** *TV ATSC rating dimension */ diff --git a/tvapi/libtv/tvdb/CTvEvent.cpp b/tvapi/libtv/tvdb/CTvEvent.cpp index 9e1f2f6..7fd6926 100644 --- a/tvapi/libtv/tvdb/CTvEvent.cpp +++ b/tvapi/libtv/tvdb/CTvEvent.cpp @@ -7,18 +7,13 @@ // @ Date : 2013-11 // @ Author : // -// +#define LOG_TAG "CTvEvent" #include "CTvEvent.h" #include "CTvDatabase.h" #include "CTvProgram.h" #include -#ifdef LOG_TAG -#undef LOG_TAG -#define LOG_TAG "CTvEvent" -#endif - void CTvEvent::InitFromCursor(CTvDatabase::Cursor &c) { int col; @@ -57,7 +52,7 @@ void CTvEvent::InitFromCursor(CTvDatabase::Cursor &c) int l = 0; char *pSave; tmp = strtok_r(rrtRatings.lockBuffer(rrtRatings.size()), ",", &pSave); - LOGD("%s, %d, %s", "TV", __LINE__, tmp); + LOGD("TV, %d, %s", __LINE__, tmp); while (tmp != NULL) { ratings.push_back(String8(tmp)); tmp = strtok_r(NULL, ",", &pSave); @@ -65,7 +60,7 @@ void CTvEvent::InitFromCursor(CTvDatabase::Cursor &c) rrtRatings.unlockBuffer(); rating_len = ratings.size(); if (!ratings.isEmpty()) { - for (int i = 0; i < ratings.size(); i++) { + for (int i = 0; i < (int)ratings.size(); i++) { Vector rating; tmp = strtok_r(ratings.editItemAt(i).lockBuffer(ratings.editItemAt(i).length()), " ", &pSave); while (tmp != NULL) { diff --git a/tvapi/libtv/tvdb/CTvProgram.cpp b/tvapi/libtv/tvdb/CTvProgram.cpp index d9dca52..49c1d86 100644 --- a/tvapi/libtv/tvdb/CTvProgram.cpp +++ b/tvapi/libtv/tvdb/CTvProgram.cpp @@ -8,18 +8,13 @@ // @ Author : // // - +#define LOG_TAG "CTvProgram" #include "CTvProgram.h" #include "CTvDatabase.h" #include "CTvChannel.h" #include "CTvEvent.h" -#ifdef LOG_TAG -#undef LOG_TAG -#define LOG_TAG "CTvProgram" -#endif - CTvProgram::CTvProgram(CTvDatabase::Cursor &c) { CreateFromCursor(c); @@ -44,7 +39,7 @@ CTvProgram::~CTvProgram() delete mvTeletexts[i]; } -CTvProgram::CTvProgram(int channelID, int type) +CTvProgram::CTvProgram(int channelID __unused, int type __unused) { mpVideo = NULL; } @@ -53,6 +48,7 @@ CTvProgram::CTvProgram() { mpVideo = NULL; } + int CTvProgram::CreateFromCursor(CTvDatabase::Cursor &c) { int i = 0; @@ -141,7 +137,6 @@ int CTvProgram::CreateFromCursor(CTvDatabase::Cursor &c) this->mpVideo = new Video(pid, fmt); //LOGD("----------vpid = %d", this->mpVideo->getPID()); - //Audio String8 strPids; String8 strFmts; @@ -187,21 +182,19 @@ int CTvProgram::CreateFromCursor(CTvDatabase::Cursor &c) strLangs.unlockBuffer(); //check empty aud_langs - for (i = vlang.size(); i < vpid.size(); i++) { + for (i = vlang.size(); i < (int)vpid.size(); i++) { sprintf(tmp_buf, "Audio%d", i + 1); vlang.push_back(String8(tmp_buf)); LOGE("%s, aud_langs is empty, add dummy data (%s).\n", "TV", tmp_buf); } //String8 l(vlang[i]); - for (i = 0; i < vpid.size(); i++) { + for (i = 0; i < (int)vpid.size(); i++) { int i_pid = atoi(vpid[i]); int i_fmt = atoi(vfmt[i]); mvAudios.push_back(new Audio(i_pid, vlang[i], i_fmt)); } - - /* parse subtitles */ vpid.clear(); vlang.clear(); @@ -219,7 +212,6 @@ int CTvProgram::CreateFromCursor(CTvDatabase::Cursor &c) col = c.getColumnIndex("sub_ancillary_page_ids"); strAids = c.getString(col); - col = c.getColumnIndex("sub_langs"); strLangs = c.getString(col); @@ -252,7 +244,7 @@ int CTvProgram::CreateFromCursor(CTvDatabase::Cursor &c) strLangs.unlockBuffer(); //Subtitle - for (int i = 0; i < vpid.size(); i++) { + for (int i = 0; i < (int)vpid.size(); i++) { this->mvSubtitles.push_back(new Subtitle( atoi(vpid[i]), String8(vlang[i]), Subtitle::TYPE_DVB_SUBTITLE, @@ -315,7 +307,6 @@ int CTvProgram::CreateFromCursor(CTvDatabase::Cursor &c) } str_ttx_langs.unlockBuffer(); - for (int i = 0; i < v_ttx_pids.size(); i++) { int ttype = atoi(v_ttx_types[i]); if (ttype == 0x2 || ttype == 0x5) { @@ -343,7 +334,6 @@ int CTvProgram::selectProgramInChannelByNumber(int channelID, int num, CTvDataba return CTvDatabase::GetTvDb()->select(cmd, c); } - int CTvProgram::selectProgramInChannelByNumber(int channelID, int major, int minor, CTvDatabase::Cursor &c) { String8 cmd = String8("select * from srv_table where db_ts_id = ") + String8::format("%d", channelID) + String8(" and "); @@ -409,7 +399,6 @@ CTvProgram::CTvProgram(int channelID, int type, int num, int skipFlag) } - /** *向数据库添加一个Program,atscMode */ @@ -466,13 +455,12 @@ CTvProgram::CTvProgram(int channelID, int type, int major, int minor, int skipFl } } + /** *根据记录ID查找指定TVProgram */ - int CTvProgram::selectByID(int id, CTvProgram &prog) { - CTvDatabase::Cursor c; String8 sql; sql = String8("select * from srv_table where srv_table.db_id = ") + String8::format("%d", id); @@ -502,7 +490,7 @@ int CTvProgram::getChannel(CTvChannel &c) return CTvChannel::selectByID(channelID, c); } -int CTvProgram::upDateChannel(CTvChannel &c, int std, int Freq, int fineFreq) +int CTvProgram::upDateChannel(CTvChannel &c __unused, int std, int Freq, int fineFreq) { return CTvChannel::updateByID(channelID, std, Freq, fineFreq); } @@ -515,7 +503,6 @@ int CTvProgram::deleteChannelsProgram(CTvChannel &c) return 0; } - /** *根据节目类型和节目号查找指定TVProgram */ @@ -617,11 +604,9 @@ int CTvProgram::selectByNumber(int type, int major, int minor, CTvProgram &prog, */ int CTvProgram::selectByChannel(int channelID, int type, Vector > &out) { - //Vector vp; String8 cmd = String8("select * from srv_table "); - if (type == TYPE_DTV) { cmd += String8("where (service_type = ") + String8::format("%d", TYPE_TV) + String8(" or service_type = ") + String8::format("%d", TYPE_RADIO) + String8(") "); } else if (type != TYPE_UNKNOWN) { @@ -727,7 +712,6 @@ int CTvProgram::selectByChanID(int type, int skip, Vector < sp < CTvProgram > > c.close(); return 0; - } int CTvProgram::selectAll(bool no_skip, Vector > &out) @@ -735,13 +719,13 @@ int CTvProgram::selectAll(bool no_skip, Vector > &out) return selectByType(TYPE_UNKNOWN, no_skip, out); } -Vector CTvProgram::selectByChannel(int channelID) +Vector CTvProgram::selectByChannel(int channelID __unused) { Vector vProg; return vProg; } -Vector CTvProgram::selectByName(int name) +Vector CTvProgram::selectByName(int name __unused) { Vector vProg; return vProg; @@ -749,14 +733,14 @@ Vector CTvProgram::selectByName(int name) void CTvProgram::tvProgramDelByChannelID(int channelID) { - + channelID = channelID; } - String8 CTvProgram::getName() { return name; } + int CTvProgram::getProgSkipFlag() { return skip; @@ -781,8 +765,8 @@ int CTvProgram::getCurrentAudio(String8 defaultLang) if (id < 0 && mvAudios.size() > 0) { LOGD("getCurrentAudio defaultLang.isEmpty() =%s= %d", defaultLang.string(), defaultLang.isEmpty()); if (!defaultLang.isEmpty()) { - for (int i = 0; i < mvAudios.size(); i++) { - LOGD("getCurrentAudio a mvAudios[i] = %d", mvAudios[i]); + for (int i = 0; i < (int)mvAudios.size(); i++) { + LOGD("getCurrentAudio a mvAudios[i] = %x", (int)mvAudios[i]); if (mvAudios[i]->getLang() == defaultLang) { id = i; break; @@ -849,7 +833,6 @@ int CTvProgram::getCurrAudioTrackIndex() return audTrackIdx; } - void CTvProgram::setCurrAudioTrackIndex(int programId, int audioIndex) { String8 cmd; @@ -868,7 +851,6 @@ void CTvProgram::setFavoriteFlag(int progId, bool bFavor) + String8::format("%d", bFavor ? 1 : 0) + String8(" where srv_table.db_id = ") + String8::format("%d", progId); CTvDatabase::GetTvDb()->exeSql(cmd.string()); - } void CTvProgram::setSkipFlag(int progId, bool bSkipFlag) @@ -906,7 +888,6 @@ void CTvProgram::swapChanOrder(int ProgId1, int chanOrderNum1, int ProgId2, int CTvDatabase::GetTvDb()->exeSql(cmd2.string()); } - void CTvProgram::setLockFlag(int progId, bool bLockFlag) { String8 cmd; @@ -916,6 +897,7 @@ void CTvProgram::setLockFlag(int progId, bool bLockFlag) CTvDatabase::GetTvDb()->exeSql(cmd.string()); } + bool CTvProgram::getLockFlag() { return lock; diff --git a/tvapi/libtv/tvdb/CTvProgram.h b/tvapi/libtv/tvdb/CTvProgram.h index 1c35c67..dbfcc97 100644 --- a/tvapi/libtv/tvdb/CTvProgram.h +++ b/tvapi/libtv/tvdb/CTvProgram.h @@ -9,7 +9,6 @@ // // - #if !defined(_CTVPROGRAM_H) #define _CTVPROGRAM_H @@ -32,7 +31,7 @@ public: AM_SCAN_SRV_DRADIO = 2, < ֹ㲥 AM_SCAN_SRV_ATV = 3, < ģ }; - * / + */ /**δ*/ static const int TYPE_UNKNOWN = 0; /**ӽĿ*/ diff --git a/tvapi/libtv/tvdb/CTvRegion.cpp b/tvapi/libtv/tvdb/CTvRegion.cpp index 7f87549..a39f56c 100644 --- a/tvapi/libtv/tvdb/CTvRegion.cpp +++ b/tvapi/libtv/tvdb/CTvRegion.cpp @@ -8,29 +8,21 @@ // @ Author : // // - +#define LOG_TAG "CTvRegion" #include "CTvRegion.h" #include "CTvDatabase.h" - -#ifdef LOG_TAG -#undef LOG_TAG -#define LOG_TAG "CTvRegion" -#endif - -CTvRegion::CTvRegion(CTvDatabase db) +CTvRegion::CTvRegion(CTvDatabase db __unused) { - } CTvRegion::CTvRegion() { - } + CTvRegion::~CTvRegion() { - } CTvRegion CTvRegion::selectByID() @@ -41,7 +33,6 @@ CTvRegion CTvRegion::selectByID() int CTvRegion::getChannelListByName(char *name, Vector > &vcp) { - if (name == NULL) return -1; @@ -140,12 +131,12 @@ int CTvRegion::getChannelListByNameAndFreqRange(char *name, int beginFreq, int e c.close(); return ret; } + void CTvRegion::selectByCountry() { - } -Vector CTvRegion::getAllCountry() +Vector CTvRegion::getAllCountry() { Vector vStr; return vStr; diff --git a/tvapi/libtv/tvin/CHDMIRxCEC.cpp b/tvapi/libtv/tvin/CHDMIRxCEC.cpp index 0b261d6..9a24a57 100644 --- a/tvapi/libtv/tvin/CHDMIRxCEC.cpp +++ b/tvapi/libtv/tvin/CHDMIRxCEC.cpp @@ -183,7 +183,7 @@ int CHDMIRxCEC::CopyMessageData(unsigned char data_buf[], unsigned char msg_data memset((void *)data_buf, 0, CC_CEC_STREAM_SIZE); - if (msg_len > CC_CEC_STREAM_SIZE) { + if (msg_len > (int)CC_CEC_STREAM_SIZE) { return 0; } diff --git a/tvapi/libtv/tvin/CHDMIRxCEC.h b/tvapi/libtv/tvin/CHDMIRxCEC.h index 2e01112..061a2b8 100644 --- a/tvapi/libtv/tvin/CHDMIRxCEC.h +++ b/tvapi/libtv/tvin/CHDMIRxCEC.h @@ -21,10 +21,11 @@ public: public: IHDMIRxCECObserver() {}; virtual ~IHDMIRxCECObserver() {}; - virtual void onHDMIRxCECMessage(int msg_len, unsigned char msg_buf[]) {}; + virtual void onHDMIRxCECMessage(int msg_len __unused, unsigned char msg_buf[] __unused) { + }; }; - void setObserver ( IHDMIRxCECObserver *pOb ) - { + + void setObserver ( IHDMIRxCECObserver *pOb ) { mpObserver = pOb; }; diff --git a/tvapi/libtv/tvin/CSourceConnectDetect.cpp b/tvapi/libtv/tvin/CSourceConnectDetect.cpp index 5421bae..0b3a81f 100644 --- a/tvapi/libtv/tvin/CSourceConnectDetect.cpp +++ b/tvapi/libtv/tvin/CSourceConnectDetect.cpp @@ -1,3 +1,5 @@ +#define LOG_TAG "CSourceConnectDetect" + #include "CTvin.h" #include #include @@ -13,10 +15,6 @@ #include "../tvconfig/tvconfig.h" #include "CSourceConnectDetect.h" -#ifdef LOG_TAG -#undef LOG_TAG -#define LOG_TAG "CSourceConnectDetect" -#endif CSourceConnectDetect::CSourceConnectDetect() { diff --git a/tvapi/libtv/tvin/CSourceConnectDetect.h b/tvapi/libtv/tvin/CSourceConnectDetect.h index 9abfd2b..3aa56d2 100644 --- a/tvapi/libtv/tvin/CSourceConnectDetect.h +++ b/tvapi/libtv/tvin/CSourceConnectDetect.h @@ -49,11 +49,12 @@ public: public: ISourceConnectObserver() {}; virtual ~ISourceConnectObserver() {}; - virtual void onSourceConnect(int source, int connect_status) {}; + virtual void onSourceConnect(int source __unused, int connect_status __unused) { + }; virtual void onVframeSizeChange() {}; }; - void setObserver ( ISourceConnectObserver *pOb ) - { + + void setObserver ( ISourceConnectObserver *pOb ) { mpObserver = pOb; }; private: diff --git a/tvapi/libtv/tvin/CTvin.cpp b/tvapi/libtv/tvin/CTvin.cpp index fc21712..1fe4fd0 100644 --- a/tvapi/libtv/tvin/CTvin.cpp +++ b/tvapi/libtv/tvin/CTvin.cpp @@ -1,3 +1,4 @@ +#define LOG_TAG "CTvin" #include "CTvin.h" #include @@ -22,12 +23,6 @@ #include "../tvconfig/tvconfig.h" #include "CFbcCommunication.h" - -#ifdef LOG_TAG -#undef LOG_TAG -#define LOG_TAG "CTvin" -#endif - #define AFE_DEV_PATH "/dev/tvafe0" #define HDMIRX_KSV_PATH "/dev/hdmirx0" @@ -42,8 +37,8 @@ #define MODE_BT 0x00000010 #define MODE_LR_SWITCH 0x00000020 #define MODE_FIELD_DEPTH 0x00000040 -#define MODE_3D_TO_2D_L 0x00000080 -#define MODE_3D_TO_2D_R 0x00000100 +//#define MODE_3D_TO_2D_L 0x00000080 redefine +//#define MODE_3D_TO_2D_R 0x00000100 redefine #define LR_FORMAT_INDICATOR 0x00000200 #define BT_FORMAT_INDICATOR 0x00000400 @@ -176,7 +171,7 @@ char *CTvin::VDIN_CheckVideoPath ( const char *videopath ) } if ( gExistD2D3 == 0 ) { - DelSub ( gVideoPath, "d2d3 " ); + DelSub ( gVideoPath, (char *)"d2d3 " ); } } @@ -527,7 +522,7 @@ int CTvin::VDIN_GetDisplayVFreq (void) memset(buf, 0, sizeof(buf)); read(fd, buf, sizeof(buf)); close(fd); - LOGD( "s%, VDIN_GetDisplayVFreq is %s\n", __FUNCTION__, buf); + LOGD( "%s, VDIN_GetDisplayVFreq is %s\n", __FUNCTION__, buf); if (strstr(buf, "50hz") != NULL) { return 50; } else if (strstr(buf, "60hz") != 0) { @@ -880,7 +875,7 @@ int CTvin::VDIN_TurnOnBlackBarDetect ( int isEnable ) return 0; } -int CTvin::VDIN_LoadHdcpKey ( unsigned char *hdcpkey_buff ) +int CTvin::VDIN_LoadHdcpKey ( unsigned char *hdcpkey_buff __unused) { unsigned char testHdcp[368] = { 0x53, 0x4B, 0x59, 0x01, 0x00, 0x10, 0x0D, 0x15, 0x3A, 0x8E, 0x99, 0xEE, 0x2A, 0x55, 0x58, 0xEE, 0xED, 0x4B, 0xBE, 0x00, 0x74, 0xA9, 0x00, 0x10, 0x0A, 0x21, 0xE3, 0x30, 0x66, 0x34, 0xCE, 0x9C, 0xC7, 0x8B, 0x51, 0x27, 0xF9, 0x0B, 0xAD, 0x09, 0x5F, 0x4D, 0xC2, 0xCA, 0xA2, 0x13, 0x06, 0x18, 0x8D, 0x34, 0x82, 0x46, 0x2D, 0xC9, 0x4B, 0xB0, 0x1C, 0xDE, @@ -915,7 +910,7 @@ int CTvin::VDIN_LoadHdcpKey ( unsigned char *hdcpkey_buff ) return ret; } -int CTvin::VDIN_KeepLastFrame ( int enable ) +int CTvin::VDIN_KeepLastFrame ( int enable __unused) { return 0; /* @@ -1722,8 +1717,8 @@ char *CTvin::get_cap_addr ( enum adc_cal_type_e calType ) dp = ( char * ) mmap ( NULL, VGA_CAP_SIZE, PROT_READ | PROT_WRITE, MAP_SHARED, m_vdin_dev_fd, 0 ); } - if ( dp < 0 ) { - LOGD ( "get_cap_addr, mmap failed!\n" ); + if ( dp == NULL ) { + LOGE ( "get_cap_addr, mmap failed!\n" ); } return dp; @@ -1903,9 +1898,7 @@ int CTvin::get_frame_average ( enum adc_cal_type_e calType, struct adc_cal_s *me if ( VDIN_DeviceIOCtl ( TVIN_IOC_START_DEC, &gTvinAFEParam ) < 0 ) { LOGW ( "get_frame_average, get vdin signal info, error(%s),fd(%d).\n", strerror ( errno ), m_vdin_dev_fd ); - return NULL; - } else { - ; + return 0; } return 0; @@ -2418,7 +2411,7 @@ tv_source_input_t CTvin::Tvin_PortToSourceInput ( tvin_port_t port ) int i; for ( i = SOURCE_TV; i < SOURCE_MAX; i++ ) { - if ( mSourceInputToPortMap[i] == port ) { + if ( mSourceInputToPortMap[i] == (int)port ) { break; } } diff --git a/tvapi/libtv/tvsetting/CBlobDevice.cpp b/tvapi/libtv/tvsetting/CBlobDevice.cpp index 8974fbf..0a1ce49 100644 --- a/tvapi/libtv/tvsetting/CBlobDevice.cpp +++ b/tvapi/libtv/tvsetting/CBlobDevice.cpp @@ -1,3 +1,5 @@ +#define LOG_TAG "CBlobDevice" + #include #include #include @@ -7,9 +9,6 @@ #include "CBlobDevice.h" #include "CTvLog.h" -#define LOG_TAG "CBlobDevice" - - CBlobDevice::CBlobDevice() { m_dev_path[0] = '\0'; @@ -22,6 +21,6 @@ CBlobDevice::~CBlobDevice() int CBlobDevice::IsFileExist(const char *file_name) { struct stat tmp_st; - return stat(file_name, &tmp_st); } + diff --git a/tvapi/libtv/tvsetting/CBlobDeviceE2prom.cpp b/tvapi/libtv/tvsetting/CBlobDeviceE2prom.cpp index 10411bd..656001f 100644 --- a/tvapi/libtv/tvsetting/CBlobDeviceE2prom.cpp +++ b/tvapi/libtv/tvsetting/CBlobDeviceE2prom.cpp @@ -1,3 +1,5 @@ +#define LOG_TAG "CBlobDeviceE2prom" + #include #include #include @@ -10,41 +12,41 @@ #include "../tvutils/tvutils.h" #include "CTvLog.h" -#define LOG_TAG "CBlobDeviceE2prom" - - CBlobDeviceE2prom::CBlobDeviceE2prom() { - } CBlobDeviceE2prom::~CBlobDeviceE2prom() { } -int CBlobDeviceE2prom::WriteBytes(int offset, int size, unsigned char *buf) +int CBlobDeviceE2prom::WriteBytes(int offset __unused, int size __unused, unsigned char *buf __unused) { return 0; } -int CBlobDeviceE2prom::ReadBytes(int offset, int size, unsigned char *buf) + +int CBlobDeviceE2prom::ReadBytes(int offset __unused, int size __unused, unsigned char *buf __unused) { return 0; } + int CBlobDeviceE2prom::EraseAllData() { return 0; } + int CBlobDeviceE2prom::InitCheck() { return 0; } + int CBlobDeviceE2prom::OpenDevice() { return 0; } + int CBlobDeviceE2prom::CloseDevice() { return 0; } -//int CBlobDeviceE2prom::InitCheck() { diff --git a/tvapi/libtv/tvsetting/CBlobDeviceFile.cpp b/tvapi/libtv/tvsetting/CBlobDeviceFile.cpp index cd6f10a..e86c3b0 100644 --- a/tvapi/libtv/tvsetting/CBlobDeviceFile.cpp +++ b/tvapi/libtv/tvsetting/CBlobDeviceFile.cpp @@ -1,3 +1,5 @@ +#define LOG_TAG "BLOB_FILE" + #include #include #include @@ -8,10 +10,6 @@ #include "CBlobDeviceFile.h" #include "CTvLog.h" - - -#define LOG_TAG "BLOB_FILE" - CBlobDeviceFile::CBlobDeviceFile() { m_dev_total_size = 4 * 1024; diff --git a/tvapi/libtv/tvsetting/CTvSetting.cpp b/tvapi/libtv/tvsetting/CTvSetting.cpp index b81b865..59fc199 100644 --- a/tvapi/libtv/tvsetting/CTvSetting.cpp +++ b/tvapi/libtv/tvsetting/CTvSetting.cpp @@ -1,3 +1,5 @@ +#define LOG_TAG "TvSetting" + #include #include #include @@ -275,7 +277,7 @@ int EEPReadOneByte(int offset , unsigned char *data_buf) close(fd); - LOGD ( "~~~EEPReadOneByte~~~##offset %d##rw_val %d##" , offset, data_buf); + LOGD ( "~~~EEPReadOneByte~~~##offset %d##rw_val %s##" , offset, data_buf); pthread_mutex_unlock(&ssm_r_w_op_mutex); return 0; @@ -2229,7 +2231,7 @@ int SSMSaveAudioEQGain(int offset, int size, int8_t tmp_buf[]) return SSMWriteNTypes(SSM_AUD_EQ_GAIN + offset, size, tmp_buf); } -int SSMReadAudioEQGain(int offset, int size, int8_t tmp_buf[]) +int SSMReadAudioEQGain(int offset __unused, int size, int8_t tmp_buf[]) { return SSMReadNTypes(SSM_AUD_EQ_GAIN, size, tmp_buf); } diff --git a/tvapi/libtv/tvsetting/CTvSetting.h b/tvapi/libtv/tvsetting/CTvSetting.h index 22a2f9a..b657426 100644 --- a/tvapi/libtv/tvsetting/CTvSetting.h +++ b/tvapi/libtv/tvsetting/CTvSetting.h @@ -9,8 +9,6 @@ #include "TvKeyData.h" #include "../tv/CTvLog.h" -#define LOG_TAG "TvSetting" - using namespace android; #ifdef __cplusplus diff --git a/tvapi/libtv/tvsetting/TvKeyData.cpp b/tvapi/libtv/tvsetting/TvKeyData.cpp index 846ea85..7e0fab9 100644 --- a/tvapi/libtv/tvsetting/TvKeyData.cpp +++ b/tvapi/libtv/tvsetting/TvKeyData.cpp @@ -1,3 +1,5 @@ + +#define LOG_TAG "TvKeyData" #include #include #include @@ -627,7 +629,7 @@ static int GetMacAddressStartWorkThreadTurnOnFlag() return tmp_val; } -static void *SSMMacAddressStartWorkMainApp(void *data) +static void *SSMMacAddressStartWorkMainApp(void *data __unused) { unsigned int curMacAddrLow = 0, curMacAddrHigh = 0; int p_status; @@ -685,16 +687,12 @@ static void *SSMMacAddressStartWorkMainApp(void *data) return NULL; } -static void *SSMMacAddressStartWorkThreadMain(void *data) +static void *SSMMacAddressStartWorkThreadMain(void *data __unused) { void *tmp_ret = NULL; - SetMacAddressStartWorkThreadExecFlag(1); - tmp_ret = SSMMacAddressStartWorkMainApp(NULL); - SetMacAddressStartWorkThreadExecFlag(0); - return tmp_ret; } @@ -879,20 +877,17 @@ int GetSSMHandleHDMIEdidByCustomerEnableCFG() { const char *config_value; - config_value = config_get_str(CFG_SECTION_TV, CS_HDMI_EDID_EN_CFG, "null"); -#if 0 - LOGD("%s, get \"%s\" is \"%s\".\n", __FUNCTION__, CS_HDMI_EDID_EN_CFG, - config_value); -#endif + config_value = config_get_str(CFG_SECTION_TV, CFG_SSM_HDMI_EDID_EN, "null"); if (strcmp(config_value, "null") == 0) { LOGD( "%s, get config \"%s\" is \"%s\", return 0 to not enable handle hdmi edid by customer.\n", - __FUNCTION__, CS_HDMI_EDID_EN_CFG, config_value); + __FUNCTION__, CFG_SSM_HDMI_EDID_EN, config_value); return 0; } return strtoul(config_value, NULL, 10); } + int RealHandleHDMIEdid(unsigned char customer_hdmi_edid_buf[]) { int i = 0, dev_fd = -1; @@ -1007,8 +1002,7 @@ static int GetFileOffsetCFG(char *key_str) return strtol(cfg_value, NULL, 10); } -static int handleDataFilePath(char *file_name, int offset, int nsize, - char file_path[]) +static int handleDataFilePath(char *file_name, int offset __unused, int nsize __unused, char file_path[] __unused) { if (file_name == NULL) { LOGE("%s, file_name is NULL!!!\n", CFG_SECTION_TV); diff --git a/tvapi/libtv/tvsetting/TvKeyData.h b/tvapi/libtv/tvsetting/TvKeyData.h index 3e4bfa4..9c71771 100644 --- a/tvapi/libtv/tvsetting/TvKeyData.h +++ b/tvapi/libtv/tvsetting/TvKeyData.h @@ -5,7 +5,6 @@ #include #include "../tv/CTvLog.h" -#define LOG_TAG "TvKeyData" #define SSM_CR_RGBOGO_LEN (256) #define SSM_CR_RGBOGO_CHKSUM_LEN (2) @@ -53,7 +52,7 @@ #define CS_HDCP_KEY_FILE_OFFSET_CFG "ssm.handle.hdcpkey.file.offset" -#define CS_HDMI_EDID_EN_CFG "ssm.handle.hdmi.edid.en" +//#define CS_HDMI_EDID_EN_CFG "ssm.handle.hdmi.edid.en" #define CS_HDMI_EDID_USE_CFG "ssm.handle.hdmi.edid.use" #define CS_HDMI_EDID_FILE_PATH_CFG "ssm.handle.hdmi.edid.file.path" #define CS_HDMI_PORT1_EDID_FILE_PATH_CFG "ssm.handle.hdmi.port1.edid.file.path" diff --git a/tvapi/libtv/tvsetting/audio_cfg.cpp b/tvapi/libtv/tvsetting/audio_cfg.cpp index 1eee1ce..682173b 100644 --- a/tvapi/libtv/tvsetting/audio_cfg.cpp +++ b/tvapi/libtv/tvsetting/audio_cfg.cpp @@ -1,3 +1,5 @@ +#define LOG_TAG "audio_cfg" + #include #include #include @@ -8,7 +10,6 @@ #include "../tvconfig/tvconfig.h" #include "audio_cfg.h" -#define LOG_TAG "audio_cfg" #include "CTvLog.h" static const char AudioAmpMainVolLutBaseNameTable[CC_GET_TYPE_CNT][128] = {"audio.amp.mainvol.tv.lutbuf",//0 @@ -468,7 +469,7 @@ int GetAudioSRSSupperBassTrubassSpeakerSizeCfg() { char cfg_name[128] = { 0 }; - strcpy(cfg_name, "audio.srs.turbass.speakersize"); + strcpy(cfg_name, CFG_AUDIO_SRS_TRUBASS_SPEAKERSIZE); const char *config_value = config_get_str(CFG_SECTION_TV, cfg_name, "null"); diff --git a/tvapi/libtv/tvutils/CFile.cpp b/tvapi/libtv/tvutils/CFile.cpp index a0b523a..af850af 100644 --- a/tvapi/libtv/tvutils/CFile.cpp +++ b/tvapi/libtv/tvutils/CFile.cpp @@ -1,11 +1,9 @@ +#define LOG_TAG "CFILE" + #include "CFile.h" -#include "CTvLog.h" +#include "CTvLog.h" #include -#ifdef LOG_TAG -#undef LOG_TAG -#define LOG_TAG "CFILE" -#endif CFile::CFile() { @@ -92,14 +90,14 @@ int CFile::copyTo(const char *dstPath) char buffer[BUFFER_SIZE]; char *ptr; int ret = 0; - while (bytes_read = read(mFd, buffer, BUFFER_SIZE)) { + while ((bytes_read = read(mFd, buffer, BUFFER_SIZE))) { /* 一个致命的错误发生了 */ if ((bytes_read == -1) && (errno != EINTR)) { ret = -1; break; } else if (bytes_read > 0) { ptr = buffer; - while (bytes_write = write(dstFd, ptr, bytes_read)) { + while ((bytes_write = write(dstFd, ptr, bytes_read))) { /* 一个致命错误发生了 */ if ((bytes_write == -1) && (errno != EINTR)) { ret = -1; @@ -178,7 +176,7 @@ int CFile::setFileAttrValue(const char *path, int value) return 0; } -int CFile::getFileAttrStr(const char *path, char *str) +int CFile::getFileAttrStr(const char *path __unused, char *str __unused) { return 0; } diff --git a/tvapi/libtv/tvutils/CHdmiCecCmd.cpp b/tvapi/libtv/tvutils/CHdmiCecCmd.cpp index c8b7149..b2fb0c3 100644 --- a/tvapi/libtv/tvutils/CHdmiCecCmd.cpp +++ b/tvapi/libtv/tvutils/CHdmiCecCmd.cpp @@ -7,9 +7,10 @@ CHdmiCec::~CHdmiCec() { } -int CHdmiCec::readFile(unsigned char *pBuf, unsigned int uLen) +int CHdmiCec::readFile(unsigned char *pBuf __unused, unsigned int uLen __unused) { - int ret; + int ret = 0; //ret = read(mFd, pBuf, uLen); return ret; } + diff --git a/tvapi/libtv/tvutils/CMsgQueue.cpp b/tvapi/libtv/tvutils/CMsgQueue.cpp index 81c9aec..9615b52 100644 --- a/tvapi/libtv/tvutils/CMsgQueue.cpp +++ b/tvapi/libtv/tvutils/CMsgQueue.cpp @@ -1,9 +1,9 @@ +#define LOG_TAG "CMsgQueueThread" + #include "CMsgQueue.h" #include #include -#define LOG_TAG "CMsgQueueThread" - CMessage::CMessage() { mDelayMs = 0; @@ -12,7 +12,6 @@ CMessage::CMessage() CMessage::~CMessage() { - } CMsgQueueThread::CMsgQueueThread() @@ -29,12 +28,13 @@ nsecs_t CMsgQueueThread::getNowMs() { return systemTime(SYSTEM_TIME_MONOTONIC) / 1000000; } + void CMsgQueueThread::sendMsg(CMessage &msg) { CMutex::Autolock _l(mLockQueue); msg.mWhenMs = getNowMs() + msg.mDelayMs;// int i = 0; - while (i < m_v_msg.size() && m_v_msg[i].mWhenMs <= msg.mWhenMs) i++; //find the index that will insert(i) + while (i < (int)m_v_msg.size() && m_v_msg[i].mWhenMs <= msg.mWhenMs) i++; //find the index that will insert(i) m_v_msg.insertAt(msg, i);//insert at index i CMessage msg1 = m_v_msg[0]; LOGD("sendmsg now = %lld msg[0] when = %lld", getNowMs(), msg1.mWhenMs); @@ -42,19 +42,20 @@ void CMsgQueueThread::sendMsg(CMessage &msg) //if(i == 0)// is empty or new whenMS is at index 0, low all ms in list. so ,need to wakeup loop, to get new delay time. mGetMsgCondition.signal(); } + //有个缺陷,只能根据消息类型移除,同类型消息会全部移除,但足够用了 void CMsgQueueThread::removeMsg(CMessage &msg) { CMutex::Autolock _l(mLockQueue); - int beforeSize = m_v_msg.size(); - for (int i = 0; i < m_v_msg.size(); i++) { + int beforeSize = (int)m_v_msg.size(); + for (int i = 0; i < (int)m_v_msg.size(); i++) { const CMessage &_msg = m_v_msg.itemAt(i); if (_msg.mType == msg.mType) { m_v_msg.removeAt(i); } } //some msg removeed - if (beforeSize > m_v_msg.size()) + if (beforeSize > (int)m_v_msg.size()) mGetMsgCondition.signal(); } @@ -71,7 +72,7 @@ int CMsgQueueThread::startMsgQueue() return 0; } -bool CMsgQueueThread::threadLoop() +bool CMsgQueueThread::threadLoop() { int sleeptime = 100;//ms while (!exitPending()) { //requietexit() or requietexitWait() not call diff --git a/tvapi/libtv/tvutils/CMutex.h b/tvapi/libtv/tvutils/CMutex.h index 5c91c1a..66749c5 100644 --- a/tvapi/libtv/tvutils/CMutex.h +++ b/tvapi/libtv/tvutils/CMutex.h @@ -67,19 +67,17 @@ private: pthread_mutex_t mMutex; }; - - - - inline CMutex::CMutex() { pthread_mutex_init(&mMutex, NULL); } -inline CMutex::CMutex(const char *name) + +inline CMutex::CMutex(const char *name __unused) { pthread_mutex_init(&mMutex, NULL); } -inline CMutex::CMutex(int type, const char *name) + +inline CMutex::CMutex(int type, const char *name __unused) { if (type == SHARED) { pthread_mutexattr_t attr; @@ -91,24 +89,27 @@ inline CMutex::CMutex(int type, const char *name) pthread_mutex_init(&mMutex, NULL); } } + inline CMutex::~CMutex() { pthread_mutex_destroy(&mMutex); } + inline int CMutex::lock() { return -pthread_mutex_lock(&mMutex); } + inline void CMutex::unlock() { pthread_mutex_unlock(&mMutex); } + inline int CMutex::tryLock() { return -pthread_mutex_trylock(&mMutex); } - //typedef CMutex::Autolock AutoMutex; #endif diff --git a/tvapi/libtv/tvutils/CSerialCommunication.cpp b/tvapi/libtv/tvutils/CSerialCommunication.cpp index b479aa7..664645a 100644 --- a/tvapi/libtv/tvutils/CSerialCommunication.cpp +++ b/tvapi/libtv/tvutils/CSerialCommunication.cpp @@ -1,3 +1,5 @@ +#define LOG_TAG "CSerialCommunication" + #include #include #include @@ -5,16 +7,9 @@ #include #include #include - #include - #include "CSerialCommunication.h" -#ifdef LOG_TAG -#undef LOG_TAG -#define LOG_TAG "CSerialCommunication" -#endif - CSerialCommunication::CSerialCommunication() { int i = 0; diff --git a/tvapi/libtv/tvutils/CSerialCommunication.h b/tvapi/libtv/tvutils/CSerialCommunication.h index d4e7e5a..4f3e2d9 100644 --- a/tvapi/libtv/tvutils/CSerialCommunication.h +++ b/tvapi/libtv/tvutils/CSerialCommunication.h @@ -20,11 +20,13 @@ public: public: ISerialCommunicationObserver() {}; virtual ~ISerialCommunicationObserver() {}; - virtual void onSerialCommunication(int dev_id, int rd_len, unsigned char data_buf[]) {}; + virtual void onSerialCommunication(int dev_id __unused, + int rd_len __unused, + unsigned char data_buf[] __unused) { + }; }; - void setObserver(ISerialCommunicationObserver *pOb) - { + void setObserver(ISerialCommunicationObserver *pOb) { mpObserver = pOb; }; diff --git a/tvapi/libtv/tvutils/CSerialPort.cpp b/tvapi/libtv/tvutils/CSerialPort.cpp index f634b04..a523285 100644 --- a/tvapi/libtv/tvutils/CSerialPort.cpp +++ b/tvapi/libtv/tvutils/CSerialPort.cpp @@ -17,6 +17,7 @@ CSerialPort::CSerialPort() { mDevId = -1; } + //close it CSerialPort::~CSerialPort() { @@ -59,7 +60,7 @@ void CSerialPort::set_speed (int fd, int speed) int status; struct termios Opt; tcgetattr (fd, &Opt); - for (i = 0; i < sizeof (speed_arr) / sizeof (int); i++) { + for (i = 0; i < (int)(sizeof (speed_arr) / sizeof (int)); i++) { if (speed == name_arr[i]) { tcflush (fd, TCIOFLUSH); cfsetispeed (&Opt, speed_arr[i]); @@ -174,7 +175,7 @@ int CSerialPort::set_opt(int speed, int db, int sb, char pb, int overtime, bool } //set speed - for (i = 0; i < sizeof(speed_arr) / sizeof(int); i++) { + for (i = 0; i < (int)(sizeof(speed_arr) / sizeof(int)); i++) { if (speed == name_arr[i]) { cfsetispeed(&new_cfg, speed_arr[i]); cfsetospeed(&new_cfg, speed_arr[i]); diff --git a/tvapi/libtv/tvutils/CSqlite.cpp b/tvapi/libtv/tvutils/CSqlite.cpp index f4e91fb..77d234e 100644 --- a/tvapi/libtv/tvutils/CSqlite.cpp +++ b/tvapi/libtv/tvutils/CSqlite.cpp @@ -8,11 +8,9 @@ // @ Author : // // -#include "CSqlite.h" -#ifdef LOG_TAG -#undef LOG_TAG #define LOG_TAG "CSqlite" -#endif + +#include "CSqlite.h" using namespace android; @@ -23,11 +21,12 @@ CSqlite::CSqlite() CSqlite::~CSqlite() { - if (mHandle > 0) { + if (mHandle != NULL) { sqlite3_close(mHandle); mHandle = NULL; } } + //完整性检测,检测数据库是否被破坏 bool CSqlite::integrityCheck() { @@ -41,7 +40,8 @@ bool CSqlite::integrityCheck() } return true; } -int CSqlite::sqlite3_exec_callback(void *data, int nColumn, char **colValues, char **colNames) + +int CSqlite::sqlite3_exec_callback(void *data __unused, int nColumn, char **colValues, char **colNames __unused) { LOGD("sqlite3_exec_callback--- nums = %d", nColumn); for (int i = 0; i < nColumn; i++) { @@ -71,6 +71,7 @@ int CSqlite::closeDb() } return rval; } + void CSqlite::setHandle(sqlite3 *h) { mHandle = h; @@ -80,6 +81,7 @@ sqlite3 *CSqlite::getHandle() { return mHandle; } + int CSqlite::select(const char *sql, CSqlite::Cursor &c) { int col, row; @@ -104,7 +106,6 @@ int CSqlite::select(const char *sql, CSqlite::Cursor &c) void CSqlite::insert() { - } bool CSqlite::exeSql(const char *sql) @@ -138,15 +139,13 @@ bool CSqlite::rollbackTransaction() void CSqlite::del() { - } void CSqlite::update() { - } void CSqlite::xxtable() { - } + diff --git a/tvapi/libtv/tvutils/CThread.cpp b/tvapi/libtv/tvutils/CThread.cpp index 16ebc30..6288040 100644 --- a/tvapi/libtv/tvutils/CThread.cpp +++ b/tvapi/libtv/tvutils/CThread.cpp @@ -35,7 +35,7 @@ int CThread::readyToRun() } -int CThread::run(const char *name, int priority, int stack) +int CThread::run(const char *name __unused, int priority __unused, int stack) { CMutex::Autolock _l(mLock); diff --git a/tvapi/libtv/tvutils/CTvInput.cpp b/tvapi/libtv/tvutils/CTvInput.cpp index 7e3af96..001a474 100644 --- a/tvapi/libtv/tvutils/CTvInput.cpp +++ b/tvapi/libtv/tvutils/CTvInput.cpp @@ -1,3 +1,5 @@ +#define LOG_TAG "CTvInput" + #include "CTvInput.h" #include #include @@ -6,8 +8,6 @@ #include #include -#define LOG_TAG "FBC" - #define SEND_KEY_ACTION_UP 0x00 #define SEND_KEY_ACTION_DOWN 0x01 @@ -41,7 +41,7 @@ void CTvInput::sendkeyEvent(const int &type, const int &code, const int &value) event.code = code ; event.value = value; ret = write(mKeyEventFd, &event, sizeof(event)); - if (ret < sizeof(event)) { + if (ret < (int)sizeof(event)) { LOGD("sendkeyEvent :write event failed, %s\n", strerror(errno)); return; } @@ -57,7 +57,7 @@ void CTvInput::sendIRkeyEvent(const int &type, const int &code, const int &value event.code = code ; event.value = value; ret = write(mKeyEventFd_IR, &event, sizeof(event)); - if (ret < sizeof(event)) { + if (ret < (int)sizeof(event)) { LOGD("sendIRkeyEvent :write event failed, %s\n", strerror(errno)); return; } @@ -142,7 +142,7 @@ bool CTvInput::threadLoop() int disToSend = -1; do { disToSend = mWhenTimeRepeatKeyStartToSend - getNowMs(); - LOGD("dis when = %lld", disToSend); + LOGD("dis when = %d", disToSend); if (disToSend <= 0) break; mLock.lock(); diff --git a/tvapi/libtv/tvutils/serial_base.cpp b/tvapi/libtv/tvutils/serial_base.cpp index 8a5a98b..be9ae17 100644 --- a/tvapi/libtv/tvutils/serial_base.cpp +++ b/tvapi/libtv/tvutils/serial_base.cpp @@ -1,3 +1,5 @@ +#define LOG_TAG "serial_base" + #include #include #include @@ -13,8 +15,6 @@ #include #include "serial_base.h" - -#define LOG_TAG "serial_base" #include "CTvLog.h" #define CS_SERIAL_A_DEV_PATH "/dev/ttyS0" @@ -140,7 +140,7 @@ static int com_set_opt(int hComm, int speed, int db, int sb, int pb, int to, int return -1; } - for (i = 0; i < sizeof(speed_arr) / sizeof(int); i++) { + for (i = 0; i < (int)(sizeof(speed_arr) / sizeof(int)); i++) { if (speed == name_arr[i]) { cfsetispeed(&tmpOpt, speed_arr[i]); cfsetospeed(&tmpOpt, speed_arr[i]); @@ -281,7 +281,7 @@ int com_a_open_dev() pthread_mutex_lock(&serial_a_op_mutex); - tmp_ret = open_com_dev(&gSerialAHandle, CS_SERIAL_A_DEV_PATH); + tmp_ret = open_com_dev(&gSerialAHandle, (char *)CS_SERIAL_A_DEV_PATH); pthread_mutex_unlock(&serial_a_op_mutex); @@ -294,7 +294,7 @@ int com_b_open_dev() pthread_mutex_lock(&serial_b_op_mutex); - tmp_ret = open_com_dev(&gSerialBHandle, CS_SERIAL_B_DEV_PATH); + tmp_ret = open_com_dev(&gSerialBHandle, (char *)CS_SERIAL_B_DEV_PATH); pthread_mutex_unlock(&serial_b_op_mutex); diff --git a/tvapi/libtv/tvutils/serial_operate.cpp b/tvapi/libtv/tvutils/serial_operate.cpp index fba239b..ddd1c01 100644 --- a/tvapi/libtv/tvutils/serial_operate.cpp +++ b/tvapi/libtv/tvutils/serial_operate.cpp @@ -1,3 +1,5 @@ +#define LOG_TAG "serial_operate" + #include #include #include @@ -19,14 +21,8 @@ #include "serial_base.h" #include "serial_operate.h" - -#ifdef LOG_TAG -#undef LOG_TAG -#define LOG_TAG "headset" -#endif #include "CTvLog.h" - //****************************************************** #ifndef HIDIOCSFEATURE #define HIDIOCSFEATURE(len) _IOC(_IOC_WRITE|_IOC_READ, 'H', 0x06, len) diff --git a/tvapi/libtv/tvutils/serial_operate.h b/tvapi/libtv/tvutils/serial_operate.h index a2d0e9a..c1262aa 100644 --- a/tvapi/libtv/tvutils/serial_operate.h +++ b/tvapi/libtv/tvutils/serial_operate.h @@ -12,21 +12,20 @@ public: class IHeadSetObserver { public: - IHeadSetObserver() - {}; - virtual ~IHeadSetObserver() - {}; - virtual void onHeadSetDetect(int state, int para) {}; - virtual void onThermalDetect(int state) {}; - + IHeadSetObserver() {}; + virtual ~IHeadSetObserver() {}; + virtual void onHeadSetDetect(int state __unused, int para __unused) { + }; + virtual void onThermalDetect(int state __unused) { + }; }; - void setObserver ( IHeadSetObserver *pOb ) - { + + void setObserver ( IHeadSetObserver *pOb ) { mpObserver = pOb; }; private: - bool threadLoop(); + bool threadLoop(); IHeadSetObserver *mpObserver; }; diff --git a/tvapi/libtv/tvutils/tvutils.cpp b/tvapi/libtv/tvutils/tvutils.cpp index e6879ca..c281b65 100644 --- a/tvapi/libtv/tvutils/tvutils.cpp +++ b/tvapi/libtv/tvutils/tvutils.cpp @@ -1,3 +1,5 @@ +#define LOG_TAG "TVutils" + #include #include #include @@ -21,8 +23,6 @@ using namespace android; #include "tvutils.h" - -#define LOG_TAG "LibTvMISC" #include "CTvLog.h" #define CS_I2C_1_DEV_PATH "/dev/i2c-1" @@ -397,7 +397,7 @@ static int memerase(int fd, struct erase_info_user *erase) #define CS_ATV_SOCKET_FILE_NAME "/dev/socket/datv_sock" -static int setServer(const char *fileName) +static int setServer(const char *fileName __unused) { int ret = -1, sock = -1; struct sockaddr_un srv_addr; @@ -709,13 +709,13 @@ int I2C_WriteNbyte(int i2c_no, int dev_addr, int slave_addr, int len, unsigned c if (i2c_no == 1) { device_fd = open(CS_I2C_1_DEV_PATH, O_RDWR); if (device_fd < 0) { - LOGE("%s, Open device file %S error: %s.\n", CFG_SECTION_TV, CS_I2C_1_DEV_PATH, strerror(errno)); + LOGE("%s, Open device file %s error: %s.\n", CFG_SECTION_TV, CS_I2C_1_DEV_PATH, strerror(errno)); return -1; } } else if (i2c_no == 2) { device_fd = open(CS_I2C_2_DEV_PATH, O_RDWR); if (device_fd < 0) { - LOGE("%s, Open device file %S error: %s.\n", CFG_SECTION_TV, CS_I2C_2_DEV_PATH, strerror(errno)); + LOGE("%s, Open device file %s error: %s.\n", CFG_SECTION_TV, CS_I2C_2_DEV_PATH, strerror(errno)); return -1; } } else { @@ -766,13 +766,13 @@ int I2C_ReadNbyte(int i2c_no, int dev_addr, int slave_addr, int len, unsigned ch if (i2c_no == 1) { device_fd = open(CS_I2C_1_DEV_PATH, O_RDWR); if (device_fd < 0) { - LOGE("%s, Open device file %S error: %s.\n", CFG_SECTION_TV, CS_I2C_1_DEV_PATH, strerror(errno)); + LOGE("%s, Open device file %s error: %s.\n", CFG_SECTION_TV, CS_I2C_1_DEV_PATH, strerror(errno)); return -1; } } else if (i2c_no == 2) { device_fd = open(CS_I2C_2_DEV_PATH, O_RDWR); if (device_fd < 0) { - LOGE("%s, Open device file %S error: %s.\n", CFG_SECTION_TV, CS_I2C_2_DEV_PATH, strerror(errno)); + LOGE("%s, Open device file %s error: %s.\n", CFG_SECTION_TV, CS_I2C_2_DEV_PATH, strerror(errno)); return -1; } } else { @@ -916,7 +916,7 @@ int Set_Fixed_NonStandard(int value) return ret; } -static void *UserPet_TreadRun(void *data) +static void *UserPet_TreadRun(void *data __unused) { while (is_turnon_user_pet_thread == true) { if (is_user_pet_thread_start == true) { @@ -1429,7 +1429,7 @@ int reboot_sys_by_fbc_edid_info() LOGD("get edid info from fbc!"); memset(outputmode_prop_value, '\0', 256); memset(lcd_reverse_prop_value, '\0', 256); - property_get("ubootenv.var.outputmode", outputmode_prop_value, "null" ); + property_get(UBOOTENV_OUTPUTMODE, outputmode_prop_value, "null" ); property_get("ubootenv.var.lcd_reverse", lcd_reverse_prop_value, "null" ); fd = open("/sys/class/amhdmitx/amhdmitx0/edid_info", O_RDWR); @@ -1455,7 +1455,7 @@ int reboot_sys_by_fbc_edid_info() if (0 == env_different_as_cur) { env_different_as_cur = 1; } - property_set("ubootenv.var.outputmode", "1080p"); + property_set(UBOOTENV_OUTPUTMODE, "1080p"); } break; case 0x1: @@ -1465,7 +1465,7 @@ int reboot_sys_by_fbc_edid_info() if (0 == env_different_as_cur) { env_different_as_cur = 1; } - property_set("ubootenv.var.outputmode", "4k2k60hz420"); + property_set(UBOOTENV_OUTPUTMODE, "4k2k60hz420"); } break; case 0x2: @@ -1473,7 +1473,7 @@ int reboot_sys_by_fbc_edid_info() if (0 == env_different_as_cur) { env_different_as_cur = 1; } - property_set("ubootenv.var.outputmode", "1366*768"); + property_set(UBOOTENV_OUTPUTMODE, "1366*768"); } break; default: @@ -1540,7 +1540,7 @@ int reboot_sys_by_fbc_uart_panel_info(CFbcCommunication *fbc) LOGD("device is fbc, get panel info from fbc!\n"); memset(outputmode_prop_value, '\0', 256); memset(lcd_reverse_prop_value, '\0', 256); - property_get("ubootenv.var.outputmode", outputmode_prop_value, "null" ); + property_get(UBOOTENV_OUTPUTMODE, outputmode_prop_value, "null" ); property_get("ubootenv.var.lcd_reverse", lcd_reverse_prop_value, "null" ); fbc->cfbc_Get_FBC_PANEL_REVERSE(COMM_DEV_SERIAL, &panel_reverse); @@ -1556,7 +1556,7 @@ int reboot_sys_by_fbc_uart_panel_info(CFbcCommunication *fbc) if (0 == env_different_as_cur) { env_different_as_cur = 1; } - property_set("ubootenv.var.outputmode", "1080p"); + property_set(UBOOTENV_OUTPUTMODE, "1080p"); } break; case 0x1: @@ -1566,7 +1566,7 @@ int reboot_sys_by_fbc_uart_panel_info(CFbcCommunication *fbc) if (0 == env_different_as_cur) { env_different_as_cur = 1; } - property_set("ubootenv.var.outputmode", "4k2k60hz420"); + property_set(UBOOTENV_OUTPUTMODE, "4k2k60hz420"); } break; case 0x2: @@ -1574,7 +1574,7 @@ int reboot_sys_by_fbc_uart_panel_info(CFbcCommunication *fbc) if (0 == env_different_as_cur) { env_different_as_cur = 1; } - property_set("ubootenv.var.outputmode", "1366*768"); + property_set(UBOOTENV_OUTPUTMODE, "1366*768"); } break; default: @@ -1623,7 +1623,7 @@ static pid_t pidof(const char *name) char tmp_buf[512]; if (!(dir = opendir("/proc"))) { - LOGE("%s, can't open /proc", __FUNCTION__, strerror(errno)); + LOGE("%s, can't open /proc, %s", __FUNCTION__, strerror(errno)); return -1; } @@ -1711,8 +1711,8 @@ unsigned int CalCRC32(unsigned int crc, const unsigned char *ptr, unsigned int b 0xedb88320, 0xf00f9344, 0xd6d6a3e8, 0xcb61b38c, 0x9b64c2b0, 0x86d3d2d4, 0xa00ae278, 0xbdbdf21c }; unsigned int crcu32 = crc; - if (buf_len < 0) - return 0; + //if (buf_len < 0) + // return 0; if (!ptr) return 0; crcu32 = ~crcu32; while (buf_len--) { @@ -1773,12 +1773,11 @@ static char gFBCPrjInfoBuf[1024] = {0}; static int GetProjectInfoOriData(char data_str[], CFbcCommunication *fbcIns) { - int tmp_val = 0; int src_type = GetPlatformProjectInfoSrc(); if (src_type == 0) { - memset(data_str, '\0', sizeof(data_str)); - getBootEnv("ubootenv.var.project_info", data_str, "null"); + //memset(data_str, '\0', sizeof(data_str));//sizeof pointer has issue + getBootEnv("ubootenv.var.project_info", data_str, (char *)"null"); if (strcmp(data_str, "null") == 0) { LOGE("%s, get project info data error!!!\n", __FUNCTION__); return -1; @@ -1966,7 +1965,7 @@ public: { } - void binderDied(const wp &who) + void binderDied(const wp &who __unused) { ALOGW("system_control died!"); } diff --git a/tvapi/libtv/vpp/CPQdb.cpp b/tvapi/libtv/vpp/CPQdb.cpp index fb42bbb..f60802d 100644 --- a/tvapi/libtv/vpp/CPQdb.cpp +++ b/tvapi/libtv/vpp/CPQdb.cpp @@ -8,6 +8,8 @@ * showbo */ +#define LOG_TAG "CPQdb" + #include #include #include @@ -19,7 +21,6 @@ #if (PQ_NO_ANDROID == 0) #include -#define LOG_TAG "CPQdb" #include "CTvLog.h" #endif @@ -213,7 +214,7 @@ int CPqData::reopenDB() } int CPqData::getRegValues(const char *table_name, tvin_port_t source, tvin_sig_fmt_t signal, - is_3d_type_t is2dOr3d, tvin_trans_fmt_t trans_fmt, am_regs_t *regs) + is_3d_type_t is2dOr3d, tvin_trans_fmt_t trans_fmt __unused, am_regs_t *regs) { CSqlite::Cursor c_tablelist, c_reg_list; int index_am_reg = 0; @@ -357,8 +358,10 @@ int CPqData::getRegValuesByValue_long(const char *name, const char *f_name, cons LOGD("%s, length = %d", __FUNCTION__, index_am_reg); return rval; } + int CPqData::PQ_GetBaseColorParams(vpp_color_basemode_t basemode, tvin_port_t source_port, - tvin_sig_fmt_t sig_fmt, is_3d_type_t is2dOr3d, tvin_trans_fmt_t trans_fmt, am_regs_t *regs) + tvin_sig_fmt_t sig_fmt, is_3d_type_t is2dOr3d, + tvin_trans_fmt_t trans_fmt __unused, am_regs_t *regs) { CSqlite::Cursor c; char sqlmaster[256]; @@ -381,7 +384,8 @@ int CPqData::PQ_GetBaseColorParams(vpp_color_basemode_t basemode, tvin_port_t so } int CPqData::PQ_GetCM2Params(vpp_color_management2_t basemode, tvin_port_t source_port, - tvin_sig_fmt_t sig_fmt, is_3d_type_t is2dOr3d, tvin_trans_fmt_t trans_fmt, am_regs_t *regs) + tvin_sig_fmt_t sig_fmt, is_3d_type_t is2dOr3d, + tvin_trans_fmt_t trans_fmt __unused, am_regs_t *regs) { CSqlite::Cursor c; char sqlmaster[256]; @@ -417,7 +421,8 @@ int CPqData::PQ_GetCM2Params(vpp_color_management2_t basemode, tvin_port_t sourc } int CPqData::PQ_GetNR2Params(vpp_noise_reduction2_mode_t nr_mode, tvin_port_t source_port, - tvin_sig_fmt_t sig_fmt, is_3d_type_t is2dOr3d, tvin_trans_fmt_t trans_fmt, am_regs_t *regs) + tvin_sig_fmt_t sig_fmt, is_3d_type_t is2dOr3d, + tvin_trans_fmt_t trans_fmt __unused, am_regs_t *regs) { CSqlite::Cursor c; char sqlmaster[256]; @@ -450,7 +455,8 @@ int CPqData::PQ_GetNR2Params(vpp_noise_reduction2_mode_t nr_mode, tvin_port_t so } int CPqData::PQ_GetXVYCCParams(vpp_xvycc_mode_t xvycc_mode, tvin_port_t source_port, - tvin_sig_fmt_t sig_fmt, is_3d_type_t is2dOr3d, tvin_trans_fmt_t trans_fmt, am_regs_t *regs, + tvin_sig_fmt_t sig_fmt, is_3d_type_t is2dOr3d, + tvin_trans_fmt_t trans_fmt __unused, am_regs_t *regs, am_regs_t *regs_1) { CSqlite::Cursor c; @@ -484,7 +490,8 @@ int CPqData::PQ_GetXVYCCParams(vpp_xvycc_mode_t xvycc_mode, tvin_port_t source_p } int CPqData::PQ_GetMCDIParams(vpp_mcdi_mode_t mcdi_mode, tvin_port_t source_port, - tvin_sig_fmt_t sig_fmt, is_3d_type_t is2dOr3d, tvin_trans_fmt_t trans_fmt, am_regs_t *regs) + tvin_sig_fmt_t sig_fmt, is_3d_type_t is2dOr3d, + tvin_trans_fmt_t trans_fmt __unused, am_regs_t *regs) { CSqlite::Cursor c; char sqlmaster[256]; @@ -517,7 +524,8 @@ int CPqData::PQ_GetMCDIParams(vpp_mcdi_mode_t mcdi_mode, tvin_port_t source_port } int CPqData::PQ_GetDeblockParams(vpp_deblock_mode_t deb_mode, tvin_port_t source_port, - tvin_sig_fmt_t sig_fmt, is_3d_type_t is2dOr3d, tvin_trans_fmt_t trans_fmt, am_regs_t *regs) + tvin_sig_fmt_t sig_fmt, is_3d_type_t is2dOr3d, + tvin_trans_fmt_t trans_fmt __unused, am_regs_t *regs) { CSqlite::Cursor c; char sqlmaster[256]; @@ -656,7 +664,8 @@ int CPqData::PQ_ResetAllColorTemperatureParams(void) } int CPqData::PQ_GetDNLPParams(tvin_port_t source_port, tvin_sig_fmt_t fmt, is_3d_type_t is2dOr3d, - tvin_trans_fmt_t trans_fmt, ve_dnlp_t *params, ve_dnlp_table_t *newParams, int *dnlpFlag) + tvin_trans_fmt_t trans_fmt __unused, ve_dnlp_t *params, + ve_dnlp_table_t *newParams, int *dnlpFlag) { CSqlite::Cursor c; char sqlmaster[256]; @@ -750,6 +759,7 @@ int CPqData::PQ_SetNoLineAllBrightnessParams(tv_source_input_type_t source_type, { return SetNonlinearMapping(TVPQ_DATA_BRIGHTNESS, source_type, osd0, osd25, osd50, osd75, osd100); } + int CPqData::PQ_GetNoLineAllBrightnessParams(tv_source_input_type_t source_type, int *osd0, int *osd25, int *osd50, int *osd75, int *osd100) { @@ -768,8 +778,9 @@ int CPqData::PQ_GetNoLineAllBrightnessParams(tv_source_input_type_t source_type, } -int CPqData::PQ_GetBrightnessParams(tvin_port_t source_port, tvin_sig_fmt_t sig_fmt, - is_3d_type_t is2dOr3d, tvin_trans_fmt_t trans_fmt, int level, int *params) +int CPqData::PQ_GetBrightnessParams(tvin_port_t source_port, tvin_sig_fmt_t sig_fmt __unused, + is_3d_type_t is2dOr3d __unused, tvin_trans_fmt_t trans_fmt __unused, + int level, int *params) { int val; @@ -778,8 +789,10 @@ int CPqData::PQ_GetBrightnessParams(tvin_port_t source_port, tvin_sig_fmt_t sig_ return 0; } -int CPqData::PQ_SetBrightnessParams(tvin_port_t source_port, tvin_sig_fmt_t sig_fmt, - is_3d_type_t is2dOr3d, tvin_trans_fmt_t trans_fmt, int level, int params) + +int CPqData::PQ_SetBrightnessParams(tvin_port_t source_port __unused, tvin_sig_fmt_t sig_fmt __unused, + is_3d_type_t is2dOr3d __unused, tvin_trans_fmt_t trans_fmt __unused, + int level __unused, int params __unused) { return 0; } @@ -789,6 +802,7 @@ int CPqData::PQ_SetNoLineAllContrastParams(tv_source_input_type_t source_type, i { return SetNonlinearMapping(TVPQ_DATA_CONTRAST, source_type, osd0, osd25, osd50, osd75, osd100); } + int CPqData::PQ_GetNoLineAllContrastParams(tv_source_input_type_t source_type, int *osd0, int *osd25, int *osd50, int *osd75, int *osd100) { @@ -806,16 +820,20 @@ int CPqData::PQ_GetNoLineAllContrastParams(tv_source_input_type_t source_type, i return rval; } -int CPqData::PQ_GetContrastParams(tvin_port_t source_port, tvin_sig_fmt_t sig_fmt, - is_3d_type_t is2dOr3d, tvin_trans_fmt_t trans_fmt, int level, int *params) +int CPqData::PQ_GetContrastParams(tvin_port_t source_port, tvin_sig_fmt_t sig_fmt __unused, + is_3d_type_t is2dOr3d __unused, tvin_trans_fmt_t trans_fmt __unused, + int level, int *params) { int val; + GetNonlinearMapping(TVPQ_DATA_CONTRAST, source_port, level, &val); *params = CaculateLevelParam(pq_con_data, con_nodes, val); return 0; } -int CPqData::PQ_SetContrastParams(tvin_port_t source_port, tvin_sig_fmt_t sig_fmt, - is_3d_type_t is2dOr3d, tvin_trans_fmt_t trans_fmt, int level, int params) + +int CPqData::PQ_SetContrastParams(tvin_port_t source_port __unused, tvin_sig_fmt_t sig_fmt __unused, + is_3d_type_t is2dOr3d __unused, tvin_trans_fmt_t trans_fmt __unused, + int level __unused, int params __unused) { return 0; } @@ -825,6 +843,7 @@ int CPqData::PQ_SetNoLineAllSaturationParams(tv_source_input_type_t source_type, { return SetNonlinearMapping(TVPQ_DATA_SATURATION, source_type, osd0, osd25, osd50, osd75, osd100); } + int CPqData::PQ_GetNoLineAllSaturationParams(tv_source_input_type_t source_type, int *osd0, int *osd25, int *osd50, int *osd75, int *osd100) { @@ -842,16 +861,20 @@ int CPqData::PQ_GetNoLineAllSaturationParams(tv_source_input_type_t source_type, return rval; } -int CPqData::PQ_GetSaturationParams(tvin_port_t source_port, tvin_sig_fmt_t sig_fmt, - is_3d_type_t is2dOr3d, tvin_trans_fmt_t trans_fmt, int level, int *params) +int CPqData::PQ_GetSaturationParams(tvin_port_t source_port, tvin_sig_fmt_t sig_fmt __unused, + is_3d_type_t is2dOr3d __unused, tvin_trans_fmt_t trans_fmt __unused, + int level, int *params) { int val; + GetNonlinearMapping(TVPQ_DATA_SATURATION, source_port, level, &val); *params = CaculateLevelParam(pq_sat_data, sat_nodes, val); return 0; } -int CPqData::PQ_SetSaturationParams(tvin_port_t source_port, tvin_sig_fmt_t sig_fmt, - is_3d_type_t is2dOr3d, tvin_trans_fmt_t trans_fmt, int level, int params) + +int CPqData::PQ_SetSaturationParams(tvin_port_t source_port __unused, tvin_sig_fmt_t sig_fmt __unused, + is_3d_type_t is2dOr3d __unused, tvin_trans_fmt_t trans_fmt __unused, + int level __unused, int params __unused) { return 0; } @@ -861,6 +884,7 @@ int CPqData::PQ_SetNoLineAllHueParams(tv_source_input_type_t source_type, int os { return SetNonlinearMapping(TVPQ_DATA_HUE, source_type, osd0, osd25, osd50, osd75, osd100); } + int CPqData::PQ_GetNoLineAllHueParams(tv_source_input_type_t source_type, int *osd0, int *osd25, int *osd50, int *osd75, int *osd100) { @@ -878,16 +902,20 @@ int CPqData::PQ_GetNoLineAllHueParams(tv_source_input_type_t source_type, int *o return rval; } -int CPqData::PQ_GetHueParams(tvin_port_t source_port, tvin_sig_fmt_t sig_fmt, - is_3d_type_t is2dOr3d, tvin_trans_fmt_t trans_fmt, int level, int *params) +int CPqData::PQ_GetHueParams(tvin_port_t source_port, tvin_sig_fmt_t sig_fmt __unused, + is_3d_type_t is2dOr3d __unused, tvin_trans_fmt_t trans_fmt __unused, + int level, int *params) { int val; + GetNonlinearMapping(TVPQ_DATA_HUE, source_port, level, &val); *params = CaculateLevelParam(pq_hue_data, hue_nodes, val); return 0; } -int CPqData::PQ_SetHueParams(tvin_port_t source_port, tvin_sig_fmt_t sig_fmt, - is_3d_type_t is2dOr3d, tvin_trans_fmt_t trans_fmt, int level, int params) + +int CPqData::PQ_SetHueParams(tvin_port_t source_port __unused, tvin_sig_fmt_t sig_fmt __unused, + is_3d_type_t is2dOr3d __unused, tvin_trans_fmt_t trans_fmt __unused, + int level __unused, int params __unused) { return 0; } @@ -897,6 +925,7 @@ int CPqData::PQ_SetNoLineAllSharpnessParams(tv_source_input_type_t source_type, { return SetNonlinearMapping(TVPQ_DATA_SHARPNESS, source_type, osd0, osd25, osd50, osd75, osd100); } + int CPqData::PQ_GetNoLineAllSharpnessParams(tv_source_input_type_t source_type, int *osd0, int *osd25, int *osd50, int *osd75, int *osd100) { @@ -914,10 +943,12 @@ int CPqData::PQ_GetNoLineAllSharpnessParams(tv_source_input_type_t source_type, return rval; } -int CPqData::PQ_GetSharpnessParams(tvin_port_t source_port, tvin_sig_fmt_t sig_fmt, - is_3d_type_t is2dOr3d, tvin_trans_fmt_t trans_fmt, int level, am_regs_t *regs, am_regs_t *regs_l) +int CPqData::PQ_GetSharpnessParams(tvin_port_t source_port, tvin_sig_fmt_t sig_fmt __unused, + is_3d_type_t is2dOr3d __unused, tvin_trans_fmt_t trans_fmt __unused, + int level, am_regs_t *regs, am_regs_t *regs_l) { int val; + GetNonlinearMapping(TVPQ_DATA_SHARPNESS, source_port, level, &val); LOGD("val = %d\n", val); *regs = CaculateLevelRegsParam(pq_sharpness_reg_data, val, 0); @@ -926,6 +957,7 @@ int CPqData::PQ_GetSharpnessParams(tvin_port_t source_port, tvin_sig_fmt_t sig_f } return 0; } + int CPqData::PQ_GetPLLParams(tvin_port_t source_port, tvin_sig_fmt_t sig_fmt, am_regs_t *regs) { int ret = -1; @@ -950,6 +982,7 @@ int CPqData::PQ_GetPLLParams(tvin_port_t source_port, tvin_sig_fmt_t sig_fmt, am } return ret; } + int CPqData::PQ_GetCVD2Params(tvin_port_t source_port, tvin_sig_fmt_t sig_fmt, am_regs_t *regs) { int ret = -1; @@ -974,8 +1007,10 @@ int CPqData::PQ_GetCVD2Params(tvin_port_t source_port, tvin_sig_fmt_t sig_fmt, a return ret; } -int CPqData::PQ_SetSharpnessParams(tvin_port_t source_port, tvin_sig_fmt_t sig_fmt, - is_3d_type_t is2dOr3d, tvin_trans_fmt_t trans_fmt, int level, am_regs_t regs) + +int CPqData::PQ_SetSharpnessParams(tvin_port_t source_port __unused, tvin_sig_fmt_t sig_fmt __unused, + is_3d_type_t is2dOr3d __unused, tvin_trans_fmt_t trans_fmt __unused, + int level __unused, am_regs_t regs __unused) { return 0; } @@ -985,6 +1020,7 @@ int CPqData::PQ_SetNoLineAllVolumeParams(tv_source_input_type_t source_type, int { return SetNonlinearMapping(TVPQ_DATA_VOLUME, source_type, osd0, osd25, osd50, osd75, osd100); } + int CPqData::PQ_GetNoLineAllVolumeParams(tv_source_input_type_t source_type, int *osd0, int *osd25, int *osd50, int *osd75, int *osd100) { @@ -1002,8 +1038,9 @@ int CPqData::PQ_GetNoLineAllVolumeParams(tv_source_input_type_t source_type, int return rval; } -int CPqData::PQ_SetVolumeParams(tvin_port_t source_port, tvin_sig_fmt_t sig_fmt, - is_3d_type_t is2dOr3d, tvin_trans_fmt_t trans_fmt, int level, int params) +int CPqData::PQ_SetVolumeParams(tvin_port_t source_port __unused, tvin_sig_fmt_t sig_fmt __unused, + is_3d_type_t is2dOr3d __unused, tvin_trans_fmt_t trans_fmt __unused, + int level __unused, int params __unused) { return 0; } @@ -1026,7 +1063,7 @@ int CPqData::PQ_ResetAllNoLineParams(void) int CPqData::PQ_GetNoiseReductionParams(vpp_noise_reduction_mode_t nr_mode, tvin_port_t source_port, tvin_sig_fmt_t sig_fmt, is_3d_type_t is2dOr3d, - tvin_trans_fmt_t trans_fmt, int *params) + tvin_trans_fmt_t trans_fmt __unused, int *params) { CSqlite::Cursor c; char sqlmaster[256]; @@ -1054,15 +1091,17 @@ int CPqData::PQ_GetNoiseReductionParams(vpp_noise_reduction_mode_t nr_mode, return rval; } -int CPqData::PQ_SetNoiseReductionParams(vpp_noise_reduction_mode_t nr_mode, - tvin_port_t source_port, tvin_sig_fmt_t sig_fmt, is_3d_type_t is2dOr3d, - tvin_trans_fmt_t trans_fmt, int *params) +int CPqData::PQ_SetNoiseReductionParams(vpp_noise_reduction_mode_t nr_mode __unused, + tvin_port_t source_port __unused, tvin_sig_fmt_t sig_fmt __unused, + is_3d_type_t is2dOr3d __unused, + tvin_trans_fmt_t trans_fmt __unused, int *params __unused) { return 0; } int CPqData::PQ_GetOverscanParams(tv_source_input_type_t source_type, tvin_sig_fmt_t fmt, - is_3d_type_t is2dOr3d, tvin_trans_fmt_t trans_fmt, vpp_display_mode_t dmode, + is_3d_type_t is2dOr3d, + tvin_trans_fmt_t trans_fmt __unused, vpp_display_mode_t dmode __unused, tvin_cutwin_t *cutwin_t) { CSqlite::Cursor c; @@ -1091,7 +1130,7 @@ int CPqData::PQ_GetOverscanParams(tv_source_input_type_t source_type, tvin_sig_f return rval; } int CPqData::PQ_SetOverscanParams(tv_source_input_type_t source_type, tvin_sig_fmt_t fmt, - is_3d_type_t is2dOr3d, tvin_trans_fmt_t trans_fmt, tvin_cutwin_t cutwin_t) + is_3d_type_t is2dOr3d, tvin_trans_fmt_t trans_fmt __unused, tvin_cutwin_t cutwin_t) { CSqlite::Cursor c; char sqlmaster[256]; @@ -1164,6 +1203,7 @@ int CPqData::PQ_GetPQModeParams(tv_source_input_type_t source_type, vpp_picture_ } return rval; } + int CPqData::PQ_SetPQModeParams(tv_source_input_type_t source_type, vpp_picture_mode_t pq_mode, vpp_pq_para_t *params) { @@ -1255,15 +1295,15 @@ int CPqData::PQ_GetGammaTable(int panel_id, tvin_port_t source_port, tvin_sig_fm { CSqlite::Cursor c; char sqlmaster[256]; - int rval = -1; + panel_id = panel_id; + getSqlParams(__FUNCTION__, sqlmaster, "select TableName from GeneralGammaTable where " "TVIN_PORT = %d and " "TVIN_SIG_FMT = %d;", source_port, fmt); rval = this->select(sqlmaster, c); - if (c.moveToFirst()) { int index_TableName = 0;//c.getColumnIndex("TableName"); getSqlParams(__FUNCTION__, sqlmaster, "select %s from %s;", f_name, @@ -1310,6 +1350,7 @@ int CPqData::PQ_GetVGAAjustPara(tvin_sig_fmt_t vga_fmt, tvafe_vga_parm_t *adjpar } return rval; } + int CPqData::PQ_SetVGAAjustPara(tvin_sig_fmt_t vga_fmt, tvafe_vga_parm_t adjparam) { CSqlite::Cursor c; @@ -1531,6 +1572,7 @@ int CPqData::SetNonlinearMappingByName(const char *name, tvpq_data_type_t data_t } return 0; } + int CPqData::getSharpnessFlag() { return sha_diff_flag; @@ -1629,6 +1671,7 @@ int CPqData::LoadPQData(tvpq_data_type_t data_type, tvin_port_t source_port, tvpq_data_t *pq_data = NULL; int *pq_nodes = NULL; + trans_fmt = trans_fmt; switch (data_type) { case TVPQ_DATA_BRIGHTNESS: getSqlParams(__FUNCTION__, sqlmaster, @@ -1908,6 +1951,7 @@ int CPqData::replacePqDb(const char *newFilePath) return ret; } } + int CPqData::PQ_GetPhaseArray(am_phase_t *am_phase) { CSqlite::Cursor c; diff --git a/tvapi/libtv/vpp/CVpp.cpp b/tvapi/libtv/vpp/CVpp.cpp index bdde325..7a69b4e 100644 --- a/tvapi/libtv/vpp/CVpp.cpp +++ b/tvapi/libtv/vpp/CVpp.cpp @@ -1,3 +1,5 @@ +#define LOG_TAG "CVpp" + #include "CVpp.h" #include #include "../tvsetting/CTvSetting.h" @@ -19,11 +21,6 @@ #include "../tvconfig/tvconfig.h" #include "CAv.h" -#ifdef LOG_TAG -#undef LOG_TAG -#define LOG_TAG "CVpp" -#endif - CVpp *CVpp::mInstance; CVpp *CVpp::getInstance() { @@ -697,7 +694,7 @@ int CVpp::Vpp_SetBaseColorMode(vpp_color_basemode_t basemode, tvin_port_t source return ret; } -int CVpp::Vpp_SetColorTemperatureUser(vpp_color_temperature_mode_t temp_mode, +int CVpp::Vpp_SetColorTemperatureUser(vpp_color_temperature_mode_t temp_mode __unused, tv_source_input_type_t source_type) { tcon_rgb_ogo_t rgbogo; @@ -736,8 +733,10 @@ int CVpp::Vpp_SetColorTemperatureUser(vpp_color_temperature_mode_t temp_mode, } int CVpp::Vpp_SetColorTemperature(vpp_color_temperature_mode_t Tempmode, - tv_source_input_type_t source_type, tvin_port_t source_port, tvin_sig_fmt_t sig_fmt, - tvin_trans_fmt_t trans_fmt) + tv_source_input_type_t source_type, + tvin_port_t source_port __unused, + tvin_sig_fmt_t sig_fmt __unused, + tvin_trans_fmt_t trans_fmt __unused) { tcon_rgb_ogo_t rgbogo, rgbPreOffset; int ret = -1; @@ -758,7 +757,7 @@ int CVpp::Vpp_SetColorTemperature(vpp_color_temperature_mode_t Tempmode, return -1; } -int CVpp::Vpp_SetBrightness(int value, tv_source_input_type_t source_type, tvin_port_t source_port, +int CVpp::Vpp_SetBrightness(int value, tv_source_input_type_t source_type __unused, tvin_port_t source_port, tvin_sig_fmt_t sig_fmt, is_3d_type_t is3d, tvin_trans_fmt_t trans_fmt) { int ret = -1; @@ -841,7 +840,7 @@ int CVpp::GetBrightness(tv_source_input_type_t source_type) return data; } -int CVpp::Vpp_SetContrast(int value, tv_source_input_type_t source_type, tvin_port_t source_port, +int CVpp::Vpp_SetContrast(int value, tv_source_input_type_t source_type __unused, tvin_port_t source_port, tvin_sig_fmt_t sig_fmt, is_3d_type_t is3d, tvin_trans_fmt_t trans_fmt) { int ret = -1; @@ -922,7 +921,7 @@ int CVpp::GetContrast(tv_source_input_type_t source_type) return data; } -int CVpp::Vpp_SetSaturation(int value, tv_source_input_type_t source_type, tvin_port_t source_port, +int CVpp::Vpp_SetSaturation(int value, tv_source_input_type_t source_type __unused, tvin_port_t source_port, tvin_sig_fmt_t sig_fmt, is_3d_type_t is3d, tvin_trans_fmt_t trans_fmt) { int ret = -1; @@ -938,7 +937,6 @@ int CVpp::Vpp_SetSaturation(int value, tv_source_input_type_t source_type, tvin_ if (VPP_SetVideoSaturationHue(params, hue) == 0) { return 0; } - } else { } } @@ -1057,7 +1055,7 @@ int CVpp::GetHue(tv_source_input_type_t source_type) return data; } -int CVpp::Vpp_SetSharpness(int value, tv_source_input_type_t source_type, tvin_port_t source_port, +int CVpp::Vpp_SetSharpness(int value, tv_source_input_type_t source_type __unused, tvin_port_t source_port, tvin_sig_fmt_t sig_fmt, is_3d_type_t is3d, tvin_trans_fmt_t trans_fmt) { int ret = -1; @@ -1153,7 +1151,8 @@ int CVpp::SetColorSpaceMode(vpp_color_space_type_t colorSpace) } int CVpp::Vpp_SetNoiseReductionMode(vpp_noise_reduction_mode_t nr_mode, - tv_source_input_type_t source_type, tvin_port_t source_port, tvin_sig_fmt_t sig_fmt, + tv_source_input_type_t source_type __unused, + tvin_port_t source_port, tvin_sig_fmt_t sig_fmt, is_3d_type_t is3d, tvin_trans_fmt_t trans_fmt) { int ret = -1; @@ -1210,7 +1209,7 @@ vpp_noise_reduction_mode_t CVpp::GetNoiseReductionMode(tv_source_input_type_t so return data; } -int CVpp::Vpp_SetXVYCCMode(vpp_xvycc_mode_t xvycc_mode, tv_source_input_type_t source_type, +int CVpp::Vpp_SetXVYCCMode(vpp_xvycc_mode_t xvycc_mode, tv_source_input_type_t source_type __unused, tvin_port_t source_port, tvin_sig_fmt_t sig_fmt, is_3d_type_t is3d, tvin_trans_fmt_t trans_fmt) { @@ -1236,7 +1235,7 @@ int CVpp::Vpp_SetXVYCCMode(vpp_xvycc_mode_t xvycc_mode, tv_source_input_type_t s return ret; } -int CVpp::Vpp_SetMCDIMode(vpp_mcdi_mode_t mcdi_mode, tv_source_input_type_t source_type, +int CVpp::Vpp_SetMCDIMode(vpp_mcdi_mode_t mcdi_mode, tv_source_input_type_t source_type __unused, tvin_port_t source_port, tvin_sig_fmt_t sig_fmt, is_3d_type_t is3d, tvin_trans_fmt_t trans_fmt) { @@ -1462,14 +1461,9 @@ vpp_color_basemode_t CVpp::GetBaseColorMode(void) } int CVpp::SetColorTempWithoutSave(vpp_color_temperature_mode_t Tempmode, - tv_source_input_type_t source_type) + tv_source_input_type_t source_type __unused) { tcon_rgb_ogo_t rgbogo; - int ret = -1; - - if (mbVppCfg_whitebalance_sameparam) { - source_type = SOURCE_TYPE_TV; //set all source share to use one group - } if (mbVppCfg_gamma_onoff) { VPP_SetGammaOnOff(0); @@ -1579,13 +1573,9 @@ vpp_display_mode_t CVpp::GetDisplayMode(tv_source_input_type_t source_type) return data; } -int CVpp::SetBacklightWithoutSave(int value, tv_source_input_type_t source_type) +int CVpp::SetBacklightWithoutSave(int value, tv_source_input_type_t source_type __unused) { - int backlight_value, backlight_reverse = 0; - int ret = -1; - int tmp_pic_mode = 0; - - source_type = SOURCE_TYPE_TV; + int backlight_value; if (value < 0 || value > 100) { value = 100; @@ -2385,11 +2375,10 @@ int CVpp::CheckColorTemperatureParams(void) for (i = 0; i < 3; i++) { ReadColorTemperatureParams((vpp_color_temperature_mode_t) i, &rgbogo); - if (rgbogo.r_gain > 2047 || rgbogo.b_gain > 2047 || rgbogo.g_gain > 2047 || rgbogo.r_gain - < 0 || rgbogo.b_gain < 0 || rgbogo.g_gain < 0) { - if (rgbogo.r_post_offset > 1023 || rgbogo.g_post_offset > 1023 || rgbogo.b_post_offset - > 1023 || rgbogo.r_post_offset < -1024 || rgbogo.g_post_offset < -1024 - || rgbogo.b_post_offset < -1024) { + if (rgbogo.r_gain > 2047 || rgbogo.b_gain > 2047 || rgbogo.g_gain > 2047 + /*|| rgbogo.r_gain < 0 || rgbogo.b_gain < 0 || rgbogo.g_gain < 0*/) { + if (rgbogo.r_post_offset > 1023 || rgbogo.g_post_offset > 1023 || rgbogo.b_post_offset > 1023 || + rgbogo.r_post_offset < -1024 || rgbogo.g_post_offset < -1024 || rgbogo.b_post_offset < -1024) { return 0; } } @@ -2455,7 +2444,7 @@ int CVpp::FactorySetColorTemp_Rgain(int source_type, int colortemp_mode, int rga return -1; } -int CVpp::FactorySaveColorTemp_Rgain(int source_type, int colortemp_mode, int rgain) +int CVpp::FactorySaveColorTemp_Rgain(int source_type __unused, int colortemp_mode, int rgain) { tcon_rgb_ogo_t rgbogo; @@ -2468,7 +2457,7 @@ int CVpp::FactorySaveColorTemp_Rgain(int source_type, int colortemp_mode, int rg return -1; } -int CVpp::FactoryGetColorTemp_Rgain(int source_type, int colortemp_mode) +int CVpp::FactoryGetColorTemp_Rgain(int source_type __unused, int colortemp_mode) { tcon_rgb_ogo_t rgbogo; @@ -2497,7 +2486,7 @@ int CVpp::FactorySetColorTemp_Ggain(int source_type, int colortemp_mode, int gga return -1; } -int CVpp::FactorySaveColorTemp_Ggain(int source_type, int colortemp_mode, int ggain) +int CVpp::FactorySaveColorTemp_Ggain(int source_type __unused, int colortemp_mode, int ggain) { tcon_rgb_ogo_t rgbogo; @@ -2510,7 +2499,7 @@ int CVpp::FactorySaveColorTemp_Ggain(int source_type, int colortemp_mode, int gg return -1; } -int CVpp::FactoryGetColorTemp_Ggain(int source_type, int colortemp_mode) +int CVpp::FactoryGetColorTemp_Ggain(int source_type __unused, int colortemp_mode) { tcon_rgb_ogo_t rgbogo; @@ -2539,7 +2528,7 @@ int CVpp::FactorySetColorTemp_Bgain(int source_type, int colortemp_mode, int bga return -1; } -int CVpp::FactorySaveColorTemp_Bgain(int source_type, int colortemp_mode, int bgain) +int CVpp::FactorySaveColorTemp_Bgain(int source_type __unused, int colortemp_mode, int bgain) { tcon_rgb_ogo_t rgbogo; @@ -2552,7 +2541,7 @@ int CVpp::FactorySaveColorTemp_Bgain(int source_type, int colortemp_mode, int bg return -1; } -int CVpp::FactoryGetColorTemp_Bgain(int source_type, int colortemp_mode) +int CVpp::FactoryGetColorTemp_Bgain(int source_type __unused, int colortemp_mode) { tcon_rgb_ogo_t rgbogo; @@ -2581,7 +2570,7 @@ int CVpp::FactorySetColorTemp_Roffset(int source_type, int colortemp_mode, int r return -1; } -int CVpp::FactorySaveColorTemp_Roffset(int source_type, int colortemp_mode, int roffset) +int CVpp::FactorySaveColorTemp_Roffset(int source_type __unused, int colortemp_mode, int roffset) { tcon_rgb_ogo_t rgbogo; @@ -2594,7 +2583,7 @@ int CVpp::FactorySaveColorTemp_Roffset(int source_type, int colortemp_mode, int return -1; } -int CVpp::FactoryGetColorTemp_Roffset(int source_type, int colortemp_mode) +int CVpp::FactoryGetColorTemp_Roffset(int source_type __unused, int colortemp_mode) { tcon_rgb_ogo_t rgbogo; @@ -2623,7 +2612,7 @@ int CVpp::FactorySetColorTemp_Goffset(int source_type, int colortemp_mode, int g return -1; } -int CVpp::FactorySaveColorTemp_Goffset(int source_type, int colortemp_mode, int goffset) +int CVpp::FactorySaveColorTemp_Goffset(int source_type __unused, int colortemp_mode, int goffset) { tcon_rgb_ogo_t rgbogo; @@ -2636,7 +2625,7 @@ int CVpp::FactorySaveColorTemp_Goffset(int source_type, int colortemp_mode, int return -1; } -int CVpp::FactoryGetColorTemp_Goffset(int source_type, int colortemp_mode) +int CVpp::FactoryGetColorTemp_Goffset(int source_type __unused, int colortemp_mode) { tcon_rgb_ogo_t rgbogo; @@ -2665,7 +2654,7 @@ int CVpp::FactorySetColorTemp_Boffset(int source_type, int colortemp_mode, int b return -1; } -int CVpp::FactorySaveColorTemp_Boffset(int source_type, int colortemp_mode, int boffset) +int CVpp::FactorySaveColorTemp_Boffset(int source_type __unused, int colortemp_mode, int boffset) { tcon_rgb_ogo_t rgbogo; @@ -2678,7 +2667,7 @@ int CVpp::FactorySaveColorTemp_Boffset(int source_type, int colortemp_mode, int return -1; } -int CVpp::FactoryGetColorTemp_Boffset(int source_type, int colortemp_mode) +int CVpp::FactoryGetColorTemp_Boffset(int source_type __unused, int colortemp_mode) { tcon_rgb_ogo_t rgbogo; @@ -2909,7 +2898,7 @@ int CVpp::FactorySetNolineParams(int type, int source_type, noline_params_t noli return ret; } -int CVpp::FactorySetOverscan(int source_type, int fmt, int status_3d, int trans_fmt, +int CVpp::FactorySetOverscan(int source_type, int fmt, int status_3d __unused, int trans_fmt, tvin_cutwin_t cutwin_t) { int ret = -1; @@ -3492,10 +3481,10 @@ int CVpp::VPP_GetGrayPattern() int CVpp::VPP_SplitScreenEffect(int width, int v_register) { - FILE *fp = fopen("/sys/class/amlogic/debug", "w"); + FILE *fp = fopen(SYS_DROILOGIC_DEBUG, "w"); if (fp == NULL) { - LOGE("Open /sys/class/amlogic/debug ERROR(%s)!!\n", strerror(errno)); + LOGE("Open %s ERROR(%s)!!\n",SYS_DROILOGIC_DEBUG, strerror(errno)); return -1; } LOGD("width = %x----v_register = %x", width, v_register); @@ -3777,11 +3766,10 @@ int CVpp::VPP_SetScalerPathSel(const unsigned int value) { FILE *fp = NULL; - fp = fopen("/sys/class/video/video_scaler_path_sel", "w"); - LOGD("~~~fopen~~~##VPP_SetScalerPathSel##%s : %d ##", "/sys/class/video/video_scaler_path_sel", - value); + fp = fopen(SYS_VIDEO_SCALER_PATH_SEL, "w"); + LOGD("VPP_SetScalerPathSel %s : %d", SYS_VIDEO_SCALER_PATH_SEL, value); if (fp == NULL) { - LOGE("Open /sys/class/video/video_scaler_path_sel error(%s)!\n", strerror(errno)); + LOGE("Open %s error(%s)!\n",SYS_VIDEO_SCALER_PATH_SEL, strerror(errno)); return -1; } fprintf(fp, "%d", value); diff --git a/tvapi/tvtests/comm_test.cpp b/tvapi/tvtests/comm_test.cpp index c719cc1..0fac8ab 100644 --- a/tvapi/tvtests/comm_test.cpp +++ b/tvapi/tvtests/comm_test.cpp @@ -8,7 +8,7 @@ void usage(char *processname) } -int main(int argc, char **argv) +int main(int argc __unused, char **argv __unused) { int cmd, go = 1; LOGD("---------------0------------------------"); -- cgit