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

📄 pe_iconfig.cpp

📁 这是DVD中伺服部分的核心代码
💻 CPP
📖 第 1 页 / 共 5 页
字号:
                    
                case ASPECT_RATIO_16X9_WINDOWBOX:
                case ASPECT_RATIO_16X9:                  
                    wss = 0x2;     
                break;
                    
                default:
                    wss = 0x3;     
                break;
            }
        break;
    }

    // cgms    = ((PEHANDLE *)handle)->iConfigure->CGMS;
    // aps     = ((PEHANDLE *)handle)->iConfigure->Macrovision;;

    /* Set the SPDIF Copyright from CGMS */
    switch (((PEHANDLE *)handle)->iConfigure->CGMS) {
    case 0:
        // copy_state = copy always
        break;
    case 1:
        // copy_state = no more copies
        break;
    case 2:
        // copy_state = copy once
        break;
    case 3:
    default:
        // copy_state = never copy
        break;
    }


    // SDK TODO: configure spdif with copy settings

    //  Set vertical blanking interval (wss,cgms,macrovision) on primary display
    // wss
    // ((PEHANDLE *)handle)->iConfigure->CGMS
    // ((PEHANDLE *)handle)->iConfigure->Macrovision


#ifdef SECONDARY_DISPLAY_SUPPORT

    //  Set vertical blanking interval (wss,cgms,macrovision) on secondary display
    // wss
    // ((PEHANDLE *)handle)->iConfigure->CGMS
    // ((PEHANDLE *)handle)->iConfigure->Macrovision

#endif
    
    return PE_SUCCESS;
}

/**
 * Calls the platform api to handle the dot_val (Digital Only Token) value.
 * If the DOT is set, we need to disable the various analog outputs and only
 * enable the digital outputs. However, if a disk is entered that is not DOT, 
 * (i.e. a disk is entered that has DOT and then another disk is entered that 
 * does not have DOT) we have to re-enable the analog outputs.
 *
 * @param handle [IN] iConfigure handle.
 * @param dotPresent [IN] is dot_val true or false
 *
 * @return PE_STATUS - Error code.
 *
 */
PE_STATUS PEiConfigureApplyDOT(PE_HANDLE handle, BOOLEAN dot)
{
    DBGPRINT(DBG_ON(DBG_TRACE), ("PEiConfigureApplyDOT, dot=%s\n", (dot)?"TRUE":"FALSE"));
    if (!handle)
        return (PE_INVALID_HANDLE);

           
    /* If the Digital Only Token Tag has changed, we need to signal to the 
     * PEiConfigureSetVideoOutput to enable/disable the analog outputs
     * TODO: no longer call the Get/SetVideoOutput() */
     
    if (dotPresent != dot)
    {
        PE_ICONFIGURE_VIDEO_FORMAT format;
        PEiConfigureGetVideoOutput(handle, &format);
        dotPresent = dot;
        ApplyEvent = TRUE;
        PEiConfigureSetVideoOutput(handle, format);
    }
    return PE_SUCCESS;
}


/**
 * Apply the ict_val (Image Constraint Token) in the decode api
 *
 * @param handle [IN] iConfigure handle.
 * @param ictPresent [IN] is ict_val true or false
 *
 * @return PE_STATUS - Error code.
 *
 */
PE_STATUS PEiConfigureSetICT(PE_HANDLE handle, BOOLEAN ict)
{
    if (!handle)
        return (PE_INVALID_HANDLE);

    DBGPRINT(DBG_ON(DBG_TRACE), ("PEiConfigureSetICT, ict=%s\n", (ict)?"PRESENT":"NOT PRESENT"));    
    
    if (ictPresent != ict)
    {
        ictPresent = ict;


    }    
    return PE_SUCCESS;
}

/**
 * Get the ict_val (Image Constraint Token) 
 *
 * @param handle [IN] iConfigure handle.
 * @param ictPresent [IN] is ict_val true or false
 *
 * @return PE_STATUS - Error code.
 *
 */
PE_STATUS PEiConfigureGetICT(PE_HANDLE handle, UBYTE *ict)
{
    if (!handle)
        return (PE_INVALID_HANDLE);

    DBGPRINT(DBG_ON(DBG_TRACE), ("PEiConfigureSetICT, ict=%s\n", (ict)?"PRESENT":"NOT PRESENT"));    

    *ict = ictPresent?1:0;
    
    return PE_SUCCESS;
}


/**
 * Sets the Macrovision type.
 *
 * @param handle [IN] iConfigure handle.
 * @param usAPSMode [IN] The lower two bits give the ASP bits from PCI_GI.
 *
 * @return PE_STATUS - Error code.
 *
 * @notes usAPSMode was left as USHORT because the VOBU_CAT field is 16 bits.
 */
PE_STATUS PEiConfigureSetVideoMacrovision(PE_HANDLE handle, USHORT usAPSMode)
{
    MACROVISION_TYPE    macrovision_type;
    PE_STATUS           status;

    DBGPRINT(DBG_ON(DBG_TRACE), ("PEiConfigureSetVideoMacrovision %d\n", usAPSMode));

    if (handle == NULL)
    {
        return (PE_INVALID_HANDLE);
    }

    /* Macrovision Modes 2 and 3 are reserved in 50 Hz systems, see DVDSpec Part3, 4.4.1 */
    if ((VIDEO_FORMAT_PAL == ((PEHANDLE *)handle)->iConfigure->VideoFormat) && (usAPSMode & 0x0020))
    {
        return (PE_FAILURE);
    }

    /*
     * DVD Specifications                                     platform settings
     * APS Code  Macrovision Mode  Mode Description           Mode enumeration                    Description
     * 00        0                 Macrovision off            BVDC_MacrovisionType_eNoProtection  No copy protection
     * 01        1                 AGC on                     BVDC_MacrovisionType_eAgcOnly       AGC only
     * 10        2                 AGC + 2-line color stripe  BVDC_MacrovisionType_eAgc2Lines     AGC + 2 Line color stripe
     * 11        3                 AGC + 4-line color stripe  BVDC_MacrovisionType_eAgc4Lines     AGC + 4 Line color stripe
     */

     /* TODO-SDK - Set-up the Macrovision type on the video outputs. */
    switch (usAPSMode)
    {
    case 0:
        macrovision_type = MACROVISION_TYPE_NONE;
        status = PE_SUCCESS;
        break;

    case 1:
        macrovision_type = MACROVISION_TYPE_AGC_ONLY;
        status = PE_SUCCESS;
        break;

    case 2:
        macrovision_type = MACROVISION_TYPE_AGC_2LINES;
        status = PE_SUCCESS;
        break;

    case 3:
        macrovision_type = MACROVISION_TYPE_AGC_4LINES;
        status = PE_SUCCESS;
        break;

    default:
        macrovision_type = MACROVISION_TYPE_NONE;
        status = PE_FAILURE;
        break;
    }

    if (PE_SUCCESS == status)
    {
        g_macrovision = macrovision_type;


        /* Re-build the Line 20 information with new Macrovision/CGMS/WSS
         * to conform to IEC-61880*/
        PEiConfigureUpdateVBI(handle);
    }

    ((PEHANDLE *)handle)->iConfigure->Macrovision = usAPSMode;

    return (status);

} /* end PEiConfigureSetVideoMacrovision() */

/**
 * Returns the current Macrovision state.
 *
 * @param handle - iConfigure handle.
 * @param pusAPSMode - Pointer to returned current video mute state.
 *
 * @return PE_STATUS Error code.
 */
PE_STATUS PEiConfigureGetVideoMacrovision(PE_HANDLE handle, USHORT *pusAPSMode)
{
    PE_STATUS               status;


    if (handle == NULL)
    {
        return (PE_INVALID_HANDLE);
    }

    /* Get the current display settings */

/* If there are two displays, macrovision will be always set on display1 (SD
 * display) but this is not necessary true for the HD display since Macrovision is only defined
 * for video resolutions NTSC, PAL, SECAM and 480p */


    /*
     * DVD Specifications                                     
     * APS Code  Macrovision Mode  Mode Description           
     * 00        0                 Macrovision off            
     * 01        1                 AGC on                     
     * 10        2                 AGC + 2-line color stripe  
     * 11        3                 AGC + 4-line color stripe  
     */

    /* TODO-SDK - Get the current Macrovision type on the video outputs. */
    g_macrovision = MACROVISION_TYPE_NONE;

    switch ( g_macrovision )
    {
    case MACROVISION_TYPE_NONE:
        *pusAPSMode = 0;
        status = PE_SUCCESS;
        break;

    case MACROVISION_TYPE_AGC_ONLY:
        *pusAPSMode = 1;
        status = PE_SUCCESS;
        break;

    case MACROVISION_TYPE_AGC_2LINES:
        *pusAPSMode = 2;
        status = PE_SUCCESS;
        break;

    case MACROVISION_TYPE_AGC_4LINES:
        *pusAPSMode = 3;
        status = PE_SUCCESS;
        break;

    default:
        *pusAPSMode = 0;
        status = PE_FAILURE;
        break;
    }

    /* Added to ensure that the PE's version of macrovision is the same as 
     * the decoder's version */
    ((PEHANDLE *)handle)->iConfigure->Macrovision = *pusAPSMode;
    DBGPRINT(DBG_ON(DBG_TRACE), ("PEiConfigureGetVideoMacrovision %d\n", *pusAPSMode));

    return (status);

} /* end PEiConfigureGetVideoMacrovision() */

/**
 * Sets the video output to display either a black or colorbar screen.
 *
 * @param handle [IN] iConfigure handle.
 * @param pcvmVideoMute [IN] BOOLEAN to enable/disable video mute.
 *
 * @return PE_STATUS - Error code.
 */
PE_STATUS PEiConfigureSetVideoMute(PE_HANDLE handle, PE_ICONFIGURE_VIDEO_MUTE VideoMute)
{
    PE_STATUS                     status;

    DBGPRINT(DBG_ON(DBG_TRACE), ("PEiConfigureSetVideoMute\n"));

    if (handle == NULL)
    {
        return (PE_INVALID_HANDLE);
    }

    switch (VideoMute)
    {
    case VIDEO_MUTE_OFF:
        status = PE_SUCCESS;
        break;

    case VIDEO_MUTE_BLACK_SCREEN:
    case VIDEO_MUTE_BLUE_SCREEN:
        status = PE_SUCCESS;
        break;

    default:
        status = PE_FAILURE;
        break;
    }

    if (status == PE_SUCCESS)
    {
        ((PEHANDLE *)handle)->iConfigure->VideoMute = VideoMute;
    }

    return (status);
}

/**
 * Returns the current video output mute state.
 *
 * @param handle     - iConfigure handle.
 * @param pVideoMute - Pointer to returned current video mute state.
 *
 * @return PE_STATUS Error code.
 */
PE_STATUS PEiConfigureGetVideoMute(PE_HANDLE handle, PE_ICONFIGURE_VIDEO_MUTE *pVideoMute)
{
    if (handle == NULL)
    {
        return (PE_INVALID_HANDLE);
    }

    if (pVideoMute != NULL)
    {
        *pVideoMute = ((PEHANDLE *)handle)->iConfigure->VideoMute;
        return (PE_SUCCESS);
    }
    else
    {
        return (PE_FAILURE);
    }
}

/**
 * Performs scaling on the video output frame to satisfy the given
 * video parameters to fit the required video output format.
 *
 * @param handle      - iConfigure handle.
 * @param pZoomParams - Pointer to zoom parameters.
 *
 * @return PE_STATUS Error code.
 */
PE_STATUS PEiConfigureZoom(PE_HANDLE handle, PE_ICONFIGURE_ZOOM_PARAMETERS *pZoomParams)
{

    return (PE_NOT_IMPLEMENTED);
}

/**
 * Returns the current zoom parameters.
 *
 * @param handle   [IN] iConfigure handle.
 * @param pZoomParams [IN] Pointer to returned zoom parameters.
 *
 * @return PE_STATUS - Error code.
 */
PE_STATUS PEiConfigureGetZoomParameters(PE_HANDLE handle, PE_ICONFIGURE_ZOOM_PARAMETERS *pZoomParams)
{


    return ( PE_NOT_IMPLEMENTED );
}

/**
 * @notes
 */
PE_STATUS PEiConfigureGetActiveVideoArea(BOOLEAN primary, unsigned int *uiLeft, unsigned int *uiTop,
    unsigned int *uiRight, unsigned int *uiBottom)
{
    PE_STATUS   status = PE_SUCCESS;

    if (TRUE != primary)
    {
        status = PE_NOT_IMPLEMENTED;
        goto err_out;
    }

    if ( (uiLeft == NULL) || (uiTop == NULL) || (uiRight == NULL) || (uiBottom == NULL) )
    {
        status = PE_NULL_POINTER;
        goto err_out;
    }

    /* SDK TODO: get active video area */
    *uiLeft   = 0;      //x;
    *uiTop    = 0;      //y;
    *uiRight  = 1920;   //x + width;
    *uiBottom = 1080;   //y + height;
    status    = PE_SUCCESS;

err_out:
    return (status);
}

/**
 *
 */
PE_STATUS PEiConfigureGetActiveVideoAreaOnScreen(BOOLEAN primary, unsigned int *uiLeft, unsigned int *uiTop,
    unsigned int *uiRight, unsigned int *uiBottom)
{
    PE_STATUS  status;

    if (TRUE != primary)
    {
        status = PE_NOT_IMPLEMENTED;
        goto err_out;
    }

    if ( (uiLeft == NULL) || (uiTop == NULL) || (uiRight == NULL) || (uiBottom == NULL) )
    {
        status = PE_NULL_POINTER;
        goto err_out;
    }

    /* SDK TODO: Get active video area on screen */

    *uiLeft   = 0;      //x;
    *uiTop    = 0;      //y;
    *uiRight  = 1920;   //x + width;
    *uiBottom = 1080;   //y + height;
    status    = PE_SUCCESS;

err_out:
    return (status);
}

/**
 *
 */
PE_STATUS PEiConfigureGetClipRegion(BOOLEAN primary, unsigned int *uiLeft, unsigned int *uiTop,
    unsigned int *uiRight, unsigned int *uiBottom)
{
    PE_STATUS                   status;

    if (TRUE != primary)
    {
        status = PE_NOT_IMPLEMENTED;
        goto err_out;
    }

    if ( (uiLeft == NULL) || (uiTop == NULL) || (uiRight == NULL) || (uiBottom == NULL) )
    {
        status = PE_NULL_POINTER;
        goto err_out;
    }

    /* SDK TODO: get clip region */
    *uiLeft   = 0; //x
    *uiTop    = 0; //y
    *uiRight  = 0; //x + width;
    *uiBottom = 0; //y + height;
    status    = PE_SUCCESS;

err_out:
    return (status);
}

/**

⌨️ 快捷键说明

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