long win_mp_subtitle_init_data() { long ret = -1; long number; long current_language_index; UINT16 lst_top,list_cnt; UINT8 sel_lang = 0xFF; if (!subtitle_handle) { return -1; } if(g_ext_subtitle_plugin) ret = g_ext_subtitle_plugin->mps_query_language(subtitle_handle, &number, ¤t_language_index, NULL, NULL); if (ret < 0) { return -1; } list_cnt = number; OSD_SetListCount(&g_ls_subtitle, list_cnt); OSD_SetListCurPos(&g_ls_subtitle, current_language_index); OSD_SetListTop(&g_ls_subtitle, current_language_index); OSD_SetListVerScrollBar(&g_ls_subtitle, &g_sb_subtitle); lst_top = OSD_GetListTopPoint(&g_ls_subtitle); ret = win_mp_subtitle_read_page(lst_top); return ret; }
long win_mp_subtitle_read_page(UINT8 top) { long i, j; long ret = -1; long number; long current_language_index; char description[201] = {0}; long description_len; char *temp; if (!subtitle_handle) { return -1; } number = 0; description_len = 200; if(g_ext_subtitle_plugin) ret = g_ext_subtitle_plugin->mps_query_language(subtitle_handle, &number, ¤t_language_index, description, &description_len); if (ret < 0) { return -1; } if(top > number) { top = 0; OSD_SetListCurPos(&g_ls_subtitle,0); OSD_SetListTop(&g_ls_subtitle,0); } for(i = 0;i < SUBTITLE_ITEM_NUMBER;i++) { if((top+i) < number) { temp = description + (top+i)*4; Subtitle_track_str[i][0]=temp[0]; Subtitle_track_str[i][1]=temp[1]; Subtitle_track_str[i][2]=temp[2]; Subtitle_track_str[i][3]=0; Subtitle_track_str[i][4]=0; Subtitle_track_str[i][5]=0; Subtitle_track_str[i][6]=0; ComUniStrToMB(Subtitle_track_str[i]); win_com_set_idx_str(top+i, Subtitle_track_idx[i], 2); } else { Subtitle_track_idx[i][0]=0; Subtitle_track_str[i][0]=0; } } return 1; }
/***************************************************** Interface : void ListChapterInfoInit(); Function : init chapter list Author : Wu Jianwen Date : 2010.8.25 Input : NONE Output : NONE Return : NONE ******************************************************/ void ListChapterInfoInit() { UINT16 top; UINT32 i_TotalChapter = 0; //the total chapter of the video INT32 i_DestChapter = 0; //dest chapter num INT32 i_CurChapter = 1; //current chapter num DEC_CHAPTER_INFO t_ChapterInfo; //save chapter info of the stream MEMSET(&t_ChapterInfo,0,sizeof(DEC_CHAPTER_INFO)); t_ChapterInfo.dst_chapter = -1; MpgFileGetChapterInfo(&t_ChapterInfo); //get the current chapter info i_CurChapter = t_ChapterInfo.cur_chapter; //begin with chapter i_TotalChapter = t_ChapterInfo.nb_chapter; OSD_SetListCount(&g_ls_chapter, i_TotalChapter); OSD_SetListCurPos(&g_ls_chapter, i_CurChapter); OSD_SetListTop(&g_ls_chapter, i_CurChapter); OSD_SetListVerScrollBar(&g_ls_chapter, &g_sb_chapter); top = OSD_GetListTopPoint(&g_ls_chapter); GetListChapterInfo(top); }
void win_subtitle_init_data() { P_NODE p_node; UINT16 lst_top,list_cnt; UINT8 sel_lang = 0xFF; SYSTEM_DATA* sys_data = sys_data_get(); TTXEng_GetSubtLang(&ttx_sub_lang_list, &g_win_ttx_subtitle_count); subt_get_language(&sub_lang_list, &g_win_subtitle_count); list_cnt = (g_win_subtitle_count + g_win_ttx_subtitle_count + 1); OSD_SetListCount(&g_ls_subtitle, list_cnt); if(sys_data->osd_set.subtitle_display == 0)/*subtitle off,select the last item*/ { OSD_SetListCurPos(&g_ls_subtitle, (list_cnt - 1)); if(list_cnt > SUBTITLE_ITEM_NUMBER) OSD_SetListTop(&g_ls_subtitle, (list_cnt - SUBTITLE_ITEM_NUMBER)); else OSD_SetListTop(&g_ls_subtitle, 0); } else if(sys_data->osd_set.subtitle_lang == 0xFF)/*set_sub_lang_idx can only be set in subtitle pop-up*/ {/*if first init,or reset*/ sel_lang = 0xFF; #if (SUBTITLE_ON == 1) sel_lang = api_ttxsub_getlang(NULL,sub_lang_list,sys_data->lang.sub_lang,g_win_subtitle_count); if(sel_lang != 0xFF) { sel_lang = sel_lang + g_win_ttx_subtitle_count; }/*subtitle language select first*/ #endif #if (TTX_ON ==1) if(sel_lang == 0xFF) { sel_lang = api_ttxsub_getlang(ttx_sub_lang_list,NULL,sys_data->lang.sub_lang,g_win_ttx_subtitle_count); }/*if can not get subt lang_idx,to get ttx_subt lang_idx*/ #endif if(sel_lang != 0xFF)/*If sel_lang valid,set to corresponding item highlight*/ { OSD_SetListCurPoint(&g_ls_subtitle, sel_lang); //OSD_SetListTopPoint(&g_ls_subtitle, sel_lang); if(sel_lang > (SUBTITLE_ITEM_NUMBER - 1)) OSD_SetListTop(&g_ls_subtitle, (sel_lang - SUBTITLE_ITEM_NUMBER + 1)); else OSD_SetListTop(&g_ls_subtitle, 0); } else/*if sel_lang invalid,set to 0 position*/ { OSD_SetListCurPoint(&g_ls_subtitle, 0); OSD_SetListTopPoint(&g_ls_subtitle, 0); } } else { OSD_SetListCurPoint(&g_ls_subtitle, sys_data->osd_set.subtitle_lang); if(sys_data->osd_set.subtitle_lang > (SUBTITLE_ITEM_NUMBER - 1)) OSD_SetListTop(&g_ls_subtitle, (sys_data->osd_set.subtitle_lang - SUBTITLE_ITEM_NUMBER + 1)); else OSD_SetListTop(&g_ls_subtitle, 0); } OSD_SetListVerScrollBar(&g_ls_subtitle, &g_sb_subtitle); lst_top = OSD_GetListTopPoint(&g_ls_subtitle); win_subtitle_read_page(lst_top); }
void win_subtitle_read_page(UINT8 top) { UINT8 i,ttx_idx,subt_idx; struct t_subt_lang* p_lang; struct t_ttx_lang* p_ttx_lang; p_lang = sub_lang_list; p_ttx_lang = ttx_sub_lang_list; if(top > (g_win_ttx_subtitle_count + g_win_subtitle_count + 1)) { top = 0;/*if top value overflow,set it to zero*/ OSD_SetListCurPos(&g_ls_subtitle,0); OSD_SetListTop(&g_ls_subtitle,0); } for(i = 0;i < SUBTITLE_ITEM_NUMBER;i++) { if((top+i) < g_win_ttx_subtitle_count) { ttx_idx = (top + i); p_ttx_lang = (ttx_sub_lang_list + ttx_idx); Subtitle_track_str[i][0]=p_ttx_lang->lang[0]; Subtitle_track_str[i][1]=p_ttx_lang->lang[1]; Subtitle_track_str[i][2]=p_ttx_lang->lang[2]; Subtitle_track_str[i][3]='('; Subtitle_track_str[i][4]='T'; Subtitle_track_str[i][5]=')'; Subtitle_track_str[i][6]=0; ComUniStrToMB(Subtitle_track_str[i]); win_com_set_idx_str(top+i, Subtitle_track_idx[i],2); } else if((top+i) < (g_win_ttx_subtitle_count + g_win_subtitle_count)) { subt_idx = (top + i - g_win_ttx_subtitle_count); p_lang = (sub_lang_list + subt_idx); Subtitle_track_str[i][0]=p_lang->lang[0]; Subtitle_track_str[i][1]=p_lang->lang[1]; Subtitle_track_str[i][2]=p_lang->lang[2]; Subtitle_track_str[i][3]='('; Subtitle_track_str[i][4]='D'; Subtitle_track_str[i][5]=')'; Subtitle_track_str[i][6]=0; ComUniStrToMB(Subtitle_track_str[i]); win_com_set_idx_str(top+i, Subtitle_track_idx[i],2); } else if((top+i) == (g_win_ttx_subtitle_count + g_win_subtitle_count)) { Subtitle_track_str[i][0]='O'; Subtitle_track_str[i][1]='F'; Subtitle_track_str[i][2]='F'; Subtitle_track_str[i][3]=0; ComUniStrToMB(Subtitle_track_str[i]); Subtitle_track_idx[i][0]=0; } else { Subtitle_track_idx[i][0]=0; Subtitle_track_str[i][0]=0; } } }
/***************************************************** Interface : void GetListChapterInfo(UINT16 top); Function : set each item's display content of list Author : Wu Jianwen Date : 2010.8.25 Input : top:first item of list Output : NONE Return : NONE ******************************************************/ void GetListChapterInfo(INT16 top) { UINT8 len = 0; UINT8 i = 0; INT32 hh,mm,ss; //start time INT32 hh2,mm2,ss2; //end time UINT8 arr_DataTemp[50]; UINT8 back_saved; INT32 i_TotalChapter = 0; //the total chapter of the video INT32 i_CurChapStartTime = 0; //current chapter start time INT32 i_CurChapEndTime = 0; //current chapter end time INT32 i_DestChapStartTime = 0; //Dest chapter start time INT32 i_DestChapEndTime = 0; //Dest chapter end time INT32 i_DestChapter = 0; //dest chapter num INT32 i_CurChapter = 1; //current chapter num INT32 i_ChapterChange = 0; DEC_CHAPTER_INFO t_ChapterInfo; //save chapter info of the stream MEMSET(&t_ChapterInfo,0,sizeof(DEC_CHAPTER_INFO)); t_ChapterInfo.dst_chapter = -1; MpgFileGetChapterInfo(&t_ChapterInfo); //get the current chapter info i_CurChapter = t_ChapterInfo.cur_chapter; //begin with chapter i_TotalChapter = t_ChapterInfo.nb_chapter; if(i_TotalChapter > 1) //only chapter num > 1 can switch { if(top > i_TotalChapter) { top = 0; OSD_SetListCurPos(&g_ls_chapter,0); OSD_SetListTop(&g_ls_chapter,0); } i = 0; for(i = 0;i < CHAPTER_ITEM_NUMBER;i++) { i_ChapterChange = top + i; if(i_ChapterChange < i_TotalChapter) { i_DestChapter = i_ChapterChange; t_ChapterInfo.dst_chapter = i_DestChapter; MpgFileGetChapterInfo(&t_ChapterInfo); i_DestChapStartTime = t_ChapterInfo.dst_start_time / 1000; hh = i_DestChapStartTime / 3600; mm = (i_DestChapStartTime % 3600) / 60; ss = i_DestChapStartTime % 60; i_DestChapEndTime = t_ChapterInfo.dst_end_time / 1000; hh2 = i_DestChapEndTime / 3600; mm2 = (i_DestChapEndTime % 3600) / 60; ss2 = i_DestChapEndTime % 60; arr_DataTemp[0] = hh; arr_DataTemp[1] = mm; arr_DataTemp[2] = ss; arr_DataTemp[3] = hh2; arr_DataTemp[4] = mm2; arr_DataTemp[5] = ss2; win_com_set_idx_str2(arr_DataTemp, &Chapter_track_str[i][0],6); win_com_set_idx_str(top+i, Chapter_track_idx[i], 2); } else { //memset(&Chapter_track_idx[i],0,40); break; } } } else { win_compopup_init(WIN_POPUP_TYPE_SMSG); win_compopup_set_frame(MSG_POPUP_LAYER_L, MSG_POPUP_LAYER_T, MSG_POPUP_LAYER_W, MSG_POPUP_LAYER_H); win_compopup_set_msg_ext("There is only one chapter!",NULL,0); win_compopup_open_ext(&back_saved); osal_task_sleep(1500); win_compopup_smsg_restoreback(); } }