[Redbutton-devel] SF.net SVN: redbutton: [171] redbutton-browser/trunk
Brought to you by:
skilvington
|
From: <ski...@us...> - 2007-01-10 21:25:55
|
Revision: 171
http://svn.sourceforge.net/redbutton/?rev=171&view=rev
Author: skilvington
Date: 2007-01-10 13:25:52 -0800 (Wed, 10 Jan 2007)
Log Message:
-----------
one step closer to being able to retune the 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
Modified: redbutton-browser/trunk/MHEGBackend.c
===================================================================
--- redbutton-browser/trunk/MHEGBackend.c 2007-01-08 16:57:43 UTC (rev 170)
+++ redbutton-browser/trunk/MHEGBackend.c 2007-01-10 21:25:52 UTC (rev 171)
@@ -11,6 +11,7 @@
#include <sys/socket.h>
#include "MHEGEngine.h"
+#include "si.h"
#include "utils.h"
/* local backend funcs */
@@ -18,6 +19,7 @@
bool local_loadFile(MHEGBackend *, OctetString *, OctetString *);
FILE *local_openFile(MHEGBackend *, OctetString *);
FILE *local_openStream(MHEGBackend *, bool, int *, int *, bool, int *, int *);
+void local_retune(MHEGBackend *, OctetString *);
static struct MHEGBackendFns local_backend_fns =
{
@@ -25,6 +27,7 @@
local_loadFile, /* loadFile */
local_openFile, /* openFile */
local_openStream, /* openStream */
+ local_retune, /* retune */
};
/* remote backend funcs */
@@ -32,6 +35,7 @@
bool remote_loadFile(MHEGBackend *, OctetString *, OctetString *);
FILE *remote_openFile(MHEGBackend *, OctetString *);
FILE *remote_openStream(MHEGBackend *, bool, int *, int *, bool, int *, int *);
+void remote_retune(MHEGBackend *, OctetString *);
static struct MHEGBackendFns remote_backend_fns =
{
@@ -39,6 +43,7 @@
remote_loadFile, /* loadFile */
remote_openFile, /* openFile */
remote_openStream, /* openStream */
+ remote_retune, /* retune */
};
/* internal functions */
@@ -346,6 +351,20 @@
}
/*
+ * retune the backend to the given service
+ * service should be in the form "dvb://<network_id>..<service_id>", eg "dvb://233a..4C80"
+ */
+
+void
+local_retune(MHEGBackend *t, OctetString *service)
+{
+/* TODO */
+fatal("TODO: Retune local backend to '%.*s' (service_id %u)", service->size, service->data, si_get_service_id(service));
+
+ return;
+}
+
+/*
* remote routines
*/
@@ -540,3 +559,17 @@
return sock;
}
+/*
+ * retune the backend to the given service
+ * service should be in the form "dvb://<network_id>..<service_id>", eg "dvb://233a..4C80"
+ */
+
+void
+remote_retune(MHEGBackend *t, OctetString *service)
+{
+/* TODO */
+fatal("TODO: Retune remote backend to '%.*s' (service_id %u)", service->size, service->data, si_get_service_id(service));
+
+ return;
+}
+
Modified: redbutton-browser/trunk/MHEGBackend.h
===================================================================
--- redbutton-browser/trunk/MHEGBackend.h 2007-01-08 16:57:43 UTC (rev 170)
+++ redbutton-browser/trunk/MHEGBackend.h 2007-01-10 21:25:52 UTC (rev 171)
@@ -28,6 +28,8 @@
FILE *(*openFile)(struct MHEGBackend *, OctetString *);
/* open an MPEG Transport Stream */
FILE *(*openStream)(struct MHEGBackend *, bool, int *, int *, bool, int *, int *);
+ /* tune to the given service */
+ void (*retune)(struct MHEGBackend *, OctetString *);
} *fns;
} MHEGBackend;
Modified: redbutton-browser/trunk/MHEGEngine.c
===================================================================
--- redbutton-browser/trunk/MHEGEngine.c 2007-01-08 16:57:43 UTC (rev 170)
+++ redbutton-browser/trunk/MHEGEngine.c 2007-01-10 21:25:52 UTC (rev 171)
@@ -183,85 +183,108 @@
}
int
-MHEGEngine_run(OctetString *derfile)
+MHEGEngine_run(void)
{
+ OctetString boot_obj;
ApplicationClass *app;
SceneClass *scene;
bool block;
+ unsigned int i;
+ bool found;
+ /* search order for the app to boot in the Service Gateway dir */
+ char *boot_order[] = { "~//a", "~//startup", NULL };
do
{
- verbose("Running '%.*s'", derfile->size, derfile->data);
- engine.quit_reason = QuitReason_DontQuit;
- /* load the app */
- if((app = MHEGApp_loadApplication(&engine.active_app, derfile)) == NULL)
- return EXIT_FAILURE;
- /* start it up */
- ApplicationClass_Preparation(app);
- ApplicationClass_Activation(app);
- /* main loop */
- while(engine.quit_reason == QuitReason_DontQuit)
+ /* search for the boot object */
+ found = false;
+ for(i=0; !found && boot_order[i] != NULL; i++)
{
- /* poll for files we are waiting for */
- MHEGEngine_pollMissingContent();
- /* process any async events */
- MHEGEngine_processMHEGEvents();
- /*
- * if we are polling for missing content,
- * or if we need to quit the current app
- * don't block waiting for the next GUI event
- */
- block = (engine.missing_content == NULL && engine.quit_reason == QuitReason_DontQuit);
- /* process any GUI events */
- if(MHEGDisplay_processEvents(&engine.display, block))
- engine.quit_reason = QuitReason_GUIQuit;
+ boot_obj.size = strlen(boot_order[i]);
+ boot_obj.data = boot_order[i];
+ found = MHEGEngine_checkContentRef(&boot_obj);
}
- /* do Destruction of Application and Scene */
- if((scene = MHEGEngine_getActiveScene()) != NULL)
+ if(!found)
{
- SceneClass_Deactivation(scene);
- SceneClass_Destruction(scene);
+ error("Unable to find boot object in service gateway");
+ return EXIT_FAILURE;
}
- ApplicationClass_Deactivation(app);
- ApplicationClass_Destruction(app);
- /* clean up */
- MHEGApp_fini(&engine.active_app);
- LIST_FREE(&engine.objects, RootClassPtr, safe_free);
- LIST_FREE(&engine.missing_content, MissingContent, free_MissingContentListItem);
- LIST_FREE(&engine.active_links, LinkClassPtr, safe_free);
- LIST_FREE(&engine.async_eventq, MHEGAsyncEvent, free_MHEGAsyncEventListItem);
- LIST_FREE(&engine.main_actionq, MHEGAction, free_MHEGActionListItem);
- LIST_FREE(&engine.temp_actionq, MHEGAction, free_MHEGActionListItem);
- /* do we need to run a new app */
- switch(engine.quit_reason)
+ do
{
- case QuitReason_Launch:
- verbose("Launch '%.*s'", engine.quit_data.size, engine.quit_data.data);
- derfile = &engine.quit_data;
- break;
-
- case QuitReason_Spawn:
+ /* boot it */
+ verbose("Booting '%.*s'", boot_obj.size, boot_obj.data);
+ engine.quit_reason = QuitReason_DontQuit;
+ /* load the app */
+ if((app = MHEGApp_loadApplication(&engine.active_app, &boot_obj)) == NULL)
+ return EXIT_FAILURE;
+ /* start it up */
+ ApplicationClass_Preparation(app);
+ ApplicationClass_Activation(app);
+ /* main loop */
+ while(engine.quit_reason == QuitReason_DontQuit)
+ {
+ /* poll for files we are waiting for */
+ MHEGEngine_pollMissingContent();
+ /* process any async events */
+ MHEGEngine_processMHEGEvents();
+ /*
+ * if we are polling for missing content,
+ * or if we need to quit the current app
+ * don't block waiting for the next GUI event
+ */
+ block = (engine.missing_content == NULL && engine.quit_reason == QuitReason_DontQuit);
+ /* process any GUI events */
+ if(MHEGDisplay_processEvents(&engine.display, block))
+ engine.quit_reason = QuitReason_GUIQuit;
+ }
+ /* do Destruction of Application and Scene */
+ if((scene = MHEGEngine_getActiveScene()) != NULL)
+ {
+ SceneClass_Deactivation(scene);
+ SceneClass_Destruction(scene);
+ }
+ ApplicationClass_Deactivation(app);
+ ApplicationClass_Destruction(app);
+ /* clean up */
+ MHEGApp_fini(&engine.active_app);
+ LIST_FREE(&engine.objects, RootClassPtr, safe_free);
+ LIST_FREE(&engine.missing_content, MissingContent, free_MissingContentListItem);
+ LIST_FREE(&engine.active_links, LinkClassPtr, safe_free);
+ LIST_FREE(&engine.async_eventq, MHEGAsyncEvent, free_MHEGAsyncEventListItem);
+ LIST_FREE(&engine.main_actionq, MHEGAction, free_MHEGActionListItem);
+ LIST_FREE(&engine.temp_actionq, MHEGAction, free_MHEGActionListItem);
+ /* do we need to run a new app */
+ switch(engine.quit_reason)
+ {
+ case QuitReason_Launch:
+ verbose("Launch '%.*s'", engine.quit_data.size, engine.quit_data.data);
+ boot_obj.size = engine.quit_data.size;
+ boot_obj.data = engine.quit_data.data;
+ break;
+
+ case QuitReason_Spawn:
+ verbose("Spawn '%.*s'", engine.quit_data.size, engine.quit_data.data);
/* TODO */
/* need to run on_restart and on_spawn_close_down Actions at some point */
printf("TODO: Spawn '%.*s'; doing Launch instead\n", engine.quit_data.size, engine.quit_data.data);
- derfile = &engine.quit_data;
- break;
-
- case QuitReason_Retune:
-/* TODO */
-fatal("TODO: Retune to '%.*s' (service_id %u)", engine.quit_data.size, engine.quit_data.data, si_get_service_id(&engine.quit_data));
- break;
-
- default:
- /* nothing to do */
- break;
+ boot_obj.size = engine.quit_data.size;
+ boot_obj.data = engine.quit_data.data;
+ break;
+
+ case QuitReason_Retune:
+ verbose("Retune to '%.*s'", engine.quit_data.size, engine.quit_data.data);
+ MHEGEngine_retune(&engine.quit_data);
+ break;
+
+ default:
+ /* nothing to do */
+ break;
+ }
}
+ while(engine.quit_reason == QuitReason_Launch || engine.quit_reason == QuitReason_Spawn);
}
- while(engine.quit_reason == QuitReason_Launch || engine.quit_reason == QuitReason_Spawn);
+ while(engine.quit_reason == QuitReason_Retune);
- /* clean up */
- free_OctetString(&engine.quit_data);
-
return EXIT_SUCCESS;
}
@@ -276,6 +299,8 @@
MHEGBackend_fini(&engine.backend);
+ free_OctetString(&engine.quit_data);
+
return;
}
@@ -1384,6 +1409,17 @@
}
/*
+ * retune the backend to the given service
+ * service should be in the form "dvb://<network_id>..<service_id>", eg "dvb://233a..4C80"
+ */
+
+void
+MHEGEngine_retune(OctetString *service)
+{
+ return (*(engine.backend.fns->retune))(&engine.backend, service);
+}
+
+/*
* returns the absolute group ID, ie it always starts with "~//"
* returns a ptr to static string that will be overwritten by the next call to this routine
* section 8.3.2 of the UK MHEG Profile says the filename prefixes are:
Modified: redbutton-browser/trunk/MHEGEngine.h
===================================================================
--- redbutton-browser/trunk/MHEGEngine.h 2007-01-08 16:57:43 UTC (rev 170)
+++ redbutton-browser/trunk/MHEGEngine.h 2007-01-10 21:25:52 UTC (rev 171)
@@ -184,8 +184,8 @@
/* prototypes */
void MHEGEngine_init(MHEGEngineOptions *);
-int MHEGEngine_run(OctetString *);
-void MHEGEngine_fini();
+int MHEGEngine_run(void);
+void MHEGEngine_fini(void);
MHEGDisplay *MHEGEngine_getDisplay(void);
MHEGVideoOutputMethod *MHEGEngine_getVideoOutputMethod(void);
@@ -237,6 +237,7 @@
bool MHEGEngine_loadFile(OctetString *, OctetString *);
FILE *MHEGEngine_openFile(OctetString *);
FILE *MHEGEngine_openStream(bool, int *, int *, bool, int *, int *);
+void MHEGEngine_retune(OctetString *);
char *MHEGEngine_absoluteFilename(OctetString *);
Modified: redbutton-browser/trunk/rb-browser.c
===================================================================
--- redbutton-browser/trunk/rb-browser.c 2007-01-08 16:57:43 UTC (rev 170)
+++ redbutton-browser/trunk/rb-browser.c 2007-01-10 21:25:52 UTC (rev 171)
@@ -33,11 +33,6 @@
int arg;
size_t last;
int rc;
- int i;
- bool found;
- OctetString boot_obj;
- /* search order for the app to boot in the Service Gateway dir */
- char *boot_order[] = { "~//a", "~//startup", NULL };
/* we assume &struct == &struct.first_item, not sure if C guarantees it */
ApplicationClass app;
@@ -106,27 +101,8 @@
MHEGEngine_init(&opts);
- /* search for the boot object */
- found = false;
- for(i=0; !found && boot_order[i] != NULL; i++)
- {
- boot_obj.size = strlen(boot_order[i]);
- boot_obj.data = boot_order[i];
- found = MHEGEngine_checkContentRef(&boot_obj);
- }
+ rc = MHEGEngine_run();
- if(found)
- {
- verbose("Booting '%.*s'", boot_obj.size, boot_obj.data);
- rc = MHEGEngine_run(&boot_obj);
- }
- else
- {
- error("Unable to find boot object in service gateway '%s'", opts.srg_loc);
- rc = EXIT_FAILURE;
- }
-
- /* clean up */
MHEGEngine_fini();
return rc;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|