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

📄 ddpdb.c

📁 linux下的一款播放器
💻 C
📖 第 1 页 / 共 4 页
字号:
        0 /* this driver has a bug in 8-bit mode!!! */},        /* blits are not available anyway: */        {0, 0, 0, 0, 0}    },    {        VER_PLATFORM_WIN32_WINDOWS,        {"S3 Inc. Trio64V+", "s3_2.drv", 0x1083c,0x4000a,        0x5333, 0x8811, 0x0, 0x0,        {0x0,0x0,0x0,{0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0}}},        /* disable overlays: */        {0, 0, 0, 0, 0},        /* RGB blits only: */        {F(CID_RGB32),         F(CID_RGB24),         F(CID_RGB565),         F(CID_RGB555),         F(CID_RGB8)}    },    {        VER_PLATFORM_WIN32_WINDOWS,        {"Chips And Technologies, Accelerator (new)", "chipsnd.drv",        0x3b6,0x40013,0x102c, 0xe0, 0x0, 0x0, {0x0,0x0,0x0,{0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0}}},        /* do NOT use overlays !!!: */        {0, 0, 0, 0, 0},        /* blits (use YUY2s & matching RGBs only): */        {F(CID_YUY2) + F(CID_RGB32),         F(CID_YUY2) + F(CID_RGB24),         F(CID_YUY2) + F(CID_RGB565),         F(CID_YUY2) + F(CID_RGB555),         F(CID_YUY2) + F(CID_RGB8)}    },    {        VER_PLATFORM_WIN32_WINDOWS,        {"Cirrus Logic 7548 PCI", "cirrusmm.drv", 0x7ee,0x40003,         0x1013, 0x38, 0x0, 0x0,         {0x0,0x0,0x0,{0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0}}},        /* does not have overlays...: */        {0, 0, 0, 0, 0},        /* RGB blits only: */        {F(CID_RGB32),         F(CID_RGB24),         F(CID_RGB565),         F(CID_RGB555),         F(CID_RGB8)}    },    /* NeoMagic controllers (widely used in Dell laptops): */    {        VER_PLATFORM_WIN32_WINDOWS,        {"NeoMagic MagicGraph 128XD", "NmgcDD.dll", 0x10006,0x4000a,        0x10c8, 0x4, 0x751028, 0x0,        {0xd7b71e28,0x4344,0x11cf,{0x9e,0x73,0x74,0x20,0xa5,0xc2,0xc9,0x35}}},        /* overlays (use YUY2 only): */        {F(CID_YUY2),        F(CID_YUY2),        F(CID_YUY2),        F(CID_YUY2),        F(CID_YUY2)},        /* don't use BLITS!!!: */        {0, 0, 0, 0, 0}    },    {        VER_PLATFORM_WIN32_WINDOWS,        {"NeoMagic MagicGraph 128XD", "Nmgc.drv",        0x10004,0x4000a, 0x10c8, 0x4, 0x0, 0x0, {0,0,0,{0,0,0,0,0,0,0,0}}},        /* overlays (use YUY2 only): */        {F(CID_YUY2),        F(CID_YUY2),        F(CID_YUY2),        F(CID_YUY2),        F(CID_YUY2)},        /* don't use BLITS!!!: */        {0, 0, 0, 0, 0}    },    {        VER_PLATFORM_WIN32_WINDOWS,        {"NeoMagic MagicGraph 128 PCI", "nmx.drv",        0x5920000,0x40003, 0x0, 0x0, 0x0, 0x0, {0,0,0,{0,0,0,0,0,0,0,0}}},        /* overlays (use YUY2 only): */        {F(CID_YUY2),        F(CID_YUY2),        F(CID_YUY2),        F(CID_YUY2),        F(CID_YUY2)},        /* don't use BLITS!!!: */        {0, 0, 0, 0, 0}    },    {        VER_PLATFORM_WIN32_WINDOWS,        {"Diamond Stealth II G460",         "s2g432le.dll",         0x10542,0x4000a,         0x8086, 0x7800, 0x0, 0x0,         {0x0,0x0,0x0,{0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0}}},        /* overlays (use YUY2 only): */        {F(CID_YUY2),        F(CID_YUY2),        F(CID_YUY2),        F(CID_YUY2),        F(CID_YUY2)},        /* blits (use matching RGBs only): */        {F(CID_RGB32),        F(CID_RGB24),        F(CID_RGB565),        F(CID_RGB555),        F(CID_RGB8)}    },    {        VER_PLATFORM_WIN32_WINDOWS,        {"Diamond Stealth II G460",         "s2g432le.dll",         0x10542,0x4000a,         0x8086, 0x7800, 0x1001092, 0x21,         {0xd7b78e66,0x3b40,0x11cf,{0x60,0x76,0x1,0x21,0x84,0xc2,0xc9,0x35}}},        /* don't use overlays: */        {0, 0, 0, 0, 0},        /* blits (use matching RGBs only): */        {F(CID_RGB32),        F(CID_RGB24),        F(CID_RGB565),        F(CID_RGB555),        F(CID_RGB8)}    },    {	VER_PLATFORM_WIN32_WINDOWS,	{"NeoMagic MagicMedia 256AV",	 "NmgcDD5.dll",	 0x11451,0x4000a,	 0x10c8, 0x5, 0x8f1028, 0x20, 	{0xd7b71e28,0x4345,0x11cf,{0xc9,0x67,0x8e,0x20,0x85,0xc2,0xc9,0x35}}},        /* do NOT use overlays !!!: */        {0, 0, 0, 0, 0},        /* no blits either: */        {0, 0, 0, 0, 0}    },    {	VER_PLATFORM_WIN32_WINDOWS,        {"NVIDIA RIVA TNT2 Ultra",         "NVDD32.DLL",         0x10170,0x4000c,         0x10de, 0x29, 0x10211102, 0x11, 	{0xd7b71e3e,0x4369,0x11cf,{0xc2,0x73,0x20,0x30,0xb2,0xc2,0xc9,0x35}}},        /* don't use overlays: */        {0, 0, 0, 0, 0},        /* no blits either: */        {0, 0, 0, 0, 0}    }}};static BOOL DDPDB_Opened = FALSE;static BOOL DDPDB_NewProfile = FALSE;static time_t DDPDB_FileTime;/* * Initializes profile database:         */BOOL DDPDB_Open(char *pszProfile){    BOOL bRet = FALSE;    /* check arguments: */    if (pszProfile && *pszProfile) {        struct _stat st;        /* get profile info: */        if (!_stat(pszProfile, &st) &&            /* check if we need to reload it: */            (!DDPDB_Opened || st.st_mtime != DDPDB_FileTime)) {            FILE *fp;            size_t s;            /* save profile time: */            DDPDB_FileTime = st.st_mtime;            /* try to open profile: */            if ((fp = fopen(pszProfile, "rb")) != NULL) {                /* try to read this file: */                if ((s = fread((void*)&DDPDB, 1, sizeof DDPDB, fp)) > 0 &&                    !strncmp(DDPDB.szMagic, DDPDB_MAGIC, 5) &&                    DDPDB.dwVersion >= DDPDB_VERSION &&                    DDPDB.dwNumProfiles >= 1 &&                    DDPDB.dwNumProfiles < MAXPROFILES &&                    DDPDB.dwNumProfiles * sizeof(DDDEVICEPROFILE) + 16 == s) {                    /* success: */                    DDPDB_Opened ++;                    DDPDB_NewProfile = TRUE;                    bRet = TRUE;                }                /* close file: */                fclose(fp);            }        }    }    return bRet;}/* * Terminates the use of profile database: */BOOL DDPDB_Close (){    return DDPDB_Opened && !--DDPDB_Opened;}/* * Checks if profile has been updated. */BOOL DDPDB_IsNewProfile (){    BOOL bResult = DDPDB_NewProfile;    DDPDB_NewProfile = FALSE;    return bResult;}/********************* * Default device profiles: */static DDDEVICEPROFILE ddWinNTDefaultProfile ={    VER_PLATFORM_WIN32_NT,    {"", "", 0,0, 0},    /* overlays (use YUVs only): */    {F(CID_YV12) + F(CID_YUY2) + F(CID_UYVY),     F(CID_YV12) + F(CID_YUY2) + F(CID_UYVY),     F(CID_YV12) + F(CID_YUY2) + F(CID_UYVY),     F(CID_YV12) + F(CID_YUY2) + F(CID_UYVY),     F(CID_YV12) + F(CID_YUY2) + F(CID_UYVY)},    /* blits (use YUVs & matching RGBs): */    {F(CID_YV12) + F(CID_YUY2) + F(CID_UYVY) + F(CID_RGB32),     F(CID_YV12) + F(CID_YUY2) + F(CID_UYVY) + F(CID_RGB24),     F(CID_YV12) + F(CID_YUY2) + F(CID_UYVY) + F(CID_RGB565),     F(CID_YV12) + F(CID_YUY2) + F(CID_UYVY) + F(CID_RGB555),     F(CID_YV12) + F(CID_YUY2) + F(CID_UYVY) + F(CID_RGB8)}};static DDDEVICEPROFILE ddWin9xDefaultProfile ={    VER_PLATFORM_WIN32_WINDOWS,    {"", "", 0,0, 0,0,0,0, 0},    /* overlays (use YUVs only): */    {F(CID_YV12) + F(CID_YUY2) + F(CID_UYVY),     F(CID_YV12) + F(CID_YUY2) + F(CID_UYVY),     F(CID_YV12) + F(CID_YUY2) + F(CID_UYVY),     F(CID_YV12) + F(CID_YUY2) + F(CID_UYVY),     F(CID_YV12) + F(CID_YUY2) + F(CID_UYVY)},    /* blits (use YUVs & matching RGBs): */    {F(CID_YV12) + F(CID_YUY2) + F(CID_UYVY) + F(CID_RGB32),     F(CID_YV12) + F(CID_YUY2) + F(CID_UYVY) + F(CID_RGB24),     F(CID_YV12) + F(CID_YUY2) + F(CID_UYVY) + F(CID_RGB565),     F(CID_YV12) + F(CID_YUY2) + F(CID_UYVY) + F(CID_RGB555),     F(CID_YV12) + F(CID_YUY2) + F(CID_UYVY) + F(CID_RGB8)}};/* * Get pointer to a best matching DirectDraw device profile. */LPDDDEVICEPROFILE DDPDB_GetDeviceProfile (LPDIRECTDRAW lpDD){    OSVERSIONINFO osVersion;    DDDEVICEIDENTIFIER ddID;                    /* DirectDraw & Win95 info */    char szChipType[MAXCHIPTYPE];               /* NT info      */    unsigned int bestMatchIdx, deviceBestMatch, driverBestMatch;    unsigned int i, deviceMatch, driverMatch;#if DIRECTDRAW_VERSION > 0x0500    LPDIRECTDRAW4 lpDD4;#endif    /* check if we are runnning NT: */    memset(&osVersion,0, sizeof(OSVERSIONINFO));    osVersion.dwOSVersionInfoSize  = sizeof(OSVERSIONINFO);    if (GetVersionEx(&osVersion) && osVersion.dwPlatformId == VER_PLATFORM_WIN32_NT) {        /* try to get WinNT device information: */        if (GetWinNTDeviceID (&ddID, szChipType)) {            /* clear best match criteria: */            deviceBestMatch = driverBestMatch = bestMatchIdx = 0;            /* scan database: */            for (i = 0; i < DDPDB.dwNumProfiles; i++) {                /* check platform ID: */                if (DDPDB.ddProfiles[i].dwPlatformId == VER_PLATFORM_WIN32_NT) {                    /* clear match criteria: */                    deviceMatch = driverMatch = 0;                    /* check non-critical parameters: */                    if (!DDPDB.ddProfiles[i].ID.WinNT.szDescription[0] ||                        !strncmp (DDPDB.ddProfiles[i].ID.WinNT.szDescription, ddID.szDescription, MAXDESCRIPT-1))                        deviceMatch ++;                    if (!DDPDB.ddProfiles[i].ID.WinNT.szDriver[0] ||                        !strnicmp (DDPDB.ddProfiles[i].ID.WinNT.szDriver, ddID.szDriver, MAXDRIVER-1))                        driverMatch ++;                    /* check critical data: */                    if (!DDPDB.ddProfiles[i].ID.WinNT.dwDriverVersionHighPart)                        driverMatch ++;                    else if (DDPDB.ddProfiles[i].ID.WinNT.dwDriverVersionHighPart == (DWORD)ddID.liDriverVersion.HighPart)                        driverMatch += 2;                    else                        continue;                    if (!DDPDB.ddProfiles[i].ID.WinNT.dwDriverVersionLowPart)                        driverMatch ++;                    else if (DDPDB.ddProfiles[i].ID.WinNT.dwDriverVersionLowPart == (DWORD)ddID.liDriverVersion.LowPart)                        driverMatch += 2;                    else                        continue;                    if (!DDPDB.ddProfiles[i].ID.WinNT.szChipType[0])                        deviceMatch += 1;                    else if (!strncmp (DDPDB.ddProfiles[i].ID.WinNT.szChipType, szChipType, MAXCHIPTYPE-1))                        deviceMatch += 2;                    else                        continue;                    /* check the results: */                    if (deviceMatch + driverMatch > deviceBestMatch + driverBestMatch &&                        deviceMatch >= deviceBestMatch && driverMatch >= driverBestMatch)                    {                        /* update best match: */                        deviceBestMatch = deviceMatch;                        driverBestMatch = driverMatch;                        bestMatchIdx = i;                    }                }            }            /* check overal search results: */            if (deviceBestMatch && driverBestMatch >= 3)            {                return DDPDB.ddProfiles + bestMatchIdx ;            }                    }        /* return WinNT default profile: */        return &ddWinNTDefaultProfile;    } else { /* Win9x: */        /* try to get DirectDraw device identifier: */        memset (&ddID, 0, sizeof (DDDEVICEIDENTIFIER));        #if DIRECTDRAW_VERSION > 0x0500 && !defined(IMPORT)        if ((IDirectDraw_QueryInterface(lpDD, &IID_IDirectDraw4, (void**)&lpDD4) == DD_OK &&

⌨️ 快捷键说明

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