- Main Page
- Namespaces
- Classes
- Files
- Directories

- File List
- File Members

# CDXAReader.h

    00001 /*
    00002  *      Copyright (C) 2003-2005 Gabest
    00003  *      http://www.gabest.org
    00004  *
    00005  *  This Program is free software; you can redistribute it and/or modify
    00006  *  it under the terms of the GNU General Public License as published by
    00007  *  the Free Software Foundation; either version 2, or (at your option)
    00008  *  any later version.
    00009  *
    00010  *  This Program is distributed in the hope that it will be useful,
    00011  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
    00012  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    00013  *  GNU General Public License for more details.
    00014  *
    00015  *  You should have received a copy of the GNU General Public License
    00016  *  along with GNU Make; see the file COPYING.  If not, write to
    00017  *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
    00018  *  http://www.gnu.org/copyleft/gpl.html
    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, // usually...
    00034                 RAW_SYNC_SIZE = 12, // 00 FF .. FF 00
    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         // IFileSourceFilter
    00085         STDMETHODIMP Load(LPCOLESTR pszFileName, const AM_MEDIA_TYPE* pmt);
    00086         STDMETHODIMP GetCurFile(LPOLESTR* ppszFileName, AM_MEDIA_TYPE* pmt);
    00087 };