Permalink
Browse files

Update MPC-HC Engine code from MPC-HC latest source.

  • Loading branch information...
1 parent c0492d5 commit 7235eaa3d7ab577b062a38926661b67898cf198f @Sebastiii Sebastiii committed Feb 9, 2013
Showing 368 changed files with 53,207 additions and 75,314 deletions.

Large diffs are not rendered by default.

Oops, something went wrong.
@@ -35,6 +35,7 @@
#include <initguid.h>
#include "moreuuids.h"
+#define countof(array) (sizeof(array)/sizeof(array[0]))
#ifdef REGISTER_FILTER
@@ -23,7 +23,7 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<CharacterSet>Unicode</CharacterSet>
- <UseOfMfc>false</UseOfMfc>
+ <UseOfMfc>Dynamic</UseOfMfc>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
@@ -1,63 +1,83 @@
+/*
+ * (C) 2003-2006 Gabest
+ * (C) 2006-2012 see Authors.txt
+ *
+ * This file is part of MPC-HC.
+ *
+ * MPC-HC is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * MPC-HC is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
#pragma once
typedef enum TrackType {
- TypeVideo = 1,
- TypeAudio = 2,
- TypeComplex = 3,
- TypeLogo = 0x10,
- TypeSubtitle = 0x11,
- TypeControl = 0x20
+ TypeVideo = 1,
+ TypeAudio = 2,
+ TypeComplex = 3,
+ TypeLogo = 0x10,
+ TypeSubtitle = 0x11,
+ TypeControl = 0x20
};
#pragma pack(push, 1)
struct TrackElement {
- WORD Size; // Size of this structure
- BYTE Type; // See TrackType
- BOOL FlagDefault; // Set if the track is the default for its TrackType.
- BOOL FlagForced; // Set if that track MUST be used during playback.
- BOOL FlagLacing; // Set if the track may contain blocks using lacing.
- UINT MinCache; // The minimum number of frames a player should be able to cache during playback.
- UINT MaxCache; // The maximum cache size required to store referenced frames in and the current frame. 0 means no cache is needed.
- CHAR Language[4]; // Specifies the language of the track, in the ISO-639-2 form. (end with '\0')
+ WORD Size; // Size of this structure
+ BYTE Type; // See TrackType
+ BOOL FlagDefault; // Set if the track is the default for its TrackType.
+ BOOL FlagForced; // Set if that track MUST be used during playback.
+ BOOL FlagLacing; // Set if the track may contain blocks using lacing.
+ UINT MinCache; // The minimum number of frames a player should be able to cache during playback.
+ UINT MaxCache; // The maximum cache size required to store referenced frames in and the current frame. 0 means no cache is needed.
+ CHAR Language[4]; // Specifies the language of the track, in the ISO-639-2 form. (end with '\0')
};
struct TrackExtendedInfoVideo {
- WORD Size; // Size of this structure
- BOOL Interlaced; // Set if the video is interlaced.
- UINT PixelWidth; // Width of the encoded video frames in pixels.
- UINT PixelHeight; // Height of the encoded video frames in pixels.
- UINT DisplayWidth; // Width of the video frames to display.
- UINT DisplayHeight; // Height of the video frames to display.
- BYTE DisplayUnit; // Type of the unit for DisplayWidth/Height (0: pixels, 1: centimeters, 2: inches).
- BYTE AspectRatioType; // Specify the possible modifications to the aspect ratio (0: free resizing, 1: keep aspect ratio, 2: fixed).
+ WORD Size; // Size of this structure
+ BOOL Interlaced; // Set if the video is interlaced.
+ UINT PixelWidth; // Width of the encoded video frames in pixels.
+ UINT PixelHeight; // Height of the encoded video frames in pixels.
+ UINT DisplayWidth; // Width of the video frames to display.
+ UINT DisplayHeight; // Height of the video frames to display.
+ BYTE DisplayUnit; // Type of the unit for DisplayWidth/Height (0: pixels, 1: centimeters, 2: inches).
+ BYTE AspectRatioType; // Specify the possible modifications to the aspect ratio (0: free resizing, 1: keep aspect ratio, 2: fixed).
};
struct TrackExtendedInfoAudio {
- WORD Size; // Size of this structure
- FLOAT SamplingFreq; // Sampling frequency in Hz.
- FLOAT OutputSamplingFrequency; // Real output sampling frequency in Hz (used for SBR techniques).
- UINT Channels; // Numbers of channels in the track.
- UINT BitDepth; // Bits per sample, mostly used for PCM.
+ WORD Size; // Size of this structure
+ float SamplingFreq; // Sampling frequency in Hz.
+ float OutputSamplingFrequency; // Real output sampling frequency in Hz (used for SBR techniques).
+ UINT Channels; // Numbers of channels in the track.
+ UINT BitDepth; // Bits per sample, mostly used for PCM.
};
#pragma pack(pop)
interface __declspec(uuid("03E98D51-DDE7-43aa-B70C-42EF84A3A23D"))
ITrackInfo :
-public IUnknown
-{
- STDMETHOD_(UINT, GetTrackCount) () = 0;
+public IUnknown {
+ STDMETHOD_(UINT, GetTrackCount)() = 0;
- // \param aTrackIdx the track index (from 0 to GetTrackCount()-1)
- STDMETHOD_(BOOL, GetTrackInfo) (UINT aTrackIdx, struct TrackElement* pStructureToFill) = 0;
+ // \param aTrackIdx the track index (from 0 to GetTrackCount()-1)
+ STDMETHOD_(BOOL, GetTrackInfo)(UINT aTrackIdx, struct TrackElement * pStructureToFill) = 0;
- // Get an extended information struct relative to the track type
- STDMETHOD_(BOOL, GetTrackExtendedInfo) (UINT aTrackIdx, void* pStructureToFill) = 0;
+ // Get an extended information struct relative to the track type
+ STDMETHOD_(BOOL, GetTrackExtendedInfo)(UINT aTrackIdx, void * pStructureToFill) = 0;
- STDMETHOD_(BSTR, GetTrackCodecID) (UINT aTrackIdx) = 0;
- STDMETHOD_(BSTR, GetTrackName) (UINT aTrackIdx) = 0;
- STDMETHOD_(BSTR, GetTrackCodecName) (UINT aTrackIdx) = 0;
- STDMETHOD_(BSTR, GetTrackCodecInfoURL) (UINT aTrackIdx) = 0;
- STDMETHOD_(BSTR, GetTrackCodecDownloadURL) (UINT aTrackIdx) = 0;
+ STDMETHOD_(BSTR, GetTrackCodecID)(UINT aTrackIdx) = 0;
+ STDMETHOD_(BSTR, GetTrackName)(UINT aTrackIdx) = 0;
+ STDMETHOD_(BSTR, GetTrackCodecName)(UINT aTrackIdx) = 0;
+ STDMETHOD_(BSTR, GetTrackCodecInfoURL)(UINT aTrackIdx) = 0;
+ STDMETHOD_(BSTR, GetTrackCodecDownloadURL)(UINT aTrackIdx) = 0;
};
@@ -1,21 +1,25 @@
#ifndef _UNRAR_DLL_
#define _UNRAR_DLL_
-#define ERAR_END_ARCHIVE 10
-#define ERAR_NO_MEMORY 11
-#define ERAR_BAD_DATA 12
-#define ERAR_BAD_ARCHIVE 13
-#define ERAR_UNKNOWN_FORMAT 14
-#define ERAR_EOPEN 15
-#define ERAR_ECREATE 16
-#define ERAR_ECLOSE 17
-#define ERAR_EREAD 18
-#define ERAR_EWRITE 19
-#define ERAR_SMALL_BUF 20
-#define ERAR_UNKNOWN 21
-
-#define RAR_OM_LIST 0
-#define RAR_OM_EXTRACT 1
+#pragma pack(1)
+
+#define ERAR_END_ARCHIVE 10
+#define ERAR_NO_MEMORY 11
+#define ERAR_BAD_DATA 12
+#define ERAR_BAD_ARCHIVE 13
+#define ERAR_UNKNOWN_FORMAT 14
+#define ERAR_EOPEN 15
+#define ERAR_ECREATE 16
+#define ERAR_ECLOSE 17
+#define ERAR_EREAD 18
+#define ERAR_EWRITE 19
+#define ERAR_SMALL_BUF 20
+#define ERAR_UNKNOWN 21
+#define ERAR_MISSING_PASSWORD 22
+
+#define RAR_OM_LIST 0
+#define RAR_OM_EXTRACT 1
+#define RAR_OM_LIST_INCSPLIT 2
#define RAR_SKIP 0
#define RAR_TEST 1
@@ -24,7 +28,16 @@
#define RAR_VOL_ASK 0
#define RAR_VOL_NOTIFY 1
-#define RAR_DLL_VERSION 3
+#define RAR_DLL_VERSION 5
+
+#ifdef _UNIX
+#define CALLBACK
+#define PASCAL
+#define LONG long
+#define HANDLE void *
+#define LPARAM long
+#define UINT unsigned int
+#endif
struct RARHeaderData
{
@@ -82,48 +95,53 @@ struct RAROpenArchiveData
unsigned int CmtState;
};
+typedef int (CALLBACK *UNRARCALLBACK)(UINT msg,LPARAM UserData,LPARAM P1,LPARAM P2);
+
struct RAROpenArchiveDataEx
{
char *ArcName;
wchar_t *ArcNameW;
- unsigned int OpenMode;
- unsigned int OpenResult;
+ unsigned int OpenMode;
+ unsigned int OpenResult;
char *CmtBuf;
- unsigned int CmtBufSize;
- unsigned int CmtSize;
- unsigned int CmtState;
- unsigned int Flags;
- unsigned int Reserved[32];
+ unsigned int CmtBufSize;
+ unsigned int CmtSize;
+ unsigned int CmtState;
+ unsigned int Flags;
+ UNRARCALLBACK Callback;
+ LPARAM UserData;
+ unsigned int Reserved[28];
};
enum UNRARCALLBACK_MESSAGES {
- UCM_CHANGEVOLUME,UCM_PROCESSDATA,UCM_NEEDPASSWORD
+ UCM_CHANGEVOLUME,UCM_PROCESSDATA,UCM_NEEDPASSWORD,UCM_CHANGEVOLUMEW,
+ UCM_NEEDPASSWORDW
};
-typedef int (CALLBACK *UNRARCALLBACK)(UINT msg,LONG UserData,LONG P1,LONG P2);
-
typedef int (PASCAL *CHANGEVOLPROC)(char *ArcName,int Mode);
typedef int (PASCAL *PROCESSDATAPROC)(unsigned char *Addr,int Size);
#ifdef __cplusplus
extern "C" {
#endif
-typedef HANDLE (PASCAL * RAROpenArchive)(struct RAROpenArchiveData *ArchiveData);
-typedef HANDLE (PASCAL * RAROpenArchiveEx)(struct RAROpenArchiveDataEx *ArchiveData);
-typedef int (PASCAL * RARCloseArchive)(HANDLE hArcData);
-typedef int (PASCAL * RARReadHeader)(HANDLE hArcData,struct RARHeaderData *HeaderData);
-typedef int (PASCAL * RARReadHeaderEx)(HANDLE hArcData,struct RARHeaderDataEx *HeaderData);
-typedef int (PASCAL * RARProcessFile)(HANDLE hArcData,int Operation,char *DestPath,char *DestName);
-typedef void (PASCAL * RARSetCallback)(HANDLE hArcData,UNRARCALLBACK Callback,LONG UserData);
-typedef void (PASCAL * RARSetChangeVolProc)(HANDLE hArcData, CHANGEVOLPROC);
-typedef void (PASCAL * RARSetProcessDataProc)(HANDLE hArcData, PROCESSDATAPROC);
-typedef void (PASCAL * RARSetPassword)(HANDLE hArcData,char *Password);
-typedef int (PASCAL * RARGetDllVersion)();
-
+typedef HANDLE (PASCAL *RAROpenArchive)(struct RAROpenArchiveData *ArchiveData);
+typedef HANDLE (PASCAL *RAROpenArchiveEx)(struct RAROpenArchiveDataEx *ArchiveData);
+typedef int (PASCAL *RARCloseArchive)(HANDLE hArcData);
+typedef int (PASCAL *RARReadHeader)(HANDLE hArcData,struct RARHeaderData *HeaderData);
+typedef int (PASCAL *RARReadHeaderEx)(HANDLE hArcData,struct RARHeaderDataEx *HeaderData);
+typedef int (PASCAL *RARProcessFile)(HANDLE hArcData,int Operation,char *DestPath,char *DestName);
+typedef int (PASCAL *RARProcessFileW)(HANDLE hArcData,int Operation,wchar_t *DestPath,wchar_t *DestName);
+typedef void (PASCAL *RARSetCallback)(HANDLE hArcData,UNRARCALLBACK Callback,LPARAM UserData);
+typedef void (PASCAL *RARSetChangeVolProc)(HANDLE hArcData,CHANGEVOLPROC ChangeVolProc);
+typedef void (PASCAL *RARSetProcessDataProc)(HANDLE hArcData,PROCESSDATAPROC ProcessDataProc);
+typedef void (PASCAL *RARSetPassword)(HANDLE hArcData,char *Password);
+typedef int (PASCAL *RARGetDllVersion)();
#ifdef __cplusplus
}
#endif
+#pragma pack()
+
#endif
@@ -0,0 +1,57 @@
+// Simple functions to test UTF-8 characters.
+// Copyright (C)2010 Francois-R.Boyer@PolyMtl.ca
+// First version 2010-08
+//
+// Written for notepad++, and distributed under same license:
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+#pragma once
+
+namespace Utf8 { // could be a static class, instead of a namespace, if it needs private members
+ // basic classification of UTF-8 bytes
+ inline static bool isSingleByte(unsigned char c) { return c < 0x80; }
+ inline static bool isPartOfMultibyte(unsigned char c) { return c >= 0x80; }
+ inline static bool isFirstOfMultibyte(unsigned char c) { return c >= 0xC2 && c < 0xF5; } // 0xF5 to 0xFD are defined by UTF-8, but are not currently valid Unicode
+ inline static bool isContinuation(unsigned char c) { return (c & 0xC0) == 0x80; }
+ inline static bool isValid(unsigned char c) { return c < 0xC0 || isFirstOfMultibyte(c); } // validates a byte, out of context
+
+ // number of continuation bytes for a given valid first character (0 for single byte characters)
+ inline static int continuationBytes(unsigned char c) {
+ static const char _len[] = { 1,1,2,3 };
+ return (c < 0xC0) ? 0 : _len[(c & 0x30) >> 4];
+ }
+
+ // validates a full character
+ inline static bool isValid(const unsigned char* buf, int buflen) {
+ if(isSingleByte(buf[0])) return true; // single byte is valid
+ if(!isFirstOfMultibyte(buf[0])) return false; // not single byte, nor valid multi-byte first byte
+ int charContinuationBytes = continuationBytes(buf[0]);
+ if(buflen < charContinuationBytes+1) return false; // character does not fit in buffer
+ for(int i = charContinuationBytes; i>0; --i)
+ if(!isContinuation(*(++buf))) return false; // not enough continuation bytes
+ return true; // the character is valid (if there are too many continuation bytes, it is the next character that will be invalid)
+ }
+
+ // rewinds to the first byte of a multi-byte character for any valid UTF-8 (and will not rewind too much on any other input)
+ inline static int characterStart(const unsigned char* buf, int startingIndex) {
+ int charContinuationBytes = 0;
+ while(charContinuationBytes < startingIndex // rewind past start of buffer?
+ && charContinuationBytes < 5 // UTF-8 support up to 5 continuation bytes (but valid sequences currently do not have more than 3)
+ && isContinuation(buf[startingIndex-charContinuationBytes])
+ )
+ ++charContinuationBytes;
+ return startingIndex-charContinuationBytes;
+ }
+};
Oops, something went wrong.

0 comments on commit 7235eaa

Please sign in to comment.