📄 aviinterface.c
字号:
/******************************************************************/
/* Copyright (C) 2007 ROCK-CHIPS FUZHOU . All Rights Reserved. */
/*******************************************************************
File : AviInterface.c
Desc : 主界面窗口
Author :
Date : 2007-08-24
Notes :
$Log :
*********************************************************************/
#include "include.h"
#include "system.h"
#include "../browser/BrowserStruct.h"
#ifdef BOARD
#include "../video/avi/avifile.h"
#include "BrowserGlobal.h"
#include "Mpeg4Contrl.h"
#include "AviMacro.h"
#include "VideoCodecs.h"
#include "VideoWin.h"
#endif
/*********************************declare********************************/
#ifdef BOARD
extern SYS_FILE_INFO VideoFileInfo;
#endif
extern void AviAudioCtrl(int cmd);
/*************************************************************/
int aviForceExit;
// return value:
// TRUE = successfully parse the file .
// FALSE = file is not supported.
int AviInit(video_interface_t *this, char *path)
{
int err;
#if 1 // just debug.
char pathName[FS_MAX_PATH_LEN];
path = pathName;
RKmemcpy(path, VideoFileInfo.Path, FS_MAX_PATH_LEN);
RKstrcat(path, VideoFileInfo.Name);
#endif
aviForceExit = FALSE;
err = AviVideoFileInit(path);
if (err == AVI_FILE_PARSING_OK)
{
this->audio_flag = 1;
return TRUE;
}
else if (err == AVI_FILE_AUDIO_CODEC_ERR)
{
/* audio codec error is allowable. */
this->audio_flag = 0;
return TRUE;
}
return FALSE;
}
// return value:
// TRUE = successfully open codec.
// FALSE = codec error.
int AviDecOpen(video_interface_t *this)
{
if (this->audio_flag)
AviAudioCtrl(AVI_AUDIO_CTRL_START); //start audio
/* start video decoder */
if (AviVideoDecInit(NULL))
{
return FALSE;
}
/* start fill buffer */
RockOSSendMsg(MBVIDEO, AS_GUVI_VideoFillBuf, NULL);
return TRUE;
}
int AviFillBuf(video_interface_t *this, void *arg)
{
int err;
if (err = AviFillBitStreamForDecoder(NULL))
return err;
/* check decoder status */
err = AviGetDecStatus();
if (IS_VIDEO_DECODE_OK((short)err) != TRUE)
{
aviForceExit = TRUE;
return -2;
}
if (IS_VIDEO_DECODE_END((short)err) != TRUE)
{
aviForceExit = TRUE;
return -1;
}
RockOSSendMsg(MBVIDEO, AS_GUVI_VideoFillBuf, NULL);
return 0;
}
int AviControl(video_interface_t *this, int cmd, void *arg0, void *arg1)
{
switch (cmd)
{
case VIDEO_CTRL_PLAY_PAUSE:
if (AviPlayPause())
{
if (this->audio_flag)
{
AviAudioCtrl(AVI_AUDIO_CTRL_PAUSE);
}
return TRUE;
}
else
{
if (this->audio_flag)
{
AviAudioCtrl(AVI_AUDIO_CTRL_RESUME);
}
return FALSE;
}
break;
case VIDEO_CTRL_FFD:
if (AviFFD(NULL) != 0)
{
this->control(this, VIDEO_CTRL_RESUME, NULL, NULL);
return -1;
}
else
{
if (this->audio_flag)
AviAudioCtrl(AVI_AUDIO_CTRL_FFD);
return 0;
}
break;
case VIDEO_CTRL_FFW:
if (this->audio_flag)
AviAudioCtrl(AVI_AUDIO_CTRL_FFW);
return AviFFW(NULL);
case VIDEO_CTRL_RESUME:
AviResume(NULL);
if ((this->audio_flag))
{
AviAudioCtrl(AVI_AUDIO_CTRL_RESUME);
}
break;
case VIDEO_CTRL_GET_CUR_TIME:
*(unsigned int *)arg0 = AviGetCurTime();
break;
case VIDEO_CTRL_GET_TOTAL_TIME:
*(unsigned int *)arg0 = AviGetTotalTime();
break;
case VIDEO_CTRL_GET_YUV_INFO:
return AviGetYuvAddr((char **)arg0);
break;
case VIDEO_CTRL_GET_RESOLUTION:
return AviGetResolution(arg0, arg1);
break;
default:
break;
}
return 0;
}
int AviSeekTime(video_interface_t *this, long time)
{
return AviVideoSeek(time);
}
int AviExit(video_interface_t *this, int force_exit)
{
if ((!force_exit) && (aviForceExit == FALSE))
{
/* ensure all video frames is showed out. */
while (!AviIsLastFrame(NULL));
}
/* stop audio */
AviAudioCtrl(AVI_AUDIO_CTRL_STOP);
/* stop video */
AviDecodeEnd(NULL);
return 0;
}
int AviInstallSubtitlePlugin(video_interface_t *this, subtitle_plugin_t *subtitle)
{
return 0;
}
#ifdef TVOUT_PANEL
int Avitvout()
{
AVITVoutChange();
return 0;
}
#endif
video_interface_t video_interface_avi =
{
"AVI",
0, //audio flag
AviInit,
AviDecOpen,
AviFillBuf,
AviSeekTime,
AviControl,
AviExit,
#ifdef TVOUT_PANEL
AviInstallSubtitlePlugin,
Avitvout
#else
AviInstallSubtitlePlugin
#endif
};
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -