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

📄 modmgr.cpp

📁 这是DVD中伺服部分的核心代码
💻 CPP
📖 第 1 页 / 共 5 页
字号:
    /* Check that message queue is created */
    if (hModMgr->MsgQID == 0)
    {
        DBGPRINT(DBG_ON(DBG_ERROR), ("ModMgrAddHDMVEvent: Msg queue not created!\n"));
        return (MODMGR_FAILURE);
    }

    /* Send message to the task */
    msg.tMsgType        = MODMGR_MSG_PROCESS_HDMV_EVENT;
    msg.cmd             = cmd;
    msg.data            = data;
    if (OS_MsgQSend(hModMgr->MsgQID, (char *)&msg, sizeof(MODMGR_MESSAGE), OS_NO_WAIT, OS_MSG_PRI_NORMAL) != OS_OK)
    {
        DBGPRINT(DBG_ON(DBG_ERROR), ("ModMgrAddHDMVEvent: Failure sending message!\n"));
        return (MODMGR_FAILURE);
    }

    return (MODMGR_SUCCESS);
}

/**
 * ModMgrAddBDJEvent -- Send a BDJ Event to the Module Manager task for processing.
 *
 * @param
 *      cmd -- specifies the command to execute
 *      data -- optional parameter passed with command
 *
 * @retval
 *      MODMGR_SUCCESS if successful
 *      MODMGR_FAILURE if not successful
 */
MODMGR_STATUS  ModMgrAddBDJEvent(MODMGR_COMMAND cmd, int data)
{
    MODMGR_MESSAGE msg;

    if (hModMgr == NULL)
    {
        DBGPRINT(DBG_ON(DBG_ERROR), ("ModMgrAddBDJEvent: Module Manager not created!\n"));
        return (MODMGR_FAILURE);
    }

    /* Check that message queue is created */
    if (hModMgr->MsgQID == 0)
    {
        DBGPRINT(DBG_ON(DBG_ERROR), ("ModMgrAddBDJEvent: Msg queue not created!\n"));
        return (MODMGR_FAILURE);
    }

    /* Send message to the task */
    msg.tMsgType        = MODMGR_MSG_PROCESS_BDJ_EVENT;
    msg.cmd             = cmd;
    msg.data            = data;
    if (OS_MsgQSend(hModMgr->MsgQID, (char *)&msg, sizeof(MODMGR_MESSAGE), OS_NO_WAIT, OS_MSG_PRI_NORMAL) != OS_OK)
    {
        DBGPRINT(DBG_ON(DBG_ERROR), ("ModMgrAddBDJEvent: Failure sending message!\n"));
        return (MODMGR_FAILURE);
    }

    return (MODMGR_SUCCESS);
}

/**
 * ModMgrConfigParentalLevel -- Set the player register for parental level
 *
 * @param
 *      parental -- parental level to set player register to
 *
 * @retval
 *      MODMGR_SUCCESS if successful
 *      MODMGR_FAILURE if not successful
 */
MODMGR_STATUS   ModMgrConfigParentalLevel(int parental)
{
    MODMGR_STATUS tStatus = MODMGR_SUCCESS;

    /* If module manager is created, set parental level through playback control engine */
    if (hModMgr == NULL)
    {
        DBGPRINT(DBG_ON(DBG_ERROR), ("ModMgrConfigParentalLevel: Module Manager not created!\n"));
        tStatus = MODMGR_FAILURE;
    }
    else
    {
        /* Set the player status register for parental level */
        if (PlayCtrlSetPSR(PLAYCTRL_PSR_PARENTAL, (ULONG)parental) != PLAYCTRL_SUCCESS)
        {
            DBGPRINT(DBG_ON(DBG_ERROR), ("ModMgrConfigParentalLevel: Failed to set PSR!\n"));
            tStatus = MODMGR_FAILURE;
        }
    }

    return (tStatus);
}

/**
 * ModMgrConfigAudioLanguage -- Set the player register for audio language
 *
 * @param
 *      language -- audio language to set player register to
 *
 * @retval
 *      MODMGR_SUCCESS if successful
 *      MODMGR_FAILURE if not successful
 */
MODMGR_STATUS   ModMgrConfigAudioLanguage(int language)
{
    MODMGR_STATUS tStatus = MODMGR_SUCCESS;

    /* If module manager is created, set audio language through playback control engine */
    if (hModMgr == NULL)
    {
        DBGPRINT(DBG_ON(DBG_ERROR), ("ModMgrConfigAudioLanguage: Module Manager not created!\n"));
        tStatus = MODMGR_FAILURE;
    }
    else
    {
        /* Set the player status register for audio language */
        if (PlayCtrlSetAudioLanguage(language) != PLAYCTRL_SUCCESS)
        {
            DBGPRINT(DBG_ON(DBG_ERROR), ("ModMgrConfigAudioLanguage: Failed to set PSR!\n"));
            tStatus = MODMGR_FAILURE;
        }
    }

    return (tStatus);
}

/**
 * ModMgrConfigPGandSTLanguage -- Set the player register for pg and subtitle language
 *
 * @param
 *      language -- pg and st language to set player register to
 *
 * @retval
 *      MODMGR_SUCCESS if successful
 *      MODMGR_FAILURE if not successful
 */
MODMGR_STATUS   ModMgrConfigPGandSTLanguage(int language)
{
    MODMGR_STATUS tStatus = MODMGR_SUCCESS;

    /* If module manager is created, set pg and st language through playback control engine */
    if (hModMgr == NULL)
    {
        DBGPRINT(DBG_ON(DBG_ERROR), ("ModMgrConfigPGandSTLanguage: Module Manager not created!\n"));
        tStatus = MODMGR_FAILURE;
    }
    else
    {
        /* Set the player status register for pg and st language */
        if (PlayCtrlSetSubtitleLanguage(language) != PLAYCTRL_SUCCESS)
        {
            DBGPRINT(DBG_ON(DBG_ERROR), ("ModMgrConfigPGandSTLanguage: Failed to set PSR!\n"));
            tStatus = MODMGR_FAILURE;
        }
    }

    return (tStatus);
}

/**
 * ModMgrConfigMenuLanguage -- Set the player register for menu language
 *
 * @param
 *      language -- menu language to set player register to
 *
 * @retval
 *      MODMGR_SUCCESS if successful
 *      MODMGR_FAILURE if not successful
 */
MODMGR_STATUS   ModMgrConfigMenuLanguage(int language)
{
    MODMGR_STATUS tStatus = MODMGR_SUCCESS;

    /* If module manager is created, set menu language through playback control engine */
    if (hModMgr == NULL)
    {
        DBGPRINT(DBG_ON(DBG_ERROR), ("ModMgrConfigMenuLanguage: Module Manager not created!\n"));
        tStatus = MODMGR_FAILURE;
    }
    else
    {
        /* Set the player status register for menu language */
        if (PlayCtrlSetMenuLanguage(language) != PLAYCTRL_SUCCESS)
        {
            DBGPRINT(DBG_ON(DBG_ERROR), ("ModMgrConfigMenuLanguage: Failed to set PSR!\n"));
            tStatus = MODMGR_FAILURE;
        }
    }

    return (tStatus);
}

/**
 * ModMgrConfigCountryCode -- Set the player register for country code
 *
 * @param
 *      country_code -- country code to set player register to
 *
 * @retval
 *      MODMGR_SUCCESS if successful
 *      MODMGR_FAILURE if not successful
 */
MODMGR_STATUS   ModMgrConfigCountryCode(int country_code)
{
    MODMGR_STATUS tStatus = MODMGR_SUCCESS;

    /* If module manager is created, set country code through playback control engine */
    if (hModMgr == NULL)
    {
        DBGPRINT(DBG_ON(DBG_ERROR), ("ModMgrConfigCountryCode: Module Manager not created!\n"));
        tStatus = MODMGR_FAILURE;
    }
    else
    {
        /* Set the player status register for country code */
        if (PlayCtrlSetPSR(PLAYCTRL_PSR_COUNTRY, (ULONG)country_code) != PLAYCTRL_SUCCESS)
        {
            DBGPRINT(DBG_ON(DBG_ERROR), ("ModMgrConfigCountryCode: Failed to set PSR!\n"));
            tStatus = MODMGR_FAILURE;
        }
    }

    return (tStatus);
}

/**
 * ModMgrSetAspectRatio -- Set the player preference for aspect ratio
 *
 * @param
 *      aspect_ratio -- players aspect ratio
 *
 * @retval
 *      MODMGR_SUCCESS if successful
 *      MODMGR_FAILURE if not successful
 */
MODMGR_STATUS ModMgrSetAspectRatio(VDVD_ASPECT_RATIO aspect_ratio)
{
    MODMGR_STATUS tStatus = MODMGR_SUCCESS;

    if (hModMgr == NULL)
    {
        DBGPRINT(DBG_ON(DBG_ERROR), ("ModMgrSetAspectRatio: Module Manager not created!\n"));
        tStatus = MODMGR_FAILURE;
    }
    else
    {
        /* Set the players aspect ratio */
        PlayCtrlVPCSetAspectRatio(aspect_ratio);
    }

    return (tStatus);
}

/**
 * ModMgrSetVideoFormat -- Set the player preference for video format
 *
 * @param
 *      video_format -- players aspect ratio
 *
 * @retval
 *      MODMGR_SUCCESS if successful
 *      MODMGR_FAILURE if not successful
 */
MODMGR_STATUS ModMgrSetVideoFormat(VDVD_VIDEO_FORMAT video_format)
{
    MODMGR_STATUS tStatus = MODMGR_SUCCESS;

    if (hModMgr == NULL)
    {
        DBGPRINT(DBG_ON(DBG_ERROR), ("ModMgrSetVideoFormat: Module Manager not created!\n"));
        tStatus = MODMGR_FAILURE;
    }
    else
    {
        /* Set the players video format */
        PlayCtrlVPCSetVideoFormat(video_format);
    }

    return (tStatus);
}

/**
 * ModMgrConfigAudioCapability -- Set the player register for audio capability
 *
 * @param
 *      capability -- audio capability to set player register to
 *
 * @retval
 *      MODMGR_SUCCESS if successful
 *      MODMGR_FAILURE if not successful
 */
MODMGR_STATUS   ModMgrConfigAudioCapability(int capability)
{
    MODMGR_STATUS tStatus = MODMGR_SUCCESS;

    /* If module manager is created, set audio capability through playback control engine */
    if (hModMgr == NULL)
    {
        DBGPRINT(DBG_ON(DBG_ERROR), ("ModMgrConfigAudioCapability: Module Manager not created!\n"));
        tStatus = MODMGR_FAILURE;
    }
    else
    {
        /* Set the player status register for audio capability */
        if (PlayCtrlSetPSR(PLAYCTRL_PSR_AUDIO_CAPABILITY, (ULONG)capability) != PLAYCTRL_SUCCESS)
        {
            DBGPRINT(DBG_ON(DBG_ERROR), ("ModMgrConfigAudioCapability: Failed to set PSR!\n"));
            tStatus = MODMGR_FAILURE;
        }
    }

    return (tStatus);
}

/**
 * ModMgrConfigTextSTCapability -- Set the player register for text subtitle capability
 *
 * @param
 *      capability -- text subtitle capability to set player register to
 *
 * @retval
 *      MODMGR_SUCCESS if successful
 *      MODMGR_FAILURE if not successful
 */
MODMGR_STATUS   ModMgrConfigTextSTCapability(int capability)
{
    MODMGR_STATUS tStatus = MODMGR_SUCCESS;

    /* If module manager is created, set text subtitle capability through playback control engine */
    if (hModMgr == NULL)
    {
        DBGPRINT(DBG_ON(DBG_ERROR), ("ModMgrConfigTextSTCapability: Module Manager not created!\n"));
        tStatus = MODMGR_FAILURE;
    }
    else
    {
        /* Set the player status register for text subtitle capability */
        if (PlayCtrlSetPSR(PLAYCTRL_PSR_TEXT_CAPABILITY, (ULONG)capability) != PLAYCTRL_SUCCESS)
        {
            DBGPRINT(DBG_ON(DBG_ERROR), ("ModMgrConfigTextSTCapability: Failed to set PSR!\n"));
            tStatus = MODMGR_FAILURE;
        }
    }

    return (tStatus);
}

/**
 * ModMgrConfigPlayerVersion -- Set the player register for player version
 *
 * @param
 *      player_version -- player version to set player register to
 *
 * @retval
 *      MODMGR_SUCCESS if successful
 *      MODMGR_FAILURE if not successful
 */
MODMGR_STATUS   ModMgrConfigPlayerVersion(int player_version)
{
    MODMGR_STATUS tStatus = MODMGR_SUCCESS;

    /* If module manager is created, set player version through playback control engine */
    if (hModMgr == NULL)
    {
        DBGPRINT(DBG_ON(DBG_ERROR), ("ModMgrConfigPlayerVersion: Module Manager not created!\n"));
        tStatus = MODMGR_FAILURE;
    }
    else
    {
        /* Set the player status register for player version */
        if (PlayCtrlSetPSR(PLAYCTRL_PSR_PROFILE_VERSION, (ULONG)player_version) != PLAYCTRL_SUCCESS)
        {
            DBGPRINT(DBG_ON(DBG_ERROR), ("ModMgrConfigPlayerVersion: Failed to set PSR!\n"));
            tStatus = MODMGR_FAILURE;
        }
    }

    return (tStatus);
}

/**
 * ModMgrConfigPSRValue -- Set the specified PSR with specified value
 *
 * @param
 *      reg_number -- PSR register number
 *      value -- value to set specified register to
 *
 * @retval
 *      MODMGR_SUCCESS if successful
 *      MODMGR_FAILURE if not successful
 */
MODMGR_STATUS   ModMgrConfigPSRValue(int reg_number, int value)
{
    MODMGR_STATUS tStatus = MODMGR_SUCCESS;

    /* If module manager is created, set PSR value through playback control engine */
    if (hModMgr == NULL)
    {
        DBGPRINT(DBG_ON(DBG_ERROR), ("ModMgrConfigPSRValue: Module Manager not created!\n"));
        tStatus = MODMGR_FAILURE;
    }
    else
    {
        /* Set the player status register */
        if (PlayCtrlSetPSR(reg_number, (ULONG)value) != PLAYCTRL_SUCCESS)
        {
            DBGPRINT(DBG_ON(DBG_ERROR), ("ModMgrConfigPSRValue: Failed to set PSR!\n"));
            tStatus = MODMGR_FAILURE;
        }
    }

    return (tStatus);
}

/**
 * ModMgrGetLocationHandleSize -- Get the size of the location handle passed into ModMgrGetLocation().
 *
 * @param
 *      none
 *
 * @retval
 *      size of location handle
 *
 * @remarks
 *      This is implemented for HDMV only.
 */
ULONG  ModMgrGetLocationHandleSize(void)
{
    return (sizeof(MODMGR_PLAY_LOCATION));
}

/**
 * ModMgrGetLocation -- Get the current play location
 *
 * @param
 *      pvLocation -- location handle
 *      uiSize -- size of buffer pointed to by location handle
 *
 * @retval
 *      MODMGR_STATUS
 *
 * @remarks
 *      This is implemented for HDMV only.
 */
MODMGR_STATUS  ModMgrGetLocation(PVOID pvLocation, uint32 uiSize)
{
    MODMGR_PLAY_LOCATION    *pPlayLocation = (MODMGR_PLAY_LOCATION *)pvLocation;
    ULONG                   ulTitle;
    uint32                  uiPlayitemID;

⌨️ 快捷键说明

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