コード例 #1
0
ファイル: dec_ctrl.c プロジェクト: alkap007/ali3606
//DWORD mpg_cmd_change_audio_track(INT32 *aud_pid);
DWORD mpg_cmd_change_prog (int prog_id)
{
	DWORD ret = AF_ERR_PE_FAIL;
    DEC_STREAM_INFO stream_info;
    INT32   ch0 = 0;
    ENTER_DEC_CMD();
    MpgFileGetStreamInfo(&stream_info);

    if(stream_info.ProgNum > 1)
    {
        if( stream_info.cur_prog_id > (MAX_PROG_TIME_NUM - 1) )     //Fix bug:mp ts change prog subtitle can not show.
            ASSERT(0);
        prog_time[stream_info.cur_prog_id] = MPGFileDecoderGetPlayTime();
        if(prog_id < stream_info.ProgNum)      
             ret = PEChangeProID(prog_id, prog_time[prog_id]);
    }
    LEAVE_DEC_CMD();

//    mpg_cmd_change_audio_track(&ch0);
    return ret;
}
コード例 #2
0
ファイル: win_youtube_player.c プロジェクト: alkap007/ali3606
static UINT32 get_video_total_time()
{
	UINT32 tot_time;
	int wait_time = 0;
	
	while( (!MPGFileDecoderGetPlayTime()) && (wait_time<555))
	{
		osal_task_sleep(2);
		++wait_time;
	}
	if (MPGGetTotalPlayTime() < 0)//not a legal time
	{
		tot_time = 0;
	}
	else
	{
		tot_time = (UINT32)MPGGetTotalPlayTime();
	}

	return tot_time;
}
コード例 #3
0
ファイル: win_youtube_player.c プロジェクト: alkap007/ali3606
static void PauseProc()
{
	api_stop_timer(&mpegYT_refresh_id);
	if ((MPEG_PAUSE == MPEGYTInfo.PlayState) || (MPEGYTInfo.PlayState == MPEG_STEP))
	{
        mpg_cmd_resume_proc();
		//mpg_cmd_play_proc();
		//MPEGYTInfo.PlayState = MPEG_PAUSE;
		MPEGYTInfo.PlayState = MPEG_STEP;
	}
	else if (MPEGYTInfo.PlayState != MPEG_STOP)
	{
		mpg_cmd_pause_proc();
		MPEGYTInfo.PlayState = MPEG_PAUSE;
	}
	MPEGYTInfo.PlaySpeed = 0;
	MPEGYTInfo.PlayTime = (UINT32)MPGFileDecoderGetPlayTime() + s_ytvideo_seektime;
	BarState.nPos = MPEGYTInfo.PlayTime;

	if (NORMAL_MOVING == BarState.State)
	{
		BarState.nCursor = BarState.nPos;
	}
}
コード例 #4
0
ファイル: dec_ctrl.c プロジェクト: alkap007/ali3606
BOOL SetCtrlCmd(DWORD msgCode, DWORD time)
{
    BOOL ret = TRUE;
    DEC_STREAM_INFO stream_info;
    ENTER_DEC_CMD();

    if(1)
    {
        switch(msgCode)
        {
            case V_KEY_PLAY:
                PENormalPly();
                break;
            case V_KEY_PAUSE:
                if(m_CurPlaystate == PEPauseStep)
                {
                    PEStepPly();
                }
                else
                {
                    PEPausePly();
                    //Delay for a while to show "Pause" OSD on PC version
                    DecoderSleep(100);
                }
                break;
            case V_KEY_FF: //FF
                PEFastForwardPly();
                break;
            case V_KEY_FB: //FB
                PEFastReversePly();
                break;
            case V_KEY_SLOW: //Slow
                PESlowPly();
                break;                
            case V_KEY_STOP:
                PEStopPly();
                break;
            case V_KEY_SEEK:
                PESeekPly(time);
                break;
            case V_KEY_CHGAUD:
                MpgFileGetStreamInfo(&stream_info);
                if(stream_info.AudioStreamNum)
                {
                    if(stream_info.cur_audio_stream_id < stream_info.AudioStreamNum)
                        ret = PEChangeAID(stream_info.cur_audio_stream_id+1);
                    else
                        ret = PEChangeAID(1);
                }
                if(ret == AF_ERR_PE_OK)
                    PESeekPly(MPGFileDecoderGetPlayTime());
                break;
        }
    }

    if(pDecFuncTable)
    {
        (*pDecFuncTable)[m_CurPlaystate][m_NxtPlaystate](&m_DecoderCtrl, m_CurPlaySpeed, m_SearchTime);
        ret = TRUE;
    }
    else
        ret = FALSE;
    
    LEAVE_DEC_CMD();
    return ret;
        
}
コード例 #5
0
ファイル: win_youtube_player.c プロジェクト: alkap007/ali3606
static PRESULT win_mpegYT_player_message_proc(POBJECT_HEAD pObj, UINT32 msg_type, UINT32 msg_code)
{
	PRESULT ret = PROC_LOOP;
	struct VDec_StatusInfo vdec_status;

	switch (msg_type)
	{
		case CTRL_MSG_SUBTYPE_CMD_STO:
			if(msg_code == USB_STATUS_OVER)
				do{}while(0);
			break;

	case CTRL_MSG_SUBTYPE_CMD_TIMEDISPLAYUPDATE:
    		//add on 2011-09-28 fixBUG42869
		//if(!b_vdec_support && !b_audio_yt_support)
		//{	
		//	StopProc();
		//	break;
		//}
		MPEGYTInfo.PlayTime = (UINT32)MPGFileDecoderGetPlayTime() + s_ytvideo_seektime;
		if(MPEGYTInfo.PlayTime >= MPEGYTInfo.TotalTime)
        {
		    BarState.nPos = MPEGYTInfo.TotalTime - 1;
			}
			else
            BarState.nPos = MPEGYTInfo.PlayTime;
        
		if (!m_HideWindow)
		{
			win_mpegYT_player_draw(TRUE);
		}
		break;
	case CTRL_MSG_SUBTYPE_STATUS_VIDEO_OVER: //video over
		#if 0
		vdec_io_control(dev_get_by_id(HLD_DEV_TYPE_DECV, 0), VDEC_IO_GET_STATUS, (UINT32)(&vdec_status));
		if(MPEG_FB != MPEGYTInfo.PlayState && MPEG_SB != MPEGYTInfo.PlayState && vdec_status.api_play_direction == VDEC_FORWARD)
	    {
    	    if((filelist_get_current_classifiedfile_count(MP_VIDEO)+1)<mpegYTlist_cnt)
    	    {
        	    mpegYTlist_idx = filelist_get_next_classifiedfile_index(MP_VIDEO, mpegYTlist_idx);
    	    }
			else
    	    {
                mpegYTlist_idx = (UINT16)(~0);
    	    }
	    }
        if(mpegYTlist_idx != (UINT16)(~0))
        {
				if(vdec_status.api_play_direction == VDEC_FORWARD)
				{
					libnet_download_abort(g_strf_cur_dl_rsrc);
					mpg_cmd_stop_proc();
				}
				MPEGYTInfo.PlayState = MPEG_STOP;
				api_stop_timer(&mpegYT_refresh_id);
				m_mpegYT_player_working = FALSE;
				MPEGYT_player_init();
				m_mpegYT_player_working = TRUE;
			}
			else
		    ret = PROC_LEAVE;
		#else
		if(MPEGYTInfo.PlayState == MPEG_FB)
		{
			MPEGYTInfo.PlayState = MPEG_STOP;
			PlayProc_yt();
		}
		else
		{
			ret = PROC_LEAVE;
		}
		#endif
		break;
	case CTRL_MSG_SUBTYPE_STATUS_TIMEOUT:	//mpegYT player display timer out
		if (!m_HideWindow)
		{
			win_mpegYT_player_draw(FALSE);
			if (BarState.State == CURSOR_MOVING)
			{
				SyncBarPosAndCursor(POS_TO_CUR);
			}
		}
		else
		{
			if (m_bSetVol_YT)//if the volume bar is showing
			{
				//ShowVolumeBar(FALSE);//Close the volume bar
			}
		}
		break;
	case CTRL_MSG_SUBTYPE_STATUS_VIDEO_DEC_ERR:
    	case CTRL_MSG_SUBTYPE_STATUS_PARSE_END:
    		s_is_in_parsing = 0;
           //	mpegYT_refresh_cnt = 0;
            MPEGYTInfo.TotalTime = get_video_total_time() + s_ytvideo_seektime;
            BarState.nRange = MPEGYTInfo.TotalTime;
           mpegYT_file_prompt(NULL, FALSE);
            //mpegYT_unsupport_detect(msg_code);
    #ifdef AV_DELAY_SUPPORT
			if(b_vdec_support && b_audio_yt_support)
			{
				SYSTEM_DATA *psys_data = sys_data_get();
	            if(psys_data->avset.avdelay_value > 500)
				    MpgSetAVSyncDelay(1, psys_data->avset.avdelay_value-500); //0:video; 1:audio.
	            else if(psys_data->avset.avdelay_value > 0 && psys_data->avset.avdelay_value < 500)
				    MpgSetAVSyncDelay(0, psys_data->avset.avdelay_value); //0:video; 1:audio.
			}
 	#endif		
    		break;
	}

	return ret;
}
コード例 #6
0
ファイル: win_youtube_player.c プロジェクト: alkap007/ali3606
static void win_mpegYT_player_draw_infor(void)
{
	BITMAP* bmp;
	TEXT_FIELD* txt;
	PROGRESS_BAR* bar;
	mpegYTplayer_bmp_t* bmp_desc;
	mpegYTplayer_txt_t* txt_desc;
	UINT32 i, hd_fulless;
	UINT16 icon;
	char string[30];
	UINT32 hh, mm, ss;
	UINT32 play_pos = 0;
	FileInfo file_node;
	char name_buffer[MAX_FILE_NAME_SIZE + 1];

	bmp = &mpegYT_player_bmp;
	txt = &mpegYT_player_text;
	bar = &mpegYT_player_bar;

	for (i = 0; i < MPEGYT_BMP_NUM; i++)
	{
		bmp_desc = &mpegYTplayer_bmps[i];
		icon = INVALID_ID;
		switch (bmp_desc->bmp_type)
		{
		case MPEGYT_BMP_STATIC:
			//icon = bmp_desc->icon;
			break;
		case MPEGYT_BMP_PLAY_RECORD:
			icon = bmp_desc->icon;
			break;
		case MPEGYT_BMP_PLAY_MODE:
			if (MPEGYTInfo.PlayState < sizeof(mpegplayer_yt_status_icons) / 2)
			{
				icon = mpegplayer_yt_status_icons[MPEGYTInfo.PlayState];
			}
			break;
		case MPEGYT_BMP_HDD_STATUS:
			/*			step_sectors =  (hdd_info.total_size - hdd_info.tms_size) / 5;
						if(step_sectors >0 )
						{
							hd_fulless = (hdd_info.rec_size + step_sectors/2) / step_sectors ;
							if(hd_fulless == 5)
								hd_fulless = 4;
							icon = MP_HDstatus_icons[4-hd_fulless];//hd_fulless -> 4-hd_fulles, show used space!
						}
			*/
			break;
		default:
			break;
		}


		OSD_SetBitmapContent(bmp, icon);
		OSD_SetRect(&bmp->head.frame, bmp_desc->left, bmp_desc->top, bmp_desc->width, bmp_desc->height);
		OSD_DrawObject( (OBJECT_HEAD*) bmp, C_UPDATE_ALL);
	}

	for (i = 0;i < MPEGYT_TXT_NUM;i++)
	{
		txt_desc = &mpegYTplayer_txts[i];

		OSD_SetTextFieldContent(txt, STRING_ANSI, (UINT32)"");

		switch (txt_desc->txt_type)
		{
		case MPEGYT_TXT_PLAY_NAME:
			//get_file_from_file_list(win_file_list[VIDEO_FILE_LIST], mpegYTlist_idx, &file_node);
			//filter_unkownfont_name(file_node.name, name_buffer);
			win_shorten_filename(entry_youtube->title,name_buffer);
			sprintf(name_buffer, "%s", name_buffer);
			OSD_SetTextFieldContent(txt, STRING_UTF8, (UINT32)name_buffer);
			break;
		case MPEGYT_TXT_DATE:
			//sprintf(string,"%02d/%02d",dt.month,dt.day);
			//STRCPY(string, "");
			sprintf(string, "%02d/%02d/%02d",
					entry_youtube->pub_date.year,
					entry_youtube->pub_date.month,
					entry_youtube->pub_date.day);
			OSD_SetTextFieldContent(txt, STRING_ANSI, (UINT32)string);
			break;
		case MPEGYT_TXT_TIME:
			//sprintf(string,"%02d:%02d",dt.hour,dt.min);
			STRCPY(string, "");
			OSD_SetTextFieldContent(txt, STRING_ANSI, (UINT32)string);
			break;
		case MPEGYT_TXT_PLAY_MODE:
			STRCPY(string, "");
			if (MPEGYTInfo.PlayState == MPEG_STOP)
			{
				sprintf(string, "%s", "Stop");
			}
			else if (MPEGYTInfo.PlayState == MPEG_PLAY)
			{
				sprintf(string, "%s", "Play");
			}
			else if (MPEGYTInfo.PlayState == MPEG_PAUSE)
			{
				sprintf(string, "%s", "Pause");
			}
			else if (MPEGYTInfo.PlayState == MPEG_FF || MPEGYTInfo.PlayState == MPEG_FB)
			{
				sprintf(string, "X%d", mpegYTspeed_steps[MPEGYTInfo.PlaySpeed]);
			}
			else if (MPEGYTInfo.PlayState == MPEG_SF || MPEGYTInfo.PlayState == MPEG_SB)
			{
				sprintf(string, "X1/%d", mpegYTspeed_steps[MPEGYTInfo.PlaySpeed]);
			}
			else if(MPEGYTInfo.PlayState == MPEG_STEP)
			{
				sprintf(string,"%s","Step");
			}
#ifdef SUPPORT_DIVX_CERT
            else if(MPEGYTInfo.PlayState == MPEG_RESUME_STOP)
            {
                sprintf(string,"%s","Stop");
            }
#endif
			OSD_SetTextFieldContent(txt, STRING_ANSI, (UINT32)string);
			break;
		case MPEGYT_TXT_PLAY_1ST_TIME:
			STRCPY(string, "");
			MPEGYTInfo.PlayTime = (UINT32)MPGFileDecoderGetPlayTime() + s_ytvideo_seektime;
            if (MPEGYTInfo.PlayState == MPEG_STOP)
                MPEGYTInfo.PlayTime = 0;
#if 1
			hh = MPEGYTInfo.PlayTime / 3600;
			mm = (MPEGYTInfo.PlayTime % 3600) / 60;
			ss = MPEGYTInfo.PlayTime % 60;
#else
			hh = entry_youtube->info->duration/3600;
			mm = (entry_youtube->info->duration % 3600) / 60;
			ss = entry_youtube->info->duration % 60;			
#endif
			sprintf(string, "%02d:%02d:%02d", hh, mm, ss);
			OSD_SetTextFieldContent(txt, STRING_ANSI, (UINT32)string);
			break;

		case MPEGYT_TXT_PLAY_2ND_TIME:
			STRCPY(string, "");
#if 0
			hh = MPEGYTInfo.TotalTime / 3600;
			mm = (MPEGYTInfo.TotalTime % 3600) / 60;
			ss = MPEGYTInfo.TotalTime % 60;
#else
			hh = entry_youtube->info->duration/3600;
			mm = (entry_youtube->info->duration % 3600) / 60;
			ss = entry_youtube->info->duration % 60;	
#endif
			sprintf(string, "%02d:%02d:%02d", hh, mm, ss);
			OSD_SetTextFieldContent(txt, STRING_ANSI, (UINT32)string);
			break;
		case MPEGYT_TXT_HDD_STATUS:
			/*step_sectors = (hdd_info.total_size - hdd_info.tms_size)/100;
			if(step_sectors >0 )
			{
				sprintf(string,"%d%%",(100 - (hdd_info.rec_size+ step_sectors/2 )/step_sectors));
			}
			else
			{
				STRCPY(string,"");
			}
			OSD_SetTextFieldContent(txt, STRING_ANSI, (UINT32)string);
			*/
			break;
		}

		OSD_SetRect(&txt->head.frame, txt_desc->left, txt_desc->top, txt_desc->width, txt_desc->height);
		txt->head.style.bShowIdx = txt_desc->shidx;
		OSD_DrawObject( (OBJECT_HEAD *)txt, C_UPDATE_ALL);
	}

	/* Draw progress bar */
	OSD_SetProgressBarPos(bar, 100);
	OSD_SetRect(&bar->head.frame, BAR_L, BAR_T, BAR_W, 24);
	bar->rcBar.uLeft 	= 2;
	bar->rcBar.uTop 		= 5;
	bar->rcBar.uWidth	= BAR_W - 4;
	bar->rcBar.uHeight 	= 14;//16 - 6;
	bar->wTickFg 		= WSTL_BAR_06;
	OSD_DrawObject((POBJECT_HEAD)bar, C_UPDATE_ALL);

	/* Draw play pos */
//    BarState.nPos = MPEGYTInfo.PlayTime;
	if (BarState.nRange)
	{
		play_pos = BarState.nPos * 100 / BarState.nRange;
	}
	OSD_SetRect(&bmp->head.frame, bar->head.frame.uLeft+6 + (bar->head.frame.uWidth-12)*play_pos / 100*OSD_GetProgressBarPos(bar) / 100 - POS_ICON_WIDTH / 2,
				bar->head.frame.uTop, POS_ICON_WIDTH, bar->head.frame.uHeight);
	OSD_SetBitmapContent(bmp, IM_PVR_DOT);
	OSD_DrawObject((POBJECT_HEAD)bmp, C_UPDATE_ALL);

	/* Draw play cursor */
	if (CURSOR_MOVING == BarState.State)
	{
		if (BarState.nRange)
		{
			play_pos = BarState.nCursor * 100 / BarState.nRange;
		}
		OSD_SetRect(&bmp->head.frame, bar->head.frame.uLeft + 6 + (bar->head.frame.uWidth-4)*play_pos / 100/**OSD_GetProgressBarPos(bar) / 100*/ - POS_ICON_WIDTH / 2,
		//OSD_SetRect(&bmp->head.frame, bar->head.frame.uLeft + 6 + (bar->head.frame.uWidth-4)*play_pos / 100*OSD_GetProgressBarPos(bar) / 100 - POS_ICON_WIDTH / 2,
					bar->head.frame.uTop, POS_ICON_WIDTH, bar->head.frame.uHeight);
		OSD_SetBitmapContent(bmp, IM_PVR_DOT_ORANGE);
		OSD_DrawObject((POBJECT_HEAD)bmp, C_UPDATE_ALL);
	}
}
コード例 #7
0
ファイル: win_chapter.c プロジェクト: alkap007/ali3606
/*****************************************************
Interface : static PRESULT chapter_con_callback(POBJECT_HEAD pObj, VEVENT event, UINT32 param1, UINT32 param2);
Function  : callback of chapter container
Author    : Wu Jianwen
Date      : 2010.8.25
Input     : 
Output    : NONE
Return    : 
******************************************************/
static PRESULT chapter_con_callback(POBJECT_HEAD pObj, VEVENT event, UINT32 param1, UINT32 param2)
{
	PRESULT ret = PROC_PASS;
	UINT8 i;
	UINT16 wait_time = 0;
	UINT8 unact = 0;
	INT32 i_DestChapter = 0;        //dest chapter num
	INT32 i_DestChapStartTime;
	DEC_CHAPTER_INFO t_ChapterInfo;    //save chapter info of the stream

	switch(event)
	{
	case EVN_MSG_GOT:
		if(param1 ==  CTRL_MSG_SUBTYPE_CMD_EXIT)
		{
			ret = PROC_LEAVE;
		}
#ifdef USB_MP_SUPPORT
		else if(param1 == CTRL_MSG_SUBTYPE_STATUS_VIDEO_OVER)
		{
			ret = PROC_LEAVE;
			ap_send_msg(CTRL_MSG_SUBTYPE_STATUS_VIDEO_OVER,0,TRUE);
		}
#endif
		break;

	case EVN_PRE_OPEN:
        api_set_deo_layer(0);
        api_inc_wnd_count();

		for(i=0;i<CHAPTER_ITEM_NUMBER;i++)
		{
			p_chapter_track_str[i]=Chapter_track_str[i];
			p_chapter_track_idx[i]=Chapter_track_idx[i];
		}
		ListChapterInfoInit();
		break;		
		
	case EVN_UNKNOWN_ACTION:
		unact = (VACTION)(param1>>16);
		if(VACT_ENTER == unact)
		{
			i_DestChapter = OSD_GetListCurPoint(&g_ls_chapter);  //get current chapter
			t_ChapterInfo.dst_chapter = i_DestChapter;
			MpgFileGetChapterInfo(&t_ChapterInfo);
			//i_DestChapStartTime = t_ChapterInfo.dst_start_time/1000;   //second
			i_DestChapStartTime = t_ChapterInfo.dst_start_time;   //ms
			if(t_ChapterInfo.dst_start_time > t_ChapterInfo.cur_start_time)  
			{
				//mpg_cmd_search_proc((DWORD)i_DestChapStartTime);
				mpg_cmd_search_ms_proc((DWORD)i_DestChapStartTime);
				while ((i_DestChapStartTime > MPGFileDecoderGetPlayTime()) && (wait_time < MP_TRICK_TIMEOUT))
				{
					osal_task_sleep(2);
					wait_time++;
				}
			}
			else                  //chapter18 to chapter1          
			{
				//mpg_cmd_search_proc((DWORD)i_DestChapStartTime);
				mpg_cmd_search_ms_proc((DWORD)i_DestChapStartTime);
				while ((i_DestChapStartTime + VIDEO_SEARCH_DLYS < MPGFileDecoderGetPlayTime()) && (wait_time < MP_TRICK_TIMEOUT))
				{
					osal_task_sleep(2);
					wait_time++;
				}
			}
			
			PlayProc();
			OSD_ObjClose(pObj,C_CLOSE_CLRBACK_FLG);
			return PROC_LEAVE;		
		}
		break;
		
	case EVN_PRE_CLOSE:
		ret = PROC_PASS;
        break;

	case EVN_POST_CLOSE:
        api_set_deo_layer(1);
        api_dec_wnd_count();
        break;
	default:
		break;
	}

	return ret;
}
コード例 #8
0
ファイル: win_mpeg_player.c プロジェクト: Janesak1977/ali3602
static PRESULT win_mpeg_player_message_proc(POBJECT_HEAD pObj, UINT32 msg_type, UINT32 msg_code)
{
    PRESULT ret = PROC_LOOP;
    struct VDec_StatusInfo vdec_status;

    switch (msg_type)
    {
    case CTRL_MSG_SUBTYPE_CMD_STO:
        if(msg_code == USB_STATUS_OVER)
        {
            storage_dev_mount_hint(1);
            file_list_check_storage_device(FALSE, FALSE);
        }
        break;

    case CTRL_MSG_SUBTYPE_CMD_TIMEDISPLAYUPDATE:
        MPEGInfo.PlayTime = (UINT32)MPGFileDecoderGetPlayTime();
        if(MPEGInfo.PlayTime >= MPEGInfo.TotalTime)
        {
            BarState.nPos = MPEGInfo.TotalTime - 1;
        }
        else
            BarState.nPos = MPEGInfo.PlayTime;

        if (!m_HideWindow)
        {
            win_mpeg_player_draw(TRUE);
        }
        break;
    case CTRL_MSG_SUBTYPE_STATUS_VIDEO_OVER: //video over
#if 0
        vdec_io_control(dev_get_by_id(HLD_DEV_TYPE_DECV, 0), VDEC_IO_GET_STATUS, (UINT32)(&vdec_status));
        if(MPEG_FB != MPEGInfo.PlayState && MPEG_SB != MPEGInfo.PlayState && vdec_status.api_play_direction == VDEC_FORWARD)
        {
            if((filelist_get_current_classifiedfile_count(MP_VIDEO)+1)<mpeglist_cnt)
            {
                mpeglist_idx = filelist_get_next_classifiedfile_index(MP_VIDEO, mpeglist_idx);
            }
            else
            {
                mpeglist_idx = (UINT16)(~0);
            }
        }
        if(mpeglist_idx != (UINT16)(~0))
        {
            if(vdec_status.api_play_direction == VDEC_FORWARD)
                mpg_cmd_stop_proc();
            MPEGInfo.PlayState = MPEG_STOP;
            api_stop_timer(&mpeg_refresh_id);
            m_mpeg_player_working = FALSE;
            MPEG_player_init();
            m_mpeg_player_working = TRUE;
        }
        else
            ret = PROC_LEAVE;
#else
        if(MPEGInfo.PlayState == MPEG_FB)
        {
            MPEGInfo.PlayState = MPEG_STOP;
            PlayProc();
        }
        else
        {
            ret = PROC_LEAVE;
        }
#endif
        break;
    case CTRL_MSG_SUBTYPE_STATUS_TIMEOUT:	//mpeg player display timer out
        if (!m_HideWindow)
        {
            win_mpeg_player_draw(FALSE);
            if (BarState.State == CURSOR_MOVING)
            {
                SyncBarPosAndCursor(POS_TO_CUR);
            }
        }
        else
        {
            if (m_bSetVol)//if the volume bar is showing
            {
                //ShowVolumeBar(FALSE);//Close the volume bar
            }
        }
        break;
    }

    return ret;
}
コード例 #9
0
ファイル: win_mpeg_player.c プロジェクト: Janesak1977/ali3602
static PRESULT win_mpeg_player_key_proc(POBJECT_HEAD pObj, UINT32 key, UINT32 param)
{
    PRESULT ret = PROC_LOOP;
    int wait_time = 0;

    if((key == V_KEY_PAUSE)&&(MPEGInfo.PlayState != MPEG_PLAY))
    {
        key = V_KEY_PLAY;
    }

    switch (key)
    {
    case V_KEY_EXIT:
    case V_KEY_MENU:
        if (m_HideWindow)
        {
            if (m_bSetVol)
            {
                //ShowVolumeBar(FALSE);//Close volume bar
                win_mpegplayer_close_video_vol();
                m_bSetVol = FALSE;
            }
            else
            {
                ret = PROC_LEAVE;//exit video player
            }
        }
        else
        {
            if (MPEGInfo.PlayState == MPEG_STOP)
            {
                ret = PROC_LEAVE;//exit video player
            }
            else
            {
                api_stop_timer(&mpeg_timeout_id);
                win_mpeg_player_draw(FALSE);//Hide the information window
                if (BarState.State == CURSOR_MOVING)
                {
                    SyncBarPosAndCursor(POS_TO_CUR);
                }
            }
        }
        break;
    case V_KEY_PLAY:
    case V_KEY_1:
        if(MPEGInfo.PlayState != MPEG_PLAY)
        {
            PivotalKeyProc();
            PlayProc();
        }
        break;
    case V_KEY_PAUSE:
    case V_KEY_2:
    case V_KEY_STEP:
        PivotalKeyProc();
        PauseProc();
        break;
    case V_KEY_STOP:
    case V_KEY_0:
        PivotalKeyProc();
        StopProc();
        ret = PROC_LEAVE;
        break;
    case V_KEY_PREV:
    case V_KEY_NEXT:

        break;
    case V_KEY_FF:
        if (MPEGInfo.PlayState == MPEG_STOP)
        {
            return PROC_LOOP;
        }
        else
        {
            PivotalKeyProc();
            FastForwardProc();
        }
        break;
    case V_KEY_FB:
        if (MPEGInfo.PlayState == MPEG_STOP)
        {
            return PROC_LOOP;
        }
        else
        {
            PivotalKeyProc();
            FastBackwardProc();
        }
        break;
    case V_KEY_SLOW:
        if (MPEGInfo.PlayState == MPEG_STOP)
        {
            return PROC_LOOP;
        }
        else
        {
            PivotalKeyProc();
            SlowForwardProc();
        }
        break;
    case V_KEY_LEFT:
        if (m_HideWindow)
        {
            win_mpeg_player_draw(FALSE);
            win_mpegplayer_set_video_vol(V_KEY_LEFT);
            return PROC_LOOP;
        }
        if (MPEGInfo.PlayState != MPEG_STOP)
        {
            if (BarState.State != CURSOR_MOVING)
            {
                BarState.State = CURSOR_MOVING;
                BarState.nCursor = BarState.nPos;
            }
            if (BarState.nCursor > SLIDE_BAR_STEP)
            {
                BarState.nCursor -= SLIDE_BAR_STEP;
            }
            else if (0 == BarState.nCursor )
            {
                if(BarState.nRange > SLIDE_BAR_STEP)
                    BarState.nCursor = BarState.nRange-SLIDE_BAR_STEP;
                else
                    BarState.nCursor = BarState.nRange;
            } else
            {
                BarState.nCursor = 0;
            }
        }
        win_mpeg_player_draw(TRUE);
        break;

    case V_KEY_RIGHT:
        if (m_HideWindow)
        {
            win_mpeg_player_draw(FALSE);
            win_mpegplayer_set_video_vol(V_KEY_RIGHT);
            return PROC_LOOP;
        }
        if (MPEGInfo.PlayState != MPEG_STOP)
        {
            if (BarState.State != CURSOR_MOVING)
            {
                BarState.State = CURSOR_MOVING;
                BarState.nCursor = BarState.nPos;
            }
            if (BarState.nCursor + SLIDE_BAR_STEP < BarState.nRange)
            {
                BarState.nCursor += SLIDE_BAR_STEP;
            }
            else
            {
                if(BarState.nRange > SLIDE_BAR_STEP)
                    BarState.nCursor = SLIDE_BAR_STEP;
                else
                    BarState.nCursor = BarState.nRange - VIDEO_SEARCH_DLYS;
            }
        }
        win_mpeg_player_draw(TRUE);
        break;

    case V_KEY_ENTER:
        if (MPEGInfo.PlayState != MPEG_STOP)
        {
            if (BarState.State == CURSOR_MOVING)
            {
                if (BarState.nPos < BarState.nCursor)//forward
                {
                    BarState.CursorDir = 1;
                }
                else if (BarState.nPos > BarState.nCursor)//backward
                {
                    BarState.CursorDir = 2;
                }
                else
                {
                    BarState.CursorDir = 0;
                }

                SyncBarPosAndCursor(CUR_TO_POS);

                MPEGInfo.PlayTime = BarState.nPos;

                if (BarState.CursorDir == 1)//forward
                {
                    mpg_cmd_search_proc(MPEGInfo.PlayTime);
                    while ((MPEGInfo.PlayTime > (UINT32)MPGFileDecoderGetPlayTime()) && (wait_time < 555))
                    {
                        osal_task_sleep(2);
                        wait_time++;
                    }
                }
                else if (BarState.CursorDir == 2)//backward
                {
                    mpg_cmd_search_proc(MPEGInfo.PlayTime);
                    while ((MPEGInfo.PlayTime + VIDEO_SEARCH_DLYS < (UINT32)MPGFileDecoderGetPlayTime()) && (wait_time < 555))
                    {
                        osal_task_sleep(2);
                        wait_time++;
                    }
                }
                PlayProc();
            }
        }
        break;
    case V_KEY_INFOR:
    case V_KEY_PVR_INFO:
        m_HideWindow = !m_HideWindow;
        if (!m_HideWindow)
        {
            if (m_bSetVol)//if volume window is open, close it.
            {
                //ShowVolumeBar(FALSE);
            }
            win_mpeg_player_draw(TRUE);
        }
        else
        {
            win_mpeg_player_draw(FALSE);
            if (BarState.State == CURSOR_MOVING)
            {
                SyncBarPosAndCursor(POS_TO_CUR);
            }
        }
        break;

    case V_KEY_MUTE:

        break;

    }
    return ret;
}