Beispiel #1
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;
}
Beispiel #2
0
/*****************************************************
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;
}
Beispiel #3
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;
}