00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #pragma once
00023
00024 #include <atlbase.h>
00025 #include "..\asyncreader\asyncio.h"
00026 #include "..\asyncreader\asyncrdr.h"
00027
00028 class CCDXAStream : public CAsyncStream
00029 {
00030 private:
00031 enum
00032 {
00033 RIFFCDXA_HEADER_SIZE = 44,
00034 RAW_SYNC_SIZE = 12,
00035 RAW_HEADER_SIZE = 4,
00036 RAW_SUBHEADER_SIZE = 8,
00037 RAW_DATA_SIZE = 2324,
00038 RAW_EDC_SIZE = 4,
00039 RAW_SECTOR_SIZE = 2352
00040 };
00041
00042 CCritSec m_csLock;
00043
00044 HANDLE m_hFile;
00045 LONGLONG m_llPosition, m_llLength;
00046 int m_nFirstSector;
00047
00048 int m_nBufferedSector;
00049 BYTE m_sector[RAW_SECTOR_SIZE];
00050
00051 bool LookForMediaSubType();
00052
00053 public:
00054 CCDXAStream();
00055 virtual ~CCDXAStream();
00056
00057 bool Load(const WCHAR* fnw);
00058
00059 HRESULT SetPointer(LONGLONG llPos);
00060 HRESULT Read(PBYTE pbBuffer, DWORD dwBytesToRead, BOOL bAlign, LPDWORD pdwBytesRead);
00061 LONGLONG Size(LONGLONG* pSizeAvailable);
00062 DWORD Alignment();
00063 void Lock();
00064 void Unlock();
00065
00066 GUID m_subtype;
00067 };
00068
00069 [uuid("D367878E-F3B8-4235-A968-F378EF1B9A44")]
00070 class CCDXAReader
00071 : public CAsyncReader
00072 , public IFileSourceFilter
00073 {
00074 CCDXAStream m_stream;
00075 CStringW m_fn;
00076
00077 public:
00078 CCDXAReader(IUnknown* pUnk, HRESULT* phr);
00079 ~CCDXAReader();
00080
00081 DECLARE_IUNKNOWN
00082 STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
00083
00084
00085 STDMETHODIMP Load(LPCOLESTR pszFileName, const AM_MEDIA_TYPE* pmt);
00086 STDMETHODIMP GetCurFile(LPOLESTR* ppszFileName, AM_MEDIA_TYPE* pmt);
00087 };