31 #include "dsm_client.h" 32 #include "dsm_control.h" 37 #ifdef MULTI_OSD_LANGS 51 #define DBC_ID_SSU 0x000A 52 #define DBC_ID_MHEG5 0x0106 53 #define DBC_ID_OAD 0x0111 54 #define DBC_ID_HBBTV 0x0123 55 #define DBC_ID_MHP0 0x00F0 56 #define DBC_ID_MHP1 0x00F1 58 #define MHEG_NETBOOT_DESC 0x01 59 #define MHEG_SERVICE_DESC 0x02 61 #define DBC_PREF_NONE 0x0000 62 #define DBC_PREF_MHEG5 0x0100 65 #define INVALID_ATAG 0xFFFF 66 #define LIFECYCLE_EVENT_ID 0xFFFF 67 #define INVALID_NB 0xFF 69 #define MAX_PATH_NAME_SIZE 65 71 #ifndef DSMCC_SECTION_CACHE_64K_BUFFERS 72 #define DSMCC_SECTION_CACHE_64K_BUFFERS 16 75 #ifndef DSMCC_WORKING_4K_BUFFER_POOL 76 #define DSMCC_WORKING_4K_BUFFER_POOL 180 78 #ifdef MULTI_OSD_LANGS 79 #define MAX_LANG_CODES 4 81 #define MAX_LANG_CODES 1 82 #define DVB_MhegOsdLanguageCodes MhegOsdLanguageCodes 108 static H_DsmControl dsmccControl = NULL;
109 static const S_STRING null_str = { 0, NULL };
113 static H_DsmEvent lifecycle_ehdl = 0;
114 static U32BIT boot_carousel_id = INVALID_CAROUSEL_ID;
115 static void *dbc_mutex = 0;
119 #ifndef MULTI_OSD_LANGS 122 U8BIT lang[4] = { 0, 0, 0, 0 };
125 *langcodes = (lang[0]<<16)|(lang[1]<<8)|lang[2];
135 while (sdbc != NULL && sdbc->
service_id != service_id)
145 DBGTRACE(TSERVICE,
"****> service_id=%d",service_id)
153 sdbc = FindServiceDbc( service_id );
161 sdbc->
next = service_dbcs;
165 return (H_PmtRef)sdbc;
178 while (app != NULL && app->
carouselId != carouselId)
199 app->
next = temp_apps;
243 static void ClearServiceDbcs(
void )
265 U8BIT nb_len = 0, *nb_ptr;
267 dptr_end = dptr + dlen;
268 while (dptr < dptr_end)
293 DBGTRACE(TERROR,
"Unknown Mheg tag 0x%x", tag);
304 static void LifecycleFunc(
void *userData,
U8BIT *name,
U32BIT dataLen,
U8BIT *dataPtr )
306 DBGTRACE(TALWAYS,
" ***************************** Rebooting! ")
325 if (lifecycle_ehdl != 0)
327 DBGTRACE(TSERVICE,
"clear Lifecycle")
328 DSMCC_ClientEventUnsubscribe(dsmccControl, lifecycle_ehdl);
333 static void StartLifecycle(
U16BIT atag )
336 if (lastatag != atag)
338 DBGTRACE(TSERVICE,
"clear Lifecycle atag=0x%x", lastatag)
341 if (lifecycle_ehdl == 0)
343 DBGTRACE(TSERVICE,
"Starting Lifecycle listen on atag=0x%x", atag)
345 LifecycleFunc, NULL, &lifecycle_ehdl ))
365 DBGTRACE(TERROR,
"No new application")
369 DBGTRACE(TSERVICE,
"updated application, LC-atag=0x%x nbact=%d nbver=%d oldapp=%p",
375 if (oldapp == NULL ||
388 DBGTRACE(TSERVICE,
"Send EE_NETWORK_BOOT_INFO")
397 static void ParsePmtFinished(H_PmtRef pmtref)
404 while (oldapp != NULL)
407 nxtapp = oldapp->
next;
411 DBGTRACE(TALWAYS,
" ***************************** Rebooting! ")
413 boot_carousel_id = INVALID_CAROUSEL_ID;
441 U8BIT *dptr_end, *dptr;
450 dptr_end = dptr + dbcLen;
451 dbcId = dptr[0] << 8 | dptr[1];
457 assert( dbc != NULL );
460 while (dptr < dptr_end)
462 appType = dptr[0] << 8 | dptr[1];
471 if (pref < boot_priority)
473 pref = boot_priority;
477 assert( newapp == NULL );
478 newapp = CreateDbcApp(
carouselId, (dbcId << 16) | appType);
485 DBGTRACE(TSERVICE,
"MHEG app type 0x%x (bp=%x)",appType,boot_priority)
486 ParseMhegDescriptors( newapp, dptr, app_len );
491 DBGTRACE(TERROR,
"Unsupported MHEG app type 0x%x", appType);
498 if (DSMCC_CurrentCarouselId(dsmccControl) ==
carouselId)
501 ProcessMhegDescriptorChange( oldapp, newapp );
512 DBGTRACE(TERROR,
"Unsupported Data Broadcast ID 0x%x", dbcId);
527 static U32BIT MH5GlueSiqCurrentApplicationId(
void)
532 id = DSMCC_CurrentCarouselId(dsmccControl);
536 app = FindDbcApp( sdbc,
id );
547 DBGTRACE(TSERVICE,
"appId=0x%x",
id)
562 carouselId = DSMCC_CurrentCarouselId(dsmccControl);
566 app = FindDbcApp( sdbc, carouselId );
569 DBGTRACE(TERROR,
"No app (%p) or no net boot desc", app)
596 DBGTRACE(TSERVICE,
"LC-atag=0x%x", atag)
605 StartLifecycle( atag );
609 static void CarouselLoadEvent( H_ObjCarousel carouselRef, E_OCLoadStatus status,
U32BIT carouselId )
612 DBGTRACE(TMHBOOT|TDSMFG,
" ( 0x%x, %d, 0x%x )", carouselRef, status, carouselId )
617 TRACE(TMHBOOT, (
"OC_LOAD_BOOTED"));
618 if (boot_carousel_id == INVALID_CAROUSEL_ID)
621 MH5GlueSiqNewBootCarousel( carouselId );
629 case OC_LOAD_ABORTED_TIMEOUT:
630 case OC_LOAD_ABORTED_PATH_ERROR:
631 case OC_LOAD_ABORTED_ERROR:
632 TRACE(TERROR, (
"OC_LOAD_ABORTED_... %d", status));
638 case OC_LOAD_COMPLETED:
639 TRACE(TMHBOOT, (
"OC_LOAD_COMPLETED"));
646 #ifdef INCLUDE_DSM_FG 647 case OC_FILE_GROUP_LIST_LOADED:
648 TRACE(TMHBOOT, (
"OC_FILE_GROUP_LIST_LOADED"));
655 case OC_FILE_GROUP_LIST_CHANGE:
656 TRACE(TMHBOOT, (
"OC_FILE_GROUP_LIST_CHANGE"));
663 case OC_FILE_GROUP_VERS_CHANGE:
664 TRACE(TMHBOOT, (
"OC_FILE_GROUP_VERS_CHANGE"));
672 case OC_LOAD_ABORTED_UNLOAD:
673 TRACE(TMHBOOT, (
"OC_LOAD_ABORTED_UNLOAD"));
674 if (boot_carousel_id == carouselId)
676 boot_carousel_id = INVALID_CAROUSEL_ID;
684 case OC_LOAD_IN_PROGRESS:
686 TRACE(TERROR, (
"Ignore status %d", status));
694 S_DsmccConfig config;
698 config.taskPriority = taskPriority - 1;
707 config.parsePmtInit = ParsePmtStartup;
708 config.parseDataBroadcastId = ParseDataBcastId;
709 config.parsePmtDone = ParsePmtFinished;
711 config.carouselLoad = CarouselLoadEvent;
713 config.notifyAitInfo = NULL;
714 config.obtainSiDirect =
FALSE;
717 if (dbc_mutex == NULL)
723 dsmccControl = DSMCC_Open( &config );
724 if (dsmccControl == NULL)
735 DSMCC_Close( dsmccControl );
751 DSMCC_Stop( dsmccControl, RST_MODE_FORCE );
765 DSMCC_Stop( dsmccControl, RST_MODE_PENDING );
770 DSMCC_Stop( dsmccControl, RST_MODE_FORCE );
783 static void AutobootClear(
void *
data )
791 U32BIT iso_639_language_code;
792 U8BIT langNum, number_languages;
793 U8BIT initial_object_length;
794 U8BIT *pathname = NULL;
796 TRACE(TMHBOOT, (
"lang code %x", languageCode))
798 number_languages = *
data++;
800 for (langNum = 0; langNum != number_languages && size > 4; langNum++)
804 iso_639_language_code = (
U32BIT)((iso_639_language_code << 8) |
data[1]);
805 iso_639_language_code = (
U32BIT)((iso_639_language_code << 8) |
data[2]);
809 if (size < initial_object_length)
813 if (iso_639_language_code == languageCode)
821 memcpy( pathname + 2,
data, initial_object_length );
823 pContent->
data = pathname;
824 pContent->
destroy = AutobootClear;
826 TRACE(TMHBOOT, (
"Found language %c%c%c path=%s",
data[-4],
data[-3],
data[-2], pathname))
831 data += initial_object_length;
832 size -= initial_object_length;
855 if (content->
data != NULL && content->
size > 4)
858 U8BIT langcode_num, id;
862 for (
id = 0;
id != langcode_num;
id++)
864 if (ParseServiceContext(content->
size, content->
data, langcodes[
id], &msg.
data.
content) != NULL)
878 TRACE(TERROR, (
"VQ_PutMsg failed"));
904 appId = MH5GlueSiqCurrentApplicationId();
905 if ((appId >> 16) != 0x0106)
908 TRACE(TMHBOOT, (
"Not MHEG data_broadcast_id 0x%x", (appId >> 16)))
917 LOAD_FLAGS_REQUEST_SERVICE_CONTEXT_BIT | LOAD_FLAGS_DEFAULT,
918 ServiceContextComplete, &dsmcontent );
919 TRACE(TFILE|TMHBOOT, (
"rtn=%d", retval))
922 pathcontent.
size = 0;
923 pathcontent.
data = NULL;
925 if (dsmcontent.
data != NULL && dsmcontent.
size > 4)
928 U8BIT langcode_num, id;
932 for (
id = 0;
id != langcode_num;
id++)
934 if (ParseServiceContext(dsmcontent.
size, dsmcontent.
data, langcodes[
id], &pathcontent) != NULL)
950 TRACE(TERROR, (
"retval is %d", retval));
958 DSMCC_Reboot( dsmccControl );
Implement MHEG5 engine control functions (i.e. start/stop etc)
void StopLifecycle(void)
Clear MHEG Lifecycle Event listening.
void MH5GlueDsmccStop(U8BIT action)
E_MhegErr VQ_PutMsg(S_MhegMessage *pMsg, E_PRIORITY priority)
Post event or section message on queue. Copies data into queue.
#define FUNCTION_FINISH(name)
void MHEG5engineStart(U8BIT *app_name, BOOLEAN isCi, BOOLEAN special)
Start the engine with the initial application.
#define MAX_PATH_NAME_SIZE
F_MSG_PROCESS proc_msg_func
S_STRING MH5GlueStringCreate(U32BIT size, U8BIT *data)
void MHEG5NotifyCarouselLoaded(S_DsmccEvent *param)
File acceleration for Australia and Souh Africa.
Interface functions to DSM-CC instance for MHEG5.
U16BIT MHEG5GetVideoSid(void)
void MHEG5RefreshStreams(U16BIT service_id)
void MH5GlueDsmccMHEGInitialBoot(void)
Causes the autoboot application to be launched. The component must be in the correct state (DSM-CC bo...
void FG_NotifyListChanged(S_DsmccEvent *param)
Tell File Group that File Groups have changed in Object Carousel's SRG User Info. ...
void STB_MemFree(void *ptr)
Releases previously allocated memory.
#define MHEG_SERVICE_DESC
void STB_OSDeleteMutex(void *mutex)
Delete a mutex.
unsigned char * STR_DataAlloc(unsigned int size)
void MH5GlueDsmccReboot(void)
void MHEG5NotifyCarouselBooted(S_DsmccEvent *param)
void MHEG5NotifyCarouselUnload(S_DsmccEvent *param)
struct s_service_dbc S_SERVICE_DBC
void MHEG5_SendEngineEvent(E_ENGINE_EVENT engineEvent)
Send MHEG app an engine event from an external task.
#define DSMCC_SECTION_CACHE_64K_BUFFERS
void MH5GlueStringFree(S_STRING *pStr)
U16BIT transport_stream_id
void(* F_MSG_PROCESS)(void *data)
Function to Process voyager message.
#define MHEG_NETBOOT_DESC
#define LIFECYCLE_EVENT_ID
DMXREF DVB_MhegGetDemuxPath(void)
Retrieve demux resource reference.
void MH5GlueDsmccClose(void)
E_MhegErr MHEG5_Reboot(void)
Reboots MHGE5 Engine This function has the same effect as calling these two: MHEG5_Stop( STOP_ACTION_...
DVB Service information functions are required by MHEG5 engine. All required functions should be non-...
void STB_OSMutexUnlock(void *mutex)
Unlock a mutex (a.k.a. 'leave', 'signal' or 'release')
void * MHEG5_DsmccInstance(void)
Get the DSMCC instance handle.
E_MhegErr MH5GlueDsmccOpen(U32BIT taskPriority)
void * STB_MemAlloc(U32BIT memSize)
Allocates the specified number of bytes.
void MHEG5StartReboot(void *dummy)
U16BIT MHEG5GetAudioSid(void)
void STR_DataFree(unsigned char *data, unsigned int size)
void MHEG5AutoPathComplete(E_FsStatus result)
Native language, reminder and banner functions for South Africa profile.
void * STB_OSCreateMutex(void)
Create a mutex.
Event handling. Implementation of a combined queue for events and actions. This is the eventsystem wh...
BOOLEAN MH5GlueSiqNetBootInfo(S_STRING *nbinfo)
Get current MHEG net boot info existance and nb info string.
#define ISO_639_LANG_CODE_UND
BOOLEAN MHEG5engineIsCiAppRunning(void)
struct s_dbc_app S_DBC_APP
struct s_service_dbc * next
#define DVB_MhegOsdLanguageCodes
File interface functions to DSMCC component.
void STB_OSMutexLock(void *mutex)
Lock a mutex (a.k.a. 'enter', 'wait' or 'get').
U16BIT MHEG5DefaultServiceId(void)
#define DSMCC_WORKING_4K_BUFFER_POOL
void MHEG5engineDsmTerminate(void)
Force the engine to terminate any DSM-CC based MHEG application.
U8BIT MhegOsdLanguageCodes(U32BIT *langcodes, U8BIT max)
void RunAutoboot(S_CONTENT *pContent)
References: [1] UK1 Profile - Digital Terrestrial Television - Requirements for interoperability (The...
Implement generic MHEG5-display functions - independent from the OSD These are generic functions used...
union s_mhg_message::@13 data
#define FUNCTION_START(name)
void FG_NotifyVersionChanged(S_DsmccEvent *param)
Tell File Group of version changed for File Group(s) in Object Carousel's SRG User Info...
void FG_NotifyListLoaded(S_DsmccEvent *param)
Tell File Group that File Groups have loaded in Object Carousel's SRG User Info.
E_MhegErr DVB_MhegGetOSDLanguage(U8BIT *language)
Return the language of the native UI (menu etc.) as a three character code as defined by ISO 639-2...
E_MhegErr MH5GlueDsmccStart(S_DVB_LOCATOR *pDvbLoc, U32BIT carouselId, BOOLEAN clear)
Header file - Function prototypes for operating system.