commit 9e5ada89b7c35b208291e36546a2a5d35fae0bb0 Author: Stefan Seyfried Date: Sat Dec 25 17:43:09 2010 +0000 add "libtriple" skeleton This should provide the same functionality as libcoolstream does, but for the TripleDragon Add td-compat directory with includes to convert values from TD api to DVB api and back. git-svn-id: http://www.coolstreamtech.de/coolstream_public_svn/THIRDPARTY/applications/neutrino-experimental@960 e54a6e83-5905-42d5-8d5c-058d10e6a962 Origin commit data ------------------ Branch: master Commit: https://github.com/neutrino-images/ni-libstb-hal/commit/25e8c83e630ec647afb272ee2c8178755ad60126 Author: Stefan Seyfried Date: 2010-12-25 (Sat, 25 Dec 2010) ------------------ This commit was generated by Migit diff --git a/libtriple/Makefile.am b/libtriple/Makefile.am new file mode 100644 index 0000000..96560a2 --- /dev/null +++ b/libtriple/Makefile.am @@ -0,0 +1,21 @@ +INCLUDES = \ + -I$(top_srcdir)/src \ + -I$(top_srcdir)/lib \ + -I$(top_srcdir)/src/zapit/include \ + -I$(top_srcdir)/lib/connection \ + -I$(top_srcdir)/lib/libeventserver + +noinst_LIBRARIES = libtriple.a + +AM_CPPFLAGS = -fno-rtti -fno-exceptions + +libtriple_a_SOURCES = \ + dmx_td.cpp \ + video_td.cpp \ + audio_td.cpp \ + init_td.cpp \ + playback_td.cpp \ + pwrmngr.cpp \ + record_td.cpp + +#libtriple_a_LIBADD = $(top_builddir)/src/driver/libneutrino_driver.a diff --git a/libtriple/init_cs.h b/libtriple/init_cs.h new file mode 100644 index 0000000..5894a14 --- /dev/null +++ b/libtriple/init_cs.h @@ -0,0 +1,2 @@ +#warning using init_cs.h from libtriple +#include "init_td.h" diff --git a/libtriple/playback.h b/libtriple/playback.h new file mode 100644 index 0000000..6e6b4c5 --- /dev/null +++ b/libtriple/playback.h @@ -0,0 +1 @@ +#include "playback_td.h" diff --git a/libtriple/td-compat/td-audio-compat.h b/libtriple/td-compat/td-audio-compat.h new file mode 100644 index 0000000..3e0b4a7 --- /dev/null +++ b/libtriple/td-compat/td-audio-compat.h @@ -0,0 +1,38 @@ +/* + * compatibility stuff for Tripledragon audio API + * + * (C) 2009 Stefan Seyfried + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#ifndef __td_audio_compat_h__ +#define __td_audio_compat_h__ + +#include +// types +typedef enum { + AUDIO_SOURCE_DEMUX = AUD_SOURCE_DEMUX, + AUDIO_SOURCE_MEMORY = AUD_SOURCE_MEMORY +} audio_stream_source_t; +#define audio_channel_select_t audChannel_t +// ioctls +#define AUDIO_CHANNEL_SELECT MPEG_AUD_SELECT_CHANNEL +#define AUDIO_SELECT_SOURCE MPEG_AUD_SELECT_SOURCE +#define AUDIO_PLAY MPEG_AUD_PLAY +#define AUDIO_STOP MPEG_AUD_STOP +#define AUDIO_SET_MUTE MPEG_AUD_SET_MUTE + +#endif /* __td_audio_compat_h__ */ diff --git a/libtriple/td-compat/td-demux-compat.h b/libtriple/td-compat/td-demux-compat.h new file mode 100644 index 0000000..8feacfe --- /dev/null +++ b/libtriple/td-compat/td-demux-compat.h @@ -0,0 +1,45 @@ +/* + * compatibility stuff for Tripledragon demux API + * + * (C) 2009 Stefan Seyfried + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#ifndef __td_demux_compat_h__ +#define __td_demux_compat_h__ + +#include +#include +// types +#define dmx_output_t OutDevice +#define dmx_pes_type_t PesType +#define dmx_sct_filter_params demux_filter_para +#define dmx_pes_filter_params demux_pes_para +#define pes_type pesType +// defines +#define DMX_FILTER_SIZE FILTER_LENGTH +#define DMX_ONESHOT XPDF_ONESHOT +#define DMX_CHECK_CRC 0 // TD checks CRC by default +#define DMX_IMMEDIATE_START XPDF_IMMEDIATE_START +#define DMX_OUT_DECODER OUT_DECODER +// ioctls +#define DMX_SET_FILTER DEMUX_FILTER_SET +#define DMX_SET_PES_FILTER DEMUX_FILTER_PES_SET +#define DMX_START DEMUX_START +#define DMX_STOP DEMUX_STOP +#define DMX_SET_BUFFER_SIZE DEMUX_SET_BUFFER_SIZE + +#endif /* __td_demux_compat_h__ */ diff --git a/libtriple/td-compat/td-frontend-compat.h b/libtriple/td-compat/td-frontend-compat.h new file mode 100644 index 0000000..46781ce --- /dev/null +++ b/libtriple/td-compat/td-frontend-compat.h @@ -0,0 +1,120 @@ +/* + * compatibility stuff for Tripledragon frontend API + * + * (C) 2009 Stefan Seyfried + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#ifndef __td_frontend_compat_h__ +#define __td_frontend_compat_h__ + +#ifdef __cplusplus +extern "C" { +#endif + #include +#ifdef __cplusplus +} +#endif + +/* I know that those are different. But functions that get a + dvb_frontend_parameters struct passed on dbox/dreambox will most likely + get a tunersetup struct on TD, so it keeps the differences in headers + and function prototypes small. Of course, the functions itself will have + #ifdef TRIPLEDRAGON or similar... */ +#define dvb_frontend_parameters tunersetup + +/* compat stuff for settings.cpp */ +enum { + INVERSION_OFF, + INVERSION_ON, + INVERSION_AUTO +}; +typedef enum fe_code_rate { + FEC_NONE = 0, + FEC_1_2, + FEC_2_3, + FEC_3_4, + FEC_4_5, + FEC_5_6, + FEC_6_7, + FEC_7_8, + FEC_8_9, + FEC_AUTO +} fe_code_rate_t; + +enum td_code_rate { + TD_FEC_AUTO = 0, + TD_FEC_1_2, + TD_FEC_2_3, + TD_FEC_3_4, + TD_FEC_5_6, + TD_FEC_7_8 +}; + +typedef enum fe_sec_tone_mode { + SEC_TONE_ON, + SEC_TONE_OFF +} fe_sec_tone_mode_t; + +typedef enum fe_sec_voltage { + SEC_VOLTAGE_13, + SEC_VOLTAGE_18, + SEC_VOLTAGE_OFF +} fe_sec_voltage_t; + +typedef enum fe_sec_mini_cmd { + SEC_MINI_A, + SEC_MINI_B +} fe_sec_mini_cmd_t; + +struct dvb_diseqc_master_cmd { + unsigned char msg [6]; /* { framing, address, command, data [3] } */ + unsigned char msg_len; /* valid values are 3...6 */ +}; + +typedef enum fe_type { + FE_QPSK, + FE_QAM, + FE_OFDM, + FE_ATSC +} fe_type_t; + +struct dvb_frontend_info { +// char name[128]; + fe_type_t type; +#if 0 + __u32 frequency_min; + __u32 frequency_max; + __u32 frequency_stepsize; + __u32 frequency_tolerance; + __u32 symbol_rate_min; + __u32 symbol_rate_max; + __u32 symbol_rate_tolerance; /* ppm */ + __u32 notifier_delay; /* DEPRECATED */ + fe_caps_t caps; +#endif +}; + +struct dvb_frontend_event { + fe_status_t status; + tunersetup parameters; +}; + +#ifdef _DVBFRONTEND_H_ +#error _DVBFRONTEND_H_ included +#endif + +#endif /* __td_frontend_compat_h__ */ diff --git a/libtriple/td-compat/td-value-compat.h b/libtriple/td-compat/td-value-compat.h new file mode 100644 index 0000000..f7bb952 --- /dev/null +++ b/libtriple/td-compat/td-value-compat.h @@ -0,0 +1,93 @@ +/* + * compatibility stuff for conversion of Tripledragon API values to DVB API + * and vice versa + * + * (C) 2009 Stefan Seyfried + * + * Released under the GPL V2. + */ + +#ifndef _td_value_compat_ +#define _td_value_compat_ + +#undef FE_GET_INFO +#undef FE_READ_BER +#undef FE_READ_SIGNAL_STRENGTH +#undef FE_READ_SNR +#undef FE_READ_UNCORRECTED_BLOCKS +#undef FE_GET_EVENT +#undef FE_READ_STATUS +#undef FE_SET_PROPERTY +#undef FE_GET_EVENT +#undef FE_GET_EVENT +#undef FE_SET_PROPERTY +#undef FE_SET_TONE +#undef FE_ENABLE_HIGH_LNB_VOLTAGE +#undef FE_SET_VOLTAGE +#undef FE_DISEQC_SEND_MASTER_CMD +#undef FE_DISEQC_SEND_BURST +/* hack, linux/dvb/frontend.h already defines fe_status */ +#define fe_status td_fe_status +#define fe_status_t td_fe_status_t +#define FE_HAS_SIGNAL TD_FE_HAS_SIGNAL +#define FE_HAS_CARRIER TD_FE_HAS_CARRIER +#define FE_HAS_VITERBI TD_FE_HAS_VITERBI +#define FE_HAS_SYNC TD_FE_HAS_SYNC +#define FE_HAS_LOCK TD_FE_HAS_LOCK +#define FE_TIMEDOUT TD_FE_TIMEDOUT +#define FE_REINIT TD_FE_REINIT +#include +#undef fe_status +#undef fe_status_t +#undef FE_HAS_SIGNAL +#undef FE_HAS_CARRIER +#undef FE_HAS_VITERBI +#undef FE_HAS_SYNC +#undef FE_HAS_LOCK +#undef FE_TIMEDOUT +#undef FE_REINIT +enum td_code_rate { + TD_FEC_AUTO = 0, + TD_FEC_1_2, + TD_FEC_2_3, + TD_FEC_3_4, + TD_FEC_5_6, + TD_FEC_7_8 +}; + +static inline unsigned int dvbfec2tdfec(fe_code_rate_t fec) +{ + switch (fec) { + case FEC_1_2: // FEC_1_2 ... FEC_3_4 are equal to TD_FEC_1_2 ... TD_FEC_3_4 + case FEC_2_3: + case FEC_3_4: + return (unsigned int)fec; + case FEC_5_6: + return TD_FEC_5_6; + case FEC_7_8: + return TD_FEC_7_8; + default: + break; + } + return TD_FEC_AUTO; +} + +static inline fe_code_rate_t tdfec2dvbfec(unsigned int tdfec) +{ + switch (tdfec) + { + case TD_FEC_1_2: + case TD_FEC_2_3: + case TD_FEC_3_4: + return (fe_code_rate_t)tdfec; + case TD_FEC_5_6: + return FEC_5_6; + case TD_FEC_7_8: + return FEC_7_8; + default: + break; + } + return FEC_AUTO; +} + +#endif /* _td_value_compat_ */ diff --git a/libtriple/td-compat/td-video-compat.h b/libtriple/td-compat/td-video-compat.h new file mode 100644 index 0000000..137a346 --- /dev/null +++ b/libtriple/td-compat/td-video-compat.h @@ -0,0 +1,46 @@ +/* + * compatibility stuff for Tripledragon video API + * + * (C) 2009 Stefan Seyfried + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ifndef __td_video_compat_h__ +#define __td_video_compat_h__ + +#include +// types +#define video_format_t vidDispSize_t +#define video_displayformat_t vidDispMode_t +typedef enum { + VIDEO_SOURCE_DEMUX = VID_SOURCE_DEMUX, + VIDEO_SOURCE_MEMORY = VID_SOURCE_MEMORY +} video_stream_source_t; +typedef enum { + VIDEO_STOPPED, /* Video is stopped */ + VIDEO_PLAYING, /* Video is currently playing */ + VIDEO_FREEZED /* Video is freezed */ +} video_play_state_t; +//#define video_play_state_t vidState_t +// ioctls +#define VIDEO_SET_SYSTEM MPEG_VID_SET_DISPFMT +#define VIDEO_SET_FORMAT MPEG_VID_SET_DISPSIZE +#define VIDEO_SET_DISPLAY_FORMAT MPEG_VID_SET_DISPMODE +#define VIDEO_SELECT_SOURCE MPEG_VID_SELECT_SOURCE +#define VIDEO_PLAY MPEG_VID_PLAY +#define VIDEO_STOP MPEG_VID_STOP +#define VIDEO_SET_BLANK MPEG_VID_SET_BLANK + +#endif /* __td_video_compat_h__ */