int main (int argc, char *argv[]){
	if(isUsbAccessory() < 0){
		if(init() < 0){
			deInit();
			return 0;
		}

		//doTransfer();
		if(setupAccessory(
			"Nexus-Computing GmbH",
			"osciprime",
			"Description",
			"antilope",
			"http://neuxs-computing.ch",
			"2254711SerialNo.") < 0){
			fprintf(stdout, "Error setting up accessory\n");
			deInit();
			return -1;
		};
	}

	if(mainPhase() < 0){
		fprintf(stdout, "Error during main phase\n");
		deInit();
		return -1;
	}	
	deInit();
	fprintf(stdout, "Done, no errors\n");
	return 0;
}
예제 #2
0
파일: adkping.c 프로젝트: YuriTr/stm32-adk
int main(int argc, char *argv[])
{
	int err;

	libusb_init(NULL);
	libusb_set_debug(NULL, 3);

	/* Try to open directly accessory. If it's not there, try to switch phone to it */
	handle = libusb_open_device_with_vid_pid(NULL, ACCESSORY_VID, ACCESSORY_PID_DBG);
	//if(handle)
		//libusb_reset_device(handle);

	if(handle == NULL){
		printf("Device not in Accessory mode. Trying to switch it to it...\n");
		err = setupAccessory("STMicroelectronics", "adkping", "Just pings data", "2.0",
			"http://www.st.com", "1234567890123456");
		if(err < 0){
			fprintf(stdout, "Sorry, can't set up accessory, giving up\n");
			deInit();
			return -1;
		}
	}

	/* Do some stuff */
	if(mainPhase() < 0){
		fprintf(stdout, "Error during main phase\n");
		deInit();
		return -1;
	}
	
	deInit();
	fprintf(stdout, "Done, no errors\n");

	return 0;
}
예제 #3
0
	void cPlug::madeError(const CStdString msg , unsigned int severity) {
		CStdString info = "Wtyczka \""+this->name+"\" zrobi³a bubu:\r\n" + string(msg) + "\r\n\r\nPrzejmujemy siê tym?";
		if (MessageBox(0 , info , "Konnekt" , MB_TASKMODAL | MB_TOPMOST | MB_ICONERROR | MB_YESNO) == IDYES)
		{ 
			int pl = Plg.findby((TdEntry)this->file.c_str() , PLG_FILE);
			if (pl < 0) return;
			Plg.setint(pl , PLG_LOAD , -1);
			Tables::savePlg();
			if (!running) {
				deInit();
			} else {
				deInit();
				restart();
			}
		}
	}
예제 #4
0
	ANativeWindowRenderer::~ANativeWindowRenderer(){
		deInit();
		if(mMetaData != NULL){
			delete mMetaData;
			mMetaData = NULL;
		}
	}
예제 #5
0
int GFFFile::endwrite(uint8 **mem, uint32 *size)
{
	if((datas.size() != datac.size()) || (datas.size() != dataoffs.size()) ||
	   (datas.size() != datasizes.size()))
		return errcode = 25;
	for(uint32 i=0;i<structs.size();i++)
	{
		if((structs[i].fieldcount = structs[i].values.size()) > 1)
			fieldidxsize += structs[i].fieldcount*4;
		// Yeah, I know this is kind of a bad hack, but I need it that way...
		for(uint32 j=0;j<structs[i].labels.size();j++)
			if(structs[i].labels[j] == (std::string *) -1)
				structs[i].labels[j] = (std::string *) (uint64) addLabel("");
	}
	for(uint32 i=0;i<lists.size();i++)
		listidxsize += lists[i].size()*4 + 4;
	structcount = structs.size();
	labelcount = labels.size();
	offstruct = 56;
	offfield = offstruct + structcount*12;
	offlabel = offfield + fieldcount*12;
	offfielddata = offlabel + labelcount*16;
	offfieldidx = offfielddata + fielddatasize;
	offlistidx = offfieldidx + fieldidxsize;

	if(finalWriteHeader()) return errcode;
	if(finalWriteData()) return errcode;
	if(finalWriteLists()) return errcode;
	if(finalWriteLabels()) return errcode;
	if(finalWriteStructs()) return errcode;
	deInit();
	if(mem) *mem = getMem();
	if(size) *size = getMemSize();
	return 0;
}
예제 #6
0
 /// \brief Deinitialize iterator, will call deInit
 void DeInit()
 {
   if(m_bInitialized&&!m_bDeInitialized)
   {
     deInit();
     m_bDeInitialized = true;
   }
 }
JpegHwEncoder::~JpegHwEncoder()
{
    LOG1("@%s", __FUNCTION__);
    if (mHWInitialized)
        deInit();

    delete mHwImageEncoder;
    mHwImageEncoder = NULL;
}
    Stack& operator = (Stack s){
        if (this == &s) return *this;
        deInit();

        m_first = Allocator{}.allocate(s.capacity());
        m_top = placement_copy_range(s.m_first, s.m_top, this->m_first);
        m_last = m_first + s.capacity();

        return *this;

    }
예제 #9
0
int main(int argc, char* argv[])
{
	struct info *args = parseARGs(argc, argv);
	struct out  *out = mkanout(NULL);
	if (args == NULL || out == NULL)
		exit(-1);
	OpenDecode(args);
	BeginParse(out, args);
	//printOUTPUT(out);
	outputTOFILE(args, out);
	deInit(args, out);
	return 0;
}
    Stack& operator = (Stack&& s){
        if (this == &s) return *this;
        deInit();

        m_first = s.m_first;
        m_top = s.m_top;
        m_last = s.m_last;

        s.m_first = nullptr;
        s.m_top = nullptr;
        s.m_last = nullptr;

        return *this;
    }
예제 #11
0
int main (int argc, char *argv[]){
	if(init() < 0)
		return;
	//doTransfer();
	if(setupAccessory(
		"Manufacturer",
		"Model",
		"Description",
		"VersionName",
		"http://neuxs-computing.ch",
		"2254711SerialNo.") < 0){
		fprintf(stdout, "Error setting up accessory\n");
		deInit();
		return -1;
	};
	if(mainPhase() < 0){
		fprintf(stdout, "Error during main phase\n");
		deInit();
		return -1;
	}	
	deInit();
	fprintf(stdout, "Done, no errors\n");
	return 0;
}
예제 #12
0
int ERFFile::endwrite(uint8 **mem, uint32 *size)
{
	if(pronto && (prontowritten < entrycount)) return errcode = 32;
	if(!pronto)
	{
		if(finalWriteCalc()) return errcode;
		if(finalWriteHeader()) return errcode;
		if(finalWriteDescription()) return errcode;
	}
	if(finalWriteKeyList()) return errcode;
	if(finalWriteResList()) return errcode;
	if(!pronto && finalWriteEntries()) return errcode;
	deInit();
	if(mem) *mem = getMem();
	if(size) *size = getMemSize();
	return errcode = 0;
}
예제 #13
0
FlcPlayer::~FlcPlayer()
{
	deInit();
}
예제 #14
0
	OpenSLRecorder::~OpenSLRecorder(){
		deInit();
	}
예제 #15
0
	MuxEngine::~MuxEngine(){
		deInit();
	}
/**
 *  Configure pre-allocated input buffer
 *
 *  Prepares the encoder to use a set of pre-allocated input buffers
 *  if an encode command comes with a pointer belonging to this set
 *  the encoding process is faster.
 * \param inputBuffersArray: a set of pre-allocated input buffers
 * \param inputBuffersNum: buffer number
 * \return 0 success
 * \return -1 failure
 */
status_t JpegHwEncoder::setInputBuffers(AtomBuffer* inputBuffersArray, int inputBuffersNum)
{
    LOG1("@%s", __FUNCTION__);

    status_t status = NO_ERROR;
    int imageSeq = 0;
    unsigned int vaFmt = 0;

    if (isInitialized())
        deInit();

    /**
     * if we want to create and destroy the IntelImageEncoder for each capture we may be
     * configured like this. This happens in video mode where the video encoder
     * context also needs to exist
     */
    if (inputBuffersNum == 0) {
        LOG1("HW encoder configured with 0 pre-allocated buffers");
        return NO_ERROR;
    }

    if (inputBuffersArray[0].bpl % SIZE_OF_WIDTH_ALIGNMENT || inputBuffersArray[0].height % 2) {
        LOGW("@%s, line:%d, bpl:%d or height:%d, we can't support", __FUNCTION__, __LINE__, inputBuffersArray[0].bpl, inputBuffersArray[0].height);
        return BAD_VALUE;
    }

    if (V4L2Fmt2VAFmt(inputBuffersArray[0].fourcc, vaFmt) < 0) {
        LOGW("@%s, unsupport format, do not use the hw jpeg encoder", __FUNCTION__);
        return BAD_VALUE;
    }

    if (init() < 0) {
        LOGE("HW encoder failed to initialize when setting the input buffers");
        return UNKNOWN_ERROR;
    }

    for (int i = 0;i < inputBuffersNum;i++) {
        /*create surface
        *buffer had been mapped when allocated by gralloc, so use SURFACE_TYPE_USER_PTR for GraphicBuffer.
        */
        status = mHwImageEncoder->createSourceSurface(SURFACE_TYPE_USER_PTR, inputBuffersArray[i].dataPtr, inputBuffersArray[i].width, inputBuffersArray[i].height, inputBuffersArray[i].bpl, vaFmt, &imageSeq);
        if (status != 0) {
            LOGE("create source surface failed");
            return UNKNOWN_ERROR;
        }
        mBuffer2SurfaceId.add(inputBuffersArray[i].dataPtr, imageSeq);
        if (i == 0)
           mFirstImageSeq = imageSeq;
    }

    //record default buffer attributes
    mBufferAttribute.width  = inputBuffersArray[0].width;
    mBufferAttribute.height = inputBuffersArray[0].height;
    mBufferAttribute.bpl    = inputBuffersArray[0].bpl;
    mBufferAttribute.fourcc = inputBuffersArray[0].fourcc;

    //create context
    status = mHwImageEncoder->createContext(mFirstImageSeq, &mMaxOutJpegBufSize);
    if (status != 0) {
        LOGE("createContext failed");
        return UNKNOWN_ERROR;
    }

    return NO_ERROR;
}
 ~Stack()
 {
     deInit();
 }
예제 #18
0
파일: GameUI.cpp 프로젝트: Ranquil/Ushiko
GameUI::~GameUI()
{
	deInit();
}
예제 #19
0
Audio::~Audio(){
	if(active){deInit();}
}
예제 #20
0
bool Game::runAndDontCrashPls()
{
	if (mainMenu.getEngineSettings().debug){
		ns::debug = new DebugConsole;
		ns::debug->draw();
	}
	else{
		HWND hwnd = GetConsoleWindow();
		ShowWindow(hwnd, SW_HIDE);
	}
	
	while (ns::reloadState || ns::restartState || (mainMenu.showMenu() && !ns::exitState)){
		if (!ns::restartState)
			init();
		else
			resetStates();

		while (ns::runningState){
			if (mainMenu.getEngineSettings().vSync){
				if (updateClock.getElapsedTime().asSeconds() > ns::g_updateTimerValue){
					if (!paused && !ns::deathState){
						update();
						pollEvents();
					}
					render();
					if (paused){
						player[0]->resetClocks();
						player[1]->resetClocks();
					}
					if (pauseMenu->showMenu(paused))
						paused = false;
					deathMenu.showMenu();
					endMenu.showMenu(gameTime.getElapsedTime().asSeconds() + (ns::dirtyRun * ns::checkPointTime.asSeconds()));
				}
			}
			else {
				if (updateClock.getElapsedTime().asSeconds() > ns::g_updateTimerValue && !paused && !ns::deathState){
					update();
					pollEvents();
				}
				render();
				if (paused){
					player[0]->resetClocks();
					player[1]->resetClocks();
				}
				if (pauseMenu->showMenu(paused))
					paused = false;
				deathMenu.showMenu();
				endMenu.showMenu(gameTime.getElapsedTime().asSeconds() + (ns::dirtyRun * ns::checkPointTime.asSeconds()));
			}
			if (!paused && !ns::endOfLevelState && !ns::deathState)
				gameTime.start();
			else
				gameTime.stop();
		}
		if (!ns::restartState)
			deInit();
		if (ns::exitState)
			return true;
	}

	if (ns::debug != nullptr) delete ns::debug;
	
	return true;
}
예제 #21
0
파일: FFMPEGer.cpp 프로젝트: forbe/recorder
	FFMPEGer::~FFMPEGer(){
		deInit();
	}
예제 #22
0
UdpSocket::~UdpSocket()
{
    deInit();
}