diff --git a/configure.ac b/configure.ac index b5a78864f..13b4b18be 100644 --- a/configure.ac +++ b/configure.ac @@ -83,6 +83,7 @@ lib/xmltree/Makefile lib/controldclient/Makefile lib/sectionsdclient/Makefile lib/timerdclient/Makefile +lib/libtriple/Makefile lib/libtuxtxt/Makefile lib/libdvbsub/Makefile lib/libupnpclient/Makefile diff --git a/lib/Makefile.am b/lib/Makefile.am index 287c9d64f..e5e2ab1a8 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -10,3 +10,8 @@ SUBDIRS = \ libtuxtxt \ libdvbsub \ libupnpclient + +if BOXTYPE_TRIPLE +SUBDIRS += \ + libtriple +endif diff --git a/lib/libtriple/Makefile.am b/lib/libtriple/Makefile.am new file mode 100644 index 000000000..96560a21f --- /dev/null +++ b/lib/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/lib/libtriple/init_cs.h b/lib/libtriple/init_cs.h new file mode 100644 index 000000000..5894a14d0 --- /dev/null +++ b/lib/libtriple/init_cs.h @@ -0,0 +1,2 @@ +#warning using init_cs.h from libtriple +#include "init_td.h" diff --git a/lib/libtriple/playback.h b/lib/libtriple/playback.h new file mode 100644 index 000000000..6e6b4c5ae --- /dev/null +++ b/lib/libtriple/playback.h @@ -0,0 +1 @@ +#include "playback_td.h" diff --git a/lib/libtriple/td-compat/td-audio-compat.h b/lib/libtriple/td-compat/td-audio-compat.h new file mode 100644 index 000000000..3e0b4a7ff --- /dev/null +++ b/lib/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/lib/libtriple/td-compat/td-demux-compat.h b/lib/libtriple/td-compat/td-demux-compat.h new file mode 100644 index 000000000..8feacfed3 --- /dev/null +++ b/lib/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/lib/libtriple/td-compat/td-frontend-compat.h b/lib/libtriple/td-compat/td-frontend-compat.h new file mode 100644 index 000000000..46781ce89 --- /dev/null +++ b/lib/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/lib/libtriple/td-compat/td-value-compat.h b/lib/libtriple/td-compat/td-value-compat.h new file mode 100644 index 000000000..f7bb9523c --- /dev/null +++ b/lib/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/lib/libtriple/td-compat/td-video-compat.h b/lib/libtriple/td-compat/td-video-compat.h new file mode 100644 index 000000000..137a3467a --- /dev/null +++ b/lib/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__ */ diff --git a/src/Makefile.am b/src/Makefile.am index 4a76c9e7c..8742fa375 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -19,6 +19,9 @@ INCLUDES = \ if BOXTYPE_COOL INCLUDES += -I$(top_srcdir)/lib/libcoolstream endif +if BOXTYPE_TRIPLE +INCLUDES += -I$(top_srcdir)/lib/libtriple +endif bin_PROGRAMS = neutrino @@ -76,4 +79,8 @@ neutrino_LDADD += \ -lOpenThreads \ -lnxp endif +if BOXTYPE_TRIPLE +neutrino_LDADD += \ + $(top_builddir)/lib/libtriple/libtriple.a +endif diff --git a/src/driver/Makefile.am b/src/driver/Makefile.am index d0fcb781e..f133cf648 100644 --- a/src/driver/Makefile.am +++ b/src/driver/Makefile.am @@ -40,6 +40,10 @@ libneutrino_driver_a_SOURCES += \ INCLUDES += \ -I$(top_srcdir)/lib/libcoolstream endif +if BOXTYPE_TRIPLE +INCLUDES += \ + -I$(top_srcdir)/lib/libtriple +endif libneutrino_driver_netfile_a_SOURCES = netfile.cpp diff --git a/src/gui/Makefile.am b/src/gui/Makefile.am index 81ab5896e..e42a09f5e 100644 --- a/src/gui/Makefile.am +++ b/src/gui/Makefile.am @@ -30,6 +30,9 @@ INCLUDES = \ if BOXTYPE_COOL INCLUDES += -I$(top_srcdir)/lib/libcoolstream endif +if BOXTYPE_TRIPLE +INCLUDES += -I$(top_srcdir)/lib/libtriple +endif noinst_LIBRARIES = libtimerlist.a libneutrino_gui.a libneutrino_gui2.a diff --git a/src/system/Makefile.am b/src/system/Makefile.am index a018a5452..4899bec4f 100644 --- a/src/system/Makefile.am +++ b/src/system/Makefile.am @@ -15,6 +15,9 @@ INCLUDES = \ if BOXTYPE_COOL INCLUDES += -I$(top_srcdir)/lib/libcoolstream endif +if BOXTYPE_TRIPLE +INCLUDES += -I$(top_srcdir)/lib/libtriple +endif noinst_LIBRARIES = libneutrino_system.a diff --git a/src/zapit/src/Makefile.am b/src/zapit/src/Makefile.am index c774b5719..94f11c0e9 100644 --- a/src/zapit/src/Makefile.am +++ b/src/zapit/src/Makefile.am @@ -12,6 +12,9 @@ INCLUDES = \ if BOXTYPE_COOL INCLUDES += -I$(top_srcdir)/lib/libcoolstream endif +if BOXTYPE_TRIPLE +INCLUDES += -I$(top_srcdir)/lib/libtriple +endif noinst_LIBRARIES = libzapit.a