⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 movinterface.c

📁 瑞星微公司RK27XX系列芯片的SDK开发包
💻 C
字号:
/********************************************************************************************
*	Copyright (C), 2008, Fuzhou Rockchip Co.,Ltd.
*   All Rights Reserved
*
*	File:
*              MovInterface.c
*	Description:
*
*	Author:
*              guosl
*	Note:
*	           None.
*	$Log: MovInterface.c,v $
*	Revision 1.2  2008/07/18 09:31:32  HZF
*	修改有声音没图片的片源
*	
*	Revision 1.1  2008/07/08 07:29:20  HZF
*	增加3gp和MP4
*	
*	Revision 1.1  2008/5/16 14:43:19  guosl
*	no message
*
*
*
*
********************************************************************************************/

#include "include.h"
#include "system.h"
#include "../browser/BrowserStruct.h"
#ifdef BOARD
#include "MovFile.h"
#include "BrowserGlobal.h"
#include "MovVideoContrl.h"
#include "MovMacro.h"
#include "VideoCodecs.h"
#include "VideoWin.h"
#endif
/*********************************declare********************************/
#ifdef BOARD
EXT SYS_FILE_INFO VideoFileInfo;
#endif

EXT void MovAudioCtrl(int cmd);
/************************************************************************/

/********************************************************************************************
*	Func:
*		MovInit()
*	Description:
*
*	Param:
*
*	Return:
*
*
*	Author:
*		guosl
*	Date:
*		2008-5-16	10:30
*	Log:
*
********************************************************************************************/

STATIC int MovInit(video_interface_t *this, char *path)
{
    int errorNo = 0;
    char pathName[FS_MAX_PATH_LEN];

	path = pathName;
	RKmemcpy(path,  VideoFileInfo.Path, FS_MAX_PATH_LEN);
	RKstrcat(path,  VideoFileInfo.Name);

	errorNo = MovVideoFileInit(path);

    if (errorNo == MOV_FILE_PARSING_OK)
    {
        this->audio_flag = 1;
		return TRUE;
	}
	else
    {
        if (errorNo == MOV_FILE_AUDIO_CODEC_ERR)
        {
		    /* audio codec error is allowable. */
		    isAudioPlayEnd = TRUE;
		    this->audio_flag = 0;
		    return TRUE;
        }
	}

	return FALSE;
}

/********************************************************************************************
*	Func:
*		 MovDecOpen()
*	Description:
*
*	Param:
*
*	Return:
*          TRUE: successfully open codec.
*          FALSE:  codec error.
*	Author:
*		guosl
*	Date:
*		2008-5-16	10:30
*	Log:
*
********************************************************************************************/

STATIC int MovDecOpen(video_interface_t *this)
{
    if (this->audio_flag)
    {
        MovAudioCtrl(MOV_AUDIO_CTRL_START);		//start audio
    }

    /* start video decoder */
    if (MovVideoDecInit(NULL) != 0x0)
    {
        return FALSE;
    }

    /* start fill buffer */
    RockOSSendMsg(MBVIDEO,AS_GUVI_VideoFillBuf,NULL);
    return TRUE;
}


/********************************************************************************************
*	Func:
*		 MovFillBuf()
*	Description:
*
*	Param:
*
*	Return:
*          TRUE: successfully open codec.
*          FALSE:  codec error.
*	Author:
*		guosl
*	Date:
*		2008-5-16	10:30
*	Log:
*
********************************************************************************************/

STATIC int MovFillBuf(video_interface_t *this, void *arg)
{
	int err = 0x0;
	//STATIC i = 0x0;

	if ((err = MovFillBitStreamForDecoder(NULL)) != 0x0)
    {
        //i = i + 1; //
	    return err;
    }

    RockOSSendMsg(MBVIDEO,AS_GUVI_VideoFillBuf,NULL);
	return 0;
}

/********************************************************************************************
*	Func:
*		 MovControl()
*	Description:
*
*	Param:
*
*	Return:
*          TRUE: successfully open codec.
*          FALSE:  codec error.
*	Author:
*		guosl
*	Date:
*		2008-5-16	10:30
*	Log:
*
********************************************************************************************/
STATIC int MovControl(video_interface_t *this, int cmd, void *arg0, void *arg1)
{
    switch (cmd)
    {
	    case VIDEO_CTRL_PLAY_PAUSE :
            if (MovPlayPause() == TRUE)
            {
                if (this->audio_flag)
                {
            	    MovAudioCtrl(MOV_AUDIO_CTRL_PAUSE);
                }

                return TRUE;
            }
            else
            {
                if (this->audio_flag)
                {
                    MovAudioCtrl(MOV_AUDIO_CTRL_RESUME);
                }

           	    return FALSE;
            }

		    break;

	    case VIDEO_CTRL_FFD :
            if(this->audio_flag)
            {
                MovAudioCtrl(MOV_AUDIO_CTRL_FFD);
            }

            return MovFFD(NULL);

	    case VIDEO_CTRL_FFW :
            if (this->audio_flag)
            {
                MovAudioCtrl(MOV_AUDIO_CTRL_FFW);
            }

            return MovFFW(NULL);

    	case VIDEO_CTRL_RESUME :
            MovResume(NULL);

            if ((this->audio_flag))
            {
                MovAudioCtrl(MOV_AUDIO_CTRL_RESUME);
            }
            break;

    	case VIDEO_CTRL_GET_CUR_TIME :
            *(unsigned int *)arg0 = MovGetCurTime();
    		break;

    	case VIDEO_CTRL_GET_TOTAL_TIME :
            *(uint32 *)arg0 = MovGetTotalTime();
            break;

    	case VIDEO_CTRL_GET_YUV_INFO :
            return MovGetYuvAddr((char **)arg0);
            break;

        case VIDEO_CTRL_GET_RESOLUTION :
            return MovGetResolution(arg0, arg1);
            break;

        default :
            break;

    }

	return 0;
}


/********************************************************************************************
*	Func:
*		 MovSeekTime()
*	Description:
*
*	Param:
*
*	Return:
*          TRUE: successfully open codec.
*          FALSE:  codec error.
*	Author:
*		guosl
*	Date:
*		2008-5-16	10:30
*	Log:
*
********************************************************************************************/
STATIC int MovSeekTime(video_interface_t *this, long time)
{
    return MovVideoSeek(time);
}

/********************************************************************************************
*	Func:
*		 MovExit()
*	Description:
*
*	Param:
*
*	Return:
*          TRUE: successfully open codec.
*          FALSE:  codec error.
*	Author:
*		guosl
*	Date:
*		2008-5-16	10:30
*	Log:
*
********************************************************************************************/
STATIC int MovExit(video_interface_t *this, int force_exit )
{
    /*if ((!force_exit) && (movForceExit == FALSE)) */
    //{
    	/* ensure all video frames is showed out. */
        //while (!MovIsLastFrame(NULL));
    //}

    /* stop audio */
    MovAudioCtrl(MOV_AUDIO_CTRL_STOP);

    /* stop video */
    MovDecodeEnd(NULL);
    return 0;
}

/********************************************************************************************
*	Func:
*		 MovInstallSubtitlePlugin()
*	Description:
*
*	Param:
*
*	Return:
*          TRUE: successfully open codec.
*          FALSE:  codec error.
*	Author:
*		guosl
*	Date:
*		2008-5-16	10:30
*	Log:
*
********************************************************************************************/
STATIC int MovInstallSubtitlePlugin(video_interface_t *this, subtitle_plugin_t *subtitle)
{
    return 0;
}

#ifdef TVOUT_PANEL
int Movtvout()
{
   MovTVoutChange();
    return 0;
}
#endif
video_interface_t video_interface_mov = {
	"MOVMP43GP",
	0,	//audio flag
       MovInit,
	MovDecOpen,
	MovFillBuf,
	MovSeekTime,
	MovControl,
	MovExit,
	
#ifdef TVOUT_PANEL
    MovInstallSubtitlePlugin,
    Movtvout
#else
    MovInstallSubtitlePlugin
#endif
};

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -