Ejemplo n.º 1
0
void nmTextSubtitles::strToDouble(const ffstring &str,double *d)
{
    if (!str.empty()) {
        wchar_t *end;
        double val=strtod(str.c_str(),&end);
        if (*end=='\0') {
            *d=val;
        }
    }
}
Ejemplo n.º 2
0
void nmTextSubtitles::strToIntMargin(const ffstring &str,int *i)
{
    if (!str.empty() /*str.size()==4 && str.compare(_L("0000"))!=0*/) {
        wchar_t *end;
        int val=strtol(str.c_str(),&end,10);
        if (*end=='\0' && val>0) {
            *i=val;
        }
    }
}
Ejemplo n.º 3
0
void nmTextSubtitles::strToInt(const ffstring &str,int *i)
{
    if (!str.empty()) {
        if (str.compare(0,4,L" yes",4)==0) {
            *i = 1;
            return;
        } else if (str.compare(0,3,L" no",3)==0) {
            *i = 0;
            return;
        }
        wchar_t *end;
        int val=strtol(str.c_str(),&end,10);
        if (*end=='\0' && val>=0) {
            *i=val;
        }
    }
}
Ejemplo n.º 4
0
//=========================== Twinamp2dspDll =================================
Twinamp2dspDll::Twinamp2dspDll(const ffstring &flnm): refcount(1)
{
    dll = NULL;
    winampDSPGetHeaderType = NULL;
    hdr = NULL;
    char_t filename[MAX_PATH], name[MAX_PATH], ext[MAX_PATH];
    _splitpath_s(flnm.c_str(), NULL, 0, NULL, 0, name, MAX_PATH, ext, MAX_PATH);
    _makepath_s(filename, MAX_PATH, NULL, NULL, name, ext);
    // DSP stacker, Adapt-X and Vst host are not compatible with ffdshow currently. Maybe ffdshow's bug, but I can't help...
    if (_strnicmp(_l("dsp_stacker.dll"), filename, 16) == 0
            || _strnicmp(_l("dsp_adaptx.dll"), filename, 15) == 0
            || _strnicmp(_l("dsp_sps.dll"), filename, 11) == 0
       ) {
        return;
    }
    dll = new Tdll(flnm.c_str(), NULL);
    if (dll->ok) {
        dll->loadFunction(winampDSPGetHeaderType, "winampDSPGetHeader2");
        if (!dll->ok) {
            // retry with index 1.
            dll->ok = true;
            dll->loadFunctionByIndex(winampDSPGetHeaderType, 1);
        }
    }
    if (dll->ok) {
        hdr = winampDSPGetHeaderType();
        if (hdr->version != DSP_HDRVER) {
            hdr = NULL;
            return;
        }
        descr = hdr->description;
        dllFileName = filename;
    }
    if (hdr)
        for (int i = 0;; i++) {
            winampDSPModule *flt = hdr->getModule(i);
            if (!flt) {
                break;
            }
            flt->hDllInstance = dll->hdll;
            filters.push_back(new Twinamp2dsp(this, flt));
        }
}
Ejemplo n.º 5
0
bool TSSAstyle::toCOLORREF(const ffstring& colourStr,COLORREF &colour,int &alpha)
{
    if (colourStr.empty()) {
        return false;
    }
    int radix;
    ffstring s1,s2;
    s1=colourStr;
    s1.ConvertToUpperCase();
    if (s1.compare(0,2,L"&H",2)==0) {
        s1.erase(0,2);
        radix=16;
    } else {
        if (s1.compare(0,1,L"-",1)==0) {
            colour=0x000000;
            alpha=256;
            return true;
        }
        radix=10;
    }
    s2=s1;
    if (s1.size()>6) {
        s1.erase(s1.size()-6,6);
        s2.erase(0,s2.size()-6);
    } else {
        s1.clear();
    }

    int msb=0;
    if (!s1.empty()) {
        const wchar_t *alphaS=s1.c_str();
        wchar_t *endalpha;
        long a=strtol(alphaS,&endalpha,radix);
        if (*endalpha=='\0') {
            msb=a;
        }
    }
    if (s2.empty()) {
        return false;
    }
    const wchar_t *colorS=s2.c_str();
    wchar_t *endcolor;
    COLORREF c=strtol(colorS,&endcolor,radix);
    if (*endcolor=='\0') {
        DWORD result=msb * (radix==16 ? 0x1000000 : 1000000) + c;
        colour=result & 0xffffff;
        alpha=256-(result>>24);
        return true;
    }
Ejemplo n.º 6
0
bool Tavisynth::getVersion(const Tconfig *config,ffstring &vers,ffstring &license)
{
    bool res=false;
    Tavisynth *dl=new Tavisynth;
    if (dl->ok) {
        IScriptEnvironment *env=dl->CreateScriptEnvironment(AVISYNTH_INTERFACE_VERSION);
        try {
            char script[]="VersionString";
            AVSValue eval_args[]= {script,"ffdshow_version_avisynth_script"};
            AVSValue val=env->Invoke("Eval",AVSValue(eval_args,2));
            vers=val.AsString();
            license=_l("(C) 2000-2003 Ben Rudiak-Gold and all subsequent developers");
            res=true;
        } catch (AvisynthError &err) {
            vers=text<char_t>(err.msg);
        }
        delete env;
    } else {
        vers=_l("not found");
        license.clear();
    }
    delete dl;
    return res;
}