[Redbutton-devel] SF.net SVN: redbutton:[503] redbutton-download/trunk
Brought to you by:
skilvington
|
From: <ski...@us...> - 2008-11-05 17:23:10
|
Revision: 503
http://redbutton.svn.sourceforge.net/redbutton/?rev=503&view=rev
Author: skilvington
Date: 2008-11-05 17:23:04 +0000 (Wed, 05 Nov 2008)
Log Message:
-----------
patch from Hans Werner to allow the frontend, dvr and demux device numbers to be given on the command line
Modified Paths:
--------------
redbutton-download/trunk/channels.c
redbutton-download/trunk/channels.h
redbutton-download/trunk/findmheg.c
redbutton-download/trunk/findmheg.h
redbutton-download/trunk/list.c
redbutton-download/trunk/list.h
redbutton-download/trunk/listen.c
redbutton-download/trunk/listen.h
redbutton-download/trunk/rb-download.c
redbutton-download/trunk/utils.h
Modified: redbutton-download/trunk/channels.c
===================================================================
--- redbutton-download/trunk/channels.c 2008-09-03 19:57:53 UTC (rev 502)
+++ redbutton-download/trunk/channels.c 2008-11-05 17:23:04 UTC (rev 503)
@@ -68,7 +68,7 @@
*/
char *
-zap_name(unsigned int adapter)
+zap_name(unsigned int adapter, unsigned int frontend)
{
char fe_dev[PATH_MAX];
int fe_fd;
@@ -76,7 +76,7 @@
bool got_info;
/* see what type of DVB device the adapter is */
- snprintf(fe_dev, sizeof(fe_dev), FE_DEVICE, adapter);
+ snprintf(fe_dev, sizeof(fe_dev), FE_DEVICE, adapter, frontend);
if((fe_fd = open(fe_dev, O_RDONLY | O_NONBLOCK)) < 0)
fatal("open '%s': %s", fe_dev, strerror(errno));
@@ -503,7 +503,7 @@
*/
bool
-tune_service_id(unsigned int adapter, unsigned int timeout, uint16_t service_id)
+tune_service_id(unsigned int adapter, unsigned int frontend, unsigned int timeout, uint16_t service_id)
{
char fe_dev[PATH_MAX];
bool got_info;
@@ -522,7 +522,7 @@
if(fe_fd < 0)
{
- snprintf(fe_dev, sizeof(fe_dev), FE_DEVICE, adapter);
+ snprintf(fe_dev, sizeof(fe_dev), FE_DEVICE, adapter, frontend);
/*
* need O_RDWR if you want to tune, O_RDONLY is okay for getting info
* if someone else is using the frontend, we can only open O_RDONLY
Modified: redbutton-download/trunk/channels.h
===================================================================
--- redbutton-download/trunk/channels.h 2008-09-03 19:57:53 UTC (rev 502)
+++ redbutton-download/trunk/channels.h 2008-11-05 17:23:04 UTC (rev 503)
@@ -26,11 +26,11 @@
#include <stdint.h>
#include <stdbool.h>
-char *zap_name(unsigned int);
+char *zap_name(unsigned int, unsigned int);
bool init_channels_conf(char *, char *);
-bool tune_service_id(unsigned int, unsigned int, uint16_t);
+bool tune_service_id(unsigned int, unsigned int, unsigned int, uint16_t);
bool service_available(uint16_t);
Modified: redbutton-download/trunk/findmheg.c
===================================================================
--- redbutton-download/trunk/findmheg.c 2008-09-03 19:57:53 UTC (rev 502)
+++ redbutton-download/trunk/findmheg.c 2008-11-05 17:23:04 UTC (rev 503)
@@ -98,7 +98,7 @@
static struct carousel _car;
struct carousel *
-find_mheg(unsigned int adapter, unsigned int timeout, uint16_t service_id, int carousel_id)
+find_mheg(unsigned int adapter, unsigned int demux, unsigned int dvr, unsigned int timeout, uint16_t service_id, int carousel_id)
{
unsigned char pmt[MAX_TABLE_LEN];
unsigned char *sdt = pmt;
@@ -114,8 +114,8 @@
int desc_carousel_id;
/* carousel data we know so far */
- snprintf(_car.demux_device, sizeof(_car.demux_device), DEMUX_DEVICE, adapter);
- snprintf(_car.dvr_device, sizeof(_car.dvr_device), DVR_DEVICE, adapter);
+ snprintf(_car.demux_device, sizeof(_car.demux_device), DEMUX_DEVICE, adapter, demux);
+ snprintf(_car.dvr_device, sizeof(_car.dvr_device), DVR_DEVICE, adapter, dvr);
_car.timeout = timeout;
_car.service_id = service_id;
Modified: redbutton-download/trunk/findmheg.h
===================================================================
--- redbutton-download/trunk/findmheg.h 2008-09-03 19:57:53 UTC (rev 502)
+++ redbutton-download/trunk/findmheg.h 2008-11-05 17:23:04 UTC (rev 503)
@@ -33,7 +33,7 @@
uint8_t video_type;
};
-struct carousel *find_mheg(unsigned int, unsigned int, uint16_t, int);
+struct carousel *find_mheg(unsigned int, unsigned int, unsigned int, unsigned int, uint16_t, int);
struct avstreams *find_avstreams(struct carousel *, int, int, int);
Modified: redbutton-download/trunk/list.c
===================================================================
--- redbutton-download/trunk/list.c 2008-09-03 19:57:53 UTC (rev 502)
+++ redbutton-download/trunk/list.c 2008-11-05 17:23:04 UTC (rev 503)
@@ -30,7 +30,7 @@
#define TAG_SERVICE_DESCRIPTOR 0x48
void
-list_channels(unsigned int adapter, unsigned int timeout)
+list_channels(unsigned int adapter, unsigned int demux, unsigned int timeout)
{
char demux_dev[PATH_MAX];
unsigned char sdt[MAX_TABLE_LEN];
@@ -42,7 +42,7 @@
uint8_t desc_length;
uint8_t name_len;
- snprintf(demux_dev, sizeof(demux_dev), DEMUX_DEVICE, adapter);
+ snprintf(demux_dev, sizeof(demux_dev), DEMUX_DEVICE, adapter, demux);
printf("Channels on this mutiplex:\n\n");
printf("ID\tChannel\n");
Modified: redbutton-download/trunk/list.h
===================================================================
--- redbutton-download/trunk/list.h 2008-09-03 19:57:53 UTC (rev 502)
+++ redbutton-download/trunk/list.h 2008-11-05 17:23:04 UTC (rev 503)
@@ -23,7 +23,7 @@
#ifndef __LIST_H__
#define __LIST_H__
-void list_channels(unsigned int, unsigned int);
+void list_channels(unsigned int, unsigned int, unsigned int);
#endif /* __LIST_H__ */
Modified: redbutton-download/trunk/listen.c
===================================================================
--- redbutton-download/trunk/listen.c 2008-09-03 19:57:53 UTC (rev 502)
+++ redbutton-download/trunk/listen.c 2008-11-05 17:23:04 UTC (rev 503)
@@ -123,7 +123,7 @@
*/
void
-start_listener(struct sockaddr_in *listen_addr, unsigned int adapter, unsigned int timeout, uint16_t service_id, int carousel_id)
+start_listener(struct sockaddr_in *listen_addr, unsigned int adapter, unsigned int frontend, unsigned int demux, unsigned int dvr, unsigned int timeout, uint16_t service_id, int carousel_id)
{
struct listen_data listen_data;
struct sigaction action;
@@ -143,7 +143,7 @@
fatal("signal: SIGCHLD: %s", strerror(errno));
/* fork off a child to download the carousel */
- listen_data.carousel = start_downloader(adapter, timeout, service_id, carousel_id);
+ listen_data.carousel = start_downloader(adapter, frontend, demux, dvr, timeout, service_id, carousel_id);
/* catch SIGHUP - tells us to retune */
action.sa_sigaction = hup_handler;
@@ -179,7 +179,7 @@
/* kill the current downloader process and start a new one */
kill(listen_data.carousel->downloader, SIGKILL);
cache_flush();
- listen_data.carousel = start_downloader(adapter, timeout, retune_id, -1);
+ listen_data.carousel = start_downloader(adapter, frontend, demux, dvr, timeout, retune_id, -1);
retune_id = -1;
}
/* listen for a connection */
@@ -275,17 +275,17 @@
}
struct carousel *
-start_downloader(unsigned int adapter, unsigned int timeout, uint16_t service_id, int carousel_id)
+start_downloader(unsigned int adapter, unsigned int frontend, unsigned int demux, unsigned int dvr, unsigned int timeout, uint16_t service_id, int carousel_id)
{
struct carousel *car;
pid_t child;
/* retune if needed */
- if(!tune_service_id(adapter, timeout, service_id))
+ if(!tune_service_id(adapter, frontend, timeout, service_id))
error("Unable to retune; let's hope you're already tuned to the right frequency...");
/* find the MHEG PIDs */
- car = find_mheg(adapter, timeout, service_id, carousel_id);
+ car = find_mheg(adapter, demux, dvr, timeout, service_id, carousel_id);
verbose("Carousel ID=%u", car->carousel_id);
verbose("Boot PID=%u", car->boot_pid);
Modified: redbutton-download/trunk/listen.h
===================================================================
--- redbutton-download/trunk/listen.h 2008-09-03 19:57:53 UTC (rev 502)
+++ redbutton-download/trunk/listen.h 2008-11-05 17:23:04 UTC (rev 503)
@@ -16,7 +16,7 @@
int parse_addr(char *, struct in_addr *, in_port_t *);
-void start_listener(struct sockaddr_in *, unsigned int, unsigned int, uint16_t, int);
-struct carousel *start_downloader(unsigned int, unsigned int, uint16_t, int);
+void start_listener(struct sockaddr_in *, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, uint16_t, int);
+struct carousel *start_downloader(unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, uint16_t, int);
#endif
Modified: redbutton-download/trunk/rb-download.c
===================================================================
--- redbutton-download/trunk/rb-download.c 2008-09-03 19:57:53 UTC (rev 502)
+++ redbutton-download/trunk/rb-download.c 2008-11-05 17:23:04 UTC (rev 503)
@@ -1,5 +1,5 @@
/*
- * rb-download [-v] [-a <adapter>] [-b <base_dir>] [-t <timeout>] [-f <channels_file>] [-l <listen_addr>] [-c <carousel_id>] [<service_id>]
+ * rb-download [-v] [-a <adapter>] [-x <frontend>} [-y <demux>} [-z <dvr>] [-b <base_dir>] [-t <timeout>] [-f <channels_file>] [-l <listen_addr>] [-c <carousel_id>] [<service_id>]
*
* Download the DVB Object Carousel for the given channel onto the local hard disc
* files will be stored under the current dir if no -b option is given
@@ -13,7 +13,8 @@
* the DVB devices used will be:
* /dev/dvb/adapter0/demux0
* /dev/dvb/adapter0/dvr0
- * use the -a option to change the adapter number (eg "-a 1" will use /dev/dvb/adapter1/demux0 etc)
+ * use the -a,-x,-y,-z options (defaults=0) to change the adapter, frontend, demux, dvr numbers
+ * (eg "-a 2 -x 1 -y 1 -z 1" will use /dev/dvb/adapter2/demux1 etc)
*
* rb-download needs a "channels.conf" file which gives tuning parameters for service_id's
* channels.conf files can be generated by the "scan" utility in the dvb-apps package at www.linuxtv.org
@@ -90,6 +91,9 @@
{
char *prog_name = argv[0];
unsigned int adapter;
+ unsigned int frontend;
+ unsigned int demux;
+ unsigned int dvr;
char *base_dir;
unsigned int timeout;
char *channels_file;
@@ -100,6 +104,9 @@
/* default values */
adapter = 0;
+ frontend = 0;
+ demux = 0;
+ dvr = 0;
base_dir = NULL;
timeout = DEFAULT_TIMEOUT;
channels_file = NULL;
@@ -107,7 +114,7 @@
listen_addr.sin_port = htons(DEFAULT_LISTEN_PORT);
carousel_id = -1; /* read it from the PMT */
- while((arg = getopt(argc, argv, "a:b:f:t:l:c:v")) != EOF)
+ while((arg = getopt(argc, argv, "a:x:y:z:b:f:t:l:c:v")) != EOF)
{
switch(arg)
{
@@ -115,6 +122,18 @@
adapter = strtoul(optarg, NULL, 0);
break;
+ case 'x':
+ frontend = strtoul(optarg, NULL, 0);
+ break;
+
+ case 'y':
+ demux = strtoul(optarg, NULL, 0);
+ break;
+
+ case 'z':
+ dvr = strtoul(optarg, NULL, 0);
+ break;
+
case 'b':
/* don't chdir yet, in case we have a relative -f param */
base_dir = optarg;
@@ -148,7 +167,7 @@
}
/* initialise channels.conf */
- if(!init_channels_conf(zap_name(adapter), channels_file))
+ if(!init_channels_conf(zap_name(adapter, frontend), channels_file))
error("Unable to open channels.conf file");
/* do we need to change the base directory */
@@ -161,12 +180,12 @@
if(argc == optind)
{
- list_channels(adapter, timeout);
+ list_channels(adapter, demux, timeout);
}
else if(argc - optind == 1)
{
service_id = strtoul(argv[optind], NULL, 0);
- start_listener(&listen_addr, adapter, timeout, service_id, carousel_id);
+ start_listener(&listen_addr, adapter, frontend, demux, dvr, timeout, service_id, carousel_id);
}
else
{
@@ -222,6 +241,9 @@
{
fatal("Usage: %s [-v] "
"[-a <adapter>] "
+ "[-x <frontend>] "
+ "[-y <demux>] "
+ "[-z <dvr>] "
"[-b <base_dir>] "
"[-t <timeout>] "
"[-f <channels_file>] "
Modified: redbutton-download/trunk/utils.h
===================================================================
--- redbutton-download/trunk/utils.h 2008-09-03 19:57:53 UTC (rev 502)
+++ redbutton-download/trunk/utils.h 2008-11-05 17:23:04 UTC (rev 503)
@@ -33,23 +33,23 @@
/* DVB demux device - %u is card number */
#if defined(HAVE_DREAMBOX_HARDWARE)
-#define DEMUX_DEVICE "/dev/dvb/card%u/demux0"
+#define DEMUX_DEVICE "/dev/dvb/card%u/demux%u"
#else
-#define DEMUX_DEVICE "/dev/dvb/adapter%u/demux0"
+#define DEMUX_DEVICE "/dev/dvb/adapter%u/demux%u"
#endif
/* DVB dvr device - %u is card number */
#if defined(HAVE_DREAMBOX_HARDWARE)
-#define DVR_DEVICE "/dev/dvb/card%u/dvr0"
+#define DVR_DEVICE "/dev/dvb/card%u/dvr%u"
#else
-#define DVR_DEVICE "/dev/dvb/adapter%u/dvr0"
+#define DVR_DEVICE "/dev/dvb/adapter%u/dvr%u"
#endif
/* DVB frontend device - %u is card number */
#if defined(HAVE_DREAMBOX_HARDWARE)
-#define FE_DEVICE "/dev/dvb/card%u/frontend0"
+#define FE_DEVICE "/dev/dvb/card%u/frontend%u"
#else
-#define FE_DEVICE "/dev/dvb/adapter%u/frontend0"
+#define FE_DEVICE "/dev/dvb/adapter%u/frontend%u"
#endif
char *skip_ws(char *);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|