[Redbutton-devel] SF.net SVN: redbutton: [216] redbutton-browser/trunk
Brought to you by:
skilvington
|
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.
|