44 #define MAX_STREAMS 16 56 H_DsmEvent eventHandle;
66 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
67 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL
69 static U32BIT gUniqueIds = 0;
79 static void FreeFromEventList(
EventInfo *eventInfo)
83 pp_EventInfo = &event_info_list;
84 while (*pp_EventInfo != NULL)
86 if (*pp_EventInfo == eventInfo)
88 TRACE(TSTRM, (
" FREE evtInfo=0x%x evHl=%p", eventInfo, eventInfo->eventHandle))
89 if (eventInfo->eventHandle != 0)
93 *pp_EventInfo = eventInfo->next;
94 MHEG5freeMem(eventInfo);
97 pp_EventInfo = &((*pp_EventInfo)->next);
112 eventInfo = event_info_list;
113 while (eventInfo != NULL)
115 if (eventInfo->unique.ptr == param->unique.ptr)
117 TRACE(TSTRM|TEVNTS, (
"link_id=%d name=%s",
118 eventInfo->link->ingredient.root.id, MHEG5linkEventName(eventInfo->link)))
130 eventInfo = eventInfo->next;
141 static void MHEG5streamEventNotifyCallback(
void *
info, U8BIT *eventName,
142 U32BIT data_len, U8BIT *data_ptr)
145 TRACE(TSTRM | TEVNTS, (
"name=%s data=(%.*s) id=%u", eventName, (
int)data_len, data_ptr, (
unsigned int)
info))
146 event_msg.proc_msg_func = (
F_MSG_PROCESS)StreamEventCallback;
147 event_msg.data_type = DT_VALUE;
148 event_msg.data.streamEvent.unique.ptr = info;
149 if (
VQ_PutMsg(&event_msg, PRTY_HIGH) != MHERR_OK)
165 eventInfo = event_info_list;
166 while (eventInfo != NULL)
168 if (eventInfo->link == link)
172 eventInfo = eventInfo->next;
174 if (eventInfo != NULL)
176 if (stream->reloading)
179 MHEG5linkEventName(eventInfo->link),
180 MHEG5streamEventNotifyCallback,
181 eventInfo->unique.ptr, &eventInfo->eventHandle) == FS_STATUS_OK)
183 TRACE(TSTRM, (
"dsmcc EventSubscribe OK, id=%p evHl=%p", eventInfo->unique.ptr, eventInfo->eventHandle))
187 TRACE(TERROR, (
"evtInfo=0x%x reloading", eventInfo))
188 FreeFromEventList(eventInfo);
197 TRACE(TERROR, (
"unable to allocate memory"));
201 eventInfo->eventHandle = 0;
202 eventInfo->stream = stream;
203 eventInfo->link = link;
204 eventInfo->unique.u32 = ++gUniqueIds;
207 MHEG5linkEventName(eventInfo->link),
208 MHEG5streamEventNotifyCallback,
209 eventInfo->unique.ptr, &eventInfo->eventHandle) == FS_STATUS_OK)
211 TRACE(TSTRM, (
"dsmcc EventSubscribe OK, id=%p evHl=%p", eventInfo->unique.ptr, eventInfo->eventHandle))
213 eventInfo->next = event_info_list;
214 event_info_list = eventInfo;
218 TRACE(TERROR, (
"evtInfo=0x%x", eventInfo))
219 MHEG5freeMem(eventInfo);
236 link = activeLinksHead[MHEG5STREAMEVENT];
239 if ((link->source == stream->ingredient.root.id) &&
240 ((stream->ingredient.root.grp == link->sourcegid.ptr.group) ||
241 ((link->sourcegid.len != 0) &&
MHEG5sameGroup(stream->ingredient.root.grp, link->sourcegid))))
243 if (stream->dsmRef != 0)
245 StreamEventSubscribe( link, stream );
249 link = link->nextActiveLink;
264 eventInfo = event_info_list;
265 while (eventInfo != NULL)
267 if (eventInfo->stream == stream)
270 TRACE(TSTRM, (
" FREE evtInfo=0x%x evHl=%p", eventInfo, eventInfo->eventHandle))
271 FreeFromEventList(eventInfo);
276 eventInfo = eventInfo->next;
291 for (ndx = 0; ndx != MAX_STREAMS; ndx++)
293 if (stream_array[ndx] != NULL)
295 pStream = stream_array[ndx];
296 if (link->source == pStream->ingredient.root.id)
298 if ((pStream->ingredient.root.grp == link->sourcegid.ptr.group) ||
299 ((link->sourcegid.len != 0) &&
MHEG5sameGroup(pStream->ingredient.root.grp, link->sourcegid)))
319 if (stream->dsmClearFunc)
322 stream->dsmClearFunc( stream->dsmRef );
324 stream->dsmClearFunc = NULL;
325 stream->dsmRef = NULL;
341 for (ndx = 0; ndx != MAX_STREAMS; ndx++)
343 if (stream_array[ndx] == NULL)
345 stream_array[ndx] = stream;
349 assert( ndx != MAX_STREAMS );
366 UnsubscribeActive(stream);
368 for (ndx = 0; ndx != MAX_STREAMS; ndx++)
370 if (stream_array[ndx] == stream)
372 stream_array[ndx] = NULL;
376 assert( stream->dsmRef == NULL || ndx != MAX_STREAMS );
378 MHEG5streamClear( stream );
391 for (ndx = 0; ndx != MAX_STREAMS; ndx++)
393 if (stream_array[ndx] != NULL)
395 TRACE(TSTRM, (
"name=%s", stream_array[ndx]->ingredient.content.ref.referenced.reference.data))
398 memset(&(stream_array[ndx]->dvbLocator), 0,
sizeof(
S_DVB_LOCATOR));
400 if (stream_array[ndx]->dsmRef)
402 stream_array[ndx]->reloading = MHEG5TRUE;
404 MHEG5streamClear( stream_array[ndx] );
418 for (ndx = 0; ndx != MAX_STREAMS; ndx++)
420 if (stream_array[ndx] != NULL)
422 TRACE(TSTRM, (
"name=%s", stream_array[ndx]->ingredient.content.ref.referenced.reference.data))
423 assert( stream_array[ndx]->dsmRef == NULL );
424 if (stream_array[ndx]->ingredient.contentHook == CHOOK_STREAM_NORMAL)
426 stream_array[ndx]->reloading = MHEG5TRUE;
444 if (stream->dsmRef &&
445 stream->ingredient.root.runningStatus)
448 SubscribeActive(stream);
450 stream->reloading = FALSE;
466 SubscribeActive(stream);
483 UnsubscribeActive(stream);
498 stream = FindEventSource(link);
502 TRACE(TSTRM, (
" lnk=%d sir=%x, sio=%x", link->ingredient.root.id,
503 stream->ingredient.root.runningStatus, stream->dsmRef))
505 if (stream->ingredient.root.runningStatus &&
508 StreamEventSubscribe( link, stream );
524 eventInfo = event_info_list;
525 while (eventInfo != NULL)
527 if (eventInfo->link == link)
529 TRACE(TSTRM, (
" FREE evtInfo=0x%x evHl=%p", eventInfo, eventInfo->eventHandle))
530 FreeFromEventList(eventInfo);
533 eventInfo = eventInfo->next;
E_MhegErr VQ_PutMsg(S_MhegMessage *pMsg, E_PRIORITY priority)
Post event or section message on queue. Copies data into queue.
MHEG5Bool MHEG5sameGroup(MH5GroupPtr gptr, MH5GroupRef gref)
Compares group ptr with group ref to see whether they both reference the same group. The first is pointer to group, the second can be a relative group name and will be converted to absolute prior to the comparison, so two different references that resolve to reference the same group name produces a True return value.
Interface functions to DSM-CC instance for MHEG5.
void MHEG5AppendActionList(MHEG5ActionList actions)
The supplied list of actions should execute after any already on queue.
void MHEG5notifyLinkInactive(MHEG5Link *link)
Notify that a link has become inactive.
Stream event subscription management.
void * MHEG5_DsmccInstance(void)
Get the DSMCC instance handle.
void MHEG5ingredientContentPrepare(MHEG5Ingredient *ingredient)
Implementation of the ContentPrepare behaviour COR.1 6.6: ContentPreparation Apply the following sequ...
void MHEG5streamReloadAll(void)
Load and Subscribe all stream events.
void(* F_MSG_PROCESS)(void *data)
Function to Process voyager message.
void MHEG5notifyLinkActive(MHEG5Link *link)
Notify that a link is active.
This file provides the control interface for MHEG5 engine. The use of this component MUST comply with...
This file defines the profile for the MHEG engine.
Implement Functions to support Service Gateways. Functions for standarizing several GroupIDs like +DS...
void MHEG5notifyStreamStopped(MHEG5Stream *stream)
Notify that a stream has stopped.
Event handling. Implementation of a combined queue for events and actions. This is the eventsystem wh...
Implement functions to retrieve MHEG5objects by GroupID and ID.
void MHEG5refreshStreamObject(MHEG5Stream *stream)
Refresh the DSM-CC Stream Object for a given MHEG-5 Stream Object.
void MHEG5streamUnloadAll(void)
Unsubscribe and unload all stream events.
void MHEG5streamRemove(MHEG5Stream *stream)
Remove an MHEG-5 Stream Object from repository.
void MHEG5notifyStreamRunning(MHEG5Stream *stream)
Notify that a stream is running.
Functions relating to Hybrid file system.
void MHEG5streamAdd(MHEG5Stream *stream)
Add an MHEG-5 Stream Object to repository.