130 lines
3.9 KiB
C++
130 lines
3.9 KiB
C++
/*
|
|
* Copyright (c) 2019 Amlogic, Inc. All rights reserved.
|
|
*
|
|
* This source code is subject to the terms and conditions defined in the
|
|
* file 'LICENSE' which is part of this source code package.
|
|
*
|
|
* Description:
|
|
*/
|
|
#include "TvCommon.h"
|
|
#include "CTvin.h"
|
|
#include "CTvDevicesPollDetect.h"
|
|
#include "CTvEvent.h"
|
|
#include "CHDMIRxManager.h"
|
|
#include "CAmVideo.h"
|
|
#include "CMsgQueue.h"
|
|
#include "CTvPanel.h"
|
|
#include "CTvDisplayadapter.h"
|
|
#include "CTvWayland.h"
|
|
|
|
#ifdef HAVE_AUDIO
|
|
#include "CTvAudio.h"
|
|
#endif
|
|
|
|
#include "tvapi.h"
|
|
|
|
#define CONFIG_FILE_PATH_DEF "/vendor/etc/tvconfig/tvconfig.conf"
|
|
|
|
#define DOLBY_VISION_TV_KO_PATH "/vendor/lib/modules/dovi_tv.ko"
|
|
#define DOLBY_VISION_STB_KO_PATH "/vendor/lib/modules/dovi.ko"
|
|
#define DOLBY_VISION_ENABLE_PATH "/sys/module/amdolby_vision/parameters/dolby_vision_enable"
|
|
|
|
#define VIDEO_SYNC_ENABLE "/sys/class/tsync/enable"
|
|
#define VIDEO_SYNC_MODE "/sys/class/tsync/mode"
|
|
//0 means do AV sync, 1 means don't do AV sync,just free run.
|
|
#define VIDEO_FREERUN_MODE "/sys/class/video/freerun_mode"
|
|
#define DLG_FUNC_PATH "/sys/class/display/cap"
|
|
|
|
class CTv : public CTvDevicesPollDetect::ISourceConnectObserver {
|
|
public:
|
|
class TvIObserver {
|
|
public:
|
|
TvIObserver() {};
|
|
virtual ~TvIObserver() {};
|
|
virtual void onTvEvent (CTvEvent &event) = 0;
|
|
};
|
|
CTv();
|
|
~CTv();
|
|
int setTvObserver (TvIObserver *ob);
|
|
public: // apis for tv client
|
|
DECLARE_TVAPI_INTEFACES()
|
|
public: // unexported apis
|
|
int SetCurrenSourceInfo(tvin_info_t sig_info);
|
|
tvin_info_t GetCurrentSourceInfo(void);
|
|
bool GetDolbyVisionSupportStatus(void);
|
|
int LoadEdidData(int isNeedBlackScreen, int isDolbyVisionEnable);
|
|
int LoadEdidDataWithPort(int isNeedBlackScreen, int isDolbyVisionEnable);
|
|
bool needSnowEffect();
|
|
int SetSnowShowEnable(bool enable);
|
|
int GetFrontendInfo(tvin_frontend_info_t *frontendInfo);
|
|
int GetPanelSize();
|
|
bool IsSupportPIP();
|
|
int SetCurrentPipSourceInfo(tvin_info_t sig_info);
|
|
|
|
public:
|
|
virtual void onSigDvAllmChange();
|
|
virtual void onSigVrrChange();
|
|
virtual void onSourceConnect(int source, int connect_status);
|
|
virtual void onVdinSignalChange();
|
|
virtual void onVdin2SignalChange();
|
|
|
|
private:
|
|
void onSigStatusChange(void);
|
|
void onPipSigStatusChange(void);
|
|
void onSigToStable();
|
|
void onSigToUnstable();
|
|
void onSigToUnSupport();
|
|
void onSigToNoSig();
|
|
int sendTvEvent(CTvEvent &event);
|
|
void sendQmsEvent(void);
|
|
void isVideoFrameAvailable(unsigned int u32NewFrameCount);
|
|
#ifdef HAVE_AUDIO
|
|
int mapSourcetoAudiotupe(tv_source_input_t dest_source);
|
|
#endif
|
|
void muteVideoOnHDMISource();
|
|
void setDisplayCrop(int source);
|
|
int controlScreenColor(int status);
|
|
volatile int mLastScreenMode;
|
|
|
|
CTvin *mpTvin;
|
|
CAmVideo *mpAmVideo;
|
|
CHDMIRxManager *mpHDMIRxManager;
|
|
CTvDisplayadapter *mpTvMainDisplayadapter;
|
|
CTvDisplayadapter *mpTvSubDisplayadapter;
|
|
tvin_info_t mCurrentSignalInfo;
|
|
tv_source_input_t mCurrentSource = SOURCE_INVALID;
|
|
tv_source_input_type_t mCurrentSourceType = SOURCE_TYPE_MPEG;
|
|
CTvDevicesPollDetect mTvDevicesPollDetect;
|
|
CTvWayland *mpTvWayland;
|
|
TvIObserver *mpObserver;
|
|
vdin_work_mode_t mVdinWorkMode = VDIN_WORK_MODE_VFM;
|
|
int mPanelSize = 0;
|
|
int mBoostOn = 0;
|
|
int mDolbyVisionEnableState = 0;
|
|
bool mDlgVisionEnableState = false;
|
|
bool mATVDisplaySnow;
|
|
bool mInitEdid =false;
|
|
bool AvAudioMode = false;
|
|
//PIP
|
|
CTvin *mpPipTvin = nullptr;
|
|
tvin_info_t mCurrentPipSignalInfo;
|
|
tv_source_input_t mCurrentPipSource = SOURCE_INVALID;
|
|
#ifndef USE_AMVIDEO
|
|
int meson_fd = -1;
|
|
#endif
|
|
|
|
protected:
|
|
class CTvMsgQueue: public CMsgQueueThread {
|
|
public:
|
|
static const int TV_MSG_ENABLE_VIDEO_LATER = 9;
|
|
CTvMsgQueue(CTv *tv);
|
|
~CTvMsgQueue();
|
|
private:
|
|
virtual void handleMessage ( CMessage &msg );
|
|
CTv *mpTv;
|
|
};
|
|
|
|
CTvMsgQueue *mTvMsgQueue;
|
|
|
|
};
|