Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mpc-hc/mpc-hc.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/DSUtil/DSUtil.h')
-rw-r--r--src/DSUtil/DSUtil.h76
1 files changed, 50 insertions, 26 deletions
diff --git a/src/DSUtil/DSUtil.h b/src/DSUtil/DSUtil.h
index 1a3ef0cfe..a66f51da0 100644
--- a/src/DSUtil/DSUtil.h
+++ b/src/DSUtil/DSUtil.h
@@ -1,6 +1,6 @@
/*
* (C) 2003-2006 Gabest
- * (C) 2006-2014 see Authors.txt
+ * (C) 2006-2016 see Authors.txt
*
* This file is part of MPC-HC.
*
@@ -21,14 +21,13 @@
#pragma once
-#include <afxstr.h>
-#include <atlpath.h>
-#include "NullRenderers.h"
#include "HdmvClipInfo.h"
-#include "H264Nalu.h"
#include "MediaTypeEx.h"
-#include "vd.h"
#include "text.h"
+#include "vd.h"
+#include "BaseClasses/streams.h"
+#include <atlcoll.h>
+#include <atlpath.h>
#define LCID_NOSUBTITLES -1
@@ -66,6 +65,7 @@ extern CString GetFilterPath(LPCTSTR clsid);
extern CString GetFilterPath(const CLSID& clsid);
extern void CStringToBin(CString str, CAtlArray<BYTE>& data);
extern CString BinToCString(const BYTE* ptr, size_t len);
+extern void FindFiles(CString fn, CAtlList<CString>& files);
enum OpticalDiskType_t {
OpticalDisk_NotFound,
OpticalDisk_Audio,
@@ -103,15 +103,6 @@ extern CStringW UTF8To16(LPCSTR utf8);
extern CStringA UTF16To8(LPCWSTR utf16);
extern CStringW UTF8ToStringW(const char* S);
extern CStringW LocalToStringW(const char* S);
-extern CString ISO6391ToLanguage(LPCSTR code);
-extern CString ISO6392ToLanguage(LPCSTR code);
-extern bool IsISO639Language(LPCSTR code);
-extern CString ISO639XToLanguage(LPCSTR code, bool bCheckForFullLangName = false);
-extern LCID ISO6391ToLcid(LPCSTR code);
-extern LCID ISO6392ToLcid(LPCSTR code);
-extern CString ISO6391To6392(LPCSTR code);
-extern CString ISO6392To6391(LPCSTR code);
-extern CString LanguageToISO6392(LPCTSTR lang);
extern BOOL CFileGetStatus(LPCTSTR lpszFileName, CFileStatus& status);
extern bool DeleteRegKey(LPCTSTR pszKey, LPCTSTR pszSubkey);
extern bool SetRegKeyValue(LPCTSTR pszKey, LPCTSTR pszSubkey, LPCTSTR pszValueName, LPCTSTR pszValue);
@@ -124,10 +115,6 @@ extern CString ReftimeToString(const REFERENCE_TIME& rtVal);
extern CString ReftimeToString2(const REFERENCE_TIME& rtVal);
extern CString DVDtimeToString(const DVD_HMSF_TIMECODE& rtVal, bool bAlwaysShowHours = false);
extern REFERENCE_TIME StringToReftime(LPCTSTR strVal);
-extern COLORREF YCrCbToRGB_Rec601(BYTE Y, BYTE Cr, BYTE Cb, double sourceBlackLevel, double sourceWhiteLevel, double targetBlackLevel, double targetWhiteLevel);
-extern COLORREF YCrCbToRGB_Rec709(BYTE Y, BYTE Cr, BYTE Cb, double sourceBlackLevel, double sourceWhiteLevel, double targetBlackLevel, double targetWhiteLevel);
-extern DWORD YCrCbToRGB_Rec601(BYTE A, BYTE Y, BYTE Cr, BYTE Cb, double sourceBlackLevel, double sourceWhiteLevel, double targetBlackLevel, double targetWhiteLevel);
-extern DWORD YCrCbToRGB_Rec709(BYTE A, BYTE Y, BYTE Cr, BYTE Cb, double sourceBlackLevel, double sourceWhiteLevel, double targetBlackLevel, double targetWhiteLevel);
extern void SetThreadName(DWORD dwThreadID, LPCSTR szThreadName);
extern void CorrectComboListWidth(CComboBox& m_pComboBox);
extern void CorrectComboBoxHeaderWidth(CWnd* pComboBox);
@@ -251,13 +238,14 @@ public:
#define SAFE_RELEASE(p) { if (p) { (p)->Release(); (p) = nullptr; } }
#define SAFE_CLOSE_HANDLE(p) { if (p) { if ((p) != INVALID_HANDLE_VALUE) VERIFY(CloseHandle(p)); (p) = nullptr; } }
-#define ResStr(id) CString(MAKEINTRESOURCE(id))
+#define StrRes(id) MAKEINTRESOURCE(id)
+#define ResStr(id) CString(StrRes(id))
-template <typename T> __inline void INITDDSTRUCT(T& dd)
-{
- ZeroMemory(&dd, sizeof(dd));
- dd.dwSize = sizeof(dd);
-}
+#define UNREACHABLE_CODE() \
+ do { \
+ ASSERT(false); \
+ __assume(false); \
+ } while (false)
template <class T>
static CUnknown* WINAPI CreateInstance(LPUNKNOWN lpunk, HRESULT* phr)
@@ -290,11 +278,47 @@ typename std::enable_if<std::is_unsigned<T>::value, T>::type GCD(T a, T b)
template <class T>
typename std::enable_if<std::is_signed<T>::value, T>::type GCD(T a, T b)
{
- typedef std::make_unsigned<T>::type uT;
+ using uT = typename std::make_unsigned<T>::type;
return T(GCD(uT(std::abs(a)), uT(std::abs(b))));
}
+template<class T>
+constexpr typename std::enable_if<std::is_integral<T>::value, bool>::type IsEqual(T a, T b)
+{
+ return a == b;
+}
+
+template<class T>
+constexpr typename std::enable_if<std::is_floating_point<T>::value, bool>::type IsEqual(T a, T b)
+{
+ return std::abs(a - b) < std::numeric_limits<T>::epsilon();
+}
+
+template<class T>
+constexpr typename std::enable_if<std::is_floating_point<T>::value, bool>::type IsNearlyEqual(T a, T b, T epsilon)
+{
+ return std::abs(a - b) < epsilon;
+}
+
+template <class T>
+constexpr typename std::enable_if < std::is_integral<T>::value&& std::is_unsigned<T>::value, int >::type SGN(T n)
+{
+ return T(0) < n;
+}
+
+template <typename T>
+constexpr typename std::enable_if < std::is_integral<T>::value&& std::is_signed<T>::value, int >::type SGN(T n)
+{
+ return (T(0) < n) - (n < T(0));
+}
+
+template <typename T>
+constexpr typename std::enable_if <std::is_floating_point<T>::value, int>::type SGN(T n)
+{
+ return IsEqual(n, T(0)) ? 0 : (n > 0 ? 1 : -1);
+}
+
namespace CStringUtils
{
struct IgnoreCaseLess {