updated mpg123 to 1.17.0

This commit is contained in:
fysx
2014-01-28 00:30:52 +01:00
parent 35f95a0c58
commit 4b6c1b51c9
533 changed files with 40135 additions and 11448 deletions
@@ -0,0 +1,15 @@
// ------------------------------------------------------------------------------------------------
#pragma once
// ------------------------------------------------------------------------------------------------
protected:
::FILE *m_pFile;
PBYTE m_pucMemData;
DWORD m_dwLength;
DWORD m_dwReadPos;
// ------------------------------------------------------------------------------------------------
@@ -0,0 +1,139 @@
// ------------------------------------------------------------------------------------------------
#pragma once
// ------------------------------------------------------------------------------------------------
#ifdef _DEBUG
#pragma comment(lib, "libMPG123_d.lib")
#else
#pragma comment(lib, "libMPG123.lib")
#endif
// ------------------------------------------------------------------------------------------------
#include "../DShowBase/streams.h"
#include <CORE/SourceFilter_AsyncIO.H>
#include <CORE/SourceFilter_AsyncReader.H>
#include "../../libMPG123/MPG123.H"
#include <IIEP_FileIn.H>
// ------------------------------------------------------------------------------------------------
#define WAVE_HEADER_LENGTH 44
// ------------------------------------------------------------------------------------------------
#define MP3_DECODE_LEN 0x4000
#define MP3_DECODE_BUF_LEN 0x8000
// ------------------------------------------------------------------------------------------------
namespace IIEP
{
class CMP3Stream : public CAsyncStream
{
public:
CMP3Stream(void);
~CMP3Stream(void);
void SetSeekFlag(void);
bool Open(const WORD *pcwsFileName, CMediaType &coMT, DWORD dwKBPerSec = INFINITE);
void Close(void);
HRESULT SetPointer(LONGLONG llPos);
HRESULT Read(PBYTE pucBuffer,
DWORD dwBytesToRead,
BOOL bAlign,
LPDWORD pdwBytesRead);
LONGLONG Size(LONGLONG *pSizeAvailable);
DWORD Alignment(void);
void Lock (void);
void Unlock(void);
bool DecodeFrame(void);
//
bool OpenFile(const WORD *pcwsFileName);
DWORD ReadFile(PVOID pBuf , DWORD dwLen );
long SeekFile(long nOffset, int iOrigin);
//
private:
CCritSec m_csLock;
DWORD m_dwKBPerSec;
DWORD m_dwTimeStart;
mpg123_handle *m_pcoMH;
DWORD m_dwTotalBlocks;
DWORD m_dwAlignment;
DWORD m_dwLength;
DWORD m_dwPosition;
BYTE m_ucHeader[WAVE_HEADER_LENGTH];
//
DWORD m_dwDataBufPos;
DWORD m_dwDataBufLen;
BYTE m_ucDataBuffer[MP3_DECODE_BUF_LEN];
//
bool m_bSeekFlag;
//
IIEP::CFileIn m_coFileIn;
long m_nDataBegin;
long m_nDataTotal;
};
// ----------------------------------------------------------------------------------------------
class CMP3Reader : public CAsyncReader
{
public:
// We're not going to be CoCreate'd so we don't need registration stuff etc
STDMETHODIMP Register(void)
{
return S_OK;
}
STDMETHODIMP Unregister(void)
{
return S_OK;
}
CMP3Reader(CMP3Stream *pcoStream,
CMediaType *pcoMT,
HRESULT *phr) :
CAsyncReader(NAME("MP3 Reader\0"),
NULL,
pcoStream,
phr)
{
m_coMT = *pcoMT;
}
};
}
// ------------------------------------------------------------------------------------------------
@@ -0,0 +1,206 @@
//
// __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __
// /_//_//_//_/\ /_//_//_//_/\ /_//_//_//_/\ /_//_//_//_/\
// \_/_//_/\\_\/ \_/_//_/\\_\//_/\\_\\_\\_\//_/\\_\\_/_/\/
// /_//_/\/ /_//_/\/ /_/\/ __ /_/\/ __ /_/\/
// /_//_/\/ /_//_/\/ /_//_//_/\ /_//_//_//_/\/
// /_//_/\/ /_//_/\/ /_/\\_\\_\/ /_/\\_\\_\\_\/
// __ /_//_/\/ __ /_//_/\/ /_/\/ __ __ /_/\/
// /_//_//_//_/\ /_//_//_//_/\ /_//_//_//_/\ /_/\/
// \_\\_\\_\\_\/ \_\\_\\_\\_\/ \_\\_\\_\\_\/ \_\/
//
//
// ..:: Interactive Internet Entertainment Platform ::..
//
// (C) 2000-2006, FAN YI PENG. ALL RIGHTS RESERVED
//
// ________________________________________________________________________________________________
//
/// @file IIEP_Def.H
/// @brief 基本定义
// ________________________________________________________________________________________________
//
//
// _____________________________________
// | |
// | DATA |
// _____________________________|_____________________________________|____________________________
//
// __________
// __________________________________________| CONFIG |__________________________________________
#pragma once
#ifdef _DEBUG
#pragma comment(lib, "IIEP_DBG.LIB")
#else
#pragma comment(lib, "IIEP.LIB")
#endif
// ____________________________________________ CONFIG ____________________________________________
//
// __________
// __________________________________________| DEFINE |__________________________________________
//
// _____________
// ____/ Data Type \_____________________________________________________________________________
typedef unsigned char BYTE;
typedef unsigned short WORD;
typedef unsigned long DWORD;
typedef __int64 QWORD;
typedef BYTE *PBYTE;
typedef WORD *PWORD;
typedef DWORD *PDWORD;
typedef QWORD *PQWORD;
typedef void *PVOID;
// ______ Data Type _______________________________________________________________________________
//
// ___________
// ____/ Release \_______________________________________________________________________________
#define SAFE_DELETE(p) if (p) { delete (p); (p) = 0; }
#define SAFE_DELETE_ARRAY(p) if (p) { delete[] (p); (p) = 0; }
#define SAFE_RELEASE(p) if (p) { (p) -> Release(); (p) = 0; }
// ______ Release _________________________________________________________________________________
//
// __________
// ____/ Assert \________________________________________________________________________________
#ifndef ASSERT
#ifdef _DEBUG
namespace IIEP { bool AssertFunction(bool, long, const char *, const char *); }
#define ASSERT(expression) \
if (IIEP::AssertFunction((bool) (expression), __LINE__, __FILE__, __FUNCTION__)) {_asm {int 3}}
#else
#define ASSERT(expression)
#endif
#endif
// ______ Assert __________________________________________________________________________________
//
// _______
// ____/ LOG \___________________________________________________________________________________
namespace IIEP
{
void DebugLog(const char *pcszFormat, ...);
void DebugLog(const WORD *pcwsFormat, ...);
void WriteLog(const char *pcszFormat, ...);
void WriteLog(const WORD *pcwsFormat, ...);
}
// ______ LOG _____________________________________________________________________________________
//
// ________
// ____/ TODO \__________________________________________________________________________________
#ifdef _DEBUG
#define TODO \
IIEP::DebugLog("\n[TODO] %d: \"%s\"- %s()\n~~~~~~\n", __LINE__, __FILE__, __FUNCTION__);
#define ToDo(x) \
IIEP::DebugLog("\n[TODO] %d: \"%s\"- %s(): %s\n~~~~~~\n", __LINE__, __FILE__, __FUNCTION__, (x));
#else
#define TODO
#define ToDo(x)
#endif
// ______ TODO ____________________________________________________________________________________
//
// ________
// ____/ Path \__________________________________________________________________________________
namespace IIEP
{
void ResetToExePath(void);
}
// ______ Path ____________________________________________________________________________________
//
// __________
// ____/ CMutex \________________________________________________________________________________
namespace IIEP
{
class CMutex
{
public:
CMutex(void) { m_bLocked = false; }
~CMutex(void) {}
void Lock(void);
void Unlock(void) { m_bLocked = false; }
void Set(void) { m_bLocked = true; }
void Wait(void);
bool IsLock(void) const { return m_bLocked; }
private:
volatile bool m_bLocked;
};
}
// ______ CMutex __________________________________________________________________________________
//
// _________
// ____/ SRect \_________________________________________________________________________________
namespace IIEP
{
/// @brief 矩形结构
struct SRect
{
SRect(void) {}
SRect(long nX, long nY, long nWidth, long nHeight)
{
m_nX = nX;
m_nY = nY;
m_nWidth = nWidth;
m_nHeight = nHeight;
}
// -------------------------------------------------------------------------------------------
void Set(long nX, long nY, long nWidth, long nHeight)
{
m_nX = nX;
m_nY = nY;
m_nWidth = nWidth;
m_nHeight = nHeight;
}
// -------------------------------------------------------------------------------------------
long m_nX; ///< 矩形左上角 X 轴坐标
long m_nY; ///< 矩形左上角 Y 轴坐标
long m_nWidth; ///< 矩形宽度
long m_nHeight; ///< 矩形高度
};
}
// ______ SRect ___________________________________________________________________________________
//
// ___________________________
// ____/ Sample Grabber CallBack \_______________________________________________________________
namespace IIEP
{
typedef void (*CALLBACK_SampleGrabberBuffer) (PVOID, DWORD);
}
// ______ Sample Grabber CallBack _________________________________________________________________
//
// ____________________________________________ DEFINE ____________________________________________
//
// ____________________________________________________________________________________ DATA ______
//
// ___________________________________________ FILE END ___________________________________________
@@ -0,0 +1,167 @@
//
// __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __
// /_//_//_//_/\ /_//_//_//_/\ /_//_//_//_/\ /_//_//_//_/\
// \_/_//_/\\_\/ \_/_//_/\\_\//_/\\_\\_\\_\//_/\\_\\_/_/\/
// /_//_/\/ /_//_/\/ /_/\/ __ /_/\/ __ /_/\/
// /_//_/\/ /_//_/\/ /_//_//_/\ /_//_//_//_/\/
// /_//_/\/ /_//_/\/ /_/\\_\\_\/ /_/\\_\\_\\_\/
// __ /_//_/\/ __ /_//_/\/ /_/\/ __ __ /_/\/
// /_//_//_//_/\ /_//_//_//_/\ /_//_//_//_/\ /_/\/
// \_\\_\\_\\_\/ \_\\_\\_\\_\/ \_\\_\\_\\_\/ \_\/
//
//
// ..:: Interactive Internet Entertainment Platform ::..
//
// (C) 2000-2005, FAN YI PENG. ALL RIGHTS RESERVED
//
// ________________________________________________________________________________________________
//
/// @file IIEP_FileIn.H
/// @brief 文件输入接口类
// ________________________________________________________________________________________________
//
//
// _____________________________________
// | |
// | DATA |
// _____________________________|_____________________________________|____________________________
//
// __________
// __________________________________________| CONFIG |__________________________________________
#pragma once
// ____________________________________________ CONFIG ____________________________________________
//
// __________
// __________________________________________| HEADER |__________________________________________
#include <stdio.h>
#include <string>
#include <IIEP_Def.H>
// ____________________________________________ HEADER ____________________________________________
//
// __________
// __________________________________________| DEFINE |__________________________________________
//
// ___________
// ____/ CFileIn \_______________________________________________________________________________
namespace IIEP
{
/// @brief 文件输入接口类
class CFileIn
{
public:
CFileIn(void);
~CFileIn(void);
bool Open(const char *pcszFileName);
bool Open(const WORD *pcwsFileName);
void Close(void);
DWORD GetFileSize(void) const;
DWORD GetReadPosition(void) const;
bool Seek(long nOffset, long nOrigin = 0); // SEEK_SET = 0 SEEK_CUR = 1 SEEK_END = 2
bool Skip(long nOffset) { return Seek(nOffset, 1); }
DWORD Read(PVOID pDataBuffer, DWORD dwReadSize);
bool ReadB(BYTE &ucData)
{
return (1 == Read(&ucData, 1));
}
bool ReadW(WORD &wData)
{
return (2 == Read(&wData, 2));
}
bool ReadDW(DWORD &dwData)
{
return (4 == Read(&dwData, 4));
}
bool ReadInverseW(WORD &wData)
{
if (2 == Read(&wData, 2))
{
_asm
{
MOV ECX, wData
MOV AX, [ECX]
XCHG AH, AL
MOV [ECX], AX
}
return true;
}
return false;
}
bool ReadInverseDW(DWORD &dwData)
{
if (4 == Read(&dwData, 4))
{
_asm
{
MOV ECX, dwData
MOV EAX, [ECX]
BSWAP EAX
MOV [ECX], EAX
}
return true;
}
return false;
}
// --------------------------------------------------------------------------------------------
bool ReadAnsiLine(std::string &strLine);
bool ReadUnicodeLine(std::wstring &wstrLine, bool bBigEndian);
bool ReadAnsiString (char *pszBuffer, DWORD dwBufferLength);
bool ReadUnicodeString(WORD *pwzBuffer, DWORD dwBufferLength);
// --------------------------------------------------------------------------------------------
private:
CFileIn(const CFileIn &); // forbidden
CFileIn & operator = (const CFileIn &); // forbidden
#include <CORE/CORE_FileIn.H>
};
}
// ______ CFileIn _________________________________________________________________________________
//
// _______________
// ____/ Memory File \___________________________________________________________________________
namespace IIEP
{
bool CreateMemoryFile(PVOID pMemory, DWORD dwLength, const char *pcszFileName);
bool CreateMemoryFile(PVOID pMemory, DWORD dwLength, const WORD *pcwsFileName);
bool RemoveMemoryFile(const char *pcszFileName);
bool RemoveMemoryFile(const WORD *pcwsFileName);
void RemoveMemoryFile(void);
}
// ______ Memory File _____________________________________________________________________________
//
// ____________________________________________ DEFINE ____________________________________________
//
// ____________________________________________________________________________________ DATA ______
//
// ___________________________________________ FILE END ___________________________________________