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 "IOggMuxSettings.h"
00037 #include "PropsOggMux.h"
00038 #include "BasicSeekPassThrough.h"
00039 #include <libOOOgg/OggPageInterleaver.h>
00040 #include <libOOOgg/INotifyComplete.h>
00041 
00042 #include <string>
00043 
00044 #include <fstream>
00045 #include <libOOOgg/IOggCallback.h>
00046 using namespace std;
00047 #include <libilliCore/StringHelper.h>
00048 class OggMuxInputPin;
00049 
00050 class OGG_MUX_API OggMuxFilter
00051         :       public IFileSinkFilter
00052         ,       public CBaseFilter
00053         ,       public IOggCallback
00054         ,       public IAMFilterMiscFlags
00055         ,       public BasicSeekPassThrough
00056         ,       public INotifyComplete
00057         ,       public IOggMuxProgress
00058         ,       public IOggMuxSettings
00059         //,     public ISpecifyPropertyPages
00060 {
00061 public:
00062         OggMuxFilter(void);
00063         OggMuxFilter(REFCLSID inFilterGUID);
00064         virtual ~OggMuxFilter(void);
00065 
00066 
00067         friend class OggMuxInputPin;
00068         //Com Stuff
00069         DECLARE_IUNKNOWN
00070         STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void **ppv);
00071         static CUnknown * WINAPI CreateInstance(LPUNKNOWN pUnk, HRESULT *pHr);
00072 
00073         // *********************************************
00074         // ***** IAMFilterMiscFlags Implementation *****
00075         // *********************************************
00076 
00078         ULONG STDMETHODCALLTYPE GetMiscFlags(void);
00079 
00080         // ***************************************
00081         // ***** IOggCallback Implementation *****
00082         // ***************************************
00083 
00085         virtual bool acceptOggPage(OggPage* inOggPage);
00086         
00087         // ******************************************
00088         // ***** IFileSinkFilter Implementation *****
00089         // ******************************************
00090 
00092         STDMETHODIMP SetFileName(LPCOLESTR inFileName, const AM_MEDIA_TYPE* inMediaType);
00093 
00095         STDMETHODIMP GetCurFile(LPOLESTR* outFileName, AM_MEDIA_TYPE* outMediaType);
00096 
00097         // *************************************
00098         // ***** CBaseFilter Pure Virtuals *****
00099         // *************************************
00100 
00102         virtual int GetPinCount();
00103 
00105         virtual CBasePin* GetPin(int inPinNo);
00106 
00107         // **********************************
00108         // ***** IMediaFilter Overrides *****
00109         // **********************************
00110 
00112         STDMETHODIMP Run(REFERENCE_TIME tStart);
00113 
00115         STDMETHODIMP Pause(void);
00116 
00118         STDMETHODIMP Stop(void);
00119 
00120         // ******************************************
00121         // ***** IOggMuxProgress Implementation *****
00122         // ******************************************
00123 
00125         virtual STDMETHODIMP_(LONGLONG) getProgressTime();
00126 
00128         virtual STDMETHODIMP_(LONGLONG) getBytesWritten();
00129 
00130 
00131         //Helpers
00132         virtual HRESULT addAnotherPin();
00133         virtual void NotifyComplete();
00134 
00135         //IMediaSeeking Override to give progress. - This is unreliable !!
00136         virtual STDMETHODIMP GetPositions(LONGLONG *pCurrent, LONGLONG *pStop);
00137         virtual STDMETHODIMP GetCurrentPosition(LONGLONG *pCurrent);
00138 
00139         //IOggMuxSettings Implementation
00140         STDMETHODIMP_(unsigned long) maxPacketsPerPage();
00141         STDMETHODIMP_(bool) setMaxPacketsPerPage(unsigned long inMaxPacketsPerPage);
00142 
00143         //SpecifyPropertyPages Implementation
00144         //STDMETHODIMP OggMuxFilter::GetPages(CAUUID* outPropPages);
00145 
00146 protected:
00147 
00148         bool SetupOutput();
00149         bool CloseOutput();
00150 
00151         wstring mFileName;
00152         vector<OggMuxInputPin*> mInputPins;
00153 
00154         OggPageInterleaver* mInterleaver;
00155 
00156         CCritSec* mStreamLock;
00157 
00158         fstream mOutputFile;
00159         fstream debugLog;
00160         HRESULT mHR;
00161 
00162 
00163 };

Generated on Thu Feb 16 23:48:15 2006 for oggdsf by  doxygen 1.3.9