MHEG-5  19.3.0
MHEG-5 Documentation
glue_events.c
Go to the documentation of this file.
1 /*******************************************************************************
2  * Copyright © 2014 The DTVKit Open Software Foundation Ltd (www.dtvkit.org)
3  * Copyright © 2012 Ocean Blue Software Ltd
4  *
5  * This file is part of a DTVKit Software Component
6  * You are permitted to copy, modify or distribute this file subject to the terms
7  * of the DTVKit 1.0 Licence which can be found in licence.txt or at www.dtvkit.org
8  *
9  * THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
10  * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES
11  * OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
12  *
13  * If you or your organisation is not a member of DTVKit then you have access
14  * to this source code outside of the terms of the licence agreement
15  * and you are expected to delete this and any associated files immediately.
16  * Further information on DTVKit, membership and terms can be found at www.dtvkit.org
17  *******************************************************************************/
25 /*---includes for this file--------------------------------------------------*/
26 #include "stb_os.h"
27 
28 /* Component Control for sending events to component task */
29 #include "glue_queue.h"
30 #include "glue_main.h"
31 
32 /* String manipulation functions */
33 #include <string.h>
34 
35 /* Component memory managerment module */
36 #include "glue_memory.h"
37 
38 #include "glue_debug.h"
39 #include "mh5control.h"
40 #include "mh5keypress.h"
41 #include "mh5queue.h"
42 #include "mh5display.h"
43 #include "mh5fileorm.h"
44 #include "mh5prgs.h"
45 #ifdef INCLUDE_IC
46 #include "mh5misc.h"
47 #ifdef INCLUDE_ICS
48 #include "mh5streamer.h"
49 #endif
50 #endif
51 #include "glue_events.h"
52 
53 
54 /*---constant definitions for this file--------------------------------------*/
55 
56 
57 /*---local typedef structs for this file-------------------------------------*/
58 
59 /*---local (static) variable declarations for this file----------------------*/
60 
61 
62 /*---local function definitions----------------------------------------------*/
63 
64 static void NotifyDvpEvent( S_DvpEventType *params )
65 {
66  TRACE(TMHAPI, ("( %d, %d )", params->eType, params->eData))
67  switch (params->eType)
68  {
69  case DVB_EVENT_AUDIO_STARTED:
70  MHEG5notifyAudioStarted(FALSE);
71  break;
72 
73  case DVB_EVENT_AUDIO_STOPPED:
74  MHEG5notifyAudioStopped(FALSE);
75  break;
76 
77  case DVB_EVENT_SAMPLE_STARTED:
78  MHEG5notifyAudioStarted(TRUE);
79  break;
80 
81  case DVB_EVENT_SAMPLE_STOPPED:
82  MHEG5notifyAudioStopped(TRUE);
83  break;
84 
85  case DVB_EVENT_VIDEO_STARTED:
86  MHEG5notifyVideoStarted();
87  break;
88 
89  case DVB_EVENT_VIDEO_STOPPED:
90  MHEG5notifyVideoStopped();
91  break;
92 
93  case DVB_EVENT_DEMUX_PATH_CHANGE:
94  //MH5GlueSfmSetDemuxPath( (H_DmxRef)params->eData );
95  break;
96 
97  case DVB_EVENT_VIDEO_PREF_CHANGED:
98  MHEG5sendAppEngineEvent( EE_VIDEO_PREF_CHANGED );
99  break;
100 
101  case DVB_EVENT_NETWORK_STATUS_CHANGED:
102  #if defined(INCLUDE_IC)
103  MHEG5changedICStatus();
104  #endif
105  break;
106 
107  #if defined(INCLUDE_ICS)
108  case DVB_EVENT_GUIDANCE_RESPONSE:
109  MHEG5notifyGuidanceResponse(params->eData ? MHEG5TRUE : MHEG5FALSE);
110  break;
111 
112  case DVB_EVENT_STREAMING_READY:
114  break;
115 
116  case DVB_EVENT_SUBTITLE_PREF_CHANGED:
117  TRACE(TERROR, ("SUBTITLE_PREF_CHANGED"))
118  MHEG5sendAppEngineEvent( EE_SUBTITLE_PREF_CHANGED );
119  break;
120  #endif
121 
122  case DVB_EVENT_AUDIODESC_PREF_CHANGED:
123  #if defined(INCLUDE_ICS)
124  TRACE(TERROR, ("AUDIODESC_PREF_CHANGED"))
125  MHEG5sendAppEngineEvent( EE_AUDIO_DESC_PREF_CHANGED );
126  #endif
127  MHEG5RefreshDefaultAudio();
128  break;
129 
130  case DVB_EVENT_AUDIO_LANG_PREF_CHANGED:
131  TRACE(TERROR, ("AUDIO_LANG_PREF_CHANGED"))
132  MHEG5sendAppEngineEvent( EE_AUDIO_LANG_PREF_CHANGED );
133  MHEG5RefreshDefaultAudio();
134  break;
135 
136  case DVB_EVENT_SUBTITLE_LANG_PREF_CHANGED:
137  TRACE(TERROR, ("SUBTITLE_LANG_PREF_CHANGED"))
138  MHEG5sendAppEngineEvent( EE_SUBTITLE_LANG_PREF_CHANGED );
139  #ifdef INCLUDE_ICS
140  MHEG5StreamerRefresh(); /* Check if refresh is needed in IC Streamer */
141  #endif
142  break;
143 
144  case DVB_EVENT_PVR_RECORD_LIST_CHANGED:
145  #if defined(INCLUDE_MHEG_PVR) || defined(INCLUDE_PVR_AU)
146  MHEG5sendAppEngineEvent( EE_PVR_LIST_CHANGED );
147  #endif
148  break;
149 
150  case DVB_EVENT_PVR_BOOK_RESULT:
151  #if defined(INCLUDE_MHEG_PVR) || defined(INCLUDE_PVR_AU)
152  MHEG5NotifyBookingResult((E_MhegErr)params->eData );
153  #endif
154  break;
155 
156  case DVB_EVENT_APPLICATION_LAUNCH_STATUS:
157  #if defined(INCLUDE_CONNECTED_TV)
158  MHEG5notifyApplicationLaunchStatus((MHEG5Bool)params->eData);
159  #endif
160  break;
161 
162  #if defined(COMMON_INTERFACE)
163  case DVB_EVENT_CICAM_REMOVE:
164  MHEG5notifyCiCamRemove((U32BIT)params->eData);
165  break;
166  #endif
167 
168  default:
169  TRACE(TERROR, ("( %d, %d ) Unknown/Unsupported Event", params->eType, params->eData))
170  break;
171  }
172 }
173 
174 static void NotifyEngineEvent( E_ENGINE_EVENT *pEngineEvent )
175 {
176  MHEG5sendAppEngineEvent( *pEngineEvent );
177 }
178 
179 /*---global function definitions---------------------------------------------*/
180 
181 
189 E_MhegErr MHEG5_NotifyDvbEvent( E_DvbEvent eType, U32BIT eData )
190 {
191  MHEG5eventMessage_t event_msg;
192 
193  TRACE(TMHAPI, (""))
194 
195  /* better to pass event on regardless of whether API state is running,
196  * because
197  * if ( MH5GlueIsStarted() )
198  */
199  event_msg.proc_msg_func = (F_MSG_PROCESS)NotifyDvpEvent;
200  event_msg.data_type = DT_VALUE;
201  event_msg.data.dvpEvent.eType = eType;
202  event_msg.data.dvpEvent.eData = eData;
203  return VQ_PutMsg(&event_msg, PRTY_NORMAL);
204 }
205 
216 {
217  MHEG5_NotifyDvbEvent( DVB_EVENT_VIDEO_PREF_CHANGED, 0 );
218 }
219 
220 #if defined(INCLUDE_ICS)
221 
228 void MHEG5_NotifySubtitlePrefChanged(void)
229 {
230  MHEG5_NotifyDvbEvent( DVB_EVENT_SUBTITLE_PREF_CHANGED, 0 );
231 }
232 
240 void MHEG5_NotifyAudioDescPrefChanged(void)
241 {
242  MHEG5_NotifyDvbEvent( DVB_EVENT_AUDIODESC_PREF_CHANGED, 0 );
243 }
244 
257 void MHEG5_NotifyGuidanceResponse(BOOLEAN result)
258 {
259  MHEG5_NotifyDvbEvent( DVB_EVENT_GUIDANCE_RESPONSE, result );
260 }
261 
262 #endif /* INCLUDE_ICS */
263 
272 {
273  MHEG5_NotifyDvbEvent( DVB_EVENT_SUBTITLE_LANG_PREF_CHANGED, 0 );
274 }
275 
284 {
285  MHEG5_NotifyDvbEvent( DVB_EVENT_AUDIO_LANG_PREF_CHANGED, 0 );
286 }
287 
295 {
296  MHEG5_NotifyDvbEvent( DVB_EVENT_NETWORK_STATUS_CHANGED, 0 );
297 }
298 
307 {
308  MHEG5_NotifyDvbEvent( DVB_EVENT_VIDEO_STARTED, 0 );
309 }
310 
322 {
323  MHEG5_NotifyDvbEvent( DVB_EVENT_VIDEO_STOPPED, 0 );
324 }
325 
333 void MHEG5_NotifyAudioStarted(BOOLEAN isClip)
334 {
335  if (isClip)
336  {
337  MHEG5_NotifyDvbEvent( DVB_EVENT_SAMPLE_STARTED, 0 );
338  }
339  MHEG5_NotifyDvbEvent( DVB_EVENT_AUDIO_STARTED, 0 );
340 }
341 
350 void MHEG5_NotifyAudioStopped(BOOLEAN isClip)
351 {
352  if (isClip)
353  {
354  MHEG5_NotifyDvbEvent( DVB_EVENT_SAMPLE_STOPPED, 0 );
355  }
356  MHEG5_NotifyDvbEvent( DVB_EVENT_AUDIO_STOPPED, 0 );
357 }
358 
367 {
368  MHEG5_NotifyDvbEvent( DVB_EVENT_STREAMING_READY, 0 );
369 }
370 
371 
376 void MHEG5_SendEngineEvent( E_ENGINE_EVENT engineEvent )
377 {
378  S_MhegMessage msg;
379  msg.proc_msg_func = (F_MSG_PROCESS)NotifyEngineEvent;
380  msg.data_type = DT_VALUE;
381  msg.data.engineEvent = engineEvent;
382  if (VQ_PutMsg(&msg, PRTY_HIGH) != MHERR_OK)
383  {
384  TRACE(TERROR, (""))
385  }
386 }
387 
Implement MHEG5 engine control functions (i.e. start/stop etc)
void MHEG5_NotifyVideoStopped(void)
Notifies MHEG5 that the decoder has stopped playing a video stream In other words, no video is playing after this call. See MHEG5_SetVideoStream() and MHEG5_SetVideoControl(). This is a non-blocking function. If the decoder hardware does not support this indication, the DVB stack must simulate it.
Definition: glue_events.c:321
E_MhegErr VQ_PutMsg(S_MhegMessage *pMsg, E_PRIORITY priority)
Post event or section message on queue. Copies data into queue.
Definition: glue_queue.c:248
void MHEG5sendAppEngineEvent(E_ENGINE_EVENT engine_event)
Store an Engine event in the asynchronous event queue.
Definition: mh5queue.c:1633
void MHEG5_NotifyICSReady(void)
This function tells the MHEG-5 engine that the external application is ready to handle IP stream data...
Definition: glue_events.c:366
void MHEG5_NotifyVideoStarted(void)
Notifies the MHEG5 component that the previously provided video stream has started playing...
Definition: glue_events.c:306
Debug tracing.
MHEG5 queue.
Miscellaneous.
E_MhegErr MHEG5_NotifyDvbEvent(E_DvbEvent eType, U32BIT eData)
Notifies MHEG5 of event from receiver platform This is a non-blocking function.
Definition: glue_events.c:189
void MHEG5_SendEngineEvent(E_ENGINE_EVENT engineEvent)
Send MHEG app an engine event from an external task.
Definition: glue_events.c:376
void MHEG5_NotifyVideoPrefChanged(void)
Notifies the MHEG5 component when the video preferences change. This is a non-blocking function...
Definition: glue_events.c:215
void(* F_MSG_PROCESS)(void *data)
Function to Process voyager message.
Definition: glue_queue.h:70
Memory functions.
API for IC streamer.
Implementation of the resident programs which are defined by the current profile. ...
void MHEG5_NotifySubtitleLangPrefChanged(void)
Notifies the MHEG5 component when the subtitle language preferences change. This is a non-blocking fu...
Definition: glue_events.c:271
void MHEG5streamerNotifyStreamingReady(void)
Handle notification that the external application is ready to handle IP stream data.
Event handling. Implementation of a combined queue for events and actions. This is the eventsystem wh...
void MHEG5_NotifyICStatusChanged(void)
Notifies the MHEG5 component when the IC connection status changes. This is a non-blocking function...
Definition: glue_events.c:294
void MHEG5_NotifyAudioStopped(BOOLEAN isClip)
Notifies the MHEG5 component that the previously provided audio clip has completed playing all requir...
Definition: glue_events.c:350
File interface functions to DSMCC component.
void MHEG5StreamerRefresh(void)
Refresh any running IC streams - called when user preferences have changed.
void MHEG5NotifyBookingResult(E_MhegErr result)
This should be called, and only called, when DVB_MhegPvrMakeBooking() has previously returned with MH...
void MHEG5_NotifyAudioLangPrefChanged(void)
Notifies the MHEG5 component when the audio language preferences change. This is a non-blocking funct...
Definition: glue_events.c:283
Implement generic MHEG5-display functions - independent from the OSD These are generic functions used...
Key Press related functionality.
void MHEG5_NotifyAudioStarted(BOOLEAN isClip)
Notifies the MHEG5 component that the previously provided audio stream or clip has started playing...
Definition: glue_events.c:333
#define TRACE(t, x)
Definition: glue_debug.h:118
Header file - Function prototypes for operating system.