예제 #1
0
void VS_CC SCSelectCreate(const VSMap *in, VSMap *out, void *userData, VSCore *core, const VSAPI *vsapi)
{
    SCSelectData d = { 0 };

    d.input = vsapi->propGetNode(in, "input", 0, 0);
    d.vi = vsapi->getVideoInfo(d.input);

    if (!isConstantFormat(d.vi)) {
        vsapi->freeNode(d.input);
        vsapi->setError(out, "SCSelect: Only constant format input supported");
        return;
    }

    if (d.vi->format->id != pfYUV420P8 && d.vi->format->id != pfYUV422P8) {
        vsapi->freeNode(d.input);
        vsapi->setError(out, "SCSelect: Only planar YV12 and YUY2 colorspaces are supported");
        return;
    }

    d.sceneBegin = vsapi->propGetNode(in, "sceneBegin", 0, 0);
    d.sceneEnd = vsapi->propGetNode(in, "sceneEnd", 0, 0);
    d.globalMotion = vsapi->propGetNode(in, "globalMotion", 0, 0);

    if (!isSameFormat(d.vi, vsapi->getVideoInfo(d.sceneBegin)) ||
        !isSameFormat(d.vi, vsapi->getVideoInfo(d.sceneEnd)) ||
        !isSameFormat(d.vi, vsapi->getVideoInfo(d.globalMotion))) {
            vsapi->freeNode(d.input);
            vsapi->freeNode(d.sceneBegin);
            vsapi->freeNode(d.sceneEnd);
            vsapi->freeNode(d.globalMotion);
            vsapi->setError(out, "SCSelect: Clips are not of equal type");
            return;
    }

    int32_t err;
    double dFactor = vsapi->propGetFloat(in, "dfactor", 0, &err);
    if (err) {
        dFactor = 4.0;
    }

    d.hblocks = d.vi->width / (2 * 16);
    d.incpitch = d.hblocks * (-2 * 16);

    SCSelectData *data = (SCSelectData *)malloc(sizeof(d));
    if (!data) {
        vsapi->setError(out, "Could not allocate SCSelectData");
        return;
    }
    *data = d;

    vsapi->createFilter(in, out, "SCSelect", SCSelectInit, SCSelectGetFrame, SCSelectFree, fmParallel, 0, data, core);
};
QString DocumentNumeratorController::getNextSymbol()
{
    if(isSameFormat()) // sprawdź czy format numerowania jest taki sam dla poprzedniego symbolu i obecnego formatu
    {
        readVariablesFromPrevious();

        return prepareNextSymbol();
    }
    else
        return prepareNextSymbol(false);

}
예제 #3
0
static void VS_CC spliceCreate(const VSMap *in, VSMap *out, void *userData, VSCore *core, const VSAPI *vsapi) {
    SpliceData d;
    SpliceData *data;
    VSNodeRef *cref;
    int mismatch;
    int i;
    int err;
    int compat = 0;

    d.numclips = vsapi->propNumElements(in, "clips");
    mismatch = !!vsapi->propGetInt(in, "mismatch", 0, &err);

    if (d.numclips == 1) { // passthrough for the special case with only one clip
        cref = vsapi->propGetNode(in, "clips", 0, 0);
        vsapi->propSetNode(out, "clip", cref, 0);
        vsapi->freeNode(cref);
    } else {
        d.node = malloc(sizeof(d.node[0]) * d.numclips);

        for (i = 0; i < d.numclips; i++) {
            d.node[i] = vsapi->propGetNode(in, "clips", i, 0);

            if (isCompatFormat(vsapi->getVideoInfo(d.node[i])))
                compat = 1;
        }

        if (findCommonVi(d.node, d.numclips, &d.vi, 0, vsapi) && (!mismatch || compat) && !isSameFormat(&d.vi, vsapi->getVideoInfo(d.node[0]))) {
            for (i = 0; i < d.numclips; i++)
                vsapi->freeNode(d.node[i]);

            free(d.node);
            RETERROR("Splice: clip property mismatch");
        }

        d.numframes = malloc(sizeof(d.numframes[0]) * d.numclips);
        d.vi.numFrames = 0;

        for (i = 0; i < d.numclips; i++) {
            d.numframes[i] = (vsapi->getVideoInfo(d.node[i]))->numFrames;
            d.vi.numFrames += d.numframes[i];

            if (d.numframes[i] == 0 && i != d.numclips - 1) {
                for (i = 0; i < d.numclips; i++)
                    vsapi->freeNode(d.node[i]);

                free(d.node);
                free(d.numframes);
                RETERROR("Splice: unknown length clips can only be last in a splice operation");
            }
        }

        if (d.numframes[d.numclips - 1] == 0)
            d.vi.numFrames = 0;

        data = malloc(sizeof(d));
        *data = d;

        vsapi->createFilter(in, out, "Splice", spliceInit, spliceGetframe, spliceFree, fmParallel, nfNoCache, data, core);
    }
}