move public libcoolstream-headers to hardware directory

Origin commit data
------------------
Commit: 2029a684e5
Author: vanhofen <vanhofen@gmx.de>
Date: 2017-03-06 (Mon, 06 Mar 2017)

Origin message was:
------------------
- move public libcoolstream-headers to hardware directory
This commit is contained in:
vanhofen
2017-03-06 21:49:32 +01:00
parent 459cf4d8ea
commit 97391211a4
38 changed files with 7 additions and 12 deletions

View File

@@ -0,0 +1,153 @@
/*******************************************************************************/
/* */
/* libcoolstream/audio_cs.h */
/* Public header file for audio API */
/* */
/* (C) 2008 CoolStream International */
/* */
/* $Id:: $ */
/*******************************************************************************/
#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,
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;
typedef enum {
HDMI_ENCODED_OFF,
HDMI_ENCODED_AUTO,
HDMI_ENCODED_FORCED
} HDMI_ENCODED_MODE;
typedef enum
{
HDMI_AUDIO_FMT_LPCM = 0x1,
HDMI_AUDIO_FMT_AC3 ,
HDMI_AUDIO_FMT_MPEG1 ,
HDMI_AUDIO_FMT_MP3 ,
HDMI_AUDIO_FMT_MPEG2 ,
HDMI_AUDIO_FMT_AAC ,
HDMI_AUDIO_FMT_DTS ,
HDMI_AUDIO_FMT_ATRAC
} HDMI_AUDIO_FORMAT;
#define CS_MAX_AUDIO_FORMATS 10
typedef struct cs_audio_format {
HDMI_AUDIO_FORMAT format;
unsigned int max_channels;
} cs_audio_format_t;
typedef struct cs_audio_caps {
unsigned char count;
cs_audio_format_t formats[CS_MAX_AUDIO_FORMATS];
} cs_audio_caps_t;
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(bool Disable);
int LipsyncAdjust(void);
int atten;
int volume;
bool clip_started;
HDMI_ENCODED_MODE hdmiDD;
bool spdifDD;
bool hasMuteScheduled;
bool analogOut;
public:
/* construct & destruct */
cAudio(void *hBuffer, void *encHD, void *encSD);
~cAudio(void);
void *GetHandle(void);
void *GetDSP(void);
void HandleAudioMessage(int Event, void *pData);
void HandlePcmMessage(int Event, void *pData);
/* shut up */
int mute(void);
int unmute(void);
int SetMute(bool 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;}
bool getMuteStatus(void) { return muted; }
/* start and stop audio */
int Start(void);
int Stop(void);
bool Pause(bool Pcm = true);
bool Resume(bool Pcm = true);
void SetStreamType(AUDIO_FORMAT StreamType) { streamType = StreamType; };
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 SyncMode);
/* 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);
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);
void SetHdmiDD(bool On);
void SetSpdifDD(bool Enable);
void ScheduleMute(bool On);
void EnableAnalogOut(bool Enable);
bool GetHdmiAudioCaps(cs_audio_caps_t &caps);
bool IsHdmiAudioFormatSupported(HDMI_AUDIO_FORMAT format);
void SetHdmiDD(HDMI_ENCODED_MODE type);
};
#endif //__AUDIO_CS_H_

View File

@@ -0,0 +1,164 @@
/*******************************************************************************/
/* */
/* libcoolstream/ca.h */
/* Public header for CA interface */
/* */
/* (C) 2010 CoolStream International Ltd. */
/* */
/* $Id:: $ */
/*******************************************************************************/
#ifndef __CA_CS_H_
#define __CA_CS_H_
#include <OpenThreads/Thread>
#include "cs_types.h"
#include <vector>
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_PARAM5_INT = (1 << 13),
CA_MESSAGE_HAS_PARAM5_PTR = (1 << 14),
CA_MESSAGE_HAS_PARAM5_DATA = (1 << 15),
CA_MESSAGE_HAS_PARAM6_INT = (1 << 16),
CA_MESSAGE_HAS_PARAM6_PTR = (1 << 17),
CA_MESSAGE_HAS_PARAM6_DATA = (1 << 18),
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)
};
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_CAPMT_ARRIVED,
CA_MESSAGE_MSG_CAT_ARRIVED,
CA_MESSAGE_MSG_ECM_ARRIVED,
CA_MESSAGE_MSG_EMM_ARRIVED,
CA_MESSAGE_MSG_CHANNEL_CHANGE,
CA_MESSAGE_MSG_GUI_READY,
CA_MESSAGE_MSG_EXIT
};
typedef struct CA_MESSAGE {
u32 MsgId;
enum CA_SLOT_TYPE SlotType;
int Slot;
u32 Flags;
union {
u8 *Data[8];
u32 Param[8];
void *Ptr[8];
u64 ParamLong[4];
} Msg;
} CA_MESSAGE;
typedef std::vector<u16> CaIdVector;
typedef std::vector<u16>::iterator CaIdVectorIterator;
typedef std::vector<u16>::const_iterator CaIdVectorConstIterator;
#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
/// CA module class
class cCA : public OpenThreads::Thread {
private:
/// Static instance of the CA module
static cCA *inst;
/// Private constructor (singleton method)
cCA(void);
/// Private data for the CA module
CS_CA_PDATA *privateData;
enum CA_INIT_MASK initMask;
bool exit;
bool started;
bool guiReady;
/// Thread method
virtual void run(void);
public:
/// Returns the number of CA slots (CI+SC, CI, SC)
u32 GetNumberSlots(enum CA_SLOT_TYPE SlotType = CA_SLOT_TYPE_ALL);
u32 GetNumberCISlots(void) { return GetNumberSlots(CA_SLOT_TYPE_CI); }
u32 GetNumberSmartCardSlots(void) { return GetNumberSlots(CA_SLOT_TYPE_SMARTCARD); }
/// Singleton
static cCA *GetInstance(void);
/// Send PMT to a individual or to all available modules (DEPRECATED)
bool SendPMT(int Unit, unsigned char *Data, int Len, enum CA_SLOT_TYPE SlotType = CA_SLOT_TYPE_ALL);
/// Sends a message to the CA thread
bool SendMessage(const CA_MESSAGE *Msg);
/// Sets which modules to initialize. It is only
/// possible to change this once!
void SetInitMask(enum CA_INIT_MASK InitMask);
/// Sets the frequency (in Hz) of the TS stream input (only valid for CI)
void SetTSClock(u32 Speed);
/// Start the CA module
bool Start(void);
/// Stops the CA module
void Stop(void);
/// Notify that the GUI is ready to receive messages
/// (CA messages coming from a module)
void Ready(bool Set);
/// Resets a module (if possible)
void ModuleReset(enum CA_SLOT_TYPE, u32 Slot);
/// Checks if a module is present
bool ModulePresent(enum CA_SLOT_TYPE, u32 Slot);
/// Returns the module name in array Name
void ModuleName(enum CA_SLOT_TYPE, u32 Slot, char *Name);
/// Notify the module we want to enter menu
void MenuEnter(enum CA_SLOT_TYPE, u32 Slot);
/// Notify the module with our answer (choice nr)
void MenuAnswer(enum CA_SLOT_TYPE, u32 Slot, u32 choice);
/// Notify the module with our answer (binary)
void InputAnswer(enum CA_SLOT_TYPE, u32 Slot, u8 * Data, int Len);
/// Notify the module we closed the menu
void MenuClose(enum CA_SLOT_TYPE, u32 Slot);
/// Get the supported CAIDs
int GetCAIDS(CaIdVector & Caids, enum CA_SLOT_TYPE SlotType = CA_SLOT_TYPE_ALL);
/// Send a CA-PMT object and Raw unparsed PMT to the CA layer
bool SendCAPMT(u64 Source, u8 DemuxSource, u8 DemuxMask, const unsigned char *CAPMT, u32 CAPMTLen, const unsigned char *RawPMT, u32 RawPMTLen, enum CA_SLOT_TYPE SlotType = CA_SLOT_TYPE_ALL);
/// Virtual destructor
virtual ~cCA();
};
#endif ///__CA_H_

View File

@@ -0,0 +1,66 @@
/****************************************************************************/
/* $Id:
****************************************************************************/
#include <linux/fb.h>
#include <linux/ioctl.h>
#include <linux/types.h>
/*
* define the IOCTL to get the frame buffer handle info.
* currently only image handle is returned
*/
/* define this for testing H/w acceleation funcitons */
/* #define FB_TEST_HW_ACCELERATION */
/* assign an accelerator type (we have no official, so we do not add them to linux/fb.h */
#define FB_ACCEL_CX2450X 0x90 /* Trident CX2450X */
/*
* structure which contains the image handle
*/
typedef struct _cnxtfb_handle
{
void *hImage;
void *hDRM_SD;
void *hTvEnc_SD;
void *hDRM;
void *hTvEnc;
} cnxtfb_handle;
typedef struct _cnxtfb_resolution
{
u_int32_t uWidth;
u_int32_t uHeight;
} cnxtfb_resolution;
typedef enum
{
CNXTFB_BLEND_MODE_GLOBAL_ALPHA = 0, /* Global / Region Alpha */
CNXTFB_BLEND_MODE_PIXEL_ALPHA, /* Alpha from pixel */
CNXTFB_BLEND_MODE_ALPHA_MULTIPLIED /* Global alpha multiplied with pixel alpha */
} CNXTFB_BLEND_MODE;
#define CNXTFB_IO(type) _IO('F', type)
#define CNXTFB_IOW(type, dtype) _IOW('F', type, dtype)
#define CNXTFB_IOR(type, dtype) _IOR('F', type, dtype)
#ifndef FBIO_WAITFORVSYNC
#define FBIO_WAITFORVSYNC _IOW('F', 0x20, u_int32_t)
#endif
#define FBIO_GETCNXTFBHANDLE CNXTFB_IOR(0x21, cnxtfb_handle)
#define FBIO_STARTDISPLAY CNXTFB_IO(0x22)
#define FBIO_STOPDISPLAY CNXTFB_IO(0x23)
#define FBIO_SETOPACITY CNXTFB_IOW(0x24, u_int8_t)
#define FBIO_SETBLENDMODE CNXTFB_IOW(0x25, u_int8_t)
#define FBIO_CHANGEOUTPUTFORMAT CNXTFB_IOW(0x26, u_int32_t)
#define FBIO_GETFBRESOLUTION CNXTFB_IOR(0x27, cnxtfb_resolution)
#define FBIO_SETFLICKERFILTER CNXTFB_IOW(0x28, u_int8_t)
#ifdef FB_TEST_HW_ACCELERATION
#define FBIO_FILL_RECT CNXTFB_IOW(0x29, struct fb_fillrect)
#define FBIO_COPY_AREA CNXTFB_IOW(0x2a, struct fb_copyarea)
#define FBIO_IMAGE_BLT CNXTFB_IOW(0x2b, struct fb_image)
#endif

View File

@@ -0,0 +1,75 @@
/********************************************************************
* Description: Control driver for PWM and Scart
* Author: CoolStream Dev. Team
* Created at: Fri Jun 26 08:11:43 CEST 2009
*
* Copyright (c) 2009 CoolStream International Ltd. All rights reserved.
*
********************************************************************/
#ifndef __CONTROL_H
#define __CONTROL_H
#ifndef __KERNEL__
typedef unsigned char u8;
typedef unsigned short u16;
typedef unsigned int u32;
#include <sys/ioctl.h>
#else
#include <linux/types.h>
#include <asm/ioctl.h>
#endif
#include "tsrouter.h"
typedef struct _scart_status {
bool widescreen;
bool function;
bool fastblank;
} scart_status_t;
typedef struct _pwm_status {
u16 pwm_pulse_first;
u16 pwm_pulse_second;
u32 pwm_clock;
} pwm_status_t;
typedef struct cs_control_data {
scart_status_t scart_status;
pwm_status_t pwm_status;
bool hdd_power;
u32 readers;
u32 sys_serial_high, sys_serial_low;
u32 sys_revision;
} cs_control_data_t;
/* ioctls */
#define CS_CONTROL_MAGIC 0xDE
#define IOC_CONTROL_WIDESCREEN _IOW(CS_CONTROL_MAGIC, 20, unsigned int)
#define IOC_CONTROL_TVAV _IOW(CS_CONTROL_MAGIC, 21, unsigned int)
#define IOC_CONTROL_RGB _IOW(CS_CONTROL_MAGIC, 22, unsigned int)
#define IOC_CONTROL_SCART_STATUS _IOR(CS_CONTROL_MAGIC, 23, scart_status_t *)
#define IOC_CONTROL_PWM_SPEED _IOW(CS_CONTROL_MAGIC, 24, unsigned int)
#define IOC_CONTROL_HDDPOWER _IOW(CS_CONTROL_MAGIC, 25, unsigned int)
/* ioctl for getting board serial and revision */
#define IOC_CONTROL_BOARD_SERIAL_LOW _IOR(CS_CONTROL_MAGIC, 26, unsigned int *)
#define IOC_CONTROL_BOARD_SERIAL_HIGH _IOR(CS_CONTROL_MAGIC, 27, unsigned int *)
#define IOC_CONTROL_BOARD_REV _IOR(CS_CONTROL_MAGIC, 28, unsigned int *)
/* ioctl for setting TS routing */
#define IOC_CONTROL_TSROUTE_GET_HSDP_CONFIG _IOR(CS_CONTROL_MAGIC, 29, tsrouter_hsdp_config_t *)
#define IOC_CONTROL_TSROUTE_SET_HSDP_CONFIG _IOW(CS_CONTROL_MAGIC, 30, tsrouter_tsp_config_t *)
#define IOC_CONTROL_TSROUTE_GET_TSP_CONFIG _IOR(CS_CONTROL_MAGIC, 31, tsrouter_hsdp_config_t *)
#define IOC_CONTROL_TSROUTE_SET_TSP_CONFIG _IOW(CS_CONTROL_MAGIC, 32, tsrouter_tsp_config_t *)
/* Gets the current TS port frequency of the CI */
#define IOC_CONTROL_TSROUTE_GET_CI_SPEED _IOR(CS_CONTROL_MAGIC, 33, unsigned int *)
/* Sets the current TS port frequency of the CI in Hz (max=12Mhz) */
#define IOC_CONTROL_TSROUTE_SET_CI_SPEED _IOW(CS_CONTROL_MAGIC, 34, unsigned int)
/* Gets the current TS port base PLL of the CI */
#define IOC_CONTROL_TSROUTE_GET_CI_PLL _IOR(CS_CONTROL_MAGIC, 35, unsigned int *)
/* Sets the current TS port base PLL of the CI */
#define IOC_CONTROL_TSROUTE_SET_CI_PLL _IOW(CS_CONTROL_MAGIC, 36, unsigned int)
#endif /* __CONTROL_H */

View File

@@ -0,0 +1,76 @@
/*******************************************************************************/
/* */
/* libcoolstream/cs_api.h */
/* Public header file for CoolStream Public API */
/* */
/* (C) 2010 CoolStream International */
/* */
/* $Id:: $ */
/*******************************************************************************/
#ifndef __CS_API_H_
#define __CS_API_H_
#include <control.h>
#include <sys/types.h>
#include <stdio.h>
#include <stdint.h>
typedef void (*cs_messenger) (unsigned int msg, unsigned int data);
enum CS_LOG_MODULE {
CS_LOG_CI = 0,
CS_LOG_HDMI_CEC,
CS_LOG_HDMI,
CS_LOG_VIDEO,
CS_LOG_VIDEO_DRM,
CS_LOG_AUDIO,
CS_LOG_DEMUX,
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
void cs_api_init(void);
void cs_api_exit(void);
// Memory helpers
void *cs_malloc_uncached(size_t size);
void cs_free_uncached(void *ptr);
void *cs_phys_addr(void *ptr);
// Callback function helpers
void cs_register_messenger(cs_messenger messenger);
void cs_deregister_messenger(void);
cs_messenger cs_get_messenger(void);
// Logging functions
void cs_log_enable(void);
void cs_log_disable(void);
void cs_log_message(const char *prefix, const char *fmt, ...);
void cs_log_module_enable(enum CS_LOG_MODULE module);
void cs_log_module_disable(enum CS_LOG_MODULE module);
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_ci_clock(unsigned int speed);
int cs_get_ts_ci_clock(unsigned int *speed);
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);
int cs_set_tsp_config(unsigned int port, tsrouter_tsp_config_t *tsp_config);
int cs_get_tsp_config(unsigned int port, tsrouter_tsp_config_t *tsp_config);
// Serial nr and revision accessors
unsigned long long cs_get_serial(void);
unsigned int cs_get_revision(void);
#endif //__CS_API_H_

View File

@@ -0,0 +1,116 @@
/*
* Driver for the Coolstream Frontpanel - public definititons.
*
* Copyright (C) 2008 - 2012 Coolstream International Limited
*/
#ifndef __CS_FRONTPANEL_H__
#define __CS_FRONTPANEL_H__
#define CS_FP_DISPLAY_DEVICE_NAME "cs_display"
#define CS_FP_DISPLAY_DEVICE_MAJOR 238
typedef enum {
/* for all frontpanels with */
FP_ICON_NONE = 0x00000000,
FP_ICON_BAR8 = 0x00000004,
FP_ICON_BAR7 = 0x00000008,
FP_ICON_BAR6 = 0x00000010,
FP_ICON_BAR5 = 0x00000020,
FP_ICON_BAR4 = 0x00000040,
FP_ICON_BAR3 = 0x00000080,
FP_ICON_BAR2 = 0x00000100,
FP_ICON_BAR1 = 0x00000200,
FP_ICON_FRAME = 0x00000400,
FP_ICON_MUTE = 0x00001000,
FP_ICON_DOLBY = 0x00002000,
FP_ICON_TV = 0x00020000,
FP_ICON_RADIO = 0x00040000,
FP_ICON_HD = 0x01000001,
FP_ICON_1080P = 0x02000001,
FP_ICON_1080I = 0x03000001,
FP_ICON_720P = 0x04000001,
FP_ICON_480P = 0x05000001,
FP_ICON_480I = 0x06000001,
FP_ICON_MP3 = 0x08000001,
FP_ICON_PLAY = 0x09000001,
FP_ICON_PAUSE = 0x0A000001,
FP_ICON_CAM1 = 0x0B000001, /* record */
/* only for frontpanels with VFD */
FP_ICON_HDD = 0x00000800,
FP_ICON_POWER = 0x00004000,
FP_ICON_TIMESHIFT = 0x00008000,
FP_ICON_SIGNAL = 0x00010000,
FP_ICON_USB = 0x07000001,
FP_ICON_COL1 = 0x09000002,
FP_ICON_COL2 = 0x0B000002,
FP_ICON_CAM2 = 0x0C000001,
/* only for frontpanels with OLED */
FP_ICON_SD = 0x01000002,
FP_ICON_576P = 0x02000002,
FP_ICON_576I = 0x03000002,
FP_ICON_MP2 = 0x07000002,
FP_ICON_DTS = 0x08000002
} fp_icon;
typedef enum {
FP_FLAG_NONE = 0x00,
FP_FLAG_SCROLL_ON = 0x01, /* switch scrolling on */
FP_FLAG_SCROLL_LTR = 0x02, /* scroll from left to right instead of default right to left direction (i.e. for arabic text) */
FP_FLAG_SCROLL_SIO = 0x04, /* start/stop scrolling with empty screen (scroll in/out) */
FP_FLAG_SCROLL_DELAY = 0x08, /* delayed scroll start */
FP_FLAG_ALIGN_LEFT = 0x10, /* align the text in display from the left (default) */
FP_FLAG_ALIGN_RIGHT = 0x20, /* align the text in display from the right (arabic) */
FP_FLAG_UPDATE_SCROLL_POS = 0x40 /* update the current position for scrolling */
} fp_flag;
typedef struct {
unsigned char brightness;
unsigned char flags;
unsigned char current_hour;
unsigned char current_minute;
unsigned char timer_minutes_hi;
unsigned char timer_minutes_lo;
} fp_standby_data_t;
typedef enum {
FP_LED_1_ON = 0x81,
FP_LED_2_ON = 0x82,
FP_LED_3_ON = 0x83,
FP_LED_1_OFF = 0x01,
FP_LED_2_OFF = 0x02,
FP_LED_3_OFF = 0x03
} fp_led_ctrl_t;
typedef struct {
unsigned char source;
unsigned char time_minutes_hi;
unsigned char time_minutes_lo;
} fp_wakeup_data_t;
typedef enum {
FP_WAKEUP_SOURCE_TIMER = 0x01,
FP_WAKEUP_SOURCE_BUTTON = 0x02,
FP_WAKEUP_SOURCE_REMOTE = 0x04,
FP_WAKEUP_SOURCE_PWLOST = 0x7F,
FP_WAKEUP_SOURCE_POWER = 0xFF
} fp_wakeup_source;
typedef struct {
unsigned short addr;
unsigned short cmd;
} fp_standby_cmd_data_t;
#define IOC_FP_SET_BRIGHT _IOW(0xDE, 1, unsigned char) /* set the display brighness in 16 steps between 0 to 15 */
#define IOC_FP_CLEAR_ALL _IOW(0xDE, 2, unsigned int) /* clear the entire display (both text and icons) */
#define IOC_FP_SET_TEXT _IOW(0xDE, 3, char*) /* set a text to be displayed on the display. If arg == NULL, the text is cleared */
#define IOC_FP_SET_ICON _IOW(0xDE, 4, fp_icon) /* switch the given icon on */
#define IOC_FP_CLEAR_ICON _IOW(0xDE, 5, fp_icon) /* switch the given icon off */
#define IOC_FP_SET_OUTPUT _IOW(0xDE, 6, unsigned char) /* switch the given output on (supported by the controller, but not used in the hardware) */
#define IOC_FP_CLEAR_OUTPUT _IOW(0xDE, 7, unsigned char) /* switch the given output off (supported by the controller, but not used in the hardware) */
#define IOC_FP_STANDBY _IOW(0xDE, 8, fp_standby_data_t *)/* switch the vfd/psu in standby (NEO and above only) */
#define IOC_FP_LED_CTRL _IOW(0xDE, 9, unsigned char) /* control the Frontpanles LED's (NEO and above only) */
#define IOC_FP_GET_WAKEUP _IOW(0xDE, 10, fp_wakeup_data_t *) /* get wakeup data (NEO and above only) */
#define IOC_FP_STANDBY_CMD _IOW(0xDE, 11, fp_standby_cmd_data_t *) /* get wakeup data (NEO and above only) */
#endif /* __CS_FRONTPANEL_H__ */

View File

@@ -0,0 +1,29 @@
/*******************************************************************************/
/* */
/* libcoolstream/cs_types.h */
/* Public header file for CoolStream Public API */
/* */
/* (C) 2010 CoolStream International */
/* */
/* $Id:: $ */
/*******************************************************************************/
#ifndef __CS_TYPES_H_
#define __CS_TYPES_H_
typedef enum
{
AVSYNC_DISABLED,
AVSYNC_ENABLED,
AVSYNC_AUDIO_IS_MASTER
} AVSYNC_TYPE;
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_

View File

@@ -0,0 +1,115 @@
/*
* Driver for the Samsung HCR-13SS22 VF-Display connected to the Conexant
* CX2450x (Nevis) SoC via Coolstream VFD-Controller - public definititons.
*
* Copyright (C) 2008 Coolstream International Limited
*/
#ifndef __CS_VFD__
#define __CS_VFD__
typedef enum {
/* for all frontpanels with VFD or OLED */
VFD_ICON_NONE = 0x00000000,
VFD_ICON_BAR8 = 0x00000004,
VFD_ICON_BAR7 = 0x00000008,
VFD_ICON_BAR6 = 0x00000010,
VFD_ICON_BAR5 = 0x00000020,
VFD_ICON_BAR4 = 0x00000040,
VFD_ICON_BAR3 = 0x00000080,
VFD_ICON_BAR2 = 0x00000100,
VFD_ICON_BAR1 = 0x00000200,
VFD_ICON_FRAME = 0x00000400,
VFD_ICON_MUTE = 0x00001000,
VFD_ICON_DOLBY = 0x00002000,
VFD_ICON_TV = 0x00020000,
VFD_ICON_RADIO = 0x00040000,
VFD_ICON_HD = 0x01000001,
VFD_ICON_1080P = 0x02000001,
VFD_ICON_1080I = 0x03000001,
VFD_ICON_720P = 0x04000001,
VFD_ICON_480P = 0x05000001,
VFD_ICON_480I = 0x06000001,
VFD_ICON_MP3 = 0x08000001,
VFD_ICON_PLAY = 0x09000001,
VFD_ICON_PAUSE = 0x0A000001,
VFD_ICON_CAM1 = 0x0B000001,
/* only for frontpanels with VFD */
VFD_ICON_HDD = 0x00000800,
VFD_ICON_POWER = 0x00004000,
VFD_ICON_TIMESHIFT = 0x00008000,
VFD_ICON_SIGNAL = 0x00010000,
VFD_ICON_USB = 0x07000001,
VFD_ICON_COL1 = 0x09000002,
VFD_ICON_COL2 = 0x0B000002,
VFD_ICON_CAM2 = 0x0C000001,
/* only for frontpanels with OLED */
VFD_ICON_SD = 0x01000002,
VFD_ICON_576P = 0x02000002,
VFD_ICON_576I = 0x03000002,
VFD_ICON_MP2 = 0x07000002,
VFD_ICON_DTS = 0x08000002
} vfd_icon;
typedef enum
{
VFD_FLAG_NONE = 0x00,
VFD_FLAG_SCROLL_ON = 0x01, /* switch scrolling on */
VFD_FLAG_SCROLL_LTR = 0x02, /* scroll from left to right instead of default right to left direction (i.e. for arabic text) */
VFD_FLAG_SCROLL_SIO = 0x04, /* start/stop scrolling with empty screen (scroll in/out) */
VFD_FLAG_SCROLL_DELAY = 0x08, /* delayed scroll start */
VFD_FLAG_ALIGN_LEFT = 0x10, /* align the text in display from the left (default) */
VFD_FLAG_ALIGN_RIGHT = 0x20, /* align the text in display from the right (arabic) */
VFD_FLAG_UPDATE_SCROLL_POS = 0x40 /* update the current position for scrolling */
} vfd_flag;
typedef struct {
unsigned char brightness;
unsigned char flags;
unsigned char current_hour;
unsigned char current_minute;
unsigned char timer_minutes_hi;
unsigned char timer_minutes_lo;
} standby_data_t;
typedef enum {
VFD_LED_1_ON = 0x81,
VFD_LED_2_ON = 0x82,
VFD_LED_3_ON = 0x83,
VFD_LED_1_OFF = 0x01,
VFD_LED_2_OFF = 0x02,
VFD_LED_3_OFF = 0x03
} vfd_led_ctrl_t;
typedef struct {
unsigned char source;
unsigned char time_minutes_hi;
unsigned char time_minutes_lo;
} wakeup_data_t;
typedef enum {
WAKEUP_SOURCE_TIMER = 0x01,
WAKEUP_SOURCE_BUTTON = 0x02,
WAKEUP_SOURCE_REMOTE = 0x04,
WAKEUP_SOURCE_PWLOST = 0x7F,
WAKEUP_SOURCE_POWER = 0xFF
} wakeup_source;
typedef struct {
unsigned short addr;
unsigned short cmd;
} standbycmd_data_t;
#define IOC_VFD_SET_BRIGHT _IOW(0xDE, 1, unsigned char) /* set the display brighness in 16 steps between 0 to 15 */
#define IOC_VFD_CLEAR_ALL _IOW(0xDE, 2, unsigned int) /* clear the entire display (both text and icons) */
#define IOC_VFD_SET_TEXT _IOW(0xDE, 3, char*) /* set a text to be displayed on the display. If arg == NULL, the text is cleared */
#define IOC_VFD_SET_ICON _IOW(0xDE, 4, vfd_icon) /* switch the given icon on */
#define IOC_VFD_CLEAR_ICON _IOW(0xDE, 5, vfd_icon) /* switch the given icon off */
#define IOC_VFD_SET_OUTPUT _IOW(0xDE, 6, unsigned char) /* switch the given output on (supported by the controller, but not used in the hardware) */
#define IOC_VFD_CLEAR_OUTPUT _IOW(0xDE, 7, unsigned char) /* switch the given output off (supported by the controller, but not used in the hardware) */
#define IOC_VFD_STANDBY _IOW(0xDE, 8, standby_data_t *)/* switch the vfd/psu in standby (NEO and above only) */
#define IOC_VFD_LED_CTRL _IOW(0xDE, 9, unsigned char) /* control the Frontpanles LED's (NEO and above only) */
#define IOC_VFD_GET_WAKEUP _IOW(0xDE, 10,wakeup_data_t *) /* get wakeup data (NEO and above only) */
#define IOC_VFD_STANDBY_CMD _IOW(0xDE, 11,standbycmd_data_t *) /* get wakeup data (NEO and above only) */
#endif /* __CS_VFD__ */

View File

@@ -0,0 +1,77 @@
/*******************************************************************************/
/* */
/* libcoolstream/dmx_cs.h */
/* Public header for demux API */
/* */
/* (C) 2008 CoolStream International */
/* */
/* $Id:: $ */
/*******************************************************************************/
#ifndef __DEMUX_CS_H_
#define __DEMUX_CS_H_
#include <string>
#include "cs_types.h"
#define DEMUX_POLL_TIMEOUT 0 // timeout in ms
#define MAX_FILTER_LENGTH 12 // maximum number of filters
#ifdef DMX_FILTER_SIZE
#error
#endif
#define DMX_FILTER_SIZE MAX_FILTER_LENGTH
#define MAX_DMX_UNITS 4
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 cDemuxData;
class cDemux {
private:
DMX_CHANNEL_TYPE type;
int timeout;
unsigned short pid;
AVSYNC_TYPE syncMode;
bool enabled;
int unit;
cDemuxData * dd;
public:
cDemux(int num = 0);
~cDemux();
//
bool Open(DMX_CHANNEL_TYPE pes_type, void * hVideoBuffer = NULL, int uBufferSize = 8192);
void Close(void);
bool Start(bool record = false);
bool Stop(void);
int Read(unsigned char *buff, int len, int Timeout = 0);
bool SetSource(int source);
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 AddSectionFilter(unsigned short Pid, const unsigned char * const Filter, const unsigned char * const Mask, int len, const unsigned char * const nMask = NULL);
bool pesFilter(const unsigned short Pid);
bool addPid(unsigned short Pid);
void SetSyncMode(AVSYNC_TYPE SyncMode);
void *getBuffer(void);
void *getChannel(void);
void getSTC(int64_t *STC);
DMX_CHANNEL_TYPE getChannelType(void) { return type; };
int getUnit(void) { return unit; };
unsigned short GetPID(void) { return pid; }
int GetSource();
static bool SetSource(int unit, int source);
static int GetSource(int unit);
};
#endif //__DMX_CS_H_

View File

@@ -0,0 +1,54 @@
/*******************************************************************************/
/* */
/* libcoolstream/mmi.h */
/* Public header file for CoolStream Public CA MMI API */
/* */
/* (C) 2010 CoolStream International */
/* */
/* $Id:: $ */
/*******************************************************************************/
#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 enum {
MMI_TOP_MENU_SUBS = 1,
MMI_TOP_MENU_EVENTS,
MMI_TOP_MENU_TOKENS,
MMI_TOP_MENU_PIN,
MMI_TOP_MENU_MATURE,
MMI_TOP_MENU_ABOUT
} MMI_MENU_CURRENT;
typedef enum {
MMI_MENU_LEVEL_MAIN = 0,
MMI_MENU_LEVEL_MATURE,
MMI_MENU_LEVEL_ASK_PIN_MATURE
} MMI_MENU_LEVEL;
typedef enum {
MMI_PIN_LEVEL_ASK_OLD = 0,
MMI_PIN_LEVEL_CHECK_CURRENT,
MMI_PIN_LEVEL_ASK_REPEAT,
MMI_PIN_LEVEL_CHECK_AND_CHANGE
} MMI_PIN_LEVEL;
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 enquiryText[MAX_MMI_TEXT_LEN];
} MMI_ENQUIRY_INFO;
#endif // __MMI_H_

View File

@@ -0,0 +1,84 @@
/*
* public definitions for the CX2450x Infrared receiver driver
*
* Copyright (C) 2008-2011 Coolstream International Limited
*
*/
#ifndef __NEVIS_IR_H__
#define __NEVIS_IR_H__
typedef enum
{
IR_PROTOCOL_UNKNOWN = 0x00000,
IR_PROTOCOL_RMAP = 0x00001, /* Ruwido rMAP */
IR_PROTOCOL_RMAP_E = 0x00002, /* Ruwido rMAP with extension for MNC Ltd sp. z o.o. */
IR_PROTOCOL_NRC17 = 0x00004, /* Nokia NRC17 */
IR_PROTOCOL_JVC = 0x00008, /* JVC */
IR_PROTOCOL_RCA = 0x00010, /* RCA */
IR_PROTOCOL_PSD = 0x00020, /* Precision Squared (not yet supported) */
IR_PROTOCOL_RC5 = 0x00040, /* Philips RC5 */
IR_PROTOCOL_RCMM = 0x00080, /* Philips RCMM */
IR_PROTOCOL_RECS80 = 0x00100, /* Philips RECS80 */
IR_PROTOCOL_NEC = 0x00200, /* NEC */
IR_PROTOCOL_NECE = 0x00400, /* NEC with 16 bit address capability */
IR_PROTOCOL_SCA = 0x00800, /* Scientific Atlanta */
IR_PROTOCOL_MATSUSHITA = 0x01000, /* Matsushita (Technics/Panasonics) */
IR_PROTOCOL_SONY = 0x02000, /* Sony SIRC 12 bit */
IR_PROTOCOL_SONY15 = 0x04000, /* Sony SIRC 15 bit */
IR_PROTOCOL_SONY20 = 0x08000, /* Sony SIRC 20 bit */
IR_PROTOCOL_SONY24 = 0x10000, /* Sony SIRC 24 bit */
IR_PROTOCOL_ALL = 0x1FFFF
} ir_protocol_t;
typedef enum
{
FP_MODE_KEYS_DISABLED = 0,
FP_MODE_KEYS_ENABLED = 1
} fp_mode_t;
#define EVENT_KEY_UP 0
#define EVENT_KEY_DOWN 1
#define NEVIS_IR_DEVICE_NAME "IR_NEVIS"
/*******************************************************************************/
/* DEBUG options */
/*******************************************************************************/
#define DBG_NONE 0x00000000 /* no debug at all */
#define DBG_IR_SYSTEM 0x00000001 /* IR: low level informations */
#define DBG_IR_DECODE 0x00000002 /* IR: informations from the IR protocol decoder */
#define DBG_OUTPUT_QUEUE 0x00000004 /* IR: show data from the outgoing queue (from driver to the client(s) ) */
#define DBG_IR_FOPS 0x00000008 /* IR: informations about filoe operations (ioctl's) */
#define DBG_VFD_SYSTEM 0x00010000 /* VFD: low level informations */
#define DBG_VFD_FOPS 0x00080000 /* VFD: informations about filoe operations (ioctl's) */
/*******************************************************************************/
/* ioctl's */
/*******************************************************************************/
/* set the IR-protocols to listen for. */
#define IOC_IR_SET_PRI_PROTOCOL _IOW(0xDD, 1, ir_protocol_t) /* set the primary IR-protocol */
#define IOC_IR_SET_SEC_PROTOCOL _IOW(0xDD, 2, ir_protocol_t) /* set the secondary IR-protocol */
/* some IR-protocols can handle different device addresses. */
#define IOC_IR_SET_PRI_ADDRESS _IOW(0xDD, 3, unsigned int) /* set the primary IR-address */
#define IOC_IR_SET_SEC_ADDRESS _IOW(0xDD, 4, unsigned int) /* set the secondary IR-address */
/* defines the delay time between two pulses in milliseconds */
#define IOC_IR_SET_F_DELAY _IOW(0xDD, 5, unsigned int) /* set the delay time before the first repetition */
#define IOC_IR_SET_X_DELAY _IOW(0xDD, 6, unsigned int) /* set the delay time between all other repetitions */
/* load key mappings to translate from raw IR to Linux Input */
#define IOC_IR_SET_PRI_KEYMAP _IOW(0xDD, 7, unsigned short *) /* set the primary keymap [num entries],[entry 1],[entry 2],...,[entry n] (max 0xFFFF entries) */
#define IOC_IR_SET_SEC_KEYMAP _IOW(0xDD, 8, unsigned short *) /* set the secondary keymap [num entries],[entry 1],[entry 2],...,[entry n] (max 0xFFFF entries) */
/* frontpanel button options */
#define IOC_IR_SET_FP_MODE _IOW(0xDD, 9, fp_mode_t) /* enable/disable frontpanel buttons */
/* informative stuff */
#define IOC_IR_GET_PROTOCOLS _IOR(0xDD, 10, ir_protocol_t) /* reports a bitmask of all supported ir_protocols */
#endif /* __NEVIS_IR_H__ */

View File

@@ -0,0 +1 @@
#include "playback_cs.h"

View File

@@ -0,0 +1,78 @@
/*******************************************************************************/
/* */
/* libcoolstream/playback_cs.h */
/* Public header file for playback API */
/* */
/* (C) 2008 CoolStream International */
/* */
/* $Id:: $ */
/*******************************************************************************/
#ifndef __PLAYBACK_CS_H_
#define __PLAYBACK_CS_H_
#include <string>
#include <stdint.h>
#include <vector>
typedef enum {
PLAYMODE_TS = 0,
PLAYMODE_FILE
} playmode_t;
class cPlaybackData;
typedef struct {
bool enabled;
uint16_t pid;
uint16_t ac3flags;
std::string lang;
std::string codec_name;
} playback_audio_pid_info_t;
#define MAX_PLAYBACK_PIDS 40
class cPlayback {
private:
cPlaybackData * pd;
bool enabled;
bool paused;
bool playing;
int unit;
int nPlaybackFD;
int video_type;
int mSpeed;
playmode_t playMode;
//
void Attach(void);
void Detach(void);
bool SetAVDemuxChannel(bool On, bool Video = true, bool Audio = true);
public:
cPlayback(int num = 0);
~cPlayback();
bool Open(playmode_t PlayMode);
void Close(void);
bool Start(char * filename, unsigned short vpid, int vtype, unsigned short apid, int audio_flag, unsigned int duration = 0);
bool Start(std::string filename, std::string headers = "");
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 FindAllPids(playback_audio_pid_info_t *audiopids, uint16_t size, uint16_t *numpida);
void FindAllPids(uint16_t *apids, unsigned short *ac3flags, uint16_t *numpida, std::string *language);
void FindAllSubs(uint16_t *pids, unsigned short *supported, uint16_t *numpida, std::string *language);
bool SelectSubtitles(int pid, std::string charset = "");
void GetChapters(std::vector<int> &positions, std::vector<std::string> &titles);
void RequestAbort();
void GetTitles(std::vector<int> &playlists, std::vector<std::string> &titles, int &current);
void SetTitle(int title);
uint64_t GetReadCount(void);
};
#endif // __PLAYBACK_CS_H_

View File

@@ -0,0 +1,60 @@
/*******************************************************************************/
/* */
/* libcoolstream/pwrmngr.h */
/* Private header of the Powermanager API */
/* */
/* (C) 2010 CoolStream International */
/* */
/*******************************************************************************/
#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,40 @@
/*******************************************************************************/
/* */
/* libcoolstream/record_cs.h */
/* Public header file for record API */
/* */
/* (C) 2008 CoolStream International */
/* */
/* $Id:: $ */
/*******************************************************************************/
#ifndef __RECORD_CS_H_
#define __RECORD_CS_H_
#include <string>
class cRecordData;
#define REC_STATUS_OK 0
#define REC_STATUS_SLOW 1
#define REC_STATUS_OVERFLOW 2
class cRecord {
private:
cRecordData * rd;
bool enabled;
int unit;
public:
cRecord(int num = 0);
~cRecord();
bool Open();
void Close(void);
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

@@ -0,0 +1,54 @@
/*******************************************************************************/
/* */
/* control\tsrouter.h */
/* Public header file for CoolStream Kernel TS Router API */
/* */
/* (C) 2010 CoolStream International */
/* */
/* $Id:: $ */
/*******************************************************************************/
#ifndef __TSROUTER_H
#define __TSROUTER_H
#define HSDP_CI_DATA_OUT 2
#define HSDP_CI_DATA_IN 3
#define HSDP_SAT_PORT 4
#define HSDP_CAB_PORT 5
typedef struct _tsrouter_hsdp_config {
u8 port;
u32 port_ctrl;
u32 pkt_ctrl;
u32 clk_ctrl;
u32 mux;
u32 int_en;
/* more ? */
} tsrouter_hsdp_config_t;
typedef struct _tsrouter_tsp_config {
u8 port;
u32 port_ctrl;
u32 mux;
} tsrouter_tsp_config_t;
#ifdef __KERNEL__
extern int cs_tsrouter_init(void);
extern void cs_tsrouter_exit(void);
extern void cs_tsx_hsdp_init_port(u32 port, u32 ctrl);
extern void cs_tsx_tsp_init_port(u32 port, u32 hsdp_port);
extern void cs_tsx_hsdp_get_port_config(tsrouter_hsdp_config_t *conf);
extern void cs_tsx_tsp_get_port_config(tsrouter_tsp_config_t *conf);
extern void cs_tsx_hsdp_set_port_config(const tsrouter_hsdp_config_t *conf);
extern void cs_tsx_tsp_set_port_config(const tsrouter_tsp_config_t *conf);
extern void cs_tsx_hsdp_get_port_pll(unsigned int port, unsigned int *pll_index);
extern void cs_tsx_hsdp_set_port_pll(unsigned int port, unsigned int pll_index);
extern void cs_tsx_hsdp_get_port_speed(unsigned int port, unsigned int *speed);
extern void cs_tsx_hsdp_set_port_speed(unsigned int port, unsigned int speed);
#endif
#endif /* __TSROUTER_H */

View File

@@ -0,0 +1,240 @@
/*******************************************************************************/
/* */
/* libcoolstream/video_cs.h */
/* Public header file for video API */
/* */
/* (C) 2008 CoolStream International */
/* */
/*******************************************************************************/
#ifndef __VIDEO_CS_H_
#define __VIDEO_CS_H_
#include <cs_vfd.h>
#include <control.h>
#include <dmx_cs.h>
#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,
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_MAX = VIDEO_STD_AUTO
} VIDEO_STD;
typedef enum {
VIDEO_HDMI_CEC_MODE_OFF = 0,
VIDEO_HDMI_CEC_MODE_TUNER,
VIDEO_HDMI_CEC_MODE_RECORDER
} VIDEO_HDMI_CEC_MODE;
typedef enum
{
VIDEO_CONTROL_BRIGHTNESS = 0,
VIDEO_CONTROL_CONTRAST,
VIDEO_CONTROL_SATURATION,
VIDEO_CONTROL_HUE,
VIDEO_CONTROL_SHARPNESS,
VIDEO_CONTROL_MAX = VIDEO_CONTROL_SHARPNESS
} VIDEO_CONTROL;
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;
unsigned int unit;
cDemux *demux;
//
int SelectAutoFormat();
void ScalePic();
public:
/* constructor & destructor */
cVideo(int mode, void * hChannel, void * hBuffer, unsigned int Unit = 0);
~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;};
/* 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(bool 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);
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);
};
#endif // __VIDEO_CS_H_