📄 mae1200.cpp
字号:
DPRINTF(MSG_IOCTL, (TEXT("MAE_Ioctl SETPLAYERRECT...\n")));
rect = (RECT *)pBufIn;
DPRINTF(MSG_IOCTL, (TEXT("MAE_Ioctl SETPLAYERRECT player (%d,%d) -> (%d,%d)\n"),
rect->left, rect->top, rect->right, rect->bottom));
g_RectPlayer.left = rect->left;
g_RectPlayer.top = rect->top;
g_RectPlayer.right = rect->right;
g_RectPlayer.bottom = rect->bottom;
}
break;
case AU1XXXMAE_SETDISPLAYRECT:
{
RECT *rect;
RPRINTF(MSG_ERROR, (TEXT("MAE_Ioctl MAE SETDISPLAYRECT deprecated!!!!\n")));
DPRINTF(MSG_IOCTL, (TEXT("MAE_Ioctl MAE DISPLAYSIZE IOCTL...\n")));
rect = (RECT *)pBufIn;
DPRINTF(MSG_IOCTL, (TEXT("$$$ MAE_Ioctl SETDISPLAYRECT: %dx%d @ (%d,%d)\n"),
rect->right - rect->left, rect->bottom - rect->top, rect->left, rect->top));
move_overlay_window(rect);
pmms->video_out_linesize = rect->right - rect->left;
pmms->video_out_height = rect->bottom - rect->top;
program_static_display();
}
break;
case AU1XXXMAE_DISPLAYSIZE:
{
PMAE_DISP_STRUCT pcur_display;
DPRINTF(MSG_IOCTL, (TEXT("MAE_Ioctl MAE DISPLAYSIZE IOCTL...\n")));
pcur_display = (PMAE_DISP_STRUCT)pBufIn;
DPRINTF(MSG_IOCTL, (TEXT("MAE_Ioctl Display Settings: width %d height %d\n"), pcur_display->display_linesize, pcur_display->display_height));
#ifdef YUV_DUMPS
DPRINTF(1, (TEXT("MAE_Ioctl Display Settings: width %d height %d\n"), pcur_display->display_linesize, pcur_display->display_height));
#endif
//pmms->video_out_linesize = (pcur_display->display_linesize > 640)?640:pcur_display->display_linesize;
//pmms->video_out_height = (pcur_display->display_height > 480)?480:pcur_display->display_height;
pmms->video_out_linesize = pcur_display->display_linesize;
pmms->video_out_height = pcur_display->display_height;
program_static_display();
}
break;
case AU1XXXMAE_GETDISPLAYSIZE:
{
PMAE_DISP_STRUCT pcur_display;
DPRINTF(MSG_IOCTL, (TEXT("MAE_Ioctl MAE GETDISPLAYSIZE IOCTL...\n")));
pcur_display = (PMAE_DISP_STRUCT)pBufOut;
pcur_display->display_height = (((lcd->screen) >> 8) & 0x7FF) + 1;
pcur_display->display_linesize = (((lcd->screen) >> 19) & 0x7FF) + 1;
DPRINTF(MSG_IOCTL, (TEXT("MAE_Ioctl Get Display Settings: width %d height %d\n"), pcur_display->display_linesize, pcur_display->display_height));
}
break;
case AU1XXXMAE_GETDISPLAYCONFIG:
{
PMAE_DISP_STRUCT pcur_display;
DPRINTF(MSG_IOCTL, (TEXT("MAE_Ioctl MAE GETDISPLAYCONFIG IOCTL...\n")));
pcur_display = (PMAE_DISP_STRUCT)pBufOut;
pcur_display->display_height = SIZE_RGB_HEIGHT;
pcur_display->display_linesize = SIZE_RGB_WIDTH;
pcur_display->format = SIZE_RGB_BPP;
pcur_display->rotation = video_out_rotation;
}
break;
case AU1XXXMAE_GETYUVCONFIG:
{
PMAE_DISP_STRUCT pcur_display;
DPRINTF(MSG_IOCTL, (TEXT("MAE_Ioctl MAE GETDISPLAYCONFIG IOCTL...\n")));
pcur_display = (PMAE_DISP_STRUCT)pBufOut;
pcur_display->display_height = SIZE_YUV_HEIGHT;
pcur_display->display_linesize = SIZE_YUV_WIDTH;
pcur_display->format = SIZE_YUV_BPP;
pcur_display->rotation = 0;
}
break;
case AU1XXXMAE_GETSCALERS:
{
PMAE_DISP_STRUCT pcur_display;
DPRINTF(MSG_IOCTL, (TEXT("MAE_Ioctl MAE GETSCALERS IOCTL...\n")));
pcur_display = (PMAE_DISP_STRUCT)pBufOut;
pcur_display->display_height = au_readl(MAEBE_SCFVSR);
pcur_display->display_linesize = au_readl(MAEBE_SCFHSR);
}
break;
case AU1XXXMAE_GETYUVBUF:
{
DPRINTF(MSG_IOCTL, (TEXT("MAE_Ioctl MAE GETYUVBUF IOCTL...\n")));
pyuvbuf = (unsigned long ) new_yuvbuffer();
//status = pyuvbuf; // ???
*(unsigned long *)pBufOut = pyuvbuf;
}
break;
case AU1XXXMAE_GETYUVBUFADDR:
{
DPRINTF(MSG_IOCTL, (TEXT("MAE_Ioctl MAE GETYUVBUFADDR IOCTL...\n")));
pyuvbuf = (unsigned long )get_yuvbufferaddr(ioc->ksegbase);
//status = pyuvbuf;
*(unsigned long *) pBufOut = pyuvbuf;
}
break;
case AU1XXXMAE_REQUEST:
{
UINT32 ulTimeout=(UINT32)pBufIn;
#if (MSG_IOCTL|MSG_STATE|MSG_BUFIF)
if (isBEstate(MAE_STATE_PREROLL|MAE_STATE_PAUSED|MAE_STATE_PAUSING|MAE_STATE_STOPPING) || !pmms->fe_proc)
{
DPRINTF(MSG_IOCTL|MSG_STATE|MSG_BUFIF, (TEXT("MAE_Ioctl REQUEST(timeout=%d): enter fe=%s be=%s done=%d\n"),
(int)ulTimeout, RunStateStr(g_FEState), RunStateStr(g_BEState), nRequestDone));
}
#endif
DPRINTF(MSG_IOCTL|MSG_BUFIF, (TEXT("MAE_Ioctl REQUEST(timeout=%d)\n"), (int)ulTimeout));
if (!isFEstate(MAE_STATE_STOPPING) && !IsFEStopped())
{
status = (UINT32)new_fesw(ulTimeout, (PMAEQ_T)pBufOut);
if (status==MAE_OK)
{
nRequestDone = 1;
RetVal = TRUE;
}
else
{
DPRINTF(MSG_IOCTL|MSG_STATE|MSG_BUFIF, (TEXT("MAE_Ioctl REQUEST: failed: status=%d fe=%s be=%s\n"),
status, RunStateStr(g_FEState), RunStateStr(g_BEState)));
RetVal = NULL; // return failing code from ioctl
}
}
else
{
DPRINTF(MSG_IOCTL|MSG_STATE|MSG_BUFIF, (TEXT("MAE_Ioctl REQUEST not servicing (STOPPED)\n")));
RetVal = NULL; // return failing code from ioctl
}
#if (MSG_IOCTL|MSG_STATE|MSG_BUFIF)
if (isBEstate(MAE_STATE_PREROLL|MAE_STATE_PAUSED|MAE_STATE_PAUSING|MAE_STATE_STOPPING))
{
DPRINTF(MSG_IOCTL|MSG_STATE|MSG_BUFIF, (TEXT("MAE_Ioctl REQUEST: done: retval=%p fe=%s be=%s\n"),
RetVal, RunStateStr(g_FEState), RunStateStr(g_BEState)));
}
#endif
}
break;
case AU1XXXMAE_REQUEST_BE:
{
if (!IsBEStopped())
{
DPRINTF(MSG_IOCTL|MSG_BUFIF, (TEXT("MAE_Ioctl REQUEST_BE\n")));
status = (UINT32)new_besw();
}
else
{
DPRINTF(MSG_IOCTL|MSG_BUFIF, (TEXT("MAE_Ioctl REQUEST_BE not servicing (STOPPED)\n")));
RetVal = NULL; // return failing code from ioctl
}
}
break;
case AU1XXXMAE_SUBMIT:
{
#if (MSG_IOCTL|MSG_STATE|MSG_BUFIF)
if (isBEstate(MAE_STATE_PREROLL|MAE_STATE_PAUSED|MAE_STATE_PAUSING|MAE_STATE_STOPPING|MAE_STATE_STOPPED) || !pmms->fe_proc)
{
DPRINTF(MSG_IOCTL|MSG_STATE|MSG_BUFIF, (TEXT("MAE_Ioctl SUBMIT: enter fe=%s be=%s\n"),
RunStateStr(g_FEState), RunStateStr(g_BEState)));
}
#endif
DPRINTF(MSG_IOCTL|MSG_BUFIF, (TEXT("MAE_Ioctl SUBMIT\n")));
EnterCS(g_CriticalSection);
if (!isFEstate(MAE_STATE_STOPPING) && !IsFEStopped() && nRequestDone)
{
CacheSync(CACHE_SYNC_WRITEBACK);
nRequestDone = 0;
status = submit_fesw();
}
else
{
if (!nRequestDone)
{
// todo: if this case happens make sure that the pipeline is cleared
DPRINTF(MSG_IOCTL|MSG_STATE|MSG_BUFIF, (TEXT("MAE_Ioctl SUBMIT - Ignore, buffer not from recent request\n")));
}
else if (pmms->sw_proc)
{
// todo: if this case happens make sure that the pipeline is cleared
DPRINTF(MSG_IOCTL|MSG_STATE|MSG_BUFIF, (TEXT("MAE_Ioctl SUBMIT has a buffer to discard while stopped\n")));
if (isFEstate(MAE_STATE_STOPPED))
flush_maeq(); /* it's safe to flush if mae_interrupt's are STOPPED */
}
else
{
// todo: we expect this case
DPRINTF(MSG_IOCTL|MSG_STATE|MSG_BUFIF, (TEXT("MAE_Ioctl SUBMIT stopped\n")));
}
status = HEALTH_OK; //SCB must implement real feedback
}
*(unsigned long *)pBufOut = status;
LeaveCS(g_CriticalSection);
#ifdef SLOW_SUBMITS_ON_PAUSE
if (isBEstate(MAE_STATE_PAUSING|MAE_STATE_PAUSED))
{
unsigned int uiWaitTime=isBEstate(MAE_STATE_PAUSED)?200:50; /* wait longer if PAUSED */
/* If a Pause was requested, let's wait a bit.
** This helps give caller (VideoRenderer) a chance to pick up status on the
** first frame rendered (via ISDISPLAYED) before queues are full.
** Thus reducing blocking on REQUEST or SUBMITS in the Decoder threads.
*/
DPRINTF(MSG_IOCTL|MSG_STATE, (TEXT("MAE_Ioctl SUBMIT (wait Paused) fe=%s be=%s\n"),
RunStateStr(g_FEState), RunStateStr(g_BEState)));
waitfor_BEstate(~(MAE_STATE_PAUSING|MAE_STATE_PAUSED), uiWaitTime);
DPRINTF(MSG_IOCTL|MSG_STATE, (TEXT("MAE_Ioctl SUBMIT (wait done) fe=%s be=%s\n"),
RunStateStr(g_FEState), RunStateStr(g_BEState)));
}
#endif
#if (MSG_IOCTL|MSG_STATE|MSG_BUFIF)
if (isBEstate(MAE_STATE_PREROLL|MAE_STATE_PAUSED|MAE_STATE_PAUSING|MAE_STATE_STOPPING|MAE_STATE_STOPPED))
{
DPRINTF(MSG_IOCTL|MSG_STATE|MSG_BUFIF, (TEXT("MAE_Ioctl SUBMIT: done fe=%s be=%s\n"),
RunStateStr(g_FEState), RunStateStr(g_BEState)));
}
#endif
}
break;
case AU1XXXMAE_SUBMIT_BE:
{
DPRINTF(MSG_IOCTL|MSG_BUFIF, (TEXT("MAE_Ioctl SUBMIT_BE\n")));
status = submit_besw();
}
break;
case AU1XXXMAE_WRITE_TIMESTAMP:
{
// write PTS and System Time Clock to shared memory
ContextTime_t *pContextTime;
pContextTime = (ContextTime_t *)pBufIn;
DPRINTF(MSG_IOCTL|MSG_TIME,(TEXT("MAE_Ioctl WRITE TIMESTAMP pts: %d stc: %d\n"), (long)pContextTime->pts, (long)pContextTime->stc));
if (!IsBEStopped())
{
write_system_time_clock(pContextTime);
}
else
{
DPRINTF(MSG_IOCTL|MSG_TIME,(TEXT("MAE_Ioctl WRITE TIMESTAMP pts: %d not servicing\n"), (long)pContextTime->pts));
}
}
break;
case AU1XXXMAE_ENABLE_COUNT:
{
DPRINTF(MSG_IOCTL, (TEXT("MAE_Ioctl ENABLE_COUNT (ignore this call)\n")));
}
break;
case AU1XXXMAE_DISABLE_COUNT:
{
DPRINTF(MSG_IOCTL, (TEXT("MAE_Ioctl DISABLE_COUNT\n")));
}
break;
case AU1XXXMAE_IGNORE_PTS:
{
long *pIgnorePts = (long *)pBufIn;
nIgnorePTS = *pIgnorePts;
DPRINTF(MSG_TIME, (TEXT("MAE_Ioctl IGNORE_PTS set to %d\n"), nIgnorePTS));
}
break;
case AU1XXXMAE_STOP:
{
int mask;
long *dshow_time = (long *)pBufIn;
DPRINTF(MSG_IOCTL|MSG_STATE, (TEXT("MAE_Ioctl STOP: time %d (sys time %d) fe=%s be=%s\n"),
*dshow_time, timeGetTime(), RunStateStr(g_FEState), RunStateStr(g_BEState)));
EnterCS(g_CriticalSection);
if (!IsFEStopped())
change_FEstate(MAE_STATE_STOPPING);
waitfor_FEstate(~MAE_STATE_STOPPING, 500);
if (!IsBEStopped())
change_BEstate(MAE_STATE_STOPPING);
LeaveCS(g_CriticalSection);
DPRINTF(MSG_IOCTL|MSG_STATE, (TEXT("MAE_Ioctl STOP: (wait) fe=%s be=%s\n"),
RunStateStr(g_FEState), RunStateStr(g_BEState)));
// wait for STOPPING -> STOPPED transition
waitfor_BEstate(~MAE_STATE_STOPPING, 1000);
DPRINTF(MSG_IOCTL|MSG_STATE, (TEXT("MAE_Ioctl STOP: (mask int) fe=%s be=%s\n"),
RunStateStr(g_FEState), RunStateStr(g_BEState)));
EnterCS(g_CriticalSection);
// mask pipeline interrupts
mask = mask_interrupts( (1<<AU1200_MAE_FE_INT) | (1<<AU1200_MAE_BE_INT) |
(1<<AU1200_MAE_BOTH_INT) | (1<<AU1200_LCD_INT) );
#if 0
/* HWG - This is most of the old Stop sequence, which is now
handled elsewhere in State changes (mainly inside interrupts).
Note: halt_mae() has been removed. Is it necessary?
*/
disable_overlay(MAE_PLANE);
if (!IsFEStopped())
change_FEstate(MAE_STATE_STOPPING);
disable_lcd_scan();
halt_mae();
flush_mae(1);
clear_lcd_pipeline();
if (!IsBEStopped())
change_BEstate(MAE_STATE_STOPPING);
#endif
DPRINTF(MSG_IOCTL|MSG_STATE|MSG_BUFIF, (TEXT("MAE_Ioctl STOP: pipeline reset\n")));
wake_decoder(); // prevent sleeping decoder from hanging dshow transtion
DPRINTF(MSG_IOCTL|MSG_STATE|MSG_BUFIF, (TEXT("MAE_Ioctl STOP: decoder wake up\n")));
// NOTE: masked interrupts are not unmasked here. The next
// pause/play will reprogram intrs and mask
LeaveCS(g_CriticalSection);
DPRINTF(MSG_IOCTL|MSG_STATE, (TEXT("MAE_Ioctl STOP: done fe=%s be=%s\n"),
RunStateStr(g_FEState), RunStateStr(g_BEState)));
}
break;
case AU1XXXMAE_PAUSE:
{
long *dshow_time = (long *)pBufIn;
int bBEPlaying=isBEstate(MAE_STATE_STARTING|MAE_STATE_PLAYING);
DPRINTF(MSG_IOCTL|MSG_STATE, (TEXT("MAE_Ioctl PAUSE: time %d (sys time %d) fe=%s be=%s\n"),
*dshow_time, timeGetTime(), RunStateStr(g_FEState), RunStateStr(g_BEState)));
EnterCS(g_CriticalSection);
if (!isBEstate(MAE_STATE_PAUSED))
change_BEstate(MAE_STATE_PAUSING);
if (!isFEstate(MAE_STATE_PLAYING))
change_FEstate(MAE_STATE_STARTING);
if (bBEPlaying)
{
// Get out of the critical section so that a BE
// state change CAN happen (PAUSING to PAUSED)
LeaveCS(g_CriticalSection);
// when we're playing, let's wait for PAUSING -> PAUSED transition
DPRINTF(MSG_IOCTL|MSG_STATE, (TEXT("MAE_Ioctl PAUSE: (wait) fe=%s be=%s\n"),
RunStateStr(g_FEState), RunStateStr(g_BEState)));
waitfor_BEstate(~MAE_STATE_PAUSING, 1000);
}
else
LeaveCS(g_CriticalSection);
DPRINTF(MSG_IOCTL|MSG_STATE, (TEXT("MAE_Ioctl PAUSE: done: fe=%s be=%s\n"),
RunStateStr(g_FEState), RunStateStr(g_BEState)));
}
break;
case AU1XXXMAE_RUN:
{
long *dshow_time = (long *)pBufIn;
DPRINTF(MSG_IOCTL|MSG_STATE, (TEXT("MAE_Ioctl RUN: time %d (sys time %d) fe=%s be=%s\n"),
*dshow_time, timeGetTime(), RunStateStr(g_FEState), RunStateStr(g_BEState)));
ResetEvent(g_hEndOfStreamSemaphore);
EnterCS(g_CriticalSection);
if (!isFEstate(MAE_STATE_PLAYING))
change_FEstate(MAE_STATE_STARTING);
change_BEstate(MAE_STATE_STARTING);
//enable_lcd_scan();
DPRINTF(MSG_IOCTL|MSG_STATE, (TEXT("MAE_Ioctl RUN: done: fe=%s be=%s\n"),
RunStateStr(g_FEState), RunStateStr(g_BEState)));
LeaveCS(g_CriticalSection);
}
break;
case AU1XXXMAE_PRIME_FE: /* this is identical to RUN, but no display (i.e. PREROLL) */
{
long *dshow_time = (long *)pBufIn;
DPRINTF(MSG_IOCTL|MSG_STATE, (TEXT("MAE_Ioctl PRIME_FE: time %d (sys time %d) fe=%s be=%s\n"),
*dshow_time, timeGetTime(), RunStateStr(g_FEState), RunStateStr(g_BEState)));
ResetEvent(g_hEndOfStreamSemaphore);
EnterCS(g_CriticalSection);
if (!isFEstate(MAE_STATE_PLAYING))
change_FEstate(MAE_STATE_STARTING);
change_BEstate(MAE_STATE_PREROLL);
//enable_lcd_scan();
DPRINTF(MSG_IOCTL|MSG_STATE, (TEXT("MAE_Ioctl PRIME_FE: done: fe=%s be=%s\n"),
RunStateStr(g_FEState), RunStateStr(g_BEState)));
LeaveCS(g_CriticalSection);
}
break;
case AU1XXXMAE_ISDISPLAYED:
{
unsigned int uiFramesDisplayed=g_FrameOutNum;
if (!uiFramesDisplayed && isFEstate(MAE_STATE_PLAYING)) /* BE had not rendered yet, but FE has decoded */
uiFramesDisplayed=(unsigned int)-1; /* FE is has decoded first frame, return special -1 value */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -