[dvblast-devel] Add HAVE_{DVB,ASI}_SUPPORT config vars.
Georgi Chorbadzhiyski
git at videolan.org
Sat Aug 25 01:08:36 CEST 2012
dvblast | branch: master | Georgi Chorbadzhiyski <gf at unixsol.org> | Thu Aug 23 21:05:20 2012 +0300| [a24ae6ded163dc74996b759a487c6daca3a5af0f] | committer: Georgi Chorbadzhiyski
Add HAVE_{DVB,ASI}_SUPPORT config vars.
With this patch DVB/ASI support is enabled only on Linux systems.
> http://git.videolan.org/gitweb.cgi/dvblast.git/?a=commit;h=a24ae6ded163dc74996b759a487c6daca3a5af0f
---
asi.c | 4 ++++
comm.c | 2 ++
comm.h | 4 ++++
config.h | 5 +++++
dvb.c | 5 +++++
dvblast.c | 29 ++++++++++++++++++++++++++---
dvblastctl.c | 6 ++++++
en50221.c | 15 +++++++++++++++
8 files changed, 67 insertions(+), 3 deletions(-)
diff --git a/asi.c b/asi.c
index bc0a43e..90405eb 100644
--- a/asi.c
+++ b/asi.c
@@ -19,6 +19,9 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
+#include "config.h"
+
+#ifdef HAVE_ASI_SUPPORT
#include <stdlib.h>
#include <stdio.h>
@@ -322,3 +325,4 @@ void asi_Reset( void )
msg_Warn( NULL, "asi_Reset() do nothing" );
}
+#endif
diff --git a/comm.c b/comm.c
index bd881e4..f2bd0f4 100644
--- a/comm.c
+++ b/comm.c
@@ -129,6 +129,7 @@ void comm_Read( void )
i_answer_size = 0;
break;
+#ifdef HAVE_DVB_SUPPORT
case CMD_FRONTEND_STATUS:
i_answer = dvb_FrontendStatus( p_answer + COMM_HEADER_SIZE,
&i_answer_size );
@@ -163,6 +164,7 @@ void comm_Read( void )
case CMD_MMI_SEND_CHOICE:
i_answer = en50221_SendMMIObject( p_input, i_size - COMM_HEADER_SIZE );
break;
+#endif
case CMD_SHUTDOWN:
b_exit_now = 1;
diff --git a/comm.h b/comm.h
index 43f5c44..be2902e 100644
--- a/comm.h
+++ b/comm.h
@@ -12,11 +12,13 @@
* http://sam.zoy.org/wtfpl/COPYING for more details.
*****************************************************************************/
+#ifdef HAVE_DVB_SUPPORT
/* DVB Card Drivers */
#include <linux/dvb/version.h>
#include <linux/dvb/dmx.h>
#include <linux/dvb/frontend.h>
#include <linux/dvb/ca.h>
+#endif
#include <bitstream/mpeg/psi.h>
@@ -66,6 +68,7 @@ typedef enum {
RET_HUH = 255,
} ctl_cmd_answer_t;
+#ifdef HAVE_DVB_SUPPORT
struct ret_frontend_status
{
struct dvb_frontend_info info;
@@ -93,6 +96,7 @@ struct cmd_mmi_send
uint8_t i_slot;
en50221_mmi_object_t object;
};
+#endif
struct cmd_pid_info
{
diff --git a/config.h b/config.h
index 1b8a9d2..6ed1e32 100644
--- a/config.h
+++ b/config.h
@@ -24,7 +24,12 @@
#ifndef _DVBLAST_CONFIG_H_
#define _DVBLAST_CONFIG_H_
+#if defined(__linux__)
+#define HAVE_DVB_SUPPORT
+#define HAVE_ASI_SUPPORT
#define HAVE_CLOCK_NANOSLEEP
+#endif
+
#define HAVE_ICONV
#define DEFAULT_PORT 3001
diff --git a/dvb.c b/dvb.c
index 96722f9..9991cf9 100644
--- a/dvb.c
+++ b/dvb.c
@@ -19,6 +19,9 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
+#include "config.h"
+
+#ifdef HAVE_DVB_SUPPORT
#include <stdlib.h>
#include <stdint.h>
@@ -1133,3 +1136,5 @@ uint8_t dvb_FrontendStatus( uint8_t *p_answer, ssize_t *pi_size )
*pi_size = sizeof(struct ret_frontend_status);
return RET_FRONTEND_STATUS;
}
+
+#endif
diff --git a/dvblast.c b/dvblast.c
index 6f99e5c..0866cd6 100644
--- a/dvblast.c
+++ b/dvblast.c
@@ -438,21 +438,33 @@ void usage()
{
DisplayVersion();
msg_Raw( NULL, "Usage: dvblast [-q] [-c <config file>] [-r <remote socket>] [-t <ttl>] [-o <SSRC IP>] "
- "[-i <RT priority>] [-a <adapter>] [-n <frontend number>] [-S <diseqc>] [-k <uncommitted port>]"
- "[-f <frequency>|-D [<src host>[:<src port>]@]<src mcast>[:<port>][/<opts>]*|-A <ASI adapter>] "
+ "[-i <RT priority>] "
+#ifdef HAVE_ASI_SUPPORT
+ "[-A <ASI adapter>]"
+#endif
+#ifdef HAVE_DVB_SUPPORT
+ "[-a <adapter>] [-n <frontend number>] [-S <diseqc>] [-k <uncommitted port>]"
+ "[-f <frequency>]"
"[-s <symbol rate>] [-v <0|13|18>] [-p] [-b <bandwidth>] [-I <inversion>] "
"[-F <fec inner>] [-m <modulation] [-R <rolloff>] [-P <pilot>] [-K <fec lp>] "
"[-G <guard interval>] [-H <hierarchy>] [-X <transmission>] [-O <lock timeout>] "
+#endif
+ "[-D [<src host>[:<src port>]@]<src mcast>[:<port>][/<opts>]*] "
"[-u] [-w] [-U] [-L <latency>] [-E <retention>] [-d <dest IP>[<:port>][/<opts>]*] "
"[-z] [-C [-e] [-M <network name] [-N <network ID>]] [-T] [-j <system charset>] "
"[-W] [-Y] [-l] [-g <logger ident>] [-Z <mrtg file>] [-V] [-h] [-B <provider_name>]"
"[-J <DVB charset>] [-Q <quit timeout>] [-x <text|xml>]" );
msg_Raw( NULL, "Input:" );
- msg_Raw( NULL, " -a --adapter read packets from a Linux-DVB adapter (typically 0-n)" );
+#ifdef HAVE_ASI_SUPPORT
msg_Raw( NULL, " -A --asi-adapter read packets from an ASI adapter (0-n)" );
+#endif
+#ifdef HAVE_DVB_SUPPORT
+ msg_Raw( NULL, " -a --adapter read packets from a Linux-DVB adapter (typically 0-n)" );
msg_Raw( NULL, " -b --bandwidth frontend bandwith" );
+#endif
msg_Raw( NULL, " -D --rtp-input read packets from a multicast address instead of a DVB card" );
+#ifdef HAVE_DVB_SUPPORT
msg_Raw( NULL, " -f --frequency frontend frequency" );
msg_Raw( NULL, " -F --fec-inner Forward Error Correction (FEC Inner)");
msg_Raw( NULL, " DVB-S2 0|12|23|34|35|56|78|89|910|999 (default auto: 999)");
@@ -478,6 +490,7 @@ void usage()
msg_Raw( NULL, " -v --voltage voltage to apply to the LNB (QPSK)" );
msg_Raw( NULL, " -w --select-pmts set a PID filter on all PMTs" );
msg_Raw( NULL, " -O --lock-timeout timeout for the lock operation (in ms)" );
+#endif
msg_Raw( NULL, "Output:" );
msg_Raw( NULL, " -c --config-file <config file>" );
@@ -655,11 +668,16 @@ int main( int i_argc, char **pp_argv )
i_frequency = strtol( optarg, NULL, 0 );
if ( pf_Open != NULL )
usage();
+#ifdef HAVE_DVB_SUPPORT
pf_Open = dvb_Open;
pf_Read = dvb_Read;
pf_Reset = dvb_Reset;
pf_SetFilter = dvb_SetFilter;
pf_UnsetFilter = dvb_UnsetFilter;
+#else
+ msg_Err( NULL, "DVBlast is compiled without DVB support.");
+ exit(1);
+#endif
break;
case 'F':
@@ -765,11 +783,16 @@ int main( int i_argc, char **pp_argv )
i_asi_adapter = strtol( optarg, NULL, 0 );
if ( pf_Open != NULL )
usage();
+#ifdef HAVE_ASI_SUPPORT
pf_Open = asi_Open;
pf_Read = asi_Read;
pf_Reset = asi_Reset;
pf_SetFilter = asi_SetFilter;
pf_UnsetFilter = asi_UnsetFilter;
+#else
+ msg_Err( NULL, "DVBlast is compiled without ASI support.");
+ exit(1);
+#endif
break;
case 'z':
diff --git a/dvblastctl.c b/dvblastctl.c
index 7862b90..9b5dbf6 100644
--- a/dvblastctl.c
+++ b/dvblastctl.c
@@ -207,6 +207,7 @@ void usage()
printf("Control commands:\n");
printf(" reload Reload configuration.\n");
printf(" shutdown Shutdown DVBlast.\n");
+#ifdef HAVE_DVB_SUPPORT
printf("Status commands:\n");
printf(" fe_status Read frontend status information.\n");
printf(" mmi_status Read CAM status.\n");
@@ -217,6 +218,7 @@ void usage()
printf(" mmi_get <slot> Read MMI slot.\n");
printf(" mmi_send_text <slot> <text> Send text to MMI slot.\n");
printf(" mmi_send_choice <slot> <choice> Send choice to MMI slot.\n");
+#endif
printf("Demux info commands:\n");
printf(" get_pat Return last PAT table.\n");
printf(" get_cat Return last CAT table.\n");
@@ -386,6 +388,7 @@ int main( int i_argc, char **ppsz_argv )
p_data[1] = (uint8_t)(i_pid & 0xff);
break;
}
+#ifdef HAVE_DVB_SUPPORT
case CMD_MMI_SEND_TEXT:
{
struct cmd_mmi_send *p_cmd = (struct cmd_mmi_send *)p_data;
@@ -432,6 +435,7 @@ int main( int i_argc, char **ppsz_argv )
i_size = COMM_HEADER_SIZE + 1;
break;
}
+#endif
default:
/* This should not happen */
return_error( "Unhandled option (%d)", opt.cmd );
@@ -533,6 +537,7 @@ int main( int i_argc, char **ppsz_argv )
break;
}
+#ifdef HAVE_DVB_SUPPORT
case RET_FRONTEND_STATUS:
{
int ret = 1;
@@ -788,6 +793,7 @@ int main( int i_argc, char **ppsz_argv )
exit(255);
break;
}
+#endif
default:
return_error( "Unknown command answer: %u", c_answer );
diff --git a/en50221.c b/en50221.c
index 8af0626..26351ed 100644
--- a/en50221.c
+++ b/en50221.c
@@ -21,6 +21,9 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
+#include "config.h"
+
+#ifdef HAVE_DVB_SUPPORT
#include <stdlib.h>
#include <stdint.h>
@@ -2421,3 +2424,15 @@ uint8_t en50221_SendMMIObject( uint8_t *p_buffer, ssize_t i_size )
msg_Err( NULL, "SendMMIObject when no MMI session is opened !" );
return RET_ERR;
}
+
+#else
+#include <inttypes.h>
+
+int i_ca_handle = 0;
+int i_ca_type = -1;
+
+void en50221_AddPMT( uint8_t *p_pmt ) { };
+void en50221_UpdatePMT( uint8_t *p_pmt ) { };
+void en50221_DeletePMT( uint8_t *p_pmt ) { };
+void en50221_Reset( void ) { };
+#endif
More information about the dvblast-devel
mailing list