1baa3858d3f5d128a5c8466b700098109edcad5f2repo sync// CreateCoder.cpp 2baa3858d3f5d128a5c8466b700098109edcad5f2repo sync 3baa3858d3f5d128a5c8466b700098109edcad5f2repo sync#include "StdAfx.h" 4baa3858d3f5d128a5c8466b700098109edcad5f2repo sync 5baa3858d3f5d128a5c8466b700098109edcad5f2repo sync#include "../../Windows/Defs.h" 6baa3858d3f5d128a5c8466b700098109edcad5f2repo sync#include "../../Windows/PropVariant.h" 7baa3858d3f5d128a5c8466b700098109edcad5f2repo sync 8baa3858d3f5d128a5c8466b700098109edcad5f2repo sync#include "CreateCoder.h" 9baa3858d3f5d128a5c8466b700098109edcad5f2repo sync 10baa3858d3f5d128a5c8466b700098109edcad5f2repo sync#include "FilterCoder.h" 11baa3858d3f5d128a5c8466b700098109edcad5f2repo sync#include "RegisterCodec.h" 12baa3858d3f5d128a5c8466b700098109edcad5f2repo sync 13baa3858d3f5d128a5c8466b700098109edcad5f2repo syncstatic const unsigned int kNumCodecsMax = 64; 14baa3858d3f5d128a5c8466b700098109edcad5f2repo syncunsigned int g_NumCodecs = 0; 15baa3858d3f5d128a5c8466b700098109edcad5f2repo syncconst CCodecInfo *g_Codecs[kNumCodecsMax]; 16baa3858d3f5d128a5c8466b700098109edcad5f2repo syncvoid RegisterCodec(const CCodecInfo *codecInfo) 17baa3858d3f5d128a5c8466b700098109edcad5f2repo sync{ 18baa3858d3f5d128a5c8466b700098109edcad5f2repo sync if (g_NumCodecs < kNumCodecsMax) 19baa3858d3f5d128a5c8466b700098109edcad5f2repo sync g_Codecs[g_NumCodecs++] = codecInfo; 20baa3858d3f5d128a5c8466b700098109edcad5f2repo sync} 21baa3858d3f5d128a5c8466b700098109edcad5f2repo sync 22baa3858d3f5d128a5c8466b700098109edcad5f2repo sync#ifdef EXTERNAL_CODECS 23baa3858d3f5d128a5c8466b700098109edcad5f2repo syncstatic HRESULT ReadNumberOfStreams(ICompressCodecsInfo *codecsInfo, UInt32 index, PROPID propID, UInt32 &res) 24baa3858d3f5d128a5c8466b700098109edcad5f2repo sync{ 25baa3858d3f5d128a5c8466b700098109edcad5f2repo sync NWindows::NCOM::CPropVariant prop; 26baa3858d3f5d128a5c8466b700098109edcad5f2repo sync RINOK(codecsInfo->GetProperty(index, propID, &prop)); 27baa3858d3f5d128a5c8466b700098109edcad5f2repo sync if (prop.vt == VT_EMPTY) 28baa3858d3f5d128a5c8466b700098109edcad5f2repo sync res = 1; 29baa3858d3f5d128a5c8466b700098109edcad5f2repo sync else if (prop.vt == VT_UI4) 30baa3858d3f5d128a5c8466b700098109edcad5f2repo sync res = prop.ulVal; 31baa3858d3f5d128a5c8466b700098109edcad5f2repo sync else 32baa3858d3f5d128a5c8466b700098109edcad5f2repo sync return E_INVALIDARG; 33baa3858d3f5d128a5c8466b700098109edcad5f2repo sync return S_OK; 34baa3858d3f5d128a5c8466b700098109edcad5f2repo sync} 35baa3858d3f5d128a5c8466b700098109edcad5f2repo sync 36baa3858d3f5d128a5c8466b700098109edcad5f2repo syncstatic HRESULT ReadIsAssignedProp(ICompressCodecsInfo *codecsInfo, UInt32 index, PROPID propID, bool &res) 37baa3858d3f5d128a5c8466b700098109edcad5f2repo sync{ 38baa3858d3f5d128a5c8466b700098109edcad5f2repo sync NWindows::NCOM::CPropVariant prop; 39baa3858d3f5d128a5c8466b700098109edcad5f2repo sync RINOK(codecsInfo->GetProperty(index, propID, &prop)); 40baa3858d3f5d128a5c8466b700098109edcad5f2repo sync if (prop.vt == VT_EMPTY) 41baa3858d3f5d128a5c8466b700098109edcad5f2repo sync res = true; 42baa3858d3f5d128a5c8466b700098109edcad5f2repo sync else if (prop.vt == VT_BOOL) 43baa3858d3f5d128a5c8466b700098109edcad5f2repo sync res = VARIANT_BOOLToBool(prop.boolVal); 44baa3858d3f5d128a5c8466b700098109edcad5f2repo sync else 45baa3858d3f5d128a5c8466b700098109edcad5f2repo sync return E_INVALIDARG; 46baa3858d3f5d128a5c8466b700098109edcad5f2repo sync return S_OK; 47baa3858d3f5d128a5c8466b700098109edcad5f2repo sync} 48baa3858d3f5d128a5c8466b700098109edcad5f2repo sync 49baa3858d3f5d128a5c8466b700098109edcad5f2repo syncHRESULT LoadExternalCodecs(ICompressCodecsInfo *codecsInfo, CObjectVector<CCodecInfoEx> &externalCodecs) 50baa3858d3f5d128a5c8466b700098109edcad5f2repo sync{ 51baa3858d3f5d128a5c8466b700098109edcad5f2repo sync UInt32 num; 52baa3858d3f5d128a5c8466b700098109edcad5f2repo sync RINOK(codecsInfo->GetNumberOfMethods(&num)); 53baa3858d3f5d128a5c8466b700098109edcad5f2repo sync for (UInt32 i = 0; i < num; i++) 54baa3858d3f5d128a5c8466b700098109edcad5f2repo sync { 55baa3858d3f5d128a5c8466b700098109edcad5f2repo sync CCodecInfoEx info; 56baa3858d3f5d128a5c8466b700098109edcad5f2repo sync NWindows::NCOM::CPropVariant prop; 57baa3858d3f5d128a5c8466b700098109edcad5f2repo sync RINOK(codecsInfo->GetProperty(i, NMethodPropID::kID, &prop)); 58baa3858d3f5d128a5c8466b700098109edcad5f2repo sync // if (prop.vt != VT_BSTR) 59baa3858d3f5d128a5c8466b700098109edcad5f2repo sync // info.Id.IDSize = (Byte)SysStringByteLen(prop.bstrVal); 60baa3858d3f5d128a5c8466b700098109edcad5f2repo sync // memmove(info.Id.ID, prop.bstrVal, info.Id.IDSize); 61baa3858d3f5d128a5c8466b700098109edcad5f2repo sync if (prop.vt != VT_UI8) 62baa3858d3f5d128a5c8466b700098109edcad5f2repo sync { 63baa3858d3f5d128a5c8466b700098109edcad5f2repo sync continue; // old Interface 64baa3858d3f5d128a5c8466b700098109edcad5f2repo sync // return E_INVALIDARG; 65baa3858d3f5d128a5c8466b700098109edcad5f2repo sync } 66baa3858d3f5d128a5c8466b700098109edcad5f2repo sync info.Id = prop.uhVal.QuadPart; 67baa3858d3f5d128a5c8466b700098109edcad5f2repo sync prop.Clear(); 68baa3858d3f5d128a5c8466b700098109edcad5f2repo sync 69baa3858d3f5d128a5c8466b700098109edcad5f2repo sync RINOK(codecsInfo->GetProperty(i, NMethodPropID::kName, &prop)); 70baa3858d3f5d128a5c8466b700098109edcad5f2repo sync if (prop.vt == VT_BSTR) 71baa3858d3f5d128a5c8466b700098109edcad5f2repo sync info.Name = prop.bstrVal; 72baa3858d3f5d128a5c8466b700098109edcad5f2repo sync else if (prop.vt != VT_EMPTY) 73baa3858d3f5d128a5c8466b700098109edcad5f2repo sync return E_INVALIDARG;; 74baa3858d3f5d128a5c8466b700098109edcad5f2repo sync 75baa3858d3f5d128a5c8466b700098109edcad5f2repo sync RINOK(ReadNumberOfStreams(codecsInfo, i, NMethodPropID::kInStreams, info.NumInStreams)); 76baa3858d3f5d128a5c8466b700098109edcad5f2repo sync RINOK(ReadNumberOfStreams(codecsInfo, i, NMethodPropID::kOutStreams, info.NumOutStreams)); 77baa3858d3f5d128a5c8466b700098109edcad5f2repo sync RINOK(ReadIsAssignedProp(codecsInfo, i, NMethodPropID::kEncoderIsAssigned, info.EncoderIsAssigned)); 78baa3858d3f5d128a5c8466b700098109edcad5f2repo sync RINOK(ReadIsAssignedProp(codecsInfo, i, NMethodPropID::kDecoderIsAssigned, info.DecoderIsAssigned)); 79baa3858d3f5d128a5c8466b700098109edcad5f2repo sync 80baa3858d3f5d128a5c8466b700098109edcad5f2repo sync externalCodecs.Add(info); 81baa3858d3f5d128a5c8466b700098109edcad5f2repo sync } 82baa3858d3f5d128a5c8466b700098109edcad5f2repo sync return S_OK; 83baa3858d3f5d128a5c8466b700098109edcad5f2repo sync} 84baa3858d3f5d128a5c8466b700098109edcad5f2repo sync 85baa3858d3f5d128a5c8466b700098109edcad5f2repo sync#endif 86baa3858d3f5d128a5c8466b700098109edcad5f2repo sync 87baa3858d3f5d128a5c8466b700098109edcad5f2repo syncbool FindMethod( 88baa3858d3f5d128a5c8466b700098109edcad5f2repo sync #ifdef EXTERNAL_CODECS 89baa3858d3f5d128a5c8466b700098109edcad5f2repo sync ICompressCodecsInfo * /* codecsInfo */, const CObjectVector<CCodecInfoEx> *externalCodecs, 90baa3858d3f5d128a5c8466b700098109edcad5f2repo sync #endif 91baa3858d3f5d128a5c8466b700098109edcad5f2repo sync const UString &name, 92baa3858d3f5d128a5c8466b700098109edcad5f2repo sync CMethodId &methodId, UInt32 &numInStreams, UInt32 &numOutStreams) 93baa3858d3f5d128a5c8466b700098109edcad5f2repo sync{ 94baa3858d3f5d128a5c8466b700098109edcad5f2repo sync UInt32 i; 95baa3858d3f5d128a5c8466b700098109edcad5f2repo sync for (i = 0; i < g_NumCodecs; i++) 96baa3858d3f5d128a5c8466b700098109edcad5f2repo sync { 97baa3858d3f5d128a5c8466b700098109edcad5f2repo sync const CCodecInfo &codec = *g_Codecs[i]; 98baa3858d3f5d128a5c8466b700098109edcad5f2repo sync if (name.CompareNoCase(codec.Name) == 0) 99baa3858d3f5d128a5c8466b700098109edcad5f2repo sync { 100baa3858d3f5d128a5c8466b700098109edcad5f2repo sync methodId = codec.Id; 101baa3858d3f5d128a5c8466b700098109edcad5f2repo sync numInStreams = codec.NumInStreams; 102baa3858d3f5d128a5c8466b700098109edcad5f2repo sync numOutStreams = 1; 103baa3858d3f5d128a5c8466b700098109edcad5f2repo sync return true; 104baa3858d3f5d128a5c8466b700098109edcad5f2repo sync } 105baa3858d3f5d128a5c8466b700098109edcad5f2repo sync } 106baa3858d3f5d128a5c8466b700098109edcad5f2repo sync #ifdef EXTERNAL_CODECS 107baa3858d3f5d128a5c8466b700098109edcad5f2repo sync if (externalCodecs) 108baa3858d3f5d128a5c8466b700098109edcad5f2repo sync for (i = 0; i < (UInt32)externalCodecs->Size(); i++) 109baa3858d3f5d128a5c8466b700098109edcad5f2repo sync { 110baa3858d3f5d128a5c8466b700098109edcad5f2repo sync const CCodecInfoEx &codec = (*externalCodecs)[i]; 111baa3858d3f5d128a5c8466b700098109edcad5f2repo sync if (codec.Name.CompareNoCase(name) == 0) 112baa3858d3f5d128a5c8466b700098109edcad5f2repo sync { 113baa3858d3f5d128a5c8466b700098109edcad5f2repo sync methodId = codec.Id; 114baa3858d3f5d128a5c8466b700098109edcad5f2repo sync numInStreams = codec.NumInStreams; 115baa3858d3f5d128a5c8466b700098109edcad5f2repo sync numOutStreams = codec.NumOutStreams; 116baa3858d3f5d128a5c8466b700098109edcad5f2repo sync return true; 117baa3858d3f5d128a5c8466b700098109edcad5f2repo sync } 118baa3858d3f5d128a5c8466b700098109edcad5f2repo sync } 119baa3858d3f5d128a5c8466b700098109edcad5f2repo sync #endif 120baa3858d3f5d128a5c8466b700098109edcad5f2repo sync return false; 121baa3858d3f5d128a5c8466b700098109edcad5f2repo sync} 122baa3858d3f5d128a5c8466b700098109edcad5f2repo sync 123baa3858d3f5d128a5c8466b700098109edcad5f2repo syncbool FindMethod( 124baa3858d3f5d128a5c8466b700098109edcad5f2repo sync #ifdef EXTERNAL_CODECS 125baa3858d3f5d128a5c8466b700098109edcad5f2repo sync ICompressCodecsInfo * /* codecsInfo */, const CObjectVector<CCodecInfoEx> *externalCodecs, 126baa3858d3f5d128a5c8466b700098109edcad5f2repo sync #endif 127baa3858d3f5d128a5c8466b700098109edcad5f2repo sync CMethodId methodId, UString &name) 128baa3858d3f5d128a5c8466b700098109edcad5f2repo sync{ 129baa3858d3f5d128a5c8466b700098109edcad5f2repo sync UInt32 i; 130baa3858d3f5d128a5c8466b700098109edcad5f2repo sync for (i = 0; i < g_NumCodecs; i++) 131baa3858d3f5d128a5c8466b700098109edcad5f2repo sync { 132baa3858d3f5d128a5c8466b700098109edcad5f2repo sync const CCodecInfo &codec = *g_Codecs[i]; 133baa3858d3f5d128a5c8466b700098109edcad5f2repo sync if (methodId == codec.Id) 134baa3858d3f5d128a5c8466b700098109edcad5f2repo sync { 135baa3858d3f5d128a5c8466b700098109edcad5f2repo sync name = codec.Name; 136baa3858d3f5d128a5c8466b700098109edcad5f2repo sync return true; 137baa3858d3f5d128a5c8466b700098109edcad5f2repo sync } 138baa3858d3f5d128a5c8466b700098109edcad5f2repo sync } 139baa3858d3f5d128a5c8466b700098109edcad5f2repo sync #ifdef EXTERNAL_CODECS 140baa3858d3f5d128a5c8466b700098109edcad5f2repo sync if (externalCodecs) 141baa3858d3f5d128a5c8466b700098109edcad5f2repo sync for (i = 0; i < (UInt32)externalCodecs->Size(); i++) 142baa3858d3f5d128a5c8466b700098109edcad5f2repo sync { 143baa3858d3f5d128a5c8466b700098109edcad5f2repo sync const CCodecInfoEx &codec = (*externalCodecs)[i]; 144baa3858d3f5d128a5c8466b700098109edcad5f2repo sync if (methodId == codec.Id) 145baa3858d3f5d128a5c8466b700098109edcad5f2repo sync { 146baa3858d3f5d128a5c8466b700098109edcad5f2repo sync name = codec.Name; 147baa3858d3f5d128a5c8466b700098109edcad5f2repo sync return true; 148baa3858d3f5d128a5c8466b700098109edcad5f2repo sync } 149baa3858d3f5d128a5c8466b700098109edcad5f2repo sync } 150baa3858d3f5d128a5c8466b700098109edcad5f2repo sync #endif 151baa3858d3f5d128a5c8466b700098109edcad5f2repo sync return false; 152baa3858d3f5d128a5c8466b700098109edcad5f2repo sync} 153baa3858d3f5d128a5c8466b700098109edcad5f2repo sync 154baa3858d3f5d128a5c8466b700098109edcad5f2repo syncHRESULT CreateCoder( 155baa3858d3f5d128a5c8466b700098109edcad5f2repo sync DECL_EXTERNAL_CODECS_LOC_VARS 156baa3858d3f5d128a5c8466b700098109edcad5f2repo sync CMethodId methodId, 157baa3858d3f5d128a5c8466b700098109edcad5f2repo sync CMyComPtr<ICompressFilter> &filter, 158baa3858d3f5d128a5c8466b700098109edcad5f2repo sync CMyComPtr<ICompressCoder> &coder, 159baa3858d3f5d128a5c8466b700098109edcad5f2repo sync CMyComPtr<ICompressCoder2> &coder2, 160baa3858d3f5d128a5c8466b700098109edcad5f2repo sync bool encode, bool onlyCoder) 161baa3858d3f5d128a5c8466b700098109edcad5f2repo sync{ 162baa3858d3f5d128a5c8466b700098109edcad5f2repo sync bool created = false; 163baa3858d3f5d128a5c8466b700098109edcad5f2repo sync UInt32 i; 164baa3858d3f5d128a5c8466b700098109edcad5f2repo sync for (i = 0; i < g_NumCodecs; i++) 165baa3858d3f5d128a5c8466b700098109edcad5f2repo sync { 166baa3858d3f5d128a5c8466b700098109edcad5f2repo sync const CCodecInfo &codec = *g_Codecs[i]; 167baa3858d3f5d128a5c8466b700098109edcad5f2repo sync if (codec.Id == methodId) 168baa3858d3f5d128a5c8466b700098109edcad5f2repo sync { 169baa3858d3f5d128a5c8466b700098109edcad5f2repo sync if (encode) 170baa3858d3f5d128a5c8466b700098109edcad5f2repo sync { 171baa3858d3f5d128a5c8466b700098109edcad5f2repo sync if (codec.CreateEncoder) 172baa3858d3f5d128a5c8466b700098109edcad5f2repo sync { 173baa3858d3f5d128a5c8466b700098109edcad5f2repo sync void *p = codec.CreateEncoder(); 174baa3858d3f5d128a5c8466b700098109edcad5f2repo sync if (codec.IsFilter) filter = (ICompressFilter *)p; 175baa3858d3f5d128a5c8466b700098109edcad5f2repo sync else if (codec.NumInStreams == 1) coder = (ICompressCoder *)p; 176baa3858d3f5d128a5c8466b700098109edcad5f2repo sync else coder2 = (ICompressCoder2 *)p; 177baa3858d3f5d128a5c8466b700098109edcad5f2repo sync created = (p != 0); 178baa3858d3f5d128a5c8466b700098109edcad5f2repo sync break; 179baa3858d3f5d128a5c8466b700098109edcad5f2repo sync } 180baa3858d3f5d128a5c8466b700098109edcad5f2repo sync } 181baa3858d3f5d128a5c8466b700098109edcad5f2repo sync else 182baa3858d3f5d128a5c8466b700098109edcad5f2repo sync if (codec.CreateDecoder) 183baa3858d3f5d128a5c8466b700098109edcad5f2repo sync { 184baa3858d3f5d128a5c8466b700098109edcad5f2repo sync void *p = codec.CreateDecoder(); 185baa3858d3f5d128a5c8466b700098109edcad5f2repo sync if (codec.IsFilter) filter = (ICompressFilter *)p; 186baa3858d3f5d128a5c8466b700098109edcad5f2repo sync else if (codec.NumInStreams == 1) coder = (ICompressCoder *)p; 187baa3858d3f5d128a5c8466b700098109edcad5f2repo sync else coder2 = (ICompressCoder2 *)p; 188baa3858d3f5d128a5c8466b700098109edcad5f2repo sync created = (p != 0); 189baa3858d3f5d128a5c8466b700098109edcad5f2repo sync break; 190baa3858d3f5d128a5c8466b700098109edcad5f2repo sync } 191baa3858d3f5d128a5c8466b700098109edcad5f2repo sync } 192baa3858d3f5d128a5c8466b700098109edcad5f2repo sync } 193baa3858d3f5d128a5c8466b700098109edcad5f2repo sync 194baa3858d3f5d128a5c8466b700098109edcad5f2repo sync #ifdef EXTERNAL_CODECS 195baa3858d3f5d128a5c8466b700098109edcad5f2repo sync if (!created && externalCodecs) 196baa3858d3f5d128a5c8466b700098109edcad5f2repo sync for (i = 0; i < (UInt32)externalCodecs->Size(); i++) 197baa3858d3f5d128a5c8466b700098109edcad5f2repo sync { 198baa3858d3f5d128a5c8466b700098109edcad5f2repo sync const CCodecInfoEx &codec = (*externalCodecs)[i]; 199baa3858d3f5d128a5c8466b700098109edcad5f2repo sync if (codec.Id == methodId) 200baa3858d3f5d128a5c8466b700098109edcad5f2repo sync { 201baa3858d3f5d128a5c8466b700098109edcad5f2repo sync if (encode) 202baa3858d3f5d128a5c8466b700098109edcad5f2repo sync { 203baa3858d3f5d128a5c8466b700098109edcad5f2repo sync if (codec.EncoderIsAssigned) 204baa3858d3f5d128a5c8466b700098109edcad5f2repo sync { 205baa3858d3f5d128a5c8466b700098109edcad5f2repo sync if (codec.IsSimpleCodec()) 206baa3858d3f5d128a5c8466b700098109edcad5f2repo sync { 207baa3858d3f5d128a5c8466b700098109edcad5f2repo sync HRESULT result = codecsInfo->CreateEncoder(i, &IID_ICompressCoder, (void **)&coder); 208baa3858d3f5d128a5c8466b700098109edcad5f2repo sync if (result != S_OK && result != E_NOINTERFACE && result != CLASS_E_CLASSNOTAVAILABLE) 209baa3858d3f5d128a5c8466b700098109edcad5f2repo sync return result; 210baa3858d3f5d128a5c8466b700098109edcad5f2repo sync if (!coder) 211baa3858d3f5d128a5c8466b700098109edcad5f2repo sync { 212baa3858d3f5d128a5c8466b700098109edcad5f2repo sync RINOK(codecsInfo->CreateEncoder(i, &IID_ICompressFilter, (void **)&filter)); 213baa3858d3f5d128a5c8466b700098109edcad5f2repo sync } 214baa3858d3f5d128a5c8466b700098109edcad5f2repo sync } 215baa3858d3f5d128a5c8466b700098109edcad5f2repo sync else 216baa3858d3f5d128a5c8466b700098109edcad5f2repo sync { 217baa3858d3f5d128a5c8466b700098109edcad5f2repo sync RINOK(codecsInfo->CreateEncoder(i, &IID_ICompressCoder2, (void **)&coder2)); 218baa3858d3f5d128a5c8466b700098109edcad5f2repo sync } 219baa3858d3f5d128a5c8466b700098109edcad5f2repo sync break; 220baa3858d3f5d128a5c8466b700098109edcad5f2repo sync } 221baa3858d3f5d128a5c8466b700098109edcad5f2repo sync } 222baa3858d3f5d128a5c8466b700098109edcad5f2repo sync else 223baa3858d3f5d128a5c8466b700098109edcad5f2repo sync if (codec.DecoderIsAssigned) 224baa3858d3f5d128a5c8466b700098109edcad5f2repo sync { 225baa3858d3f5d128a5c8466b700098109edcad5f2repo sync if (codec.IsSimpleCodec()) 226baa3858d3f5d128a5c8466b700098109edcad5f2repo sync { 227baa3858d3f5d128a5c8466b700098109edcad5f2repo sync HRESULT result = codecsInfo->CreateDecoder(i, &IID_ICompressCoder, (void **)&coder); 228baa3858d3f5d128a5c8466b700098109edcad5f2repo sync if (result != S_OK && result != E_NOINTERFACE && result != CLASS_E_CLASSNOTAVAILABLE) 229baa3858d3f5d128a5c8466b700098109edcad5f2repo sync return result; 230baa3858d3f5d128a5c8466b700098109edcad5f2repo sync if (!coder) 231baa3858d3f5d128a5c8466b700098109edcad5f2repo sync { 232baa3858d3f5d128a5c8466b700098109edcad5f2repo sync RINOK(codecsInfo->CreateDecoder(i, &IID_ICompressFilter, (void **)&filter)); 233baa3858d3f5d128a5c8466b700098109edcad5f2repo sync } 234baa3858d3f5d128a5c8466b700098109edcad5f2repo sync } 235baa3858d3f5d128a5c8466b700098109edcad5f2repo sync else 236baa3858d3f5d128a5c8466b700098109edcad5f2repo sync { 237baa3858d3f5d128a5c8466b700098109edcad5f2repo sync RINOK(codecsInfo->CreateDecoder(i, &IID_ICompressCoder2, (void **)&coder2)); 238baa3858d3f5d128a5c8466b700098109edcad5f2repo sync } 239baa3858d3f5d128a5c8466b700098109edcad5f2repo sync break; 240baa3858d3f5d128a5c8466b700098109edcad5f2repo sync } 241baa3858d3f5d128a5c8466b700098109edcad5f2repo sync } 242baa3858d3f5d128a5c8466b700098109edcad5f2repo sync } 243baa3858d3f5d128a5c8466b700098109edcad5f2repo sync #endif 244baa3858d3f5d128a5c8466b700098109edcad5f2repo sync 245baa3858d3f5d128a5c8466b700098109edcad5f2repo sync if (onlyCoder && filter) 246baa3858d3f5d128a5c8466b700098109edcad5f2repo sync { 247baa3858d3f5d128a5c8466b700098109edcad5f2repo sync CFilterCoder *coderSpec = new CFilterCoder; 248baa3858d3f5d128a5c8466b700098109edcad5f2repo sync coder = coderSpec; 249baa3858d3f5d128a5c8466b700098109edcad5f2repo sync coderSpec->Filter = filter; 250baa3858d3f5d128a5c8466b700098109edcad5f2repo sync } 251baa3858d3f5d128a5c8466b700098109edcad5f2repo sync return S_OK; 252baa3858d3f5d128a5c8466b700098109edcad5f2repo sync} 253baa3858d3f5d128a5c8466b700098109edcad5f2repo sync 254baa3858d3f5d128a5c8466b700098109edcad5f2repo syncHRESULT CreateCoder( 255baa3858d3f5d128a5c8466b700098109edcad5f2repo sync DECL_EXTERNAL_CODECS_LOC_VARS 256baa3858d3f5d128a5c8466b700098109edcad5f2repo sync CMethodId methodId, 257baa3858d3f5d128a5c8466b700098109edcad5f2repo sync CMyComPtr<ICompressCoder> &coder, 258baa3858d3f5d128a5c8466b700098109edcad5f2repo sync CMyComPtr<ICompressCoder2> &coder2, 259baa3858d3f5d128a5c8466b700098109edcad5f2repo sync bool encode) 260baa3858d3f5d128a5c8466b700098109edcad5f2repo sync{ 261baa3858d3f5d128a5c8466b700098109edcad5f2repo sync CMyComPtr<ICompressFilter> filter; 262baa3858d3f5d128a5c8466b700098109edcad5f2repo sync return CreateCoder( 263baa3858d3f5d128a5c8466b700098109edcad5f2repo sync EXTERNAL_CODECS_LOC_VARS 264baa3858d3f5d128a5c8466b700098109edcad5f2repo sync methodId, 265baa3858d3f5d128a5c8466b700098109edcad5f2repo sync filter, coder, coder2, encode, true); 266baa3858d3f5d128a5c8466b700098109edcad5f2repo sync} 267baa3858d3f5d128a5c8466b700098109edcad5f2repo sync 268baa3858d3f5d128a5c8466b700098109edcad5f2repo syncHRESULT CreateCoder( 269baa3858d3f5d128a5c8466b700098109edcad5f2repo sync DECL_EXTERNAL_CODECS_LOC_VARS 270baa3858d3f5d128a5c8466b700098109edcad5f2repo sync CMethodId methodId, 271baa3858d3f5d128a5c8466b700098109edcad5f2repo sync CMyComPtr<ICompressCoder> &coder, bool encode) 272baa3858d3f5d128a5c8466b700098109edcad5f2repo sync{ 273baa3858d3f5d128a5c8466b700098109edcad5f2repo sync CMyComPtr<ICompressFilter> filter; 274baa3858d3f5d128a5c8466b700098109edcad5f2repo sync CMyComPtr<ICompressCoder2> coder2; 275baa3858d3f5d128a5c8466b700098109edcad5f2repo sync return CreateCoder( 276baa3858d3f5d128a5c8466b700098109edcad5f2repo sync EXTERNAL_CODECS_LOC_VARS 277baa3858d3f5d128a5c8466b700098109edcad5f2repo sync methodId, 278baa3858d3f5d128a5c8466b700098109edcad5f2repo sync coder, coder2, encode); 279baa3858d3f5d128a5c8466b700098109edcad5f2repo sync} 280baa3858d3f5d128a5c8466b700098109edcad5f2repo sync 281baa3858d3f5d128a5c8466b700098109edcad5f2repo syncHRESULT CreateFilter( 282baa3858d3f5d128a5c8466b700098109edcad5f2repo sync DECL_EXTERNAL_CODECS_LOC_VARS 283baa3858d3f5d128a5c8466b700098109edcad5f2repo sync CMethodId methodId, 284baa3858d3f5d128a5c8466b700098109edcad5f2repo sync CMyComPtr<ICompressFilter> &filter, 285baa3858d3f5d128a5c8466b700098109edcad5f2repo sync bool encode) 286baa3858d3f5d128a5c8466b700098109edcad5f2repo sync{ 287baa3858d3f5d128a5c8466b700098109edcad5f2repo sync CMyComPtr<ICompressCoder> coder; 288baa3858d3f5d128a5c8466b700098109edcad5f2repo sync CMyComPtr<ICompressCoder2> coder2; 289baa3858d3f5d128a5c8466b700098109edcad5f2repo sync return CreateCoder( 290baa3858d3f5d128a5c8466b700098109edcad5f2repo sync EXTERNAL_CODECS_LOC_VARS 291baa3858d3f5d128a5c8466b700098109edcad5f2repo sync methodId, 292baa3858d3f5d128a5c8466b700098109edcad5f2repo sync filter, coder, coder2, encode, false); 293baa3858d3f5d128a5c8466b700098109edcad5f2repo sync} 294