[Redbutton-devel] SF.net SVN: redbutton:[522]
Brought to you by:
skilvington
|
From: <ski...@us...> - 2009-04-17 10:09:12
|
Revision: 522
http://redbutton.svn.sourceforge.net/redbutton/?rev=522&view=rev
Author: skilvington
Date: 2009-04-17 10:09:02 +0000 (Fri, 17 Apr 2009)
Log Message:
-----------
allow the Network ID to be specified on the command line when using a local backend
Modified Paths:
--------------
redbutton-browser/trunk/MHEGBackend.c
redbutton-browser/trunk/MHEGBackend.h
redbutton-browser/trunk/MHEGEngine.c
redbutton-browser/trunk/MHEGEngine.h
redbutton-browser/trunk/rb-browser.c
www/index.html
Modified: redbutton-browser/trunk/MHEGBackend.c
===================================================================
--- redbutton-browser/trunk/MHEGBackend.c 2009-04-07 12:56:42 UTC (rev 521)
+++ redbutton-browser/trunk/MHEGBackend.c 2009-04-17 10:09:02 UTC (rev 522)
@@ -74,7 +74,7 @@
/* public interface */
void
-MHEGBackend_init(MHEGBackend *b, bool remote, char *srg_loc)
+MHEGBackend_init(MHEGBackend *b, bool remote, char *srg_loc, int net_id)
{
bzero(b, sizeof(MHEGBackend));
@@ -94,7 +94,10 @@
{
/* backend is on a different host, srg_loc is the remote host[:port] */
b->fns = &remote_backend_fns;
+ /* these are only used by local backends */
b->base_dir = NULL;
+ b->network_id[0] = '\0';
+ /* resolve the host:port */
if(parse_addr(srg_loc, &b->addr.sin_addr, &b->addr.sin_port) < 0)
fatal("Unable to resolve host %s", srg_loc);
verbose("Remote backend at %s:%u", inet_ntoa(b->addr.sin_addr), ntohs(b->addr.sin_port));
@@ -106,6 +109,11 @@
/* backend and frontend on same host, srg_loc is the base directory */
b->fns = &local_backend_fns;
b->base_dir = safe_strdup(srg_loc);
+ /* net_id < 0 means leave it blank */
+ if(net_id >= 0)
+ snprintf(b->network_id, sizeof(b->network_id), "%x", net_id);
+ else
+ b->network_id[0] = '\0';
verbose("Local backend; carousel file root '%s'", srg_loc);
/* initialise rec://svc/def value */
local_set_service_url(b);
@@ -374,7 +382,7 @@
}
/* create a fake dvb:// format URL */
- len = snprintf(url, sizeof(url), "dvb://..%x", service_id);
+ len = snprintf(url, sizeof(url), "dvb://%s..%x", t->network_id, service_id);
/* overwrite any existing value */
t->rec_svc_def.size = len;
Modified: redbutton-browser/trunk/MHEGBackend.h
===================================================================
--- redbutton-browser/trunk/MHEGBackend.h 2009-04-07 12:56:42 UTC (rev 521)
+++ redbutton-browser/trunk/MHEGBackend.h 2009-04-17 10:09:02 UTC (rev 522)
@@ -25,6 +25,7 @@
{
OctetString rec_svc_def; /* service we are downloading the carousel from */
char *base_dir; /* local Service Gateway root directory */
+ char network_id[16]; /* local Network ID (maybe blank if you don't care) */
struct sockaddr_in addr; /* remote backend IP and port */
FILE *be_sock; /* connection to remote backend */
/* function pointers */
@@ -49,7 +50,7 @@
} *fns;
} MHEGBackend;
-void MHEGBackend_init(MHEGBackend *, bool, char *);
+void MHEGBackend_init(MHEGBackend *, bool, char *, int);
void MHEGBackend_fini(MHEGBackend *);
#endif /* __MHEGBACKEND_H__ */
Modified: redbutton-browser/trunk/MHEGEngine.c
===================================================================
--- redbutton-browser/trunk/MHEGEngine.c 2009-04-07 12:56:42 UTC (rev 521)
+++ redbutton-browser/trunk/MHEGEngine.c 2009-04-17 10:09:02 UTC (rev 522)
@@ -177,7 +177,7 @@
engine.vo_method = MHEGVideoOutputMethod_fromString(opts->vo_method);
engine.av_disabled = opts->av_disabled;
- MHEGBackend_init(&engine.backend, opts->remote, opts->srg_loc);
+ MHEGBackend_init(&engine.backend, opts->remote, opts->srg_loc, opts->network_id);
MHEGApp_init(&engine.active_app);
Modified: redbutton-browser/trunk/MHEGEngine.h
===================================================================
--- redbutton-browser/trunk/MHEGEngine.h 2009-04-07 12:56:42 UTC (rev 521)
+++ redbutton-browser/trunk/MHEGEngine.h 2009-04-17 10:09:02 UTC (rev 522)
@@ -85,6 +85,7 @@
{
bool remote; /* or local rb-download backend */
char *srg_loc; /* service gateway location: directory for local; host[:port] for remote */
+ int network_id; /* Network ID for local backends, used to resolve rec://svc/def (<0 => leave it blank) */
int verbose; /* -v flag */
unsigned int timeout; /* seconds to poll for missing content before generating a ContentRefError */
bool fullscreen; /* scale to fullscreen? */
Modified: redbutton-browser/trunk/rb-browser.c
===================================================================
--- redbutton-browser/trunk/rb-browser.c 2009-04-07 12:56:42 UTC (rev 521)
+++ redbutton-browser/trunk/rb-browser.c 2009-04-17 10:09:02 UTC (rev 522)
@@ -1,5 +1,5 @@
/*
- * rb-browser [-v] [-f] [-d] [-a <alsa_device>] [-o <video_output_method>] [-k <keymap_file>] [-t <timeout>] [-r] [<service_gateway>]
+ * rb-browser [-v] [-f] [-d] [-a <alsa_device>] [-o <video_output_method>] [-k <keymap_file>] [-t <timeout>] [-n <network_id>] [-r] [<service_gateway>]
*
* -v is verbose/debug mode
* -f is full screen, otherwise it uses a window
@@ -15,6 +15,8 @@
* and <service_gateway> should be an entry in the services directory, eg. services/4165
* (this is really only for debugging or running MHEG apps you've written yourself)
* the default backend is "-r 127.0.0.1"
+ * -n allows you to specify a Network ID for local backends, this is used to resolve rec://svc/def
+ * by default, the Network ID is left blank in rec://svc/def
*/
#include <unistd.h>
@@ -58,8 +60,9 @@
opts.av_disabled = false;
opts.timeout = MISSING_CONTENT_TIMEOUT;
opts.keymap = NULL;
+ opts.network_id = -1; /* => leave it blank */
- while((arg = getopt(argc, argv, "rvfda:o:k:t:")) != EOF)
+ while((arg = getopt(argc, argv, "rvfda:o:k:t:n:")) != EOF)
{
switch(arg)
{
@@ -95,6 +98,10 @@
opts.timeout = strtoul(optarg, NULL, 0);
break;
+ case 'n':
+ opts.network_id = strtoul(optarg, NULL, 0);
+ break;
+
default:
usage(prog_name);
break;
@@ -136,6 +143,7 @@
"[-o <video_output_method>] "
"[-k <keymap_file>] "
"[-t <timeout>] "
+ "[-n <network_id>] "
"[-r] "
"[<service_gateway>]\n\n"
"%s",
Modified: www/index.html
===================================================================
--- www/index.html 2009-04-07 12:56:42 UTC (rev 521)
+++ www/index.html 2009-04-17 10:09:02 UTC (rev 522)
@@ -122,7 +122,7 @@
<H2>rb-browser</H2>
Usage:
<PRE>
-rb-browser [-v] [-f] [-d] [-o <video_output_method>] [-k <keymap_config_file>] [-t <timeout>] [-r] [<service_gateway>]
+rb-browser [-v] [-f] [-d] [-o <video_output_method>] [-k <keymap_config_file>] [-t <timeout>] [-n <network_id>] [-r] [<service_gateway>]
</PRE>
Display the MHEG apps downloaded with rb-download.
<P>
@@ -158,6 +158,10 @@
Although this will not give you any video or audio as this is streamed from rb-download.
Retuning will also probably not work unless you've also saved the services directory for the channel you want to retune to.
<P>
+For local backends, -n allows you to specify a Network ID that will be used to resolve rec://svc/def.
+By default, the Network ID is left blank in rec://svc/def.
+If you don't know what this means, you can probably just ignore the -n flag!
+<P>
It will display the app in a window, use -f for full screen mode.
<P>
The -d flag disables all audio and video output.
@@ -186,7 +190,7 @@
<TR align="center"><TD>t</TD><TD>Text</TD></TR>
<TR align="center"><TD>e</TD><TD>EPG (NZ Profile only)</TD></TR>
</TABLE>
-<P>
+<H2>Notes</H2>
You will need the "expat" XML parsing library and the xsltproc XML stylesheet processor that comes with "libxslt" to compile it.
On Gentoo, you can just:
<PRE>
@@ -196,7 +200,7 @@
If the compile fails with errors about function names ending in "_dup" being missing, libxslt is not installed.
<P>
To run it you need an X server that supports the Xrender extension and you need to have libpng, freetype2 and ffmpeg installed.
-<H2>Notes</H2>
+<P>
It does not implement the whole MHEG spec.
However, it seems to be enough to view everything that is currently being broadcast on the 'Freeview' channels in the UK.
If it comes across something that is not yet implemented it will print out a message on the console. Let us know if you find anything it can't do.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|