summaryrefslogtreecommitdiff
Diffstat
-rw-r--r--Android.mk14
-rw-r--r--screen_source/Android.mk31
-rw-r--r--screen_source/aml_screen.cpp296
-rw-r--r--screen_source/v4l2_vdin.cpp676
-rw-r--r--screen_source/v4l2_vdin.h144
-rw-r--r--tv_callback.h18
-rw-r--r--tv_input.cpp263
-rw-r--r--tvapi/android/Android.mk2
-rw-r--r--tvapi/android/include/ITv.h98
-rw-r--r--tvapi/android/include/ITvClient.h56
-rw-r--r--tvapi/android/include/ITvService.h66
-rw-r--r--tvapi/android/include/Tv.h158
-rw-r--r--tvapi/android/include/tvcmd.h1212
-rw-r--r--tvapi/android/jni/Android.mk135
-rw-r--r--tvapi/android/jni/cfbc_jni.cpp18
-rw-r--r--tvapi/android/jni/cfbc_test.cpp86
-rw-r--r--tvapi/android/jni/com_droidlogic_app_tv_TvControlManager.cpp (renamed from tvapi/android/jni/android_amlogic_tv.cpp)929
-rw-r--r--tvapi/android/libtvbinder/Android.mk48
-rw-r--r--tvapi/android/libtvbinder/ITv.cpp292
-rw-r--r--tvapi/android/libtvbinder/ITvClient.cpp116
-rw-r--r--tvapi/android/libtvbinder/ITvService.cpp100
-rw-r--r--tvapi/android/libtvbinder/Tv.cpp378
-rw-r--r--tvapi/android/tv/Android.mk23
-rw-r--r--tvapi/android/tv/CTv.cpp104
-rw-r--r--tvapi/android/tv/CTv.h54
-rw-r--r--tvapi/android/tvserver/Android.mk164
-rw-r--r--tvapi/android/tvserver/TvService.cpp8911
-rw-r--r--tvapi/android/tvserver/TvService.h170
-rw-r--r--tvapi/android/tvserver/main.cpp46
-rw-r--r--tvapi/android/tvserver/tv_callback.h18
-rw-r--r--[-rwxr-xr-x]tvapi/build/include/.gitignore0
-rw-r--r--tvapi/build/include/xxxconfig.h1
-rw-r--r--tvapi/docs/tv.uml12156
-rw-r--r--tvapi/libtv/Android.mk12
-rw-r--r--tvapi/libtv/audio/CAudioCustomerCtrl.cpp126
-rw-r--r--tvapi/libtv/audio/CAudioCustomerCtrl.h31
-rw-r--r--tvapi/libtv/audio/CTvAudio.cpp30
-rw-r--r--tvapi/libtv/audio/CTvAudio.h76
-rw-r--r--tvapi/libtv/audio/audio_alsa.cpp2073
-rw-r--r--tvapi/libtv/audio/audio_alsa.h257
-rw-r--r--tvapi/libtv/audio/audio_android.cpp1035
-rw-r--r--tvapi/libtv/audio/audio_android.h78
-rw-r--r--tvapi/libtv/audio/audio_android_effect.cpp591
-rw-r--r--tvapi/libtv/audio/audio_android_effect.h65
-rw-r--r--tvapi/libtv/audio/audio_api.cpp2470
-rw-r--r--tvapi/libtv/audio/audio_api.h323
-rw-r--r--tvapi/libtv/audio/audio_effect.cpp356
-rw-r--r--tvapi/libtv/audio/audio_effect.h58
-rw-r--r--tvapi/libtv/include/amstream.h526
-rw-r--r--tvapi/libtv/include/amvecm.h136
-rw-r--r--tvapi/libtv/include/cm.h308
-rw-r--r--tvapi/libtv/include/hdmirx_cec.h316
-rw-r--r--tvapi/libtv/include/ve.h461
-rw-r--r--tvapi/libtv/tv/AutoBackLight.cpp425
-rw-r--r--tvapi/libtv/tv/CAutoPQparam.cpp150
-rw-r--r--tvapi/libtv/tv/CAutoPQparam.h41
-rw-r--r--tvapi/libtv/tv/CAv.cpp116
-rw-r--r--tvapi/libtv/tv/CAv.h24
-rw-r--r--tvapi/libtv/tv/CFbcCommunication.cpp443
-rw-r--r--tvapi/libtv/tv/CFbcCommunication.h25
-rw-r--r--tvapi/libtv/tv/CFrontEnd.cpp198
-rw-r--r--tvapi/libtv/tv/CFrontEnd.h19
-rw-r--r--tvapi/libtv/tv/CTv.cpp13003
-rw-r--r--tvapi/libtv/tv/CTv.h1453
-rw-r--r--tvapi/libtv/tv/CTvBooking.cpp324
-rw-r--r--tvapi/libtv/tv/CTvBooking.h166
-rw-r--r--tvapi/libtv/tv/CTvEpg.cpp24
-rw-r--r--tvapi/libtv/tv/CTvEv.h12
-rw-r--r--tvapi/libtv/tv/CTvLog.h8
-rw-r--r--tvapi/libtv/tv/CTvRecord.cpp552
-rw-r--r--tvapi/libtv/tv/CTvRecord.h92
-rw-r--r--tvapi/libtv/tv/CTvSatellite.h42
-rw-r--r--tvapi/libtv/tv/CTvScanner.cpp335
-rw-r--r--tvapi/libtv/tv/CTvScanner.h26
-rw-r--r--tvapi/libtv/tv/CTvScreenCapture.cpp1279
-rw-r--r--tvapi/libtv/tv/CTvScreenCapture.h351
-rw-r--r--tvapi/libtv/tv/CTvSubtitle.cpp361
-rw-r--r--tvapi/libtv/tv/CTvSubtitle.h484
-rw-r--r--tvapi/libtv/tv/CTvVchipCheck.cpp6
-rw-r--r--tvapi/libtv/tv/CUpgradeFBC.cpp4
-rw-r--r--tvapi/libtv/tv/CUpgradeFBC.h282
-rw-r--r--tvapi/libtv/tv/ScreenCatch.cpp379
-rw-r--r--tvapi/libtv/tvconfig/CIniFile.cpp706
-rw-r--r--tvapi/libtv/tvconfig/tvconfig.conf58
-rw-r--r--tvapi/libtv/tvconfig/tvconfig.cpp106
-rw-r--r--tvapi/libtv/tvconfig/tvconfig.h40
-rw-r--r--tvapi/libtv/tvdb/CTvChannel.cpp694
-rw-r--r--tvapi/libtv/tvdb/CTvChannel.h574
-rw-r--r--tvapi/libtv/tvdb/CTvDatabase.cpp25
-rw-r--r--tvapi/libtv/tvdb/CTvDatabase.h188
-rw-r--r--tvapi/libtv/tvdb/CTvDimension.cpp86
-rw-r--r--tvapi/libtv/tvdb/CTvDimension.h194
-rw-r--r--tvapi/libtv/tvdb/CTvEvent.cpp483
-rw-r--r--tvapi/libtv/tvdb/CTvEvent.h170
-rw-r--r--tvapi/libtv/tvdb/CTvGroup.cpp88
-rw-r--r--tvapi/libtv/tvdb/CTvGroup.h60
-rw-r--r--tvapi/libtv/tvdb/CTvProgram.cpp1806
-rw-r--r--tvapi/libtv/tvdb/CTvProgram.h1066
-rw-r--r--tvapi/libtv/tvdb/CTvRegion.cpp366
-rw-r--r--tvapi/libtv/tvdb/CTvRegion.h84
-rw-r--r--tvapi/libtv/tvin/CHDMIRxCEC.cpp38
-rw-r--r--tvapi/libtv/tvin/CSourceConnectDetect.cpp478
-rw-r--r--tvapi/libtv/tvin/CSourceConnectDetect.h73
-rw-r--r--tvapi/libtv/tvin/CTvin.cpp203
-rw-r--r--tvapi/libtv/tvin/CTvin.h191
-rw-r--r--tvapi/libtv/tvsetting/CBlobDevice.cpp54
-rw-r--r--tvapi/libtv/tvsetting/CBlobDevice.h100
-rw-r--r--tvapi/libtv/tvsetting/CBlobDeviceE2prom.cpp403
-rw-r--r--tvapi/libtv/tvsetting/CBlobDeviceE2prom.h152
-rw-r--r--tvapi/libtv/tvsetting/CBlobDeviceFile.cpp160
-rw-r--r--tvapi/libtv/tvsetting/CBlobDeviceFile.h52
-rw-r--r--tvapi/libtv/tvsetting/CBlobDeviceRam.cpp258
-rw-r--r--tvapi/libtv/tvsetting/CBlobDeviceRam.h74
-rw-r--r--tvapi/libtv/tvsetting/CTvSetting.cpp4658
-rw-r--r--tvapi/libtv/tvsetting/CTvSetting.h30
-rw-r--r--tvapi/libtv/tvsetting/CTvSettingCfg.h782
-rw-r--r--tvapi/libtv/tvsetting/CTvSettingDeviceFactory.cpp10
-rw-r--r--tvapi/libtv/tvsetting/TvKeyData.cpp2726
-rw-r--r--tvapi/libtv/tvsetting/TvKeyData.h64
-rw-r--r--tvapi/libtv/tvsetting/audio_cfg.cpp2575
-rw-r--r--tvapi/libtv/tvsetting/audio_cfg.h239
-rw-r--r--tvapi/libtv/tvutils/CCondition.h2
-rw-r--r--tvapi/libtv/tvutils/CFile.cpp65
-rw-r--r--tvapi/libtv/tvutils/CFile.h3
-rw-r--r--tvapi/libtv/tvutils/CHdmiCecCmd.cpp2
-rw-r--r--tvapi/libtv/tvutils/CMsgQueue.cpp31
-rw-r--r--tvapi/libtv/tvutils/CMsgQueue.h3
-rw-r--r--tvapi/libtv/tvutils/CSerialCommunication.h96
-rw-r--r--tvapi/libtv/tvutils/CSerialPort.cpp18
-rw-r--r--tvapi/libtv/tvutils/CSqlite.cpp8
-rw-r--r--tvapi/libtv/tvutils/CSqlite.h12
-rw-r--r--tvapi/libtv/tvutils/CThread.cpp2
-rw-r--r--tvapi/libtv/tvutils/CTvInput.cpp25
-rw-r--r--tvapi/libtv/tvutils/CTvInput.h4
-rw-r--r--tvapi/libtv/tvutils/serial_base.h34
-rw-r--r--tvapi/libtv/tvutils/serial_operate.cpp66
-rw-r--r--tvapi/libtv/tvutils/serial_operate.h70
-rw-r--r--tvapi/libtv/tvutils/tvutils.cpp3931
-rw-r--r--tvapi/libtv/tvutils/tvutils.h222
-rw-r--r--tvapi/libtv/tvutils/zepoll.cpp2
-rw-r--r--tvapi/libtv/version/version.cpp188
-rw-r--r--tvapi/libtv/version/version.h22
-rw-r--r--tvapi/libtv/vpp/CPQdb.cpp3509
-rw-r--r--tvapi/libtv/vpp/CPQdb.h340
-rw-r--r--tvapi/libtv/vpp/CVpp.cpp5602
-rw-r--r--tvapi/libtv/vpp/CVpp.h230
-rw-r--r--tvapi/tvtests/Android.mk98
-rw-r--r--tvapi/tvtests/android_tvtest.cpp2
-rw-r--r--tvapi/tvtests/comm_test.cpp4
-rw-r--r--tvapi/tvtests/ssm_test.cpp420
-rw-r--r--tvapi/tvtests/tvconfig_test.cpp854
151 files changed, 45277 insertions, 47437 deletions
diff --git a/tvapi/libtv/tv/AutoBackLight.cpp b/tvapi/libtv/tv/AutoBackLight.cpp
index d00f931..c87635a 100644
--- a/tvapi/libtv/tv/AutoBackLight.cpp
+++ b/tvapi/libtv/tv/AutoBackLight.cpp
@@ -1,213 +1,212 @@
-#include "AutoBackLight.h"
-#include "../tvsetting/CTvSetting.h"
-#include "../tvconfig/tvconfig.h"
-#include "../tvutils/tvutils.h"
-#include <stdio.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/ioctl.h>
-#include <fcntl.h>
-#include <string.h>
-#include <errno.h>
-#include <dlfcn.h>
-#include <linux/fb.h>
-#include <stdlib.h>
-#include <cutils/properties.h>
-
-#ifdef LOG_TAG
-#undef LOG_TAG
-#define LOG_TAG "AutoBackLight"
-#endif
-
-AutoBackLight::AutoBackLight( CVpp *mVpp, CTvin *pTvin )
-{
- mAutoBacklightSource = SOURCE_TYPE_TV;
- myVpp = mVpp;
- myTvin = pTvin;
- mCur_source_default_backlight = 100;
- mCur_sig_state == SIG_STATE_NOSIG;
- mAutoBacklight_OnOff_Flag = false;
- mCurrent_backlight = 100;
- mCur_dest_backlight = 100;
-}
-
-AutoBackLight::~AutoBackLight()
-{
- mAutoBacklight_OnOff_Flag = false;
-}
-
-bool AutoBackLight::isAutoBacklightOn()
-{
- return mAutoBacklight_OnOff_Flag;
-}
-
-void AutoBackLight::updateSigState(int state)
-{
- mCur_sig_state = state;
- LOGD("updateSigState = %d", mCur_sig_state);
-}
-
-void AutoBackLight::startAutoBacklight( tv_source_input_type_t source_type )
-{
- mAutoBacklightSource = source_type;
- mCur_source_default_backlight = myVpp->Tv_GetBacklight(source_type);
- mCurrent_backlight = mCur_source_default_backlight;
- myVpp->Tv_SetBacklight(mCur_source_default_backlight, source_type, 1);
-
- /*
- mDefault_auto_bl_value = def_source_bl_value;
- dynamicGamma = mDefault_auto_bl_value * mCur_source_default_backlight / 100;
- // this if should not happen
- if (dynamicGamma > mCur_source_default_backlight) {
- dynamicGamma = mCur_source_default_backlight;
- }
- */
-
- if (!mAutoBacklight_OnOff_Flag) {
- mAutoBacklight_OnOff_Flag = true;
- this->run();
- }
-}
-
-void AutoBackLight::stopAutoBacklight()
-{
- if (mAutoBacklight_OnOff_Flag) {
- mAutoBacklight_OnOff_Flag = false;
- myVpp->Tv_SetBacklight(mCur_source_default_backlight, mAutoBacklightSource, 1);
- }
-}
-
-/**
- * @ description: tpv project
- * @ return:value
- * value <= 20: mCur_dest_backlight is 14
- * 20 < value <= 160: mCur_dest_backlight is 57
- *160 < value: mCur_dest_backlight is 100
- */
-void AutoBackLight::adjustDstBacklight()
-{
- if (mCur_sig_state == SIG_STATE_STABLE) {
- //the node is used to adjust current ts is static or dynamtic frame
- char temp_str = 0;
- int fd = open("/sys/module/di/parameters/frame_dynamic", O_RDWR);
- if (fd <= 0) {
- LOGE("open /sys/module/di/parameters/frame_dynamic ERROR!!\n");
- return;
- }
-
- if (read(fd, &temp_str, 1) > 0) {
-
- if (temp_str == 'N') {
- mCurrent_backlight = mCur_dest_backlight = mCur_source_default_backlight;
- myVpp->Tv_SetBacklight(mCurrent_backlight, mAutoBacklightSource, 0);
- } else if (temp_str == 'Y') {
- int pwm = HistogramGet_AVE();
- if (pwm <= 20) {
- mCur_dest_backlight = 14;
- } else if (pwm > 20 && pwm <= 160) {
- mCur_dest_backlight = 57;
- } else {
- mCur_dest_backlight = 100;
- }
- //LOGD("pwm = %d, mCur_dest_backlight = %d", pwm, mCur_dest_backlight);
- }
- }
- close(fd);
- } else {
- mCurrent_backlight = mCur_dest_backlight = mCur_source_default_backlight;
- myVpp->Tv_SetBacklight(mCurrent_backlight, mAutoBacklightSource, 0);
- }
-
- /*
- if (pwm > 0)
- pwm_max = pwm;
- else
- pwm_min = pwm;
- pwm = 255 - pwm;
- int average = (pwm_min + pwm_max) / 2;
- dynamicGammaOffset = (pwm - average) / 10;
- dynamicGammaOffset = dynamicGammaOffset * mDefault_auto_bl_value / 100;
-
- //the node is used to adjust current ts is static or dynamtic frame
- char temp_str = 0;
- int fd = open("/sys/module/di/parameters/frame_dynamic", O_RDWR);
- if (fd <= 0) {
- LOGE("open /sys/module/di/parameters/frame_dynamic ERROR!!\n");
- return;
- }
-
- if (read(fd, &temp_str, 1) > 0) {
- if (temp_str== 'N') {
- mCur_dest_backlight = mCur_source_default_backlight;
- }
- else if (temp_str == 'Y') {
- mCur_dest_backlight = dynamicGamma + dynamicGammaOffset;
-
- if (mCur_dest_backlight > mCur_source_default_backlight) {
- mCur_dest_backlight = mCur_source_default_backlight;
- }
- else if (mCur_dest_backlight < 0) {
- mCur_dest_backlight = 0;
- }
- }
- }
- close(fd);
- */
-}
-
-void AutoBackLight::adjustBacklight()
-{
- if (mCurrent_backlight == mCur_dest_backlight) {
- return;
- } else if ((mCurrent_backlight - mCur_dest_backlight) > -2 && (mCurrent_backlight - mCur_dest_backlight) < 2) {
- mCurrent_backlight = mCur_dest_backlight;
- myVpp->Tv_SetBacklight(mCurrent_backlight, mAutoBacklightSource, 0);
- } else if (mCurrent_backlight < mCur_dest_backlight) {
- mCurrent_backlight = mCurrent_backlight + 2;
- myVpp->Tv_SetBacklight(mCurrent_backlight, mAutoBacklightSource, 0);
- } else if (mCurrent_backlight > mCur_dest_backlight) {
- mCurrent_backlight = mCurrent_backlight - 2;
- myVpp->Tv_SetBacklight(mCurrent_backlight, mAutoBacklightSource, 0);
- }
-
- //LOGD("mCurrent_backlight = %d", mCurrent_backlight);
-}
-
-/**
- * @ description: get current picture's average brightness
- * @ return: 0~255,0 is darkest,255 is brightest
- */
-int AutoBackLight::HistogramGet_AVE()
-{
- int hist_ave = 0;
- tvin_parm_t vdinParam;
- if (0 == myTvin->VDIN_GetVdinParam(&vdinParam)) {
- if(vdinParam.pixel_sum != 0) {
- hist_ave = vdinParam.luma_sum / vdinParam.pixel_sum;
- LOGD("[hist_ave][%d].", hist_ave);
- return hist_ave;
- }
- LOGE("vdinParam.pixel_sum is zero, so the value is infinity\n");
- return -1;
- }
- LOGE("VDIN_GetVdinParam get data error!!!\n");
- return -1;
-}
-
-bool AutoBackLight::threadLoop()
-{
- int sleeptime = 50;//ms
- int adjustBacklightCount = 0;
- while ( mAutoBacklight_OnOff_Flag ) {
- usleep ( sleeptime * 1000 );
- adjustBacklightCount++;
- if (adjustBacklightCount == 24) {
- adjustBacklightCount = 0;
- adjustDstBacklight();
- }
- adjustBacklight();
- }
-
- return false;//return true, run again, return false,not run.
-}
+#include "AutoBackLight.h"
+#include "../tvsetting/CTvSetting.h"
+#include "../tvconfig/tvconfig.h"
+#include "../tvutils/tvutils.h"
+#include <stdio.h>
+#include <unistd.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <sys/ioctl.h>
+#include <fcntl.h>
+#include <string.h>
+#include <errno.h>
+#include <dlfcn.h>
+#include <linux/fb.h>
+#include <stdlib.h>
+#include <cutils/properties.h>
+
+#ifdef LOG_TAG
+#undef LOG_TAG
+#define LOG_TAG "AutoBackLight"
+#endif
+
+AutoBackLight::AutoBackLight( CVpp *mVpp, CTvin *pTvin )
+{
+ mAutoBacklightSource = SOURCE_TYPE_TV;
+ myVpp = mVpp;
+ myTvin = pTvin;
+ mCur_source_default_backlight = 100;
+ mCur_sig_state == SIG_STATE_NOSIG;
+ mAutoBacklight_OnOff_Flag = false;
+ mCurrent_backlight = 100;
+ mCur_dest_backlight = 100;
+}
+
+AutoBackLight::~AutoBackLight()
+{
+ mAutoBacklight_OnOff_Flag = false;
+}
+
+bool AutoBackLight::isAutoBacklightOn()
+{
+ return mAutoBacklight_OnOff_Flag;
+}
+
+void AutoBackLight::updateSigState(int state)
+{
+ mCur_sig_state = state;
+ LOGD("updateSigState = %d", mCur_sig_state);
+}
+
+void AutoBackLight::startAutoBacklight( tv_source_input_type_t source_type )
+{
+ mAutoBacklightSource = source_type;
+ mCur_source_default_backlight = myVpp->GetBacklight(source_type);
+ mCurrent_backlight = mCur_source_default_backlight;
+ myVpp->SetBacklight(mCur_source_default_backlight, source_type, 1);
+
+ /*
+ mDefault_auto_bl_value = def_source_bl_value;
+ dynamicGamma = mDefault_auto_bl_value * mCur_source_default_backlight / 100;
+ // this if should not happen
+ if (dynamicGamma > mCur_source_default_backlight) {
+ dynamicGamma = mCur_source_default_backlight;
+ }
+ */
+
+ if (!mAutoBacklight_OnOff_Flag) {
+ mAutoBacklight_OnOff_Flag = true;
+ this->run();
+ }
+}
+
+void AutoBackLight::stopAutoBacklight()
+{
+ if (mAutoBacklight_OnOff_Flag) {
+ mAutoBacklight_OnOff_Flag = false;
+ myVpp->SetBacklight(mCur_source_default_backlight, mAutoBacklightSource, 1);
+ }
+}
+
+/**
+ * @ description: tpv project
+ * @ return:value
+ * value <= 20: mCur_dest_backlight is 14
+ * 20 < value <= 160: mCur_dest_backlight is 57
+ *160 < value: mCur_dest_backlight is 100
+ */
+void AutoBackLight::adjustDstBacklight()
+{
+ if (mCur_sig_state == SIG_STATE_STABLE) {
+ //the node is used to adjust current ts is static or dynamtic frame
+ char temp_str = 0;
+ int fd = open("/sys/module/di/parameters/frame_dynamic", O_RDWR);
+ if (fd <= 0) {
+ LOGE("open /sys/module/di/parameters/frame_dynamic ERROR!!\n");
+ return;
+ }
+
+ if (read(fd, &temp_str, 1) > 0) {
+
+ if (temp_str == 'N') {
+ mCur_dest_backlight = mCur_source_default_backlight;
+ } else if (temp_str == 'Y') {
+ int pwm = HistogramGet_AVE();
+ if (pwm <= 20) {
+ mCur_dest_backlight = 14;
+ } else if (pwm > 20 && pwm <= 160) {
+ mCur_dest_backlight = 57;
+ } else {
+ mCur_dest_backlight = 100;
+ }
+ //LOGD("pwm = %d, mCur_dest_backlight = %d", pwm, mCur_dest_backlight);
+ }
+ }
+ close(fd);
+ } else {
+ mCurrent_backlight = mCur_dest_backlight = mCur_source_default_backlight;
+ myVpp->SetBacklight(mCurrent_backlight, mAutoBacklightSource, 0);
+ }
+
+ /*
+ if (pwm > 0)
+ pwm_max = pwm;
+ else
+ pwm_min = pwm;
+ pwm = 255 - pwm;
+ int average = (pwm_min + pwm_max) / 2;
+ dynamicGammaOffset = (pwm - average) / 10;
+ dynamicGammaOffset = dynamicGammaOffset * mDefault_auto_bl_value / 100;
+
+ //the node is used to adjust current ts is static or dynamtic frame
+ char temp_str = 0;
+ int fd = open("/sys/module/di/parameters/frame_dynamic", O_RDWR);
+ if (fd <= 0) {
+ LOGE("open /sys/module/di/parameters/frame_dynamic ERROR!!\n");
+ return;
+ }
+
+ if (read(fd, &temp_str, 1) > 0) {
+ if (temp_str== 'N') {
+ mCur_dest_backlight = mCur_source_default_backlight;
+ }
+ else if (temp_str == 'Y') {
+ mCur_dest_backlight = dynamicGamma + dynamicGammaOffset;
+
+ if (mCur_dest_backlight > mCur_source_default_backlight) {
+ mCur_dest_backlight = mCur_source_default_backlight;
+ }
+ else if (mCur_dest_backlight < 0) {
+ mCur_dest_backlight = 0;
+ }
+ }
+ }
+ close(fd);
+ */
+}
+
+void AutoBackLight::adjustBacklight()
+{
+ if (mCurrent_backlight == mCur_dest_backlight) {
+ return;
+ } else if ((mCurrent_backlight - mCur_dest_backlight) > -2 && (mCurrent_backlight - mCur_dest_backlight) < 2) {
+ mCurrent_backlight = mCur_dest_backlight;
+ myVpp->SetBacklight(mCurrent_backlight, mAutoBacklightSource, 0);
+ } else if (mCurrent_backlight < mCur_dest_backlight) {
+ mCurrent_backlight = mCurrent_backlight + 2;
+ myVpp->SetBacklight(mCurrent_backlight, mAutoBacklightSource, 0);
+ } else if (mCurrent_backlight > mCur_dest_backlight) {
+ mCurrent_backlight = mCurrent_backlight - 2;
+ myVpp->SetBacklight(mCurrent_backlight, mAutoBacklightSource, 0);
+ }
+
+ //LOGD("mCurrent_backlight = %d", mCurrent_backlight);
+}
+
+/**
+ * @ description: get current picture's average brightness
+ * @ return: 0~255,0 is darkest,255 is brightest
+ */
+int AutoBackLight::HistogramGet_AVE()
+{
+ int hist_ave = 0;
+ tvin_parm_t vdinParam;
+ if (0 == myTvin->VDIN_GetVdinParam(&vdinParam)) {
+ if (vdinParam.pixel_sum != 0) {
+ hist_ave = vdinParam.luma_sum / vdinParam.pixel_sum;
+ LOGD("[hist_ave][%d].", hist_ave);
+ return hist_ave;
+ }
+ LOGE("vdinParam.pixel_sum is zero, so the value is infinity\n");
+ return -1;
+ }
+ LOGE("VDIN_GetVdinParam get data error!!!\n");
+ return -1;
+}
+
+bool AutoBackLight::threadLoop()
+{
+ int sleeptime = 50;//ms
+ int adjustBacklightCount = 0;
+ while ( mAutoBacklight_OnOff_Flag ) {
+ usleep ( sleeptime * 1000 );
+ adjustBacklightCount++;
+ if (adjustBacklightCount == 24) {
+ adjustBacklightCount = 0;
+ adjustDstBacklight();
+ }
+ adjustBacklight();
+ }
+
+ return false;//return true, run again, return false,not run.
+}