redbutton-devel Mailing List for RedButton MHEG Engine (Page 18)
Brought to you by:
skilvington
You can subscribe to this list here.
| 2006 |
Jan
(1) |
Feb
(4) |
Mar
(27) |
Apr
(6) |
May
(46) |
Jun
(45) |
Jul
(7) |
Aug
(4) |
Sep
(7) |
Oct
(5) |
Nov
(10) |
Dec
(11) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2007 |
Jan
(49) |
Feb
(29) |
Mar
(35) |
Apr
(43) |
May
(23) |
Jun
(4) |
Jul
(1) |
Aug
(58) |
Sep
(66) |
Oct
(27) |
Nov
(15) |
Dec
(1) |
| 2008 |
Jan
(11) |
Feb
|
Mar
(8) |
Apr
|
May
|
Jun
(30) |
Jul
(1) |
Aug
(1) |
Sep
(1) |
Oct
|
Nov
(3) |
Dec
(6) |
| 2009 |
Jan
(6) |
Feb
(1) |
Mar
(2) |
Apr
(5) |
May
(2) |
Jun
(1) |
Jul
(7) |
Aug
|
Sep
(2) |
Oct
(2) |
Nov
|
Dec
(6) |
| 2010 |
Jan
(6) |
Feb
|
Mar
(4) |
Apr
|
May
|
Jun
|
Jul
|
Aug
(6) |
Sep
(4) |
Oct
|
Nov
(11) |
Dec
(4) |
| 2011 |
Jan
|
Feb
(11) |
Mar
(8) |
Apr
|
May
|
Jun
(3) |
Jul
|
Aug
|
Sep
(4) |
Oct
|
Nov
(2) |
Dec
|
| 2012 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: <ski...@us...> - 2007-03-06 12:19:34
|
Revision: 238
http://svn.sourceforge.net/redbutton/?rev=238&view=rev
Author: skilvington
Date: 2007-03-06 04:19:18 -0800 (Tue, 06 Mar 2007)
Log Message:
-----------
DynamicLineArtClass Activation and Deactivation
Modified Paths:
--------------
redbutton-browser/trunk/DynamicLineArtClass.c
redbutton-browser/trunk/TODO
Modified: redbutton-browser/trunk/DynamicLineArtClass.c
===================================================================
--- redbutton-browser/trunk/DynamicLineArtClass.c 2007-03-02 09:12:32 UTC (rev 237)
+++ redbutton-browser/trunk/DynamicLineArtClass.c 2007-03-06 12:19:18 UTC (rev 238)
@@ -31,8 +31,21 @@
{
verbose("DynamicLineArtClass: %s; Activation", ExternalReference_name(&t->rootClass.inst.ref));
-/* TODO */
-printf("TODO: DynamicLineArtClass_Activation not yet implemented\n");
+ /* has it been prepared yet */
+ if(!t->rootClass.inst.AvailabilityStatus)
+ DynamicLineArtClass_Preparation(t);
+
+ /* has it already been activated */
+ if(!RootClass_Activation(&t->rootClass))
+ return;
+
+ /* set its RunningStatus */
+ t->rootClass.inst.RunningStatus = true;
+ MHEGEngine_generateEvent(&t->rootClass.inst.ref, EventType_is_running, NULL);
+
+ /* now its RunningStatus is true, get it drawn at its position in the application's DisplayStack */
+ MHEGEngine_redrawArea(&t->inst.Position, &t->inst.BoxSize);
+
return;
}
@@ -41,8 +54,13 @@
{
verbose("DynamicLineArtClass: %s; Deactivation", ExternalReference_name(&t->rootClass.inst.ref));
-/* TODO */
-printf("TODO: DynamicLineArtClass_Deactivation not yet implemented\n");
+ /* is it already deactivated */
+ if(!RootClass_Deactivation(&t->rootClass))
+ return;
+
+ /* now its RunningStatus is false, redraw the area it covered */
+ MHEGEngine_redrawArea(&t->inst.Position, &t->inst.BoxSize);
+
return;
}
@@ -101,6 +119,8 @@
{
verbose("DynamicLineArtClass: %s; SetPosition", ExternalReference_name(&t->rootClass.inst.ref));
+ /* corrigendum says we don't need to clear to OriginalRefFillColour */
+
/* TODO */
printf("TODO: DynamicLineArtClass_SetPosition not yet implemented\n");
return;
@@ -123,6 +143,7 @@
/* TODO */
printf("TODO: DynamicLineArtClass_SetBoxSize not yet implemented\n");
+/* clear to OriginalRefFillColour */
return;
}
@@ -143,8 +164,7 @@
MHEGEngine_bringToFront(&t->rootClass);
-/* TODO */
-/* clear to OriginalRefFillColour */
+ /* corrigendum says we don't need to clear to OriginalRefFillColour */
/* if it is active, redraw it */
if(t->rootClass.inst.RunningStatus)
@@ -160,8 +180,7 @@
MHEGEngine_sendToBack(&t->rootClass);
-/* TODO */
-/* clear to OriginalRefFillColour */
+ /* corrigendum says we don't need to clear to OriginalRefFillColour */
/* if it is active, redraw it */
if(t->rootClass.inst.RunningStatus)
@@ -182,8 +201,7 @@
&& ((obj = MHEGEngine_findObjectReference(ref, caller_gid)) != NULL))
{
MHEGEngine_putBefore(&t->rootClass, obj);
-/* TODO */
-/* clear to OriginalRefFillColour */
+ /* corrigendum says we don't need to clear to OriginalRefFillColour */
/* if it is active, redraw it */
if(t->rootClass.inst.RunningStatus)
MHEGEngine_redrawArea(&t->inst.Position, &t->inst.BoxSize);
@@ -204,8 +222,7 @@
&& ((obj = MHEGEngine_findObjectReference(ref, caller_gid)) != NULL))
{
MHEGEngine_putBehind(&t->rootClass, obj);
-/* TODO */
-/* clear to OriginalRefFillColour */
+ /* corrigendum says we don't need to clear to OriginalRefFillColour */
/* if it is active, redraw it */
if(t->rootClass.inst.RunningStatus)
MHEGEngine_redrawArea(&t->inst.Position, &t->inst.BoxSize);
Modified: redbutton-browser/trunk/TODO
===================================================================
--- redbutton-browser/trunk/TODO 2007-03-02 09:12:32 UTC (rev 237)
+++ redbutton-browser/trunk/TODO 2007-03-06 12:19:18 UTC (rev 238)
@@ -1,3 +1,6 @@
+BorderedBoundingBox
+
+
aspect ratio
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ski...@us...> - 2007-03-02 09:12:33
|
Revision: 237
http://svn.sourceforge.net/redbutton/?rev=237&view=rev
Author: skilvington
Date: 2007-03-02 01:12:32 -0800 (Fri, 02 Mar 2007)
Log Message:
-----------
Tagged release 20070302
Added Paths:
-----------
redbutton-browser/tags/redbutton-browser-20070302/
Copied: redbutton-browser/tags/redbutton-browser-20070302 (from rev 236, redbutton-browser/trunk)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ski...@us...> - 2007-03-01 17:26:43
|
Revision: 236
http://svn.sourceforge.net/redbutton/?rev=236&view=rev
Author: skilvington
Date: 2007-03-01 09:26:41 -0800 (Thu, 01 Mar 2007)
Log Message:
-----------
don't let timers go off after their GroupClass has been deleted
Modified Paths:
--------------
redbutton-browser/trunk/ApplicationClass.c
redbutton-browser/trunk/GroupClass.c
redbutton-browser/trunk/GroupClass.h
redbutton-browser/trunk/MHEGTimer.h
redbutton-browser/trunk/SceneClass.c
redbutton-browser/trunk/add_instance_vars.conf
Modified: redbutton-browser/trunk/ApplicationClass.c
===================================================================
--- redbutton-browser/trunk/ApplicationClass.c 2007-03-01 15:50:35 UTC (rev 235)
+++ redbutton-browser/trunk/ApplicationClass.c 2007-03-01 17:26:41 UTC (rev 236)
@@ -45,6 +45,7 @@
/* GroupClass */
v->GroupCachePriority = t->original_group_cache_priority;
v->Timers = NULL;
+ v->removed_timers = NULL;
/* ApplicationClass */
v->LockCount = 0;
@@ -58,7 +59,7 @@
void
free_ApplicationClassInstanceVars(ApplicationClassInstanceVars *v)
{
- GroupClass_freeTimers(&v->Timers);
+ GroupClass_freeTimers(&v->Timers, &v->removed_timers);
LIST_FREE(&v->DisplayStack, RootClassPtr, safe_free);
@@ -586,7 +587,7 @@
{
verbose("ApplicationClass: %s; SetTimer", ExternalReference_name(&t->rootClass.inst.ref));
- GroupClass_SetTimer(&t->rootClass.inst.ref, &t->inst.Timers, &t->inst.start_time, params, caller_gid);
+ GroupClass_SetTimer(&t->rootClass.inst.ref, &t->inst.Timers, &t->inst.removed_timers, &t->inst.start_time, params, caller_gid);
return;
}
Modified: redbutton-browser/trunk/GroupClass.c
===================================================================
--- redbutton-browser/trunk/GroupClass.c 2007-03-01 15:50:35 UTC (rev 235)
+++ redbutton-browser/trunk/GroupClass.c 2007-03-01 17:26:41 UTC (rev 236)
@@ -12,11 +12,12 @@
#include "ExternalReference.h"
void
-GroupClass_SetTimer(ExternalReference *ref, LIST_OF(Timer) **timer_list, struct timeval *start_time,
- SetTimer *params, OctetString *caller_gid)
+GroupClass_SetTimer(ExternalReference *ref, LIST_OF(Timer) **timer_list, LIST_OF(MHEGTimer) **removed_timers,
+ struct timeval *start_time, SetTimer *params, OctetString *caller_gid)
{
int id;
LIST_TYPE(Timer) *timer;
+ LIST_TYPE(MHEGTimer) *old_timer;
int value;
bool absolute;
int interval;
@@ -51,6 +52,13 @@
if(interval < 0)
interval = 0;
timer->item.position = value;
+ /*
+ * don't want timers going off after the GroupClass has been deleted
+ * so, remember the old mheg_id
+ */
+ old_timer = safe_malloc(sizeof(LIST_TYPE(MHEGTimer)));
+ old_timer->item = timer->item.mheg_id;
+ LIST_APPEND(removed_timers, old_timer);
/* update its mheg_id */
timer->item.mheg_id = MHEGTimer_addGroupClassTimer(interval, ref, timer->item.id, timer_list);
}
@@ -87,6 +95,10 @@
/* no new timer value => remove the timer */
if(timer != NULL)
{
+ /* remember the old mheg_id */
+ old_timer = safe_malloc(sizeof(LIST_TYPE(MHEGTimer)));
+ old_timer->item = timer->item.mheg_id;
+ LIST_APPEND(removed_timers, old_timer);
/* removing a timer does not surpress events from the previous timer */
LIST_REMOVE(timer_list, timer);
safe_free(timer);
@@ -129,9 +141,10 @@
}
void
-GroupClass_freeTimers(LIST_OF(Timer) **timer_list)
+GroupClass_freeTimers(LIST_OF(Timer) **timer_list, LIST_OF(MHEGTimer) **removed_timers)
{
LIST_TYPE(Timer) *timer = *timer_list;
+ LIST_TYPE(MHEGTimer) *old_timer = *removed_timers;
while(timer)
{
@@ -141,6 +154,15 @@
LIST_FREE(timer_list, Timer, safe_free);
+ /* remove the timers that have been updated or removed */
+ while(old_timer)
+ {
+ MHEGTimer_removeGroupClassTimer(old_timer->item);
+ old_timer = old_timer->next;
+ }
+
+ LIST_FREE(removed_timers, MHEGTimer, safe_free);
+
return;
}
Modified: redbutton-browser/trunk/GroupClass.h
===================================================================
--- redbutton-browser/trunk/GroupClass.h 2007-03-01 15:50:35 UTC (rev 235)
+++ redbutton-browser/trunk/GroupClass.h 2007-03-01 17:26:41 UTC (rev 236)
@@ -9,10 +9,10 @@
#include "ISO13522-MHEG-5.h"
-void GroupClass_SetTimer(ExternalReference *, LIST_OF(Timer) **, struct timeval *, SetTimer *, OctetString *);
+void GroupClass_SetTimer(ExternalReference *, LIST_OF(Timer) **, LIST_OF(MHEGTimer) **, struct timeval *, SetTimer *, OctetString *);
void GroupClass_timerFired(ExternalReference *, int, MHEGTimer, LIST_OF(Timer) **);
-void GroupClass_freeTimers(LIST_OF(Timer) **);
+void GroupClass_freeTimers(LIST_OF(Timer) **, LIST_OF(MHEGTimer) **);
#endif /* __GROUPCLASS_H__ */
Modified: redbutton-browser/trunk/MHEGTimer.h
===================================================================
--- redbutton-browser/trunk/MHEGTimer.h 2007-03-01 15:50:35 UTC (rev 235)
+++ redbutton-browser/trunk/MHEGTimer.h 2007-03-01 17:26:41 UTC (rev 236)
@@ -10,6 +10,8 @@
typedef XtIntervalId MHEGTimer;
+DEFINE_LIST_OF(MHEGTimer);
+
MHEGTimer MHEGTimer_addGroupClassTimer(unsigned int, ExternalReference *, int, void *);
void MHEGTimer_removeGroupClassTimer(MHEGTimer);
Modified: redbutton-browser/trunk/SceneClass.c
===================================================================
--- redbutton-browser/trunk/SceneClass.c 2007-03-01 15:50:35 UTC (rev 235)
+++ redbutton-browser/trunk/SceneClass.c 2007-03-01 17:26:41 UTC (rev 236)
@@ -23,6 +23,7 @@
/* GroupClass */
v->GroupCachePriority = t->original_group_cache_priority;
v->Timers = NULL;
+ v->removed_timers = NULL;
v->next_clone = FIRST_CLONED_OBJ_NUM;
@@ -32,7 +33,7 @@
void
free_SceneClassInstanceVars(SceneClassInstanceVars *v)
{
- GroupClass_freeTimers(&v->Timers);
+ GroupClass_freeTimers(&v->Timers, &v->removed_timers);
return;
}
@@ -210,7 +211,7 @@
{
verbose("SceneClass: %s; SetTimer", ExternalReference_name(&t->rootClass.inst.ref));
- GroupClass_SetTimer(&t->rootClass.inst.ref, &t->inst.Timers, &t->inst.start_time, params, caller_gid);
+ GroupClass_SetTimer(&t->rootClass.inst.ref, &t->inst.Timers, &t->inst.removed_timers, &t->inst.start_time, params, caller_gid);
return;
}
Modified: redbutton-browser/trunk/add_instance_vars.conf
===================================================================
--- redbutton-browser/trunk/add_instance_vars.conf 2007-03-01 15:50:35 UTC (rev 235)
+++ redbutton-browser/trunk/add_instance_vars.conf 2007-03-01 17:26:41 UTC (rev 236)
@@ -40,7 +40,8 @@
/* inherited from GroupClass */
unsigned int GroupCachePriority;
LIST_OF(Timer) *Timers;
- /* we add this */
+ /* we add these */
+ LIST_OF(MHEGTimer) *removed_timers;
struct timeval start_time;
/* ApplicationClass */
unsigned int LockCount;
@@ -56,7 +57,8 @@
/* inherited from GroupClass */
unsigned int GroupCachePriority;
LIST_OF(Timer) *Timers;
- /* we add this */
+ /* we add these */
+ LIST_OF(MHEGTimer) *removed_timers;
struct timeval start_time;
/* we add where to start searching for unused object numbers for clones */
unsigned int next_clone;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ski...@us...> - 2007-03-01 15:50:36
|
Revision: 235
http://svn.sourceforge.net/redbutton/?rev=235&view=rev
Author: skilvington
Date: 2007-03-01 07:50:35 -0800 (Thu, 01 Mar 2007)
Log Message:
-----------
Tagged release 20070301
Added Paths:
-----------
redbutton-download/tags/redbutton-download-20070301/
Copied: redbutton-download/tags/redbutton-download-20070301 (from rev 234, redbutton-download/trunk)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ski...@us...> - 2007-03-01 15:49:36
|
Revision: 234
http://svn.sourceforge.net/redbutton/?rev=234&view=rev
Author: skilvington
Date: 2007-03-01 07:49:34 -0800 (Thu, 01 Mar 2007)
Log Message:
-----------
Tagged release 20070301
Added Paths:
-----------
redbutton-browser/tags/redbutton-browser-20070301/
Copied: redbutton-browser/tags/redbutton-browser-20070301 (from rev 233, redbutton-browser/trunk)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ski...@us...> - 2007-03-01 15:40:35
|
Revision: 233
http://svn.sourceforge.net/redbutton/?rev=233&view=rev
Author: skilvington
Date: 2007-03-01 07:40:32 -0800 (Thu, 01 Mar 2007)
Log Message:
-----------
try to make sure dvr device loses PID filters when we close demux devices
Modified Paths:
--------------
redbutton-download/trunk/command.c
Modified: redbutton-download/trunk/command.c
===================================================================
--- redbutton-download/trunk/command.c 2007-03-01 12:09:42 UTC (rev 232)
+++ redbutton-download/trunk/command.c 2007-03-01 15:40:32 UTC (rev 233)
@@ -11,6 +11,7 @@
#include <signal.h>
#include <sys/types.h>
#include <sys/stat.h>
+#include <sys/ioctl.h>
#include "command.h"
#include "findmheg.h"
@@ -240,8 +241,9 @@
stream_ts(ts_fd, client);
/* clean up */
+ ioctl(audio_fd, DMX_STOP);
+ close(audio_fd);
close(ts_fd);
- close(audio_fd);
/* close the connection */
return true;
@@ -315,8 +317,9 @@
stream_ts(ts_fd, client);
/* clean up */
+ ioctl(video_fd, DMX_STOP);
+ close(video_fd);
close(ts_fd);
- close(video_fd);
/* close the connection */
return true;
@@ -407,9 +410,11 @@
stream_ts(ts_fd, client);
/* clean up */
- close(ts_fd);
+ ioctl(audio_fd, DMX_STOP);
+ ioctl(video_fd, DMX_STOP);
close(audio_fd);
close(video_fd);
+ close(ts_fd);
/* close the connection */
return true;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ski...@us...> - 2007-03-01 12:09:48
|
Revision: 232
http://svn.sourceforge.net/redbutton/?rev=232&view=rev
Author: skilvington
Date: 2007-03-01 04:09:42 -0800 (Thu, 01 Mar 2007)
Log Message:
-----------
centre video within its VideoClass
Modified Paths:
--------------
redbutton-browser/trunk/MHEGStreamPlayer.c
redbutton-browser/trunk/TODO
Modified: redbutton-browser/trunk/MHEGStreamPlayer.c
===================================================================
--- redbutton-browser/trunk/MHEGStreamPlayer.c 2007-02-26 16:07:56 UTC (rev 231)
+++ redbutton-browser/trunk/MHEGStreamPlayer.c 2007-03-01 12:09:42 UTC (rev 232)
@@ -512,6 +512,8 @@
int out_y;
unsigned int out_width;
unsigned int out_height;
+ unsigned int vid_width;
+ unsigned int vid_height;
VideoFrame *vf;
double buffered;
double last_pts;
@@ -650,17 +652,24 @@
if(p->have_audio)
set_avsync_base(p, last_pts, last_time);
}
- /* origin of VideoClass */
+ /* origin and size of VideoClass */
pthread_mutex_lock(&p->video->inst.bbox_lock);
out_x = p->video->inst.Position.x_position;
out_y = p->video->inst.Position.y_position;
+ vid_width = p->video->inst.BoxSize.x_length;
+ vid_height = p->video->inst.BoxSize.y_length;
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;
}
+ /* 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);
/* redraw objects above the video */
Modified: redbutton-browser/trunk/TODO
===================================================================
--- redbutton-browser/trunk/TODO 2007-02-26 16:07:56 UTC (rev 231)
+++ redbutton-browser/trunk/TODO 2007-03-01 12:09:42 UTC (rev 232)
@@ -1,7 +1,11 @@
+aspect ratio
+
+
VideoDecodeOffset
-if video size != VideoClass size, centre and draw a smaller transparent hole
+if video size != VideoClass size, draw a smaller transparent hole
+or fill the frame edges with black
clear overlay on boot/retune/launch/etc
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: Simon K. <s.k...@er...> - 2007-02-28 10:41:33
|
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi, the problem is that the application_type_code field in the data_broadcast_id descriptor is set to 0x0505 - whereas rb-download expects it to be 0x0101 as a temporary fix you can change the line in findmheg.c that says: #define APPLICATION_TYPE_CODE 0x0101 to: #define APPLICATION_TYPE_CODE 0x0505 or you could explicitly choose your carousel ID on the command line, eg: rb-download -c 1 1035 the 0x0101 application_type_code is defined in the UK MHEG Profile - I'm not sure what 0x0505 means - is there a NZ MHEG Profile? Open Media Support wrote: > We are getting a DVB-S based service here in NZ shortly and I'm trying to > debug the MythTV MHEG-5 stack via rb-download etc. Can't quite understand > what is happening. > > I've included some debug output below. Basically it sees the IDs for the > various channels. Then I try and use a PID and it reports it can't find > the carousel. > > As you can see i'm using the 20070108 release. > > So any tips/assistance would be greatly appreciated. > > Steve > > root@mythtv:~/redbutton-download-20070108# ./rb-download -vvvv > Channels on this mutiplex: > > ID Channel > == ======= > 1025 Maori TV > 1035 TVONE > 1036 TV2 > 1037 Reserved 6 > 1038 Reserved 7 > 1901 Test 1-Bloomberg > 1902 Test 2-DWTV > 1903 Test 3-CCTV-9 > 1904 Test 4-TVNZ WIDE > 26000 27M SSU DOWNLOAD > 26176 SSU-ZINWELL > root@mythtv:~/redbutton-download-20070108# ./rb-download -vvvv 1025 > PMT PID: 266 > PID=514 descriptor=0x2 > 0x00000000 1a 48 5f .H_ > PID=514 component_tag=2 > PID=652 descriptor=0x3 > 0x00000000 67 g > PID=652 component_tag=140 > PID=1001 component_tag=11 > PID=1001 data_broadcast_id=0x106 > 0x00000000 01 06 05 05 00 00 ...... > PID=1001 carousel_id=1 > Unable to find Carousel Descriptor in PMT > root@mythtv:~/redbutton-download-20070108# ./rb-download -vvvv 1035 > PMT PID: 269 > PID=515 descriptor=0x2 > 0x00000000 1a 48 5f .H_ > PID=515 component_tag=3 > PID=653 descriptor=0x3 > 0x00000000 67 g > PID=653 component_tag=141 > PID=579 descriptor=0x56 > 0x00000000 65 6e 67 09 00 65 6e 67 10 01 eng..eng.. > PID=579 component_tag=67 > PID=1001 component_tag=11 > PID=1001 data_broadcast_id=0x106 > 0x00000000 01 06 05 05 00 00 ...... > PID=1001 carousel_id=1 > Unable to find Carousel Descriptor in PMT > > > -------------------------------------------- > Steven Ellis - Technical Director > OpenMedia Limited - The Home of myPVR > sales - sa...@op... > support - su...@op... > website - http://www.openmedia.co.nz > > ------------------------------------------------------------------------- > Take Surveys. Earn Cash. Influence the Future of IT > Join SourceForge.net's Techsay panel and you'll get the chance to share your > opinions on IT & business topics through brief surveys-and earn cash > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV > _______________________________________________ > Redbutton-devel mailing list > Red...@li... > https://lists.sourceforge.net/lists/listinfo/redbutton-devel > > - -- Simon Kilvington -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.4 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFF5VxOmt9ZifioJSwRAh3NAJ9NP0cRVlyWZUkAXepPzHlYNvnyGwCaA8E4 WYqI7kbF35TqGX6QA99IWY8= =yEkM -----END PGP SIGNATURE----- |
|
From: Open M. S. <su...@op...> - 2007-02-28 05:12:14
|
We are getting a DVB-S based service here in NZ shortly and I'm trying to debug the MythTV MHEG-5 stack via rb-download etc. Can't quite understand what is happening. I've included some debug output below. Basically it sees the IDs for the various channels. Then I try and use a PID and it reports it can't find the carousel. As you can see i'm using the 20070108 release. So any tips/assistance would be greatly appreciated. Steve root@mythtv:~/redbutton-download-20070108# ./rb-download -vvvv Channels on this mutiplex: ID Channel =3D=3D =3D=3D=3D=3D=3D=3D=3D 1025 Maori TV 1035 TVONE 1036 TV2 1037 Reserved 6 1038 Reserved 7 1901 Test 1-Bloomberg 1902 Test 2-DWTV 1903 Test 3-CCTV-9 1904 Test 4-TVNZ WIDE 26000 27M SSU DOWNLOAD 26176 SSU-ZINWELL root@mythtv:~/redbutton-download-20070108# ./rb-download -vvvv 1025 PMT PID: 266 PID=3D514 descriptor=3D0x2 0x00000000 1a 48 5f .H_ PID=3D514 component_tag=3D2 PID=3D652 descriptor=3D0x3 0x00000000 67 g PID=3D652 component_tag=3D140 PID=3D1001 component_tag=3D11 PID=3D1001 data_broadcast_id=3D0x106 0x00000000 01 06 05 05 00 00 ...... PID=3D1001 carousel_id=3D1 Unable to find Carousel Descriptor in PMT root@mythtv:~/redbutton-download-20070108# ./rb-download -vvvv 1035 PMT PID: 269 PID=3D515 descriptor=3D0x2 0x00000000 1a 48 5f .H_ PID=3D515 component_tag=3D3 PID=3D653 descriptor=3D0x3 0x00000000 67 g PID=3D653 component_tag=3D141 PID=3D579 descriptor=3D0x56 0x00000000 65 6e 67 09 00 65 6e 67 10 01 eng..eng.. PID=3D579 component_tag=3D67 PID=3D1001 component_tag=3D11 PID=3D1001 data_broadcast_id=3D0x106 0x00000000 01 06 05 05 00 00 ...... PID=3D1001 carousel_id=3D1 Unable to find Carousel Descriptor in PMT -------------------------------------------- Steven Ellis - Technical Director OpenMedia Limited - The Home of myPVR sales - sa...@op... support - su...@op... website - http://www.openmedia.co.nz |
|
From: <ski...@us...> - 2007-02-26 16:08:01
|
Revision: 231
http://svn.sourceforge.net/redbutton/?rev=231&view=rev
Author: skilvington
Date: 2007-02-26 08:07:56 -0800 (Mon, 26 Feb 2007)
Log Message:
-----------
only demux the PIDs we are expecting
Modified Paths:
--------------
redbutton-browser/trunk/MHEGStreamPlayer.c
redbutton-browser/trunk/mpegts.c
redbutton-browser/trunk/mpegts.h
Modified: redbutton-browser/trunk/MHEGStreamPlayer.c
===================================================================
--- redbutton-browser/trunk/MHEGStreamPlayer.c 2007-02-26 15:10:33 UTC (rev 230)
+++ redbutton-browser/trunk/MHEGStreamPlayer.c 2007-02-26 16:07:56 UTC (rev 231)
@@ -362,6 +362,8 @@
decode_thread(void *arg)
{
MHEGStreamPlayer *p = (MHEGStreamPlayer *) arg;
+ int demux_apid;
+ int demux_vpid;
MpegTSContext *tsdemux;
AVPacket pkt;
AVCodecContext *audio_codec_ctx = NULL;
@@ -411,7 +413,9 @@
if((frame = avcodec_alloc_frame()) == NULL)
fatal("Out of memory");
- if((tsdemux = mpegts_open(p->ts)) == NULL)
+ demux_apid = p->have_audio ? p->audio_pid : -1;
+ demux_vpid = p->have_video ? p->video_pid : -1;
+ if((tsdemux = mpegts_open(p->ts, demux_apid, demux_vpid)) == NULL)
fatal("Out of memory");
while(!p->stop && !feof(p->ts))
Modified: redbutton-browser/trunk/mpegts.c
===================================================================
--- redbutton-browser/trunk/mpegts.c 2007-02-26 15:10:33 UTC (rev 230)
+++ redbutton-browser/trunk/mpegts.c 2007-02-26 16:07:56 UTC (rev 231)
@@ -37,22 +37,9 @@
#include "MHEGEngine.h"
#define TS_PACKET_SIZE 188
-#define NB_PID_MAX 2
/* expands as necessary */
#define INIT_FRAME_BUFF_SIZE (128 * 1024)
-typedef struct PESContext PESContext;
-
-struct MpegTSContext
-{
- FILE *ts_stream; /* transport stream we are reading from */
- AVPacket *pkt; /* packet containing av data */
- int stop_parse; /* stop parsing loop */
- PESContext *pids[NB_PID_MAX]; /* PIDs we are demuxing */
- int is_start; /* is the current packet the first of a frame */
- int last_cc; /* last Continuity Check value we saw (<0 => none seen yet) */
-};
-
/* TS stream handling */
enum MpegTSState
{
@@ -85,16 +72,38 @@
unsigned int alloc_size; /* number of bytes malloc'ed to frame_data */
};
+typedef struct PESContext PESContext;
+
+struct MpegTSContext
+{
+ FILE *ts_stream; /* transport stream we are reading from */
+ int apid; /* audio PID we want, -1 => no audio */
+ int vpid; /* video PID we want, -1 => no video */
+ AVPacket *pkt; /* packet containing av data */
+ int stop_parse; /* stop parsing loop */
+ PESContext apes; /* audio PES we are demuxing */
+ PESContext vpes; /* video PES we are demuxing */
+ int is_start; /* is the current packet the first of a frame */
+ int last_cc; /* last Continuity Check value we saw (<0 => none seen yet) */
+};
+
static int read_packet(FILE *, uint8_t *);
static void handle_packet(MpegTSContext *, const uint8_t *);
-static PESContext *add_pes_stream(MpegTSContext *, int);
+static int init_pes_stream(MpegTSContext *, PESContext *, int);
+static void free_pes_stream(PESContext *);
+static PESContext *find_pes_stream(MpegTSContext *, int);
static void mpegts_push_data(PESContext *, const uint8_t *, int, int);
static int64_t get_pts(const uint8_t *);
/* my interface */
+/*
+ * demux the given audio and video PIDs from the transport stream
+ * if apid or vpid is -1, ignore it
+ */
+
MpegTSContext *
-mpegts_open(FILE *ts)
+mpegts_open(FILE *ts, int apid, int vpid)
{
MpegTSContext *ctx;
@@ -102,7 +111,21 @@
return NULL;
ctx->ts_stream = ts;
+ ctx->apid = apid;
+ ctx->vpid = vpid;
+ if(init_pes_stream(ctx, &ctx->apes, apid) < 0)
+ {
+ av_free(ctx);
+ return NULL;
+ }
+ if(init_pes_stream(ctx, &ctx->vpes, vpid) < 0)
+ {
+ free_pes_stream(&ctx->apes);
+ av_free(ctx);
+ return NULL;
+ }
+
ctx->is_start = 0;
/* last continuity check value (-1 => CC always passes) */
@@ -126,8 +149,8 @@
return -1;
}
/* find the stream */
- if((pes = add_pes_stream(ctx, packet.stream_index)) == NULL)
- fatal("mpegts_demux_frame: internal error");
+ if((pes = find_pes_stream(ctx, packet.stream_index)) == NULL)
+ fatal("mpegts_demux_frame: unexpected PID %d", packet.stream_index);
/* is it the first packet of the next frame */
if(ctx->is_start == 0)
{
@@ -211,16 +234,9 @@
void
mpegts_close(MpegTSContext *ctx)
{
- int i;
+ free_pes_stream(&ctx->apes);
+ free_pes_stream(&ctx->vpes);
- for(i=0; i<NB_PID_MAX; i++)
- {
- if(ctx->pids[i])
- {
- av_free(ctx->pids[i]->frame_data);
- av_free(ctx->pids[i]);
- }
- }
av_free(ctx);
return;
@@ -276,8 +292,11 @@
pid = ((packet[1] & 0x1f) << 8) | packet[2];
- if((pes = add_pes_stream(ctx, pid)) == NULL)
+ if((pes = find_pes_stream(ctx, pid)) == NULL)
+ {
+ verbose("MPEG TS demux: ignoring unexpected PID %d", pid);
return;
+ }
ctx->is_start = packet[1] & 0x40;
@@ -311,40 +330,44 @@
return;
}
-static PESContext *
-add_pes_stream(MpegTSContext *ctx, int pid)
+static int
+init_pes_stream(MpegTSContext *ctx, PESContext *pes, int pid)
{
- PESContext *pes;
- int i;
+ bzero(pes, sizeof(PESContext));
- /* have we already added this PID */
- for(i=0; i<NB_PID_MAX && ctx->pids[i]!=NULL; i++)
- if(ctx->pids[i]->pid == pid)
- return ctx->pids[i];
- if(i == NB_PID_MAX)
- return NULL;
-
- /* if no pid found, then add a pid context */
- if((pes = av_mallocz(sizeof(PESContext))) == NULL)
- return NULL;
pes->ts = ctx;
pes->pid = pid;
pes->alloc_size = INIT_FRAME_BUFF_SIZE;
if((pes->frame_data = av_malloc(pes->alloc_size)) == NULL)
- {
- av_free(pes);
- return NULL;
- }
+ return -1;
pes->frame_pts = AV_NOPTS_VALUE;
pes->frame_dts = AV_NOPTS_VALUE;
- ctx->pids[i] = pes;
+ return 0;
+}
- return pes;
+static void
+free_pes_stream(PESContext *pes)
+{
+ if(pes->frame_data)
+ av_free(pes->frame_data);
+
+ return;
}
+static PESContext *
+find_pes_stream(MpegTSContext *ctx, int pid)
+{
+ if(pid == ctx->apid)
+ return &ctx->apes;
+ else if(pid == ctx->vpid)
+ return &ctx->vpes;
+ else
+ return NULL;
+}
+
/* return non zero if a packet could be constructed */
static void
mpegts_push_data(PESContext *pes, const uint8_t *buf, int buf_size, int is_start)
Modified: redbutton-browser/trunk/mpegts.h
===================================================================
--- redbutton-browser/trunk/mpegts.h 2007-02-26 15:10:33 UTC (rev 230)
+++ redbutton-browser/trunk/mpegts.h 2007-02-26 16:07:56 UTC (rev 231)
@@ -19,7 +19,7 @@
typedef struct MpegTSContext MpegTSContext;
-MpegTSContext *mpegts_open(FILE *);
+MpegTSContext *mpegts_open(FILE *, int, int);
int mpegts_demux_frame(MpegTSContext *, AVPacket *);
int mpegts_demux_packet(MpegTSContext *, AVPacket *);
void mpegts_close(MpegTSContext *);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ski...@us...> - 2007-02-26 15:10:40
|
Revision: 230
http://svn.sourceforge.net/redbutton/?rev=230&view=rev
Author: skilvington
Date: 2007-02-26 07:10:33 -0800 (Mon, 26 Feb 2007)
Log Message:
-----------
dont send an empty a/v stream if we can't find the PIDs
Modified Paths:
--------------
redbutton-download/trunk/command.c
Modified: redbutton-download/trunk/command.c
===================================================================
--- redbutton-download/trunk/command.c 2007-02-25 10:21:50 UTC (rev 229)
+++ redbutton-download/trunk/command.c 2007-02-26 15:10:33 UTC (rev 230)
@@ -209,7 +209,10 @@
/* check we have a default stream */
if(streams->audio_pid == 0)
+ {
SEND_RESPONSE(500, "Unable to resolve audio PID");
+ return false;
+ }
/* add the PID to the demux device */
if((audio_fd = add_demux_filter(car->demux_device, streams->audio_pid, DMX_PES_AUDIO)) < 0)
@@ -281,7 +284,10 @@
/* check we have a default stream */
if(streams->video_pid == 0)
+ {
SEND_RESPONSE(500, "Unable to resolve video PID");
+ return false;
+ }
/* add the PID to the demux device */
if((video_fd = add_demux_filter(car->demux_device, streams->video_pid, DMX_PES_VIDEO)) < 0)
@@ -357,9 +363,15 @@
/* check we have a default stream */
if(streams->audio_pid == 0)
+ {
SEND_RESPONSE(500, "Unable to resolve audio PID");
+ return false;
+ }
if(streams->video_pid == 0)
+ {
SEND_RESPONSE(500, "Unable to resolve video PID");
+ return false;
+ }
/* add the PIDs to the demux device */
if((audio_fd = add_demux_filter(car->demux_device, streams->audio_pid, DMX_PES_AUDIO)) < 0)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ski...@us...> - 2007-02-25 10:21:54
|
Revision: 229
http://svn.sourceforge.net/redbutton/?rev=229&view=rev
Author: skilvington
Date: 2007-02-25 02:21:50 -0800 (Sun, 25 Feb 2007)
Log Message:
-----------
don't keep malloc/free'ing memory for a/v frames
Modified Paths:
--------------
redbutton-browser/trunk/MHEGStreamPlayer.c
redbutton-browser/trunk/MHEGStreamPlayer.h
redbutton-browser/trunk/TODO
redbutton-browser/trunk/utils.c
redbutton-browser/trunk/utils.h
Modified: redbutton-browser/trunk/MHEGStreamPlayer.c
===================================================================
--- redbutton-browser/trunk/MHEGStreamPlayer.c 2007-02-19 17:47:32 UTC (rev 228)
+++ redbutton-browser/trunk/MHEGStreamPlayer.c 2007-02-25 10:21:50 UTC (rev 229)
@@ -23,12 +23,32 @@
static void thread_usleep(unsigned long);
static enum CodecID find_av_codec_id(int);
+/* global pool of spare VideoFrame's */
+LIST_OF(VideoFrame) *free_vframes = NULL;
+pthread_mutex_t free_vframes_lock = PTHREAD_MUTEX_INITIALIZER;
+
LIST_TYPE(VideoFrame) *
new_VideoFrameListItem(double pts, enum PixelFormat pix_fmt, unsigned int width, unsigned int height, AVFrame *frame)
{
- LIST_TYPE(VideoFrame) *vf = safe_malloc(sizeof(LIST_TYPE(VideoFrame)));
+ LIST_TYPE(VideoFrame) *vf;
int frame_size;
+ /* do we have a spare frame we can use */
+ pthread_mutex_lock(&free_vframes_lock);
+ if(free_vframes != NULL)
+ {
+ vf = free_vframes;
+ LIST_REMOVE(&free_vframes, vf);
+ }
+ else
+ {
+ vf = safe_malloc(sizeof(LIST_TYPE(VideoFrame)));
+ vf->item.frame_data = NULL;
+ vf->item.nalloced = 0;
+ }
+ pthread_mutex_unlock(&free_vframes_lock);
+
+ /* frame info */
vf->item.pts = pts;
vf->item.pix_fmt = pix_fmt;
vf->item.width = width;
@@ -40,7 +60,7 @@
*/
if((frame_size = avpicture_get_size(pix_fmt, width, height)) < 0)
fatal("Invalid frame_size");
- vf->item.frame_data = safe_malloc(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);
img_copy(&vf->item.frame, (AVPicture*) frame, pix_fmt, width, height);
@@ -50,18 +70,36 @@
void
free_VideoFrameListItem(LIST_TYPE(VideoFrame) *vf)
{
- safe_free(vf->item.frame_data);
+ /* add it to the free list */
+ pthread_mutex_lock(&free_vframes_lock);
+ LIST_APPEND(&free_vframes, vf);
+ pthread_mutex_unlock(&free_vframes_lock);
- safe_free(vf);
-
return;
}
+/* global pool of spare AudioFrame's */
+LIST_OF(AudioFrame) *free_aframes = NULL;
+pthread_mutex_t free_aframes_lock = PTHREAD_MUTEX_INITIALIZER;
+
LIST_TYPE(AudioFrame) *
new_AudioFrameListItem(void)
{
- LIST_TYPE(AudioFrame) *af = safe_malloc(sizeof(LIST_TYPE(AudioFrame)));
+ LIST_TYPE(AudioFrame) *af;
+ /* do we have a spare frame we can use */
+ pthread_mutex_lock(&free_aframes_lock);
+ if(free_aframes != NULL)
+ {
+ af = free_aframes;
+ LIST_REMOVE(&free_aframes, af);
+ }
+ else
+ {
+ af = safe_malloc(sizeof(LIST_TYPE(AudioFrame)));
+ }
+ pthread_mutex_unlock(&free_aframes_lock);
+
af->item.pts = AV_NOPTS_VALUE;
af->item.size = 0;
@@ -72,7 +110,10 @@
void
free_AudioFrameListItem(LIST_TYPE(AudioFrame) *af)
{
- safe_free(af);
+ /* add it to the free list */
+ pthread_mutex_lock(&free_aframes_lock);
+ LIST_APPEND(&free_aframes, af);
+ pthread_mutex_unlock(&free_aframes_lock);
return;
}
Modified: redbutton-browser/trunk/MHEGStreamPlayer.h
===================================================================
--- redbutton-browser/trunk/MHEGStreamPlayer.h 2007-02-19 17:47:32 UTC (rev 228)
+++ redbutton-browser/trunk/MHEGStreamPlayer.h 2007-02-25 10:21:50 UTC (rev 229)
@@ -28,6 +28,7 @@
unsigned int height;
AVPicture frame;
unsigned char *frame_data;
+ size_t nalloced; /* number of bytes malloc'ed to frame_data */
} VideoFrame;
DEFINE_LIST_OF(VideoFrame);
Modified: redbutton-browser/trunk/TODO
===================================================================
--- redbutton-browser/trunk/TODO 2007-02-19 17:47:32 UTC (rev 228)
+++ redbutton-browser/trunk/TODO 2007-02-25 10:21:50 UTC (rev 229)
@@ -1,9 +1,6 @@
VideoDecodeOffset
-don't keep malloc/free'ing memory for a/v frames
-
-
if video size != VideoClass size, centre and draw a smaller transparent hole
Modified: redbutton-browser/trunk/utils.c
===================================================================
--- redbutton-browser/trunk/utils.c 2007-02-19 17:47:32 UTC (rev 228)
+++ redbutton-browser/trunk/utils.c 2007-02-25 10:21:50 UTC (rev 229)
@@ -188,6 +188,23 @@
}
/*
+ * only calls safe_realloc if nbytes > *oldsize
+ * updates *oldsize if it calls safe_realloc
+ */
+
+void *
+safe_fast_realloc(void *oldbuf, size_t *oldsize, size_t nbytes)
+{
+ if(nbytes > *oldsize)
+ {
+ oldbuf = safe_realloc(oldbuf, nbytes);
+ *oldsize = nbytes;
+ }
+
+ return oldbuf;
+}
+
+/*
* safe_free(NULL) is okay
*/
Modified: redbutton-browser/trunk/utils.h
===================================================================
--- redbutton-browser/trunk/utils.h 2007-02-19 17:47:32 UTC (rev 228)
+++ redbutton-browser/trunk/utils.h 2007-02-25 10:21:50 UTC (rev 229)
@@ -43,6 +43,7 @@
void *safe_malloc(size_t);
void *safe_mallocz(size_t);
void *safe_realloc(void *, size_t);
+void *safe_fast_realloc(void *, size_t *, size_t);
void safe_free(void *);
char *safe_strdup(const char *);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ski...@us...> - 2007-02-19 17:48:02
|
Revision: 228
http://svn.sourceforge.net/redbutton/?rev=228&view=rev
Author: skilvington
Date: 2007-02-19 09:47:32 -0800 (Mon, 19 Feb 2007)
Log Message:
-----------
put cache under base_dir
Modified Paths:
--------------
redbutton-download/trunk/rb-download.c
Modified: redbutton-download/trunk/rb-download.c
===================================================================
--- redbutton-download/trunk/rb-download.c 2007-02-19 17:16:11 UTC (rev 227)
+++ redbutton-download/trunk/rb-download.c 2007-02-19 17:47:32 UTC (rev 228)
@@ -147,9 +147,6 @@
}
}
- if(!cache_init())
- fatal("Unable to initialise cache");
-
/* initialise channels.conf */
if(!init_channels_conf(channels_file))
error("Unable to open channels.conf file");
@@ -159,6 +156,9 @@
&& chdir(base_dir) < 0)
fatal("Unable to cd to '%s': %s", base_dir, strerror(errno));
+ if(!cache_init())
+ fatal("Unable to initialise cache");
+
if(argc == optind)
{
list_channels(adapter, timeout);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ski...@us...> - 2007-02-19 17:16:26
|
Revision: 227
http://svn.sourceforge.net/redbutton/?rev=227&view=rev
Author: skilvington
Date: 2007-02-19 09:16:11 -0800 (Mon, 19 Feb 2007)
Log Message:
-----------
cache PAT and PMTs
Modified Paths:
--------------
redbutton-download/trunk/Makefile
redbutton-download/trunk/TODO
redbutton-download/trunk/findmheg.c
redbutton-download/trunk/listen.c
redbutton-download/trunk/rb-download.c
www/index.html
Added Paths:
-----------
redbutton-download/trunk/cache.c
redbutton-download/trunk/cache.h
Modified: redbutton-download/trunk/Makefile
===================================================================
--- redbutton-download/trunk/Makefile 2007-02-19 13:30:26 UTC (rev 226)
+++ redbutton-download/trunk/Makefile 2007-02-19 17:16:11 UTC (rev 227)
@@ -17,6 +17,7 @@
biop.o \
fs.o \
channels.o \
+ cache.o \
utils.o
LIBS=-lz
Modified: redbutton-download/trunk/TODO
===================================================================
--- redbutton-download/trunk/TODO 2007-02-19 13:30:26 UTC (rev 226)
+++ redbutton-download/trunk/TODO 2007-02-19 17:16:11 UTC (rev 227)
@@ -1,5 +1,3 @@
-cache PAT and PMTs
-
need to kill all existing command connections on retune
(listen_data->carousel is stale for them)
Added: redbutton-download/trunk/cache.c
===================================================================
--- redbutton-download/trunk/cache.c (rev 0)
+++ redbutton-download/trunk/cache.c 2007-02-19 17:16:11 UTC (rev 227)
@@ -0,0 +1,125 @@
+/*
+ * cache.c
+ */
+
+/*
+ * Copyright (C) 2007, Simon Kilvington
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include <stdio.h>
+#include <string.h>
+#include <stdbool.h>
+#include <dirent.h>
+#include <errno.h>
+#include <unistd.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+
+#include "cache.h"
+#include "table.h"
+#include "utils.h"
+
+/*
+ * can't just cache tables in memory because the PMTs are mostly read when we
+ * execute "avstream <service_id> ..." commands
+ * each command is run in a child process, so the memory is lost when the
+ * process ends
+ * so we cache the tables in the file system
+ * all cache items are MAX_TABLE_LEN bytes long
+ */
+
+#define CACHE_DIR "cache"
+
+bool
+cache_init(void)
+{
+ if(mkdir(CACHE_DIR, 0755) < 0 && errno != EEXIST)
+ fatal("Unable to create cache directory '%s': %s", CACHE_DIR, strerror(errno));
+
+ cache_flush();
+
+ return true;
+}
+
+/*
+ * returns false if the item is not in the cache
+ */
+
+bool
+cache_load(char *item, unsigned char *out)
+{
+ char filename[PATH_MAX];
+ FILE *f;
+ size_t nread;
+
+ snprintf(filename, sizeof(filename), "%s/%s", CACHE_DIR, item);
+
+ if((f = fopen(filename, "r")) == NULL)
+ return false;
+
+ nread = fread(out, 1, MAX_TABLE_LEN, f);
+
+ fclose(f);
+
+ return (nread == MAX_TABLE_LEN);
+}
+
+void
+cache_save(char *item, unsigned char *data)
+{
+ char filename[PATH_MAX];
+ FILE *f;
+
+ snprintf(filename, sizeof(filename), "%s/%s", CACHE_DIR, item);
+
+ if((f = fopen(filename, "w")) == NULL)
+ return;
+
+ /* if we don't write it all, we'll find out when we try to load it */
+ fwrite(data, 1, MAX_TABLE_LEN, f);
+
+ fclose(f);
+
+ return;
+}
+
+void
+cache_flush(void)
+{
+ DIR *d;
+ struct dirent *item;
+ char filename[PATH_MAX];
+
+ if((d = opendir(CACHE_DIR)) == NULL)
+ return;
+
+ while((item = readdir(d)) != NULL)
+ {
+ /* skip . and .. */
+ if(strcmp(item->d_name, ".") == 0
+ || strcmp(item->d_name, "..") == 0)
+ continue;
+ snprintf(filename, sizeof(filename), "%s/%s", CACHE_DIR, item->d_name);
+ unlink(filename);
+ }
+
+ closedir(d);
+
+ return;
+}
+
+
Added: redbutton-download/trunk/cache.h
===================================================================
--- redbutton-download/trunk/cache.h (rev 0)
+++ redbutton-download/trunk/cache.h 2007-02-19 17:16:11 UTC (rev 227)
@@ -0,0 +1,36 @@
+/*
+ * cache.h
+ */
+
+/*
+ * Copyright (C) 2007, Simon Kilvington
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef __CACHE_H__
+#define __CACHE_H__
+
+#include <stdbool.h>
+
+bool cache_init(void);
+
+bool cache_load(char *, unsigned char *);
+void cache_save(char *, unsigned char *);
+
+void cache_flush(void);
+
+#endif /* __CACHE_H__ */
+
Modified: redbutton-download/trunk/findmheg.c
===================================================================
--- redbutton-download/trunk/findmheg.c 2007-02-19 13:30:26 UTC (rev 226)
+++ redbutton-download/trunk/findmheg.c 2007-02-19 17:16:11 UTC (rev 227)
@@ -30,6 +30,7 @@
#include "findmheg.h"
#include "table.h"
#include "assoc.h"
+#include "cache.h"
#include "utils.h"
/* Programme Association Table and Section */
@@ -81,6 +82,7 @@
static struct avstreams *find_current_avstreams(struct carousel *, int, int);
static struct avstreams *find_service_avstreams(struct carousel *, int, int, int);
+static bool read_pat(char *, unsigned int, unsigned char *);
static bool read_pmt(char *, uint16_t, unsigned int, unsigned char *);
bool
@@ -405,9 +407,35 @@
* returns false if it timesout
*/
-bool
+static bool
+read_pat(char *demux, unsigned int timeout, unsigned char *out)
+{
+ /* is it in the cache */
+ if(cache_load("pat", out))
+ return true;
+
+ /* read it from the DVB card */
+ if(!read_table(demux, PID_PAT, TID_PAT, timeout, out))
+ {
+ error("Unable to read PAT");
+ return false;
+ }
+
+ /* cache it */
+ cache_save("pat", out);
+
+ return true;
+}
+
+/*
+ * output buffer must be at least MAX_TABLE_LEN bytes
+ * returns false if it timesout
+ */
+
+static bool
read_pmt(char *demux, uint16_t service_id, unsigned int timeout, unsigned char *out)
{
+ char cache_item[PATH_MAX];
unsigned char pat[MAX_TABLE_LEN];
uint16_t section_length;
uint16_t offset;
@@ -415,12 +443,14 @@
bool found;
bool rc;
+ /* is it in the cache */
+ snprintf(cache_item, sizeof(cache_item), "pmt-%u", service_id);
+ if(cache_load(cache_item, out))
+ return true;
+
/* get the PAT */
- if(!read_table(demux, PID_PAT, TID_PAT, timeout, pat))
- {
- error("Unable to read PAT");
+ if(!read_pat(demux, timeout, pat))
return false;
- }
section_length = 3 + (((pat[1] & 0x0f) << 8) + pat[2]);
@@ -447,7 +477,12 @@
vverbose("PMT PID: %u", map_pid);
/* get the PMT */
- if(!(rc = read_table(demux, map_pid, TID_PMT, timeout, out)))
+ rc = read_table(demux, map_pid, TID_PMT, timeout, out);
+
+ /* cache it */
+ if(rc)
+ cache_save(cache_item, out);
+ else
error("Unable to read PMT");
return rc;
Modified: redbutton-download/trunk/listen.c
===================================================================
--- redbutton-download/trunk/listen.c 2007-02-19 13:30:26 UTC (rev 226)
+++ redbutton-download/trunk/listen.c 2007-02-19 17:16:11 UTC (rev 227)
@@ -20,6 +20,7 @@
#include "findmheg.h"
#include "carousel.h"
#include "channels.h"
+#include "cache.h"
#include "utils.h"
/* listen() backlog, 5 is max for BSD apparently */
@@ -177,6 +178,7 @@
verbose("Retune to service_id %d", retune_id);
/* kill the current downloader process and start a new one */
kill(listen_data.carousel->downloader, SIGKILL);
+ cache_flush();
listen_data.carousel = start_downloader(adapter, timeout, retune_id, -1);
retune_id = -1;
}
Modified: redbutton-download/trunk/rb-download.c
===================================================================
--- redbutton-download/trunk/rb-download.c 2007-02-19 13:30:26 UTC (rev 226)
+++ redbutton-download/trunk/rb-download.c 2007-02-19 17:16:11 UTC (rev 227)
@@ -71,6 +71,7 @@
#include "carousel.h"
#include "listen.h"
#include "channels.h"
+#include "cache.h"
#include "utils.h"
/* seconds before we assume no DSMCC data is available on this PID */
@@ -146,6 +147,9 @@
}
}
+ if(!cache_init())
+ fatal("Unable to initialise cache");
+
/* initialise channels.conf */
if(!init_channels_conf(channels_file))
error("Unable to open channels.conf file");
Modified: www/index.html
===================================================================
--- www/index.html 2007-02-19 13:30:26 UTC (rev 226)
+++ www/index.html 2007-02-19 17:16:11 UTC (rev 227)
@@ -90,6 +90,10 @@
</PRE>
where <PID> is the PID the carousel was downloaded from
and <CID> is the Carousel ID.
+<PRE>
+./cache/
+</PRE>
+Temporary cache of DVB tables to stop us having to wait for them to be retransmitted everytime we need them.
<P>
Just leave it running and any updated files will be downloaded as they are broadcast.
<H2>Notes</H2>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ski...@us...> - 2007-02-19 13:30:28
|
Revision: 226
http://svn.sourceforge.net/redbutton/?rev=226&view=rev
Author: skilvington
Date: 2007-02-19 05:30:26 -0800 (Mon, 19 Feb 2007)
Log Message:
-----------
cut 'n' paste error
Modified Paths:
--------------
redbutton-download/trunk/findmheg.c
Modified: redbutton-download/trunk/findmheg.c
===================================================================
--- redbutton-download/trunk/findmheg.c 2007-02-19 13:25:10 UTC (rev 225)
+++ redbutton-download/trunk/findmheg.c 2007-02-19 13:30:26 UTC (rev 226)
@@ -416,7 +416,7 @@
bool rc;
/* get the PAT */
- if(!read_table(_car.demux_device, PID_PAT, TID_PAT, timeout, pat))
+ if(!read_table(demux, PID_PAT, TID_PAT, timeout, pat))
{
error("Unable to read PAT");
return false;
@@ -447,7 +447,7 @@
vverbose("PMT PID: %u", map_pid);
/* get the PMT */
- if(!(rc = read_table(_car.demux_device, map_pid, TID_PMT, timeout, out)))
+ if(!(rc = read_table(demux, map_pid, TID_PMT, timeout, out)))
error("Unable to read PMT");
return rc;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ski...@us...> - 2007-02-19 13:25:12
|
Revision: 225
http://svn.sourceforge.net/redbutton/?rev=225&view=rev
Author: skilvington
Date: 2007-02-19 05:25:10 -0800 (Mon, 19 Feb 2007)
Log Message:
-----------
style
Modified Paths:
--------------
redbutton-download/trunk/findmheg.c
Modified: redbutton-download/trunk/findmheg.c
===================================================================
--- redbutton-download/trunk/findmheg.c 2007-02-19 13:17:28 UTC (rev 224)
+++ redbutton-download/trunk/findmheg.c 2007-02-19 13:25:10 UTC (rev 225)
@@ -447,8 +447,7 @@
vverbose("PMT PID: %u", map_pid);
/* get the PMT */
- rc = read_table(_car.demux_device, map_pid, TID_PMT, timeout, out);
- if(!rc)
+ if(!(rc = read_table(_car.demux_device, map_pid, TID_PMT, timeout, out)))
error("Unable to read PMT");
return rc;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ski...@us...> - 2007-02-19 13:17:36
|
Revision: 224
http://svn.sourceforge.net/redbutton/?rev=224&view=rev
Author: skilvington
Date: 2007-02-19 05:17:28 -0800 (Mon, 19 Feb 2007)
Log Message:
-----------
caller provides output buffer when reading DVB tables
Modified Paths:
--------------
redbutton-download/trunk/TODO
redbutton-download/trunk/carousel.c
redbutton-download/trunk/findmheg.c
redbutton-download/trunk/list.c
redbutton-download/trunk/table.c
redbutton-download/trunk/table.h
Modified: redbutton-download/trunk/TODO
===================================================================
--- redbutton-download/trunk/TODO 2007-02-18 14:37:15 UTC (rev 223)
+++ redbutton-download/trunk/TODO 2007-02-19 13:17:28 UTC (rev 224)
@@ -1,5 +1,4 @@
cache PAT and PMTs
-also, better if caller provides output buffer for tables
need to kill all existing command connections on retune
(listen_data->carousel is stale for them)
Modified: redbutton-download/trunk/carousel.c
===================================================================
--- redbutton-download/trunk/carousel.c 2007-02-18 14:37:15 UTC (rev 223)
+++ redbutton-download/trunk/carousel.c 2007-02-19 13:17:28 UTC (rev 224)
@@ -34,7 +34,7 @@
void
load_carousel(struct carousel *car)
{
- unsigned char *table;
+ unsigned char table[MAX_TABLE_LEN];
bool done;
/* no modules yet */
@@ -46,7 +46,7 @@
do
{
struct dsmccMessageHeader *dsmcc;
- if((table = read_dsmcc_tables(car)) == NULL)
+ if(!read_dsmcc_tables(car, table))
fatal("Unable to read PID");
dsmcc = (struct dsmccMessageHeader *) &table[8];
if(dsmcc->protocolDiscriminator == DSMCC_PROTOCOL
Modified: redbutton-download/trunk/findmheg.c
===================================================================
--- redbutton-download/trunk/findmheg.c 2007-02-18 14:37:15 UTC (rev 223)
+++ redbutton-download/trunk/findmheg.c 2007-02-19 13:17:28 UTC (rev 224)
@@ -81,7 +81,7 @@
static struct avstreams *find_current_avstreams(struct carousel *, int, int);
static struct avstreams *find_service_avstreams(struct carousel *, int, int, int);
-static unsigned char *read_pmt(char *, uint16_t, unsigned int);
+static bool read_pmt(char *, uint16_t, unsigned int, unsigned char *);
bool
is_audio_stream(uint8_t stream_type)
@@ -107,7 +107,7 @@
struct carousel *
find_mheg(unsigned int adapter, unsigned int timeout, uint16_t service_id, int carousel_id)
{
- unsigned char *pmt;
+ unsigned char pmt[MAX_TABLE_LEN];
uint16_t section_length;
uint16_t offset;
uint8_t stream_type;
@@ -144,7 +144,7 @@
_car.modules = NULL;
/* get the PMT */
- if((pmt = read_pmt(_car.demux_device, service_id, timeout)) == NULL)
+ if(!read_pmt(_car.demux_device, service_id, timeout, pmt))
fatal("Unable to read PMT");
section_length = 3 + (((pmt[1] & 0x0f) << 8) + pmt[2]);
@@ -302,7 +302,7 @@
static struct avstreams *
find_service_avstreams(struct carousel *car, int service_id, int audio_tag, int video_tag)
{
- unsigned char *pmt;
+ unsigned char pmt[MAX_TABLE_LEN];
uint16_t section_length;
uint16_t offset;
uint8_t stream_type;
@@ -318,7 +318,7 @@
bzero(&_streams, sizeof(_streams));
/* get the PMT */
- if((pmt = read_pmt(car->demux_device, service_id, car->timeout)) == NULL)
+ if(!read_pmt(car->demux_device, service_id, car->timeout, pmt))
fatal("Unable to read PMT");
section_length = 3 + (((pmt[1] & 0x0f) << 8) + pmt[2]);
@@ -400,21 +400,26 @@
return &_streams;
}
-static unsigned char *
-read_pmt(char *demux, uint16_t service_id, unsigned int timeout)
+/*
+ * output buffer must be at least MAX_TABLE_LEN bytes
+ * returns false if it timesout
+ */
+
+bool
+read_pmt(char *demux, uint16_t service_id, unsigned int timeout, unsigned char *out)
{
- unsigned char *pat;
+ unsigned char pat[MAX_TABLE_LEN];
uint16_t section_length;
uint16_t offset;
uint16_t map_pid = 0;
bool found;
- unsigned char *pmt;
+ bool rc;
/* get the PAT */
- if((pat = read_table(_car.demux_device, PID_PAT, TID_PAT, timeout)) == NULL)
+ if(!read_table(_car.demux_device, PID_PAT, TID_PAT, timeout, pat))
{
error("Unable to read PAT");
- return NULL;
+ return false;
}
section_length = 3 + (((pat[1] & 0x0f) << 8) + pat[2]);
@@ -442,9 +447,10 @@
vverbose("PMT PID: %u", map_pid);
/* get the PMT */
- if((pmt = read_table(_car.demux_device, map_pid, TID_PMT, timeout)) == NULL)
+ rc = read_table(_car.demux_device, map_pid, TID_PMT, timeout, out);
+ if(!rc)
error("Unable to read PMT");
- return pmt;
+ return rc;
}
Modified: redbutton-download/trunk/list.c
===================================================================
--- redbutton-download/trunk/list.c 2007-02-18 14:37:15 UTC (rev 223)
+++ redbutton-download/trunk/list.c 2007-02-19 13:17:28 UTC (rev 224)
@@ -37,7 +37,7 @@
list_channels(unsigned int adapter, unsigned int timeout)
{
char demux_dev[PATH_MAX];
- unsigned char *sds;
+ unsigned char sds[MAX_TABLE_LEN];
uint16_t size;
uint16_t offset;
uint16_t service_id;
@@ -53,7 +53,7 @@
printf("==\t=======\n");
/* grab the Service Description Section table */
- if((sds = read_table(demux_dev, PID_SDT, TID_SDS, timeout)) == NULL)
+ if(!read_table(demux_dev, PID_SDT, TID_SDS, timeout, sds))
fatal("Unable to read SDT");
/* 12 bit section_length field */
Modified: redbutton-download/trunk/table.c
===================================================================
--- redbutton-download/trunk/table.c 2007-02-18 14:37:15 UTC (rev 223)
+++ redbutton-download/trunk/table.c 2007-02-19 13:17:28 UTC (rev 224)
@@ -38,21 +38,23 @@
#include <linux/dvb/dmx.h>
#endif
+#include "table.h"
#include "dsmcc.h"
#include "carousel.h"
#include "biop.h"
#include "utils.h"
-#define MAX_TABLE_LEN 4096
-
/* DSMCC table ID's we want */
#define TID_DSMCC_CONTROL 0x3b /* DSI or DII */
#define TID_DSMCC_DATA 0x3c /* DDB */
-static unsigned char _buf[MAX_TABLE_LEN];
+/*
+ * output buffer must be at least MAX_TABLE_LEN bytes
+ * returns false if it timesout
+ */
-unsigned char *
-read_table(char *device, uint16_t pid, uint8_t tid, unsigned int secs)
+bool
+read_table(char *device, uint16_t pid, uint8_t tid, unsigned int secs, unsigned char *out)
{
int fd_data;
struct dmx_sct_filter_params sctFilterParams;
@@ -63,7 +65,7 @@
if((fd_data = open(device, O_RDWR)) < 0)
{
error("open '%s': %s", device, strerror(errno));
- return NULL;
+ return false;
}
memset(&sctFilterParams, 0, sizeof(sctFilterParams));
@@ -77,14 +79,15 @@
{
error("ioctl DMX_SET_FILTER: %s", strerror(errno));
close(fd_data);
- return NULL;
+ return false;
}
timeout.tv_sec = secs;
timeout.tv_usec = 0;
do
{
- _buf[0] = 0xff; /* we never want table ID 0xff */
+ /* we check for out[0]==tid to see if we read the table */
+ out[0] = ~tid;
FD_ZERO(&readfds);
FD_SET(fd_data, &readfds);
if(select(fd_data + 1, &readfds, NULL, NULL, &timeout) < 0)
@@ -93,36 +96,38 @@
continue;
error("read_table: select: %s", strerror(errno));
close(fd_data);
- return NULL;
+ return false;
}
if(FD_ISSET(fd_data, &readfds))
{
- if((n = read(fd_data, _buf, sizeof(_buf))) < 0)
+ if((n = read(fd_data, out, MAX_TABLE_LEN)) < 0)
{
error("read: %s", strerror(errno));
close(fd_data);
- return NULL;
+ return false;
}
}
else
{
error("Timeout reading %s", device);
close(fd_data);
- return NULL;
+ return false;
}
}
- while(_buf[0] != tid);
+ while(out[0] != tid);
-// printf("PID: 0x%x table_id: 0x%x length: %d bytes\n", pid, _buf[0], n);
-// hexdump(_buf, n);
-
close(fd_data);
- return _buf;
+ return true;
}
-unsigned char *
-read_dsmcc_tables(struct carousel *car)
+/*
+ * output buffer must be at least MAX_TABLE_LEN bytes
+ * returns false if it timesout
+ */
+
+bool
+read_dsmcc_tables(struct carousel *car, unsigned char *out)
{
struct timeval timeout;
unsigned int i;
@@ -135,7 +140,7 @@
timeout.tv_usec = 0;
do
{
- _buf[0] = 0;
+ out[0] = 0;
/* work out the max fd number and set the fds we want to read from */
max = 0;
FD_ZERO(&readfds);
@@ -150,7 +155,7 @@
if(select(max + 1, &readfds, NULL, NULL, &timeout) < 0)
{
error("read_dsmcc_tables: select: %s", strerror(errno));
- return NULL;
+ return false;
}
/* see which fd is ready */
fd = -1;
@@ -172,25 +177,22 @@
if(fd == -1)
{
error("Timeout reading %s", car->demux_device);
- return NULL;
+ return false;
}
/* read the table */
- if((n = read(fd, _buf, sizeof(_buf))) < 0)
+ if((n = read(fd, out, MAX_TABLE_LEN)) < 0)
{
/*
* may get EOVERFLOW if we don't read quick enough,
* so just report it and have another go
*/
error("read: %s", strerror(errno));
- _buf[0] = 0;
+ out[0] = 0;
}
}
- while(_buf[0] != TID_DSMCC_CONTROL && _buf[0] != TID_DSMCC_DATA);
+ while(out[0] != TID_DSMCC_CONTROL && out[0] != TID_DSMCC_DATA);
-// printf("PID: 0x%x table_id: 0x%x length: %d bytes\n", car->current_pid, _buf[0], n);
-// hexdump(_buf, n);
-
- return _buf;
+ return out;
}
void
Modified: redbutton-download/trunk/table.h
===================================================================
--- redbutton-download/trunk/table.h 2007-02-18 14:37:15 UTC (rev 223)
+++ redbutton-download/trunk/table.h 2007-02-19 13:17:28 UTC (rev 224)
@@ -24,13 +24,17 @@
#define __TABLE_H__
#include <stdint.h>
+#include <stdbool.h>
#include "module.h"
-unsigned char *read_table(char *, uint16_t, uint8_t, unsigned int);
+/* max size of a DVB table */
+#define MAX_TABLE_LEN 4096
-unsigned char *read_dsmcc_tables(struct carousel *);
+bool read_table(char *, uint16_t, uint8_t, unsigned int, unsigned char *);
+bool read_dsmcc_tables(struct carousel *, unsigned char *);
+
void add_dsmcc_pid(struct carousel *, uint16_t);
#endif /* __TABLE_H__ */
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ski...@us...> - 2007-02-18 14:37:21
|
Revision: 223
http://svn.sourceforge.net/redbutton/?rev=223&view=rev
Author: skilvington
Date: 2007-02-18 06:37:15 -0800 (Sun, 18 Feb 2007)
Log Message:
-----------
how to speed up opening streams
Modified Paths:
--------------
redbutton-download/trunk/TODO
Modified: redbutton-download/trunk/TODO
===================================================================
--- redbutton-download/trunk/TODO 2007-02-17 17:53:59 UTC (rev 222)
+++ redbutton-download/trunk/TODO 2007-02-18 14:37:15 UTC (rev 223)
@@ -1,3 +1,6 @@
+cache PAT and PMTs
+also, better if caller provides output buffer for tables
+
need to kill all existing command connections on retune
(listen_data->carousel is stale for them)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ski...@us...> - 2007-02-17 17:54:05
|
Revision: 222
http://svn.sourceforge.net/redbutton/?rev=222&view=rev
Author: skilvington
Date: 2007-02-17 09:53:59 -0800 (Sat, 17 Feb 2007)
Log Message:
-----------
didn't think it looked right
Modified Paths:
--------------
redbutton-browser/trunk/StreamClass.c
Modified: redbutton-browser/trunk/StreamClass.c
===================================================================
--- redbutton-browser/trunk/StreamClass.c 2007-02-16 21:58:40 UTC (rev 221)
+++ redbutton-browser/trunk/StreamClass.c 2007-02-17 17:53:59 UTC (rev 222)
@@ -250,7 +250,7 @@
/*
* don't think we need to generate stream_playing/stopped events
- * but I'm not entirely shore
+ * but I'm not entirely sure
*/
/* if we are activated, stop playing while we change the component */
@@ -272,7 +272,7 @@
/*
* don't think we need to generate stream_playing/stopped events
- * but I'm not entirely shore
+ * but I'm not entirely sure
*/
/* if we are activated, stop playing while we change the component */
@@ -294,7 +294,7 @@
/*
* don't think we need to generate stream_playing/stopped events
- * but I'm not entirely shore
+ * but I'm not entirely sure
*/
/* if we are activated, stop playing while we change the component */
@@ -316,7 +316,7 @@
/*
* don't think we need to generate stream_playing/stopped events
- * but I'm not entirely shore
+ * but I'm not entirely sure
*/
/* if we are activated, stop playing while we change the component */
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ski...@us...> - 2007-02-16 21:58:41
|
Revision: 221
http://svn.sourceforge.net/redbutton/?rev=221&view=rev
Author: skilvington
Date: 2007-02-16 13:58:40 -0800 (Fri, 16 Feb 2007)
Log Message:
-----------
cope with MPEG stream type 6
Modified Paths:
--------------
redbutton-browser/trunk/MHEGStreamPlayer.c
redbutton-browser/trunk/TODO
redbutton-browser/trunk/mpegts.h
Modified: redbutton-browser/trunk/MHEGStreamPlayer.c
===================================================================
--- redbutton-browser/trunk/MHEGStreamPlayer.c 2007-02-16 21:06:15 UTC (rev 220)
+++ redbutton-browser/trunk/MHEGStreamPlayer.c 2007-02-16 21:58:40 UTC (rev 221)
@@ -221,7 +221,8 @@
p->video->inst.no_video = true;
/* is audio/video output totally disabled */
- if(MHEGEngine_avDisabled())
+ if(MHEGEngine_avDisabled()
+ || (!p->have_video && !p->have_audio))
return;
p->audio_pid = p->audio_tag;
@@ -242,6 +243,17 @@
p->stop = false;
/*
+ * the MPEG type for some streams is set to 6 (STREAM_TYPE_PRIVATE_DATA)
+ * eg the streams for BBC News Multiscreen
+ * presumably, this is stop them getting accidentally picked up when you scan for channels
+ * luckily we know what type MPEG audio and video streams should be
+ */
+ if(p->have_video && p->video_type == STREAM_TYPE_PRIVATE_DATA)
+ p->video_type = STREAM_TYPE_VIDEO_MPEG2;
+ if(p->have_audio && p->audio_type == STREAM_TYPE_PRIVATE_DATA)
+ p->audio_type = STREAM_TYPE_AUDIO_MPEG2;
+
+ /*
* we have three threads:
* decode_thread reads MPEG data from the TS and decodes it into YUV video frames and audio samples
* video_thread takes YUV frames off the videoq list, converts them to RGB and displays them on the screen
Modified: redbutton-browser/trunk/TODO
===================================================================
--- redbutton-browser/trunk/TODO 2007-02-16 21:06:15 UTC (rev 220)
+++ redbutton-browser/trunk/TODO 2007-02-16 21:58:40 UTC (rev 221)
@@ -1,4 +1,4 @@
-find out what MPEG stream type 6 means!
+VideoDecodeOffset
don't keep malloc/free'ing memory for a/v frames
Modified: redbutton-browser/trunk/mpegts.h
===================================================================
--- redbutton-browser/trunk/mpegts.h 2007-02-16 21:06:15 UTC (rev 220)
+++ redbutton-browser/trunk/mpegts.h 2007-02-16 21:58:40 UTC (rev 221)
@@ -6,15 +6,16 @@
#define __MPEGTS_H__
/* stream types we care about */
-#define STREAM_TYPE_VIDEO_MPEG1 0x01
-#define STREAM_TYPE_VIDEO_MPEG2 0x02
-#define STREAM_TYPE_AUDIO_MPEG1 0x03
-#define STREAM_TYPE_AUDIO_MPEG2 0x04
-#define STREAM_TYPE_AUDIO_AAC 0x0f
-#define STREAM_TYPE_VIDEO_MPEG4 0x10
-#define STREAM_TYPE_VIDEO_H264 0x1b
-#define STREAM_TYPE_AUDIO_AC3 0x81
-#define STREAM_TYPE_AUDIO_DTS 0x8a
+#define STREAM_TYPE_VIDEO_MPEG1 0x01
+#define STREAM_TYPE_VIDEO_MPEG2 0x02
+#define STREAM_TYPE_AUDIO_MPEG1 0x03
+#define STREAM_TYPE_AUDIO_MPEG2 0x04
+#define STREAM_TYPE_PRIVATE_DATA 0x06
+#define STREAM_TYPE_AUDIO_AAC 0x0f
+#define STREAM_TYPE_VIDEO_MPEG4 0x10
+#define STREAM_TYPE_VIDEO_H264 0x1b
+#define STREAM_TYPE_AUDIO_AC3 0x81
+#define STREAM_TYPE_AUDIO_DTS 0x8a
typedef struct MpegTSContext MpegTSContext;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ski...@us...> - 2007-02-16 21:06:17
|
Revision: 220
http://svn.sourceforge.net/redbutton/?rev=220&view=rev
Author: skilvington
Date: 2007-02-16 13:06:15 -0800 (Fri, 16 Feb 2007)
Log Message:
-----------
bloody hell! BBC News Multiscreen still doesn't work!
Modified Paths:
--------------
redbutton-browser/trunk/TODO
Modified: redbutton-browser/trunk/TODO
===================================================================
--- redbutton-browser/trunk/TODO 2007-02-16 20:56:28 UTC (rev 219)
+++ redbutton-browser/trunk/TODO 2007-02-16 21:06:15 UTC (rev 220)
@@ -1,3 +1,6 @@
+find out what MPEG stream type 6 means!
+
+
don't keep malloc/free'ing memory for a/v frames
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ski...@us...> - 2007-02-16 20:56:33
|
Revision: 219
http://svn.sourceforge.net/redbutton/?rev=219&view=rev
Author: skilvington
Date: 2007-02-16 12:56:28 -0800 (Fri, 16 Feb 2007)
Log Message:
-----------
play/stop StreamComponents when they are activated/deactivated
Modified Paths:
--------------
redbutton-browser/trunk/StreamClass.c
Modified: redbutton-browser/trunk/StreamClass.c
===================================================================
--- redbutton-browser/trunk/StreamClass.c 2007-02-16 12:54:40 UTC (rev 218)
+++ redbutton-browser/trunk/StreamClass.c 2007-02-16 20:56:28 UTC (rev 219)
@@ -246,47 +246,88 @@
void
StreamClass_activateVideoComponent(StreamClass *t, VideoClass *c)
{
-/* TODO */
-printf("TODO: StreamClass_activateVideoComponent (tag=%d)\n", c->component_tag);
-// basically:
-// MHEGStreamPlayer_stop(t)
-// MHEGStreamPlayer_setVideoStream(t, c) - may get the "only using last video stream" warning
-// MHEGStreamPlayer_play(t)
-// MHEGEngine_generateAstncEvent(&t->rootClass.inst.ref, EventType_stream_playing, NULL)
+ verbose("StreamClass_activateVideoComponent (tag=%d)", c->component_tag);
+ /*
+ * don't think we need to generate stream_playing/stopped events
+ * but I'm not entirely shore
+ */
+
+ /* if we are activated, stop playing while we change the component */
+ if(t->rootClass.inst.RunningStatus)
+ MHEGStreamPlayer_stop(&t->inst.player);
+
+ MHEGStreamPlayer_setVideoStream(&t->inst.player, c);
+
+ if(t->rootClass.inst.RunningStatus)
+ MHEGStreamPlayer_play(&t->inst.player);
+
return;
}
void
StreamClass_activateAudioComponent(StreamClass *t, AudioClass *c)
{
-/* TODO */
-printf("TODO: StreamClass_activateAudioComponent (tag=%d)\n", c->component_tag);
+ verbose("StreamClass_activateAudioComponent (tag=%d)", c->component_tag);
+ /*
+ * don't think we need to generate stream_playing/stopped events
+ * but I'm not entirely shore
+ */
+
+ /* if we are activated, stop playing while we change the component */
+ if(t->rootClass.inst.RunningStatus)
+ MHEGStreamPlayer_stop(&t->inst.player);
+
+ MHEGStreamPlayer_setAudioStream(&t->inst.player, c);
+
+ if(t->rootClass.inst.RunningStatus)
+ MHEGStreamPlayer_play(&t->inst.player);
+
return;
}
void
StreamClass_deactivateVideoComponent(StreamClass *t, VideoClass *c)
{
-/* TODO */
-printf("TODO: StreamClass_deactivateVideoComponent (tag=%d)\n", c->component_tag);
-// basically:
-// MHEGStreamPlayer_stop(t)
-// MHEGStreamPlayer_setVideoStream(t, NULL)
-// MHEGStreamPlayer_play(t)
-// MHEGEngine_generateAstncEvent(&t->rootClass.inst.ref, EventType_stream_stopped, NULL)
-// => need to make MHEGStreamPlayer_setVideoStream(t, NULL) disable video
+ verbose("StreamClass_deactivateVideoComponent (tag=%d)", c->component_tag);
+ /*
+ * don't think we need to generate stream_playing/stopped events
+ * but I'm not entirely shore
+ */
+
+ /* if we are activated, stop playing while we change the component */
+ if(t->rootClass.inst.RunningStatus)
+ MHEGStreamPlayer_stop(&t->inst.player);
+
+ MHEGStreamPlayer_setVideoStream(&t->inst.player, NULL);
+
+ if(t->rootClass.inst.RunningStatus)
+ MHEGStreamPlayer_play(&t->inst.player);
+
return;
}
void
StreamClass_deactivateAudioComponent(StreamClass *t, AudioClass *c)
{
-/* TODO */
-printf("TODO: StreamClass_deactivateAudioComponent (tag=%d)\n", c->component_tag);
+ verbose("StreamClass_deactivateAudioComponent (tag=%d)", c->component_tag);
+ /*
+ * don't think we need to generate stream_playing/stopped events
+ * but I'm not entirely shore
+ */
+
+ /* if we are activated, stop playing while we change the component */
+ if(t->rootClass.inst.RunningStatus)
+ MHEGStreamPlayer_stop(&t->inst.player);
+
+ MHEGStreamPlayer_setAudioStream(&t->inst.player, NULL);
+
+ if(t->rootClass.inst.RunningStatus)
+ MHEGStreamPlayer_play(&t->inst.player);
+
return;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ski...@us...> - 2007-02-16 12:54:42
|
Revision: 218
http://svn.sourceforge.net/redbutton/?rev=218&view=rev
Author: skilvington
Date: 2007-02-16 04:54:40 -0800 (Fri, 16 Feb 2007)
Log Message:
-----------
allow us to temporarily stop playing streams without forgetting what their components are
Modified Paths:
--------------
redbutton-browser/trunk/MHEGStreamPlayer.c
redbutton-browser/trunk/StreamComponent.c
Modified: redbutton-browser/trunk/MHEGStreamPlayer.c
===================================================================
--- redbutton-browser/trunk/MHEGStreamPlayer.c 2007-02-15 09:31:49 UTC (rev 217)
+++ redbutton-browser/trunk/MHEGStreamPlayer.c 2007-02-16 12:54:40 UTC (rev 218)
@@ -139,6 +139,23 @@
void
MHEGStreamPlayer_setVideoStream(MHEGStreamPlayer *p, VideoClass *video)
{
+ /* assert */
+ if(p->playing)
+ fatal("MHEGStreamPlayer_setVideoStream: trying to set stream while playing");
+
+ if(video)
+ verbose("MHEGStreamPlayer_setVideoStream: tag=%d", video->component_tag);
+ else
+ verbose("MHEGStreamPlayer_setVideoStream: NULL");
+
+ /* video==NULL => forget any existing stream */
+ if(video == NULL)
+ {
+ p->have_video = false;
+ p->video = NULL;
+ return;
+ }
+
if(p->have_video)
error("MHEGStreamPlayer: more than one video stream; only using the last one (%d)", video->component_tag);
@@ -158,6 +175,24 @@
void
MHEGStreamPlayer_setAudioStream(MHEGStreamPlayer *p, AudioClass *audio)
{
+ /* assert */
+ if(p->playing)
+ fatal("MHEGStreamPlayer_setAudioStream: trying to set stream while playing");
+
+ if(audio)
+ verbose("MHEGStreamPlayer_setAudioStream: tag=%d", audio->component_tag);
+ else
+ verbose("MHEGStreamPlayer_setAudioStream: NULL");
+
+ /* audio==NULL => forget any existing stream */
+ if(audio == NULL)
+ {
+ p->have_audio = false;
+ p->audio = NULL;
+ p->audio_codec = NULL;
+ return;
+ }
+
if(p->have_audio)
error("MHEGStreamPlayer: more than one audio stream; only using the last one (%d)", audio->component_tag);
@@ -258,13 +293,6 @@
p->ts = NULL;
}
- /* forget any existing streams */
- p->have_video = false;
- p->have_audio = false;
- p->video = NULL;
- p->audio = NULL;
- p->audio_codec = NULL;
-
p->playing = false;
return;
Modified: redbutton-browser/trunk/StreamComponent.c
===================================================================
--- redbutton-browser/trunk/StreamComponent.c 2007-02-15 09:31:49 UTC (rev 217)
+++ redbutton-browser/trunk/StreamComponent.c 2007-02-16 12:54:40 UTC (rev 218)
@@ -155,9 +155,11 @@
switch(s->choice)
{
case StreamComponent_audio:
+ MHEGStreamPlayer_setAudioStream(player, NULL);
break;
case StreamComponent_video:
+ MHEGStreamPlayer_setVideoStream(player, NULL);
break;
case StreamComponent_rtgraphics:
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ski...@us...> - 2007-02-15 09:32:03
|
Revision: 217
http://svn.sourceforge.net/redbutton/?rev=217&view=rev
Author: skilvington
Date: 2007-02-15 01:31:49 -0800 (Thu, 15 Feb 2007)
Log Message:
-----------
make sure StreamComponents don't forget who their StreamClass is, if they are activated after the StreamClass is activated
Modified Paths:
--------------
redbutton-browser/trunk/AudioClass.c
redbutton-browser/trunk/VideoClass.c
Modified: redbutton-browser/trunk/AudioClass.c
===================================================================
--- redbutton-browser/trunk/AudioClass.c 2007-02-14 17:17:51 UTC (rev 216)
+++ redbutton-browser/trunk/AudioClass.c 2007-02-15 09:31:49 UTC (rev 217)
@@ -11,12 +11,18 @@
void
default_AudioClassInstanceVars(AudioClass *t, AudioClassInstanceVars *v)
{
- bzero(v, sizeof(AudioClassInstanceVars));
+ /*
+ * don't do:
+ * bzero(v, sizeof(AudioClassInstanceVars));
+ * or:
+ * v->owner = NULL;
+ * the whole AudioClass including these instance vars is zero'd when it is DER decoded
+ * we need to make sure v->owner is not set to NULL here
+ * in case our StreamClass is already active and has set our owner
+ */
v->Volume = t->original_volume;
- v->owner = NULL;
-
return;
}
@@ -68,7 +74,6 @@
*/
if(t->inst.owner != NULL)
StreamClass_activateAudioComponent(t->inst.owner, t);
-else printf("TODO: AudioClass_Activation: un-owned (tag=%d)\n", t->component_tag);
return;
}
@@ -89,7 +94,6 @@
*/
if(t->inst.owner != NULL)
StreamClass_deactivateAudioComponent(t->inst.owner, t);
-else printf("TODO: AudioClass_Deactivation: un-owned (tag=%d)\n", t->component_tag);
return;
}
Modified: redbutton-browser/trunk/VideoClass.c
===================================================================
--- redbutton-browser/trunk/VideoClass.c 2007-02-14 17:17:51 UTC (rev 216)
+++ redbutton-browser/trunk/VideoClass.c 2007-02-15 09:31:49 UTC (rev 217)
@@ -18,7 +18,15 @@
void
default_VideoClassInstanceVars(VideoClass *t, VideoClassInstanceVars *v)
{
- bzero(v, sizeof(VideoClassInstanceVars));
+ /*
+ * don't do:
+ * bzero(v, sizeof(VideoClassInstanceVars));
+ * or:
+ * v->owner = NULL;
+ * the whole VideoClass including these instance vars is zero'd when it is DER decoded
+ * we need to make sure v->owner is not set to NULL here
+ * in case our StreamClass is already active and has set our owner
+ */
/* VisibleClass */
memcpy(&v->BoxSize, &t->original_box_size, sizeof(OriginalBoxSize));
@@ -31,8 +39,6 @@
v->VideoDecodeOffset.x_position = 0;
v->VideoDecodeOffset.y_position = 0;
- v->owner = NULL;
-
pthread_mutex_init(&v->bbox_lock, NULL);
pthread_mutex_init(&v->scaled_lock, NULL);
v->scaled = false;
@@ -95,7 +101,6 @@
*/
if(t->inst.owner != NULL)
StreamClass_activateVideoComponent(t->inst.owner, t);
-else printf("TODO: VideoClass_Activation: un-owned (tag=%d)\n", t->component_tag);
/* now its RunningStatus is true, get it drawn at its position in the application's DisplayStack */
MHEGEngine_redrawArea(&t->inst.Position, &t->inst.BoxSize);
@@ -119,7 +124,6 @@
*/
if(t->inst.owner != NULL)
StreamClass_deactivateVideoComponent(t->inst.owner, t);
-else printf("TODO: VideoClass_Deactivation: un-owned (tag=%d)\n", t->component_tag);
/* now its RunningStatus is false, redraw the area it covered */
MHEGEngine_redrawArea(&t->inst.Position, &t->inst.BoxSize);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ski...@us...> - 2007-02-14 17:17:58
|
Revision: 216
http://svn.sourceforge.net/redbutton/?rev=216&view=rev
Author: skilvington
Date: 2007-02-14 09:17:51 -0800 (Wed, 14 Feb 2007)
Log Message:
-----------
get StreamComponents to tell their StreamClass when they are [de]activated
Modified Paths:
--------------
redbutton-browser/trunk/AudioClass.c
redbutton-browser/trunk/StreamClass.c
redbutton-browser/trunk/StreamClass.h
redbutton-browser/trunk/VideoClass.c
Modified: redbutton-browser/trunk/AudioClass.c
===================================================================
--- redbutton-browser/trunk/AudioClass.c 2007-02-13 16:59:54 UTC (rev 215)
+++ redbutton-browser/trunk/AudioClass.c 2007-02-14 17:17:51 UTC (rev 216)
@@ -5,6 +5,7 @@
#include "MHEGEngine.h"
#include "AudioClass.h"
#include "RootClass.h"
+#include "StreamClass.h"
#include "ExternalReference.h"
void
@@ -14,6 +15,8 @@
v->Volume = t->original_volume;
+ v->owner = NULL;
+
return;
}
@@ -58,6 +61,15 @@
/* generate IsRunning event */
MHEGEngine_generateEvent(&t->rootClass.inst.ref, EventType_is_running, NULL);
+ /*
+ * tell our StreamClass to start playing us
+ * owner maybe NULL if our StreamClass is in the process of activating itself
+ * in which case, it will start us when needed
+ */
+ if(t->inst.owner != NULL)
+ StreamClass_activateAudioComponent(t->inst.owner, t);
+else printf("TODO: AudioClass_Activation: un-owned (tag=%d)\n", t->component_tag);
+
return;
}
@@ -66,8 +78,19 @@
{
verbose("AudioClass: %s; Deactivation", ExternalReference_name(&t->rootClass.inst.ref));
- RootClass_Deactivation(&t->rootClass);
+ /* is it already deactivated */
+ if(!RootClass_Deactivation(&t->rootClass))
+ return;
+ /*
+ * tell our StreamClass to stop playing us
+ * owner maybe NULL if our StreamClass is in the process of deactivating itself
+ * in which case, it will stop us when needed
+ */
+ if(t->inst.owner != NULL)
+ StreamClass_deactivateAudioComponent(t->inst.owner, t);
+else printf("TODO: AudioClass_Deactivation: un-owned (tag=%d)\n", t->component_tag);
+
return;
}
Modified: redbutton-browser/trunk/StreamClass.c
===================================================================
--- redbutton-browser/trunk/StreamClass.c 2007-02-13 16:59:54 UTC (rev 215)
+++ redbutton-browser/trunk/StreamClass.c 2007-02-14 17:17:51 UTC (rev 216)
@@ -13,8 +13,6 @@
void
default_StreamClassInstanceVars(StreamClass *t, StreamClassInstanceVars *v)
{
- LIST_TYPE(StreamComponent) *comp;
-
bzero(v, sizeof(StreamClassInstanceVars));
v->Speed.numerator = 1;
@@ -26,14 +24,6 @@
v->CounterTriggers = NULL;
- /* let the StreamComponents know who they belong to */
- comp = t->multiplex;
- while(comp)
- {
- StreamComponent_registerStreamClass(&comp->item, t);
- comp = comp->next;
- }
-
MHEGStreamPlayer_init(&v->player);
return;
@@ -155,6 +145,14 @@
t->rootClass.inst.RunningStatus = true;
MHEGEngine_generateEvent(&t->rootClass.inst.ref, EventType_is_running, NULL);
+ /* now we are fully activated, let our StreamComponents know who they belong to */
+ comp = t->multiplex;
+ while(comp)
+ {
+ StreamComponent_registerStreamClass(&comp->item, t);
+ comp = comp->next;
+ }
+
return;
}
@@ -170,6 +168,14 @@
if(!t->rootClass.inst.RunningStatus)
return;
+ /* disown all our StreamComponents */
+ comp = t->multiplex;
+ while(comp)
+ {
+ StreamComponent_registerStreamClass(&comp->item, NULL);
+ comp = comp->next;
+ }
+
/* stop playing all active StreamComponents */
MHEGStreamPlayer_stop(&t->inst.player);
comp = t->multiplex;
@@ -237,6 +243,53 @@
return;
}
+void
+StreamClass_activateVideoComponent(StreamClass *t, VideoClass *c)
+{
+/* TODO */
+printf("TODO: StreamClass_activateVideoComponent (tag=%d)\n", c->component_tag);
+// basically:
+// MHEGStreamPlayer_stop(t)
+// MHEGStreamPlayer_setVideoStream(t, c) - may get the "only using last video stream" warning
+// MHEGStreamPlayer_play(t)
+// MHEGEngine_generateAstncEvent(&t->rootClass.inst.ref, EventType_stream_playing, NULL)
+
+ return;
+}
+
+void
+StreamClass_activateAudioComponent(StreamClass *t, AudioClass *c)
+{
+/* TODO */
+printf("TODO: StreamClass_activateAudioComponent (tag=%d)\n", c->component_tag);
+
+ return;
+}
+
+void
+StreamClass_deactivateVideoComponent(StreamClass *t, VideoClass *c)
+{
+/* TODO */
+printf("TODO: StreamClass_deactivateVideoComponent (tag=%d)\n", c->component_tag);
+// basically:
+// MHEGStreamPlayer_stop(t)
+// MHEGStreamPlayer_setVideoStream(t, NULL)
+// MHEGStreamPlayer_play(t)
+// MHEGEngine_generateAstncEvent(&t->rootClass.inst.ref, EventType_stream_stopped, NULL)
+// => need to make MHEGStreamPlayer_setVideoStream(t, NULL) disable video
+
+ return;
+}
+
+void
+StreamClass_deactivateAudioComponent(StreamClass *t, AudioClass *c)
+{
+/* TODO */
+printf("TODO: StreamClass_deactivateAudioComponent (tag=%d)\n", c->component_tag);
+
+ return;
+}
+
/*
* corrigendum says StreamClass can be the target of SetData
* this changes the multiplex (ie service ID)
Modified: redbutton-browser/trunk/StreamClass.h
===================================================================
--- redbutton-browser/trunk/StreamClass.h 2007-02-13 16:59:54 UTC (rev 215)
+++ redbutton-browser/trunk/StreamClass.h 2007-02-14 17:17:51 UTC (rev 216)
@@ -12,6 +12,11 @@
void StreamClass_Deactivation(StreamClass *);
void StreamClass_Destruction(StreamClass *);
+void StreamClass_activateVideoComponent(StreamClass *, VideoClass *);
+void StreamClass_activateAudioComponent(StreamClass *, AudioClass *);
+void StreamClass_deactivateVideoComponent(StreamClass *, VideoClass *);
+void StreamClass_deactivateAudioComponent(StreamClass *, AudioClass *);
+
void StreamClass_SetData(StreamClass *, SetData *, OctetString *);
void StreamClass_SetCounterTrigger(StreamClass *, SetCounterTrigger *, OctetString *);
void StreamClass_SetSpeed(StreamClass *, SetSpeed *, OctetString *);
Modified: redbutton-browser/trunk/VideoClass.c
===================================================================
--- redbutton-browser/trunk/VideoClass.c 2007-02-13 16:59:54 UTC (rev 215)
+++ redbutton-browser/trunk/VideoClass.c 2007-02-14 17:17:51 UTC (rev 216)
@@ -5,6 +5,7 @@
#include "MHEGEngine.h"
#include "ISO13522-MHEG-5.h"
#include "RootClass.h"
+#include "StreamClass.h"
#include "ExternalReference.h"
#include "ObjectReference.h"
#include "GenericInteger.h"
@@ -30,6 +31,8 @@
v->VideoDecodeOffset.x_position = 0;
v->VideoDecodeOffset.y_position = 0;
+ v->owner = NULL;
+
pthread_mutex_init(&v->bbox_lock, NULL);
pthread_mutex_init(&v->scaled_lock, NULL);
v->scaled = false;
@@ -85,6 +88,15 @@
t->rootClass.inst.RunningStatus = true;
MHEGEngine_generateEvent(&t->rootClass.inst.ref, EventType_is_running, NULL);
+ /*
+ * tell our StreamClass to start playing us
+ * owner maybe NULL if our StreamClass is in the process of activating itself
+ * in which case, it will start us when needed
+ */
+ if(t->inst.owner != NULL)
+ StreamClass_activateVideoComponent(t->inst.owner, t);
+else printf("TODO: VideoClass_Activation: un-owned (tag=%d)\n", t->component_tag);
+
/* now its RunningStatus is true, get it drawn at its position in the application's DisplayStack */
MHEGEngine_redrawArea(&t->inst.Position, &t->inst.BoxSize);
@@ -100,6 +112,15 @@
if(!RootClass_Deactivation(&t->rootClass))
return;
+ /*
+ * tell our StreamClass to stop playing us
+ * owner maybe NULL if our StreamClass is in the process of deactivating itself
+ * in which case, it will stop us when needed
+ */
+ if(t->inst.owner != NULL)
+ StreamClass_deactivateVideoComponent(t->inst.owner, t);
+else printf("TODO: VideoClass_Deactivation: un-owned (tag=%d)\n", t->component_tag);
+
/* now its RunningStatus is false, redraw the area it covered */
MHEGEngine_redrawArea(&t->inst.Position, &t->inst.BoxSize);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|