Ejemplo n.º 1
0
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;
}
Ejemplo n.º 2
0
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;
}
Ejemplo n.º 3
0
static PRESULT win_mpegYT_player_key_proc(POBJECT_HEAD pObj, UINT32 key, UINT32 param)
{
	PRESULT ret = PROC_LOOP;
	int wait_time = 0;

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

	switch (key)
	{
	case V_KEY_EXIT:
	case V_KEY_MENU:
		if (m_HideWindow)
		{
			if (m_bSetVol_YT)
			{
				//ShowVolumeBar(FALSE);//Close volume bar
				win_mpegYTplayer_close_video_vol();
				m_bSetVol_YT = FALSE;
			}
			else
			{
				ret = PROC_LEAVE;//exit video player
			}
		}
		else
		{
			if (MPEGYTInfo.PlayState == MPEG_STOP)
			{
				ret = PROC_LEAVE;//exit video player
			}
			else
			{
				api_stop_timer(&mpegYT_timeout_id);
				win_mpegYT_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(MPEGYTInfo.PlayState != MPEG_PLAY)
		{
			PivotalKeyProc();
			PlayProc_yt();
		}
		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_LEFT:
		if (m_HideWindow)
		{
			win_mpegYT_player_draw(FALSE);
			win_mpegYTplayer_set_video_vol(V_KEY_LEFT);
			return PROC_LOOP;
		}
		if(s_is_in_parsing)
		{
			break;
		}
		if (MPEGYTInfo.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_mpegYT_player_draw(TRUE);
		break;

	case V_KEY_RIGHT:
		if (m_HideWindow)
		{
			win_mpegYT_player_draw(FALSE);
			win_mpegYTplayer_set_video_vol(V_KEY_RIGHT);
			return PROC_LOOP;
		}
		if(s_is_in_parsing)
		{
			break;
		}
		if (MPEGYTInfo.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_mpegYT_player_draw(TRUE);
		break;

	case V_KEY_ENTER:
		if (MPEGYTInfo.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);

				MPEGYTInfo.PlayTime = BarState.nPos;

				if (BarState.CursorDir)
				{
					s_ytvideo_seektime =  MPEGYTInfo.PlayTime;
					api_stop_timer(&mpegYT_refresh_id);
					libnet_download_abort(g_strf_cur_dl_rsrc);
					mpg_cmd_stop_proc();
					mpegYT_file_prompt("Loading, please wait...", TRUE);
					osal_task_sleep(1000);
					UINT8 tmpurl[1024];
					UINT8* tmppos;
					tmppos = strstr(url_youtube, "&begin=");
					if(NULL == tmppos)
					{
						sprintf(tmpurl, "&begin=%d", s_ytvideo_seektime * 1000);
						strcat(url_youtube, tmpurl);
					}else
					{
						sprintf(tmppos, "&begin=%d", s_ytvideo_seektime * 1000);
					}
					httpstrfile_url_gen(tmpurl, url_youtube, "mp4");
					video_dec_file(tmpurl, 0);
					s_is_in_parsing = 1;
					MPEGYTInfo.PlaySpeed = 0;
					StartRefreshTimer();
				}
				PlayProc_yt();
			}
		}
		break;
	default:
		break;
	}
	return ret;
}
Ejemplo n.º 4
0
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;
}