RoQSplitter.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 "..\BaseSplitter\BaseSplitter.h"
00025 
00026 // {48B93619-A959-45d9-B5FD-E12A67A96CF1}
00027 DEFINE_GUID(MEDIASUBTYPE_RoQ, 
00028 0x48b93619, 0xa959, 0x45d9, 0xb5, 0xfd, 0xe1, 0x2a, 0x67, 0xa9, 0x6c, 0xf1);
00029 
00030 // 56516F52-0000-0010-8000-00AA00389B71  'RoQV' == MEDIASUBTYPE_RoQV
00031 DEFINE_GUID(MEDIASUBTYPE_RoQV,
00032 0x56516F52, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71);
00033 
00034 #define WAVE_FORMAT_RoQA 0x41516F52
00035 
00036 // 41516F52-0000-0010-8000-00AA00389B71  'RoQA' == MEDIASUBTYPE_RoQA
00037 DEFINE_GUID(MEDIASUBTYPE_RoQA,
00038 WAVE_FORMAT_RoQA, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71);
00039 
00040 #pragma pack(push, 1)
00041 struct roq_chunk {WORD id; DWORD size; WORD arg;};
00042 struct roq_info {WORD w, h, unk1, unk2;};
00043 #pragma pack(pop)
00044 
00045 [uuid("C73DF7C1-21F2-44C7-A430-D35FB9BB298F")]
00046 class CRoQSplitterFilter : public CBaseSplitterFilter
00047 {
00048         CComPtr<IAsyncReader> m_pAsyncReader;
00049 
00050         struct index {REFERENCE_TIME rtv, rta; __int64 fp;};
00051         CList<index> m_index;
00052         POSITION m_indexpos;
00053 
00054 protected:
00055         HRESULT CreateOutputs(IAsyncReader* pAsyncReader);
00056 
00057         bool DemuxInit();
00058         void DemuxSeek(REFERENCE_TIME rt);
00059         bool DemuxLoop();
00060 
00061 public:
00062         CRoQSplitterFilter(LPUNKNOWN pUnk, HRESULT* phr);
00063 };
00064 
00065 [uuid("02B8E5C2-4E1F-45D3-9A8E-B8F1EDE6DE09")]
00066 class CRoQSourceFilter : public CRoQSplitterFilter
00067 {
00068 public:
00069         CRoQSourceFilter(LPUNKNOWN pUnk, HRESULT* phr);
00070 };
00071 
00072 [uuid("FBEFC5EC-ABA0-4E6C-ACA3-D05FDFEFB853")]
00073 class CRoQVideoDecoder : public CTransformFilter
00074 {
00075         CCritSec m_csReceive;
00076 
00077         REFERENCE_TIME m_rtStart;
00078 
00079         BYTE* m_y[2];
00080         BYTE* m_u[2];
00081         BYTE* m_v[2];
00082         int m_pitch;
00083 
00084         void Copy(BYTE* pOut, BYTE* pIn, DWORD w, DWORD h);
00085 
00086         #pragma pack(push, 1)
00087         struct roq_cell {BYTE y0, y1, y2, y3, u, v;} m_cells[256];
00088         struct roq_qcell {roq_cell* idx[4];} m_qcells[256];
00089         #pragma pack(pop)
00090         void apply_vector_2x2(int x, int y, roq_cell* cell);
00091         void apply_vector_4x4(int x, int y, roq_cell* cell);
00092         void apply_motion_4x4(int x, int y, unsigned char mv, char mean_x, char mean_y);
00093         void apply_motion_8x8(int x, int y, unsigned char mv, char mean_x, char mean_y);
00094 
00095 public:
00096         CRoQVideoDecoder(LPUNKNOWN lpunk, HRESULT* phr);
00097         virtual ~CRoQVideoDecoder();
00098 
00099     HRESULT NewSegment(REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate);
00100 
00101         HRESULT Transform(IMediaSample* pIn, IMediaSample* pOut);
00102         HRESULT CheckInputType(const CMediaType* mtIn);
00103         HRESULT CheckTransform(const CMediaType* mtIn, const CMediaType* mtOut);
00104         HRESULT DecideBufferSize(IMemAllocator* pAllocator, ALLOCATOR_PROPERTIES* pProperties);
00105         HRESULT GetMediaType(int iPosition, CMediaType* pMediaType);
00106 
00107         HRESULT StartStreaming();
00108         HRESULT StopStreaming();
00109 };
00110 
00111 [uuid("226FAF85-E358-4502-8C98-F4224BE76953")]
00112 class CRoQAudioDecoder : public CTransformFilter
00113 {
00114 public:
00115         CRoQAudioDecoder(LPUNKNOWN lpunk, HRESULT* phr);
00116         virtual ~CRoQAudioDecoder();
00117 
00118         HRESULT Transform(IMediaSample* pIn, IMediaSample* pOut);
00119         HRESULT CheckInputType(const CMediaType* mtIn);
00120         HRESULT CheckTransform(const CMediaType* mtIn, const CMediaType* mtOut);
00121         HRESULT DecideBufferSize(IMemAllocator* pAllocator, ALLOCATOR_PROPERTIES* pProperties);
00122         HRESULT GetMediaType(int iPosition, CMediaType* pMediaType);
00123 };
00124 

Generated on Tue Dec 13 14:47:22 2005 for guliverkli by  doxygen 1.4.5