コード例 #1
0
ファイル: Test.cpp プロジェクト: MattPD/Prog3
void createOtherSack() {
	auto intsack=makeSack({1,2,3});
	ASSERT_EQUAL(3,intsack.size());
	ASSERT((std::is_same<int,decltype(intsack.getOut())>::value));
	Sack<int,std::deque> anothersack{};
	auto othersack=makeOtherSack<std::deque>({1,2,3});
	ASSERT_EQUAL(3,othersack.size());
	auto setsack=makeOtherSack<std::set>({'a','b','c','c'});
	ASSERT_EQUAL(3,setsack.size());
}
コード例 #2
0
STDMETHODIMP_(LRESULT) TffdshowEnc::getFormat(const BITMAPINFOHEADER *inhdr, BITMAPINFO *lpbiOutput)
{
    extraDataSize = 0;
    initCo();
    if (getBMPcolorspace(inhdr, coSettings->incsps) == FF_CSP_NULL) {
        return ICERR_BADFORMAT;
    }

    unsigned int outDx, outDy;
    getOut(inhdr->biWidth, inhdr->biHeight, &outDx, &outDy);
    if (!findEncLib()) {
        return 0;
    }
    extradata.clear();
    if (enc->supExtradata()) {
        if (enccsps.empty()) {
            enc->getCompressColorspaces(enccsps, outDx, outDy);
        }
        enccsp = enccsps[0];
        enc->beginCompress(coSettings->mode, enccsp, Trect(0, 0, outDx, outDy));
        const void *edata0;
        enc->getExtradata(&edata0, &extraDataSize);
        if (extraDataSize) {
            extradata.set(edata0, extraDataSize, 0, true);
        }
        enc->end();
    }

    if (lpbiOutput == NULL) {
        return sizeof(BITMAPINFOHEADER) + extradata.size;
    }
    BITMAPINFOHEADER *outhdr = &lpbiOutput->bmiHeader;

    memcpy(outhdr, inhdr, sizeof(BITMAPINFOHEADER));
    outhdr->biSize = DWORD(sizeof(BITMAPINFOHEADER) + extradata.size);
    findEncLib();
    outhdr->biWidth = outDx;
    outhdr->biHeight = outDy;
    if (!enc || !enc->prepareHeader(outhdr)) {
        outhdr->biCompression = coSettings->fourcc;
        outhdr->biBitCount = 24; // or 16
        outhdr->biSizeImage = outDx * outDy * 3;
    }
    //TODO: maybe encoders should be allowed to modify other outhdr properties
    outhdr->biPlanes = 1;
    outhdr->biXPelsPerMeter = 0;
    outhdr->biYPelsPerMeter = 0;
    outhdr->biClrUsed = 0;
    outhdr->biClrImportant = 0;
    if (extradata.data) {
        memcpy((unsigned char*)outhdr + sizeof(BITMAPINFOHEADER), extradata.data, extradata.size);
    }
    biOutput.bmiHeader = lpbiOutput->bmiHeader;
    return ICERR_OK;
}
コード例 #3
0
STDMETHODIMP_(LRESULT) TffdshowEnc::getSize(const BITMAPINFO *lpbiInput)
{
    findEncLib();
    unsigned int outDx, outDy;
    getOut(lpbiInput->bmiHeader.biWidth, lpbiInput->bmiHeader.biHeight, &outDx, &outDy);
    BITMAPINFOHEADER outhdr;
    outhdr.biWidth = outDx;
    outhdr.biHeight = outDy;
    if (!enc || !enc->prepareHeader(&outhdr)) {
        return outDx * outDy * 3;
    } else {
        return outhdr.biSizeImage;
    }
}
コード例 #4
0
	void init (glm::mat4 pGiven, glm::mat4 rGiven) {
		
		liveCount = 0;
		
		position = pGiven;
		
		rotation = rGiven;
		
		orientation = position * rotation;
		
		direction = getOut(orientation);
		
		return;
		
	}
コード例 #5
0
ファイル: rpc_client.cpp プロジェクト: peay/mexrpc
void rpc_client(int nlhs, uint8_t** lhs_serial, size_t* lhs_sizes,
                        int nrhs, uint8_t** rhs_serial, size_t* rhs_sizes,
                        const char* host_port)
{
    capnp::EzRpcClient client(host_port, 2360);
    auto& waitScope = client.getWaitScope();

    Call::Client cap = client.importCap<Call>("call");

    capnp::MallocMessageBuilder message;

    // Make RHS argument list
    ArgList::Builder in = message.initRoot<ArgList>();
    capnp::List<ArgList::Arg>::Builder arg_list = in.initArgs(nrhs);

    for (size_t i = 0; i < (unsigned int) nrhs; ++i)
    {
        arg_list[i].setSize(rhs_sizes[i]);
        arg_list[i].setData(capnp::Data::Reader(reinterpret_cast<const unsigned char*>(rhs_serial[i]), rhs_sizes[i] * sizeof(uint8_t)));
    }

    in.setType(ArgList::Type::RIGHT);

    // Make request
    auto request = cap.callRequest();
    request.setOut_size(nlhs);
    request.setIn(in);

    auto promise = request.send();
    auto response = promise.wait(waitScope);
    auto out = response.getOut();

    // Populate lhs_serial and lhs_sizes
    capnp::List<ArgList::Arg>::Reader out_list = out.getArgs();

    for (size_t i = 0; i < (unsigned int) nlhs; ++i)
    {
        capnp::Data::Reader out_arg = out_list[i].getData();
        size_t num_els = out_list[i].getSize();

        lhs_serial[i] = new uint8_t[num_els];
        lhs_sizes[i] = num_els;

        memcpy(lhs_serial[i], out_arg.begin(), num_els * sizeof(uint8_t));
    }
}
コード例 #6
0
STDMETHODIMP_(LRESULT) TffdshowEnc::query(const BITMAPINFOHEADER *inhdr, BITMAPINFOHEADER *outhdr)
{
    initCo();
    if (getBMPcolorspace(inhdr, coSettings->incsps) == FF_CSP_NULL) {
        return ICERR_BADFORMAT;
    }
    if (outhdr == NULL) {
        unsigned int outDx, outDy;
        getOut(inhdr->biWidth, inhdr->biHeight, &outDx, &outDy);
        if (outDx & 1 || outDy & 1) {
            return ICERR_BADFORMAT;
        }
        return ICERR_OK;
    }
    if (inhdr->biWidth != outhdr->biWidth || inhdr->biHeight != outhdr->biHeight) {
        return ICERR_BADFORMAT;
    }
    if (outhdr->biCompression == coSettings->fourcc) {
        return ICERR_OK;    //FIX ?
    }
    return ICERR_BADFORMAT;
}
コード例 #7
0
	glm::vec3 getForward() {
		
		return getOut(orientation);
		
	}
コード例 #8
0
STDMETHODIMP_(LRESULT) TffdshowEnc::begin(const BITMAPINFOHEADER *inhdr)
{
    if (!findEncLib()) {
        return ICERR_ERROR;
    }

    int nom, den;
    if (lavc_reduce(&nom, &den, fpsRate, fpsScale, 10000)) {
        fpsRate = nom;
        fpsScale = den;
    }

    dbgInit();
    getOut(inhdr->biWidth, inhdr->biHeight, &outDx, &outDy);
    ownStoreExt = false;

    if (enccsps.empty()) {
        enc->getCompressColorspaces(enccsps, outDx, outDy);
        if (enccsps.empty()) {
            return ICERR_BADFORMAT;
        }
    }
    enccsp = enccsps[0];

    cfgcomode = coSettings->mode;
    switch (cfgcomode) {
        case ENC_MODE::CBR:
            if (!sup_CBR(coSettings->codecId)) {
                cfgcomode = ENC_MODE::UNKNOWN;
            }
            break;
        case ENC_MODE::VBR_QUAL:
            if (!sup_VBR_QUAL(coSettings->codecId)) {
                cfgcomode = ENC_MODE::UNKNOWN;
            }
            break;
        case ENC_MODE::VBR_QUANT:
            if (!sup_VBR_QUANT(coSettings->codecId)) {
                cfgcomode = ENC_MODE::UNKNOWN;
            }
            break;
    }

    if (coSettings->storeExt && !ownStoreExt && coSettings->storeExtFlnm[0]) {
        mux = Tmuxer::getMuxer(coSettings->muxer, this);
    } else {
        mux = NULL;
    }
    enc->setCoSettings(oldCodecId);
    LRESULT res = enc->beginCompress(cfgcomode, enccsp, Trect(0, 0, outDx, outDy));
    if (res != ICERR_OK) {
        return res;
    }

    dx = inhdr->biWidth;
    dy = inhdr->biHeight;
    totalsize = keyspacing = 0;
    if (coSettings->isProc && ffproc) {
        ffproc->begin(dx, dy, fpsRate, fpsScale);
    }

    if (mux) {
        mux->writeHeader(extradata.data, extradata.size, 1, biOutput.bmiHeader);
    }

    memset(&params, 0, sizeof(params));
    encStats.init(outDx, outDy, enccsp);
    outputdebug = globalSettings->outputdebug;
    outputdebugfile = globalSettings->outputdebugfile;

    working = true;
    firstrun = true;
    return ICERR_OK;
}
コード例 #9
0
HRESULT TffdshowEnc::GetMediaType(int iPosition, CMediaType *mtOut)
{
    DPRINTF(_l("TffdshowEnc::GetMediaType"));

    if (m_pInput->IsConnected() == FALSE) {
        return E_UNEXPECTED;
    }

    if (iPosition < 0) {
        return E_INVALIDARG;
    }
    if (iPosition >/*(mpeg_codec(ffvfw->cfg.co.codecId)?2:1)*/1) {
        return VFW_S_NO_MORE_ITEMS;
    }

    switch (iPosition) {
        case 0: {
            getFormat(&inpin->biIn.bmiHeader, NULL);
            VIDEOINFOHEADER *vih = (VIDEOINFOHEADER*)mtOut->ReallocFormatBuffer(ULONG(sizeof(VIDEOINFOHEADER) + extraDataSize));
            if (!vih) {
                return E_OUTOFMEMORY;
            }

            ZeroMemory(vih, sizeof(VIDEOINFOHEADER) + extraDataSize);
            getFormat(&inpin->biIn.bmiHeader, (BITMAPINFO*)&vih->bmiHeader);
            vih->rcSource.left = 0;
            vih->rcSource.top = 0;
            vih->rcSource.right = vih->bmiHeader.biWidth;
            vih->rcSource.bottom = vih->bmiHeader.biHeight;
            vih->rcTarget = vih->rcSource;
            vih->AvgTimePerFrame = inpin->avgTimePerFrame;

            GUID subtype = MEDIASUBTYPE_YV12;
            subtype.Data1 = vih->bmiHeader.biCompression;
            mtOut->SetSubtype(&subtype);

            mtOut->SetType(&MEDIATYPE_Video);
            mtOut->SetFormatType(&FORMAT_VideoInfo);
            mtOut->SetTemporalCompression(TRUE);
            mtOut->SetSampleSize(vih->bmiHeader.biSizeImage);
            break;
        }
        case 1: {
            mtOut->SetType(&MEDIATYPE_Stream);
            mtOut->SetSubtype(&MEDIASUBTYPE_None);
            mtOut->SetFormatType(&FORMAT_None);
            unsigned int outdx, outdy;
            getOut(inpin->biIn.bmiHeader.biWidth, inpin->biIn.bmiHeader.biHeight, &outdx, &outdy);
            mtOut->SetSampleSize(outdx * outdy * 4);
            mtOut->SetVariableSize();
            mtOut->SetTemporalCompression(FALSE);
            break;
        }
        case 2: {
            unsigned int outdx, outdy;
            getOut(inpin->biIn.bmiHeader.biWidth, inpin->biIn.bmiHeader.biHeight, &outdx, &outdy);
            mtOut->SetType(&MEDIATYPE_Video);
            mtOut->SetTemporalCompression(TRUE);
            mtOut->SetSampleSize(outdx * outdy * 4);
            if (coSettings->codecId == CODEC_ID_MPEG1VIDEO) { //mpeg1 (including VideoCD)
                mtOut->SetSubtype(&MEDIASUBTYPE_MPEG1Video);
                mtOut->SetFormatType(&FORMAT_MPEGVideo);
                MPEG1VIDEOINFO *mvi = (MPEG1VIDEOINFO*)mtOut->ReallocFormatBuffer(sizeof(MPEG1VIDEOINFO));
                mvi->dwStartTimeCode = 0;
                ZeroMemory(&mvi->hdr, sizeof(VIDEOINFOHEADER));
                mvi->hdr.rcSource.left = 0;
                mvi->hdr.rcSource.top = 0;
                mvi->hdr.rcSource.right = outdx;
                mvi->hdr.rcSource.bottom = outdy;
                mvi->hdr.rcTarget = mvi->hdr.rcSource;
                mvi->hdr.AvgTimePerFrame = inpin->avgTimePerFrame;
                //mvi->hdr.bmiHeader=biOut.bmiHeader;
            } else { //mpeg2
            }
            break;
        }
    }
    return S_OK;
}
コード例 #10
0
ファイル: RangeIOBase.cpp プロジェクト: ixc-software/lucksi
 shared_ptr<FlashOStream> RangeIOBase::OutStreamAll()
 {
     return getOut(m_totalRange);
 }
コード例 #11
0
ファイル: RangeIOBase.cpp プロジェクト: ixc-software/lucksi
 shared_ptr<FlashOStream> RangeIOBase::OutStreamRange( NamedRangeIndex index )
 {
     AssertRegion(index);
     return getOut(m_map.at(index));
 }