OggMuxFilter.h

Go to the documentation of this file.
00001 //===========================================================================
00002 //Copyright (C) 2003, 2004 Zentaro Kavanagh
00003 //
00004 //Redistribution and use in source and binary forms, with or without
00005 //modification, are permitted provided that the following conditions
00006 //are met:
00007 //
00008 //- Redistributions of source code must retain the above copyright
00009 //  notice, this list of conditions and the following disclaimer.
00010 //
00011 //- Redistributions in binary form must reproduce the above copyright
00012 //  notice, this list of conditions and the following disclaimer in the
00013 //  documentation and/or other materials provided with the distribution.
00014 //
00015 //- Neither the name of Zentaro Kavanagh nor the names of contributors 
00016 //  may be used to endorse or promote products derived from this software 
00017 //  without specific prior written permission.
00018 //
00019 //THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
00020 //``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
00021 //LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
00022 //PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE ORGANISATION OR
00023 //CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
00024 //EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
00025 //PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
00026 //PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
00027 //LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
00028 //NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
00029 //SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00030 //===========================================================================
00031 
00032 #pragma once
00033 #include "oggmuxdllstuff.h"
00034 #include "OggMuxInputPin.h"
00035 #include "IOggMuxProgress.h"
00036 #include "BasicSeekPassThrough.h"
00037 #include <libOOOgg/OggPageInterleaver.h>
00038 #include <libOOOgg/INotifyComplete.h>
00039 
00040 #include <string>
00041 
00042 #include <fstream>
00043 #include <libOOOgg/IOggCallback.h>
00044 using namespace std;
00045 #include <libilliCore/StringHelper.h>
00046 class OggMuxInputPin;
00047 
00048 class OGG_MUX_API OggMuxFilter
00049         :       public IFileSinkFilter
00050         ,       public CBaseFilter
00051         ,       public IOggCallback
00052         ,       public IAMFilterMiscFlags
00053         ,       public BasicSeekPassThrough
00054         ,       public INotifyComplete
00055         ,       public IOggMuxProgress
00056 {
00057 public:
00058         OggMuxFilter(void);
00059         OggMuxFilter(REFCLSID inFilterGUID);
00060         virtual ~OggMuxFilter(void);
00061 
00062 
00063         friend class OggMuxInputPin;
00064         //Com Stuff
00065         DECLARE_IUNKNOWN
00066         STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void **ppv);
00067         static CUnknown * WINAPI CreateInstance(LPUNKNOWN pUnk, HRESULT *pHr);
00068 
00069         // *********************************************
00070         // ***** IAMFilterMiscFlags Implementation *****
00071         // *********************************************
00072 
00074         ULONG STDMETHODCALLTYPE GetMiscFlags(void);
00075 
00076         // ***************************************
00077         // ***** IOggCallback Implementation *****
00078         // ***************************************
00079 
00081         virtual bool acceptOggPage(OggPage* inOggPage);
00082         
00083         // ******************************************
00084         // ***** IFileSinkFilter Implementation *****
00085         // ******************************************
00086 
00088         STDMETHODIMP SetFileName(LPCOLESTR inFileName, const AM_MEDIA_TYPE* inMediaType);
00089 
00091         STDMETHODIMP GetCurFile(LPOLESTR* outFileName, AM_MEDIA_TYPE* outMediaType);
00092 
00093         // *************************************
00094         // ***** CBaseFilter Pure Virtuals *****
00095         // *************************************
00096 
00098         virtual int GetPinCount();
00099 
00101         virtual CBasePin* GetPin(int inPinNo);
00102 
00103         // **********************************
00104         // ***** IMediaFilter Overrides *****
00105         // **********************************
00106 
00108         STDMETHODIMP Run(REFERENCE_TIME tStart);
00109 
00111         STDMETHODIMP Pause(void);
00112 
00114         STDMETHODIMP Stop(void);
00115 
00116         // ******************************************
00117         // ***** IOggMuxProgress Implementation *****
00118         // ******************************************
00119 
00121         virtual STDMETHODIMP_(LONGLONG) getProgressTime();
00122 
00124         virtual STDMETHODIMP_(LONGLONG) getBytesWritten();
00125 
00126 
00127         //Helpers
00128         virtual HRESULT addAnotherPin();
00129         virtual void NotifyComplete();
00130 
00131         //IMediaSeeking Override to give progress. - This is unreliable !!
00132         virtual STDMETHODIMP GetPositions(LONGLONG *pCurrent, LONGLONG *pStop);
00133         virtual STDMETHODIMP GetCurrentPosition(LONGLONG *pCurrent);
00134 protected:
00135 
00136         bool SetupOutput();
00137         bool CloseOutput();
00138 
00139         wstring mFileName;
00140         vector<OggMuxInputPin*> mInputPins;
00141 
00142         OggPageInterleaver* mInterleaver;
00143 
00144         CCritSec* mStreamLock;
00145 
00146         fstream mOutputFile;
00147         fstream debugLog;
00148         HRESULT mHR;
00149 
00150 
00151 };

Generated on Tue Feb 15 14:54:20 2005 for oggdsf by  doxygen 1.3.9