From b8c1fa5cc1b48ec29a98c61b50401ee3dc4070ca Mon Sep 17 00:00:00 2001 From: focus Date: Tue, 7 Dec 2010 10:00:52 +0000 Subject: [PATCH] * reworked CA menu code * added support for internal cardreaders for future conax support * added inactivity shutdown timer for EuP WARNING: new libcoolstream and libOpenThreads needed. git-svn-id: file:///home/bas/coolstream_public_svn/THIRDPARTY/applications/neutrino-experimental@925 e54a6e83-5905-42d5-8d5c-058d10e6a962 --- data/locale/deutsch.locale | 18 +- data/locale/english.locale | 34 ++- lib/libcoolstream/audio_cs.h | 27 ++- lib/libcoolstream/ca_cs.h | 119 ++++++++++ lib/libcoolstream/cs_api.h | 16 ++ lib/libcoolstream/cs_types.h | 15 +- lib/libcoolstream/dmx_cs.h | 22 +- lib/libcoolstream/dvb-ci.h | 60 ----- lib/libcoolstream/mmi.h | 23 ++ lib/libcoolstream/playback_cs.h | 94 ++++---- lib/libcoolstream/pwrmngr.h | 17 +- lib/libcoolstream/record_cs.h | 41 ++-- lib/libcoolstream/video_cs.h | 226 +++++++++--------- src/Makefile.am | 1 + src/driver/rcinput.cpp | 3 + src/driver/shutdown_count.cpp | 28 ++- src/driver/shutdown_count.h | 6 +- src/gui/cam_menu.cpp | 405 +++++++++++++++++++------------- src/gui/cam_menu.h | 10 +- src/gui/sleeptimer.cpp | 48 ++-- src/gui/user_menue_setup.cpp | 2 +- src/gui/videosettings.cpp | 19 +- src/gui/widget/hintbox.cpp | 26 +- src/gui/widget/hintbox.h | 6 +- src/gui/widget/menue.cpp | 5 + src/gui/widget/menue.h | 1 + src/gui/widget/messagebox.cpp | 1 - src/neutrino.cpp | 32 ++- src/neutrinoMessages.h | 9 +- src/neutrino_menue.cpp | 14 +- src/system/locals.h | 30 ++- src/system/locals_intern.h | 30 ++- src/system/settings.h | 1 + src/zapit/src/pmt.cpp | 8 +- src/zapit/src/zapit.cpp | 21 +- 35 files changed, 882 insertions(+), 536 deletions(-) create mode 100644 lib/libcoolstream/ca_cs.h delete mode 100644 lib/libcoolstream/dvb-ci.h create mode 100644 lib/libcoolstream/mmi.h diff --git a/data/locale/deutsch.locale b/data/locale/deutsch.locale index eaf26f35c..a00242a0c 100644 --- a/data/locale/deutsch.locale +++ b/data/locale/deutsch.locale @@ -99,15 +99,15 @@ bouqueteditor.switch Kanal aufnehmen/entfernen bouqueteditor.switchmode TV/Radio bouquetlist.head Bouquets cablesetup.provider Kabelanbieter -cam.empty Kein CAM im Slot -cam.init_ok CAM-Init beendet -> -cam.inserted CAM im Slot -cam.removed CAM entfernt -> Slot -cam.settings CI-Module -cam.timeout CAM antwortet nicht -cam.reset Reset -cam.reset_standby Reset nach Standby -cam.waiting Warte auf CAM-Antwort +ci.empty Kein CAM im Slot +ci.init_ok CAM-Init beendet -> +ci.inserted CAM im Slot +ci.removed CAM entfernt -> Slot +ci.settings CI-Module +ci.timeout CAM antwortet nicht +ci.reset Reset +ci.reset_standby Reset nach Standby +ci.waiting Warte auf CAM-Antwort channellist.current_tp Aktueller Transponder channellist.edit Bearbeiten channellist.epgtext_align_left links diff --git a/data/locale/english.locale b/data/locale/english.locale index b50cb4f08..3f9514b09 100644 --- a/data/locale/english.locale +++ b/data/locale/english.locale @@ -546,11 +546,12 @@ miscsettings.noaviawatchdog enable AVIA watchdog miscsettings.noenxwatchdog enable eNX watchdog miscsettings.pmtupdate enable pmt update miscsettings.show_infomenu -miscsettings.shutdown_count switch off after +miscsettings.shutdown_count In stabdby, switch off after miscsettings.shutdown_count_hint1 time (in minutes) to switch from standby miscsettings.shutdown_count_hint2 to deep standby (0 = off). miscsettings.shutdown_real Enable standby miscsettings.shutdown_real_rcdelay Delayed shutdown +miscsettings.sleeptimer Inactivity shutdown timer miscsettings.sptsmode use spts mode motorcontrol.head Satellite finder movieplayer.bookmark Bookmarks @@ -795,8 +796,10 @@ settings.menu_pos Menu position shutdowntimer.announce Box will shutdown in 1 min.\nCancel Shutdown ? sleeptimerbox.announce Sleeptimer in 1 min sleeptimerbox.hint1 Shutdown time in min. (000=off) -sleeptimerbox.hint2 The STB will shutdown after this time. +sleeptimerbox.hint2 The STB will shutdown after this time in standby. +sleeptimerbox.hint3 The STB will shutdown, if remote not used. sleeptimerbox.title Sleeptimer +sleeptimerbox.title2 Inactivity shutdown timer streamfeatures.head Features streaminfo.aratio Aspect Ratio streaminfo.aratio_unknown Aspect Ratio: unknown @@ -1402,15 +1405,24 @@ reset_channels Delete all channels reset_settings Reset settings to defaults reset_all Factory reset and reboot reset_confirm Are you sure ? -cam.settings CI Cam -cam.empty No CAM in slot -cam.inserted CAM inserted in slot -cam.removed CAM removed from slot -cam.init_ok CAM init complete -cam.waiting Waiting for CI answer -cam.timeout Timeout waiting CI menu ready -cam.reset Reset -cam.reset_standby Reset after standby +ci.settings Conditional access +ci.empty No CAM in slot +ci.inserted CAM inserted in slot +ci.removed CAM removed from slot +ci.init_ok CAM init complete +ci.init_failed CAM init failed +ci.waiting Waiting for CI answer +ci.timeout Timeout waiting CI menu ready +ci.reset Reset +ci.reset_standby Reset after standby +sc.empty No card in slot +sc.inserted Card inserted in slot +sc.removed Card removed from slot +sc.init_ok Card init complete +sc.init_failed Card init failed +sc.waiting Waing for card answer +sc.timeout Timeout waiting card menu +sc.reset Reset card subtitles.head Subtitles subtitles.stop Stop subtitles favorites.copy Copy bouquet to Favorites diff --git a/lib/libcoolstream/audio_cs.h b/lib/libcoolstream/audio_cs.h index c954b1a8b..34bd06340 100644 --- a/lib/libcoolstream/audio_cs.h +++ b/lib/libcoolstream/audio_cs.h @@ -1,7 +1,19 @@ -/* public header file */ +/*******************************************************************************/ +/* */ +/* libcoolstream/audio_cs.h */ +/* Public header file for audio API */ +/* */ +/* (C) 2008 CoolStream International */ +/* */ +/*******************************************************************************/ +#ifndef __AUDIO_CS_H_ +#define __AUDIO_CS_H_ -#ifndef _AUDIO_CS_H_ -#define _AUDIO_CS_H_ +#ifndef CS_AUDIO_PDATA +#define CS_AUDIO_PDATA void +#endif + +#include "cs_types.h" typedef enum { AUDIO_SYNC_WITH_PTS, @@ -25,12 +37,6 @@ typedef enum { AUDIO_FMT_ADVANCED = AUDIO_FMT_MLP } AUDIO_FORMAT; -#ifndef CS_AUDIO_PDATA -#define CS_AUDIO_PDATA void -#endif - -#include "cs_types.h" - class cAudio { private: CS_AUDIO_PDATA *privateData; @@ -110,5 +116,4 @@ public: void EnableAnalogOut(bool Enable); }; -#endif - +#endif //__AUDIO_CS_H_ diff --git a/lib/libcoolstream/ca_cs.h b/lib/libcoolstream/ca_cs.h new file mode 100644 index 000000000..fa9a1a705 --- /dev/null +++ b/lib/libcoolstream/ca_cs.h @@ -0,0 +1,119 @@ +/*******************************************************************************/ +/* */ +/* libcoolstream/ca.h */ +/* Public header for CA interface */ +/* */ +/* (C) 2010 CoolStream International Ltd. */ +/* */ +/*******************************************************************************/ +#ifndef __CA_CS_H_ +#define __CA_CS_H_ + +#include +#include "cs_types.h" + +enum CA_INIT_MASK { + CA_INIT_SC = 1, + CA_INIT_CI, + CA_INIT_BOTH +}; + +enum CA_SLOT_TYPE { + CA_SLOT_TYPE_SMARTCARD, + CA_SLOT_TYPE_CI, + CA_SLOT_TYPE_ALL, +}; + +enum CA_MESSAGE_FLAGS { + CA_MESSAGE_EMPTY = (1 << 0), + CA_MESSAGE_HAS_PARAM1_DATA = (1 << 1), // Free after use! + CA_MESSAGE_HAS_PARAM1_INT = (1 << 2), + CA_MESSAGE_HAS_PARAM1_PTR = (1 << 3), + CA_MESSAGE_HAS_PARAM2_INT = (1 << 4), + CA_MESSAGE_HAS_PARAM2_PTR = (1 << 5), + CA_MESSAGE_HAS_PARAM2_DATA = (1 << 6), + CA_MESSAGE_HAS_PARAM3_DATA = (1 << 7), // Free after use! + CA_MESSAGE_HAS_PARAM3_INT = (1 << 8), + CA_MESSAGE_HAS_PARAM3_PTR = (1 << 9), + CA_MESSAGE_HAS_PARAM4_INT = (1 << 10), + CA_MESSAGE_HAS_PARAM4_PTR = (1 << 11), + CA_MESSAGE_HAS_PARAM4_DATA = (1 << 12), + CA_MESSAGE_HAS_PARAM_LONG = (1 << 13), +}; + +enum CA_MESSAGE_MSGID { + CA_MESSAGE_MSG_INSERTED, + CA_MESSAGE_MSG_REMOVED, + CA_MESSAGE_MSG_INIT_OK, + CA_MESSAGE_MSG_INIT_FAILED, + CA_MESSAGE_MSG_MMI_MENU, + CA_MESSAGE_MSG_MMI_MENU_ENTER, + CA_MESSAGE_MSG_MMI_MENU_ANSWER, + CA_MESSAGE_MSG_MMI_LIST, + CA_MESSAGE_MSG_MMI_TEXT, + CA_MESSAGE_MSG_MMI_REQ_INPUT, + CA_MESSAGE_MSG_MMI_CLOSE, + CA_MESSAGE_MSG_INTERNAL, + CA_MESSAGE_MSG_PMT_ARRIVED, + CA_MESSAGE_MSG_CAT_ARRIVED, + CA_MESSAGE_MSG_ECM_ARRIVED, + CA_MESSAGE_MSG_EMM_ARRIVED, + CA_MESSAGE_MSG_CHANNEL_CHANGE, + CA_MESSAGE_MSG_EXIT, +}; + +typedef struct CA_MESSAGE { + u32 MsgId; + enum CA_SLOT_TYPE SlotType; + int Slot; + u32 Flags; + union { + u8 *Data[4]; + u32 Param[4]; + void *Ptr[4]; + u64 ParamLong; + } Msg; +} CA_MESSAGE; + +#define CA_MESSAGE_SIZE sizeof(CA_MESSAGE) +#define CA_MESSAGE_ENTRIES 256 +#define CA_MESSAGE_ENTRIES_CI 128 +#define CA_MESSAGE_ENTRIES_SC 64 + +#ifndef CS_CA_PDATA +#define CS_CA_PDATA void +#endif + +class cCA : public OpenThreads::Thread { +private: + static cCA *inst; + // + cCA(void); + // + CS_CA_PDATA *privateData; + enum CA_INIT_MASK initMask; + bool exit; + bool started; + bool guiReady; + virtual void run(void); +public: + u32 GetNumberCISlots(void); + u32 GetNumberSmartCardSlots(void); // + static cCA *GetInstance(void); + bool SendPMT(int Unit, unsigned char *Data, int Len); + bool SendMessage(const CA_MESSAGE *Msg); + void SetInitMask(enum CA_INIT_MASK InitMask); + bool Start(void); + void Stop(void); + void Ready(bool Set); + void ModuleReset(enum CA_SLOT_TYPE, u32 Slot); + bool ModulePresent(enum CA_SLOT_TYPE, u32 Slot); + void ModuleName(enum CA_SLOT_TYPE, u32 Slot, char *Name); + void MenuEnter(enum CA_SLOT_TYPE, u32 Slot); + void MenuAnswer(enum CA_SLOT_TYPE, u32 Slot, u32 choice); + void InputAnswer(enum CA_SLOT_TYPE, u32 Slot, u8 * Data, int Len); + void MenuClose(enum CA_SLOT_TYPE, u32 Slot); + virtual ~cCA(); +}; + +#endif //__CA_H_ diff --git a/lib/libcoolstream/cs_api.h b/lib/libcoolstream/cs_api.h index 8119e50be..11696daf3 100644 --- a/lib/libcoolstream/cs_api.h +++ b/lib/libcoolstream/cs_api.h @@ -1,6 +1,17 @@ +/*******************************************************************************/ +/* */ +/* libcoolstream/cs_api.h */ +/* Public header file for CoolStream Public API */ +/* */ +/* (C) 2010 CoolStream International */ +/* */ +/*******************************************************************************/ #ifndef __CS_API_H_ #define __CS_API_H_ +#include +#include + typedef void (*cs_messenger) (unsigned int msg, unsigned int data); enum CS_LOG_MODULE { @@ -14,10 +25,12 @@ enum CS_LOG_MODULE { CS_LOG_DENC, CS_LOG_PVR_RECORD, CS_LOG_PVR_PLAY, + CS_LOG_FILEPLAYER, CS_LOG_POWER_CTRL, CS_LOG_POWER_CLK, CS_LOG_MEM, CS_LOG_API, + CS_LOG_CA, }; // Initialization @@ -45,9 +58,12 @@ void cs_log_module_message(enum CS_LOG_MODULE module, const char *fmt, ...); // TS Routing unsigned int cs_get_ts_output(void); int cs_set_ts_output(unsigned int port); +int cs_set_ts_config(unsigned int port, tsrouter_hsdp_config_t *hsdp_config); +int cs_get_ts_config(unsigned int port, tsrouter_hsdp_config_t *hsdp_config); // Serial nr and revision accessors unsigned long long cs_get_serial(void); unsigned int cs_get_revision(void); + #endif //__CS_API_H_ diff --git a/lib/libcoolstream/cs_types.h b/lib/libcoolstream/cs_types.h index 21c4ba8fa..a0e17abd4 100644 --- a/lib/libcoolstream/cs_types.h +++ b/lib/libcoolstream/cs_types.h @@ -1,5 +1,5 @@ -#ifndef __CS_TYPES -#define __CS_TYPES +#ifndef __CS_TYPES_H_ +#define __CS_TYPES_H_ typedef enum { @@ -8,4 +8,13 @@ typedef enum AVSYNC_AUDIO_IS_MASTER } AVSYNC_TYPE; -#endif +typedef unsigned long long u64; +typedef unsigned int u32; +typedef unsigned short u16; +typedef unsigned char u8; +typedef signed long long s64; +typedef signed int s32; +typedef signed short s16; +typedef signed char s8; + +#endif // __CS_TYPES_H_ diff --git a/lib/libcoolstream/dmx_cs.h b/lib/libcoolstream/dmx_cs.h index 21d32e158..5d93adc3c 100644 --- a/lib/libcoolstream/dmx_cs.h +++ b/lib/libcoolstream/dmx_cs.h @@ -1,18 +1,18 @@ /*******************************************************************************/ /* */ -/* libcoolstream/cszapper/demux.h */ -/* ZAP interface for neutrino frontend */ +/* libcoolstream/dmx_cs.h */ +/* Public header for demux API */ /* */ /* (C) 2008 CoolStream International */ /* */ /*******************************************************************************/ -#ifndef __DEMUX_CS_H -#define __DEMUX_CS_H +#ifndef __DEMUX_CS_H_ +#define __DEMUX_CS_H_ #include #define DEMUX_POLL_TIMEOUT 0 // timeout in ms -#define MAX_FILTER_LENGTH 16 // maximum number of filters +#define MAX_FILTER_LENGTH 12 // maximum number of filters #ifndef DMX_FILTER_SIZE #define DMX_FILTER_SIZE MAX_FILTER_LENGTH #endif @@ -38,7 +38,6 @@ class cDemux { private: int timeout; unsigned short pid; - unsigned char tid[MAX_FILTER_LENGTH], mask[MAX_FILTER_LENGTH]; bool nb; // non block pthread_cond_t read_cond; pthread_mutex_t mutex; @@ -48,7 +47,7 @@ private: int unit; DMX_CHANNEL_TYPE type; - CS_DMX_PDATA * privateData; + CS_DMX_PDATA *privateData; public: cDemux(int num = 0); ~cDemux(); @@ -60,8 +59,10 @@ public: int Read(unsigned char *buff, int len, int Timeout = 0); void SignalRead(int len); unsigned short GetPID(void) { return pid; } - const unsigned char *GetFilterTID(void) { return tid; } - const unsigned char *GetFilterMask(void) { return mask; } + const unsigned char *GetFilterTID(u8 FilterIndex = 0); + const unsigned char *GetFilterMask(u8 FilterIndex = 0); + const unsigned int GetFilterLength(u8 FilterIndex = 0); + bool AddSectionFilter(unsigned short Pid, const unsigned char * const Filter, const unsigned char * const Mask, int len, const unsigned char * const nMask = NULL); bool sectionFilter(unsigned short Pid, const unsigned char * const Tid, const unsigned char * const Mask, int len, int Timeout = DEMUX_POLL_TIMEOUT, const unsigned char * const nMask = NULL); bool pesFilter(const unsigned short Pid); void SetSyncMode(AVSYNC_TYPE SyncMode); @@ -70,6 +71,7 @@ public: DMX_CHANNEL_TYPE getChannelType(void); void addPid(unsigned short Pid); void getSTC(int64_t *STC); + int getUnit(void); // }; -#endif //__DEMUX_H +#endif //__DMX_CS_H_ diff --git a/lib/libcoolstream/dvb-ci.h b/lib/libcoolstream/dvb-ci.h deleted file mode 100644 index d527272af..000000000 --- a/lib/libcoolstream/dvb-ci.h +++ /dev/null @@ -1,60 +0,0 @@ -#ifndef __DVBCI_H -#define __DVBCI_H - -#ifdef __cplusplus -extern "C" { -#endif -void CI_MenuAnswer(unsigned char bSlotIndex,unsigned char choice); -void CI_Answer(unsigned char bSlotIndex,unsigned char *pBuffer,unsigned char nLength); -void CI_CloseMMI(unsigned char bSlotIndex); -void CI_EnterMenu(unsigned char bSlotIndex); -#ifdef __cplusplus -} -#endif -#include - -#define MAX_MMI_ITEMS 20 -#define MAX_MMI_TEXT_LEN 255 -#define MAX_MMI_CHOICE_TEXT_LEN 255 - -typedef struct -{ - int slot; - int choice_nb; - char title[MAX_MMI_TEXT_LEN]; - char subtitle[MAX_MMI_TEXT_LEN]; - char bottom[MAX_MMI_TEXT_LEN]; - char choice_item[MAX_MMI_ITEMS][MAX_MMI_CHOICE_TEXT_LEN]; -} MMI_MENU_LIST_INFO; - -typedef struct -{ - int slot; - int blind; - int answerlen; - char enguiryText[MAX_MMI_TEXT_LEN]; -} MMI_ENGUIRY_INFO; - - -class cDvbCi { - private: - int slots; - bool init; - int pmtlen; - unsigned char * pmtbuf; - void SendPMT(); - pthread_mutex_t ciMutex; - cDvbCi(int Slots); - public: - bool Init(void); - bool SendPMT(unsigned char *data, int len); - bool SendDateTime(void); - // - ~cDvbCi(); - static cDvbCi * getInstance(); - bool CamPresent(int slot); - bool GetName(int slot, char * name); - bool Reset(int slot); -}; - -#endif //__DVBCI_H diff --git a/lib/libcoolstream/mmi.h b/lib/libcoolstream/mmi.h new file mode 100644 index 000000000..76ff99279 --- /dev/null +++ b/lib/libcoolstream/mmi.h @@ -0,0 +1,23 @@ +#ifndef __MMI_H_ +#define __MMI_H_ + +#define MAX_MMI_ITEMS 40 +#define MAX_MMI_TEXT_LEN 255 +#define MAX_MMI_CHOICE_TEXT_LEN 255 + +typedef struct { + int choice_nb; + char title[MAX_MMI_TEXT_LEN]; + char subtitle[MAX_MMI_TEXT_LEN]; + char bottom[MAX_MMI_TEXT_LEN]; + char choice_item[MAX_MMI_ITEMS][MAX_MMI_CHOICE_TEXT_LEN]; +} MMI_MENU_LIST_INFO; + +typedef struct { + int blind; + int answerlen; + char enguiryText[MAX_MMI_TEXT_LEN]; +} MMI_ENGUIRY_INFO; + +#endif // __MMI_H_ + diff --git a/lib/libcoolstream/playback_cs.h b/lib/libcoolstream/playback_cs.h index 4ca6ae1dc..bfd6e13e4 100644 --- a/lib/libcoolstream/playback_cs.h +++ b/lib/libcoolstream/playback_cs.h @@ -1,13 +1,13 @@ /*******************************************************************************/ /* */ -/* libcoolstream/cszapper/demux.h */ -/* ZAP interface for neutrino frontend */ +/* libcoolstream/playback_cs.h */ +/* Public header file for playback API */ /* */ /* (C) 2008 CoolStream International */ /* */ /*******************************************************************************/ -#ifndef __PLAYBACK_CS_H -#define __PLAYBACK_CS_H +#ifndef __PLAYBACK_CS_H_ +#define __PLAYBACK_CS_H_ #include @@ -20,49 +20,47 @@ typedef enum { PLAYMODE_FILE } playmode_t; -class cPlayback -{ - private: - int timeout; - pthread_cond_t read_cond; - pthread_mutex_t mutex; - CS_PLAYBACK_PDATA * privateData; - bool enabled; - bool paused; - bool playing; - int unit; - int nPlaybackFD; - int video_type; - int nPlaybackSpeed; - int mSpeed; - playmode_t playMode; - // - void Attach(void); - void Detach(void); - bool SetAVDemuxChannel(bool On, bool Video = true, bool Audio = true); - public: - void PlaybackNotify (int Event, void *pData, void *pTag); - void DMNotify(int Event, void *pTsBuf, void *Tag); - bool Open(playmode_t PlayMode); - void Close(void); - bool Start(char * filename, unsigned short vpid, int vtype, unsigned short apid, int audio_flag); - bool Stop(void); - bool SetAPid(unsigned short pid, int audio_flag); - bool SetSpeed(int speed); - bool GetSpeed(int &speed) const; - bool GetPosition(int &position, int &duration); - bool GetOffset(off64_t &offset); - bool SetPosition(int position, bool absolute = false); - bool IsPlaying(void) const { return playing; } - bool IsEnabled(void) const { return enabled; } - void * GetHandle(void); - void * GetDmHandle(void); - int GetCurrPlaybackSpeed(void) const { return nPlaybackSpeed; } - void FindAllPids(uint16_t *apids, unsigned short *ac3flags, uint16_t *numpida, std::string *language); - // - cPlayback(int num = 0); - ~cPlayback(); - +class cPlayback { +private: + int timeout; + pthread_cond_t read_cond; + pthread_mutex_t mutex; + CS_PLAYBACK_PDATA * privateData; + bool enabled; + bool paused; + bool playing; + int unit; + int nPlaybackFD; + int video_type; + int nPlaybackSpeed; + int mSpeed; + playmode_t playMode; + // + void Attach(void); + void Detach(void); + bool SetAVDemuxChannel(bool On, bool Video = true, bool Audio = true); +public: + void PlaybackNotify (int Event, void *pData, void *pTag); + void DMNotify(int Event, void *pTsBuf, void *Tag); + bool Open(playmode_t PlayMode); + void Close(void); + bool Start(char * filename, unsigned short vpid, int vtype, unsigned short apid, int audio_flag); + bool Stop(void); + bool SetAPid(unsigned short pid, int audio_flag); + bool SetSpeed(int speed); + bool GetSpeed(int &speed) const; + bool GetPosition(int &position, int &duration); + bool GetOffset(off64_t &offset); + bool SetPosition(int position, bool absolute = false); + bool IsPlaying(void) const { return playing; } + bool IsEnabled(void) const { return enabled; } + void * GetHandle(void); + void * GetDmHandle(void); + int GetCurrPlaybackSpeed(void) const { return nPlaybackSpeed; } + void FindAllPids(uint16_t *apids, unsigned short *ac3flags, uint16_t *numpida, std::string *language); + // + cPlayback(int num = 0); + ~cPlayback(); }; -#endif +#endif // __PLAYBACK_CS_H_ diff --git a/lib/libcoolstream/pwrmngr.h b/lib/libcoolstream/pwrmngr.h index 3adf7c73b..2ef61c752 100644 --- a/lib/libcoolstream/pwrmngr.h +++ b/lib/libcoolstream/pwrmngr.h @@ -1,5 +1,13 @@ -#ifndef __PWRMNGR_H__ -#define __PWRMNGR_H__ +/*******************************************************************************/ +/* */ +/* libcoolstream/pwrmngr.h */ +/* Private header of the Powermanager API */ +/* */ +/* (C) 2010 CoolStream International */ +/* */ +/*******************************************************************************/ +#ifndef __PWRMNGR_H_ +#define __PWRMNGR_H_ // -- cCpuFreqManager ---------------------------------------------------------- @@ -23,8 +31,7 @@ public: // -- cPowerManageger ---------------------------------------------------------- -typedef enum -{ +typedef enum { PWR_INIT = 1, PWR_FULL_ACTIVE, /* all devices/clocks up */ PWR_ACTIVE_STANDBY, @@ -38,7 +45,7 @@ private: bool opened; PWR_STATE powerState; // -// static void ApplicationCallback(void *hHandle, void *pUserData, signed long eEvent, void *pEventData, void *pTag) {} + static void ApplicationCallback(void *hHandle, void *pUserData, signed long eEvent, void *pEventData, void *pTag) {} bool SetState(PWR_STATE PowerState); public: bool Open(void); diff --git a/lib/libcoolstream/record_cs.h b/lib/libcoolstream/record_cs.h index 72b5c66f2..cf1110e73 100644 --- a/lib/libcoolstream/record_cs.h +++ b/lib/libcoolstream/record_cs.h @@ -1,13 +1,13 @@ /*******************************************************************************/ /* */ -/* libcoolstream/cszapper/demux.h */ -/* ZAP interface for neutrino frontend */ +/* libcoolstream/record_cs.h */ +/* Public header file for record API */ /* */ /* (C) 2008 CoolStream International */ /* */ /*******************************************************************************/ -#ifndef __RECORD_CS_H -#define __RECORD_CS_H +#ifndef __RECORD_CS_H_ +#define __RECORD_CS_H_ #include @@ -15,24 +15,23 @@ #define CS_RECORD_PDATA void #endif -class cRecord -{ - private: - CS_RECORD_PDATA * privateData; - bool enabled; - int num_apids; - int unit; - int nRecordFD; +class cRecord { +private: + CS_RECORD_PDATA * privateData; + bool enabled; + int num_apids; + int unit; + int nRecordFD; - public: - cRecord(int num = 0); - ~cRecord(); +public: + cRecord(int num = 0); + ~cRecord(); - bool Open(int numpids); - void Close(void); - bool Start(int fd, unsigned short vpid, unsigned short * apids, int numpids); - bool Stop(void); - void RecordNotify(int Event, void *pData); + bool Open(int numpids); + void Close(void); + bool Start(int fd, unsigned short vpid, unsigned short * apids, int numpids); + bool Stop(void); + void RecordNotify(int Event, void *pData); }; -#endif +#endif // __RECORD_CS_H_ diff --git a/lib/libcoolstream/video_cs.h b/lib/libcoolstream/video_cs.h index 186300733..1946710a3 100644 --- a/lib/libcoolstream/video_cs.h +++ b/lib/libcoolstream/video_cs.h @@ -1,11 +1,23 @@ -#ifndef _VIDEO_CS_H -#define _VIDEO_CS_H +/*******************************************************************************/ +/* */ +/* libcoolstream/video_cs.h */ +/* Public header file for video API */ +/* */ +/* (C) 2008 CoolStream International */ +/* */ +/*******************************************************************************/ +#ifndef __VIDEO_CS_H_ +#define __VIDEO_CS_H_ #include #include #include "cs_types.h" +#ifndef CS_VIDEO_PDATA +#define CS_VIDEO_PDATA void +#endif + typedef enum { ANALOG_SD_RGB_CINCH = 0x00, ANALOG_SD_YPRPB_CINCH, @@ -110,122 +122,114 @@ typedef enum VIDEO_CONTROL_MAX = VIDEO_CONTROL_SHARPNESS } VIDEO_CONTROL; -#ifndef CS_VIDEO_PDATA -#define CS_VIDEO_PDATA void -#endif +class cVideo { +private: + CS_VIDEO_PDATA *privateData; + VIDEO_FORMAT StreamType; + VIDEO_DEFINITION VideoDefinition; + DISPLAY_AR DisplayAR; + VIDEO_PLAY_MODE playMode; + AVSYNC_TYPE syncMode; + DISPLAY_AR_MODE ARMode; + VIDEO_DB_DR eDbDr; + DISPLAY_AR PictureAR; + VIDEO_FRAME_RATE FrameRate; + VIDEO_HDMI_CEC_MODE hdmiCECMode; + bool Interlaced; + unsigned int uDRMDisplayDelay; + unsigned int uVideoPTSDelay; + int StcPts; + bool started; + unsigned int bStandby; + bool blank; + bool playing; + bool auto_format; + int uFormatIndex; + bool vbi_started; + bool receivedDRMDelay; + bool receivedVideoDelay; + int cfd; // control driver fd + analog_mode_t analog_mode_cinch; + analog_mode_t analog_mode_scart; + vfd_icon mode_icon; + // + int SelectAutoFormat(); + void ScalePic(); +public: + /* constructor & destructor */ + cVideo(int mode, void * hChannel, void * hBuffer); + ~cVideo(void); -class cVideo -{ - private: - CS_VIDEO_PDATA *privateData; - VIDEO_FORMAT StreamType; - VIDEO_DEFINITION VideoDefinition; - DISPLAY_AR DisplayAR; - VIDEO_PLAY_MODE playMode; - AVSYNC_TYPE syncMode; - DISPLAY_AR_MODE ARMode; - VIDEO_DB_DR eDbDr; - DISPLAY_AR PictureAR; - VIDEO_FRAME_RATE FrameRate; - VIDEO_HDMI_CEC_MODE hdmiCECMode; - bool Interlaced; + void * GetDRM(void); + void * GetTVEnc(); + void * GetTVEncSD(); + void * GetHandle(); - unsigned int uDRMDisplayDelay; - unsigned int uVideoPTSDelay; - int StcPts; - bool started; - unsigned int bStandby; - bool blank; - bool playing; - bool auto_format; - int uFormatIndex; - bool vbi_started; + void SetAudioHandle(void * handle); + /* aspect ratio */ + int getAspectRatio(void); + void getPictureInfo(int &width, int &height, int &rate); + int setAspectRatio(int aspect, int mode); - bool receivedDRMDelay; - bool receivedVideoDelay; - int cfd; // control driver fd - analog_mode_t analog_mode_cinch; - analog_mode_t analog_mode_scart; + /* cropping mode */ + int getCroppingMode(void); + int setCroppingMode(void); - vfd_icon mode_icon; - int SelectAutoFormat(); - void ScalePic(); - public: - /* constructor & destructor */ - cVideo(int mode, void * hChannel, void * hBuffer); - ~cVideo(void); + /* stream source */ + int getSource(void); + int setSource(void); + int GetStreamType(void) { return StreamType; }; - void * GetDRM(void); - void * GetTVEnc(); - void * GetTVEncSD(); - void * GetHandle(); + /* blank on freeze */ + int getBlank(void); + int setBlank(int enable); - void SetAudioHandle(void * handle); - /* aspect ratio */ - int getAspectRatio(void); - void getPictureInfo(int &width, int &height, int &rate); - int setAspectRatio(int aspect, int mode); + /* get play state */ + int getPlayState(void); + void SetDRMDelay(unsigned int delay) { uDRMDisplayDelay = delay;}; + void SetVideoDelay(unsigned int delay) { uVideoPTSDelay = delay;}; + /* Notification handlers */ + void HandleDRMMessage(int Event, void *pData); + void HandleVideoMessage(void * hHandle, int Event, void *pData); + void HandleEncoderMessage(void *hHandle, int Event, void *pData); + VIDEO_DEFINITION GetVideoDef(void) { return VideoDefinition; } - /* cropping mode */ - int getCroppingMode(void); - int setCroppingMode(void); + /* change video play state */ + int Prepare(void * PcrChannel, unsigned short PcrPid, unsigned short VideoPid, void * hChannel = NULL); + int Start(void * PcrChannel, unsigned short PcrPid, unsigned short VideoPid, void * hChannel = NULL); + int Stop(bool Blank = true); + bool Pause(void); + bool Resume(void); + int LipsyncAdjust(); + int64_t GetPTS(void); + int Flush(void); - /* stream source */ - int getSource(void); - int setSource(void); - int GetStreamType(void) { return StreamType; }; - - /* blank on freeze */ - int getBlank(void); - int setBlank(int enable); - - /* get play state */ - int getPlayState(void); - void SetDRMDelay(unsigned int delay) { uDRMDisplayDelay = delay;}; - void SetVideoDelay(unsigned int delay) { uVideoPTSDelay = delay;}; - /* Notification handlers */ - void HandleDRMMessage(int Event, void *pData); - void HandleVideoMessage(void * hHandle, int Event, void *pData); - void HandleEncoderMessage(void *hHandle, int Event, void *pData); - VIDEO_DEFINITION GetVideoDef(void) { return VideoDefinition; } - - /* change video play state */ - int Prepare(void * PcrChannel, unsigned short PcrPid, unsigned short VideoPid, void * hChannel = NULL); - int Start(void * PcrChannel, unsigned short PcrPid, unsigned short VideoPid, void * hChannel = NULL); - int Stop(bool blank = true); - bool Pause(void); - bool Resume(void); - int LipsyncAdjust(); - int64_t GetPTS(void); - - int Flush(void); - - /* set video_system */ - int SetVideoSystem(int video_system, bool remember = true); - int SetStreamType(VIDEO_FORMAT type); - void SetSyncMode(AVSYNC_TYPE mode); - bool SetCECMode(VIDEO_HDMI_CEC_MODE Mode); - void SetCECAutoView(bool OnOff); - void SetCECAutoStandby(bool OnOff); - void ShowPicture(const char * fname); - void StopPicture(); - void Standby(unsigned int bOn); - void Pig(int x, int y, int w, int h, int osd_w = 1064, int osd_h = 600); - void SetControl(int num, int val); - bool ReceivedDRMDelay(void) { return receivedDRMDelay; } - bool ReceivedVideoDelay(void) { return receivedVideoDelay; } - void SetReceivedDRMDelay(bool Received) { receivedDRMDelay = Received; } - void SetReceivedVideoDelay(bool Received) { receivedVideoDelay = Received; } - void SetFastBlank(bool onoff); - void SetTVAV(bool onoff); - void SetWideScreen(bool onoff); - void SetVideoMode(analog_mode_t mode); - void SetDBDR(int dbdr); - void SetAutoModes(int modes[VIDEO_STD_MAX]); - int OpenVBI(int num); - int CloseVBI(void); - int StartVBI(unsigned short pid); - int StopVBI(void); + /* set video_system */ + int SetVideoSystem(int video_system, bool remember = true); + int SetStreamType(VIDEO_FORMAT type); + void SetSyncMode(AVSYNC_TYPE mode); + bool SetCECMode(VIDEO_HDMI_CEC_MODE Mode); + void SetCECAutoView(bool OnOff); + void SetCECAutoStandby(bool OnOff); + void ShowPicture(const char * fname); + void StopPicture(); + void Standby(unsigned int bOn); + void Pig(int x, int y, int w, int h, int osd_w = 1064, int osd_h = 600); + void SetControl(int num, int val); + bool ReceivedDRMDelay(void) { return receivedDRMDelay; } + bool ReceivedVideoDelay(void) { return receivedVideoDelay; } + void SetReceivedDRMDelay(bool Received) { receivedDRMDelay = Received; } + void SetReceivedVideoDelay(bool Received) { receivedVideoDelay = Received; } + void SetFastBlank(bool onoff); + void SetTVAV(bool onoff); + void SetWideScreen(bool onoff); + void SetVideoMode(analog_mode_t mode); + void SetDBDR(int dbdr); + void SetAutoModes(int modes[VIDEO_STD_MAX]); + int OpenVBI(int num); + int CloseVBI(void); + int StartVBI(unsigned short pid); + int StopVBI(void); }; -#endif +#endif // __VIDEO_CS_H_ diff --git a/src/Makefile.am b/src/Makefile.am index 289f35957..4a76c9e7c 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -73,6 +73,7 @@ neutrino_LDADD = \ if BOXTYPE_COOL neutrino_LDADD += \ -lcoolstream \ + -lOpenThreads \ -lnxp endif diff --git a/src/driver/rcinput.cpp b/src/driver/rcinput.cpp index ebe23a612..028cfa072 100644 --- a/src/driver/rcinput.cpp +++ b/src/driver/rcinput.cpp @@ -57,6 +57,7 @@ #include #include +#include #include #include @@ -1143,6 +1144,8 @@ printf("[neutrino] CSectionsdClient::EVT_GOT_CN_EPG\n"); if(ret != sizeof(t_input_event)) continue; + + SHTDCNT::getInstance()->resetSleepTimer(); printf("key: %04x value %d, translate: %04x -%s-\n", ev.code, ev.value, translate(ev.code, i), getKeyName(translate(ev.code, i)).c_str()); uint32_t trkey = translate(ev.code, i); diff --git a/src/driver/shutdown_count.cpp b/src/driver/shutdown_count.cpp index c6fd2e398..39eacffbc 100644 --- a/src/driver/shutdown_count.cpp +++ b/src/driver/shutdown_count.cpp @@ -63,6 +63,8 @@ void* SHTDCNT::TimeThread(void *) void SHTDCNT::init() { + shutdown_cnt = atoi(g_settings.shutdown_count) * 60; + sleep_cnt = g_settings.shutdown_min*60; if (pthread_create (&thrTime, NULL, TimeThread, NULL) != 0 ) { perror("[SHTDCNT]: pthread_create(TimeThread)"); @@ -72,6 +74,7 @@ void SHTDCNT::init() void SHTDCNT::shutdown_counter() { + static bool sleeptimer_active = true; if (atoi(g_settings.shutdown_count) > 0) { if ((CNeutrinoApp::getInstance()->getMode() == NeutrinoMessages::mode_standby) && (!CNeutrinoApp::getInstance ()->recordingstatus)) @@ -79,13 +82,14 @@ void SHTDCNT::shutdown_counter() if (shutdown_cnt > 0 ) { shutdown_cnt = shutdown_cnt - 1; - printf("[SHTDCNT] shutdown counter: %d sec to shutdown\n", shutdown_cnt); + //printf("[SHTDCNT] shutdown counter: %d sec to shutdown\n", shutdown_cnt); } else { - // send shutdown message - printf("[SHTDCNT] shutdown counter send NeutrinoMessages::SHUTDOWN\n"); - CNeutrinoApp::getInstance()->handleMsg( NeutrinoMessages::SHUTDOWN, 0); + // send shutdown message + printf("[SHTDCNT] shutdown counter send NeutrinoMessages::SHUTDOWN\n"); + //CNeutrinoApp::getInstance()->handleMsg( NeutrinoMessages::SHUTDOWN, 0); + g_RCInput->postMsg(NeutrinoMessages::SHUTDOWN, 0); } } else @@ -94,4 +98,20 @@ void SHTDCNT::shutdown_counter() shutdown_cnt = atoi(g_settings.shutdown_count) * 60; } } + + if(g_settings.shutdown_min > 0) { + if(sleep_cnt > 0) { + sleeptimer_active = true; + sleep_cnt--; + } else if(sleeptimer_active && !CNeutrinoApp::getInstance ()->recordingstatus) { + sleeptimer_active = false; + printf("[SHTDCNT] sleep-timer send NeutrinoMessages::SLEEPTIMER\n"); + g_RCInput->postMsg(NeutrinoMessages::SLEEPTIMER, 1); + } + } +} + +void SHTDCNT::resetSleepTimer() +{ + sleep_cnt = g_settings.shutdown_min*60; } diff --git a/src/driver/shutdown_count.h b/src/driver/shutdown_count.h index 2bf7efee3..6b0692da6 100644 --- a/src/driver/shutdown_count.h +++ b/src/driver/shutdown_count.h @@ -33,9 +33,10 @@ class SHTDCNT { private: - pthread_t thrTime; + pthread_t thrTime; unsigned int shutdown_cnt; - CConfigFile configfile; + unsigned int sleep_cnt; + CConfigFile configfile; void shutdown_counter(); SHTDCNT(); @@ -48,6 +49,7 @@ class SHTDCNT static SHTDCNT* getInstance(); void init(); + void resetSleepTimer(); }; #endif diff --git a/src/gui/cam_menu.cpp b/src/gui/cam_menu.cpp index cda80058f..7692a1219 100644 --- a/src/gui/cam_menu.cpp +++ b/src/gui/cam_menu.cpp @@ -61,83 +61,117 @@ #include #include -#include #include void CCAMMenuHandler::init(void) { hintBox = NULL; - ci = cDvbCi::getInstance(); + ca = cCA::GetInstance(); } int CCAMMenuHandler::exec(CMenuTarget* parent, const std::string &actionkey) { -printf("CCAMMenuHandler::exec: actionkey %s\n", actionkey.c_str()); + std::string::size_type loc; + int slot; + + printf("CCAMMenuHandler::exec: actionkey %s\n", actionkey.c_str()); if (parent) parent->hide(); - if(actionkey == "cam1") { - return doMenu(0); - } else if(actionkey == "cam2") { - return doMenu(1); -#if 1 - } else if(actionkey == "reset1") { - if(ci->CamPresent(0)) - ci->Reset(0); - } else if(actionkey == "reset2") { - if(ci->CamPresent(1)) - ci->Reset(1); -#endif + if ((loc = actionkey.find("ca_ci_reset", 0)) != std::string::npos) { + slot = actionkey.at(11) - '0'; + + if(ca && ca->ModulePresent(CA_SLOT_TYPE_CI, slot)) + ca->ModuleReset(CA_SLOT_TYPE_CI, slot); + } else if ((loc = actionkey.find("ca_ci", 0)) != std::string::npos) { + slot = actionkey.at(5) - '0'; + printf("CCAMMenuHandler::exec: actionkey %s for slot %d\n", actionkey.c_str(), slot); + return doMenu(slot, CA_SLOT_TYPE_CI); + } else if ((loc = actionkey.find("ca_sc_reset", 0)) != std::string::npos) { + slot = actionkey.at(11) - '0'; + + if(ca && ca->ModulePresent(CA_SLOT_TYPE_SMARTCARD, slot)) + ca->ModuleReset(CA_SLOT_TYPE_SMARTCARD, slot); + } else if ((loc = actionkey.find("ca_sc", 0)) != std::string::npos) { + slot = actionkey.at(5) - '0'; + printf("CCAMMenuHandler::exec: actionkey %s for slot %d\n", actionkey.c_str(), slot); + return doMenu(slot, CA_SLOT_TYPE_SMARTCARD); } if(!parent) return 0; - return doMainMenu (); + return doMainMenu(); } -int CCAMMenuHandler::doMainMenu () +int CCAMMenuHandler::doMainMenu() { - int ret; - char name1[255], name2[255]; - //cDvbCiSlot *one, *two; + int ret, cnt; + char name1[255]; char str1[255]; - char str2[255]; - //one = ci->GetSlot(0); - //two = ci->GetSlot(1); - - CMenuWidget* cammenu = new CMenuWidget(LOCALE_CAM_SETTINGS, NEUTRINO_ICON_SETTINGS); + CMenuWidget* cammenu = new CMenuWidget(LOCALE_CI_SETTINGS, NEUTRINO_ICON_SETTINGS); cammenu->addItem( GenericMenuBack ); cammenu->addItem( GenericMenuSeparatorLine ); - cammenu->addItem( new CMenuOptionChooser(LOCALE_CAM_RESET_STANDBY, &g_settings.ci_standby_reset, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true)); + cammenu->addItem( new CMenuOptionChooser(LOCALE_CI_RESET_STANDBY, &g_settings.ci_standby_reset, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true)); cammenu->addItem( GenericMenuSeparatorLine ); CMenuWidget * tempMenu; - if(ci->CamPresent(0)) { - ci->GetName(0, name1); - printf("CCAMMenuHandler::doMenu cam1 name %s\n", name1); - cammenu->addItem(new CMenuForwarderNonLocalized(name1, true, NULL, this, "cam1", CRCInput::RC_1)); - cammenu->addItem(new CMenuForwarder(LOCALE_CAM_RESET, true, NULL, this, "reset1")); - } else { - snprintf(str1, sizeof(str1), "%s 1", g_Locale->getText(LOCALE_CAM_EMPTY)); - tempMenu = new CMenuWidget(str1, NEUTRINO_ICON_SETTINGS); - cammenu->addItem(new CMenuForwarderNonLocalized(str1, false, NULL, tempMenu)); - } - if(cs_get_revision() < 8){ - cammenu->addItem( GenericMenuSeparatorLine ); - if(ci->CamPresent(1)) { - ci->GetName(1, name2); - printf("CCAMMenuHandler::doMenu cam2 name %s\n", name2); - cammenu->addItem(new CMenuForwarderNonLocalized(name2, true, NULL, this, "cam2", CRCInput::RC_2)); - cammenu->addItem(new CMenuForwarder(LOCALE_CAM_RESET, true, NULL, this, "reset2")); + int CiSlots = ca->GetNumberCISlots(); + int i = 0; + + cnt = 0; + printf("CCAMMenuHandler::doMainMenu CI slots: %d\n", CiSlots); + while (i < CiSlots && i < 2) { + if (ca->ModulePresent(CA_SLOT_TYPE_CI, i)) { + ca->ModuleName(CA_SLOT_TYPE_CI, i, name1); + printf("CCAMMenuHandler::doMainMenu cam%d name %s\n", i, name1); + char tmp[32]; + snprintf(tmp, sizeof(tmp), "ca_ci%d", i); + + cammenu->addItem(new CMenuForwarderNonLocalized(name1, true, NULL, this, tmp, CRCInput::RC_1 + cnt++)); + snprintf(tmp, sizeof(tmp), "ca_ci_reset%d", i); + cammenu->addItem(new CMenuForwarder(LOCALE_CI_RESET, true, NULL, this, tmp)); } else { - snprintf(str2, sizeof(str2), "%s 2", g_Locale->getText(LOCALE_CAM_EMPTY)); - tempMenu = new CMenuWidget(str2, NEUTRINO_ICON_SETTINGS); - cammenu->addItem(new CMenuForwarderNonLocalized(str2, false, NULL, tempMenu)); + snprintf(str1, sizeof(str1), "%s %d", g_Locale->getText(LOCALE_CI_EMPTY), i); + tempMenu = new CMenuWidget(str1, NEUTRINO_ICON_SETTINGS); + cammenu->addItem(new CMenuForwarderNonLocalized(str1, false, NULL, tempMenu)); } + if (i < (CiSlots - 1)) + cammenu->addItem( GenericMenuSeparatorLine ); + i++; } + + i = 0; + int ScNum = ca->GetNumberSmartCardSlots(); + printf("CCAMMenuHandler::doMainMenu sc slots: %d\n", ScNum); + + if(ScNum && CiSlots) + cammenu->addItem( GenericMenuSeparatorLine ); + + while (i < ScNum && i < 2) { + if (ca->ModulePresent(CA_SLOT_TYPE_SMARTCARD, i)) { + ca->ModuleName(CA_SLOT_TYPE_SMARTCARD, i, name1); + printf("CCAMMenuHandler::doMainMenu cam%d name %s\n", i, name1); + char tmp[32]; + snprintf(tmp, sizeof(tmp), "ca_sc%d", i); + + cammenu->addItem(new CMenuForwarderNonLocalized(name1, true, NULL, this, tmp, CRCInput::RC_1 + cnt++)); +#if 0 // FIXME not implemented yet + snprintf(tmp, sizeof(tmp), "ca_sc_reset%d", i); + cammenu->addItem(new CMenuForwarder(LOCALE_SC_RESET, true, NULL, this, tmp)); +#endif + } else { + snprintf(str1, sizeof(str1), "%s %d", g_Locale->getText(LOCALE_SC_EMPTY), i); + tempMenu = new CMenuWidget(str1, NEUTRINO_ICON_SETTINGS); + cammenu->addItem(new CMenuForwarderNonLocalized(str1, false, NULL, tempMenu)); + } + if (i < (ScNum - 1)) + cammenu->addItem( GenericMenuSeparatorLine ); + i++; + } + ret = cammenu->exec(NULL, ""); delete cammenu; return ret; @@ -155,6 +189,26 @@ int CCAMMenuHandler::handleMsg (const neutrino_msg_t msg, neutrino_msg_data_t da return ret; } +void CCAMMenuHandler::showHintBox (const neutrino_locale_t Caption, const char * const Text, uint32_t timeout) +{ + hideHintBox(); + hintBox = new CHintBox(LOCALE_MESSAGEBOX_INFO, Text); + hintBox->paint(); + if(timeout > 0) { + sleep(timeout); + hideHintBox(); + } +} + +void CCAMMenuHandler::hideHintBox(void) +{ + if(hintBox != NULL) { + hintBox->hide(); + delete hintBox; + hintBox = NULL; + } +} + int CCAMMenuHandler::handleCamMsg (const neutrino_msg_t msg, neutrino_msg_data_t data, bool from_menu) { int ret = 0; @@ -163,78 +217,96 @@ int CCAMMenuHandler::handleCamMsg (const neutrino_msg_t msg, neutrino_msg_data_t int i; MMI_MENU_LIST_INFO Menu; MMI_ENGUIRY_INFO MmiEnquiry; - int curslot; - MMI_MENU_LIST_INFO * pMenu = &Menu; - MMI_ENGUIRY_INFO * pMmiEnquiry = &MmiEnquiry; + MMI_MENU_LIST_INFO *pMenu = &Menu; + MMI_ENGUIRY_INFO *pMmiEnquiry = &MmiEnquiry; + CA_MESSAGE Msg, *rMsg; -//printf("CCAMMenuHandler::handleCamMsg: msg 0x%x data 0x%x\n", msg, data); + if (msg != NeutrinoMessages::EVT_CA_MESSAGE) + return from_menu ? 1 : -1; - if(msg == NeutrinoMessages::EVT_CI_INSERTED) { - if(hintBox != NULL) { - hintBox->hide(); - delete hintBox; - } - snprintf(str, sizeof(str), "%s %d", g_Locale->getText(LOCACE_CAM_INSERTED), (int) data+1); - - printf("CCAMMenuHandler::handleMsg: %s\n", str); - hintBox = new CHintBox(LOCALE_MESSAGEBOX_INFO, str); - hintBox->paint(); - - sleep(CI_MSG_TIME); - hintBox->hide(); - delete hintBox; - hintBox = NULL; - - } else if (msg == NeutrinoMessages::EVT_CI_REMOVED) { - if(hintBox != NULL) { - hintBox->hide(); - delete hintBox; - } - snprintf(str, sizeof(str), "%s %d", g_Locale->getText(LOCALE_CAM_REMOVED), (int) data+1); - - printf("CCAMMenuHandler::handleMsg: %s\n", str); - hintBox = new CHintBox(LOCALE_MESSAGEBOX_INFO, str); - - hintBox->paint(); - - sleep(CI_MSG_TIME); - hintBox->hide(); - delete hintBox; - hintBox = NULL; - } else if(msg == NeutrinoMessages::EVT_CI_INIT_OK) { + rMsg = (CA_MESSAGE *)data; + if (!rMsg) + return -1; + + Msg = *rMsg; + delete rMsg; + + u32 MsgId = Msg.MsgId; + CA_SLOT_TYPE SlotType = Msg.SlotType; + int curslot = Msg.Slot; + + printf("CCAMMenuHandler::handleCamMsg: msg %d from %s\n", MsgId, from_menu ? "menu" : "neutrino"); + + if (SlotType != CA_SLOT_TYPE_SMARTCARD && SlotType != CA_SLOT_TYPE_CI) + return -1; + + if(MsgId == CA_MESSAGE_MSG_INSERTED) { + hideHintBox(); + snprintf(str, sizeof(str), "%s %d", + g_Locale->getText(SlotType == CA_SLOT_TYPE_CI ? LOCALE_CI_INSERTED : LOCALE_SC_INSERTED), (int)curslot+1); + printf("CCAMMenuHandler::handleCamMsg: %s\n", str); + ShowHintUTF(LOCALE_MESSAGEBOX_INFO, str); +#if 0 + showHintBox(LOCALE_MESSAGEBOX_INFO, str, CI_MSG_TIME); +#endif + } else if (MsgId == CA_MESSAGE_MSG_REMOVED) { + hideHintBox(); + + snprintf(str, sizeof(str), "%s %d", + g_Locale->getText(SlotType == CA_SLOT_TYPE_CI ? LOCALE_CI_REMOVED : LOCALE_SC_REMOVED), (int)curslot+1); + + printf("CCAMMenuHandler::handleCamMsg: %s\n", str); + ShowHintUTF(LOCALE_MESSAGEBOX_INFO, str); +#if 0 + showHintBox(LOCALE_MESSAGEBOX_INFO, str, CI_MSG_TIME); +#endif + } else if(MsgId == CA_MESSAGE_MSG_INIT_OK) { if(hintBox != NULL) { hintBox->hide(); delete hintBox; + hintBox = NULL; } char name[255] = "Unknown"; - //cDvbCiSlot * slot = ci->GetSlot((int) data); - //if(slot) - // slot->GetName(name); - ci->GetName((int) data, name); - snprintf(str, sizeof(str), "%s %d: %s", g_Locale->getText(LOCALE_CAM_INIT_OK), (int) data+1, name); + if (ca) + ca->ModuleName(SlotType, curslot, name); - printf("CCAMMenuHandler::handleMsg: %s\n", str); - hintBox = new CHintBox(LOCALE_MESSAGEBOX_INFO, str); - hintBox->paint(); - sleep(CI_MSG_TIME); - hintBox->hide(); - delete hintBox; - hintBox = NULL; - } - else if(msg == NeutrinoMessages::EVT_CI_MMI_MENU || msg == NeutrinoMessages::EVT_CI_MMI_LIST) { + snprintf(str, sizeof(str), "%s %d: %s", + g_Locale->getText(SlotType == CA_SLOT_TYPE_CI ? LOCALE_CI_INIT_OK : LOCALE_SC_INIT_OK), (int)curslot+1, name); + printf("CCAMMenuHandler::handleCamMsg: %s\n", str); + ShowHintUTF(LOCALE_MESSAGEBOX_INFO, str); +#if 0 + showHintBox(LOCALE_MESSAGEBOX_INFO, str, CI_MSG_TIME); +#endif + } else if(MsgId == CA_MESSAGE_MSG_INIT_FAILED) { + hideHintBox(); + + char name[255] = "Unknown"; + if (ca) + ca->ModuleName(SlotType, curslot, name); + + snprintf(str, sizeof(str), "%s %d: %s", + g_Locale->getText(SlotType == CA_SLOT_TYPE_CI ? LOCALE_CI_INIT_FAILED : LOCALE_SC_INIT_FAILED), (int)curslot+1, name); + + printf("CCAMMenuHandler::handleCamMsg: %s\n", str); + ShowHintUTF(LOCALE_MESSAGEBOX_INFO, str); +#if 0 + showHintBox(LOCALE_MESSAGEBOX_INFO, str, CI_MSG_TIME); +#endif + } else if(MsgId == CA_MESSAGE_MSG_MMI_MENU || MsgId == CA_MESSAGE_MSG_MMI_LIST) { bool sublevel = false; - if(msg != NeutrinoMessages::EVT_CI_MMI_MENU) + + if(MsgId != CA_MESSAGE_MSG_MMI_MENU) sublevel = true; - memcpy(pMenu, (MMI_MENU_LIST_INFO*) data, sizeof(MMI_MENU_LIST_INFO)); - free((void *)data); - curslot = pMenu->slot; + if (!(Msg.Flags & CA_MESSAGE_HAS_PARAM1_DATA)) + return -1; + + memcpy(pMenu, (MMI_MENU_LIST_INFO*)Msg.Msg.Data[0], sizeof(MMI_MENU_LIST_INFO)); + free((void *)Msg.Msg.Data[0]); printf("CCAMMenuHandler::handleCamMsg: slot %d menu ready, title %s choices %d\n", curslot, convertDVBUTF8(pMenu->title, strlen(pMenu->title), 0).c_str(), pMenu->choice_nb); - if(hintBox) { - hintBox->hide(); - } + hideHintBox(); int selected = -1; if(pMenu->choice_nb) { @@ -250,15 +322,15 @@ int CCAMMenuHandler::handleCamMsg (const neutrino_msg_t msg, neutrino_msg_data_t if((tptr[li] == 0x8A) || ((bpos > 38) && (tptr[li] == 0x20)) ) { bpos = 0; tptr[li] = 0; -printf("CCAMMenuHandler::handleCamMsg: subtitle: %s\n", sptr); + printf("CCAMMenuHandler::handleCamMsg: subtitle: %s\n", sptr); menu->addItem(new CMenuForwarderNonLocalized(convertDVBUTF8(sptr, strlen(sptr), 0).c_str(), false)); sptr = &tptr[li+1]; } bpos++; } if(strlen(sptr)) { -printf("CCAMMenuHandler::handleCamMsg: subtitle: %s\n", sptr); - menu->addItem(new CMenuForwarderNonLocalized(convertDVBUTF8(sptr, strlen(sptr), 0).c_str(), false)); + printf("CCAMMenuHandler::handleCamMsg: subtitle: %s\n", sptr); + menu->addItem(new CMenuForwarderNonLocalized(convertDVBUTF8(sptr, strlen(sptr), 0).c_str(), false)); } } for(i = 0; i < pMenu->choice_nb; i++) { @@ -270,7 +342,7 @@ printf("CCAMMenuHandler::handleCamMsg: subtitle: %s\n", sptr); } slen = strlen(pMenu->bottom); if(slen) { -printf("CCAMMenuHandler::handleCamMsg: bottom: %s\n", pMenu->bottom); + printf("CCAMMenuHandler::handleCamMsg: bottom: %s\n", pMenu->bottom); menu->addItem(new CMenuForwarderNonLocalized(convertDVBUTF8(pMenu->bottom, slen, 0).c_str(), false)); } @@ -279,19 +351,35 @@ printf("CCAMMenuHandler::handleCamMsg: bottom: %s\n", pMenu->bottom); delete menu; delete selector; } else { + char lstr[255]; - snprintf(lstr, 255, "%s\n%s\n%s", pMenu->title, pMenu->subtitle, pMenu->bottom); - if(hintBox) - delete hintBox; - //hintBox = new CHintBox(LOCALE_MESSAGEBOX_INFO, convertDVBUTF8(pMenu->title, strlen(pMenu->title), 0).c_str()); - hintBox = new CHintBox(LOCALE_MESSAGEBOX_INFO, convertDVBUTF8(str, strlen(lstr), 0).c_str()); - hintBox->paint(); + int slen = 0; + + hideHintBox(); +#if 1 + if(strlen(pMenu->title)) + slen += snprintf(&lstr[slen], 255-slen, "%s", pMenu->title); + if(strlen(pMenu->subtitle)) + slen += snprintf(&lstr[slen], 255-slen, "\n%s", pMenu->subtitle); + if(strlen(pMenu->bottom)) + slen += snprintf(&lstr[slen], 255-slen, "\n%s", pMenu->bottom); + + ShowHintUTF(LOCALE_MESSAGEBOX_INFO, convertDVBUTF8(lstr, slen, 0).c_str()); +#else + if(strlen(pMenu->subtitle)) + slen += snprintf(&lstr[slen], 255-slen, "\n%s", pMenu->subtitle); + if(strlen(pMenu->bottom)) + slen += snprintf(&lstr[slen], 255-slen, "\n%s", pMenu->bottom); + ShowHintUTF(convertDVBUTF8(pMenu->title, strlen(pMenu->title), 0).c_str(), convertDVBUTF8(lstr, slen, 0).c_str()); +#endif +#if 0 + showHintBox(LOCALE_MESSAGEBOX_INFO, convertDVBUTF8(lstr, slen, 0).c_str()); sleep(4);//FIXME if(!from_menu) { - delete hintBox; - hintBox = NULL; + hideHintBox(); } - return 1; +#endif + return 0; } if(sublevel) @@ -299,20 +387,21 @@ printf("CCAMMenuHandler::handleCamMsg: bottom: %s\n", pMenu->bottom); if(selected >= 0) { printf("CCAMMenuHandler::handleCamMsg: selected %d:%s sublevel %s\n", selected, pMenu->choice_item[i], sublevel ? "yes" : "no"); - CI_MenuAnswer(curslot, selected+1); + ca->MenuAnswer(SlotType, curslot, selected+1); timeoutEnd = CRCInput::calcTimeoutEnd(10); return 1; } else { return 2; } } - else if(msg == NeutrinoMessages::EVT_CI_MMI_REQUEST_INPUT) { - memcpy(pMmiEnquiry, (MMI_ENGUIRY_INFO*) data, sizeof(MMI_ENGUIRY_INFO)); - free((void *)data); - curslot = pMmiEnquiry->slot; + else if(MsgId == CA_MESSAGE_MSG_MMI_REQ_INPUT) { + if (!(Msg.Flags & CA_MESSAGE_HAS_PARAM1_DATA)) + return -1; + + memcpy(pMmiEnquiry, (MMI_ENGUIRY_INFO *)Msg.Msg.Data[0], sizeof(MMI_ENGUIRY_INFO)); + free((void *)Msg.Msg.Data[0]); printf("CCAMMenuHandler::handleCamMsg: slot %d input request, text %s\n", curslot, convertDVBUTF8(pMmiEnquiry->enguiryText, strlen(pMmiEnquiry->enguiryText), 0).c_str()); - if(hintBox) - hintBox->hide(); + hideHintBox(); char cPIN[pMmiEnquiry->answerlen+1]; cPIN[0] = 0; @@ -322,41 +411,31 @@ printf("CCAMMenuHandler::handleCamMsg: bottom: %s\n", pMenu->bottom); delete PINInput; printf("CCAMMenuHandler::handleCamMsg: input=[%s]\n", cPIN); - //if(cPIN[0] == 0) - // return 0; if((int) strlen(cPIN) != pMmiEnquiry->answerlen) { printf("CCAMMenuHandler::handleCamMsg: wrong input len\n"); - CI_Answer(curslot, (unsigned char *) cPIN, 0); - return 0; + ca->InputAnswer(SlotType, curslot, (unsigned char *) cPIN, 0); + return 1; //FIXME } else { - CI_Answer(curslot, (unsigned char *) cPIN, pMmiEnquiry->answerlen); + ca->InputAnswer(SlotType, curslot, (unsigned char *) cPIN, pMmiEnquiry->answerlen); return 1; } } - else if(msg == NeutrinoMessages::EVT_CI_MMI_CLOSE) { - curslot = (int) data; + else if(MsgId == CA_MESSAGE_MSG_MMI_CLOSE) { printf("CCAMMenuHandler::handleCamMsg: close request slot: %d\n", curslot); -#if 0 - if(hintBox) { - hintBox->hide(); - delete hintBox; - hintBox = NULL; - } -#endif - CI_CloseMMI(curslot); + hideHintBox(); + ca->MenuClose(SlotType, curslot); return 0; } - else if(msg == NeutrinoMessages::EVT_CI_MMI_TEXT) { - curslot = (int) data; + else if(MsgId == CA_MESSAGE_MSG_MMI_TEXT) { printf("CCAMMenuHandler::handleCamMsg: text\n"); } else ret = -1; -//printf("CCAMMenuHandler::handleCamMsg: return %d\n", ret); + //printf("CCAMMenuHandler::handleCamMsg: return %d\n", ret); return ret; } -int CCAMMenuHandler::doMenu (int slot) +int CCAMMenuHandler::doMenu(int slot, CA_SLOT_TYPE slotType) { int res = menu_return::RETURN_REPAINT; neutrino_msg_t msg; @@ -364,34 +443,31 @@ int CCAMMenuHandler::doMenu (int slot) bool doexit = false; while(!doexit) { - printf("CCAMMenuHandler::doMenu: slot %d\n", slot); + printf("CCAMMenuHandler::doMenu: enter menu for slot %d\n", slot); timeoutEnd = CRCInput::calcTimeoutEnd(10); - CI_EnterMenu(slot); + ca->MenuEnter(slotType, slot); while(true) { - if(hintBox) - delete hintBox; - hintBox = new CHintBox(LOCALE_MESSAGEBOX_INFO, g_Locale->getText(LOCALE_CAM_WAITING)); - hintBox->paint(); + showHintBox(LOCALE_MESSAGEBOX_INFO, + g_Locale->getText(slotType == CA_SLOT_TYPE_CI ? LOCALE_CI_WAITING : LOCALE_SC_WAITING)); + g_RCInput->getMsgAbsoluteTimeout (&msg, &data, &timeoutEnd); printf("CCAMMenuHandler::doMenu: msg %x data %x\n", msg, data); if (msg == CRCInput::RC_timeout) { - if(hintBox) - delete hintBox; - - hintBox = new CHintBox(LOCALE_MESSAGEBOX_INFO, g_Locale->getText(LOCALE_CAM_TIMEOUT)); - hintBox->paint(); - printf("CCAMMenuHandler::doMenu: menu timeout\n"); - sleep(5); - delete hintBox; - hintBox = NULL; - CI_CloseMMI(slot); + hideHintBox(); + ShowHintUTF(LOCALE_MESSAGEBOX_INFO, + g_Locale->getText(slotType == CA_SLOT_TYPE_CI ? LOCALE_CI_TIMEOUT : LOCALE_SC_TIMEOUT)); +#if 0 + showHintBox(LOCALE_MESSAGEBOX_INFO, g_Locale->getText(LOCALE_CI_TIMEOUT), 5); +#endif + ca->MenuClose(slotType, slot); return menu_return::RETURN_REPAINT; } /* -1 = not our event, 0 = back to top menu, 1 = continue loop, 2 = quit */ int ret = handleCamMsg(msg, data, true); + printf("CCAMMenuHandler::doMenu: handleCamMsg %d\n", ret); if(ret < 0 && (msg > CRCInput::RC_Messages)) { if ( CNeutrinoApp::getInstance()->handleMsg( msg, data ) & ( messages_return::cancel_all | messages_return::cancel_info ) ) { @@ -404,16 +480,13 @@ int CCAMMenuHandler::doMenu (int slot) } else if (ret == 2) { doexit = true; break; - } else { + } else { // ret == 0 break; } } } - CI_CloseMMI(slot); - if(hintBox) { - delete hintBox; - hintBox = NULL; - } -printf("CCAMMenuHandler::doMenu: return\n"); + ca->MenuClose(slotType, slot); + hideHintBox(); + printf("CCAMMenuHandler::doMenu: return\n"); return res; } diff --git a/src/gui/cam_menu.h b/src/gui/cam_menu.h index 4290b83ca..e8c801fe8 100644 --- a/src/gui/cam_menu.h +++ b/src/gui/cam_menu.h @@ -25,7 +25,9 @@ #include "widget/menue.h" -#include +#include +#include + using namespace std; @@ -33,12 +35,14 @@ class CCAMMenuHandler : public CMenuTarget { private: CHintBox * hintBox; - cDvbCi * ci; + cCA *ca; uint64_t timeoutEnd; //int slot; - int doMenu(int slot); + int doMenu(int slot, CA_SLOT_TYPE slotType); int doMainMenu(); int handleCamMsg (const neutrino_msg_t msg, neutrino_msg_data_t data, bool from_menu = false); + void hideHintBox(void); + void showHintBox(const neutrino_locale_t Caption, const char * const Text, uint32_t timeout = 0); public: void init(void); int exec(CMenuTarget* parent, const std::string &actionkey); diff --git a/src/gui/sleeptimer.cpp b/src/gui/sleeptimer.cpp index a849a0e46..4fc05b033 100644 --- a/src/gui/sleeptimer.cpp +++ b/src/gui/sleeptimer.cpp @@ -48,30 +48,40 @@ extern CRemoteControl * g_RemoteControl; /* neutrino.cpp */ #include -int CSleepTimerWidget::exec(CMenuTarget* parent, const std::string &) +int CSleepTimerWidget::exec(CMenuTarget* parent, const std::string &actionKey) { int res = menu_return::RETURN_REPAINT; int shutdown_min = 0; char value[16]; CStringInput *inbox; + bool permanent = (actionKey == "permanent"); if (parent) parent->hide(); - - shutdown_min = g_Timerd->getSleepTimerRemaining(); // remaining shutdown time? - sprintf(value,"%03d", shutdown_min); - CSectionsdClient::CurrentNextInfo info_CurrentNext; - g_InfoViewer->getEPG(g_RemoteControl->current_channel_id, info_CurrentNext); - if ( info_CurrentNext.flags & CSectionsdClient::epgflags::has_current) { - time_t jetzt=time(NULL); - int current_epg_zeit_dauer_rest = (info_CurrentNext.current_zeit.dauer+150 - (jetzt - info_CurrentNext.current_zeit.startzeit ))/60 ; - if(shutdown_min == 0 && current_epg_zeit_dauer_rest > 0 && current_epg_zeit_dauer_rest < 1000) - { - sprintf(value,"%03d",current_epg_zeit_dauer_rest); - } - } - inbox = new CStringInput(LOCALE_SLEEPTIMERBOX_TITLE, value, 3, LOCALE_SLEEPTIMERBOX_HINT1, LOCALE_SLEEPTIMERBOX_HINT2, "0123456789 "); + if(permanent) { + sprintf(value,"%03d", g_settings.shutdown_min); + } else { + shutdown_min = g_Timerd->getSleepTimerRemaining(); // remaining shutdown time? + sprintf(value,"%03d", shutdown_min); + } + + if(permanent) { + inbox = new CStringInput(LOCALE_SLEEPTIMERBOX_TITLE2, value, 3, LOCALE_SLEEPTIMERBOX_HINT1, LOCALE_SLEEPTIMERBOX_HINT3, "0123456789 "); + } else { + CSectionsdClient::CurrentNextInfo info_CurrentNext; + g_InfoViewer->getEPG(g_RemoteControl->current_channel_id, info_CurrentNext); + if ( info_CurrentNext.flags & CSectionsdClient::epgflags::has_current) { + time_t jetzt=time(NULL); + int current_epg_zeit_dauer_rest = (info_CurrentNext.current_zeit.dauer+150 - (jetzt - info_CurrentNext.current_zeit.startzeit ))/60 ; + if(shutdown_min == 0 && current_epg_zeit_dauer_rest > 0 && current_epg_zeit_dauer_rest < 1000) + { + sprintf(value,"%03d",current_epg_zeit_dauer_rest); + } + } + + inbox = new CStringInput(LOCALE_SLEEPTIMERBOX_TITLE, value, 3, LOCALE_SLEEPTIMERBOX_HINT1, LOCALE_SLEEPTIMERBOX_HINT2, "0123456789 "); + } int ret = inbox->exec (NULL, ""); inbox->hide (); @@ -82,9 +92,13 @@ int CSleepTimerWidget::exec(CMenuTarget* parent, const std::string &) return res; int new_val = atoi(value); - if(shutdown_min != new_val) { + if(permanent) { + g_settings.shutdown_min = new_val; + printf("permanent sleeptimer min: %d\n", g_settings.shutdown_min); + } + else if(shutdown_min != new_val) { shutdown_min = new_val; - printf("sleeptimer min: %d\n",shutdown_min); + printf("sleeptimer min: %d\n", shutdown_min); if (shutdown_min == 0) // if set to zero remove existing sleeptimer { if(g_Timerd->getSleeptimerID() > 0) { diff --git a/src/gui/user_menue_setup.cpp b/src/gui/user_menue_setup.cpp index 1e45bb6a8..633a7da73 100644 --- a/src/gui/user_menue_setup.cpp +++ b/src/gui/user_menue_setup.cpp @@ -94,7 +94,7 @@ const CMenuOptionChooser::keyval USERMENU_ITEM_OPTIONS[USERMENU_ITEM_OPTION_COUN { SNeutrinoSettings::ITEM_VTXT, LOCALE_USERMENU_ITEM_VTXT }, { SNeutrinoSettings::ITEM_IMAGEINFO, LOCALE_SERVICEMENU_IMAGEINFO }, { SNeutrinoSettings::ITEM_BOXINFO, LOCALE_DBOXINFO }, - { SNeutrinoSettings::ITEM_CAM, LOCALE_CAM_SETTINGS } + { SNeutrinoSettings::ITEM_CAM, LOCALE_CI_SETTINGS } }; int CUserMenuSetup::exec(CMenuTarget* parent, const std::string &) diff --git a/src/gui/videosettings.cpp b/src/gui/videosettings.cpp index 6198e954a..9a967bb4d 100644 --- a/src/gui/videosettings.cpp +++ b/src/gui/videosettings.cpp @@ -284,14 +284,27 @@ void CVideoSettings::setVideoCECSettings() void CVideoSettings::setVideoSettings() { printf("[neutrino VideoSettings] %s init video settings...\n", __FUNCTION__); + unsigned int system_rev = cs_get_revision(); +#if 0 + //FIXME focus: ?? this is different for different boxes videoDecoder->SetVideoMode((analog_mode_t) g_settings.analog_mode1); videoDecoder->SetVideoMode((analog_mode_t) g_settings.analog_mode2); - - setupVideoSystem(false/*don't ask*/); +#endif + if (system_rev == 0x06) { + changeNotify(LOCALE_VIDEOMENU_ANALOG_MODE, NULL); + } else { + changeNotify(LOCALE_VIDEOMENU_SCART, NULL); + changeNotify(LOCALE_VIDEOMENU_CINCH, NULL); + } + //setupVideoSystem(false/*don't ask*/);// focus: CVideoSettings constructor do this already ? + +#if 0 videoDecoder->setAspectRatio(-1, g_settings.video_43mode); videoDecoder->setAspectRatio(g_settings.video_Format, -1); - +#endif + videoDecoder->setAspectRatio(g_settings.video_Format, g_settings.video_43mode); + videoDecoder->SetDBDR(g_settings.video_dbdr); } diff --git a/src/gui/widget/hintbox.cpp b/src/gui/widget/hintbox.cpp index 2b87e6a29..0268a1608 100644 --- a/src/gui/widget/hintbox.cpp +++ b/src/gui/widget/hintbox.cpp @@ -45,6 +45,17 @@ #define HINTBOX_MAX_HEIGHT 420 CHintBox::CHintBox(const neutrino_locale_t Caption, const char * const Text, const int Width, const char * const Icon) +{ + const char * caption = g_Locale->getText(Caption); + init(caption, Text, Width, Icon); +} + +CHintBox::CHintBox(const char * const Caption, const char * const Text, const int Width, const char * const Icon) +{ + init(Caption, Text, Width, Icon); +} + +void CHintBox::init(const char * const Caption, const char * const Text, const int Width, const char * const Icon) { char * begin; char * pos; @@ -99,7 +110,8 @@ CHintBox::CHintBox(const neutrino_locale_t Caption, const char * const Text, con else iconfile = ""; - nw = additional_width + g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->getRenderWidth(g_Locale->getText(caption), true); // UTF-8 + //nw = additional_width + g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->getRenderWidth(g_Locale->getText(caption), true); // UTF-8 + nw = additional_width + g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->getRenderWidth(caption, true); // UTF-8 if (nw > width) width = nw; @@ -165,10 +177,11 @@ void CHintBox::refresh(void) CFrameBuffer::getInstance()->getIconSize(iconfile.c_str(), &iw, &ih); //window->paintIcon(iconfile.c_str(), 8, 5); window->paintIcon(iconfile.c_str(), 10, 0, theight); - window->RenderString(g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE], iw+20, theight, width - 20-iw, g_Locale->getText(caption), (CFBWindow::color_t)COL_MENUHEAD, 0, true); // UTF-8 + //window->RenderString(g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE], iw+20, theight, width - 20-iw, g_Locale->getText(caption), (CFBWindow::color_t)COL_MENUHEAD, 0, true); // UTF-8 + window->RenderString(g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE], iw+20, theight, width - 20-iw, caption, (CFBWindow::color_t)COL_MENUHEAD, 0, true); // UTF-8 } else - window->RenderString(g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE], 10, theight, width - 10, g_Locale->getText(caption), (CFBWindow::color_t)COL_MENUHEAD, 0, true); // UTF-8 + window->RenderString(g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE], 10, theight, width - 10, caption, (CFBWindow::color_t)COL_MENUHEAD, 0, true); // UTF-8 //window->paintBoxRel(0, theight, width, (entries_per_page + 1) * fheight, (CFBWindow::color_t)COL_MENUCONTENT_PLUS_0); window->paintBoxRel(0, theight, width, (entries_per_page + 1) * fheight, (CFBWindow::color_t)COL_MENUCONTENT_PLUS_0, RADIUS_LARGE, CORNER_BOTTOM);//round @@ -221,6 +234,13 @@ void CHintBox::hide(void) } int ShowHintUTF(const neutrino_locale_t Caption, const char * const Text, const int Width, int timeout, const char * const Icon) +{ + const char * caption = g_Locale->getText(Caption); + + return ShowHintUTF(caption, Text, Width, timeout, Icon); +} + +int ShowHintUTF(const char * const Caption, const char * const Text, const int Width, int timeout, const char * const Icon) { neutrino_msg_t msg; neutrino_msg_data_t data; diff --git a/src/gui/widget/hintbox.h b/src/gui/widget/hintbox.h index e647b5e25..035ec2b56 100644 --- a/src/gui/widget/hintbox.h +++ b/src/gui/widget/hintbox.h @@ -54,16 +54,17 @@ class CHintBox int fheight; int theight; - neutrino_locale_t caption; + const char * caption; char * message; std::vector line; std::string iconfile; - + void init(const char * const Caption, const char * const Text, const int Width, const char * const Icon); void refresh(void); public: // Text is UTF-8 encoded CHintBox(const neutrino_locale_t Caption, const char * const Text, const int Width = 450, const char * const Icon = NEUTRINO_ICON_INFO); + CHintBox(const char * const Caption, const char * const Text, const int Width = 450, const char * const Icon = NEUTRINO_ICON_INFO); ~CHintBox(void); bool has_scrollbar(void); @@ -76,6 +77,7 @@ class CHintBox // Text is UTF-8 encoded int ShowHintUTF(const neutrino_locale_t Caption, const char * const Text, const int Width = 450, int timeout = -1, const char * const Icon = NEUTRINO_ICON_INFO); +int ShowHintUTF(const char * const Caption, const char * const Text, const int Width = 450, int timeout = -1, const char * const Icon = NEUTRINO_ICON_INFO); int ShowLocalizedHint(const neutrino_locale_t Caption, const neutrino_locale_t Text, const int Width = 450, int timeout = -1, const char * const Icon = NEUTRINO_ICON_INFO); diff --git a/src/gui/widget/menue.cpp b/src/gui/widget/menue.cpp index 1144070b4..4453b7640 100644 --- a/src/gui/widget/menue.cpp +++ b/src/gui/widget/menue.cpp @@ -1375,6 +1375,11 @@ CMenuForwarderNonLocalized::CMenuForwarderNonLocalized(const char * const Text, the_text = Text; } +int CMenuForwarderNonLocalized::getWidth(void) +{ + int tw = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getRenderWidth(the_text, true); + return tw; +} //------------------------------------------------------------------------------------------------------------------------------- CMenuSeparator::CMenuSeparator(const int Type, const neutrino_locale_t Text) { diff --git a/src/gui/widget/menue.h b/src/gui/widget/menue.h index 398558f3f..05e1a2bf4 100644 --- a/src/gui/widget/menue.h +++ b/src/gui/widget/menue.h @@ -177,6 +177,7 @@ class CMenuForwarderNonLocalized : public CMenuForwarder // Text must be UTF-8 encoded: CMenuForwarderNonLocalized(const char * const Text, const bool Active=true, const char * const Option=NULL, CMenuTarget* Target=NULL, const char * const ActionKey = NULL, const neutrino_msg_t DirectKey = CRCInput::RC_nokey, const char * const IconName = NULL); CMenuForwarderNonLocalized(const char * const Text, const bool Active, const std::string &Option, CMenuTarget* Target=NULL, const char * const ActionKey = NULL, const neutrino_msg_t DirectKey = CRCInput::RC_nokey, const char * const IconName = NULL); + int getWidth(void); }; diff --git a/src/gui/widget/messagebox.cpp b/src/gui/widget/messagebox.cpp index 9e82220f7..04009753a 100644 --- a/src/gui/widget/messagebox.cpp +++ b/src/gui/widget/messagebox.cpp @@ -199,7 +199,6 @@ int CMessageBox::exec(int timeout) bool loop=true; while (loop) { - g_RCInput->getMsgAbsoluteTimeout( &msg, &data, &timeoutEnd ); if (msg == CRCInput::RC_timeout && returnDefaultOnTimeout) { diff --git a/src/neutrino.cpp b/src/neutrino.cpp index d6441aa52..2a784c607 100644 --- a/src/neutrino.cpp +++ b/src/neutrino.cpp @@ -132,6 +132,7 @@ #include #include #include +#include #include #include @@ -184,7 +185,7 @@ void getZapitConfig(Zapit_config *Cfg); void * nhttpd_main_thread(void *data); static pthread_t nhttpd_thread ; -//#define DISABLE_SECTIONSD //FIXME +//#define DISABLE_SECTIONSD extern int sectionsd_stop; static pthread_t sections_thread; void * sectionsd_main_thread(void *data); @@ -477,9 +478,15 @@ int CNeutrinoApp::loadSetup(const char * fname) g_settings.hdd_fs = configfile.getInt32( "hdd_fs", 0); g_settings.hdd_sleep = configfile.getInt32( "hdd_sleep", 120); g_settings.hdd_noise = configfile.getInt32( "hdd_noise", 254); + g_settings.shutdown_real = configfile.getBool("shutdown_real" , false ); g_settings.shutdown_real_rcdelay = configfile.getBool("shutdown_real_rcdelay", false ); strcpy(g_settings.shutdown_count, configfile.getString("shutdown_count","0").c_str()); + + g_settings.shutdown_min = 0; + if(cs_get_revision() > 7) + g_settings.shutdown_min = configfile.getInt32("shutdown_min", 180 ); + g_settings.infobar_sat_display = configfile.getBool("infobar_sat_display" , true ); g_settings.infobar_subchan_disp_pos = configfile.getInt32("infobar_subchan_disp_pos" , 0 ); g_settings.progressbar_color = configfile.getBool("progressbar_color", true ); @@ -1024,6 +1031,7 @@ void CNeutrinoApp::saveSetup(const char * fname) configfile.setBool("shutdown_real" , g_settings.shutdown_real ); configfile.setBool("shutdown_real_rcdelay", g_settings.shutdown_real_rcdelay); configfile.setString("shutdown_count" , g_settings.shutdown_count); + configfile.setInt32("shutdown_min" , g_settings.shutdown_min ); configfile.setBool("infobar_sat_display" , g_settings.infobar_sat_display ); configfile.setInt32("infobar_subchan_disp_pos" , g_settings.infobar_subchan_disp_pos ); configfile.setBool("progressbar_color" , g_settings.progressbar_color ); @@ -1276,11 +1284,11 @@ void CNeutrinoApp::saveSetup(const char * fname) //Software-update configfile.setInt32 ("softupdate_mode" , g_settings.softupdate_mode ); configfile.setString("softupdate_url_file" , g_settings.softupdate_url_file ); -#if 1 //FIXME why was commented ?? + configfile.setString("softupdate_proxyserver" , g_settings.softupdate_proxyserver ); configfile.setString("softupdate_proxyusername" , g_settings.softupdate_proxyusername ); configfile.setString("softupdate_proxypassword" , g_settings.softupdate_proxypassword ); -#endif + configfile.setString("update_dir", g_settings.update_dir); configfile.setString("font_file", g_settings.font_file); configfile.setString("ttx_font_file", g_settings.ttx_font_file); @@ -2102,6 +2110,7 @@ int CNeutrinoApp::run(int argc, char **argv) audioDecoder->EnableAnalogOut(g_settings.analog_out ? true : false); //init video and CEC Settings + g_videoSettings = new CVideoSettings; g_videoSettings->setVideoCECSettings(); // trigger a change @@ -2157,7 +2166,6 @@ int CNeutrinoApp::run(int argc, char **argv) g_EpgData = new CEpgData; g_InfoViewer = new CInfoViewer; g_EventList = new EventList; - g_videoSettings = new CVideoSettings; int dx = 0; int dy = 0; @@ -2388,6 +2396,8 @@ void CNeutrinoApp::RealRun(CMenuWidget &mainMenu) if(g_settings.power_standby) standbyMode(true); + cCA::GetInstance()->Ready(true); + while( true ) { g_RCInput->getMsg(&msg, &data, 100); // 10 secs.. @@ -3222,6 +3232,20 @@ printf("NeutrinoMessages::EVT_BOUQUETSCHANGED\n");fflush(stdout); return messages_return::handled; } else if( msg == NeutrinoMessages::SLEEPTIMER) { + if(data) { + skipShutdownTimer = + (ShowLocalizedMessage(LOCALE_MESSAGEBOX_INFO, LOCALE_SHUTDOWNTIMER_ANNOUNCE, + CMessageBox::mbrNo, CMessageBox::mbYes | CMessageBox::mbNo, NULL, 450, 30, true) == CMessageBox::mbrYes);//FIXME + if(skipShutdownTimer) { + printf("NeutrinoMessages::SLEEPTIMER: skiping\n"); + skipShutdownTimer = false; + return messages_return::handled; + } + else { + printf("NeutrinoMessages::SLEEPTIMER: shutdown\n"); + ExitRun(true, (cs_get_revision() > 7)); + } + } if(g_settings.shutdown_real) ExitRun(true, (cs_get_revision() > 7)); else diff --git a/src/neutrinoMessages.h b/src/neutrinoMessages.h index 3fb035850..be29ec36a 100644 --- a/src/neutrinoMessages.h +++ b/src/neutrinoMessages.h @@ -106,14 +106,7 @@ struct NeutrinoMessages { EVT_SI_FINISHED = CRCInput::RC_Events + 39, /* NEVER CHANGE THIS */ - EVT_CI_INSERTED = CRCInput::RC_Events + 60, /* data = slot num */ - EVT_CI_REMOVED = CRCInput::RC_Events + 61, /* data = slot num */ - EVT_CI_INIT_OK = CRCInput::RC_Events + 62, /* data = slot num */ - EVT_CI_MMI_MENU = CRCInput::RC_Events + 63, - EVT_CI_MMI_LIST = CRCInput::RC_Events + 64, - EVT_CI_MMI_TEXT = CRCInput::RC_Events + 65, - EVT_CI_MMI_REQUEST_INPUT = CRCInput::RC_Events + 66, - EVT_CI_MMI_CLOSE = CRCInput::RC_Events + 67, + EVT_CA_MESSAGE = CRCInput::RC_Events + 60, /* data = CA_MESSAGE pointer */ /* END */ EVT_CURRENTEPG = CRCInput::RC_WithData + 1, diff --git a/src/neutrino_menue.cpp b/src/neutrino_menue.cpp index 93ae70376..8cad72b13 100644 --- a/src/neutrino_menue.cpp +++ b/src/neutrino_menue.cpp @@ -143,6 +143,7 @@ #include #include #include +#include //#define TEST_MENU @@ -481,7 +482,7 @@ void CNeutrinoApp::InitMainMenu(CMenuWidget &mainMenu, CMenuWidget &mainSettings CRCInput::convertDigitToKey(shortcut++))); mainMenu.addItem(GenericMenuSeparatorLine); - mainMenu.addItem(new CMenuForwarder(LOCALE_MAINMENU_SLEEPTIMER, true, NULL, new CSleepTimerWidget, NULL, + mainMenu.addItem(new CMenuForwarder(LOCALE_MAINMENU_SLEEPTIMER, true, NULL, new CSleepTimerWidget, "", CRCInput::convertDigitToKey(shortcut++))); mainMenu.addItem(new CMenuForwarder(LOCALE_MAINMENU_REBOOT, true, NULL, this, "reboot", CRCInput::convertDigitToKey(shortcut++))); @@ -500,8 +501,8 @@ void CNeutrinoApp::InitMainMenu(CMenuWidget &mainMenu, CMenuWidget &mainSettings mainMenu.addItem(new CMenuForwarder(LOCALE_MESSAGEBOX_INFO, true, NULL, info, NULL, CRCInput::RC_help, NEUTRINO_ICON_BUTTON_HELP_SMALL )); } // end of infomenu - if(system_rev != 10) - mainMenu.addItem( new CMenuForwarder(LOCALE_CAM_SETTINGS, true, NULL, g_CamHandler, NULL, CRCInput::convertDigitToKey(0))); + /*if(system_rev != 10)*/ + mainMenu.addItem( new CMenuForwarder(LOCALE_CI_SETTINGS, true, NULL, g_CamHandler, NULL, CRCInput::convertDigitToKey(0))); //settings menu int sett_count =1; @@ -1343,8 +1344,7 @@ void CNeutrinoApp::InitMiscSettings(CMenuWidget &miscSettings) miscSettingsGeneral->addItem(new CMenuOptionChooser(LOCALE_MISCSETTINGS_SHUTDOWN_REAL, &g_settings.shutdown_real, OPTIONS_OFF1_ON0_OPTIONS, OPTIONS_OFF1_ON0_OPTION_COUNT, true, miscNotifier)); miscSettingsGeneral->addItem(m1); miscSettingsGeneral->addItem(m2); - - + miscSettingsGeneral->addItem(new CMenuForwarder(LOCALE_MISCSETTINGS_SLEEPTIMER, true, NULL, new CSleepTimerWidget, "permanent")); } #if 0 @@ -2201,12 +2201,12 @@ bool CNeutrinoApp::showUserMenu(int button) menu->addItem( new CMenuForwarder(LOCALE_DBOXINFO, true, NULL, new CDBoxInfoWidget, NULL, key, icon)); break; case SNeutrinoSettings::ITEM_CAM: - if(cs_get_revision() != 10) + //if(cs_get_revision() != 10) { menu_items++; menu_prev = SNeutrinoSettings::ITEM_CAM; keyhelper.get(&key,&icon); - menu->addItem(new CMenuForwarder(LOCALE_CAM_SETTINGS, true, NULL, g_CamHandler, NULL, key, icon)); + menu->addItem(new CMenuForwarder(LOCALE_CI_SETTINGS, true, NULL, g_CamHandler, NULL, key, icon)); } break; diff --git a/src/system/locals.h b/src/system/locals.h index e69cc9970..a12fbf73e 100644 --- a/src/system/locals.h +++ b/src/system/locals.h @@ -578,6 +578,7 @@ typedef enum { LOCALE_MISCSETTINGS_SHUTDOWN_COUNT, LOCALE_MISCSETTINGS_SHUTDOWN_COUNT_HINT1, LOCALE_MISCSETTINGS_SHUTDOWN_COUNT_HINT2, + LOCALE_MISCSETTINGS_SLEEPTIMER, LOCALE_MISCSETTINGS_NOAVIAWATCHDOG, LOCALE_MISCSETTINGS_NOENXWATCHDOG, LOCALE_MISCSETTINGS_PMTUPDATE, @@ -1041,7 +1042,9 @@ typedef enum { LOCALE_SLEEPTIMERBOX_ANNOUNCE, LOCALE_SLEEPTIMERBOX_HINT1, LOCALE_SLEEPTIMERBOX_HINT2, + LOCALE_SLEEPTIMERBOX_HINT3, LOCALE_SLEEPTIMERBOX_TITLE, + LOCALE_SLEEPTIMERBOX_TITLE2, LOCALE_STREAMFEATURES_HEAD, LOCALE_STREAMINFO_ARATIO, LOCALE_STREAMINFO_ARATIO_UNKNOWN, @@ -1417,15 +1420,24 @@ typedef enum { LOCALE_VIDEOMODE_OK, LOCALE_SCRAMBLED_CHANNEL, LOCALE_NEUTRINO_STARTING, - LOCALE_CAM_SETTINGS, - LOCALE_CAM_EMPTY, - LOCACE_CAM_INSERTED, - LOCALE_CAM_REMOVED, - LOCALE_CAM_INIT_OK, - LOCALE_CAM_WAITING, - LOCALE_CAM_TIMEOUT, - LOCALE_CAM_RESET, - LOCALE_CAM_RESET_STANDBY, + LOCALE_CI_SETTINGS, + LOCALE_CI_EMPTY, + LOCALE_CI_INSERTED, + LOCALE_CI_REMOVED, + LOCALE_CI_INIT_OK, + LOCALE_CI_INIT_FAILED, + LOCALE_CI_WAITING, + LOCALE_CI_TIMEOUT, + LOCALE_CI_RESET, + LOCALE_CI_RESET_STANDBY, + LOCALE_SC_EMPTY, + LOCALE_SC_INSERTED, + LOCALE_SC_REMOVED, + LOCALE_SC_INIT_OK, + LOCALE_SC_INIT_FAILED, + LOCALE_SC_WAITING, + LOCALE_SC_TIMEOUT, + LOCALE_SC_RESET, LOCALE_SUBTITLES_HEAD, LOCALE_SUBTITLES_STOP, LOCALE_FAN_SPEED, diff --git a/src/system/locals_intern.h b/src/system/locals_intern.h index cd34f857a..18f424d79 100644 --- a/src/system/locals_intern.h +++ b/src/system/locals_intern.h @@ -578,6 +578,7 @@ const char *locale_real_names[] = { "miscsettings.shutdown_count", "miscsettings.shutdown_count_hint1", "miscsettings.shutdown_count_hint2", + "miscsettings.sleeptimer", "miscsettings.noaviawatchdog", "miscsettings.noenxwatchdog", "miscsettings.pmtupdate", @@ -1041,7 +1042,9 @@ const char *locale_real_names[] = { "sleeptimerbox.announce", "sleeptimerbox.hint1", "sleeptimerbox.hint2", + "sleeptimerbox.hint3", "sleeptimerbox.title", + "sleeptimerbox.title2", "streamfeatures.head", "streaminfo.aratio", "streaminfo.aratio_unknown", @@ -1417,15 +1420,24 @@ const char *locale_real_names[] = { "video_mode_ok", "scrambled_channel", "neutrino_starting", - "cam.settings", - "cam.empty", - "cam.inserted", - "cam.removed", - "cam.init_ok", - "cam.waiting", - "cam.timeout", - "cam.reset", - "cam.reset_standby", + "ci.settings", + "ci.empty", + "ci.inserted", + "ci.removed", + "ci.init_ok", + "ci.init_failed", + "ci.waiting", + "ci.timeout", + "ci.reset", + "ci.reset_standby", + "sc.empty", + "sc.inserted", + "sc.removed", + "sc.init_ok", + "sc.init_failed", + "sc.waiting", + "sc.timeout", + "sc.reset", "subtitles.head", "subtitles.stop", "fan_speed", diff --git a/src/system/settings.h b/src/system/settings.h index 15b9d5d74..c4c58fad2 100644 --- a/src/system/settings.h +++ b/src/system/settings.h @@ -56,6 +56,7 @@ struct SNeutrinoSettings int shutdown_real; int shutdown_real_rcdelay; char shutdown_count[4]; + int shutdown_min; char record_safety_time_before[3]; char record_safety_time_after[3]; int infobar_sat_display; diff --git a/src/zapit/src/pmt.cpp b/src/zapit/src/pmt.cpp index 877af598f..d3a145f00 100644 --- a/src/zapit/src/pmt.cpp +++ b/src/zapit/src/pmt.cpp @@ -31,7 +31,7 @@ #include #include -#include +#include #include #define PMT_SIZE 1024 @@ -452,15 +452,17 @@ int parse_pmt(CZapitChannel * const channel) delete dmx; return -1; } + unsigned int dmxUnit = dmx->getUnit(); + delete dmx; - extern cDvbCi *ci; + cCA *ca = cCA::GetInstance(); curservice_id = channel->getServiceId(); curpmtpid = channel->getPmtPid(); pmtlen= ((buffer[1]&0xf)<<8) + buffer[2] +3; if(!(currentMode & RECORD_MODE) && !scan_runs) { - ci->SendPMT(buffer, pmtlen); + ca->SendPMT(dmxUnit, buffer, pmtlen); fout = fopen("/tmp/pmt.tmp","wb"); if(fout != NULL) { if ((int) fwrite(buffer, sizeof(unsigned char), pmtlen, fout) != pmtlen) { diff --git a/src/zapit/src/zapit.cpp b/src/zapit/src/zapit.cpp index 9ce16e1b1..7450d3fff 100644 --- a/src/zapit/src/zapit.cpp +++ b/src/zapit/src/zapit.cpp @@ -57,7 +57,7 @@ #include #include -#include +#include #include #include @@ -72,7 +72,7 @@ int zapit_ready; int abort_zapit; extern void send_ca_id(int); -cDvbCi * ci; +cCA *ca = NULL; //cDvbCiSlot *one, *two; extern cDemux * pmtDemux; @@ -423,7 +423,11 @@ printf("[zapit] saving channel, apid %x sub pid %x mode %d volume %d\n", g_curre pmt_stop_update_filter(&pmt_update_fd); stopPlayBack(true); - ci->SendPMT((unsigned char*) "", 0); + ca->SendPMT(0, (unsigned char*) "", 0); + if(g_current_channel && g_current_channel->getCaPmt()) { + delete g_current_channel->getCaPmt(); + g_current_channel->setCaPmt(NULL); + } /* store the new channel */ if ((!g_current_channel) || (channel_id != g_current_channel->getChannelID())) @@ -2195,8 +2199,10 @@ int zapit_main_thread(void *data) videoDecoder->OpenVBI(1); - ci = cDvbCi::getInstance(); - ci->Init(); + ca = cCA::GetInstance(); + /* CA_INIT_CI or CA_INIT_SC or CA_INIT_BOTH */ + ca->SetInitMask(CA_INIT_BOTH); + ca->Start(); scan_runs = 0; found_channels = 0; @@ -2304,6 +2310,11 @@ int zapit_main_thread(void *data) delete frontend; } INFO("frontend deleted"); + if (ca) { + INFO("stopping CA"); + ca->Stop(); + delete ca; + } INFO("shutdown complete"); return 0; }