[Redbutton-devel] SF.net SVN: redbutton:[546] redbutton-browser/trunk
Brought to you by:
skilvington
From: <ski...@us...> - 2011-06-02 07:43:29
|
Revision: 546 http://redbutton.svn.sourceforge.net/redbutton/?rev=546&view=rev Author: skilvington Date: 2011-06-02 07:43:23 +0000 (Thu, 02 Jun 2011) Log Message: ----------- no need for external pointers to the MHEGStreamPlayer singleton Modified Paths: -------------- redbutton-browser/trunk/MHEGStreamPlayer.c redbutton-browser/trunk/MHEGStreamPlayer.h redbutton-browser/trunk/StreamClass.c redbutton-browser/trunk/StreamComponent.c redbutton-browser/trunk/StreamComponent.h redbutton-browser/trunk/add_instance_vars.conf Modified: redbutton-browser/trunk/MHEGStreamPlayer.c =================================================================== --- redbutton-browser/trunk/MHEGStreamPlayer.c 2011-03-20 20:34:51 UTC (rev 545) +++ redbutton-browser/trunk/MHEGStreamPlayer.c 2011-06-02 07:43:23 UTC (rev 546) @@ -127,7 +127,7 @@ static MHEGStreamPlayer player; void -MHEGStreamPlayer_init(MHEGStreamPlayer **p) +MHEGStreamPlayer_init(void) { static bool created = false; @@ -168,22 +168,16 @@ verbose("MHEGStreamPlayer: %u users", player.nusers); - *p = &player; - return; } void -MHEGStreamPlayer_fini(MHEGStreamPlayer **p) +MHEGStreamPlayer_fini(void) { - /* assert */ - if(*p != &player) - fatal("MHEGStreamPlayer: *p=%p, &player=%p", *p, &player); - if(player.nusers == 0) fatal("MHEGStreamPlayer: nusers is 0"); - MHEGStreamPlayer_stop(&player); + MHEGStreamPlayer_stop(); player.nusers --; @@ -200,8 +194,6 @@ verbose("MHEGStreamPlayer: %u users", player.nusers); - *p = NULL; - #if 0 /* this is how you would destroy it */ pthread_mutex_destroy(&player.base_lock); @@ -221,11 +213,10 @@ */ void -MHEGStreamPlayer_setServiceID(MHEGStreamPlayer *p, int id) +MHEGStreamPlayer_setServiceID(int id) { - /* assert */ - if(p != &player) - fatal("MHEGStreamPlayer_setServiceID: p=%p, &player=%p", p, &player); + /* there can be only one */ + MHEGStreamPlayer *p = &player; /* assert */ if(p->playing && p->service_id != id) @@ -237,11 +228,10 @@ } void -MHEGStreamPlayer_setVideoStream(MHEGStreamPlayer *p, VideoClass *video) +MHEGStreamPlayer_setVideoStream(VideoClass *video) { - /* assert */ - if(p != &player) - fatal("MHEGStreamPlayer_setVideoStream: p=%p, &player=%p", p, &player); + /* there can be only one */ + MHEGStreamPlayer *p = &player; /* assert */ if(p->playing) @@ -277,11 +267,10 @@ } void -MHEGStreamPlayer_setAudioStream(MHEGStreamPlayer *p, AudioClass *audio) +MHEGStreamPlayer_setAudioStream(AudioClass *audio) { - /* assert */ - if(p != &player) - fatal("MHEGStreamPlayer_setAudioStream: p=%p, &player=%p", p, &player); + /* there can be only one */ + MHEGStreamPlayer *p = &player; /* assert */ if(p->playing) @@ -320,11 +309,10 @@ } void -MHEGStreamPlayer_play(MHEGStreamPlayer *p) +MHEGStreamPlayer_play(void) { - /* assert */ - if(p != &player) - fatal("MHEGStreamPlayer_play: p=%p, &player=%p", p, &player); + /* there can be only one */ + MHEGStreamPlayer *p = &player; verbose("MHEGStreamPlayer_play: service_id=%d audio_tag=%d video_tag=%d", p->service_id, p->audio_tag, p->video_tag); @@ -397,11 +385,10 @@ } void -MHEGStreamPlayer_stop(MHEGStreamPlayer *p) +MHEGStreamPlayer_stop(void) { - /* assert */ - if(p != &player) - fatal("MHEGStreamPlayer_stop: p=%p, &player=%p", p, &player); + /* there can be only one */ + MHEGStreamPlayer *p = &player; verbose("MHEGStreamPlayer_stop"); @@ -466,8 +453,8 @@ { verbose("MHEGStreamPlayer: retuned while playing"); /* just stop and restart, when we start playing the A/V PIDs are recalculated */ - MHEGStreamPlayer_stop(p); - MHEGStreamPlayer_play(p); + MHEGStreamPlayer_stop(); + MHEGStreamPlayer_play(); } return; Modified: redbutton-browser/trunk/MHEGStreamPlayer.h =================================================================== --- redbutton-browser/trunk/MHEGStreamPlayer.h 2011-03-20 20:34:51 UTC (rev 545) +++ redbutton-browser/trunk/MHEGStreamPlayer.h 2011-06-02 07:43:23 UTC (rev 546) @@ -82,15 +82,15 @@ LIST_OF(AudioFrame) *audioq; /* head of list is next to be played */ } MHEGStreamPlayer; -void MHEGStreamPlayer_init(MHEGStreamPlayer **); -void MHEGStreamPlayer_fini(MHEGStreamPlayer **); +void MHEGStreamPlayer_init(void); +void MHEGStreamPlayer_fini(void); -void MHEGStreamPlayer_setServiceID(MHEGStreamPlayer *, int); -void MHEGStreamPlayer_setVideoStream(MHEGStreamPlayer *, VideoClass *); -void MHEGStreamPlayer_setAudioStream(MHEGStreamPlayer *, AudioClass *); +void MHEGStreamPlayer_setServiceID(int); +void MHEGStreamPlayer_setVideoStream(VideoClass *); +void MHEGStreamPlayer_setAudioStream(AudioClass *); -void MHEGStreamPlayer_play(MHEGStreamPlayer *); -void MHEGStreamPlayer_stop(MHEGStreamPlayer *); +void MHEGStreamPlayer_play(void); +void MHEGStreamPlayer_stop(void); void MHEGStreamPlayer_retuned(void); Modified: redbutton-browser/trunk/StreamClass.c =================================================================== --- redbutton-browser/trunk/StreamClass.c 2011-03-20 20:34:51 UTC (rev 545) +++ redbutton-browser/trunk/StreamClass.c 2011-06-02 07:43:23 UTC (rev 546) @@ -26,7 +26,7 @@ v->CounterTriggers = NULL; - MHEGStreamPlayer_init(&v->player); + MHEGStreamPlayer_init(); return; } @@ -34,7 +34,7 @@ void free_StreamClassInstanceVars(StreamClassInstanceVars *v) { - MHEGStreamPlayer_fini(&v->player); + MHEGStreamPlayer_fini(); LIST_FREE(&v->CounterTriggers, CounterTrigger, safe_free); @@ -110,7 +110,7 @@ */ if(OctetString_strncmp(service, "dvb:", 4) == 0) { - MHEGStreamPlayer_setServiceID(t->inst.player, si_get_service_id(service)); + MHEGStreamPlayer_setServiceID(si_get_service_id(service)); } else if(OctetString_strncmp(service, "rec://svc/lcn/", 14) == 0) { @@ -120,7 +120,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(-1); } /* leave player's service ID as it is for "rec://svc/cur" */ else if(OctetString_strcmp(service, "rec://svc/cur") != 0) @@ -135,10 +135,10 @@ { if((r = StreamComponent_rootClass(&comp->item)) != NULL && r->inst.RunningStatus) - StreamComponent_play(&comp->item, t->inst.player); + StreamComponent_play(&comp->item); comp = comp->next; } - MHEGStreamPlayer_play(t->inst.player); + MHEGStreamPlayer_play(); /* multiplex is now playing */ MHEGEngine_generateAsyncEvent(&t->rootClass.inst.ref, EventType_stream_playing, NULL); @@ -179,13 +179,13 @@ } /* stop playing all active StreamComponents */ - MHEGStreamPlayer_stop(t->inst.player); + MHEGStreamPlayer_stop(); 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); comp = comp->next; } @@ -262,12 +262,12 @@ /* if we are activated, stop playing while we change the component */ if(t->rootClass.inst.RunningStatus) - MHEGStreamPlayer_stop(t->inst.player); + MHEGStreamPlayer_stop(); - MHEGStreamPlayer_setVideoStream(t->inst.player, c); + MHEGStreamPlayer_setVideoStream(c); if(t->rootClass.inst.RunningStatus) - MHEGStreamPlayer_play(t->inst.player); + MHEGStreamPlayer_play(); return; } @@ -284,12 +284,12 @@ /* if we are activated, stop playing while we change the component */ if(t->rootClass.inst.RunningStatus) - MHEGStreamPlayer_stop(t->inst.player); + MHEGStreamPlayer_stop(); - MHEGStreamPlayer_setAudioStream(t->inst.player, c); + MHEGStreamPlayer_setAudioStream(c); if(t->rootClass.inst.RunningStatus) - MHEGStreamPlayer_play(t->inst.player); + MHEGStreamPlayer_play(); return; } @@ -306,12 +306,12 @@ /* if we are activated, stop playing while we change the component */ if(t->rootClass.inst.RunningStatus) - MHEGStreamPlayer_stop(t->inst.player); + MHEGStreamPlayer_stop(); - MHEGStreamPlayer_setVideoStream(t->inst.player, NULL); + MHEGStreamPlayer_setVideoStream(NULL); if(t->rootClass.inst.RunningStatus) - MHEGStreamPlayer_play(t->inst.player); + MHEGStreamPlayer_play(); return; } @@ -328,12 +328,12 @@ /* if we are activated, stop playing while we change the component */ if(t->rootClass.inst.RunningStatus) - MHEGStreamPlayer_stop(t->inst.player); + MHEGStreamPlayer_stop(); - MHEGStreamPlayer_setAudioStream(t->inst.player, NULL); + MHEGStreamPlayer_setAudioStream(NULL); if(t->rootClass.inst.RunningStatus) - MHEGStreamPlayer_play(t->inst.player); + MHEGStreamPlayer_play(); return; } @@ -381,7 +381,7 @@ // new_service_id = -1; do the strncmps; if getServiceID != new_service_id {if(playing) stop; setServiceID; if(playing) play} /* if playing, stop */ if(t->rootClass.inst.RunningStatus) - MHEGStreamPlayer_stop(t->inst.player); + MHEGStreamPlayer_stop(); // TODO: the below is very similar to StreamClass_Activation /* * update the service ID @@ -394,7 +394,7 @@ */ if(OctetString_strncmp(service, "dvb:", 4) == 0) { - MHEGStreamPlayer_setServiceID(t->inst.player, si_get_service_id(service)); + MHEGStreamPlayer_setServiceID(si_get_service_id(service)); } else if(OctetString_strncmp(service, "rec://svc/lcn/", 14) == 0) { @@ -405,7 +405,7 @@ || OctetString_strcmp(service, "rec://svc/cur") == 0) { /* use the service ID we are currently tuned to */ - MHEGStreamPlayer_setServiceID(t->inst.player, -1); + MHEGStreamPlayer_setServiceID(-1); } else { @@ -413,7 +413,7 @@ } /* if playing, restart, this also update audio/video PIDs */ if(t->rootClass.inst.RunningStatus) - MHEGStreamPlayer_play(t->inst.player); + MHEGStreamPlayer_play(); //TODO: MHEGEngine_setRecSvcCur(service) - will need to copy 'service' contents printf("TODO: update rec://svc/cur\n"); //TODO: make sure "rec://svc/cur" and "rec://svc/def" usage is still correct everywhere else Modified: redbutton-browser/trunk/StreamComponent.c =================================================================== --- redbutton-browser/trunk/StreamComponent.c 2011-03-20 20:34:51 UTC (rev 545) +++ redbutton-browser/trunk/StreamComponent.c 2011-06-02 07:43:23 UTC (rev 546) @@ -125,16 +125,16 @@ } void -StreamComponent_play(StreamComponent *s, MHEGStreamPlayer *player) +StreamComponent_play(StreamComponent *s) { switch(s->choice) { case StreamComponent_audio: - MHEGStreamPlayer_setAudioStream(player, &s->u.audio); + MHEGStreamPlayer_setAudioStream(&s->u.audio); break; case StreamComponent_video: - MHEGStreamPlayer_setVideoStream(player, &s->u.video); + MHEGStreamPlayer_setVideoStream(&s->u.video); break; case StreamComponent_rtgraphics: @@ -150,16 +150,16 @@ } void -StreamComponent_stop(StreamComponent *s, MHEGStreamPlayer *player) +StreamComponent_stop(StreamComponent *s) { switch(s->choice) { case StreamComponent_audio: - MHEGStreamPlayer_setAudioStream(player, NULL); + MHEGStreamPlayer_setAudioStream(NULL); break; case StreamComponent_video: - MHEGStreamPlayer_setVideoStream(player, NULL); + MHEGStreamPlayer_setVideoStream(NULL); break; case StreamComponent_rtgraphics: Modified: redbutton-browser/trunk/StreamComponent.h =================================================================== --- redbutton-browser/trunk/StreamComponent.h 2011-03-20 20:34:51 UTC (rev 545) +++ redbutton-browser/trunk/StreamComponent.h 2011-06-02 07:43:23 UTC (rev 546) @@ -17,8 +17,8 @@ void StreamComponent_Activation(StreamComponent *); void StreamComponent_Destruction(StreamComponent *); -void StreamComponent_play(StreamComponent *, MHEGStreamPlayer *); -void StreamComponent_stop(StreamComponent *, MHEGStreamPlayer *); +void StreamComponent_play(StreamComponent *); +void StreamComponent_stop(StreamComponent *); #endif /* __STREAMCOMPONENT_H__ */ Modified: redbutton-browser/trunk/add_instance_vars.conf =================================================================== --- redbutton-browser/trunk/add_instance_vars.conf 2011-03-20 20:34:51 UTC (rev 545) +++ redbutton-browser/trunk/add_instance_vars.conf 2011-06-02 07:43:23 UTC (rev 546) @@ -226,8 +226,6 @@ int CounterPosition; int CounterEndPosition; LIST_OF(CounterTrigger) *CounterTriggers; - /* we add this */ - MHEGStreamPlayer *player; } StreamClassInstanceVars; </StreamClass> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |