📄 uoctrl.cpp
字号:
/*****************************************************************************
******************************************************************************
** **
** Copyright (c) 2005-2006 Videon Central, Inc. **
** All rights reserved. **
** **
** The computer program contained herein contains proprietary information **
** which is the property of Videon Central, Inc. The program may be used **
** and/or copied only with the written permission of Videon Central, Inc. **
** or in accordance with the terms and conditions stipulated in the **
** agreement/contract under which the programs have been supplied. **
** **
******************************************************************************
*****************************************************************************/
/**
* @file uoctrl.cpp
*
* API to the User Operation (UO) Controller.
* The UO Controller receives User Operations and calls appropriate
* functions of the Playback Control Engine in accordance with the
* received UO.
*
* $Id: uoctrl.cpp,v 1.32 2007/01/19 14:05:22 mspinnenweber Exp $
*/
#include "vdvd_types.h"
#include "uoctrl.h"
#include "../playctrl/playctrl.h"
#include "dbgprint.h"
#ifdef VDVD_ENABLE_BDJ
# include "../modmgr.h"
# include "../bdjobjdb.h"
#endif
/* Debug macros */
#define DBG_UOCTRL DBG_ERROR
#define DBG_ON(x) (DBG_UOCTRL >= x)
/**
* UO Masks
*/
const uint64 UOMASK_CHAPTER_SEARCH = ((uint64)1 << 61);
const uint64 UOMASK_TIME_SEARCH = ((uint64)1 << 60);
const uint64 UOMASK_SKIP_TO_NEXT_POINT = ((uint64)1 << 59);
const uint64 UOMASK_SKIP_TO_PREV_POINT = ((uint64)1 << 58);
const uint64 UOMASK_STOP = ((uint64)1 << 56);
const uint64 UOMASK_PAUSE_ON = ((uint64)1 << 55);
const uint64 UOMASK_PAUSE_OFF = ((uint64)1 << 54);
const uint64 UOMASK_STILL_OFF = ((uint64)1 << 53);
const uint64 UOMASK_FORWARD_PLAY = ((uint64)1 << 52);
const uint64 UOMASK_BACKWARD_PLAY = ((uint64)1 << 51);
const uint64 UOMASK_RESUME = ((uint64)1 << 50);
const uint64 UOMASK_MOVE_UP_SELECTED_BUTTON = ((uint64)1 << 49);
const uint64 UOMASK_MOVE_DOWN_SELECTED_BUTTON = ((uint64)1 << 48);
const uint64 UOMASK_MOVE_LEFT_SELECTED_BUTTON = ((uint64)1 << 47);
const uint64 UOMASK_MOVE_RIGHT_SELECTED_BUTTON = ((uint64)1 << 46);
const uint64 UOMASK_SELECT_BUTTON = ((uint64)1 << 45);
const uint64 UOMASK_ACTIVATE_BUTTON = ((uint64)1 << 44);
const uint64 UOMASK_SELECT_AND_ACTIVATE_BUTTON = ((uint64)1 << 43);
const uint64 UOMASK_PRIMARY_AUDIO_CHANGE = ((uint64)1 << 42);
const uint64 UOMASK_ANGLE_CHANGE = ((uint64)1 << 40);
const uint64 UOMASK_POPUP_ON = ((uint64)1 << 39);
const uint64 UOMASK_POPUP_OFF = ((uint64)1 << 38);
const uint64 UOMASK_PG_AND_ST_ENABLE = ((uint64)1 << 37);
const uint64 UOMASK_PG_AND_ST_CHANGE = ((uint64)1 << 36);
const uint64 UOMASK_SECONDARY_VIDEO_ENABLE = ((uint64)1 << 35);
const uint64 UOMASK_SECONDARY_VIDEO_CHANGE = ((uint64)1 << 34);
const uint64 UOMASK_SECONDARY_AUDIO_ENABLE = ((uint64)1 << 33);
const uint64 UOMASK_SECONDARY_AUDIO_CHANGE = ((uint64)1 << 32);
const uint64 UOMASK_PIP_PG_AND_ST_ENABLE = ((uint64)1 << 31);
const uint64 UOMASK_PIP_PG_AND_ST_CHANGE = ((uint64)1 << 30);
typedef enum tagMUOMask
{
UOP_MASK_RESERVED1 = 0,
UOP_MASK_RESERVED2,
UOP_MASK_CHAPTER_SEARCH_MASK,
UOP_MASK_TIME_SEARCH_MASK,
UOP_MASK_SKIP_TO_NEXT_POINT_MASK,
UOP_MASK_SKIP_BACK_TO_PREVIOUS_POINT_MASK,
UOP_MASK_PLAY_MASK,
UOP_MASK_STOP_MASK,
UOP_MASK_PAUSE_ON_MASK,
UOP_MASK_RESERVED3,
UOP_MASK_STILL_OFF_MASK,
UOP_MASK_FORWARD_PLAY_MASK,
UOP_MASK_BACKWARD_PLAY_MASK,
UOP_MASK_RESUME_MASK,
UOP_MASK_MOVE_UP_SELECTED_BUTTON_MASK,
UOP_MASK_MOVE_DOWN_SELECTED_BUTTON_MASK,
UOP_MASK_MOVE_LEFT_SELECTED_BUTTON_MASK,
UOP_MASK_MOVE_RIGHT_SELECTED_BUTTON_MASK,
UOP_MASK_SELECT_BUTTON_MASK,
UOP_MASK_ACTIVATE_BUTTON_MASK,
UOP_MASK_SELECT_AND_ACTIVATE_MASK,
UOP_MASK_AUDIO_CHANGE_MASK,
UOP_MASK_PG_TEXTST_CHANGE_MASK,
UOP_MASK_ANGLE_CHANGE_MASK,
UOP_MASK_POPUP_ON_MASK,
UOP_MASK_POPUP_OFF_MASK,
UOP_MASK_PG_TEXTST_ENABLE_DISABLE_MASK
} UOP_MASK_TABLE;
/**
* UOCtrlChapterSearch -- Start playback at the specified chapter number in the
* current movie title.
*
* @param
* chapter_number -- the chapter number at which playback should be started.
*
* @retval
* UOCTRL_SUCCESS if UO is allowed
* UOCTRL_PROHIBITED if UO is prohibited
* UOCTRL_FAILURE if error occurs
*/
UOCTRL_STATUS UOCtrlChapterSearch(uint32 chapter_number)
{
UOCTRL_STATUS tRetStatus = UOCTRL_SUCCESS;
uint64 UO_mask_table = 0;
DBGPRINT(DBG_ON(DBG_TRACE), ("UOCtrlChapterSearch: Enter\n"));
/* Entering playback control critical section */
PlayCtrlTakeSemaphore();
/* Get the UO Mask table */
if (PlayCtrlGetUOPMaskTable(&UO_mask_table) != PLAYCTRL_SUCCESS)
{
DBGPRINT(DBG_ON(DBG_ERROR), ("UOCtrlChapterSearch: Failed to get UO Mask table!\n"));
tRetStatus = UOCTRL_FAILURE;
}
else
{
USHORT NumChapters;
/* Get the number of chapters */
NumChapters = PlayCtrlGetNumberOfMarks(ENTRY_MARK);
/* Check the UO Mask and chapter number */
if ( ( (UO_mask_table & UOMASK_CHAPTER_SEARCH) != 0) || (chapter_number == 0) || (chapter_number > NumChapters) )
{
/* UO is prohibited */
tRetStatus = UOCTRL_PROHIBITED;
#ifdef VDVD_ENABLE_BDJ
BDJ_SystemEvent( bdj_handle, BDJ_UOP_MASKED, (UInt32)(UOP_MASK_CHAPTER_SEARCH_MASK) );
#endif
}
else
{
/* Tell playback control engine to play specified chapter number */
if (PlayCtrlLinkMark(chapter_number, TRUE) != PLAYCTRL_SUCCESS)
{
DBGPRINT(DBG_ON(DBG_ERROR), ("UOCtrlChapterSearch: Failed to link playmark!\n"));
tRetStatus = UOCTRL_FAILURE;
}
}
}
/* Leaving playback control critical section */
PlayCtrlGiveSemaphore();
return (tRetStatus);
}
/**
* UOCtrlTimeSearch -- Start playback at the specified time in the
* current movie title.
*
* @param
* time -- the time (in seconds) at which playback should be started.
*
* @retval
* UOCTRL_SUCCESS if UO is allowed
* UOCTRL_PROHIBITED if UO is prohibited
* UOCTRL_FAILURE if error occurs
*/
UOCTRL_STATUS UOCtrlTimeSearch(uint32 time)
{
uint32 uiPlaylist = 0;
UOCTRL_STATUS tRetStatus = UOCTRL_SUCCESS;
uint64 UO_mask_table = 0;
DBGPRINT(DBG_ON(DBG_TRACE), ("UOCtrlTimeSearch: Enter\n"));
/* Entering playback control critical section */
PlayCtrlTakeSemaphore();
/* Get the UO Mask table */
if (PlayCtrlGetUOPMaskTable(&UO_mask_table) != PLAYCTRL_SUCCESS)
{
DBGPRINT(DBG_ON(DBG_ERROR), ("UOCtrlTimeSearch: Failed to get UO Mask table!\n"));
tRetStatus = UOCTRL_FAILURE;
}
else
{
ULONG title_time;
/* Get the total title time (and convert from 45Khz units to seconds) */
title_time = PlayCtrlGetPlayListDuration() / 45000;
/* Check the UO Mask and time value */
if ( ( (UO_mask_table & UOMASK_TIME_SEARCH) != 0) || (time >= title_time) )
{
/* UO is prohibited */
tRetStatus = UOCTRL_PROHIBITED;
#ifdef VDVD_ENABLE_BDJ
BDJ_SystemEvent( bdj_handle, BDJ_UOP_MASKED, (UInt32)(UOP_MASK_TIME_SEARCH_MASK) );
#endif
}
else
{
/* Get the current playlist ID from the playback control engine */
if (PlayCtrlGetPSR(PLAYCTRL_PSR_PLAYLIST, &uiPlaylist) != PLAYCTRL_SUCCESS)
{
DBGPRINT(DBG_ON(DBG_ERROR), ("UOCtrlTimeSearch: Failed to get current playlist id!\n"));
tRetStatus = UOCTRL_FAILURE;
}
else
{
/* Tell playback control engine to link to specified time */
if (PlayCtrlTimeSearch(time, TRUE) != PLAYCTRL_SUCCESS)
{
DBGPRINT(DBG_ON(DBG_ERROR), ("UOCtrlTimeSearch: Failed to play time!\n"));
tRetStatus = UOCTRL_FAILURE;
}
}
}
}
/* Leaving playback control critical section */
PlayCtrlGiveSemaphore();
return (tRetStatus);
}
/**
* UOCtrlSkipToNextPoint -- Move to next entry mark position in current movie title.
*
* @param
* pOutChapterNumber - used to return the new chapter number.
*
* @retval
* UOCTRL_SUCCESS if UO is allowed
* UOCTRL_PROHIBITED if UO is prohibited
* UOCTRL_FAILURE if error occurs
*/
UOCTRL_STATUS UOCtrlSkipToNextPoint(uint32 *pOutChapterNumber)
{
UOCTRL_STATUS tRetStatus = UOCTRL_SUCCESS;
uint64 UO_mask_table = 0;
DBGPRINT(DBG_ON(DBG_TRACE), ("UOCtrlSkipToNextPoint: Enter\n"));
/* Entering playback control critical section */
PlayCtrlTakeSemaphore();
/* Get the UO Mask table */
if (PlayCtrlGetUOPMaskTable(&UO_mask_table) != PLAYCTRL_SUCCESS)
{
DBGPRINT(DBG_ON(DBG_ERROR), ("UOCtrlSkipToNextPoint: Failed to get UO Mask table!\n"));
tRetStatus = UOCTRL_FAILURE;
}
else
{
/* Check the UO Mask */
if ( (UO_mask_table & UOMASK_SKIP_TO_NEXT_POINT) != 0)
{
/* UO is prohibited */
tRetStatus = UOCTRL_PROHIBITED;
#ifdef VDVD_ENABLE_BDJ
BDJ_SystemEvent( bdj_handle, BDJ_UOP_MASKED, (UInt32)(UOP_MASK_SKIP_TO_NEXT_POINT_MASK) );
#endif
}
else
{
/* Tell playback control engine to skip to next play mark */
if (PlayCtrlSkipToNextPoint(pOutChapterNumber) != PLAYCTRL_SUCCESS)
{
tRetStatus = UOCTRL_PROHIBITED;
#ifdef VDVD_ENABLE_BDJ
BDJ_SystemEvent( bdj_handle, BDJ_UOP_MASKED, (UInt32)(UOP_MASK_SKIP_TO_NEXT_POINT_MASK) );
#endif
}
}
}
/* Leaving playback control critical section */
PlayCtrlGiveSemaphore();
return (tRetStatus);
}
/**
* UOCtrlSkipToPrevPoint -- Move to previous entry mark position in current movie title.
*
* @param
* pOutChapterNumber - used to return the new chapter number.
*
* @retval
* UOCTRL_SUCCESS if UO is allowed
* UOCTRL_PROHIBITED if UO is prohibited
* UOCTRL_FAILURE if error occurs
*/
UOCTRL_STATUS UOCtrlSkipToPrevPoint(uint32 *pOutChapterNumber)
{
UOCTRL_STATUS tRetStatus = UOCTRL_SUCCESS;
uint64 UO_mask_table = 0;
DBGPRINT(DBG_ON(DBG_TRACE), ("UOCtrlSkipToPrevPoint: Enter\n"));
/* Entering playback control critical section */
PlayCtrlTakeSemaphore();
/* Get the UO Mask table */
if (PlayCtrlGetUOPMaskTable(&UO_mask_table) != PLAYCTRL_SUCCESS)
{
DBGPRINT(DBG_ON(DBG_ERROR), ("UOCtrlSkipToPrevPoint: Failed to get UO Mask table!\n"));
tRetStatus = UOCTRL_FAILURE;
}
else
{
/* Check the UO Mask */
if ( (UO_mask_table & UOMASK_SKIP_TO_PREV_POINT) != 0)
{
/* UO is prohibited */
tRetStatus = UOCTRL_PROHIBITED;
#ifdef VDVD_ENABLE_BDJ
BDJ_SystemEvent( bdj_handle, BDJ_UOP_MASKED, (UInt32)(UOP_MASK_SKIP_BACK_TO_PREVIOUS_POINT_MASK) );
#endif
}
else
{
/* Tell playback control engine to skip to previous play mark */
if (PlayCtrlSkipToPrevPoint(pOutChapterNumber) != PLAYCTRL_SUCCESS)
{
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -