Merge branch 'neutrino-apollo' of coolstreamtech.de:cst-private-neutrino into neutrino-apollo

Conflicts:
	src/timerd/timermanager.cpp


Origin commit data
------------------
Commit: a222240dbb
Author: [CST] Bas <bas@coolstreamtech.com>
Date: 2012-09-26 (Wed, 26 Sep 2012)
This commit is contained in:
[CST] Bas
2012-09-26 17:52:47 +08:00
15 changed files with 163 additions and 91 deletions

View File

@@ -118,7 +118,8 @@ AC_ARG_ENABLE(cleanup,
[ --enable-cleanup enable cleanup on exit],
[AC_DEFINE(EXIT_CLEANUP,1,[enable cleanup on exit])])
AC_CHECK_HEADERS(coolstream/nevis_ir.h)
AC_CHECK_HEADERS(coolstream/cs_ir_generic.h)
AC_CHECK_HEADERS(coolstream/cs_frontpanel.h)
#
# Check for libtdservicedb - the new one - for testing only

View File

@@ -56,6 +56,7 @@ typedef enum
HDMI_AUDIO_FMT_ATRAC
} HDMI_AUDIO_FORMAT;
#define CS_MAX_AUDIO_DECODERS 1
#define CS_MAX_AUDIO_FORMATS 10
typedef struct cs_audio_format {
@@ -68,8 +69,15 @@ typedef struct cs_audio_caps {
cs_audio_format_t formats[CS_MAX_AUDIO_FORMATS];
} cs_audio_caps_t;
class cDemux;
class cVideo;
class cAudio {
private:
static cAudio *instance[CS_MAX_AUDIO_DECODERS];
unsigned int unit;
cDemux *demux;
cVideo *video;
CS_AUDIO_PDATA *privateData;
//unsigned int cEncodedDataOnSPDIF, cEncodedDataOnHDMI;
bool muted;
@@ -92,6 +100,8 @@ private:
bool spdifDD;
bool hasMuteScheduled;
bool analogOut;
//
cAudio(unsigned int Unit);
public:
/* construct & destruct */
cAudio(void *hBuffer, void *encHD, void *encSD);
@@ -149,6 +159,9 @@ public:
bool IsHdmiAudioFormatSupported(HDMI_AUDIO_FORMAT format);
void SetHdmiDD(HDMI_ENCODED_MODE type);
bool IsHdmiDTSSupported(void);
void SetDemux(cDemux *Demux);
void SetVideo(cVideo *Video);
static cAudio *GetDecoder(unsigned int Unit);
};
#endif //__AUDIO_CS_H_

View File

@@ -11,8 +11,8 @@
#define __CA_CS_H_
#include <OpenThreads/Thread>
#include "cs_types.h"
#include <vector>
#include "cs_types.h"
enum CA_INIT_MASK {
CA_INIT_SC = 1,
@@ -23,7 +23,7 @@ enum CA_INIT_MASK {
enum CA_SLOT_TYPE {
CA_SLOT_TYPE_SMARTCARD,
CA_SLOT_TYPE_CI,
CA_SLOT_TYPE_ALL
CA_SLOT_TYPE_ALL,
};
enum CA_MESSAGE_FLAGS {
@@ -49,7 +49,7 @@ enum CA_MESSAGE_FLAGS {
CA_MESSAGE_HAS_PARAM1_LONG = (1 << 19),
CA_MESSAGE_HAS_PARAM2_LONG = (1 << 20),
CA_MESSAGE_HAS_PARAM3_LONG = (1 << 21),
CA_MESSAGE_HAS_PARAM4_LONG = (1 << 22)
CA_MESSAGE_HAS_PARAM4_LONG = (1 << 22),
};
enum CA_MESSAGE_MSGID {
@@ -72,7 +72,7 @@ enum CA_MESSAGE_MSGID {
CA_MESSAGE_MSG_EMM_ARRIVED,
CA_MESSAGE_MSG_CHANNEL_CHANGE,
CA_MESSAGE_MSG_GUI_READY,
CA_MESSAGE_MSG_EXIT
CA_MESSAGE_MSG_EXIT,
};
typedef struct CA_MESSAGE {

View File

@@ -36,8 +36,12 @@ typedef enum {
} DMX_CHANNEL_TYPE;
class cDemuxData;
class cVideo;
class cAudio;
class cDemux {
friend class cVideo;
friend class cAudio;
private:
DMX_CHANNEL_TYPE type;
int timeout;

View File

@@ -11,6 +11,7 @@
#define __PLAYBACK_CS_H_
#include <string>
#include <stdint.h>
typedef enum {
PLAYMODE_TS = 0,

View File

@@ -14,6 +14,10 @@
class cRecordData;
#define REC_STATUS_OK 0
#define REC_STATUS_SLOW 1
#define REC_STATUS_OVERFLOW 2
class cRecord {
private:
cRecordData * rd;
@@ -29,6 +33,8 @@ public:
bool Start(int fd, unsigned short vpid, unsigned short * apids, int numapids, uint64_t chid);
bool Stop(void);
bool AddPid(unsigned short pid);
int GetStatus();
void ResetStatus();
};
#endif // __RECORD_CS_H_

View File

@@ -10,11 +10,13 @@
#ifndef __VIDEO_CS_H_
#define __VIDEO_CS_H_
#include <coolstream/cs_vfd.h>
#include <coolstream/cs_frontpanel.h>
#include <coolstream/control.h>
#include "cs_types.h"
#define CS_MAX_VIDEO_DECODERS 16
#ifndef CS_VIDEO_PDATA
#define CS_VIDEO_PDATA void
#endif
@@ -138,10 +140,17 @@ typedef enum
VIDEO_CONTROL_MAX = VIDEO_CONTROL_SHARPNESS
} VIDEO_CONTROL;
class cDemux;
class cAudio;
class cVideo {
friend class cAudio;
private:
static cVideo *instance[CS_MAX_VIDEO_DECODERS];
unsigned int unit;
CS_VIDEO_PDATA *privateData;
u32 streamType;
VIDEO_FORMAT streamType;
VIDEO_DEFINITION VideoDefinition;
DISPLAY_AR DisplayAR;
VIDEO_PLAY_MODE playMode;
@@ -167,13 +176,16 @@ private:
int cfd; // control driver fd
analog_mode_t analog_mode_cinch;
analog_mode_t analog_mode_scart;
vfd_icon mode_icon;
fp_icon mode_icon;
cDemux *demux;
//
int SelectAutoFormat();
void ScalePic();
cVideo(unsigned int Unit);
public:
/* constructor & destructor */
cVideo(int mode, void * hChannel, void * hBuffer);
~cVideo(void);
void * GetVPP(void);
@@ -247,6 +259,8 @@ public:
int StartVBI(unsigned short pid);
int StopVBI(void);
bool GetScreenImage(unsigned char * &data, int &xres, int &yres, bool get_video = true, bool get_osd = false, bool scale_to_video = false);
void SetDemux(cDemux *Demux);
static cVideo *GetDecoder(unsigned int Unit);
};
#endif // __VIDEO_CS_H_

View File

@@ -65,8 +65,7 @@
#define ENABLE_REPEAT_CHECK
//const char * const RC_EVENT_DEVICE[NUMBER_OF_EVENT_DEVICES] = {"/dev/input/nevis_ir", "/dev/input/event0"};
const char * const RC_EVENT_DEVICE[NUMBER_OF_EVENT_DEVICES] = {"/dev/input/nevis_ir"};
const char * const RC_EVENT_DEVICE[NUMBER_OF_EVENT_DEVICES] = {"/dev/cs_ir"};
typedef struct input_event t_input_event;
#ifdef KEYBOARD_INSTEAD_OF_REMOTE_CONTROL
@@ -1574,8 +1573,8 @@ void CRCInput::play_click()
}
#ifdef HAVE_COOLSTREAM_NEVIS_IR_H
// hint: ir_protocol_t and other useful things are defined in nevis_ir.h
#ifdef HAVE_COOLSTREAM_CS_IR_GENERIC_H
// hint: ir_protocol_t and other useful things are defined in cs_ir_generic.h
void CRCInput::set_rc_hw(ir_protocol_t ir_protocol, unsigned int ir_address)
{
int ioctl_ret = -1;
@@ -1599,7 +1598,7 @@ void CRCInput::set_rc_hw(ir_protocol_t ir_protocol, unsigned int ir_address)
}
}
// hint: ir_protocol_t and other useful things are defined in nevis_ir.h
// hint: ir_protocol_t and other useful things are defined in cs_ir_generic.h
void CRCInput::set_rc_hw(void)
{
ir_protocol_t ir_protocol = IR_PROTOCOL_UNKNOWN;

View File

@@ -38,8 +38,8 @@
#include <sys/types.h>
#include <string>
#include <vector>
#ifdef HAVE_COOLSTREAM_NEVIS_IR_H
#include <coolstream/nevis_ir.h>
#ifdef HAVE_COOLSTREAM_CS_IR_GENERIC_H
#include <coolstream/cs_ir_generic.h>
#endif
#ifndef KEY_OK
@@ -152,7 +152,7 @@ class CRCInput
int translate(int code, int num);
void calculateMaxFd(void);
int checkTimers();
#ifdef HAVE_COOLSTREAM_NEVIS_IR_H
#ifdef HAVE_COOLSTREAM_CS_IR_GENERIC_H
void set_rc_hw(ir_protocol_t ir_protocol, unsigned int ir_address);
#endif
public:

View File

@@ -169,9 +169,9 @@ void CVFD::setlcdparameter(int dimm, const int power)
brightness = dimm;
printf("CVFD::setlcdparameter dimm %d power %d\n", dimm, power);
int ret = ioctl(fd, IOC_VFD_SET_BRIGHT, dimm);
int ret = ioctl(fd, IOC_FP_SET_BRIGHT, dimm);
if(ret < 0)
perror("IOC_VFD_SET_BRIGHT");
perror("IOC_FP_SET_BRIGHT");
}
void CVFD::setlcdparameter(void)
@@ -186,14 +186,14 @@ void CVFD::setled(int led1, int led2){
int ret = -1;
if(led1 != -1){
ret = ioctl(fd, IOC_VFD_LED_CTRL, led1);
ret = ioctl(fd, IOC_FP_LED_CTRL, led1);
if(ret < 0)
perror("IOC_VFD_LED_CTRL");
perror("IOC_FP_LED_CTRL");
}
if(led2 != -1){
ret = ioctl(fd, IOC_VFD_LED_CTRL, led2);
ret = ioctl(fd, IOC_FP_LED_CTRL, led2);
if(ret < 0)
perror("IOC_VFD_LED_CTRL");
perror("IOC_FP_LED_CTRL");
}
}
@@ -206,13 +206,13 @@ void CVFD::setled(bool on_off)
if(on_off){//on
switch(g_settings.led_rec_mode){
case 1:
led1 = VFD_LED_1_ON; led2 = VFD_LED_2_ON;
led1 = FP_LED_1_ON; led2 = FP_LED_2_ON;
break;
case 2:
led1 = VFD_LED_1_ON;
led1 = FP_LED_1_ON;
break;
case 3:
led2 = VFD_LED_2_ON;
led2 = FP_LED_2_ON;
break;
default:
break;
@@ -222,13 +222,13 @@ void CVFD::setled(bool on_off)
switch(g_settings.led_rec_mode){
break;
case 2:
led1 = VFD_LED_1_OFF;
led1 = FP_LED_1_OFF;
break;
case 3:
led2 = VFD_LED_2_OFF;
led2 = FP_LED_2_OFF;
break;
default:
led1 = VFD_LED_1_OFF; led2 = VFD_LED_2_OFF;
led1 = FP_LED_1_OFF; led2 = FP_LED_2_OFF;
break;
}
}
@@ -249,16 +249,16 @@ void CVFD::setled(void)
switch(select){
case 0:
led1 = VFD_LED_1_OFF; led2 = VFD_LED_2_OFF;
led1 = FP_LED_1_OFF; led2 = FP_LED_2_OFF;
break;
case 1:
led1 = VFD_LED_1_ON; led2 = VFD_LED_2_ON;
led1 = FP_LED_1_ON; led2 = FP_LED_2_ON;
break;
case 2:
led1 = VFD_LED_1_ON; led2 = VFD_LED_2_OFF;
led1 = FP_LED_1_ON; led2 = FP_LED_2_OFF;
break;
case 3:
led1 = VFD_LED_1_OFF; led2 = VFD_LED_2_ON;
led1 = FP_LED_1_OFF; led2 = FP_LED_2_ON;
break;
default:
break;
@@ -288,7 +288,7 @@ void CVFD::showTime(bool force)
return;
#endif
if(has_lcd && mode == MODE_SHUTDOWN) {
ShowIcon(VFD_ICON_CAM1, false);
ShowIcon(FP_ICON_CAM1, false);
return;
}
if (has_lcd && showclock) {
@@ -314,18 +314,18 @@ void CVFD::showTime(bool force)
if(clearClock) {
clearClock = 0;
if(has_lcd)
ShowIcon(VFD_ICON_CAM1, false);
ShowIcon(FP_ICON_CAM1, false);
setled(false);//off
} else {
clearClock = 1;
if(has_lcd)
ShowIcon(VFD_ICON_CAM1, true);
ShowIcon(FP_ICON_CAM1, true);
setled(true);//on
}
} else if(clearClock || (recstatus != tmp_recstatus)) { // in case icon ON after record stopped
clearClock = 0;
if(has_lcd)
ShowIcon(VFD_ICON_CAM1, false);
ShowIcon(FP_ICON_CAM1, false);
setled();
}
recstatus = tmp_recstatus;
@@ -340,13 +340,13 @@ void CVFD::showVolume(const char vol, const bool /*perform_update*/)
static int oldpp = 0;
if(!has_lcd) return;
ShowIcon(VFD_ICON_MUTE, muted);
ShowIcon(FP_ICON_MUTE, muted);
if(vol == volume)
return;
volume = vol;
wake_up();
ShowIcon(VFD_ICON_FRAME, true);
ShowIcon(FP_ICON_FRAME, true);
if ((mode == MODE_TVRADIO) && g_settings.lcd_setting[SNeutrinoSettings::LCD_SHOW_VOLUME]) {
int pp = (int) round((double) vol * (double) 8 / (double) 100);
@@ -357,11 +357,11 @@ printf("CVFD::showVolume: %d, bar %d\n", (int) vol, pp);
int i;
int j = 0x00000200;
for(i = 0; i < pp; i++) {
ShowIcon((vfd_icon) j, true);
ShowIcon((fp_icon) j, true);
j /= 2;
}
for(;i < 8; i++) {
ShowIcon((vfd_icon) j, false);
ShowIcon((fp_icon) j, false);
j /= 2;
}
oldpp = pp;
@@ -376,7 +376,7 @@ void CVFD::showPercentOver(const unsigned char perc, const bool /*perform_update
if ((mode == MODE_TVRADIO) && !(g_settings.lcd_setting[SNeutrinoSettings::LCD_SHOW_VOLUME])) {
//if (g_settings.lcd_setting[SNeutrinoSettings::LCD_SHOW_VOLUME] == 0)
{
ShowIcon(VFD_ICON_FRAME, true);
ShowIcon(FP_ICON_FRAME, true);
int pp;
if(perc == 255)
pp = 0;
@@ -388,11 +388,11 @@ void CVFD::showPercentOver(const unsigned char perc, const bool /*perform_update
int i;
int j = 0x00000200;
for(i = 0; i < pp; i++) {
ShowIcon((vfd_icon) j, true);
ShowIcon((fp_icon) j, true);
j /= 2;
}
for(;i < 8; i++) {
ShowIcon((vfd_icon) j, false);
ShowIcon((fp_icon) j, false);
j /= 2;
}
percentOver = pp;
@@ -432,16 +432,16 @@ void CVFD::showAudioPlayMode(AUDIOMODES m)
if(!has_lcd) return;
switch(m) {
case AUDIO_MODE_PLAY:
ShowIcon(VFD_ICON_PLAY, true);
ShowIcon(VFD_ICON_PAUSE, false);
ShowIcon(FP_ICON_PLAY, true);
ShowIcon(FP_ICON_PAUSE, false);
break;
case AUDIO_MODE_STOP:
ShowIcon(VFD_ICON_PLAY, false);
ShowIcon(VFD_ICON_PAUSE, false);
ShowIcon(FP_ICON_PLAY, false);
ShowIcon(FP_ICON_PAUSE, false);
break;
case AUDIO_MODE_PAUSE:
ShowIcon(VFD_ICON_PLAY, false);
ShowIcon(VFD_ICON_PAUSE, true);
ShowIcon(FP_ICON_PLAY, false);
ShowIcon(FP_ICON_PAUSE, true);
break;
case AUDIO_MODE_FF:
break;
@@ -474,11 +474,11 @@ void CVFD::setMode(const MODES m, const char * const title)
if(!has_lcd) return;
if(mode == MODE_AUDIO)
ShowIcon(VFD_ICON_MP3, false);
ShowIcon(FP_ICON_MP3, false);
#if 0
else if(mode == MODE_STANDBY) {
ShowIcon(VFD_ICON_COL1, false);
ShowIcon(VFD_ICON_COL2, false);
ShowIcon(FP_ICON_COL1, false);
ShowIcon(FP_ICON_COL2, false);
}
#endif
@@ -511,7 +511,7 @@ void CVFD::setMode(const MODES m, const char * const title)
break;
case MODE_AUDIO:
{
ShowIcon(VFD_ICON_MP3, true);
ShowIcon(FP_ICON_MP3, true);
showAudioPlayMode(AUDIO_MODE_STOP);
showVolume(volume, false);
showclock = true;
@@ -533,8 +533,8 @@ void CVFD::setMode(const MODES m, const char * const title)
break;
case MODE_STANDBY:
#if 0
ShowIcon(VFD_ICON_COL1, true);
ShowIcon(VFD_ICON_COL2, true);
ShowIcon(FP_ICON_COL1, true);
ShowIcon(FP_ICON_COL2, true);
#endif
showclock = true;
showTime(true); /* "showclock = true;" implies that "showTime();" does a "displayUpdate();" */
@@ -669,20 +669,20 @@ void CVFD::Unlock()
void CVFD::Clear()
{
if(!has_lcd) return;
int ret = ioctl(fd, IOC_VFD_CLEAR_ALL, 0);
int ret = ioctl(fd, IOC_FP_CLEAR_ALL, 0);
if(ret < 0)
perror("IOC_VFD_SET_TEXT");
perror("IOC_FP_SET_TEXT");
else
text[0] = 0;
}
void CVFD::ShowIcon(vfd_icon icon, bool show)
void CVFD::ShowIcon(fp_icon icon, bool show)
{
if(!has_lcd) return;
//printf("CVFD::ShowIcon %s %x\n", show ? "show" : "hide", (int) icon);
int ret = ioctl(fd, show ? IOC_VFD_SET_ICON : IOC_VFD_CLEAR_ICON, icon);
int ret = ioctl(fd, show ? IOC_FP_SET_ICON : IOC_FP_CLEAR_ICON, icon);
if(ret < 0)
perror(show ? "IOC_VFD_SET_ICON" : "IOC_VFD_CLEAR_ICON");
perror(show ? "IOC_FP_SET_ICON" : "IOC_FP_CLEAR_ICON");
}
void CVFD::ShowText(const char *str)
@@ -707,9 +707,9 @@ printf("CVFD::ShowText: [%s]\n", str);
//printf("****************************** CVFD::ShowText: %s\n", str);
//FIXME !!
ret = ioctl(fd, IOC_VFD_SET_TEXT, len ? str : NULL);
ret = ioctl(fd, IOC_FP_SET_TEXT, len ? str : NULL);
if(ret < 0)
perror("IOC_VFD_SET_TEXT");
perror("IOC_FP_SET_TEXT");
}
#ifdef VFD_UPDATE

View File

@@ -42,7 +42,7 @@
#include <pthread.h>
#include <string>
#include <coolstream/cs_vfd.h>
#include <coolstream/cs_frontpanel.h>
class CVFD
{
@@ -143,7 +143,7 @@ class CVFD
void Lock();
void Unlock();
void Clear();
void ShowIcon(vfd_icon icon, bool show);
void ShowIcon(fp_icon icon, bool show);
void ShowText(const char *str);
void wake_up();
MODES getMode(void) { return mode; };

View File

@@ -33,7 +33,7 @@
#include <config.h>
#endif
#ifdef HAVE_COOLSTREAM_NEVIS_IR_H
#ifdef HAVE_COOLSTREAM_CS_IR_GENERIC_H
/* define constants instead of #ifdef'ing the corresponding code.
* the compiler will optimize it away anyway, but the syntax is
* still checked */
@@ -41,7 +41,7 @@
#else
#define RC_HW_SELECT false
#ifdef HAVE_COOL_HARDWARE
#warning header coolstream/nevis_ir.h not found
#warning header coolstream/cs_ir_generic.h not found
#warning you probably have an old driver installation
#warning you´ll be missing the remotecontrol selection feature!
#endif

View File

@@ -432,7 +432,7 @@ void CMoviePlayerGui::PlayFile(void)
playback->Close();
} else {
playstate = CMoviePlayerGui::PLAY;
CVFD::getInstance()->ShowIcon(VFD_ICON_PLAY, true);
CVFD::getInstance()->ShowIcon(FP_ICON_PLAY, true);
if(timeshift) {
first_start_timeshift = true;
startposition = -1;
@@ -679,8 +679,8 @@ void CMoviePlayerGui::PlayFile(void)
playback->SetSpeed(1);
playback->Close();
CVFD::getInstance()->ShowIcon(VFD_ICON_PLAY, false);
CVFD::getInstance()->ShowIcon(VFD_ICON_PAUSE, false);
CVFD::getInstance()->ShowIcon(FP_ICON_PLAY, false);
CVFD::getInstance()->ShowIcon(FP_ICON_PAUSE, false);
restoreNeutrino();

View File

@@ -35,6 +35,10 @@
#include <sectionsdclient/sectionsdclient.h>
#include <eitd/sectionsd.h>
#ifdef HAVE_COOLSTREAM_CS_FRONTPANEL_H
#include <coolstream/cs_frontpanel.h>
#endif
#include <vector>
#include <cstdlib>
@@ -60,6 +64,32 @@ void CTimerManager::Init(void)
m_saveEvents = false;
m_isTimeSet = false;
wakeup = 0;
timer_wakeup = false;
#if HAVE_COOL_HARDWARE
int fd = open("/dev/display", O_RDONLY);
if (fd < 0) {
perror("/dev/display");
} else {
fp_wakeup_data_t wk;
memset(&wk, 0, sizeof(wk));
int ret = ioctl(fd, IOC_FP_GET_WAKEUP, &wk);
if(ret >= 0)
wakeup = ((wk.source == FP_WAKEUP_SOURCE_TIMER) /* || (wk.source == WAKEUP_SOURCE_PWLOST)*/);
close(fd);
}
printf("[timerd] wakeup from standby: %s\n", wakeup ? "yes" : "no");
if(wakeup){
creat("/tmp/.wakeup", 0);
timer_wakeup = true;
}else{
const char *neutrino_leave_deepstandby_script = CONFIGDIR "/deepstandby.off";
printf("[%s] executing %s\n",__FILE__ ,neutrino_leave_deepstandby_script);
if (system(neutrino_leave_deepstandby_script) != 0)
perror( neutrino_leave_deepstandby_script );
}
#endif
loadRecordingSafety();
//thread starten

View File

@@ -2036,12 +2036,16 @@ bool CZapit::Start(Z_start_arg *ZapStart_arg)
audioDemux = new cDemux();
audioDemux->Open(DMX_AUDIO_CHANNEL);
videoDecoder = cVideo::GetDecoder();
videoDecoder = cVideo::GetDecoder(0);
audioDecoder = cAudio::GetDecoder(0);
videoDecoder->SetDemux(videoDemux);
videoDecoder->SetVideoSystem(video_mode);
videoDecoder->Standby(false);
audioDecoder = new cAudio(audioDemux->getBuffer(), videoDecoder->GetTVEnc(), NULL /*videoDecoder->GetTVEncSD()*/);
audioDecoder->SetDemux(audioDemux);
audioDecoder->SetVideo(videoDecoder);
videoDecoder->SetAudioHandle(audioDecoder->GetHandle());
#ifdef USE_VBI