BasicSeekPassThrough.cpp

Go to the documentation of this file.
00001 //===========================================================================
00002 //Copyright (C) 2003, 2004 Zentaro Kavanagh
00003 //
00004 //Copyright (C) 2003, 2004 Commonwealth Scientific and Industrial Research
00005 //Organisation (CSIRO) Australia
00006 //
00007 //Redistribution and use in source and binary forms, with or without
00008 //modification, are permitted provided that the following conditions
00009 //are met:
00010 //
00011 //- Redistributions of source code must retain the above copyright
00012 //notice, this list of conditions and the following disclaimer.
00013 //
00014 //- Redistributions in binary form must reproduce the above copyright
00015 //notice, this list of conditions and the following disclaimer in the
00016 //documentation and/or other materials provided with the distribution.
00017 //
00018 //- Neither the name of CSIRO Australia nor the names of its
00019 //contributors may be used to endorse or promote products derived from
00020 //this software without specific prior written permission.
00021 //
00022 //THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
00023 //``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
00024 //LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
00025 //PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE ORGANISATION OR
00026 //CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
00027 //EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
00028 //PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
00029 //PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
00030 //LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
00031 //NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
00032 //SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00033 //===========================================================================
00034 
00035 #include "stdafx.h"
00036 #include "BasicSeekPassThrough.h"
00037 
00038 BasicSeekPassThrough::BasicSeekPassThrough(IMediaSeeking* inDelegate)
00039         //: CUnknown(NAME("Basic Seekable Thing"), NULL, &mHR)
00040 {
00041         mSeekDelegate = inDelegate;
00042         //mSeekTimeBase = 0;
00043 
00044                 mSeekingCap = 0;
00045         mSeekingCap =           AM_SEEKING_CanSeekAbsolute |
00046                                                 AM_SEEKING_CanSeekForwards |
00047                                                 AM_SEEKING_CanSeekBackwards |
00048                                                 //AM_SEEKING_CanGetCurrentPos |
00049                                                 AM_SEEKING_CanGetStopPos |
00050                                                 AM_SEEKING_CanGetDuration;
00051 
00052         //string x = "g:\\logs\\seeker.log";
00053         //seekDebug.open(x.c_str(), ios_base::out);
00054 
00055 }
00056 
00057 BasicSeekPassThrough::BasicSeekPassThrough(void)
00058         //: CUnknown(NAME("Basic Seekable Thing"), NULL, &mHR) 
00059 {
00060         //mSeekTimeBase = 0;
00061         mSeekDelegate = NULL;   
00062         mSeekingCap =           AM_SEEKING_CanSeekAbsolute |
00063                                                 AM_SEEKING_CanSeekForwards |
00064                                                 AM_SEEKING_CanSeekBackwards |
00065                                                 //AM_SEEKING_CanGetCurrentPos |
00066                                                 AM_SEEKING_CanGetStopPos |
00067                                                 AM_SEEKING_CanGetDuration;
00068         
00069         //string x = "g:\\logs\\seeker.log";
00070         //seekDebug.open(x.c_str(), ios_base::out);
00071         
00072 
00073 }
00074 
00075 bool BasicSeekPassThrough::ReleaseDelegate() {
00076         if (mSeekDelegate != NULL) {
00077                 mSeekDelegate->Release();
00078                 mSeekDelegate = NULL;
00079         }
00080         return true;
00081 }
00082 
00083 bool BasicSeekPassThrough::SetDelegate(IMediaSeeking* inDelegate) {
00084         mSeekDelegate = inDelegate;
00085         return true;
00086 }
00087 BasicSeekPassThrough::~BasicSeekPassThrough(void)
00088 {
00089         //TODO::: FActor this... use the new releasedelegate function.
00090         if (mSeekDelegate != NULL) {
00091                 mSeekDelegate->Release();
00092                 mSeekDelegate = NULL;
00093         }
00094         //seekDebug.close();
00095 }
00096 //IMediaSeeking Interface
00097 STDMETHODIMP BasicSeekPassThrough::GetCapabilities(DWORD* inCapabilities) {
00098 //typedef 
00099 //enum AM_SEEKING_SeekingCapabilities {
00100 //    AM_SEEKING_CanSeekAbsolute        = 0x1,
00101 //    AM_SEEKING_CanSeekForwards        = 0x2,
00102 //    AM_SEEKING_CanSeekBackwards       = 0x4,
00103 //    AM_SEEKING_CanGetCurrentPos       = 0x8,
00104 //    AM_SEEKING_CanGetStopPos          = 0x10,
00105 //    AM_SEEKING_CanGetDuration         = 0x20,
00106 //    AM_SEEKING_CanPlayBackwards       = 0x40,
00107 //    AM_SEEKING_CanDoSegments          = 0x80,
00108 //    AM_SEEKING_Source                 = 0x100
00109 //}   AM_SEEKING_SEEKING_CAPABILITIES;
00110 
00111         
00112         //*inCapabilities       =       mSeekingCap;
00113         //return S_OK;
00114         
00115         if (mSeekDelegate != NULL) {
00116                 //seekDebug<<"GetCaps : Passed on..."<<endl;
00117                 return mSeekDelegate->GetCapabilities(inCapabilities);
00118         } else {
00119                 //seekDebug<<"GetCaps : NULL Delegate"<<endl;
00120                 //This is probably wrong.
00121                 return E_NOTIMPL;
00122         }
00123 
00124 }
00125 STDMETHODIMP BasicSeekPassThrough::CheckCapabilities(DWORD* outCapabilities) {
00126         
00127         
00128         //if (inCapabilities == NULL) {
00129         //      return E_POINTER;
00130         //}
00131         //*inCapabilities &= mSeekingCap;
00132 
00133         //if (*inCapabilities == mSeekingCap) {
00134         //      return S_OK;
00135         //} else {
00136         //      return E_NOTIMPL;
00137         //}
00138 
00139 
00140         if (mSeekDelegate != NULL) {
00141                 //seekDebug<<"CheckCaps : Passed on..."<<endl;
00142                 return mSeekDelegate->CheckCapabilities(outCapabilities);
00143         } else {
00144                 //seekDebug<<"CheckCaps : NULL Delegate"<<endl;
00145                 //This is probably wrong.
00146                 return E_NOTIMPL;
00147         }
00148 
00149 }
00150 STDMETHODIMP BasicSeekPassThrough::IsFormatSupported(const GUID* inFormat) {
00151 
00152         //if (inFormat == NULL) {
00153         //      return E_POINTER;
00154         //}
00155         //if (*inFormat == TIME_FORMAT_MEDIA_TIME) {
00156         //      return S_OK;
00157         //} else {
00158         //      return S_FALSE;
00159         //}
00160 
00161         if (mSeekDelegate != NULL) {
00162                 //seekDebug<<"IsFromatsupp : Passed on..."<<endl;
00163                 return mSeekDelegate->IsFormatSupported(inFormat);
00164         } else {
00165                 //seekDebug<<"IsFromatsupp : NULL Delegate"<<endl;
00166                 //This is probably wrong.
00167                 return E_NOTIMPL;
00168         }
00169 
00170 }
00171 STDMETHODIMP BasicSeekPassThrough::QueryPreferredFormat(GUID* outFormat) {
00172         //if (inFormat == NULL) {
00173         //      return E_POINTER;
00174         //}
00175 
00176         //*outFormat = TIME_FORMAT_MEDIA_TIME;
00177 
00178         //return S_OK;
00179         if (mSeekDelegate != NULL) {
00180                 //seekDebug<<"Query preff : Passed on..."<<endl;
00181                 return mSeekDelegate->QueryPreferredFormat(outFormat);
00182         } else {
00183                 //seekDebug<<"Query preff : NULL Delegate"<<endl;
00184                 //This is probably wrong.
00185                 return E_NOTIMPL;
00186         }
00187 
00188 }
00189 STDMETHODIMP BasicSeekPassThrough::SetTimeFormat(const GUID* inFormat) {
00190 
00191         if (mSeekDelegate != NULL) {
00192                 //seekDebug<<"SetTimeformat :Passed on..."<<endl;
00193                 return mSeekDelegate->SetTimeFormat(inFormat);
00194         } else {
00195                 //seekDebug<<"SetTimeformat : NULL Delegate"<<endl;
00196                 //This is probably wrong.
00197                 return E_NOTIMPL;
00198         }
00199 }
00200 
00201 STDMETHODIMP  BasicSeekPassThrough::GetTimeFormat( GUID *outFormat) {
00202         if (mSeekDelegate != NULL) {
00203                 //seekDebug<<"Gettimeformat : Passed on..."<<endl;
00204                 return mSeekDelegate->GetTimeFormat(outFormat);
00205         } else {
00206                 //seekDebug<<"Gettimeformat : NULL Delegate"<<endl;
00207                 //This is probably wrong.
00208                 return E_NOTIMPL;
00209         }
00210 }
00211 STDMETHODIMP BasicSeekPassThrough::GetDuration(LONGLONG* outDuration) {
00212 
00213         if (mSeekDelegate != NULL) {
00214                 //seekDebug<<"Getdureation : Passed on..."<<endl;
00215                 return mSeekDelegate->GetDuration(outDuration);
00216         } else {
00217                 //seekDebug<<"Getdureation : NULL Delegate"<<endl;
00218                 //This is probably wrong.
00219                 return E_NOTIMPL;
00220         }
00221         //return E_NOTIMPL;
00222 }
00223 STDMETHODIMP BasicSeekPassThrough::GetStopPosition(LONGLONG* inStop) {
00224         if (mSeekDelegate != NULL) {
00225                 //seekDebug<<"Getstoppos : Passed on..."<<endl;
00226                 return mSeekDelegate->GetStopPosition(inStop);
00227         } else {
00228                 //seekDebug<<"Getstoppos : NULL Delegate"<<endl;
00229                 //This is probably wrong.
00230                 return E_NOTIMPL;
00231         }
00232         //return E_NOTIMPL;
00233 }
00234 STDMETHODIMP BasicSeekPassThrough::GetCurrentPosition(LONGLONG* outCurrent) {
00235         //return E_NOTIMPL;
00236         
00237         if (mSeekDelegate != NULL) {
00238                 //seekDebug<<"Getcurrpos : Passed on..."<<endl;
00239                 return mSeekDelegate->GetCurrentPosition(outCurrent);
00240         } else {
00241                 //seekDebug<<"Getcurrpos : NULL Delegate"<<endl;
00242                 //This is probably wrong.
00243                 return E_NOTIMPL;
00244         }
00245 }
00246 STDMETHODIMP BasicSeekPassThrough::ConvertTimeFormat(LONGLONG* outTarget, const GUID* inTargetFormat, LONGLONG inSource, const GUID* inSourceFormat) {
00247         //return E_NOTIMPL;
00248         if (mSeekDelegate != NULL) {
00249                 //seekDebug<<"ConvTimeformat : Passed on..."<<endl;
00250                 return mSeekDelegate->ConvertTimeFormat(outTarget, inTargetFormat, inSource, inSourceFormat);
00251         } else {
00252                 //seekDebug<<"ConvTimeformat : NULL Delegate"<<endl;
00253                 //This is probably wrong.
00254                 return E_NOTIMPL;
00255         }
00256 }       
00257 STDMETHODIMP BasicSeekPassThrough::SetPositions(LONGLONG* inoutCurrent, DWORD inCurrentFlags, LONGLONG* inStop, DWORD inStopFlags) {
00258         if (mSeekDelegate != NULL) {
00259                 //seekDebug<<"Set pos : Requested Time : "<<*inoutCurrent<<endl;
00260                 HRESULT locHR = mSeekDelegate->SetPositions(inoutCurrent, inCurrentFlags, inStop, inStopFlags);
00261                 if (locHR == S_OK) {
00262                         //mSeekTimeBase = *inoutCurrent;
00263                         //seekDebug<<"Set Pos : Actual Time   : "<<*inoutCurrent<<endl;
00264                         
00265                 }
00266                 return locHR;
00267         } else {
00268                 //seekDebug<<"Set pos : NULL Delegate"<<endl;
00269                 //This is probably wrong.
00270                 return E_NOTIMPL;
00271         }
00272 
00273 }
00274 STDMETHODIMP BasicSeekPassThrough::GetPositions(LONGLONG* outCurrent, LONGLONG* outStop) {
00275         if (mSeekDelegate != NULL) {
00276                 //seekDebug<<"GetPos : Passed on..."<<endl;
00277                 return mSeekDelegate->GetPositions(outCurrent, outStop);
00278         } else {
00279                 //seekDebug<<"GetPos : NULL Delegate"<<endl;
00280                 //This is probably wrong.
00281                 return E_NOTIMPL;
00282         }
00283 
00284 }
00285 STDMETHODIMP BasicSeekPassThrough::GetAvailable(LONGLONG* outEarliest, LONGLONG* outLatest) {
00286         if (mSeekDelegate != NULL) {
00287                 //seekDebug<<"Getavail : Passed on..."<<endl;
00288                 return mSeekDelegate->GetAvailable(outEarliest, outLatest);
00289         } else {
00290                 //seekDebug<<"Getavail : NULL Delegate"<<endl;
00291                 //This is probably wrong.
00292                 return E_NOTIMPL;
00293         }
00294 }
00295 STDMETHODIMP BasicSeekPassThrough::SetRate(double inRate) {
00296 
00297         if (mSeekDelegate != NULL) {
00298                 //seekDebug<<"Setrate : Passed on..."<<endl;
00299                 return mSeekDelegate->SetRate(inRate);
00300         } else {
00301                 //seekDebug<<"Setrate : NULL Delegate"<<endl;
00302                 //This is probably wrong.
00303                 return E_NOTIMPL;
00304         }
00305 }
00306 STDMETHODIMP BasicSeekPassThrough::GetRate(double* outRate) {
00307         if (mSeekDelegate != NULL) {
00308                 //seekDebug<<"Getrate : Passed on..."<<endl;
00309                 return mSeekDelegate->GetRate(outRate);
00310         } else {
00311                 //seekDebug<<"Getrate : NULL Delegate"<<endl;
00312                 //This is probably wrong.
00313                 return E_NOTIMPL;
00314         }
00315 }
00316 STDMETHODIMP BasicSeekPassThrough::GetPreroll(LONGLONG* outPreroll) {
00317         if (mSeekDelegate != NULL) {
00318                 //seekDebug<<"Getpreroll : Passed on..."<<endl;
00319                 return mSeekDelegate->GetPreroll(outPreroll);
00320         } else {
00321                 //seekDebug<<"Getpreroll : NULL Delegate"<<endl;
00322                 //This is probably wrong.
00323                 return E_NOTIMPL;
00324         }
00325 }
00326 STDMETHODIMP BasicSeekPassThrough::IsUsingTimeFormat(const GUID* inFormat) {
00327 if (mSeekDelegate != NULL) {
00328                 //seekDebug<<"Isusingtimeformat : Passed on..."<<endl;
00329                 return mSeekDelegate->IsUsingTimeFormat(inFormat);
00330         } else {
00331                 //seekDebug<<"Isusingtimeformat : NULL Delegate"<<endl;
00332                 //This is probably wrong.
00333                 return E_NOTIMPL;
00334         }
00335 }
00336 //

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