Thread: [Redbutton-devel] SF.net SVN: redbutton: [275] redbutton-browser/trunk (Page 4)
Brought to you by:
skilvington
|
From: <ski...@us...> - 2007-04-03 14:14:43
|
Revision: 275
http://svn.sourceforge.net/redbutton/?rev=275&view=rev
Author: skilvington
Date: 2007-04-03 07:14:42 -0700 (Tue, 03 Apr 2007)
Log Message:
-----------
SI_GetBasicSI resident programme
Modified Paths:
--------------
redbutton-browser/trunk/ResidentProgramClass.c
redbutton-browser/trunk/si.c
redbutton-browser/trunk/si.h
Modified: redbutton-browser/trunk/ResidentProgramClass.c
===================================================================
--- redbutton-browser/trunk/ResidentProgramClass.c 2007-04-03 13:10:45 UTC (rev 274)
+++ redbutton-browser/trunk/ResidentProgramClass.c 2007-04-03 14:14:42 UTC (rev 275)
@@ -991,6 +991,17 @@
bool
prog_SI_GetBasicSI(LIST_OF(Parameter) *params, OctetString *caller_gid)
{
+ GenericInteger *serviceIndex_par;
+ GenericInteger *networkId_par;
+ GenericInteger *origNetworkId_par;
+ GenericInteger *transportStreamId_par;
+ GenericInteger *serviceId_par;
+ int si;
+ OctetString *url;
+ unsigned int network_id;
+ unsigned int transport_id;
+ unsigned int service_id;
+
if(!check_parameters(params, 5, Parameter_new_generic_integer, /* in: serviceIndex */
Parameter_new_generic_integer, /* out: networkId */
Parameter_new_generic_integer, /* out: origNetworkId */
@@ -1000,8 +1011,28 @@
error("ResidentProgram: SI_GetBasicSI (BSI): wrong number or type of parameters");
return false;
}
-/* TODO */
-printf("TODO: program BSI SI_GetBasicSI\n");
+
+ serviceIndex_par = &(get_parameter(params, 1)->u.new_generic_integer);
+ networkId_par = &(get_parameter(params, 2)->u.new_generic_integer);
+ origNetworkId_par = &(get_parameter(params, 3)->u.new_generic_integer);
+ transportStreamId_par = &(get_parameter(params, 4)->u.new_generic_integer);
+ serviceId_par = &(get_parameter(params, 5)->u.new_generic_integer);
+
+ si = GenericInteger_getInteger(serviceIndex_par, caller_gid);
+ url = si_get_url(si);
+
+ network_id = si_get_network_id(url);
+ transport_id = si_get_transport_id(url);
+ service_id = si_get_service_id(url);
+
+ /* not sure what the difference between the Network ID and the Original Network ID is */
+ GenericInteger_setInteger(networkId_par, caller_gid, network_id);
+ GenericInteger_setInteger(origNetworkId_par, caller_gid, network_id);
+ GenericInteger_setInteger(transportStreamId_par, caller_gid, transport_id);
+ GenericInteger_setInteger(serviceId_par, caller_gid, service_id);
+
+ verbose("ResidentProgram: SI_GetBasicSI(%u, %u, %u, %u, %u)", si, network_id, network_id, transport_id, service_id);
+
return true;
}
Modified: redbutton-browser/trunk/si.c
===================================================================
--- redbutton-browser/trunk/si.c 2007-04-03 13:10:45 UTC (rev 274)
+++ redbutton-browser/trunk/si.c 2007-04-03 14:14:42 UTC (rev 275)
@@ -22,6 +22,12 @@
if(OctetString_cmp(ref, &si_channel[i]) == 0)
return i;
+/* TODO */
+/* convert rec://svc/{def,cur,lcn/X} to dvb://network.transport.service */
+/* even if we don't have a backend! */
+if(ref->size < 6 || strncmp(ref->data, "dvb://", 6) != 0)
+printf("TODO: si_get_index '%.*s' is not in 'dvb://' format\n", ref->size, ref->data);
+
/* add it to the list */
si_max_index ++;
si_channel = safe_realloc(si_channel, (si_max_index + 1) * sizeof(OctetString));
@@ -30,6 +36,18 @@
return si_max_index;
}
+OctetString *
+si_get_url(int index)
+{
+ if(index > si_max_index)
+ {
+ error("SI_GetURL: invalid service index (%d); max is %d", index, si_max_index);
+ return NULL;
+ }
+
+ return &si_channel[index];
+}
+
bool
si_tune_index(int index)
{
@@ -44,12 +62,72 @@
return true;
}
+/*
+ * URL format is:
+ * dvb://original_network_id.[transport_id].service_id
+ * each id is a hex value without any preceeding 0x etc
+ */
+
unsigned int
+si_get_network_id(OctetString *ref)
+{
+ unsigned int pos;
+ unsigned int id;
+
+ if(ref == NULL || ref->size < 6 || strncmp(ref->data, "dvb://", 6) != 0)
+ return 0;
+
+ /* read upto the first . or end of string */
+ id = 0;
+ pos = 6;
+ while(pos < ref->size && isxdigit(ref->data[pos]))
+ {
+ id <<= 4;
+ id += char2hex(ref->data[pos]);
+ pos ++;
+ }
+
+ return id;
+}
+
+unsigned int
+si_get_transport_id(OctetString *ref)
+{
+ unsigned int pos;
+ unsigned int id;
+
+ if(ref == NULL || ref->size < 6 || strncmp(ref->data, "dvb://", 6) != 0)
+ return 0;
+
+ /* find the first . or end of string */
+ pos = 6;
+ while(pos < ref->size && ref->data[pos] != '.')
+ pos ++;
+
+ /* skip the . */
+ pos ++;
+
+ /* read the value */
+ id = 0;
+ while(pos < ref->size && isxdigit(ref->data[pos]))
+ {
+ id <<= 4;
+ id += char2hex(ref->data[pos]);
+ pos ++;
+ }
+
+ return id;
+}
+
+unsigned int
si_get_service_id(OctetString *ref)
{
unsigned int len;
unsigned int id;
+ if(ref == NULL || ref->size < 6 || strncmp(ref->data, "dvb://", 6) != 0)
+ return 0;
+
len = ref->size;
while(len > 0 && isxdigit(ref->data[len - 1]))
len --;
Modified: redbutton-browser/trunk/si.h
===================================================================
--- redbutton-browser/trunk/si.h 2007-04-03 13:10:45 UTC (rev 274)
+++ redbutton-browser/trunk/si.h 2007-04-03 14:14:42 UTC (rev 275)
@@ -8,8 +8,12 @@
#include "der_decode.h"
int si_get_index(OctetString *);
+OctetString *si_get_url(int);
+
bool si_tune_index(int);
+unsigned int si_get_network_id(OctetString *);
+unsigned int si_get_transport_id(OctetString *);
unsigned int si_get_service_id(OctetString *);
void si_free(void);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ski...@us...> - 2007-04-08 11:50:34
|
Revision: 279
http://svn.sourceforge.net/redbutton/?rev=279&view=rev
Author: skilvington
Date: 2007-04-08 04:50:31 -0700 (Sun, 08 Apr 2007)
Log Message:
-----------
I know how to do this, but my wife's just had a baby, so it may not get done for a while!
Modified Paths:
--------------
redbutton-browser/trunk/MHEGEngine.c
redbutton-browser/trunk/MHEGEngine.h
redbutton-browser/trunk/si.c
Modified: redbutton-browser/trunk/MHEGEngine.c
===================================================================
--- redbutton-browser/trunk/MHEGEngine.c 2007-04-03 15:13:34 UTC (rev 278)
+++ redbutton-browser/trunk/MHEGEngine.c 2007-04-08 11:50:31 UTC (rev 279)
@@ -1448,6 +1448,22 @@
return (*(engine.backend.fns->retune))(&engine.backend, service);
}
+const OctetString *
+MHEGEngine_getRecSvcDef(void)
+{
+static OctetString _TODO = {4,"TODO"};
+printf("TODO: MHEGEngine_getRecSvcDef\n");
+return (const OctetString *) &_TODO;
+}
+
+const OctetString *
+MHEGEngine_getRecSvcCur(void)
+{
+static OctetString _TODO = {4,"TODO"};
+printf("TODO: MHEGEngine_getRecSvcCur\n");
+return (const OctetString *) &_TODO;
+}
+
/*
* 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
Modified: redbutton-browser/trunk/MHEGEngine.h
===================================================================
--- redbutton-browser/trunk/MHEGEngine.h 2007-04-03 15:13:34 UTC (rev 278)
+++ redbutton-browser/trunk/MHEGEngine.h 2007-04-08 11:50:31 UTC (rev 279)
@@ -246,6 +246,9 @@
void MHEGEngine_closeStream(MHEGStream *);
void MHEGEngine_retune(OctetString *);
+const OctetString *MHEGEngine_getRecSvcDef(void);
+const OctetString *MHEGEngine_getRecSvcCur(void);
+
char *MHEGEngine_absoluteFilename(OctetString *);
/* convert PNG to internal format */
Modified: redbutton-browser/trunk/si.c
===================================================================
--- redbutton-browser/trunk/si.c 2007-04-03 15:13:34 UTC (rev 278)
+++ redbutton-browser/trunk/si.c 2007-04-08 11:50:31 UTC (rev 279)
@@ -12,22 +12,48 @@
static int si_max_index = -1;
static OctetString *si_channel = NULL;
+/*
+ * service can be:
+ * "dvb://<original_network_id>.[<transport_stream_id>].<service_id>"
+ * "rec://svc/def" - use the service we are downloading the carousel from
+ * "rec://svc/cur" - use the current service
+ * this will be the same as "def" unless SetData has been called on the StreamClass
+ * "rec://svc/lcn/X" - use logical channel number X (eg 1 for BBC1, 3 for ITV1, etc)
+ *
+ * we resolve whatever we are given to a dvb:// format URL and store that
+ */
+
int
si_get_index(OctetString *ref)
{
int i;
+ /* resolve it to dvb:// format */
+ if(OctetString_strcmp(ref, "rec://svc/def") == 0)
+ {
+ /* promise we wont change it */
+ ref = (OctetString *) MHEGEngine_getRecSvcDef();
+ }
+ else if(OctetString_strcmp(ref, "rec://svc/cur") == 0)
+ {
+ /* promise we wont change it */
+ ref = (OctetString *) MHEGEngine_getRecSvcCur();
+ }
+ else if(OctetString_strncmp(ref, "rec://svc/lcn/", 14) == 0)
+ {
+/* TODO */
+printf("TODO: si_get_index: service='%.*s'\n", ref->size, ref->data);
+ }
+ else if(OctetString_strncmp(ref, "dvb:", 4) != 0)
+ {
+ error("si_get_index: unexpected service '%.*s'", ref->size, ref->data);
+ }
+
/* have we assigned it already */
for(i=0; i<=si_max_index; i++)
if(OctetString_cmp(ref, &si_channel[i]) == 0)
return i;
-/* TODO */
-/* convert rec://svc/{def,cur,lcn/X} to dvb://network.transport.service */
-/* even if we don't have a backend! */
-if(ref->size < 6 || strncmp(ref->data, "dvb://", 6) != 0)
-printf("TODO: si_get_index '%.*s' is not in 'dvb://' format\n", ref->size, ref->data);
-
/* add it to the list */
si_max_index ++;
si_channel = safe_realloc(si_channel, (si_max_index + 1) * sizeof(OctetString));
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ski...@us...> - 2007-04-13 14:26:32
|
Revision: 281
http://svn.sourceforge.net/redbutton/?rev=281&view=rev
Author: skilvington
Date: 2007-04-13 07:26:28 -0700 (Fri, 13 Apr 2007)
Log Message:
-----------
keep track of rec://svc/def
Modified Paths:
--------------
redbutton-browser/trunk/MHEGBackend.c
redbutton-browser/trunk/MHEGBackend.h
redbutton-browser/trunk/MHEGEngine.c
Modified: redbutton-browser/trunk/MHEGBackend.c
===================================================================
--- redbutton-browser/trunk/MHEGBackend.c 2007-04-11 09:44:27 UTC (rev 280)
+++ redbutton-browser/trunk/MHEGBackend.c 2007-04-13 14:26:28 UTC (rev 281)
@@ -21,6 +21,11 @@
static MHEGStream *open_stream(MHEGBackend *, int, bool, int *, int *, bool, int *, int *);
static void close_stream(MHEGBackend *, MHEGStream *);
+static void local_set_service_url(MHEGBackend *);
+static void remote_set_service_url(MHEGBackend *);
+
+static const OctetString *get_service_url(MHEGBackend *);
+
static int parse_addr(char *, struct in_addr *, in_port_t *);
static int get_host_addr(char *, struct in_addr *);
@@ -40,6 +45,7 @@
open_stream, /* openStream */
close_stream, /* closeStream */
local_retune, /* retune */
+ get_service_url, /* getServiceURL */
};
/* remote backend funcs */
@@ -56,9 +62,11 @@
open_stream, /* openStream */
close_stream, /* closeStream */
remote_retune, /* retune */
+ get_service_url, /* getServiceURL */
};
/* public interface */
+
void
MHEGBackend_init(MHEGBackend *b, bool remote, char *srg_loc)
{
@@ -72,6 +80,10 @@
/* no connection to the backend yet */
b->be_sock = NULL;
+ /* don't know rec://svc/def yet */
+ b->rec_svc_def.size = 0;
+ b->rec_svc_def.data = NULL;
+
if(remote)
{
/* backend is on a different host, srg_loc is the remote host[:port] */
@@ -80,6 +92,8 @@
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));
+ /* initialise rec://svc/def value */
+ remote_set_service_url(b);
}
else
{
@@ -87,8 +101,12 @@
b->fns = &local_backend_fns;
b->base_dir = safe_strdup(srg_loc);
verbose("Local backend; carousel file root '%s'", srg_loc);
+ /* initialise rec://svc/def value */
+ local_set_service_url(b);
}
+ verbose("Current service is %.*s", b->rec_svc_def.size, b->rec_svc_def.data);
+
return;
}
@@ -102,6 +120,8 @@
safe_free(b->base_dir);
+ safe_free(b->rec_svc_def.data);
+
return;
}
@@ -320,6 +340,88 @@
}
/*
+ * update rec_svc_def to the service directory we are reading the carousel from
+ * rec_svc_def will be in dvb:// format, but the network_id will be empty
+ * eg if we are reading path/to/services/4165, then rec_svc_def will be dvb://..1045
+ */
+
+static void
+local_set_service_url(MHEGBackend *t)
+{
+ char *slash;
+ int prefix_len;
+ int service_id;
+ char url[1024];
+ size_t len;
+
+ /* base_dir is: [path/to/services/]<service_id> */
+ slash = strrchr(t->base_dir, '/');
+ if(slash == NULL)
+ {
+ /* no preceeding path */
+ service_id = atoi(t->base_dir);
+ }
+ else
+ {
+ prefix_len = (slash - t->base_dir) + 1;
+ service_id = atoi(t->base_dir + prefix_len);
+ }
+
+ /* create a fake dvb:// format URL */
+ len = snprintf(url, sizeof(url), "dvb://..%x", service_id);
+
+ /* overwrite any existing value */
+ t->rec_svc_def.size = len;
+ t->rec_svc_def.data = safe_realloc(t->rec_svc_def.data, len);
+ memcpy(t->rec_svc_def.data, url, len);
+
+ return;
+}
+
+/*
+ * update rec_svc_def to the service we are downloading the carousel from
+ * rec_svc_def will be in dvb:// format
+ */
+
+static void
+remote_set_service_url(MHEGBackend *t)
+{
+ char cmd[32];
+ FILE *sock;
+ char url[1024];
+ size_t len;
+
+ /* send backend a "service" command, response is carousel service in dvb:// format */
+ snprintf(cmd, sizeof(cmd), "service\n");
+
+ if((sock = remote_command(t, true, cmd)) == NULL
+ || remote_response(sock) != BACKEND_RESPONSE_OK
+ || fgets(url, sizeof(url), sock) == NULL)
+ {
+ /* this should never happen, and I don't want a NULL rec_svc_def */
+ fatal("Unable to determine current service");
+ }
+
+ /* chop any trailing \n off the URL */
+ len = strlen(url);
+ while(len > 0 && url[len-1] == '\n')
+ len --;
+
+ /* overwrite any existing value */
+ t->rec_svc_def.size = len;
+ t->rec_svc_def.data = safe_realloc(t->rec_svc_def.data, len);
+ memcpy(t->rec_svc_def.data, url, len);
+
+ return;
+}
+
+static const OctetString *
+get_service_url(MHEGBackend *t)
+{
+ return (const OctetString *) &t->rec_svc_def;
+}
+
+/*
* extract the IP addr and port number from a string in one of these forms:
* host:port
* ip-addr:port
@@ -484,6 +586,10 @@
char *slash;
int prefix_len;
+ /* assert */
+ if(service->size < 6 || strncmp(service->data, "dvb://", 6) != 0)
+ fatal("local_retune: unable to tune to '%.*s'", service->size, service->data);
+
/* extract the service_id */
service_id = si_get_service_id(service);
snprintf(service_str, sizeof(service_str), "%u", service_id);
@@ -506,6 +612,9 @@
strcpy(t->base_dir + prefix_len, service_str);
}
+ /* update rec://svc/def */
+ local_set_service_url(t);
+
verbose("Retune: new service gateway is '%s'", t->base_dir);
return;
@@ -647,6 +756,10 @@
char cmd[128];
FILE *sock;
+ /* assert */
+ if(service->size < 6 || strncmp(service->data, "dvb://", 6) != 0)
+ fatal("remote_retune: unable to tune to '%.*s'", service->size, service->data);
+
snprintf(cmd, sizeof(cmd), "retune %u\n", si_get_service_id(service));
if((sock = remote_command(t, true, cmd)) == NULL
@@ -662,6 +775,9 @@
t->be_sock = NULL;
}
+ /* update rec://svc/def */
+ remote_set_service_url(t);
+
return;
}
Modified: redbutton-browser/trunk/MHEGBackend.h
===================================================================
--- redbutton-browser/trunk/MHEGBackend.h 2007-04-11 09:44:27 UTC (rev 280)
+++ redbutton-browser/trunk/MHEGBackend.h 2007-04-13 14:26:28 UTC (rev 281)
@@ -23,6 +23,7 @@
typedef struct MHEGBackend
{
+ OctetString rec_svc_def; /* service we are downloading the carousel from */
char *base_dir; /* local Service Gateway root directory */
struct sockaddr_in addr; /* remote backend IP and port */
FILE *be_sock; /* connection to remote backend */
@@ -41,6 +42,8 @@
void (*closeStream)(struct MHEGBackend *, MHEGStream *);
/* tune to the given service */
void (*retune)(struct MHEGBackend *, OctetString *);
+ /* return a dvb:// URL for the service we are currently downloading the carousel from */
+ const OctetString *(*getServiceURL)(struct MHEGBackend *);
} *fns;
} MHEGBackend;
Modified: redbutton-browser/trunk/MHEGEngine.c
===================================================================
--- redbutton-browser/trunk/MHEGEngine.c 2007-04-11 09:44:27 UTC (rev 280)
+++ redbutton-browser/trunk/MHEGEngine.c 2007-04-13 14:26:28 UTC (rev 281)
@@ -1448,20 +1448,31 @@
return (*(engine.backend.fns->retune))(&engine.backend, service);
}
+/*
+ * return a read-only dvb:// format value for rec://svc/def
+ */
+
const OctetString *
MHEGEngine_getRecSvcDef(void)
{
-static OctetString _TODO = {4,"TODO"};
-printf("TODO: MHEGEngine_getRecSvcDef\n");
-return (const OctetString *) &_TODO;
+ /* ask the backend */
+ return (*(engine.backend.fns->getServiceURL))(&engine.backend);
}
+/*
+ * return a read-only dvb:// format value for rec://svc/cur
+ */
+
const OctetString *
MHEGEngine_getRecSvcCur(void)
{
-static OctetString _TODO = {4,"TODO"};
-printf("TODO: MHEGEngine_getRecSvcCur\n");
-return (const OctetString *) &_TODO;
+/* TODO */
+// need to keep track of this ourselves
+// initially svc/cur = svc/def
+// only changes if SetData called on StreamClass
+// retune => reset to svc/cur = svc/def again?
+printf("TODO: MHEGEngine_getRecSvcCur: returning rec://svc/def instead\n");
+return (*(engine.backend.fns->getServiceURL))(&engine.backend);
}
/*
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ski...@us...> - 2007-04-15 09:17:30
|
Revision: 286
http://svn.sourceforge.net/redbutton/?rev=286&view=rev
Author: skilvington
Date: 2007-04-15 02:17:28 -0700 (Sun, 15 Apr 2007)
Log Message:
-----------
add SetVideoDecodeOffset method to VideoClass
Modified Paths:
--------------
redbutton-browser/trunk/MHEGStreamPlayer.c
redbutton-browser/trunk/VideoClass.c
Modified: redbutton-browser/trunk/MHEGStreamPlayer.c
===================================================================
--- redbutton-browser/trunk/MHEGStreamPlayer.c 2007-04-13 22:14:11 UTC (rev 285)
+++ redbutton-browser/trunk/MHEGStreamPlayer.c 2007-04-15 09:17:28 UTC (rev 286)
@@ -510,6 +510,8 @@
MHEGVideoOutput vo;
int out_x;
int out_y;
+ int off_x;
+ int off_y;
unsigned int out_width;
unsigned int out_height;
unsigned int vid_width;
@@ -658,6 +660,9 @@
out_y = p->video->inst.Position.y_position;
vid_width = p->video->inst.BoxSize.x_length;
vid_height = p->video->inst.BoxSize.y_length;
+ /* VideoDecodeOffset position */
+ off_x = p->video->inst.VideoDecodeOffset.x_position;
+ off_y = p->video->inst.VideoDecodeOffset.y_position;
pthread_mutex_unlock(&p->video->inst.bbox_lock);
/* scale if fullscreen */
if(d->fullscreen)
@@ -666,12 +671,14 @@
out_y = (out_y * d->yres) / MHEG_YRES;
vid_width = (vid_width * d->xres) / MHEG_XRES;
vid_height = (vid_height * d->yres) / MHEG_YRES;
+ off_x = (off_x * d->xres) / MHEG_XRES;
+ off_y = (off_y * d->yres) / MHEG_YRES;
}
/* if the frame is smaller or larger than the VideoClass, centre it */
out_x += (vid_width - out_width) / 2;
out_y += (vid_height - out_height) / 2;
/* draw the current frame */
- MHEGVideoOutput_drawFrame(&vo, out_x, out_y);
+ MHEGVideoOutput_drawFrame(&vo, out_x + off_x, out_y + off_y);
/* redraw objects above the video */
pthread_mutex_lock(&p->video->inst.bbox_lock);
MHEGDisplay_refresh(d, &p->video->inst.Position, &p->video->inst.BoxSize);
Modified: redbutton-browser/trunk/VideoClass.c
===================================================================
--- redbutton-browser/trunk/VideoClass.c 2007-04-13 22:14:11 UTC (rev 285)
+++ redbutton-browser/trunk/VideoClass.c 2007-04-15 09:17:28 UTC (rev 286)
@@ -360,8 +360,15 @@
{
verbose("VideoClass: %s; SetVideoDecodeOffset", ExternalReference_name(&t->rootClass.inst.ref));
-/* TODO */
-printf("TODO: VideoClass_SetVideoDecodeOffset not yet implemented\n");
+ pthread_mutex_lock(&t->inst.bbox_lock);
+ t->inst.VideoDecodeOffset.x_position = GenericInteger_getInteger(¶ms->new_x_offset, caller_gid);
+ t->inst.VideoDecodeOffset.y_position = GenericInteger_getInteger(¶ms->new_y_offset, caller_gid);
+ pthread_mutex_unlock(&t->inst.bbox_lock);
+
+ /* if it is active, redraw it */
+ if(t->rootClass.inst.RunningStatus)
+ MHEGEngine_redrawArea(&t->inst.Position, &t->inst.BoxSize);
+
return;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ski...@us...> - 2007-04-15 09:47:33
|
Revision: 287
http://svn.sourceforge.net/redbutton/?rev=287&view=rev
Author: skilvington
Date: 2007-04-15 02:47:31 -0700 (Sun, 15 Apr 2007)
Log Message:
-----------
screen will be redrawn for us
Modified Paths:
--------------
redbutton-browser/trunk/TODO
redbutton-browser/trunk/VideoClass.c
Modified: redbutton-browser/trunk/TODO
===================================================================
--- redbutton-browser/trunk/TODO 2007-04-15 09:17:28 UTC (rev 286)
+++ redbutton-browser/trunk/TODO 2007-04-15 09:47:31 UTC (rev 287)
@@ -4,11 +4,9 @@
aspect ratio
-VideoDecodeOffset
-
-
if video size != VideoClass size, draw a smaller transparent hole
or fill the frame edges with black
+also fill with black after SetVideoDecodeOffset
use ffmpeg to permenantly scale-up bitmaps in MHEGBitmap_fromRGBA
Modified: redbutton-browser/trunk/VideoClass.c
===================================================================
--- redbutton-browser/trunk/VideoClass.c 2007-04-15 09:17:28 UTC (rev 286)
+++ redbutton-browser/trunk/VideoClass.c 2007-04-15 09:47:31 UTC (rev 287)
@@ -365,9 +365,10 @@
t->inst.VideoDecodeOffset.y_position = GenericInteger_getInteger(¶ms->new_y_offset, caller_gid);
pthread_mutex_unlock(&t->inst.bbox_lock);
- /* if it is active, redraw it */
- if(t->rootClass.inst.RunningStatus)
- MHEGEngine_redrawArea(&t->inst.Position, &t->inst.BoxSize);
+ /* screen will be updated next time we draw a video frame */
+/* TODO */
+/* should probably clear content Pixmap to black */
+/* x,y = t->inst.Position, w,h = t->inst.BoxSize */
return;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ski...@us...> - 2007-05-23 10:38:20
|
Revision: 308
http://svn.sourceforge.net/redbutton/?rev=308&view=rev
Author: skilvington
Date: 2007-05-23 03:38:19 -0700 (Wed, 23 May 2007)
Log Message:
-----------
stop verbose messages from different threads overlapping
Modified Paths:
--------------
redbutton-browser/trunk/MHEGEngine.c
redbutton-browser/trunk/TODO
Modified: redbutton-browser/trunk/MHEGEngine.c
===================================================================
--- redbutton-browser/trunk/MHEGEngine.c 2007-05-23 10:31:02 UTC (rev 307)
+++ redbutton-browser/trunk/MHEGEngine.c 2007-05-23 10:38:19 UTC (rev 308)
@@ -1600,6 +1600,9 @@
return;
}
+/* stop verbose messages from different threads overlapping */
+pthread_mutex_t stdout_lock = PTHREAD_MUTEX_INITIALIZER;
+
void
verbose(char *message, ...)
{
@@ -1607,10 +1610,12 @@
if(engine.verbose)
{
+ pthread_mutex_lock(&stdout_lock);
va_start(ap, message);
vprintf(message, ap);
printf("\n");
va_end(ap);
+ pthread_mutex_unlock(&stdout_lock);
}
return;
Modified: redbutton-browser/trunk/TODO
===================================================================
--- redbutton-browser/trunk/TODO 2007-05-23 10:31:02 UTC (rev 307)
+++ redbutton-browser/trunk/TODO 2007-05-23 10:38:19 UTC (rev 308)
@@ -1,3 +1,11 @@
+got this once when changing channels:
+X Error of failed request: BadAccess (attempt to access private resource denied)
+ Major opcode of failed request: 146 (MIT-SHM)
+ Minor opcode of failed request: 1 (X_ShmAttach)
+ Serial number of failed request: 4292
+ Current serial number in output stream: 4385
+
+
posix_fadvise() when streaming data from the backend?
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ski...@us...> - 2007-05-25 15:36:11
|
Revision: 315
http://svn.sourceforge.net/redbutton/?rev=315&view=rev
Author: skilvington
Date: 2007-05-25 08:35:18 -0700 (Fri, 25 May 2007)
Log Message:
-----------
add remaining ElementaryAction's
Modified Paths:
--------------
redbutton-browser/trunk/ElementaryAction.c
redbutton-browser/trunk/HotspotClass.c
redbutton-browser/trunk/HotspotClass.h
redbutton-browser/trunk/PushButtonClass.c
redbutton-browser/trunk/PushButtonClass.h
redbutton-browser/trunk/SwitchButtonClass.c
redbutton-browser/trunk/SwitchButtonClass.h
Modified: redbutton-browser/trunk/ElementaryAction.c
===================================================================
--- redbutton-browser/trunk/ElementaryAction.c 2007-05-24 08:47:46 UTC (rev 314)
+++ redbutton-browser/trunk/ElementaryAction.c 2007-05-25 15:35:18 UTC (rev 315)
@@ -242,8 +242,14 @@
if(((ref = GenericObjectReference_getObjectReference(&e->u.deselect, caller_gid)) != NULL)
&& ((obj = MHEGEngine_findObjectReference(ref, caller_gid)) != NULL))
{
-/* TODO */
-printf("TODO: Deselect: target: %s\n", ExternalReference_name(&obj->inst.ref));
+ if(obj->inst.rtti == RTTI_HotspotClass)
+ HotspotClass_Deselect((HotspotClass *) obj);
+ else if(obj->inst.rtti == RTTI_PushButtonClass)
+ PushButtonClass_Deselect((PushButtonClass *) obj);
+ else if(obj->inst.rtti == RTTI_SwitchButtonClass)
+ SwitchButtonClass_Deselect((SwitchButtonClass *) obj);
+ else
+ error("Deselect: unexpected target: %s", ExternalReference_name(&obj->inst.ref));
}
break;
@@ -525,8 +531,12 @@
if(((ref = GenericObjectReference_getObjectReference(&e->u.get_label.target, caller_gid)) != NULL)
&& ((obj = MHEGEngine_findObjectReference(ref, caller_gid)) != NULL))
{
-/* TODO */
-printf("TODO: GetLabel: target: %s\n", ExternalReference_name(&obj->inst.ref));
+ if(obj->inst.rtti == RTTI_PushButtonClass)
+ PushButtonClass_GetLabel((PushButtonClass *) obj, &e->u.get_label, caller_gid);
+ else if(obj->inst.rtti == RTTI_SwitchButtonClass)
+ SwitchButtonClass_GetLabel((SwitchButtonClass *) obj, &e->u.get_label, caller_gid);
+ else
+ error("GetLabel: unexpected target: %s", ExternalReference_name(&obj->inst.ref));
}
break;
@@ -666,8 +676,10 @@
if(((ref = GenericObjectReference_getObjectReference(&e->u.get_selection_status.target, caller_gid)) != NULL)
&& ((obj = MHEGEngine_findObjectReference(ref, caller_gid)) != NULL))
{
-/* TODO */
-printf("TODO: GetSelectionStatus: target: %s\n", ExternalReference_name(&obj->inst.ref));
+ if(obj->inst.rtti == RTTI_SwitchButtonClass)
+ SwitchButtonClass_GetSelectionStatus((SwitchButtonClass *) obj, &e->u.get_selection_status, caller_gid);
+ else
+ error("GetSelectionStatus: unexpected target: %s", ExternalReference_name(&obj->inst.ref));
}
break;
@@ -1023,8 +1035,14 @@
if(((ref = GenericObjectReference_getObjectReference(&e->u.select, caller_gid)) != NULL)
&& ((obj = MHEGEngine_findObjectReference(ref, caller_gid)) != NULL))
{
-/* TODO */
-printf("TODO: Select: target: %s\n", ExternalReference_name(&obj->inst.ref));
+ if(obj->inst.rtti == RTTI_HotspotClass)
+ HotspotClass_Select((HotspotClass *) obj);
+ else if(obj->inst.rtti == RTTI_PushButtonClass)
+ PushButtonClass_Select((PushButtonClass *) obj);
+ else if(obj->inst.rtti == RTTI_SwitchButtonClass)
+ SwitchButtonClass_Select((SwitchButtonClass *) obj);
+ else
+ error("Select: unexpected target: %s", ExternalReference_name(&obj->inst.ref));
}
break;
@@ -1289,8 +1307,12 @@
if(((ref = GenericObjectReference_getObjectReference(&e->u.set_label.target, caller_gid)) != NULL)
&& ((obj = MHEGEngine_findObjectReference(ref, caller_gid)) != NULL))
{
-/* TODO */
-printf("TODO: SetLabel: target: %s\n", ExternalReference_name(&obj->inst.ref));
+ if(obj->inst.rtti == RTTI_PushButtonClass)
+ PushButtonClass_SetLabel((PushButtonClass *) obj, &e->u.set_label, caller_gid);
+ else if(obj->inst.rtti == RTTI_SwitchButtonClass)
+ SwitchButtonClass_SetLabel((SwitchButtonClass *) obj, &e->u.set_label, caller_gid);
+ else
+ error("SetLabel: unexpected target: %s", ExternalReference_name(&obj->inst.ref));
}
break;
@@ -1592,8 +1614,10 @@
if(((ref = GenericObjectReference_getObjectReference(&e->u.toggle, caller_gid)) != NULL)
&& ((obj = MHEGEngine_findObjectReference(ref, caller_gid)) != NULL))
{
-/* TODO */
-printf("TODO: Toggle: target: %s\n", ExternalReference_name(&obj->inst.ref));
+ if(obj->inst.rtti == RTTI_SwitchButtonClass)
+ SwitchButtonClass_Toggle((SwitchButtonClass *) obj);
+ else
+ error("Toggle: unexpected target: %s", ExternalReference_name(&obj->inst.ref));
}
break;
Modified: redbutton-browser/trunk/HotspotClass.c
===================================================================
--- redbutton-browser/trunk/HotspotClass.c 2007-05-24 08:47:46 UTC (rev 314)
+++ redbutton-browser/trunk/HotspotClass.c 2007-05-25 15:35:18 UTC (rev 315)
@@ -38,3 +38,19 @@
return;
}
+void
+HotspotClass_Select(HotspotClass *t)
+{
+ error("HotspotClass: %s; not supported", ExternalReference_name(&t->rootClass.inst.ref));
+
+ return;
+}
+
+void
+HotspotClass_Deselect(HotspotClass *t)
+{
+ error("HotspotClass: %s; not supported", ExternalReference_name(&t->rootClass.inst.ref));
+
+ return;
+}
+
Modified: redbutton-browser/trunk/HotspotClass.h
===================================================================
--- redbutton-browser/trunk/HotspotClass.h 2007-05-24 08:47:46 UTC (rev 314)
+++ redbutton-browser/trunk/HotspotClass.h 2007-05-25 15:35:18 UTC (rev 315)
@@ -12,5 +12,8 @@
void HotspotClass_Deactivation(HotspotClass *);
void HotspotClass_Destruction(HotspotClass *);
+void HotspotClass_Select(HotspotClass *);
+void HotspotClass_Deselect(HotspotClass *);
+
#endif /* __HOTSPOTCLASS_H__ */
Modified: redbutton-browser/trunk/PushButtonClass.c
===================================================================
--- redbutton-browser/trunk/PushButtonClass.c 2007-05-24 08:47:46 UTC (rev 314)
+++ redbutton-browser/trunk/PushButtonClass.c 2007-05-25 15:35:18 UTC (rev 315)
@@ -38,3 +38,35 @@
return;
}
+void
+PushButtonClass_Select(PushButtonClass *t)
+{
+ error("PushButtonClass: %s; not supported", ExternalReference_name(&t->rootClass.inst.ref));
+
+ return;
+}
+
+void
+PushButtonClass_Deselect(PushButtonClass *t)
+{
+ error("PushButtonClass: %s; not supported", ExternalReference_name(&t->rootClass.inst.ref));
+
+ return;
+}
+
+void
+PushButtonClass_GetLabel(PushButtonClass *t, GetLabel *params, OctetString *caller_gid)
+{
+ error("PushButtonClass: %s; not supported", ExternalReference_name(&t->rootClass.inst.ref));
+
+ return;
+}
+
+void
+PushButtonClass_SetLabel(PushButtonClass *t, SetLabel *params, OctetString *caller_gid)
+{
+ error("PushButtonClass: %s; not supported", ExternalReference_name(&t->rootClass.inst.ref));
+
+ return;
+}
+
Modified: redbutton-browser/trunk/PushButtonClass.h
===================================================================
--- redbutton-browser/trunk/PushButtonClass.h 2007-05-24 08:47:46 UTC (rev 314)
+++ redbutton-browser/trunk/PushButtonClass.h 2007-05-25 15:35:18 UTC (rev 315)
@@ -12,5 +12,10 @@
void PushButtonClass_Deactivation(PushButtonClass *);
void PushButtonClass_Destruction(PushButtonClass *);
+void PushButtonClass_Select(PushButtonClass *);
+void PushButtonClass_Deselect(PushButtonClass *);
+void PushButtonClass_GetLabel(PushButtonClass *, GetLabel *, OctetString *);
+void PushButtonClass_SetLabel(PushButtonClass *, SetLabel *, OctetString *);
+
#endif /* __PUSHBUTTONCLASS_H__ */
Modified: redbutton-browser/trunk/SwitchButtonClass.c
===================================================================
--- redbutton-browser/trunk/SwitchButtonClass.c 2007-05-24 08:47:46 UTC (rev 314)
+++ redbutton-browser/trunk/SwitchButtonClass.c 2007-05-25 15:35:18 UTC (rev 315)
@@ -38,3 +38,51 @@
return;
}
+void
+SwitchButtonClass_GetSelectionStatus(SwitchButtonClass *t, GetSelectionStatus *params, OctetString *caller_gid)
+{
+ error("SwitchButtonClass: %s; not supported", ExternalReference_name(&t->rootClass.inst.ref));
+
+ return;
+}
+
+void
+SwitchButtonClass_Select(SwitchButtonClass *t)
+{
+ error("SwitchButtonClass: %s; not supported", ExternalReference_name(&t->rootClass.inst.ref));
+
+ return;
+}
+
+void
+SwitchButtonClass_Deselect(SwitchButtonClass *t)
+{
+ error("SwitchButtonClass: %s; not supported", ExternalReference_name(&t->rootClass.inst.ref));
+
+ return;
+}
+
+void
+SwitchButtonClass_GetLabel(SwitchButtonClass *t, GetLabel *params, OctetString *caller_gid)
+{
+ error("SwitchButtonClass: %s; not supported", ExternalReference_name(&t->rootClass.inst.ref));
+
+ return;
+}
+
+void
+SwitchButtonClass_SetLabel(SwitchButtonClass *t, SetLabel *params, OctetString *caller_gid)
+{
+ error("SwitchButtonClass: %s; not supported", ExternalReference_name(&t->rootClass.inst.ref));
+
+ return;
+}
+
+void
+SwitchButtonClass_Toggle(SwitchButtonClass *t)
+{
+ error("SwitchButtonClass: %s; not supported", ExternalReference_name(&t->rootClass.inst.ref));
+
+ return;
+}
+
Modified: redbutton-browser/trunk/SwitchButtonClass.h
===================================================================
--- redbutton-browser/trunk/SwitchButtonClass.h 2007-05-24 08:47:46 UTC (rev 314)
+++ redbutton-browser/trunk/SwitchButtonClass.h 2007-05-25 15:35:18 UTC (rev 315)
@@ -12,5 +12,12 @@
void SwitchButtonClass_Deactivation(SwitchButtonClass *);
void SwitchButtonClass_Destruction(SwitchButtonClass *);
+void SwitchButtonClass_GetSelectionStatus(SwitchButtonClass *, GetSelectionStatus *, OctetString *);
+void SwitchButtonClass_Select(SwitchButtonClass *);
+void SwitchButtonClass_Deselect(SwitchButtonClass *);
+void SwitchButtonClass_GetLabel(SwitchButtonClass *, GetLabel *, OctetString *);
+void SwitchButtonClass_SetLabel(SwitchButtonClass *, SetLabel *, OctetString *);
+void SwitchButtonClass_Toggle(SwitchButtonClass *);
+
#endif /* __SWITCHBUTTONCLASS_H__ */
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ski...@us...> - 2007-07-16 16:00:45
|
Revision: 320
http://svn.sourceforge.net/redbutton/?rev=320&view=rev
Author: skilvington
Date: 2007-07-16 09:00:42 -0700 (Mon, 16 Jul 2007)
Log Message:
-----------
factor out converting MHEG coords to screen coords
Modified Paths:
--------------
redbutton-browser/trunk/MHEGCanvas.c
redbutton-browser/trunk/MHEGDisplay.c
redbutton-browser/trunk/MHEGDisplay.h
redbutton-browser/trunk/MHEGStreamPlayer.c
Modified: redbutton-browser/trunk/MHEGCanvas.c
===================================================================
--- redbutton-browser/trunk/MHEGCanvas.c 2007-06-26 14:30:03 UTC (rev 319)
+++ redbutton-browser/trunk/MHEGCanvas.c 2007-07-16 16:00:42 UTC (rev 320)
@@ -21,8 +21,8 @@
MHEGDisplay *d = MHEGEngine_getDisplay();
/* scale width/height if fullscreen */
- c->width = (width * d->xres) / MHEG_XRES;
- c->height = (height * d->yres) / MHEG_YRES;
+ c->width = MHEGDisplay_scaleX(d, width);
+ c->height = MHEGDisplay_scaleY(d, height);
/* no border set yet */
c->border = 0;
@@ -83,7 +83,7 @@
error("MHEGCanvas_setBorder: LineStyle %d not supported (using a solid line)", style);
/* scale width if fullscreen */
- c->border = (width * d->xres) / MHEG_XRES;
+ c->border = MHEGDisplay_scaleX(d, width);
/* draw the border */
gcvals.foreground = pixel_value(c->pic_format, colour);
@@ -160,11 +160,11 @@
error("MHEGCanvas_drawArc: LineStyle %d not supported (using a solid line)", style);
/* scale up if fullscreen */
- x = (pos->x_position * d->xres) / MHEG_XRES;
- y = (pos->y_position * d->yres) / MHEG_YRES;
- w = (box->x_length * d->xres) / MHEG_XRES;
- h = (box->y_length * d->yres) / MHEG_YRES;
- width = (width * d->xres) / MHEG_XRES;
+ x = MHEGDisplay_scaleX(d, pos->x_position);
+ y = MHEGDisplay_scaleY(d, pos->y_position);
+ w = MHEGDisplay_scaleX(d, box->x_length);
+ h = MHEGDisplay_scaleY(d, box->y_length);
+ width = MHEGDisplay_scaleX(d, width);
/* set up the GC values */
gcvals.foreground = pixel_value(c->pic_format, colour);
@@ -200,11 +200,11 @@
error("MHEGCanvas_drawSector: LineStyle %d not supported (using a solid line)", style);
/* scale up if fullscreen */
- x = (pos->x_position * d->xres) / MHEG_XRES;
- y = (pos->y_position * d->yres) / MHEG_YRES;
- w = (box->x_length * d->xres) / MHEG_XRES;
- h = (box->y_length * d->yres) / MHEG_YRES;
- width = (width * d->xres) / MHEG_XRES;
+ x = MHEGDisplay_scaleX(d, pos->x_position);
+ y = MHEGDisplay_scaleY(d, pos->y_position);
+ w = MHEGDisplay_scaleX(d, box->x_length);
+ h = MHEGDisplay_scaleY(d, box->y_length);
+ width = MHEGDisplay_scaleX(d, width);
/* fill it */
gcvals.foreground = pixel_value(c->pic_format, fill_col);
@@ -265,11 +265,11 @@
error("MHEGCanvas_drawLine: LineStyle %d not supported (using a solid line)", style);
/* scale up if fullscreen */
- x1 = (p1->x_position * d->xres) / MHEG_XRES;
- y1 = (p1->y_position * d->yres) / MHEG_YRES;
- x2 = (p2->x_position * d->xres) / MHEG_XRES;
- y2 = (p2->y_position * d->yres) / MHEG_YRES;
- width = (width * d->xres) / MHEG_XRES;
+ x1 = MHEGDisplay_scaleX(d, p1->x_position);
+ y1 = MHEGDisplay_scaleY(d, p1->y_position);
+ x2 = MHEGDisplay_scaleX(d, p2->x_position);
+ y2 = MHEGDisplay_scaleY(d, p2->y_position);
+ width = MHEGDisplay_scaleX(d, width);
/* set up the GC values */
gcvals.foreground = pixel_value(c->pic_format, colour);
@@ -298,11 +298,11 @@
error("MHEGCanvas_drawOval: LineStyle %d not supported (using a solid line)", style);
/* scale up if fullscreen */
- x = (pos->x_position * d->xres) / MHEG_XRES;
- y = (pos->y_position * d->yres) / MHEG_YRES;
- w = (box->x_length * d->xres) / MHEG_XRES;
- h = (box->y_length * d->yres) / MHEG_YRES;
- width = (width * d->xres) / MHEG_XRES;
+ x = MHEGDisplay_scaleX(d, pos->x_position);
+ y = MHEGDisplay_scaleY(d, pos->y_position);
+ w = MHEGDisplay_scaleX(d, box->x_length);
+ h = MHEGDisplay_scaleY(d, box->y_length);
+ width = MHEGDisplay_scaleX(d, width);
/* fill it */
gcvals.foreground = pixel_value(c->pic_format, fill_col);
@@ -344,7 +344,7 @@
error("MHEGCanvas_drawPolygon: LineStyle %d not supported (using a solid line)", style);
/* scale up if fullscreen */
- width = (width * d->xres) / MHEG_XRES;
+ width = MHEGDisplay_scaleX(d, width);
/* convert the XYPosition list into an array of XPoint's */
nxpts = 0;
@@ -361,8 +361,8 @@
for(i=0; i<nxpts; i++)
{
/* scale up if fullscreen */
- xpts[i].x = (pos->item.x_position * d->xres) / MHEG_XRES;
- xpts[i].y = (pos->item.y_position * d->yres) / MHEG_YRES;
+ xpts[i].x = MHEGDisplay_scaleX(d, pos->item.x_position);
+ xpts[i].y = MHEGDisplay_scaleY(d, pos->item.y_position);
pos = pos->next;
}
@@ -376,8 +376,8 @@
if(width > 0)
{
/* close the polygon */
- xpts[nxpts].x = (xy_list->item.x_position * d->xres) / MHEG_XRES;
- xpts[nxpts].y = (xy_list->item.y_position * d->yres) / MHEG_YRES;
+ xpts[nxpts].x = MHEGDisplay_scaleX(d, xy_list->item.x_position);
+ xpts[nxpts].y = MHEGDisplay_scaleY(d, xy_list->item.y_position);
/* set the line width and colour */
gcvals.foreground = pixel_value(c->pic_format, line_col);
gcvals.line_width = width;
@@ -414,7 +414,7 @@
error("MHEGCanvas_drawPolyline: LineStyle %d not supported (using a solid line)", style);
/* scale up if fullscreen */
- width = (width * d->xres) / MHEG_XRES;
+ width = MHEGDisplay_scaleX(d, width);
/* convert the XYPosition list into an array of XPoint's */
nxpts = 0;
@@ -430,8 +430,8 @@
for(i=0; i<nxpts; i++)
{
/* scale up if fullscreen */
- xpts[i].x = (pos->item.x_position * d->xres) / MHEG_XRES;
- xpts[i].y = (pos->item.y_position * d->yres) / MHEG_YRES;
+ xpts[i].x = MHEGDisplay_scaleX(d, pos->item.x_position);
+ xpts[i].y = MHEGDisplay_scaleY(d, pos->item.y_position);
pos = pos->next;
}
@@ -466,11 +466,11 @@
error("MHEGCanvas_drawRectangle: LineStyle %d not supported (using a solid line)", style);
/* scale up if fullscreen */
- x = (pos->x_position * d->xres) / MHEG_XRES;
- y = (pos->y_position * d->yres) / MHEG_YRES;
- w = (box->x_length * d->xres) / MHEG_XRES;
- h = (box->y_length * d->yres) / MHEG_YRES;
- width = (width * d->xres) / MHEG_XRES;
+ x = MHEGDisplay_scaleX(d, pos->x_position);
+ y = MHEGDisplay_scaleY(d, pos->y_position);
+ w = MHEGDisplay_scaleX(d, box->x_length);
+ h = MHEGDisplay_scaleY(d, box->y_length);
+ width = MHEGDisplay_scaleX(d, width);
/* fill it */
gcvals.foreground = pixel_value(c->pic_format, fill_col);
Modified: redbutton-browser/trunk/MHEGDisplay.c
===================================================================
--- redbutton-browser/trunk/MHEGDisplay.c 2007-06-26 14:30:03 UTC (rev 319)
+++ redbutton-browser/trunk/MHEGDisplay.c 2007-07-16 16:00:42 UTC (rev 320)
@@ -367,10 +367,10 @@
unsigned int w, h;
/* scale if fullscreen */
- x = (pos->x_position * d->xres) / MHEG_XRES;
- y = (pos->y_position * d->yres) / MHEG_YRES;
- w = (box->x_length * d->xres) / MHEG_XRES;
- h = (box->y_length * d->yres) / MHEG_YRES;
+ x = MHEGDisplay_scaleX(d, pos->x_position);
+ y = MHEGDisplay_scaleY(d, pos->y_position);
+ w = MHEGDisplay_scaleX(d, box->x_length);
+ h = MHEGDisplay_scaleY(d, box->y_length);
/*
* if video is being displayed, the current frame will already be in d->contents
@@ -426,10 +426,10 @@
XRectangle clip;
/* scale if fullscreen */
- clip.x = (pos->x_position * d->xres) / MHEG_XRES;
- clip.y = (pos->y_position * d->yres) / MHEG_YRES;
- clip.width = (box->x_length * d->xres) / MHEG_XRES;
- clip.height = (box->y_length * d->yres) / MHEG_YRES;
+ clip.x = MHEGDisplay_scaleX(d, pos->x_position);
+ clip.y = MHEGDisplay_scaleY(d, pos->y_position);
+ clip.width = MHEGDisplay_scaleX(d, box->x_length);
+ clip.height = MHEGDisplay_scaleY(d, box->y_length);
XRenderSetPictureClipRectangles(d->dpy, d->next_overlay_pic, 0, 0, &clip, 1);
@@ -478,11 +478,11 @@
display_colour(&rcol, col);
/* scale if fullscreen */
- x = (pos->x_position * d->xres) / MHEG_XRES;
- y = (pos->y_position * d->yres) / MHEG_YRES;
- w = (len * d->xres) / MHEG_XRES;
+ x = MHEGDisplay_scaleX(d, pos->x_position);
+ y = MHEGDisplay_scaleY(d, pos->y_position);
+ w = MHEGDisplay_scaleX(d, len);
/* aspect ratio */
- h = (width * d->yres) / MHEG_YRES;
+ h = MHEGDisplay_scaleY(d, width);
/* TODO */
if(style != LineStyle_solid)
@@ -515,11 +515,11 @@
display_colour(&rcol, col);
/* scale if fullscreen */
- x = (pos->x_position * d->xres) / MHEG_XRES;
- y = (pos->y_position * d->yres) / MHEG_YRES;
- h = (len * d->yres) / MHEG_YRES;
+ x = MHEGDisplay_scaleX(d, pos->x_position);
+ y = MHEGDisplay_scaleY(d, pos->y_position);
+ h = MHEGDisplay_scaleY(d, len);
/* aspect ratio */
- w = (width * d->xres) / MHEG_XRES;
+ w = MHEGDisplay_scaleX(d, width);
/* TODO */
if(style != LineStyle_solid)
@@ -550,10 +550,10 @@
display_colour(&rcol, col);
/* scale if fullscreen */
- x = (pos->x_position * d->xres) / MHEG_XRES;
- y = (pos->y_position * d->yres) / MHEG_YRES;
- w = (box->x_length * d->xres) / MHEG_XRES;
- h = (box->y_length * d->yres) / MHEG_YRES;
+ x = MHEGDisplay_scaleX(d, pos->x_position);
+ y = MHEGDisplay_scaleY(d, pos->y_position);
+ w = MHEGDisplay_scaleX(d, box->x_length);
+ h = MHEGDisplay_scaleY(d, box->y_length);
XRenderFillRectangle(d->dpy, PictOpOver, d->next_overlay_pic, &rcol, x, y, w, h);
@@ -574,10 +574,10 @@
unsigned int w, h;
/* scale if fullscreen */
- x = (pos->x_position * d->xres) / MHEG_XRES;
- y = (pos->y_position * d->yres) / MHEG_YRES;
- w = (box->x_length * d->xres) / MHEG_XRES;
- h = (box->y_length * d->yres) / MHEG_YRES;
+ x = MHEGDisplay_scaleX(d, pos->x_position);
+ y = MHEGDisplay_scaleY(d, pos->y_position);
+ w = MHEGDisplay_scaleX(d, box->x_length);
+ h = MHEGDisplay_scaleY(d, box->y_length);
XRenderFillRectangle(d->dpy, PictOpSrc, d->next_overlay_pic, &rcol, x, y, w, h);
@@ -603,12 +603,12 @@
* scale up if fullscreen
* the bitmap itself is scaled when it is created in MHEGDisplay_newBitmap()
*/
- src_x = (src->x_position * d->xres) / MHEG_XRES;
- src_y = (src->y_position * d->yres) / MHEG_YRES;
- w = (box->x_length * d->xres) / MHEG_XRES;
- h = (box->y_length * d->yres) / MHEG_YRES;
- dst_x = (dst->x_position * d->xres) / MHEG_XRES;
- dst_y = (dst->y_position * d->yres) / MHEG_YRES;
+ src_x = MHEGDisplay_scaleX(d, src->x_position);
+ src_y = MHEGDisplay_scaleY(d, src->y_position);
+ w = MHEGDisplay_scaleX(d, box->x_length);
+ h = MHEGDisplay_scaleY(d, box->y_length);
+ dst_x = MHEGDisplay_scaleX(d, dst->x_position);
+ dst_y = MHEGDisplay_scaleY(d, dst->y_position);
XRenderComposite(d->dpy, PictOpOver, bitmap->image_pic, None, d->next_overlay_pic,
src_x, src_y, src_x, src_y, dst_x, dst_y, w, h);
@@ -631,12 +631,12 @@
* scale up if fullscreen
* the canvas image itself is scaled when it is created
*/
- src_x = (src->x_position * d->xres) / MHEG_XRES;
- src_y = (src->y_position * d->yres) / MHEG_YRES;
- w = (box->x_length * d->xres) / MHEG_XRES;
- h = (box->y_length * d->yres) / MHEG_YRES;
- dst_x = (dst->x_position * d->xres) / MHEG_XRES;
- dst_y = (dst->y_position * d->yres) / MHEG_YRES;
+ src_x = MHEGDisplay_scaleX(d, src->x_position);
+ src_y = MHEGDisplay_scaleY(d, src->y_position);
+ w = MHEGDisplay_scaleX(d, box->x_length);
+ h = MHEGDisplay_scaleY(d, box->y_length);
+ dst_x = MHEGDisplay_scaleX(d, dst->x_position);
+ dst_y = MHEGDisplay_scaleY(d, dst->y_position);
XRenderComposite(d->dpy, PictOpOver, canvas->contents_pic, None, d->next_overlay_pic,
src_x, src_y, src_x, src_y, dst_x, dst_y, w, h);
@@ -679,9 +679,9 @@
display_colour(&rcol, &text->col);
/* scale the x origin if fullscreen */
- orig_x = (pos->x_position * d->xres) / MHEG_XRES;
+ orig_x = MHEGDisplay_scaleX(d, pos->x_position);
/* y coord does not change */
- y = ((pos->y_position + text->y) * d->yres) / MHEG_YRES;
+ y = MHEGDisplay_scaleY(d, pos->y_position + text->y);
/* set the text foreground colour */
XRenderFillRectangle(d->dpy, PictOpSrc, d->textfg_pic, &rcol, 0, 0, 1, 1);
@@ -735,7 +735,7 @@
/* render it */
XftUnlockFace(font->font);
/* round up/down the X coord */
- scrn_x = (x * d->xres) / MHEG_XRES;
+ scrn_x = MHEGDisplay_scaleX(d, x);
scrn_x = (scrn_x + (face->units_per_EM / 2)) / face->units_per_EM;
XftGlyphRender(d->dpy, PictOpOver, d->textfg_pic, font->font, d->next_overlay_pic,
0, 0, orig_x + scrn_x, y,
@@ -1021,6 +1021,7 @@
/* if we are using fullscreen mode, scale the image */
if(d->fullscreen)
{
+printf("TODO: MHEGBitmap_fromRGBA: take aspect ratio into account\n");
/* set up the matrix to scale it */
XTransform xform;
/* X */
Modified: redbutton-browser/trunk/MHEGDisplay.h
===================================================================
--- redbutton-browser/trunk/MHEGDisplay.h 2007-06-26 14:30:03 UTC (rev 319)
+++ redbutton-browser/trunk/MHEGDisplay.h 2007-07-16 16:00:42 UTC (rev 320)
@@ -89,5 +89,9 @@
/* utils */
bool intersects(XYPosition *, OriginalBoxSize *, XYPosition *, OriginalBoxSize *, XYPosition *, OriginalBoxSize *);
+/* convert X/Y coords from MHEG resolution (0->720, 0->576) to output resolution */
+#define MHEGDisplay_scaleX(DPY, X) (((X) * (DPY)->xres) / MHEG_XRES)
+#define MHEGDisplay_scaleY(DPY, Y) (((Y) * (DPY)->yres) / MHEG_YRES)
+
#endif /* __MHEGDISPLAY_H__ */
Modified: redbutton-browser/trunk/MHEGStreamPlayer.c
===================================================================
--- redbutton-browser/trunk/MHEGStreamPlayer.c 2007-06-26 14:30:03 UTC (rev 319)
+++ redbutton-browser/trunk/MHEGStreamPlayer.c 2007-07-16 16:00:42 UTC (rev 320)
@@ -630,11 +630,8 @@
}
pthread_mutex_unlock(&p->video->inst.scaled_lock);
/* scale up if fullscreen */
- if(d->fullscreen)
- {
- out_width = (out_width * d->xres) / MHEG_XRES;
- out_height = (out_height * d->yres) / MHEG_YRES;
- }
+ out_width = MHEGDisplay_scaleX(d, out_width);
+ out_height = MHEGDisplay_scaleY(d, out_height);
MHEGVideoOutput_prepareFrame(&vo, vf, out_width, out_height);
/* remember the PTS for this frame */
last_pts = vf->pts;
@@ -669,15 +666,12 @@
off_y = p->video->inst.VideoDecodeOffset.y_position;
pthread_mutex_unlock(&p->video->inst.bbox_lock);
/* scale if fullscreen */
- if(d->fullscreen)
- {
- out_x = (out_x * d->xres) / MHEG_XRES;
- out_y = (out_y * d->yres) / MHEG_YRES;
- vid_width = (vid_width * d->xres) / MHEG_XRES;
- vid_height = (vid_height * d->yres) / MHEG_YRES;
- off_x = (off_x * d->xres) / MHEG_XRES;
- off_y = (off_y * d->yres) / MHEG_YRES;
- }
+ out_x = MHEGDisplay_scaleX(d, out_x);
+ out_y = MHEGDisplay_scaleY(d, out_y);
+ vid_width = MHEGDisplay_scaleX(d, vid_width);
+ vid_height = MHEGDisplay_scaleY(d, vid_height);
+ off_x = MHEGDisplay_scaleX(d, off_x);
+ off_y = MHEGDisplay_scaleY(d, off_y);
/* if the frame is smaller or larger than the VideoClass, centre it */
out_x += (vid_width - out_width) / 2;
out_y += (vid_height - out_height) / 2;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ski...@us...> - 2008-06-11 14:50:02
|
Revision: 489
http://redbutton.svn.sourceforge.net/redbutton/?rev=489&view=rev
Author: skilvington
Date: 2008-06-11 07:50:00 -0700 (Wed, 11 Jun 2008)
Log Message:
-----------
use swscale rather than img_convert. based on patch from Andrea
Modified Paths:
--------------
redbutton-browser/trunk/MHEGDisplay.c
redbutton-browser/trunk/Makefile
redbutton-browser/trunk/videoout_xshm.c
redbutton-browser/trunk/videoout_xshm.h
Modified: redbutton-browser/trunk/MHEGDisplay.c
===================================================================
--- redbutton-browser/trunk/MHEGDisplay.c 2008-06-11 09:10:16 UTC (rev 488)
+++ redbutton-browser/trunk/MHEGDisplay.c 2008-06-11 14:50:00 UTC (rev 489)
@@ -14,6 +14,7 @@
#include <X11/Shell.h>
#include <X11/keysym.h>
#include <ffmpeg/avformat.h>
+#include <ffmpeg/swscale.h>
#include "MHEGEngine.h"
#include "MHEGDisplay.h"
@@ -908,13 +909,20 @@
else
{
/* convert to RGBA */
+ struct SwsContext *sws_ctx;
width = codec_ctx->width;
height = codec_ctx->height;
if((nbytes = avpicture_get_size(PIX_FMT_RGBA32, width, height)) < 0)
fatal("Invalid MPEG image");
rgba = safe_malloc(nbytes);
avpicture_fill((AVPicture *) rgb_frame, rgba, PIX_FMT_RGBA32, width, height);
- img_convert((AVPicture *) rgb_frame, PIX_FMT_RGBA32, (AVPicture*) yuv_frame, codec_ctx->pix_fmt, width, height);
+ //img_convert((AVPicture *) rgb_frame, PIX_FMT_RGBA32, (AVPicture*) yuv_frame, codec_ctx->pix_fmt, width, height);
+ if((sws_ctx = sws_getContext(width, height, codec_ctx->pix_fmt,
+ width, height, PIX_FMT_RGBA32,
+ SWS_FAST_BILINEAR, NULL, NULL, NULL)) == NULL)
+ fatal("Out of memory");
+ sws_scale(sws_ctx, yuv_frame->data, yuv_frame->linesize, 0, height, rgb_frame->data, rgb_frame->linesize);
+ sws_freeContext(sws_ctx);
/* convert the PIX_FMT_RGBA32 data to a MHEGBitmap */
b = MHEGBitmap_fromRGBA(d, rgba, width, height);
}
Modified: redbutton-browser/trunk/Makefile
===================================================================
--- redbutton-browser/trunk/Makefile 2008-06-11 09:10:16 UTC (rev 488)
+++ redbutton-browser/trunk/Makefile 2008-06-11 14:50:00 UTC (rev 489)
@@ -11,6 +11,9 @@
INCS=`freetype-config --cflags`
LIBS=-lm -lz -L/usr/X11R6/lib -lX11 -lXext -lXt -lXrender -lXft -lpng -lavformat -lavcodec -lavutil -lasound -lpthread
+# if libswscale is not in libavcodec, add a -lswscale to the LIBS
+LIBS+=`[ -f /usr/lib/libswscale.so -o -f /usr/local/lib/libswscale.so ] && echo "-lswscale"`
+
CLASSES=ActionClass.o \
ApplicationClass.o \
AudioClass.o \
Modified: redbutton-browser/trunk/videoout_xshm.c
===================================================================
--- redbutton-browser/trunk/videoout_xshm.c 2008-06-11 09:10:16 UTC (rev 488)
+++ redbutton-browser/trunk/videoout_xshm.c 2008-06-11 14:50:00 UTC (rev 489)
@@ -38,8 +38,7 @@
v->current_frame = NULL;
- v->resize_ctx = NULL;
- v->resized_data = NULL;
+ v->sws_ctx = NULL;
return v;
}
@@ -49,10 +48,9 @@
{
vo_xshm_ctx *v = (vo_xshm_ctx *) ctx;
- if(v->resize_ctx != NULL)
+ if(v->sws_ctx != NULL)
{
- img_resample_close(v->resize_ctx);
- safe_free(v->resized_data);
+ sws_freeContext(v->sws_ctx);
}
if(v->current_frame != NULL)
@@ -67,8 +65,6 @@
vo_xshm_prepareFrame(void *ctx, VideoFrame *f, unsigned int out_width, unsigned int out_height)
{
vo_xshm_ctx *v = (vo_xshm_ctx *) ctx;
- AVPicture *yuv_frame;
- int resized_size;
/* have we created the output frame yet */
if(v->current_frame == NULL)
@@ -78,41 +74,28 @@
if(v->current_frame->width != out_width || v->current_frame->height != out_height)
vo_xshm_resize_frame(v, out_width, out_height);
- /* see if the input size is different than the output size */
- if(f->width != out_width || f->height != out_height)
+ /* have the input or output dimensions changed */
+ if(v->sws_ctx == NULL
+ || v->resize_in.width != f->width || v->resize_in.height != f->height
+ || v->resize_out.width != out_width || v->resize_out.height != out_height)
{
- /* have the resize input or output dimensions changed */
- if(v->resize_ctx == NULL
- || v->resize_in.width != f->width || v->resize_in.height != f->height
- || v->resize_out.width != out_width || v->resize_out.height != out_height)
- {
- /* get rid of any existing resize context */
- if(v->resize_ctx != NULL)
- img_resample_close(v->resize_ctx);
- if((v->resize_ctx = img_resample_init(out_width, out_height, f->width, f->height)) == NULL)
- fatal("Out of memory");
- /* remember the resize input and output dimensions */
- v->resize_in.width = f->width;
- v->resize_in.height = f->height;
- v->resize_out.width = out_width;
- v->resize_out.height = out_height;
- /* somewhere to store the resized frame */
- if((resized_size = avpicture_get_size(f->pix_fmt, out_width, out_height)) < 0)
- fatal("vo_xshm_prepareFrame: invalid frame size");
- v->resized_data = safe_realloc(v->resized_data, resized_size);
- avpicture_fill(&v->resized_frame, v->resized_data, f->pix_fmt, out_width, out_height);
- }
- /* resize it */
- img_resample(v->resize_ctx, &v->resized_frame, &f->frame);
- yuv_frame = &v->resized_frame;
+ /* get rid of any existing resize context */
+ if(v->sws_ctx != NULL)
+ sws_freeContext(v->sws_ctx);
+ if((v->sws_ctx = sws_getContext(f->width, f->height, f->pix_fmt,
+ out_width, out_height, v->out_format,
+ SWS_FAST_BILINEAR, NULL, NULL, NULL)) == NULL)
+ fatal("Out of memory");
+ verbose("videoout_xshm: input=%d,%d output=%d,%d", f->width, f->height, out_width, out_height);
+ /* remember the resize input and output dimensions */
+ v->resize_in.width = f->width;
+ v->resize_in.height = f->height;
+ v->resize_out.width = out_width;
+ v->resize_out.height = out_height;
}
- else
- {
- yuv_frame = &f->frame;
- }
- /* convert the frame to RGB */
- img_convert(&v->rgb_frame, v->out_format, yuv_frame, f->pix_fmt, out_width, out_height);
+ /* resize it (if needed) and convert to RGB */
+ sws_scale(v->sws_ctx, f->frame.data, f->frame.linesize, 0, f->height, v->rgb_frame.data, v->rgb_frame.linesize);
return;
}
Modified: redbutton-browser/trunk/videoout_xshm.h
===================================================================
--- redbutton-browser/trunk/videoout_xshm.h 2008-06-11 09:10:16 UTC (rev 488)
+++ redbutton-browser/trunk/videoout_xshm.h 2008-06-11 14:50:00 UTC (rev 489)
@@ -9,6 +9,7 @@
#include <X11/Xlib.h>
#include <X11/extensions/XShm.h>
#include <ffmpeg/avcodec.h>
+#include <ffmpeg/swscale.h>
typedef struct
{
@@ -22,11 +23,9 @@
XShmSegmentInfo shm; /* shared memory used by current_frame */
AVPicture rgb_frame; /* ffmpeg wrapper for current_frame SHM data */
enum PixelFormat out_format; /* rgb_frame ffmpeg pixel format */
- ImgReSampleContext *resize_ctx; /* NULL if we do not need to resize the frame */
- FrameSize resize_in; /* resize_ctx input dimensions */
- FrameSize resize_out; /* resize_ctx output dimensions */
- AVPicture resized_frame; /* resized output frame */
- uint8_t *resized_data; /* resized_frame data buffer */
+ struct SwsContext *sws_ctx; /* converts to RGB and resizes if needed */
+ FrameSize resize_in; /* input dimensions */
+ FrameSize resize_out; /* output dimensions */
} vo_xshm_ctx;
extern MHEGVideoOutputMethod vo_xshm_fns;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ski...@us...> - 2008-06-11 14:55:38
|
Revision: 490
http://redbutton.svn.sourceforge.net/redbutton/?rev=490&view=rev
Author: skilvington
Date: 2008-06-11 07:55:21 -0700 (Wed, 11 Jun 2008)
Log Message:
-----------
somethings TODO
Modified Paths:
--------------
redbutton-browser/trunk/MHEGDisplay.c
redbutton-browser/trunk/MHEGStreamPlayer.c
Modified: redbutton-browser/trunk/MHEGDisplay.c
===================================================================
--- redbutton-browser/trunk/MHEGDisplay.c 2008-06-11 14:50:00 UTC (rev 489)
+++ redbutton-browser/trunk/MHEGDisplay.c 2008-06-11 14:55:21 UTC (rev 490)
@@ -1037,6 +1037,7 @@
if(d->fullscreen)
{
printf("TODO: MHEGBitmap_fromRGBA: take aspect ratio into account\n");
+/* TODO: use swscale here to permenantly scale up the image */
/* set up the matrix to scale it */
XTransform xform;
/* X */
Modified: redbutton-browser/trunk/MHEGStreamPlayer.c
===================================================================
--- redbutton-browser/trunk/MHEGStreamPlayer.c 2008-06-11 14:50:00 UTC (rev 489)
+++ redbutton-browser/trunk/MHEGStreamPlayer.c 2008-06-11 14:55:21 UTC (rev 490)
@@ -62,6 +62,7 @@
fatal("Invalid frame_size");
vf->item.frame_data = safe_fast_realloc(vf->item.frame_data, &vf->item.nalloced, frame_size);
avpicture_fill(&vf->item.frame, vf->item.frame_data, pix_fmt, width, height);
+/* TODO: img_copy is deprecated, use swscale instead */
img_copy(&vf->item.frame, (AVPicture*) frame, pix_fmt, width, height);
return vf;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ski...@us...> - 2008-06-16 16:16:09
|
Revision: 491
http://redbutton.svn.sourceforge.net/redbutton/?rev=491&view=rev
Author: skilvington
Date: 2008-06-16 09:16:06 -0700 (Mon, 16 Jun 2008)
Log Message:
-----------
make MHEGStreamPlayer a singleton to avoid having to open the dvr device more than once
Modified Paths:
--------------
redbutton-browser/trunk/MHEGStreamPlayer.c
redbutton-browser/trunk/MHEGStreamPlayer.h
redbutton-browser/trunk/StreamClass.c
redbutton-browser/trunk/add_instance_vars.conf
Modified: redbutton-browser/trunk/MHEGStreamPlayer.c
===================================================================
--- redbutton-browser/trunk/MHEGStreamPlayer.c 2008-06-11 14:55:21 UTC (rev 490)
+++ redbutton-browser/trunk/MHEGStreamPlayer.c 2008-06-16 16:16:06 UTC (rev 491)
@@ -119,48 +119,88 @@
return;
}
+/*
+ * MHEGStreamPlayer is a singleton
+ * UK MHEG spec says we only need one video/audio decoder
+ * Linux only allows us to open the dvr device once, so we can't have more than one MHEGStreamPlayer
+ */
+
+static MHEGStreamPlayer player;
+
void
-MHEGStreamPlayer_init(MHEGStreamPlayer *p)
+MHEGStreamPlayer_init(MHEGStreamPlayer **p)
{
- bzero(p, sizeof(MHEGStreamPlayer));
+ static bool created = false;
- p->playing = false;
- p->stop = false;
+ /* have we created the singleton yet */
+ if(!created)
+ {
+ bzero(&player, sizeof(MHEGStreamPlayer));
- p->have_video = false;
- p->have_audio = false;
+ player.nusers = 0;
- p->video = NULL;
- p->audio = NULL;
+ player.playing = false;
+ player.stop = false;
- /* stream a/v components from the service we are currently tuned to */
- p->service_id = -1;
+ player.have_video = false;
+ player.have_audio = false;
- p->audio_codec = NULL;
+ player.video = NULL;
+ player.audio = NULL;
- pthread_mutex_init(&p->base_lock, NULL);
- pthread_cond_init(&p->base_cond, NULL);
+ /* stream a/v components from the service we are currently tuned to */
+ player.service_id = -1;
- pthread_mutex_init(&p->videoq_lock, NULL);
- p->videoq = NULL;
+ player.audio_codec = NULL;
- pthread_mutex_init(&p->audioq_lock, NULL);
- p->audioq = NULL;
+ pthread_mutex_init(&player.base_lock, NULL);
+ pthread_cond_init(&player.base_cond, NULL);
+ pthread_mutex_init(&player.videoq_lock, NULL);
+ player.videoq = NULL;
+
+ pthread_mutex_init(&player.audioq_lock, NULL);
+ player.audioq = NULL;
+
+ created = true;
+ }
+
+ player.nusers ++;
+
+ verbose("MHEGStreamPlayer: %u users", player.nusers);
+
+ *p = &player;
+
return;
}
void
-MHEGStreamPlayer_fini(MHEGStreamPlayer *p)
+MHEGStreamPlayer_fini(MHEGStreamPlayer **p)
{
- MHEGStreamPlayer_stop(p);
+ /* assert */
+ if(*p != &player)
+ fatal("MHEGStreamPlayer: *p=%p, &player=%p", *p, &player);
- pthread_mutex_destroy(&p->base_lock);
- pthread_cond_destroy(&p->base_cond);
+ if(player.nusers == 0)
+ fatal("MHEGStreamPlayer: nusers is 0");
- pthread_mutex_destroy(&p->videoq_lock);
- pthread_mutex_destroy(&p->audioq_lock);
+ MHEGStreamPlayer_stop(&player);
+ player.nusers --;
+
+ verbose("MHEGStreamPlayer: %u users", player.nusers);
+
+ *p = NULL;
+
+#if 0
+ /* this is how you would destroy it */
+ pthread_mutex_destroy(&player.base_lock);
+ pthread_cond_destroy(&player.base_cond);
+
+ pthread_mutex_destroy(&player.videoq_lock);
+ pthread_mutex_destroy(&player.audioq_lock);
+#endif
+
return;
}
@@ -173,6 +213,10 @@
void
MHEGStreamPlayer_setServiceID(MHEGStreamPlayer *p, int id)
{
+ /* assert */
+ if(p != &player)
+ fatal("MHEGStreamPlayer_setServiceID: p=%p, &player=%p", p, &player);
+
p->service_id = id;
return;
@@ -182,6 +226,11 @@
MHEGStreamPlayer_setVideoStream(MHEGStreamPlayer *p, VideoClass *video)
{
/* assert */
+ if(p != &player)
+ fatal("MHEGStreamPlayer_setVideoStream: p=%p, &player=%p", p, &player);
+
+/* TODO need to be able to handle this */
+ /* assert */
if(p->playing)
fatal("MHEGStreamPlayer_setVideoStream: trying to set stream while playing");
@@ -218,6 +267,11 @@
MHEGStreamPlayer_setAudioStream(MHEGStreamPlayer *p, AudioClass *audio)
{
/* assert */
+ if(p != &player)
+ fatal("MHEGStreamPlayer_setAudioStream: p=%p, &player=%p", p, &player);
+
+/* TODO need to be able to handle this */
+ /* assert */
if(p->playing)
fatal("MHEGStreamPlayer_setAudioStream: trying to set stream while playing");
@@ -256,6 +310,10 @@
void
MHEGStreamPlayer_play(MHEGStreamPlayer *p)
{
+ /* assert */
+ if(p != &player)
+ fatal("MHEGStreamPlayer_play: p=%p, &player=%p", p, &player);
+
verbose("MHEGStreamPlayer_play: service_id=%d audio_tag=%d video_tag=%d", p->service_id, p->audio_tag, p->video_tag);
/* make sure the VideoClass doesn't try to draw anything yet */
@@ -323,6 +381,10 @@
void
MHEGStreamPlayer_stop(MHEGStreamPlayer *p)
{
+ /* assert */
+ if(p != &player)
+ fatal("MHEGStreamPlayer_stop: p=%p, &player=%p", *p, &player);
+
verbose("MHEGStreamPlayer_stop");
/* are we playing */
Modified: redbutton-browser/trunk/MHEGStreamPlayer.h
===================================================================
--- redbutton-browser/trunk/MHEGStreamPlayer.h 2008-06-11 14:55:21 UTC (rev 490)
+++ redbutton-browser/trunk/MHEGStreamPlayer.h 2008-06-16 16:16:06 UTC (rev 491)
@@ -53,6 +53,7 @@
/* player state */
typedef struct
{
+ unsigned int nusers; /* reference count */
bool playing; /* true when our threads are active */
bool stop; /* true => stop playback */
bool have_video; /* false if we have no video stream */
@@ -81,8 +82,8 @@
LIST_OF(AudioFrame) *audioq; /* head of list is next to be played */
} MHEGStreamPlayer;
-void MHEGStreamPlayer_init(MHEGStreamPlayer *);
-void MHEGStreamPlayer_fini(MHEGStreamPlayer *);
+void MHEGStreamPlayer_init(MHEGStreamPlayer **);
+void MHEGStreamPlayer_fini(MHEGStreamPlayer **);
void MHEGStreamPlayer_setServiceID(MHEGStreamPlayer *, int);
void MHEGStreamPlayer_setVideoStream(MHEGStreamPlayer *, VideoClass *);
Modified: redbutton-browser/trunk/StreamClass.c
===================================================================
--- redbutton-browser/trunk/StreamClass.c 2008-06-11 14:55:21 UTC (rev 490)
+++ redbutton-browser/trunk/StreamClass.c 2008-06-16 16:16:06 UTC (rev 491)
@@ -108,7 +108,7 @@
*/
if(OctetString_strncmp(service, "dvb:", 4) == 0)
{
- MHEGStreamPlayer_setServiceID(&t->inst.player, si_get_service_id(service));
+ MHEGStreamPlayer_setServiceID(t->inst.player, si_get_service_id(service));
}
else if(OctetString_strncmp(service, "rec://svc/lcn/", 14) == 0)
{
@@ -118,7 +118,7 @@
else if(OctetString_strcmp(service, "rec://svc/def") == 0)
{
/* use the service ID we are currently tuned to */
- MHEGStreamPlayer_setServiceID(&t->inst.player, -1);
+ MHEGStreamPlayer_setServiceID(t->inst.player, -1);
}
/* leave player's service ID as it is for "rec://svc/cur" */
else if(OctetString_strcmp(service, "rec://svc/cur") != 0)
@@ -133,10 +133,10 @@
{
if((r = StreamComponent_rootClass(&comp->item)) != NULL
&& r->inst.RunningStatus)
- StreamComponent_play(&comp->item, &t->inst.player);
+ StreamComponent_play(&comp->item, t->inst.player);
comp = comp->next;
}
- MHEGStreamPlayer_play(&t->inst.player);
+ MHEGStreamPlayer_play(t->inst.player);
/* multiplex is now playing */
MHEGEngine_generateAsyncEvent(&t->rootClass.inst.ref, EventType_stream_playing, NULL);
@@ -177,13 +177,13 @@
}
/* stop playing all active StreamComponents */
- MHEGStreamPlayer_stop(&t->inst.player);
+ MHEGStreamPlayer_stop(t->inst.player);
comp = t->multiplex;
while(comp)
{
if((r = StreamComponent_rootClass(&comp->item)) != NULL
&& r->inst.RunningStatus)
- StreamComponent_stop(&comp->item, &t->inst.player);
+ StreamComponent_stop(&comp->item, t->inst.player);
comp = comp->next;
}
@@ -260,12 +260,12 @@
/* if we are activated, stop playing while we change the component */
if(t->rootClass.inst.RunningStatus)
- MHEGStreamPlayer_stop(&t->inst.player);
+ MHEGStreamPlayer_stop(t->inst.player);
- MHEGStreamPlayer_setVideoStream(&t->inst.player, c);
+ MHEGStreamPlayer_setVideoStream(t->inst.player, c);
if(t->rootClass.inst.RunningStatus)
- MHEGStreamPlayer_play(&t->inst.player);
+ MHEGStreamPlayer_play(t->inst.player);
return;
}
@@ -282,12 +282,12 @@
/* if we are activated, stop playing while we change the component */
if(t->rootClass.inst.RunningStatus)
- MHEGStreamPlayer_stop(&t->inst.player);
+ MHEGStreamPlayer_stop(t->inst.player);
- MHEGStreamPlayer_setAudioStream(&t->inst.player, c);
+ MHEGStreamPlayer_setAudioStream(t->inst.player, c);
if(t->rootClass.inst.RunningStatus)
- MHEGStreamPlayer_play(&t->inst.player);
+ MHEGStreamPlayer_play(t->inst.player);
return;
}
@@ -304,12 +304,12 @@
/* if we are activated, stop playing while we change the component */
if(t->rootClass.inst.RunningStatus)
- MHEGStreamPlayer_stop(&t->inst.player);
+ MHEGStreamPlayer_stop(t->inst.player);
- MHEGStreamPlayer_setVideoStream(&t->inst.player, NULL);
+ MHEGStreamPlayer_setVideoStream(t->inst.player, NULL);
if(t->rootClass.inst.RunningStatus)
- MHEGStreamPlayer_play(&t->inst.player);
+ MHEGStreamPlayer_play(t->inst.player);
return;
}
@@ -326,12 +326,12 @@
/* if we are activated, stop playing while we change the component */
if(t->rootClass.inst.RunningStatus)
- MHEGStreamPlayer_stop(&t->inst.player);
+ MHEGStreamPlayer_stop(t->inst.player);
- MHEGStreamPlayer_setAudioStream(&t->inst.player, NULL);
+ MHEGStreamPlayer_setAudioStream(t->inst.player, NULL);
if(t->rootClass.inst.RunningStatus)
- MHEGStreamPlayer_play(&t->inst.player);
+ MHEGStreamPlayer_play(t->inst.player);
return;
}
Modified: redbutton-browser/trunk/add_instance_vars.conf
===================================================================
--- redbutton-browser/trunk/add_instance_vars.conf 2008-06-11 14:55:21 UTC (rev 490)
+++ redbutton-browser/trunk/add_instance_vars.conf 2008-06-16 16:16:06 UTC (rev 491)
@@ -227,7 +227,7 @@
int CounterEndPosition;
LIST_OF(CounterTrigger) *CounterTriggers;
/* we add this */
- MHEGStreamPlayer player;
+ MHEGStreamPlayer *player;
} StreamClassInstanceVars;
</StreamClass>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ski...@us...> - 2008-07-04 15:31:15
|
Revision: 500
http://redbutton.svn.sourceforge.net/redbutton/?rev=500&view=rev
Author: skilvington
Date: 2008-07-04 08:31:11 -0700 (Fri, 04 Jul 2008)
Log Message:
-----------
stop ffmpeg flooding stderr if the signal is noisy
Modified Paths:
--------------
redbutton-browser/trunk/MHEGDisplay.c
redbutton-browser/trunk/MHEGDisplay.h
redbutton-browser/trunk/MHEGEngine.c
Modified: redbutton-browser/trunk/MHEGDisplay.c
===================================================================
--- redbutton-browser/trunk/MHEGDisplay.c 2008-06-27 16:13:45 UTC (rev 499)
+++ redbutton-browser/trunk/MHEGDisplay.c 2008-07-04 15:31:11 UTC (rev 500)
@@ -66,7 +66,7 @@
};
void
-MHEGDisplay_init(MHEGDisplay *d, bool fullscreen, char *keymap)
+MHEGDisplay_init(MHEGDisplay *d, bool fullscreen, char *keymap, int verbose)
{
unsigned int xrender_major;
unsigned int xrender_minor;
@@ -255,6 +255,9 @@
/* init ffmpeg */
av_register_all();
+ /* stop ffmpeg flooding stderr if the signal is noisy */
+ if(!verbose)
+ av_log_set_level(AV_LOG_QUIET);
return;
}
Modified: redbutton-browser/trunk/MHEGDisplay.h
===================================================================
--- redbutton-browser/trunk/MHEGDisplay.h 2008-06-27 16:13:45 UTC (rev 499)
+++ redbutton-browser/trunk/MHEGDisplay.h 2008-07-04 15:31:11 UTC (rev 500)
@@ -56,7 +56,7 @@
MHEGKeyMapEntry *keymap; /* keyboard mapping */
} MHEGDisplay;
-void MHEGDisplay_init(MHEGDisplay *, bool, char *);
+void MHEGDisplay_init(MHEGDisplay *, bool, char *, int);
void MHEGDisplay_fini(MHEGDisplay *);
bool MHEGDisplay_processEvents(MHEGDisplay *, bool);
Modified: redbutton-browser/trunk/MHEGEngine.c
===================================================================
--- redbutton-browser/trunk/MHEGEngine.c 2008-06-27 16:13:45 UTC (rev 499)
+++ redbutton-browser/trunk/MHEGEngine.c 2008-07-04 15:31:11 UTC (rev 500)
@@ -171,7 +171,7 @@
engine.verbose = opts->verbose;
engine.timeout = opts->timeout;
- MHEGDisplay_init(&engine.display, opts->fullscreen, opts->keymap);
+ MHEGDisplay_init(&engine.display, opts->fullscreen, opts->keymap, opts->verbose);
engine.vo_method = MHEGVideoOutputMethod_fromString(opts->vo_method);
engine.av_disabled = opts->av_disabled;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ski...@us...> - 2007-06-26 14:30:21
|
Revision: 319
http://svn.sourceforge.net/redbutton/?rev=319&view=rev
Author: skilvington
Date: 2007-06-26 07:30:03 -0700 (Tue, 26 Jun 2007)
Log Message:
-----------
be more verbose about ops on Variables
Modified Paths:
--------------
redbutton-browser/trunk/IntegerVariableClass.c
redbutton-browser/trunk/OctetStringVariableClass.c
redbutton-browser/trunk/VariableClass.c
Modified: redbutton-browser/trunk/IntegerVariableClass.c
===================================================================
--- redbutton-browser/trunk/IntegerVariableClass.c 2007-06-13 09:40:44 UTC (rev 318)
+++ redbutton-browser/trunk/IntegerVariableClass.c 2007-06-26 14:30:03 UTC (rev 319)
@@ -139,6 +139,8 @@
val = GenericInteger_getInteger(¶ms->value, caller_gid);
+ verbose("Add: %d + %d", v->inst.Value.u.integer, val);
+
v->inst.Value.u.integer += val;
return;
@@ -157,6 +159,8 @@
val = GenericInteger_getInteger(¶ms->value, caller_gid);
+ verbose("Subtract: %d - %d", v->inst.Value.u.integer, val);
+
v->inst.Value.u.integer -= val;
return;
@@ -175,6 +179,8 @@
val = GenericInteger_getInteger(¶ms->value, caller_gid);
+ verbose("Multiply: %d * %d", v->inst.Value.u.integer, val);
+
v->inst.Value.u.integer *= val;
return;
@@ -193,6 +199,8 @@
val = GenericInteger_getInteger(¶ms->value, caller_gid);
+ verbose("Divide: %d / %d", v->inst.Value.u.integer, val);
+
v->inst.Value.u.integer /= val;
return;
@@ -211,6 +219,8 @@
val = GenericInteger_getInteger(¶ms->value, caller_gid);
+ verbose("Modulo: %d %% %d", v->inst.Value.u.integer, val);
+
v->inst.Value.u.integer %= val;
return;
Modified: redbutton-browser/trunk/OctetStringVariableClass.c
===================================================================
--- redbutton-browser/trunk/OctetStringVariableClass.c 2007-06-13 09:40:44 UTC (rev 318)
+++ redbutton-browser/trunk/OctetStringVariableClass.c 2007-06-26 14:30:03 UTC (rev 319)
@@ -115,6 +115,8 @@
target = &v->inst.Value.u.octetstring;
append = GenericOctetString_getOctetString(¶ms->append_value, caller_gid);
+ verbose("Append: '%.*s' + '%.*s'", target->size, target->data, append->size, append->data);
+
target->data = safe_realloc(target->data, target->size + append->size);
memcpy(&target->data[target->size], append->data, append->size);
target->size += append->size;
Modified: redbutton-browser/trunk/VariableClass.c
===================================================================
--- redbutton-browser/trunk/VariableClass.c 2007-06-13 09:40:44 UTC (rev 318)
+++ redbutton-browser/trunk/VariableClass.c 2007-06-26 14:30:03 UTC (rev 319)
@@ -4,6 +4,7 @@
#include "MHEGEngine.h"
#include "ISO13522-MHEG-5.h"
+#include "VariableClass.h"
#include "RootClass.h"
#include "GenericBoolean.h"
#include "BooleanVariableClass.h"
@@ -163,6 +164,8 @@
break;
}
+ verbose("SetVariable: %s", VariableClass_stringValue(v));
+
return;
}
@@ -249,7 +252,7 @@
case OriginalValue_octetstring:
oct = &v->inst.Value.u.octetstring;
_value = safe_realloc(_value, oct->size + 128);
- snprintf(_value, oct->size + 128, "OctetString %u %.*s", oct->size, oct->size, oct->data);
+ snprintf(_value, oct->size + 128, "OctetString '%.*s'", oct->size, oct->data);
return _value;
case OriginalValue_object_reference:
@@ -260,7 +263,7 @@
case OriginalValue_content_reference:
oct = &v->inst.Value.u.content_reference;
_value = safe_realloc(_value, oct->size + 128);
- snprintf(_value, oct->size + 128, "ContentReference %u %.*s", oct->size, oct->size, oct->data);
+ snprintf(_value, oct->size + 128, "ContentReference '%.*s'", oct->size, oct->data);
return _value;
default:
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|