kb_machblue_client.c
上传用户:fy98168
上传日期:2015-06-26
资源大小:13771k
文件大小:42k
- //*****************************************************************************
- //FileName:kb_machblue_client.c
- //
- //Description:Machblue client.
- //
- //Author:steven
- //
- //Date: 2006.12.25
- //
- //Version: v1.0
- //*****************************************************************************
- #include "stdio.h"
- #include "string.h"
- #include "rckeymap.h"
- #include "epg.h"
- #include "av.h"
- #include "timer.h"
- #include "avplay.h"
- #include "StbMoviesInfo.h"
- #include "cas21.h"
- #include "demand.h"
- #include "kb_machblue_client.h"
- #include "machblue_client.h"
- #include "machblue_init.h"
- #include "machblue_porting_core.h"
- #include "kb_machblue_client_data.h"
- #include "kb_machblue_client_lc.h"
- #include "kb_machblue_client_task.h"
- #include "kb_movie.h"
-
- //steven
- static mb_gfx_ctx_t _kb_graphicsContext;
- static mb_client_t _kb_client;
- static mb_semaphore_t _kb_mStatusSem,g_kb_clientSem;
- static kb_movie_info_t g_kb_adv_swf;
- static kb_movie_struct_t _kb_currentMovie;
- static BOOL _kb_movieClear=TRUE;
- static kb_movie_play_bak_t _kb_playMovie;
- static UINT32 movieCloseTimer = 0xffffffff;
- static BOOL playFirst=FALSE;
- static unsigned char g_kb_movie_playStatus=kb_movie_closed;
- //wisco
- static kb_lc_attributes_t _kb_currentpAttribs;
- static BOOL _kb_secMovieFlag=FALSE;
- static kb_movie_name _kb_secMovieName;
- static char* prompt_message;
- static bool playPrgFlag=false;
- static int prePrgType=0,prePrgNo=1;
- static int _kb_nvod_flag = 0;// 1 NVOD 0 VIDEO OR AUDIO
- static UINT32 _kb_number_key_value = 0;
- static mb_semaphore_t g_kb_machblue_pcmStatus;
- static kb_movie_sound g_kb_machblue_pcmType=kb_movie_sound_cocacola;
- static BOOL g_kb_machblue_pcmFlag=false;
- static unsigned long g_kb_machblue_pcmDataHandle=0,g_kb_machblue_pcmSizeHandle=0;
- void kb_movie_playStatusSet(unsigned char status)
- {
- mb_semaphore_wait(_kb_mStatusSem);
- g_kb_movie_playStatus=status;
- mb_semaphore_signal(_kb_mStatusSem);
- }
- unsigned char kb_movie_playStatusGet(void)
- {
- unsigned char status;
-
- mb_semaphore_wait(_kb_mStatusSem);
- status=g_kb_movie_playStatus;
- mb_semaphore_signal(_kb_mStatusSem);
- return status;
- }
- static void Set_NVOD_Flag(int kb_nvod_flag)
- {
- _kb_nvod_flag = kb_nvod_flag;
- }
- static int Get_NVOD_Flag(void)
- {
- return _kb_nvod_flag;
- }
- /***
- A flash movie is playing on the screen, then play the ca inform flash movie.
- ***/
- void Play_CA_Inform()
- {
- kb_machblue_movie_close(TRUE);
- _kb_playMovie.name=kb_movie_ca_inform;
- _kb_playMovie.flag=TRUE;
- }
- /**
- * reset current movie information used by machblue client.
- * @return MB_SUCCESS, MB_FAILURE otherwise.
- */
- mb_error_t kb_machblue_movie_current_reset(void)
- {
- if(_kb_currentMovie.data!=NULL)
- mb_free(_kb_currentMovie.data);
-
- mb_memset(&_kb_currentMovie,0,sizeof(kb_movie_struct_t));
- //kb_movie_playStatusSet(kb_movie_closed);
-
- return MB_SUCCESS;
- }
- /**
- * play movie by machblue lib.
- * movie_name < movie name which to be activated >
-
- * @return MB_SUCCESS, MB_FAILURE otherwise.
- */
- mb_error_t kb_machblue_movie_play(kb_movie_name movie_name)
- {
- unsigned char *pData;
- unsigned long size;
- if(kb_movie_playStatusGet()!=kb_movie_closed)
- {
- mb_printf("nPlay movie error: some movie playing");
- return MB_FAILURE;
- }
- else
- kb_movie_playStatusSet(kb_movie_processing);
-
- //get movie data
- if(movie_name==kb_movie_adve_logo)
- {
- pData=(unsigned char*)KB_Swf_GetLogo(&size);
- }
- else if((movie_name==kb_movie_adve_realtime)||
- (movie_name==kb_movie_adve_alter))
- {
- pData=g_kb_adv_swf.pData;
- size=g_kb_adv_swf.size;
- }
- else
- {
- pData=(unsigned char*)KB_Swf_GetMenuByName(movie_name,&size);
- }
- _kb_currentMovie.info.name=movie_name;
- _kb_currentMovie.data=mb_malloc((mb_size_t)size);
- _kb_currentMovie.info.size=size;
- mb_memcpy(_kb_currentMovie.data,pData,size);
- //create movie
- if(mb_movie_create(&_kb_currentMovie.movie,_kb_currentMovie.data,_kb_currentMovie.info.size,NULL)!=MB_SUCCESS)
- {
- mb_printf("n[Machblue]:Client create movie error.");
- kb_movie_playStatusSet(kb_movie_closed);
- return MB_FAILURE;
- }
- //attach movie
- if(mb_movie_attach(_kb_currentMovie.movie,_kb_client,NULL)!=MB_SUCCESS)
- {
- mb_printf("n[Machblue]:Client attach movie error.");
- kb_movie_playStatusSet(kb_movie_closed);
- return MB_FAILURE;
- }
- mb_semaphore_wait(g_kb_clientSem);
- mb_printf("n[Machblue]:Client movie attached.");
- if(mb_movie_activate(_kb_currentMovie.movie,MB_AR_INITIAL,NULL)!=MB_SUCCESS)
- {
- mb_printf("n[Machblue]:Client activate movie error.");
- kb_movie_playStatusSet(kb_movie_closed);
- return MB_FAILURE;
- }
- mb_semaphore_wait(g_kb_clientSem);
- mb_printf("n[Machblue]:Client movie activated.");
- kb_movie_playStatusSet(kb_movie_playing);
-
- return MB_SUCCESS;
- }
-
- /**
- * delete movie by machblue lib and reset movie information,clear screen
- * @return MB_SUCCESS, MB_FAILURE otherwise.
- */
- mb_error_t kb_machblue_movie_delete(BOOL Menu_Exit)
- {
- static bool flag=false;
- if(mb_movie_delete(_kb_currentMovie.movie)!=MB_SUCCESS)
- {
- mb_printf("n[Machblue]:Client delete movie error.");
- return MB_FAILURE;
- }
- switch(_kb_currentMovie.info.name)
- {
- case kb_movie_menu_mail:
- TFCASTB_LeaveMailManager();
- break;
- case kb_movie_adve_logo:
- if(flag)
- {
- break;
- }
- else
- {
- KB_Machblue_PcmFlagSet(kb_movie_sound_cocacola,false);
-
- if((KB_DBGetPrgTotal(DTVPRG)!=0)&&(playFirst==FALSE))
- {
- printf("nKB play current program when power on.");
- KB_DTVPlayCurPrg();
- //kb_machblue_search_schedule();
- }
- else
- {
- //play main menu movie
- //kb_machblue_movie_play(kb_movie_menu_main);
- }
- flag=true;
- break;
- }
- case kb_movie_menu_search:
- case kb_movie_menu_searchAll:
- if(KB_DBGetPrgTotal(DTVPRG)!=0)
- {
- KB_DTVSetPrg(prePrgType,prePrgNo);
- STB_StateSwitch(State_AV);
- }
- break;
- case kb_movie_adve_realtime:
- mb_free(g_kb_adv_swf.pData);
- g_kb_adv_swf.pData=NULL;
- Kb_clearAderTimer();
- break;
- case kb_movie_menu_help:
- case kb_movie_menu_sys_info:
- case kb_movie_dbc_weather:
- case kb_movie_dbc_gov:
- if(KB_DBGetPrgTotal(DTVPRG)!=0)
- {
- KB_DTVSetPrg(prePrgType,prePrgNo);
- STB_StateSwitch(State_AV);
- //KB_DTVRunNextPrg(prePrgType);
- }
- if(!Menu_Exit)
- {
- if(_kb_secMovieName==kb_movie_menu_main)
- playPrgFlag=true;
- }
- break;
- default:
- break;
- }
-
- kb_machblue_movie_current_reset();
- KB_AVSetWindow(0, 0, 720, 576);
-
- //clear osd
- if(Menu_Exit)
- mb_surface_osd_clear();
-
- return MB_SUCCESS;
- }
- /**
- * close movie which playing.
- * @return MB_SUCCESS, MB_FAILURE otherwise.
- */
- mb_error_t kb_machblue_movie_close(BOOL Menu_Exit)
- {
- KB_TimerDisable(movieCloseTimer);
- if(kb_movie_playStatusGet()!=kb_movie_playing)
- {
- mb_printf("nClose movie error: no movie playing");
- return MB_FAILURE;
- }
- else
- kb_movie_playStatusSet(kb_movie_processing);
- _kb_movieClear=Menu_Exit;
- if(mb_movie_suspend(_kb_currentMovie.movie,MB_SR_SYSTEM)!=MB_SUCCESS)
- {
- mb_printf("n[Machblue]:Client suspend movie error.");
- kb_movie_playStatusSet(kb_movie_playing);
- return MB_FAILURE;
- }
- mb_semaphore_wait(g_kb_clientSem);
- mb_printf("n[Machblue]:Client movie suspended.");
- if(mb_movie_detach(_kb_currentMovie.movie)!= MB_SUCCESS)
- {
- mb_printf("n[Machblue]:Client detach movie error.");
- kb_movie_playStatusSet(kb_movie_playing);
- return MB_FAILURE;
- }
- mb_semaphore_wait(g_kb_clientSem);
- mb_printf("n[Machblue]:Client movie detached.");
- kb_movie_playStatusSet(kb_movie_closed);
- //if play the second movie
- if((Menu_Exit==FALSE)&&(_kb_secMovieFlag==FALSE))
- {
- _kb_secMovieFlag=TRUE;
- kb_machblue_movie_play(_kb_secMovieName);
- }
- if(_kb_playMovie.flag)
- {
- kb_machblue_movie_play(_kb_playMovie.name);
-
- if(_kb_currentMovie.info.name==kb_movie_menu_pf)
- KB_DTVGetEitPF();
- _kb_playMovie.flag=FALSE;
- }
- return MB_SUCCESS;
- }
- void kb_machblue_movieCloseAuto(void)
- {
- if(kb_movie_playStatusGet()==kb_movie_playing)
- {
- switch(_kb_currentMovie.info.name)
- {
- case kb_movie_menu_pf:
- case kb_movie_menu_volume:
- case kb_movie_menu_channle_no:
- case kb_movie_adve_logo:
- kb_machblue_movie_close(TRUE);
- break;
- default:
- break;
- }
- }
- }
- void kb_machblue_movieActivated(void)
- {
- unsigned char volume=15;
- BYTE mail_empty_num,mail_count;
- int r_pPrgType,r_pPrgNO,tv_pPrgType,tv_pPrgNO;
- KB_OSPMsgNode movie_msg;
- switch(_kb_currentMovie.info.name)
- {
- case kb_movie_menu_main:
- if(0)//(playPrgFlag)
- {
- if(KB_DBGetPrgTotal(DTVPRG)!=0)
- {
- KB_DTVSetPrg(prePrgType,prePrgNo);
- STB_StateSwitch(State_AV);
- KB_DTVRunNextPrg(prePrgType);
- }
- playPrgFlag=false;
- }
-
- if(Get_NVOD_Flag()==1)
- {
- Set_NVOD_Flag(0);
- STB_StateSwitch(State_AV);
- }
- break;
- case kb_movie_menu_mail:
- KB_MB_lc_Set_Mail_Type(mail_list);
- TFCASTB_EnterMailManager();
- TFCASTB_GetEmailSpaceInfo(&mail_count,&mail_empty_num);
- KB_MB_lc_2_movie_word_Post_Task(mail_count);
- break;
- case kb_movie_menu_pf:
- KB_TimerDisable(movieCloseTimer);
- KB_TimerEnable(movieCloseTimer, 10000);
- break;
- case kb_movie_menu_volume:
- case kb_movie_menu_volumeMute:
- KB_MB_lc_2_movie_Post_Task();
- break;
- case kb_movie_menu_popup:
- movie_msg.Word1= KB_MOVIE_PROMPT_TO_MOVIE;
- movie_msg.Word2=(unsigned long)prompt_message;
- kb_machblue_task_post(&movie_msg);
- break;
- case kb_movie_menu_nvod:
- Set_NVOD_Flag(1);
- if (State_AV != KB_GetCurState() && State_NVOD != KB_GetCurState())
- {
- KB_DTVStopAV();
- }
- STB_StateSwitch(State_NVOD);
- if (KB_DBGetNvodNum()>0)
- KB_NVODGetEit();
- else
- movie_msg.Word1 = KB_MOVIE_NVOD_TO_MOVIE;
- kb_machblue_task_post(&movie_msg);
- break;
- case kb_movie_menu_channle_no:
- KB_MB_lc_2_movie_word_Post_Task(_kb_number_key_value);
-
- KB_TimerDisable(movieCloseTimer);
- KB_TimerEnable(movieCloseTimer, 10000);
- break;
- case kb_movie_ca_inform:
- KB_DTVStopAV();
- KB_MB_lc_2_movie_Post_Task();
- break;
- case kb_movie_dbc_gov:
- KB_DTVGetPrg(&prePrgType,&prePrgNo);
- KB_DTVStopAV();
- kb_dbc_govCatalog();
- break;
-
- case kb_movie_dbc_weather:
- KB_DTVGetPrg(&prePrgType,&prePrgNo);
- KB_DTVStopAV();
- kb_weatherInit();
- break;
- case kb_movie_adve_logo:
- KB_Machblue_MpegSoundReSet();
- KB_Machblue_PcmFlagSet(kb_movie_sound_cocacola,true);
- KB_AVPlay(100,100,100);
- KB_DBGetPgmCurVol(&volume);
- KB_DTVSetVolume(volume);
- break;
- case kb_movie_menu_search:
- case kb_movie_menu_searchAll:
- case kb_movie_menu_help:
- KB_DTVGetPrg(&prePrgType,&prePrgNo);
- KB_DTVStopAV();
- break;
- case kb_movie_menu_sys_info:
- KB_DTVGetPrg(&prePrgType,&prePrgNo);
- KB_DTVStopAV();
- KB_MB_lc_2_movie_Post_Task();
- break;
- default:
- break;
- }
- }
- /**
- * client notify
- * machblue lib will send msg to client use this fun when complete some operation.
- * reason
- * args
- * client_data
-
- * @return MB_SUCCESS, MB_FAILURE otherwise.
- */
- mb_error_t kb_machblue_clientNotify(mb_notif_reason_t reason,mb_args_t *args,void *client_data)
- {
- KB_OSPMsgNode movie_msg;
- mb_lc_attributes_t *pAttribs;
- BOOL lcToMovie=FALSE;
-
- switch ( reason )
- {
- case MB_NR_MOVIE_ATTACHED:
- mb_semaphore_signal(g_kb_clientSem);
- break;
-
- case MB_NR_MOVIE_DETACHED:
- kb_machblue_movie_delete(_kb_movieClear);
- mb_semaphore_signal(g_kb_clientSem);
- break;
-
- case MB_NR_MOVIE_ACTIVATED:
- kb_machblue_movieActivated();
- mb_semaphore_signal(g_kb_clientSem);
- break;
-
- case MB_NR_MOVIE_SUSPENDED:
- mb_semaphore_signal(g_kb_clientSem);
- break;
-
- case MB_NR_LC_SEND_COMPLETE:
- #if MB_PLAYER_1_2
- mb_printf("n[Machblue]:Client notify lc send complete[%d].",MB_NR_LC_STATUS_ARG(args));
- #else
- mb_printf("n[Machblue]:Client notify lc send complete[%d].",MB_NR_LC_STATUS(args));
- #endif
- break;
-
- case MB_NR_LC_REQUEST:
- #if MB_PLAYER_1_2
- pAttribs=(mb_lc_attributes_t*)MB_NR_LC_ATTRIBUTES_ARG(args);
- #else
- pAttribs=(mb_lc_attributes_t*)MB_NR_LC_ATTRIBUTES(args);
- #endif
- //mb_memcpy(&_kb_currentpAttribs,pAttribs,sizeof(mb_lc_attributes_t));
- /*add by steven*/
- mb_memcpy((void*)_kb_currentpAttribs.connection,(void*)pAttribs->connection,30);
- mb_memcpy((void*)_kb_currentpAttribs.function,(void*)pAttribs->function,30);
- mb_memcpy((void*)_kb_currentpAttribs.parameters[lc_movie_name].name,(void*)pAttribs->parameters[lc_movie_name].name,5);
- mb_memcpy((void*)_kb_currentpAttribs.parameters[lc_movie_name].value,(void*)pAttribs->parameters[lc_movie_name].value,30);
- mb_memcpy((void*)_kb_currentpAttribs.parameters[lc_movie_type].name,(void*)pAttribs->parameters[lc_movie_type].name,5);
- mb_memcpy((void*)_kb_currentpAttribs.parameters[lc_movie_type].value,(void*)pAttribs->parameters[lc_movie_type].value,30);
- mb_memcpy((void*)_kb_currentpAttribs.parameters[lc_movie_lcName].name,(void*)pAttribs->parameters[lc_movie_lcName].name,5);
- mb_memcpy((void*)_kb_currentpAttribs.parameters[lc_movie_lcName].value,(void*)pAttribs->parameters[lc_movie_lcName].value,30);
- mb_memcpy((void*)_kb_currentpAttribs.parameters[lc_movie_funName].name,(void*)pAttribs->parameters[lc_movie_funName].name,5);
- mb_memcpy((void*)_kb_currentpAttribs.parameters[lc_movie_funName].value,(void*)pAttribs->parameters[lc_movie_funName].value,30);
- mb_memcpy((void*)_kb_currentpAttribs.parameters[lc_event_type].name,(void*)pAttribs->parameters[lc_event_type].name,5);
- mb_memcpy((void*)_kb_currentpAttribs.parameters[lc_event_type].value,(void*)pAttribs->parameters[lc_event_type].value,30);
- if((pAttribs->parameters[lc_data1].name!=NULL)&&(lcToMovie==FALSE))
- {
- mb_memcpy((void*)_kb_currentpAttribs.parameters[lc_data1].name,(void*)pAttribs->parameters[lc_data1].name,5);
- mb_memcpy((void*)_kb_currentpAttribs.parameters[lc_data1].value,(void*)pAttribs->parameters[lc_data1].value,30);
- }
- else
- lcToMovie=TRUE;
-
- if((pAttribs->parameters[lc_data2].name!=NULL)&&(lcToMovie==FALSE))
- {
- mb_memcpy((void*)_kb_currentpAttribs.parameters[lc_data2].name,(void*)pAttribs->parameters[lc_data2].name,5);
- mb_memcpy((void*)_kb_currentpAttribs.parameters[lc_data2].value,(void*)pAttribs->parameters[lc_data2].value,30);
- }
- else
- lcToMovie=TRUE;
-
- if((pAttribs->parameters[lc_data3].name!=NULL)&&(lcToMovie==FALSE))
- {
- mb_memcpy((void*)_kb_currentpAttribs.parameters[lc_data3].name,(void*)pAttribs->parameters[lc_data3].name,5);
- mb_memcpy((void*)_kb_currentpAttribs.parameters[lc_data3].value,(void*)pAttribs->parameters[lc_data3].value,30);
- }
- else
- lcToMovie=TRUE;
-
- if((pAttribs->parameters[lc_data4].name!=NULL)&&(lcToMovie==FALSE))
- {
- mb_memcpy((void*)_kb_currentpAttribs.parameters[lc_data4].name,(void*)pAttribs->parameters[lc_data4].name,5);
- mb_memcpy((void*)_kb_currentpAttribs.parameters[lc_data4].value,(void*)pAttribs->parameters[lc_data4].value,30);
- }
- else
- lcToMovie=TRUE;
-
- if((pAttribs->parameters[lc_data5].name!=NULL)&&(lcToMovie==FALSE))
- {
- mb_memcpy((void*)_kb_currentpAttribs.parameters[lc_data5].name,(void*)pAttribs->parameters[lc_data5].name,5);
- mb_memcpy((void*)_kb_currentpAttribs.parameters[lc_data5].value,(void*)pAttribs->parameters[lc_data5].value,30);
- }
- else
- lcToMovie=TRUE;
- if((pAttribs->parameters[lc_data6].name!=NULL)&&(lcToMovie==FALSE))
- {
- mb_memcpy((void*)_kb_currentpAttribs.parameters[lc_data6].name,(void*)pAttribs->parameters[lc_data6].name,5);
- mb_memcpy((void*)_kb_currentpAttribs.parameters[lc_data6].value,(void*)pAttribs->parameters[lc_data6].value,30);
- }
- else
- lcToMovie=TRUE;
-
- if((pAttribs->parameters[lc_data7].name!=NULL)&&(lcToMovie==FALSE))
- {
- mb_memcpy((void*)_kb_currentpAttribs.parameters[lc_data7].name,(void*)pAttribs->parameters[lc_data7].name,5);
- mb_memcpy((void*)_kb_currentpAttribs.parameters[lc_data7].value,(void*)pAttribs->parameters[lc_data7].value,30);
- }
- else
- lcToMovie=TRUE;
-
- if((pAttribs->parameters[lc_data8].name!=NULL)&&(lcToMovie==FALSE))
- {
- mb_memcpy((void*)_kb_currentpAttribs.parameters[lc_data8].name,(void*)pAttribs->parameters[lc_data8].name,5);
- mb_memcpy((void*)_kb_currentpAttribs.parameters[lc_data8].value,(void*)pAttribs->parameters[lc_data8].value,30);
- }
- else
- lcToMovie=TRUE;
-
- if((pAttribs->parameters[lc_data9].name!=NULL)&&(lcToMovie==FALSE))
- {
- mb_memcpy((void*)_kb_currentpAttribs.parameters[lc_data9].name,(void*)pAttribs->parameters[lc_data9].name,5);
- mb_memcpy((void*)_kb_currentpAttribs.parameters[lc_data9].value,(void*)pAttribs->parameters[lc_data9].value,30);
- }
- else
- lcToMovie=TRUE;
-
- /*add by steven end*/
-
- movie_msg.Word1=KB_MOVIE_LC_TO_CCODE;
- movie_msg.Word2=(long)&_kb_currentpAttribs;
- kb_machblue_task_post(&movie_msg);
- mb_printf("n[Machblue]:Client notify lc request.");
- break;
-
- case MB_NR_MOVIE_ABORT:
- mb_printf("n[Machblue]:Client notify movie abort.");
- break;
-
- default:
- mb_printf("n[Machblue]:Client notify unknown reason.");
- }
-
- return MB_SUCCESS;
- }
- void kb_machblue_movie_attrubutes_init(void)
- {
- _kb_currentpAttribs.connection=mb_malloc(30);
- _kb_currentpAttribs.function=mb_malloc(30);
- _kb_currentpAttribs.parameters[lc_movie_name].name=mb_malloc(5);
- _kb_currentpAttribs.parameters[lc_movie_name].value=mb_malloc(30);
- _kb_currentpAttribs.parameters[lc_movie_type].name=mb_malloc(5);
- _kb_currentpAttribs.parameters[lc_movie_type].value=mb_malloc(30);
- _kb_currentpAttribs.parameters[lc_movie_lcName].name=mb_malloc(5);
- _kb_currentpAttribs.parameters[lc_movie_lcName].value=mb_malloc(30);
- _kb_currentpAttribs.parameters[lc_movie_funName].name=mb_malloc(5);
- _kb_currentpAttribs.parameters[lc_movie_funName].value=mb_malloc(30);
- _kb_currentpAttribs.parameters[lc_event_type].name=mb_malloc(5);
- _kb_currentpAttribs.parameters[lc_event_type].value=mb_malloc(30);
- _kb_currentpAttribs.parameters[lc_data1].name=mb_malloc(5);
- _kb_currentpAttribs.parameters[lc_data1].value=mb_malloc(30);
- _kb_currentpAttribs.parameters[lc_data2].name=mb_malloc(5);
- _kb_currentpAttribs.parameters[lc_data2].value=mb_malloc(30);
- _kb_currentpAttribs.parameters[lc_data3].name=mb_malloc(5);
- _kb_currentpAttribs.parameters[lc_data3].value=mb_malloc(30);
- _kb_currentpAttribs.parameters[lc_data4].name=mb_malloc(5);
- _kb_currentpAttribs.parameters[lc_data4].value=mb_malloc(30);
- _kb_currentpAttribs.parameters[lc_data5].name=mb_malloc(5);
- _kb_currentpAttribs.parameters[lc_data5].value=mb_malloc(30);
- _kb_currentpAttribs.parameters[lc_data6].name=mb_malloc(5);
- _kb_currentpAttribs.parameters[lc_data6].value=mb_malloc(30);
- _kb_currentpAttribs.parameters[lc_data7].name=mb_malloc(5);
- _kb_currentpAttribs.parameters[lc_data7].value=mb_malloc(30);
- _kb_currentpAttribs.parameters[lc_data8].name=mb_malloc(5);
- _kb_currentpAttribs.parameters[lc_data8].value=mb_malloc(30);
- _kb_currentpAttribs.parameters[lc_data9].name=mb_malloc(5);
- _kb_currentpAttribs.parameters[lc_data9].value=mb_malloc(30);
- }
- /**
- * init movie information used by machblue client.
- * @return MB_SUCCESS, MB_FAILURE otherwise.
- */
- mb_error_t kb_machblue_movie_init(void)
- {
- kb_machblue_movie_current_reset();
- kb_machblue_movie_attrubutes_init();
- _kb_playMovie.flag=FALSE;
- _kb_playMovie.name=kb_movie_last;
-
- return MB_SUCCESS;
- }
- /**
- * init machblue client used by keybridge.
- */
- void kb_machblue_client_init(void)
- {
- mb_init_config_t playerConfig;
- mb_error_t ret;
- ret=mb_default_config_get(&playerConfig);
- if(ret!=MB_SUCCESS)
- {
- mb_printf("n[Machblue]:Client get default config error[%d].",ret);
- return;
- }
- playerConfig.registry.root_path[0]=' ';
- ret=mb_player_init(&playerConfig);
- if(ret!=MB_SUCCESS)
- {
- mb_printf("n[Machblue]:Client init player error[%d].",ret);
- return;
- }
-
// Create controle semaphore
- ret=mb_semaphore_create(&_kb_mStatusSem,1);
- if(ret!=MB_SUCCESS)
- {
- mb_printf("n[Machblue]:Client create operate semaphore error[%d].",ret);
- return;
- }
- ret=mb_semaphore_create(&g_kb_machblue_pcmStatus,1);
- if(ret!=MB_SUCCESS)
- {
- mb_printf("n[Machblue]:Client create pcm flag semaphore error[%d].",ret);
- return;
- }
- ret=mb_semaphore_create(&g_kb_clientSem,0);
- if(ret!=MB_SUCCESS)
- {
- mb_printf("n[Machblue]:Client create client semaphore error[%d].",ret);
- return;
- }
-
// Initiale the graphique contexte
- ret=mb_surface_graphics_init(&_kb_graphicsContext,NULL);
- if(ret!=MB_SUCCESS)
- {
- mb_printf("n[Machblue]:Client init graphics surface error[%d].",ret);
- return;
- }
-
// Create client (see client_api for more info)
- ret=mb_client_create(&_kb_client,&_kb_graphicsContext,NULL,kb_machblue_clientNotify);
- if (ret!=MB_SUCCESS)
- {
- mb_printf("n[Machblue]:Client create client error[%d].",ret);
- return;
- }
- ret=kb_machblue_movie_init();
- if(ret!=MB_SUCCESS)
- {
- mb_printf("n[Machblue]:Client init movies error[%d].",ret);
- return;
- }
- movieCloseTimer=KB_TimerCreate(KB_TIMER_REPEAT,(KB_TIMER_FUNC_POINTER)kb_machblue_movieCloseAuto,NULL);
- //play logo movie
- //kb_machblue_movie_play(kb_movie_adve_logo);
- kb_machblue_movie_play(kb_movie_adve_logo);
- KB_TimerDisable(movieCloseTimer);
- KB_TimerEnable(movieCloseTimer, 14000);
- }
- void number_key_operation(int number)
- {
- int proTotal = 0;
- _kb_number_key_value = number;
- proTotal = KB_DBGetPrgTotal(KB_DTVGetPrePrgType());
- if((number>0)&&(number<=proTotal))
- {
- kb_machblue_movie_play(kb_movie_menu_channle_no);
- }
- }
-
- /**
- * remoter event manager.
- * key < key pressed by remoter >
-
- * @return MB_SUCCESS, MB_FAILURE otherwise.
- */
- mb_error_t kb_machblue_key(rc_navKeyStroke_t key)
- {
- long keyValue;
- mb_event_t tEvent;
- mb_error_t ret;
- int pPrgType,pPrgNO;
- static int poweron=1;
- //--------------------
- //软开关机控制
- if(KB_SysPowerIsDown())
- {
- if(key!=rc_KeyPower)
- key=rc_KeyInvalid;
- }
-
- if(key== rc_KeyPower)
- {
- if(poweron==1)
- {
- KB_SystemShutDownNow();
- poweron=0;
- }
- else if(poweron==0)
- {
- KB_SystemSetUpNow();
- poweron=1;
- }
- }
- //软开关机控制
- //--------------------
- switch(key)
- {
-
- case rc_KeyNum0:
- case rc_KeyNum1:
- case rc_KeyNum2:
- case rc_KeyNum3:
- case rc_KeyNum4:
- case rc_KeyNum5:
- case rc_KeyNum6:
- case rc_KeyNum7:
- case rc_KeyNum8:
- case rc_KeyNum9:
- if(kb_movie_playStatusGet()==kb_movie_closed)
- {
- number_key_operation(key);
- return MB_SUCCESS;
- }
- else
- break;
-
- //play program list movie
- case rc_KeyOK:
- if(kb_movie_playStatusGet()==kb_movie_closed)
- {
- kb_machblue_movie_play(kb_movie_menu_video_list);
- return MB_SUCCESS;
- }
- else
- break;
- //play epg movie
- case rc_KeyGuide:
- if(kb_movie_playStatusGet()==kb_movie_closed)
- kb_machblue_movie_play(kb_movie_menu_epg);
- return MB_SUCCESS;
- //play menu movie
- case rc_KeyMenu:
- if(kb_movie_playStatusGet()==kb_movie_closed)
- {
- if(Get_NVOD_Flag()!=1)
- kb_machblue_movie_play(kb_movie_menu_main);
- else
- kb_machblue_movie_play(kb_movie_menu_nvod);
- }
- else if((kb_movie_playStatusGet()==kb_movie_playing)&&(
- _kb_currentMovie.info.name!=kb_movie_menu_main))
- {
- _kb_playMovie.name=kb_movie_menu_main;
- _kb_playMovie.flag=TRUE;
- kb_machblue_movie_close(TRUE);
- }
- return MB_SUCCESS;
- case rc_KeyExit:
- if(kb_movie_playStatusGet()==kb_movie_playing)
- {
- kb_machblue_movie_close(TRUE);
-
-
- }
- return MB_SUCCESS;
-
- case rc_KeyUp:
- if(kb_movie_playStatusGet()==kb_movie_closed)
- {
- if(Get_NVOD_Flag()!=1)
- {
- KB_DTVRunNextPrg(KB_DTVGetPrePrgType());
- kb_machblue_movie_play(kb_movie_menu_pf);
- //kb_machblue_movie_play(kb_movie_menu_pf);
- KB_DTVGetEitPF();
- }
- return MB_SUCCESS;
- }
- else if(kb_movie_playStatusGet()==kb_movie_playing)
- {
- if(_kb_currentMovie.info.name==kb_movie_menu_pf)
- {
- KB_DTVRunNextPrg(KB_DTVGetPrePrgType());
- KB_DTVGetEitPF();
- //KB_MB_lc_2_movie_Post_Task();
- KB_MB_lc_2_movie_word_Post_Task(0);
- KB_TimerDisable(movieCloseTimer);
- KB_TimerEnable(movieCloseTimer, 10000);
- return MB_SUCCESS;
- }
- else if((_kb_currentMovie.info.name==kb_movie_menu_popup)||
- ((_kb_currentMovie.info.name==kb_movie_adve_realtime)))
- {
- KB_DTVRunNextPrg(KB_DTVGetPrePrgType());
-
- kb_machblue_movie_close(TRUE);
- _kb_playMovie.name=kb_movie_menu_pf;
- _kb_playMovie.flag=TRUE;
- return MB_SUCCESS;
- }
- }
- else
- break;
-
- case rc_KeyDown:
- if(kb_movie_playStatusGet()==kb_movie_closed)
- {
- if(Get_NVOD_Flag()!=1)
- {
- KB_DTVRunPrePrg(KB_DTVGetPrePrgType());
- kb_machblue_movie_play(kb_movie_menu_pf);
- //kb_machblue_movie_play(kb_movie_menu_pf);
- KB_DTVGetEitPF();
- }
- return MB_SUCCESS;
- }
- else if(kb_movie_playStatusGet()==kb_movie_playing)
- {
- if(_kb_currentMovie.info.name==kb_movie_menu_pf)
- {
- KB_DTVRunPrePrg(KB_DTVGetPrePrgType());
- KB_DTVGetEitPF();
- //KB_MB_lc_2_movie_Post_Task();
- KB_MB_lc_2_movie_word_Post_Task(0);
- KB_TimerDisable(movieCloseTimer);
- KB_TimerEnable(movieCloseTimer, 10000);
- return MB_SUCCESS;
- }
- else if((_kb_currentMovie.info.name==kb_movie_menu_popup)||
- ((_kb_currentMovie.info.name==kb_movie_adve_realtime)))
- {
- KB_DTVRunPrePrg(KB_DTVGetPrePrgType());
-
- kb_machblue_movie_close(TRUE);
- _kb_playMovie.name=kb_movie_menu_pf;
- _kb_playMovie.flag=TRUE;
- return MB_SUCCESS;
- }
- }
- else
- break;
-
- case rc_KeyLeft:
- case rc_KeyVolMinus:
- if(kb_movie_playStatusGet()==kb_movie_closed)
- {
- INT32 volume=KB_DTVGetVolume();
- if(volume>0)
- {
- KB_DTVSetVolume((UINT8)(volume-1));
- }
- KB_DTVMute(FALSE);
- kb_machblue_movie_play(kb_movie_menu_volume);
- KB_TimerDisable(movieCloseTimer);
- KB_TimerEnable(movieCloseTimer, 10000);
- return MB_SUCCESS;
- }
- else if(kb_movie_playStatusGet()==kb_movie_playing)
- {
- if(_kb_currentMovie.info.name==kb_movie_menu_volume)
- {
- INT32 volume=KB_DTVGetVolume();
- if(volume>0)
- {
- KB_DTVSetVolume((UINT8)(volume-1));
- }
- KB_DTVMute(FALSE);
- KB_TimerDisable(movieCloseTimer);
- KB_TimerEnable(movieCloseTimer, 10000);
- KB_MB_lc_2_movie_Post_Task();
- return MB_SUCCESS;
- }
- else
- break;
-
- }
- case rc_KeyRight:
- case rc_KeyVolPlus:
- if(kb_movie_playStatusGet()==kb_movie_closed)
- {
- INT32 volume=KB_DTVGetVolume();
- if(volume<32)
- {
- KB_DTVSetVolume((UINT8)(volume+1));
- }
- KB_DTVMute(FALSE);
- kb_machblue_movie_play(kb_movie_menu_volume);
- KB_TimerDisable(movieCloseTimer);
- KB_TimerEnable(movieCloseTimer, 10000);
- return MB_SUCCESS;
- }
- else if(kb_movie_playStatusGet()==kb_movie_playing)
- {
- if(_kb_currentMovie.info.name==kb_movie_menu_volume)
- {
- INT32 volume=KB_DTVGetVolume();
- if(volume<32)
- {
- KB_DTVSetVolume((UINT8)(volume+1));
- }
- KB_DTVMute(FALSE);
- KB_TimerDisable(movieCloseTimer);
- KB_TimerEnable(movieCloseTimer, 10000);
- KB_MB_lc_2_movie_Post_Task();
- return MB_SUCCESS;
- }
- else
- break;
-
- }
- case rc_KeyMute:
- if(kb_movie_playStatusGet()==kb_movie_closed)
- {
- if(KB_DTVGetMuteFlag())
- {
- KB_DTVMute(FALSE);
- }
- else
- {
- KB_DTVMute(TRUE);
- }
- kb_machblue_movie_play(kb_movie_menu_volumeMute);
- KB_TimerDisable(movieCloseTimer);
- KB_TimerEnable(movieCloseTimer, 10000);
- return MB_SUCCESS;
- }
- else if(kb_movie_playStatusGet()==kb_movie_playing)
- {
- if(_kb_currentMovie.info.name==kb_movie_menu_volumeMute)
- {
- if(KB_DTVGetMuteFlag())
- {
- mb_printf("n[kb_machblue_key]the mute flag is true");
- KB_DTVMute(FALSE);
- }
- else
- {
- mb_printf("n[kb_machblue_key]the mute flag is false");
- KB_DTVMute(TRUE);
- }
- KB_TimerDisable(movieCloseTimer);
- KB_TimerEnable(movieCloseTimer, 10000);
- KB_MB_lc_2_movie_Post_Task();
- }
- return MB_SUCCESS;
- }
- break;
- case rc_KeyTrack:
- if(kb_movie_playStatusGet()==kb_movie_closed)
- {
- switch(KB_DTVGetTrack())
- {
- case LEFT_TRACK:
- KB_DTVSetTrack(RIGHT_TRACK);
- break;
- case RIGHT_TRACK:
- KB_DTVSetTrack(STEREO_TRACK);
- break;
- case STEREO_TRACK:
- KB_DTVSetTrack(LEFT_TRACK);
- break;
- default:
- KB_DTVSetTrack(LEFT_TRACK);
- break;
- }
- KB_DTVMute(FALSE);
- kb_machblue_movie_play(kb_movie_menu_volume);
- KB_TimerDisable(movieCloseTimer);
- KB_TimerEnable(movieCloseTimer, 10000);
- return MB_SUCCESS;
- }
- else if(kb_movie_playStatusGet()==kb_movie_playing)
- {
- if(_kb_currentMovie.info.name==kb_movie_menu_volume)
- {
- switch(KB_DTVGetTrack())
- {
- case LEFT_TRACK:
- KB_DTVSetTrack(RIGHT_TRACK);
- break;
- case RIGHT_TRACK:
- KB_DTVSetTrack(STEREO_TRACK);
- break;
- case STEREO_TRACK:
- KB_DTVSetTrack(LEFT_TRACK);
- break;
- default:
- KB_DTVSetTrack(LEFT_TRACK);
- break;
- }
- KB_DTVMute(FALSE);
- KB_TimerDisable(movieCloseTimer);
- KB_TimerEnable(movieCloseTimer, 10000);
- KB_MB_lc_2_movie_Post_Task();
- }
- return MB_SUCCESS;
- }
- break;
- case rc_KeyMail:
-
- return MB_SUCCESS;
- case rc_KeyNVOD:
- if(kb_movie_playStatusGet()==kb_movie_closed)
- kb_machblue_movie_play(kb_movie_menu_nvod);
- return MB_SUCCESS;
- case rc_KeyF1:
- if(kb_movie_playStatusGet()==kb_movie_closed)
- kb_machblue_movie_play(kb_movie_vote_voteMenu);
- return MB_SUCCESS;
- }
-
- //button used by machblue lib
- switch(key)
- {
- //number button
- case rc_KeyNum0:
- keyValue=0x30;
- break;
- case rc_KeyNum1:
- keyValue=0x31;
- break;
- case rc_KeyNum2:
- keyValue=0x32;
- break;
- case rc_KeyNum3:
- keyValue=0x33;
- break;
- case rc_KeyNum4:
- keyValue=0x34;
- break;
- case rc_KeyNum5:
- keyValue=0x35;
- break;
- case rc_KeyNum6:
- keyValue=0x36;
- break;
- case rc_KeyNum7:
- keyValue=0x37;
- break;
- case rc_KeyNum8:
- keyValue=0x38;
- break;
- case rc_KeyNum9:
- keyValue=0x39;
- break;
- //operate button
- case rc_KeyUp:
- keyValue=MB_KEY_UP;
- break;
- case rc_KeyDown:
- keyValue=MB_KEY_DOWN;
- break;
-
- case rc_KeyLeft:
- case rc_KeyVolMinus:
- keyValue=MB_KEY_LEFT;
- break;
- case rc_KeyRight:
- case rc_KeyVolPlus:
- keyValue=MB_KEY_RIGHT;
- break;
- case rc_KeyOK:
- keyValue=MB_KEY_SELECT;
- break;
- case rc_KeySwitch:
- case rc_KeyTrack:
- keyValue=MB_KEY_SHIFT;
- break;
-
- case rc_KeyReturn:
- case rc_KeyMute:
- keyValue=MB_KEY_ESCAPE;
- break;
- case rc_KeyBlue:
- keyValue=MB_KEY_INSERT;
- break;
- case rc_KeyYellow:
- keyValue = MB_KEY_DELETE;
- break;
- case rc_KeyRed:
- keyValue=MB_KEY_CONTROL;
- break;
-
- case rc_KeyGreen:
- keyValue=MB_KEY_CAPSLOCK;
- break;
- case rc_KeyPageUp:
- keyValue=MB_KEY_PAGE_UP;
- break;
- case rc_KeyPageDown:
- keyValue=MB_KEY_PAGE_DOWN;
- break;
-
- default:
- mb_printf("nkb_machblue_key unvalid key");
- return MB_FAILURE;
- }
- tEvent.type=MB_EVENT_KEY_DOWN;
- MB_ASCII_CODE_ARG(&tEvent)=keyValue;
- MB_KEY_CODE_ARG(&tEvent)=keyValue;
- //key press down
- if(kb_movie_playStatusGet()==kb_movie_playing)
- {
- ret=mb_movie_event_post(_kb_currentMovie.movie,&tEvent);
- if(ret!=MB_SUCCESS)
- {
- mb_printf("n[Machblue]:Client button down operation error.");
- return MB_FAILURE;
- }
- }
- //key pop up
- tEvent.type=MB_EVENT_KEY_UP;
- if(kb_movie_playStatusGet()==kb_movie_playing)
- {
- ret=mb_movie_event_post(_kb_currentMovie.movie,&tEvent);
- if(ret!=MB_SUCCESS)
- {
- mb_printf("n[Machblue]:Client button up operation error.");
- return MB_FAILURE;
- }
- }
- return MB_SUCCESS;
- }
- /**
- * Get machblue client graphics context.
- * @return pointer of graphics context.
- */
- mb_gfx_ctx_t *kb_machblue_getGraphicsContext(void)
- {
- return &_kb_graphicsContext;
- }
- /**
- * get current movie information.
- * @return None.
- */
- void kb_machblue_getCurMovieInfo(kb_movie_struct_t *current_movie)
- {
- *current_movie=_kb_currentMovie;
- }
- kb_movie_struct_t *kb_machblue_getCurrentMovie(void)
- {
- return &_kb_currentMovie;
- }
- /**
- * get movie data by information
- * pData < pointer to storage movie data >
- * pInfo < pointer of movie information >
-
- * @return MB_SUCCESS, MB_FAILURE otherwise.
- */
- mb_error_t kb_machblue_getMovieData(unsigned char *pData,kb_movie_info_t *pInfo)
- {
- mb_memcpy((void*)_kb_currentMovie.data,(const void*)pInfo->pData,(mb_size_t)_kb_currentMovie.info.size);
-
- return MB_SUCCESS;
- }
- kb_movie_name kb_machblue_getMovieName(unsigned char *pName)
- {
- kb_movie_name movieName=kb_movie_last;
- if(mb_strcmp((mb_char_t*)MOVIE_NAME_MENU_MAIN,(mb_char_t*)pName)==0)
- movieName=kb_movie_menu_main;
- else if(mb_strcmp((mb_char_t*)MOVIE_NAME_PGM_LIST,(mb_char_t*)pName)==0)
- movieName=kb_movie_menu_video_list;
- else if(mb_strcmp((mb_char_t*)MOVIE_NAME_MENU_NVOD,(mb_char_t*)pName)==0)
- movieName=kb_movie_menu_nvod;
- else if(mb_strcmp((mb_char_t*)MOVIE_NAME_MENU_EPG,(mb_char_t*)pName)==0)
- movieName=kb_movie_menu_epg;
- else if(mb_strcmp((mb_char_t*)MOVIE_NAME_MENU_SEARCH,(mb_char_t*)pName)==0)
- movieName=kb_movie_menu_search;
- else if(mb_strcmp((mb_char_t*)MOVIE_NAME_MENU_SEARCHALL,(mb_char_t*)pName)==0)
- movieName=kb_movie_menu_searchAll;
- else if(mb_strcmp((mb_char_t*)MOVIE_NAME_MENU_MAIL,(mb_char_t*)pName)==0)
- movieName=kb_movie_menu_mail;
- else if(mb_strcmp((mb_char_t*)MOVIE_NAME_SYS_INFO,(mb_char_t*)pName)==0)
- movieName=kb_movie_menu_sys_info;
- else if(mb_strcmp((mb_char_t*)MOVIE_NAME_SYS_INFO_HELP,(mb_char_t*)pName)==0)
- movieName=kb_movie_menu_help;
- else if(mb_strcmp((mb_char_t*)MOVIE_NAME_MENU_PF,(mb_char_t*)pName)==0)
- movieName=kb_movie_menu_pf;
- else if(mb_strcmp((mb_char_t*)MOVIE_NAME_SOUND,(mb_char_t*)pName)==0)
- movieName=kb_movie_menu_volume;
- else if(mb_strcmp((mb_char_t*)MOVIE_NAME_SOUND_MUTE,(mb_char_t*)pName)==0)
- movieName=kb_movie_menu_volumeMute;
- else if(mb_strcmp((mb_char_t*)MOVIE_NAME_MENU_PROMPT,(mb_char_t*)pName)==0)
- movieName=kb_movie_menu_popup;
- else if(mb_strcmp((mb_char_t*)MOVIE_NAME_DBC_WEATHER,(mb_char_t*)pName)==0)
- movieName=kb_movie_dbc_weather;
- else if(mb_strcmp((mb_char_t*)MOVIE_NAME_DBC_GOV_BULLETIN,(mb_char_t*)pName)==0)
- movieName=kb_movie_dbc_gov;
- else if(mb_strcmp((mb_char_t*)MOVIE_NAME_ADVE_LOGO,(mb_char_t*)pName)==0)
- movieName=kb_movie_adve_logo;
- else if(mb_strcmp((mb_char_t*)MOVIE_NAME_MENU_CHANNEL_NO,(mb_char_t*)pName)==0)
- movieName=kb_movie_menu_channle_no;
- else if(mb_strcmp((mb_char_t*)MOVIE_NAME_CA_INFORM,(mb_char_t*)pName)==0)
- movieName=kb_movie_ca_inform;
- else if(mb_strcmp((mb_char_t*)MOVIE_NAME_MENU_VOTE,(mb_char_t*)pName)==0)
- movieName=kb_movie_vote_voteMenu;
- return movieName;
- }
- /**
- * switch different menu movie
- * pAttribs < data of movie which will be switched >
- *
- * @return MB_SUCCESS, MB_FAILURE otherwise.
- */
- mb_error_t kb_machblue_switchMenuMovie(kb_lc_attributes_t *pAttribs)
- {
- kb_movie_name movieName=kb_movie_last;
- kb_movie_info_t *pInfo=NULL;
-
- if(pAttribs==NULL)
- {
- mb_printf("n[kb_machblue_switchMenuMovie]:Client menu operatioin attributes NULL.");
- return MB_FAILURE;
- }
-
- movieName=kb_machblue_getMovieName((unsigned char *)pAttribs->parameters[lc_data1].value);
- //mb_printf("n[machblue]kb_machblue_switchMenuMovie: aim moive name is %sn",(unsigned char *)pAttribs->parameters[lc_data1].value);
- /*
- if(movieName== kb_movie_menu_video_list)
- {
- int pro_total,pPrgType,pPrgNO;
-
- pro_total = KB_DBGetPrgTotal(DTVPRG);
- if (pro_total>0)
- {
- KB_DTVGetPrg(&pPrgType,&pPrgNO);
- if (pPrgType != DTVPRG)
- {
- mb_printf("nkb_machblue_switchMenuMovie play video");
- KB_DTVPlayPrg(DTVPRG, 1);
- playFirst=TRUE;
- }
- }
- else
- {
- kb_machblue_lc_menu_noRadioList(DTVPRG);
- return MB_SUCCESS;
- }
- }
- */
- _kb_secMovieName=movieName;
- _kb_secMovieFlag=FALSE;
-
- kb_machblue_movie_close(FALSE);
- return MB_SUCCESS;
- }
- //for test
- void kb_machblue_create_schedule(unsigned long serviceID)
- {
- unsigned long index;
- kb_movie_serviceList_t *pServList;
- pServList=kb_mb_service_list_get();
- KB_LoadDmdEnt();
- KB_DelOnTimeDmdEnt();
- //mb_printf("n************************************");
- //mb_printf("n[Machblue]kb_machblue_create_schedule");
- //mb_printf("n************************************");
- for(index=0;index<pServList->count;index++)
- {
- if(pServList->services[index].info.display_id==serviceID)
- {
- kb_mb_event_schedule_create(&pServList->services[index]);
- break;
- }
- }
- }
- void kb_machblue_search_schedule(void)
- {
- int pPrgType,pPrgNO;
- unsigned short tsID,serviceID;
- //printf("n$$$$$$$$$$$$$$$$$$$$$$$$$");
- //printf("nstart to search event");
- //printf("n$$$$$$$$$$$$$$$$$$$$$$$$$");
- STB_StateSwitch(State_EPG);
- KB_DTVGetCurPrgInfo(&tsID,&serviceID);
- KB_DTVGetPrg(&pPrgType,&pPrgNO);
- pPrgNO=KD_GetPrgInxByTsidSvcID(pPrgType,tsID,serviceID);
- KB_EPGGetPrgSCH(pPrgType,pPrgNO+1);
- }
- void KB_MENUTranslateMsg(KB_OSPMsgNode* pInMsg)
- {
- }
- bool kb_machblue_TSMovie2(KB_MovieInfoNode *pInfo)
- {
- unsigned short tsID=0,serviceID=0;
-
- mb_printf("n-------kb_machblue_TSMovie2-------");
- pInfo->st_MovieInfo.m_pData=mb_malloc((mb_size_t)pInfo->st_MovieInfo.m_nSize);
- if(kb_dc_getMovie(pInfo)==FALSE)
- {
- mb_printf("n[Machblue]:Client get movie adver data error.");
- mb_free(pInfo->st_MovieInfo.m_pData);
- return false;
- }
- if(KB_DTVGetCurPrgInfo(&tsID,&serviceID))
- {
- if(pInfo->st_MovieInfo.m_serviceID!=serviceID)
- {
- mb_free(pInfo->st_MovieInfo.m_pData);
- return false;
- }
- }
- g_kb_adv_swf.type=movie_adver;
- g_kb_adv_swf.size=pInfo->st_MovieInfo.m_nSize;
- g_kb_adv_swf.pData=pInfo->st_MovieInfo.m_pData;
- g_kb_adv_swf.para1=0;
- g_kb_adv_swf.para2=0;
- g_kb_adv_swf.valid=TRUE;
- g_kb_adv_swf.name=kb_movie_adve_realtime;
- if(kb_movie_playStatusGet()==kb_movie_closed)
- {
- if(pInfo->st_MovieInfo.m_cfgType==kb_dc_ser_alter)
- KB_Vote_SetServiceType(pInfo->st_MovieInfo.m_reserve1);
- //play current movie
- if(kb_machblue_movie_play(kb_movie_adve_realtime)!=MB_SUCCESS)
- {
- mb_free(pInfo->st_MovieInfo.m_pData);
- return false;
- }
- else
- return true;
- }
- else
- {
- mb_free(pInfo->st_MovieInfo.m_pData);
- return false;
- }
-
- }
- /*
- *函数名称:KB_Machblue_PcmFlagSet
- *
- *函数简介:设置PCM 开关标志
- *
- *输入参数:flag 设置的PCM 开关标志的值
- *
- *输出参数:无
- *
- *返 回 值:无
- */
- void KB_Machblue_PcmFlagSet(kb_movie_sound type,BOOL flag)
- {
- mb_semaphore_wait(g_kb_machblue_pcmStatus);
- g_kb_machblue_pcmType=type;
- g_kb_machblue_pcmFlag=flag;
- mb_semaphore_signal(g_kb_machblue_pcmStatus);
- }
- /*
- *函数名称:KB_Machblue_PcmFlagGet
- *
- *函数简介:获得PCM 开关标志
- *
- *输入参数:无
- *
- *输出参数:flag PCM 开关标志
- *
- *返 回 值:无
- */
- void KB_Machblue_PcmFlagGet(BOOL *flag)
- {
- mb_semaphore_wait(g_kb_machblue_pcmStatus);
- *flag=g_kb_machblue_pcmFlag;
- mb_semaphore_signal(g_kb_machblue_pcmStatus);
- }
- void KB_Machblue_MpegSoundReSet(void)
- {
- unsigned long logoSoundSize;
- unsigned char *logoSoundData;
- logoSoundData = (unsigned char *)KB_Swf_GetLogoSound (&logoSoundSize);
- *(unsigned char**)g_kb_machblue_pcmDataHandle=logoSoundData;
- *(unsigned long*)g_kb_machblue_pcmSizeHandle=logoSoundSize;
- }
- /*
- *函数名称:KB_Machblue_MpegSoundSet
- *
- *函数简介:设置MPEG 声音数据
- *
- *输入参数:无
- *
- *输出参数:pData 声音数据buffer
- * size 声音数据字节数
- *
- *返 回 值:无
- */
- void KB_Machblue_MpegSoundSet(unsigned char **pData,unsigned long *size)
- {
- mb_error_t ret;
-
- // Create pcm flag semaphore
- ret=mb_semaphore_create(&g_kb_machblue_pcmStatus,1);
- if(ret!=MB_SUCCESS)
- {
- mb_printf("n[Machblue]:Client create pcm flag semaphore error[%d].",ret);
- return;
- }
-
- g_kb_machblue_pcmDataHandle=(unsigned long)pData;
- g_kb_machblue_pcmSizeHandle=(unsigned long)size;
- }
- /***
- 在填加了swf 模块以后,所使用的影片播放接口
- ***/
- void kb_swf_test(unsigned char *p,unsigned long size)
- {
- g_kb_adv_swf.type=movie_adver;
- g_kb_adv_swf.size=size;
- g_kb_adv_swf.pData=p;
- g_kb_adv_swf.para1=0;
- g_kb_adv_swf.para2=0;
- g_kb_adv_swf.valid=TRUE;
- g_kb_adv_swf.name=kb_movie_adve_realtime;
- //play current movie
- if(kb_movie_playStatusGet()==kb_movie_closed)
- kb_machblue_movie_play(kb_movie_adve_realtime);
- else
- {
- _kb_playMovie.name=kb_movie_adve_realtime;
- _kb_playMovie.flag=TRUE;
- kb_machblue_movie_close(TRUE);
- }
- }
- void kb_machblue_alterAdvPlay(unsigned char flag)
- {
- switch(flag)
- {
- case 1:
- g_kb_adv_swf.size=movie_alter1_size;
- g_kb_adv_swf.pData=movie_alter1;
- break;
-
- case 2:
- g_kb_adv_swf.size=movie_alter2_size;
- g_kb_adv_swf.pData=movie_alter2;
- break;
-
- default:
- break;
- }
- g_kb_adv_swf.type=movie_adver;
- g_kb_adv_swf.para1=0;
- g_kb_adv_swf.para2=0;
- g_kb_adv_swf.valid=TRUE;
- g_kb_adv_swf.name=kb_movie_adve_alter;
- //play current movie
- if(kb_movie_playStatusGet()==kb_movie_closed)
- kb_machblue_movie_play(kb_movie_adve_alter);
- else if(kb_movie_playStatusGet()==kb_movie_playing)
- {
- _kb_playMovie.name=kb_movie_adve_alter;
- _kb_playMovie.flag=TRUE;
- kb_machblue_movie_close(TRUE);
- }
- }
- void kb_machblue_updatePlay(void)
- {
- //play current movie
- if(kb_movie_playStatusGet()==kb_movie_closed)
- kb_machblue_movie_play(kb_movie_swfUpdatePrompt);
- else if(kb_movie_playStatusGet()==kb_movie_playing)
- {
- _kb_playMovie.name=kb_movie_swfUpdatePrompt;
- _kb_playMovie.flag=TRUE;
- kb_machblue_movie_close(TRUE);
- }
- }
- /* EOF... */