our current experimental Neutrino branch

git-svn-id: file:///home/bas/coolstream_public_svn/THIRDPARTY/applications/neutrino-experimental@27 e54a6e83-5905-42d5-8d5c-058d10e6a962
This commit is contained in:
mrcolor
2009-12-08 11:05:11 +00:00
commit bc5bd4154e
876 changed files with 193775 additions and 0 deletions

View File

@@ -0,0 +1,5 @@
Makefile.in
.libs
.deps
*.la
*.lo

View File

@@ -0,0 +1,115 @@
/* public header file */
#ifndef _AUDIO_CS_H_
#define _AUDIO_CS_H_
typedef enum
{
AUDIO_SYNC_WITH_PTS,
AUDIO_NO_SYNC,
AUDIO_SYNC_AUDIO_MASTER
} AUDIO_SYNC_MODE;
typedef enum
{
AUDIO_FMT_AUTO = 0,
AUDIO_FMT_MPEG,
AUDIO_FMT_MP3,
AUDIO_FMT_DOLBY_DIGITAL,
AUDIO_FMT_BASIC = AUDIO_FMT_DOLBY_DIGITAL,
AUDIO_FMT_AAC,
AUDIO_FMT_AAC_PLUS,
AUDIO_FMT_DD_PLUS,
AUDIO_FMT_DTS,
AUDIO_FMT_AVS,
AUDIO_FMT_MLP,
AUDIO_FMT_WMA,
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;
unsigned int cEncodedDataOnSPDIF, cEncodedDataOnHDMI;
bool Muted;
AUDIO_FORMAT StreamType;
AUDIO_SYNC_MODE SyncMode;
bool started;
unsigned int uAudioPTSDelay;
unsigned int uAudioDolbyPTSDelay, uAudioMpegPTSDelay;
bool receivedDelay;
/* internal methods */
int setBypassMode(int disable);
int LipsyncAdjust(void);
int atten;
int volume;
bool clip_started;
bool hdmiDD;
bool spdifDD;
bool hasMuteScheduled;
public:
/* construct & destruct */
cAudio(void * hBuffer, void * encHD, void * encSD);
~cAudio(void);
void * GetHandle();
void * GetDSP();
void HandleAudioMessage(int Event, void *pData);
void HandlePcmMessage(int Event, void *pData);
/* shut up */
int mute(void);
int unmute(void);
int SetMute(int enable);
/* bypass audio to external decoder */
int enableBypass(void);
int disableBypass(void);
/* volume, min = 0, max = 255 */
int setVolume(unsigned int left, unsigned int right);
int getVolume(void) { return volume;}
/* start and stop audio */
int Start(void);
int Stop(void);
bool Pause(bool Pcm = true);
bool Resume(bool Pcm = true);
void SetStreamType(AUDIO_FORMAT type) { StreamType = type; };
AUDIO_FORMAT GetStreamType(void) { return StreamType; }
bool ReceivedAudioDelay(void) { return receivedDelay; }
void SetReceivedAudioDelay(bool set = false) { receivedDelay = set; }
unsigned int GetAudioDelay(void) { return (StreamType == AUDIO_FMT_DOLBY_DIGITAL) ? uAudioDolbyPTSDelay : uAudioMpegPTSDelay; }
void SetSyncMode(AVSYNC_TYPE Mode);
/* stream source */
int getSource(void);
int setSource(int source);
int Flush(void);
/* select channels */
int setChannel(int channel);
int getChannel(void);
int PrepareClipPlay(int uNoOfChannels, int uSampleRate, int uBitsPerSample, int bLittleEndian);
int WriteClip(unsigned char * buffer, int size);
int StopClip();
void getAudioInfo(int &type, int &layer, int& freq, int &bitrate, int &mode);
void SetSRS(int iq_enable, int nmgr_enable, int iq_mode, int iq_level);
bool IsHdmiDDSupported();
void SetHdmiDD(bool enable);
void SetSpdifDD(bool enable);
void ScheduleMute(bool On);
};
#endif

View File

@@ -0,0 +1,11 @@
#ifndef __CS_TYPES
#define __CS_TYPES
typedef enum
{
AVSYNC_DISABLED,
AVSYNC_ENABLED,
AVSYNC_AUDIO_IS_MASTER,
} AVSYNC_TYPE;
#endif

View File

@@ -0,0 +1,78 @@
/*******************************************************************************/
/* */
/* libcoolstream/cszapper/demux.h */
/* ZAP interface for neutrino frontend */
/* */
/* (C) 2008 CoolStream International */
/* */
/*******************************************************************************/
#ifndef __DEMUX_CS_H
#define __DEMUX_CS_H
#include <string>
#define DEMUX_POLL_TIMEOUT 0 // timeout in ms
#define MAX_FILTER_LENGTH 16 // maximum number of filters
#ifndef DMX_FILTER_SIZE
#define DMX_FILTER_SIZE MAX_FILTER_LENGTH
#endif
#define MAX_DMX_UNITS 4 //DMX_NUM_TSS_INPUTS_REVB
#ifndef CS_DMX_PDATA
#define CS_DMX_PDATA void
#endif
#include "cs_types.h"
typedef enum
{
DMX_VIDEO_CHANNEL = 1,
DMX_AUDIO_CHANNEL,
DMX_PES_CHANNEL,
DMX_PSI_CHANNEL,
DMX_PIP_CHANNEL,
DMX_TP_CHANNEL,
DMX_PCR_ONLY_CHANNEL,
} DMX_CHANNEL_TYPE;
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;
AVSYNC_TYPE SyncMode;
int uLength;
bool enabled;
int unit;
DMX_CHANNEL_TYPE type;
CS_DMX_PDATA * privateData;
public:
bool Open(DMX_CHANNEL_TYPE pes_type, void * hVideoBuffer = NULL, int uBufferSize = 8192);
void Close(void);
bool Start(void);
bool Stop(void);
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; }
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 mode);
void * getBuffer();
void * getChannel();
const DMX_CHANNEL_TYPE getChannelType(void);
void addPid(unsigned short Pid);
void getSTC(int64_t * STC);
//
cDemux(int num = 0);
~cDemux();
};
#endif //__DEMUX_H

View File

@@ -0,0 +1,62 @@
#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
#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;
typedef void (*SEND_MSG_HOOK) (unsigned int msg, unsigned int data);
class cDvbCi {
private:
int slots;
bool init;
int pmtlen;
unsigned char * pmtbuf;
void SendPMT();
pthread_mutex_t ciMutex;
public:
bool Init(void);
bool SendPMT(unsigned char *data, int len);
bool SendDateTime(void);
//
cDvbCi(int Slots);
~cDvbCi();
static cDvbCi * getInstance();
SEND_MSG_HOOK SendMessage;
void SetHook(SEND_MSG_HOOK _SendMessage) { SendMessage = _SendMessage; };
bool CamPresent(int slot);
bool GetName(int slot, char * name);
};
#endif //__DVBCI_H

View File

@@ -0,0 +1,5 @@
#ifndef __INIT_CS_H
#define __INIT_CS_H
void init_cs_api();
void shutdown_cs_api();
#endif

View File

@@ -0,0 +1,68 @@
/*******************************************************************************/
/* */
/* libcoolstream/cszapper/demux.h */
/* ZAP interface for neutrino frontend */
/* */
/* (C) 2008 CoolStream International */
/* */
/*******************************************************************************/
#ifndef __PLAYBACK_CS_H
#define __PLAYBACK_CS_H
#include <string>
#ifndef CS_PLAYBACK_PDATA
#define CS_PLAYBACK_PDATA void
#endif
typedef enum {
PLAYMODE_TS = 0,
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, bool ac3);
bool Stop(void);
bool SetAPid(unsigned short pid, bool ac3);
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

View File

@@ -0,0 +1,53 @@
#ifndef __PWRMNGR_H__
#define __PWRMNGR_H__
// -- cCpuFreqManager ----------------------------------------------------------
class cCpuFreqManager {
private:
unsigned long startCpuFreq;
unsigned long delta;
public:
void Up(void);
void Down(void);
void Reset(void);
//
bool SetCpuFreq(unsigned long CpuFreq);
bool SetDelta(unsigned long Delta);
unsigned long GetCpuFreq(void);
unsigned long GetDelta(void);
//
cCpuFreqManager(void);
};
// -- cPowerManageger ----------------------------------------------------------
typedef enum
{
PWR_INIT = 1,
PWR_FULL_ACTIVE, /* all devices/clocks up */
PWR_ACTIVE_STANDBY,
PWR_PASSIVE_STANDBY,
PWR_INVALID
} PWR_STATE;
class cPowerManager {
private:
bool init;
bool opened;
PWR_STATE powerState;
//
static void ApplicationCallback(void *hHandle, void *pUserData, signed long eEvent, void *pEventData, void *pTag) {}
bool SetState(PWR_STATE PowerState);
public:
bool Open(void);
void Close(void);
//
bool SetStandby(bool Active, bool Passive);
//
cPowerManager(void);
virtual ~cPowerManager();
};
#endif // __PWRMNGR_H__

View File

@@ -0,0 +1,38 @@
/*******************************************************************************/
/* */
/* libcoolstream/cszapper/demux.h */
/* ZAP interface for neutrino frontend */
/* */
/* (C) 2008 CoolStream International */
/* */
/*******************************************************************************/
#ifndef __RECORD_CS_H
#define __RECORD_CS_H
#include <string>
#ifndef CS_RECORD_PDATA
#define CS_RECORD_PDATA void
#endif
class cRecord
{
private:
CS_RECORD_PDATA * privateData;
bool enabled;
int num_apids;
int unit;
int nRecordFD;
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);
};
#endif

View File

@@ -0,0 +1,203 @@
#ifndef _VIDEO_CS_H
#define _VIDEO_CS_H
#include <coolstream/cs_vfd.h>
#include <coolstream/control.h>
#include "cs_types.h"
typedef enum {
ANALOG_SD_RGB_CINCH = 0x00,
ANALOG_SD_YPRPB_CINCH,
ANALOG_HD_RGB_CINCH,
ANALOG_HD_YPRPB_CINCH,
ANALOG_SD_RGB_SCART = 0x10,
ANALOG_SD_YPRPB_SCART,
ANALOG_HD_RGB_SCART,
ANALOG_HD_YPRPB_SCART,
ANALOG_SCART_MASK = 0x10,
} analog_mode_t;
typedef enum {
VIDEO_FORMAT_MPEG2 = 0,
VIDEO_FORMAT_MPEG4,
VIDEO_FORMAT_VC1,
VIDEO_FORMAT_JPEG,
VIDEO_FORMAT_GIF,
VIDEO_FORMAT_PNG
} VIDEO_FORMAT;
typedef enum {
VIDEO_SD = 0,
VIDEO_HD,
VIDEO_120x60i,
VIDEO_320x240i,
VIDEO_1440x800i,
VIDEO_360x288i
} VIDEO_DEFINITION;
typedef enum {
VIDEO_FRAME_RATE_23_976 = 0,
VIDEO_FRAME_RATE_24,
VIDEO_FRAME_RATE_25,
VIDEO_FRAME_RATE_29_97,
VIDEO_FRAME_RATE_30,
VIDEO_FRAME_RATE_50,
VIDEO_FRAME_RATE_59_94,
VIDEO_FRAME_RATE_60
} VIDEO_FRAME_RATE;
typedef enum {
DISPLAY_AR_1_1,
DISPLAY_AR_4_3,
DISPLAY_AR_14_9,
DISPLAY_AR_16_9,
DISPLAY_AR_20_9,
DISPLAY_AR_RAW,
} DISPLAY_AR;
typedef enum {
DISPLAY_AR_MODE_PANSCAN = 0,
DISPLAY_AR_MODE_LETTERBOX,
DISPLAY_AR_MODE_NONE,
DISPLAY_AR_MODE_PANSCAN2
} DISPLAY_AR_MODE;
typedef enum {
VIDEO_DB_DR_NEITHER = 0,
VIDEO_DB_ON,
VIDEO_DB_DR_BOTH
} VIDEO_DB_DR;
typedef enum {
VIDEO_PLAY_STILL = 0,
VIDEO_PLAY_CLIP,
VIDEO_PLAY_TRICK,
VIDEO_PLAY_MOTION,
VIDEO_PLAY_MOTION_NO_SYNC
} VIDEO_PLAY_MODE;
typedef enum {
VIDEO_STD_NTSC,
VIDEO_STD_SECAM,
VIDEO_STD_PAL,
VIDEO_STD_480P,
VIDEO_STD_576P,
VIDEO_STD_720P60,
VIDEO_STD_1080I60,
VIDEO_STD_720P50,
VIDEO_STD_1080I50,
VIDEO_STD_1080P30,
VIDEO_STD_1080P24,
VIDEO_STD_1080P25,
VIDEO_STD_AUTO
} VIDEO_STD;
#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 SyncMode;
DISPLAY_AR_MODE ARMode;
VIDEO_DB_DR eDbDr;
DISPLAY_AR PictureAR;
VIDEO_FRAME_RATE FrameRate;
bool interlaced;
unsigned int uDRMDisplayDelay;
unsigned int uVideoPTSDelay;
int StcPts;
bool started;
unsigned int bStandby;
bool blank;
bool playing;
bool auto_format;
int uFormatIndex;
int pic_width, pic_height;
int jpeg_width, jpeg_height;
int video_width, video_height;
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);
void * GetDRM(void);
void * GetTVEnc();
void * GetTVEncSD();
void * GetHandle();
void SetAudioHandle(void * handle);
/* aspect ratio */
int getAspectRatio(void);
void getPictureInfo(int &width, int &height, int &rate);
int setAspectRatio(int aspect, int mode);
/* cropping mode */
int getCroppingMode(void);
int setCroppingMode(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;};
void HandleDRMMessage(int Event, void *pData);
void HandleVideoMessage(void * hHandle, int Event, void *pData);
VIDEO_DEFINITION GetVideoDef(void) { return VideoDefinition; }
/* change video play state */
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);
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 setContrast(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);
};
#endif