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:
authortetsuo55 <tetsuo55@users.sourceforge.net>2010-04-09 01:14:58 +0400
committertetsuo55 <tetsuo55@users.sourceforge.net>2010-04-09 01:14:58 +0400
commita9b7bf3fb3e1334d8defd05ca4cfae870b4912e5 (patch)
tree2dab453d94d5e003379a6cc895eceb84c80e23ec /src/apps/mplayerc/Ifo.cpp
parentaafd49a91f7c2fa9c7103971c16fa6e1b29e8bfd (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/apps/mplayerc/Ifo.cpp')
-rw-r--r--src/apps/mplayerc/Ifo.cpp260
1 files changed, 131 insertions, 129 deletions
diff --git a/src/apps/mplayerc/Ifo.cpp b/src/apps/mplayerc/Ifo.cpp
index 8f036c953..52fe77bbb 100644
--- a/src/apps/mplayerc/Ifo.cpp
+++ b/src/apps/mplayerc/Ifo.cpp
@@ -70,12 +70,12 @@
#define IFO_HDR_LEN 8
#define LU_SUB_LEN 8
-extern HANDLE (__stdcall * Real_CreateFileW)(LPCWSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode, LPSECURITY_ATTRIBUTES lpSecurityAttributes, DWORD dwCreationDisposition, DWORD dwFlagsAndAttributes, HANDLE hTemplateFile);
+extern HANDLE(__stdcall * Real_CreateFileW)(LPCWSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode, LPSECURITY_ATTRIBUTES lpSecurityAttributes, DWORD dwCreationDisposition, DWORD dwFlagsAndAttributes, HANDLE hTemplateFile);
-unsigned __int32 get4bytes (const BYTE* buf)
+unsigned __int32 get4bytes(const BYTE* buf)
{
- return be2me_32 (*((unsigned __int32 *)buf));
+ return be2me_32(*((unsigned __int32 *)buf));
}
@@ -89,180 +89,182 @@ unsigned __int32 get4bytes (const BYTE* buf)
CIfo::CIfo()
{
- m_pBuffer = NULL;
- m_pPGCI = NULL;
- m_pPGCIT = NULL;
- m_dwSize = 0;
+ m_pBuffer = NULL;
+ m_pPGCI = NULL;
+ m_pPGCIT = NULL;
+ m_dwSize = 0;
}
-int CIfo::GetMiscPGCI (CIfo::ifo_hdr_t *hdr, int title, uint8_t **ptr)
+int CIfo::GetMiscPGCI(CIfo::ifo_hdr_t *hdr, int title, uint8_t **ptr)
{
- pgci_sub_t *pgci_sub;
+ pgci_sub_t *pgci_sub;
- *ptr = (uint8_t *) hdr;
- *ptr += IFO_HDR_LEN;
- pgci_sub = (pgci_sub_t *) *ptr + title;
+ *ptr = (uint8_t *) hdr;
+ *ptr += IFO_HDR_LEN;
+ pgci_sub = (pgci_sub_t *) * ptr + title;
- *ptr = (uint8_t *) hdr + be2me_32 (pgci_sub->start);
+ *ptr = (uint8_t *) hdr + be2me_32(pgci_sub->start);
- return 0;
+ return 0;
}
-void CIfo::RemovePgciUOPs (uint8_t *ptr)
+void CIfo::RemovePgciUOPs(uint8_t *ptr)
{
- ifo_hdr_t* hdr = (ifo_hdr_t *) ptr;
- uint16_t num;
- int i;
-
- ptr += IFO_HDR_LEN;
- num = be2me_16(hdr->num);
-
- for (i=1; i<=num; i++) {
- lu_sub_t *lu_sub = (lu_sub_t *) ptr;
-
- ptr += LU_SUB_LEN;
- }
-
- for (i=0; i<be2me_16(hdr->num); i++) {
- uint8_t *ptr;
-
- if (GetMiscPGCI (hdr, i, &ptr) >= 0)
- {
- pgc_t* pgc = (pgc_t*) ptr;
- pgc->prohibited_ops = 0;
- }
- }
+ ifo_hdr_t* hdr = (ifo_hdr_t *) ptr;
+ uint16_t num;
+ int i;
+
+ ptr += IFO_HDR_LEN;
+ num = be2me_16(hdr->num);
+
+ for(i = 1; i <= num; i++)
+ {
+ lu_sub_t *lu_sub = (lu_sub_t *) ptr;
+
+ ptr += LU_SUB_LEN;
+ }
+
+ for(i = 0; i < be2me_16(hdr->num); i++)
+ {
+ uint8_t *ptr;
+
+ if(GetMiscPGCI(hdr, i, &ptr) >= 0)
+ {
+ pgc_t* pgc = (pgc_t*) ptr;
+ pgc->prohibited_ops = 0;
+ }
+ }
}
CIfo::pgc_t* CIfo::GetFirstPGC()
{
- if (m_pBuffer)
- return (pgc_t*) (m_pBuffer + 0x0400);
- else
- return NULL;
+ if(m_pBuffer)
+ return (pgc_t*)(m_pBuffer + 0x0400);
+ else
+ return NULL;
}
CIfo::pgc_t* CIfo::GetPGCI(const int title, const ifo_hdr_t* hdr)
{
- CIfo::pgci_sub_t *pgci_sub;
- uint8_t *ptr;
+ CIfo::pgci_sub_t *pgci_sub;
+ uint8_t *ptr;
- ptr = (uint8_t *) hdr;
- ptr += IFO_HDR_LEN;
+ ptr = (uint8_t *) hdr;
+ ptr += IFO_HDR_LEN;
- pgci_sub = (pgci_sub_t *) ptr + title;
+ pgci_sub = (pgci_sub_t *) ptr + title;
- ptr = (uint8_t *) hdr + be2me_32 (pgci_sub->start);
+ ptr = (uint8_t *) hdr + be2me_32(pgci_sub->start);
- /* jdw */
- if ( ptr >= ( (uint8_t *) hdr + be2me_32 ( hdr->len )))
- {
- return NULL ;
- }
- /* /jdw */
+ /* jdw */
+ if(ptr >= ((uint8_t *) hdr + be2me_32(hdr->len)))
+ {
+ return NULL ;
+ }
+ /* /jdw */
- return (pgc_t *) ptr;
+ return (pgc_t *) ptr;
}
bool CIfo::IsVTS()
{
- if (m_dwSize<12 || (strncmp ((char*)m_pBuffer, "DVDVIDEO-VTS", 12)!=0))
- return false;
+ if(m_dwSize < 12 || (strncmp((char*)m_pBuffer, "DVDVIDEO-VTS", 12) != 0))
+ return false;
- return true;
+ return true;
}
bool CIfo::IsVMG()
{
- if (m_dwSize<12 || (strncmp ((char*)m_pBuffer, "DVDVIDEO-VMG", 12)!=0))
- return false;
+ if(m_dwSize < 12 || (strncmp((char*)m_pBuffer, "DVDVIDEO-VMG", 12) != 0))
+ return false;
- return true;
+ return true;
}
-bool CIfo::OpenFile (LPCTSTR strFile)
+bool CIfo::OpenFile(LPCTSTR strFile)
{
- bool bRet = false;
- HANDLE hFile;
-
- hFile = Real_CreateFileW((LPTSTR) strFile, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
- ASSERT (hFile != INVALID_HANDLE_VALUE);
-
- if (hFile != INVALID_HANDLE_VALUE)
- {
- DWORD dwSize = GetFileSize (hFile, NULL);
- m_pBuffer = DNew BYTE [dwSize];
- ReadFile (hFile, m_pBuffer, dwSize, &m_dwSize, NULL);
- CloseHandle (hFile);
-
- if (IsVTS() && (OFF_VTSM_PGCI_UT(m_pBuffer)!=0))
- {
- m_pPGCI = (ifo_hdr_t*)(m_pBuffer + OFF_VTSM_PGCI_UT(m_pBuffer) * DVD_VIDEO_LB_LEN);
- m_pPGCIT = (ifo_hdr_t*)(m_pBuffer + OFF_VTS_PGCIT(m_pBuffer) * DVD_VIDEO_LB_LEN);
- }
- else if (IsVMG() && (OFF_VMGM_PGCI_UT(m_pBuffer)!=0))
- m_pPGCI = (ifo_hdr_t*)(m_pBuffer + OFF_VMGM_PGCI_UT(m_pBuffer) * DVD_VIDEO_LB_LEN);
-
- bRet = (m_pPGCI != NULL);
- }
-
- return bRet;
+ bool bRet = false;
+ HANDLE hFile;
+
+ hFile = Real_CreateFileW((LPTSTR) strFile, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
+ ASSERT(hFile != INVALID_HANDLE_VALUE);
+
+ if(hFile != INVALID_HANDLE_VALUE)
+ {
+ DWORD dwSize = GetFileSize(hFile, NULL);
+ m_pBuffer = DNew BYTE [dwSize];
+ ReadFile(hFile, m_pBuffer, dwSize, &m_dwSize, NULL);
+ CloseHandle(hFile);
+
+ if(IsVTS() && (OFF_VTSM_PGCI_UT(m_pBuffer) != 0))
+ {
+ m_pPGCI = (ifo_hdr_t*)(m_pBuffer + OFF_VTSM_PGCI_UT(m_pBuffer) * DVD_VIDEO_LB_LEN);
+ m_pPGCIT = (ifo_hdr_t*)(m_pBuffer + OFF_VTS_PGCIT(m_pBuffer) * DVD_VIDEO_LB_LEN);
+ }
+ else if(IsVMG() && (OFF_VMGM_PGCI_UT(m_pBuffer) != 0))
+ m_pPGCI = (ifo_hdr_t*)(m_pBuffer + OFF_VMGM_PGCI_UT(m_pBuffer) * DVD_VIDEO_LB_LEN);
+
+ bRet = (m_pPGCI != NULL);
+ }
+
+ return bRet;
}
bool CIfo::RemoveUOPs()
{
- pgc_t* pgc;
-
- if (m_pPGCI)
- {
- pgc = GetFirstPGC();
- pgc->prohibited_ops = 0;
-
- for (int i=0; i<be2me_16(m_pPGCI->num); i++)
- {
- if (pgc = GetPGCI(i, m_pPGCI))
- RemovePgciUOPs ((uint8_t*)pgc);
- }
- }
- if (m_pPGCIT)
- {
- for (int i=0; i<be2me_16(m_pPGCIT->num); i++)
- {
- if (pgc = GetPGCI(i, m_pPGCIT))
- pgc->prohibited_ops = 0;
- }
- }
- return true;
+ pgc_t* pgc;
+
+ if(m_pPGCI)
+ {
+ pgc = GetFirstPGC();
+ pgc->prohibited_ops = 0;
+
+ for(int i = 0; i < be2me_16(m_pPGCI->num); i++)
+ {
+ if(pgc = GetPGCI(i, m_pPGCI))
+ RemovePgciUOPs((uint8_t*)pgc);
+ }
+ }
+ if(m_pPGCIT)
+ {
+ for(int i = 0; i < be2me_16(m_pPGCIT->num); i++)
+ {
+ if(pgc = GetPGCI(i, m_pPGCIT))
+ pgc->prohibited_ops = 0;
+ }
+ }
+ return true;
}
-bool CIfo::SaveFile (LPCTSTR strFile)
+bool CIfo::SaveFile(LPCTSTR strFile)
{
- bool bRet = false;
- HANDLE m_hFile;
-
- if (m_pBuffer)
- {
- m_hFile = Real_CreateFileW((LPTSTR) strFile, GENERIC_WRITE|GENERIC_READ, FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE,
- NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
- ASSERT (m_hFile != INVALID_HANDLE_VALUE);
-
- if (m_hFile != INVALID_HANDLE_VALUE)
- {
- DWORD dwSize;
- WriteFile (m_hFile, m_pBuffer, m_dwSize, &dwSize, NULL);
- CloseHandle(m_hFile);
- bRet = true;
- }
- }
-
- return bRet;
+ bool bRet = false;
+ HANDLE m_hFile;
+
+ if(m_pBuffer)
+ {
+ m_hFile = Real_CreateFileW((LPTSTR) strFile, GENERIC_WRITE | GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
+ NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
+ ASSERT(m_hFile != INVALID_HANDLE_VALUE);
+
+ if(m_hFile != INVALID_HANDLE_VALUE)
+ {
+ DWORD dwSize;
+ WriteFile(m_hFile, m_pBuffer, m_dwSize, &dwSize, NULL);
+ CloseHandle(m_hFile);
+ bRet = true;
+ }
+ }
+
+ return bRet;
}
CIfo::~CIfo(void)
{
- delete[] m_pBuffer;
+ delete[] m_pBuffer;
}