diff options
author | tetsuo55 <tetsuo55@users.sourceforge.net> | 2010-04-09 01:14:58 +0400 |
---|---|---|
committer | tetsuo55 <tetsuo55@users.sourceforge.net> | 2010-04-09 01:14:58 +0400 |
commit | a9b7bf3fb3e1334d8defd05ca4cfae870b4912e5 (patch) | |
tree | 2dab453d94d5e003379a6cc895eceb84c80e23ec /src/filters/BaseClasses/amvideo.cpp | |
parent | aafd49a91f7c2fa9c7103971c16fa6e1b29e8bfd (diff) |
astyle formatting cleanup to make the sourcecode more accessible
switch used: astyle --style=ansi --min-conditional-indent=0 --pad=oper --unpad=paren
http://astyle.sourceforge.net/
git-svn-id: https://mpc-hc.svn.sourceforge.net/svnroot/mpc-hc/trunk@1783 10f7b99b-c216-0410-bff0-8a66a9350fd8
Diffstat (limited to 'src/filters/BaseClasses/amvideo.cpp')
-rw-r--r-- | src/filters/BaseClasses/amvideo.cpp | 117 |
1 files changed, 72 insertions, 45 deletions
diff --git a/src/filters/BaseClasses/amvideo.cpp b/src/filters/BaseClasses/amvideo.cpp index 42fe446de..75c3d8e83 100644 --- a/src/filters/BaseClasses/amvideo.cpp +++ b/src/filters/BaseClasses/amvideo.cpp @@ -13,29 +13,30 @@ // These are bit field masks for true colour devices
-const DWORD bits555[] = {0x007C00,0x0003E0,0x00001F};
-const DWORD bits565[] = {0x00F800,0x0007E0,0x00001F};
-const DWORD bits888[] = {0xFF0000,0x00FF00,0x0000FF};
+const DWORD bits555[] = {0x007C00, 0x0003E0, 0x00001F};
+const DWORD bits565[] = {0x00F800, 0x0007E0, 0x00001F};
+const DWORD bits888[] = {0xFF0000, 0x00FF00, 0x0000FF};
// This maps bitmap subtypes into a bits per pixel value and also a
// name. unicode and ansi versions are stored because we have to
// return a pointer to a static string.
-const struct {
+const struct
+{
const GUID *pSubtype;
WORD BitCount;
CHAR *pName;
WCHAR *wszName;
-} BitCountMap[] = { &MEDIASUBTYPE_RGB1, 1, "RGB Monochrome", L"RGB Monochrome",
- &MEDIASUBTYPE_RGB4, 4, "RGB VGA", L"RGB VGA",
- &MEDIASUBTYPE_RGB8, 8, "RGB 8", L"RGB 8",
- &MEDIASUBTYPE_RGB565, 16, "RGB 565 (16 bit)", L"RGB 565 (16 bit)",
- &MEDIASUBTYPE_RGB555, 16, "RGB 555 (16 bit)", L"RGB 555 (16 bit)",
- &MEDIASUBTYPE_RGB24, 24, "RGB 24", L"RGB 24",
+} BitCountMap[] = { &MEDIASUBTYPE_RGB1, 1, "RGB Monochrome", L"RGB Monochrome",
+ &MEDIASUBTYPE_RGB4, 4, "RGB VGA", L"RGB VGA",
+ &MEDIASUBTYPE_RGB8, 8, "RGB 8", L"RGB 8",
+ &MEDIASUBTYPE_RGB565, 16, "RGB 565 (16 bit)", L"RGB 565 (16 bit)",
+ &MEDIASUBTYPE_RGB555, 16, "RGB 555 (16 bit)", L"RGB 555 (16 bit)",
+ &MEDIASUBTYPE_RGB24, 24, "RGB 24", L"RGB 24",
&MEDIASUBTYPE_RGB32, 32, "RGB 32", L"RGB 32",
&MEDIASUBTYPE_ARGB32, 32, "ARGB 32", L"ARGB 32",
- &MEDIASUBTYPE_Overlay, 0, "Overlay", L"Overlay",
- &GUID_NULL, 0, "UNKNOWN", L"UNKNOWN"
-};
+ &MEDIASUBTYPE_Overlay, 0, "Overlay", L"Overlay",
+ &GUID_NULL, 0, "UNKNOWN", L"UNKNOWN"
+ };
// Return the size of the bitmap as defined by this header
@@ -55,16 +56,20 @@ STDAPI_(const GUID) GetTrueColorType(const BITMAPINFOHEADER *pbmiHeader) // If its BI_RGB then it's RGB 555 by default
- if (pbmiHeader->biCompression == BI_RGB) {
+ if(pbmiHeader->biCompression == BI_RGB)
+ {
return MEDIASUBTYPE_RGB555;
}
// Compare the bit fields with RGB 555
DWORD *pMask = (DWORD *) pbmInfo->bmiColors;
- if (pMask[0] == bits555[0]) {
- if (pMask[1] == bits555[1]) {
- if (pMask[2] == bits555[2]) {
+ if(pMask[0] == bits555[0])
+ {
+ if(pMask[1] == bits555[1])
+ {
+ if(pMask[2] == bits555[2])
+ {
return MEDIASUBTYPE_RGB555;
}
}
@@ -73,9 +78,12 @@ STDAPI_(const GUID) GetTrueColorType(const BITMAPINFOHEADER *pbmiHeader) // Compare the bit fields with RGB 565
pMask = (DWORD *) pbmInfo->bmiColors;
- if (pMask[0] == bits565[0]) {
- if (pMask[1] == bits565[1]) {
- if (pMask[2] == bits565[2]) {
+ if(pMask[0] == bits565[0])
+ {
+ if(pMask[1] == bits565[1])
+ {
+ if(pMask[2] == bits565[2])
+ {
return MEDIASUBTYPE_RGB565;
}
}
@@ -96,8 +104,10 @@ STDAPI_(const GUID) GetBitmapSubtype(const BITMAPINFOHEADER *pbmiHeader) // If it's not RGB then create a GUID from the compression type
- if (pbmiHeader->biCompression != BI_RGB) {
- if (pbmiHeader->biCompression != BI_BITFIELDS) {
+ if(pbmiHeader->biCompression != BI_RGB)
+ {
+ if(pbmiHeader->biCompression != BI_BITFIELDS)
+ {
FOURCCMap FourCCMap(pbmiHeader->biCompression);
return (const GUID) FourCCMap;
}
@@ -105,13 +115,20 @@ STDAPI_(const GUID) GetBitmapSubtype(const BITMAPINFOHEADER *pbmiHeader) // Map the RGB DIB bit depth to a image GUID
- switch(pbmiHeader->biBitCount) {
- case 1 : return MEDIASUBTYPE_RGB1;
- case 4 : return MEDIASUBTYPE_RGB4;
- case 8 : return MEDIASUBTYPE_RGB8;
- case 16 : return GetTrueColorType(pbmiHeader);
- case 24 : return MEDIASUBTYPE_RGB24;
- case 32 : return MEDIASUBTYPE_RGB32;
+ switch(pbmiHeader->biBitCount)
+ {
+ case 1 :
+ return MEDIASUBTYPE_RGB1;
+ case 4 :
+ return MEDIASUBTYPE_RGB4;
+ case 8 :
+ return MEDIASUBTYPE_RGB8;
+ case 16 :
+ return GetTrueColorType(pbmiHeader);
+ case 24 :
+ return MEDIASUBTYPE_RGB24;
+ case 32 :
+ return MEDIASUBTYPE_RGB32;
}
return GUID_NULL;
}
@@ -130,12 +147,15 @@ STDAPI_(WORD) GetBitCount(const GUID *pSubtype) // Scan the mapping list seeing if the source GUID matches any known
// bitmap subtypes, the list is terminated by a GUID_NULL entry
- while (TRUE) {
+ while(TRUE)
+ {
pMediaSubtype = BitCountMap[iPosition].pSubtype;
- if (IsEqualGUID(*pMediaSubtype,GUID_NULL)) {
+ if(IsEqualGUID(*pMediaSubtype, GUID_NULL))
+ {
return USHRT_MAX;
}
- if (IsEqualGUID(*pMediaSubtype,*pSubtype)) {
+ if(IsEqualGUID(*pMediaSubtype, *pSubtype))
+ {
return BitCountMap[iPosition].BitCount;
}
iPosition++;
@@ -156,15 +176,16 @@ int LocateSubtype(const GUID *pSubtype) // Scan the mapping list seeing if the source GUID matches any known
// bitmap subtypes, the list is terminated by a GUID_NULL entry
- while (TRUE) {
+ while(TRUE)
+ {
pMediaSubtype = BitCountMap[iPosition].pSubtype;
- if (IsEqualGUID(*pMediaSubtype,*pSubtype) ||
- IsEqualGUID(*pMediaSubtype,GUID_NULL)
- )
+ if(IsEqualGUID(*pMediaSubtype, *pSubtype) ||
+ IsEqualGUID(*pMediaSubtype, GUID_NULL)
+ )
{
break;
}
-
+
iPosition++;
}
@@ -212,11 +233,11 @@ STDAPI_(CHAR *) GetSubtypeName(const GUID *pSubtype) STDAPI_(LONG) GetBitmapFormatSize(const BITMAPINFOHEADER *pHeader)
{
- // Everyone has this to start with this
+ // Everyone has this to start with this
LONG Size = SIZE_PREHEADER + pHeader->biSize;
ASSERT(pHeader->biSize >= sizeof(BITMAPINFOHEADER));
-
+
// Does this format use a palette, if the number of colours actually used
// is zero then it is set to the maximum that are allowed for that colour
// depth (an example is 256 for eight bits). Truecolour formats may also
@@ -225,9 +246,11 @@ STDAPI_(LONG) GetBitmapFormatSize(const BITMAPINFOHEADER *pHeader) // This would scare me.
ASSERT(pHeader->biBitCount <= iPALETTE || pHeader->biClrUsed == 0);
- if (pHeader->biBitCount <= iPALETTE || pHeader->biClrUsed) {
+ if(pHeader->biBitCount <= iPALETTE || pHeader->biClrUsed)
+ {
LONG Entries = (DWORD) 1 << pHeader->biBitCount;
- if (pHeader->biClrUsed) {
+ if(pHeader->biClrUsed)
+ {
Entries = pHeader->biClrUsed;
}
Size += Entries * sizeof(RGBQUAD);
@@ -237,7 +260,8 @@ STDAPI_(LONG) GetBitmapFormatSize(const BITMAPINFOHEADER *pHeader) // type which means that room for three DWORDs should be allocated that
// specify where in each pixel the RGB colour components may be found
- if (pHeader->biCompression == BI_BITFIELDS) {
+ if(pHeader->biCompression == BI_BITFIELDS)
+ {
Size += SIZE_MASKS;
}
@@ -255,8 +279,10 @@ STDAPI_(LONG) GetBitmapFormatSize(const BITMAPINFOHEADER *pHeader) STDAPI_(BOOL) ContainsPalette(const VIDEOINFOHEADER *pVideoInfo)
{
- if (PALETTISED(pVideoInfo) == FALSE) {
- if (pVideoInfo->bmiHeader.biClrUsed == 0) {
+ if(PALETTISED(pVideoInfo) == FALSE)
+ {
+ if(pVideoInfo->bmiHeader.biClrUsed == 0)
+ {
return FALSE;
}
}
@@ -268,7 +294,8 @@ STDAPI_(BOOL) ContainsPalette(const VIDEOINFOHEADER *pVideoInfo) STDAPI_(const RGBQUAD *) GetBitmapPalette(const VIDEOINFOHEADER *pVideoInfo)
{
- if (pVideoInfo->bmiHeader.biCompression == BI_BITFIELDS) {
+ if(pVideoInfo->bmiHeader.biCompression == BI_BITFIELDS)
+ {
return TRUECOLOR(pVideoInfo)->bmiColors;
}
return COLORS(pVideoInfo);
|