Esempio n. 1
0
int Webcam::stopStreaming()
{
	if(!streaming)
		return -1;
	
	imageNotifier->setEnabled(false);
	
	if (munmap(mem[0], bufLength) == -1)
	{
		printf("Webcam::stopStreaming : munmap 0 failed. errno = %d\n", errno);
	}

	if (munmap(mem[1], bufLength) == -1)
	{
		printf("Webcam::stopStreaming : munmap 1 failed. errno = %d\n", errno);
	}
	else
		mmaped = false;

	if(streamOff() == 0)
	{
		streaming = false;
		printf(" * Succesful Stopped\n");
	}
	else
		imageNotifier->setEnabled(true);
	return EXIT_SUCCESS;
}
Esempio n. 2
0
// ##############################################################################################################
jevois::Gadget::~Gadget()
{
  JEVOIS_TRACE(1);
  
  streamOff();

  // Tell run() thread to finish up:
  itsRunning.store(false);

  // Will block until the run() thread completes:
  if (itsRunFuture.valid()) try { itsRunFuture.get(); } catch (...) { jevois::warnAndIgnoreException(); }

  if (close(itsFd) == -1) PLERROR("Error closing UVC gadget -- IGNORED");
}
Esempio n. 3
0
// ##############################################################################################################
jevois::Camera::~Camera()
{
  JEVOIS_TRACE(1);

  // Turn off streaming if it was on:
  try { streamOff(); } catch (...) { jevois::warnAndIgnoreException(); }
 
  // Block until the run() thread completes:
  itsRunning.store(false);
  if (itsRunFuture.valid()) try { itsRunFuture.get(); } catch (...) { jevois::warnAndIgnoreException(); }

  if (itsBuffers) delete itsBuffers;
  
  if (close(itsFd) == -1) PLERROR("Error closing V4L2 camera");
}
QCameraStream_preview::~QCameraStream_preview() {
    ALOGV("%s: E", __func__);
	if(mActive) {
		streamOff(0);
	}
	if(mInit) {
		deinitStream();
	}
	mInit = false;
	mActive = false;
    if (mDisplayBuf) {
        delete[] mDisplayBuf;
        mDisplayBuf = NULL;
    }
    deallocateStreamId(mStreamId);
    ALOGV("%s: X", __func__);

}
// ---------------------------------------------------------------------------
// QCameraStream_preview
// ---------------------------------------------------------------------------
  void QCameraStream_preview::stop() {
    ALOGE("%s: E", __func__);
    int ret=MM_CAMERA_OK;

    if(!mActive) {
      return;
    }
    Mutex::Autolock lock(mLock);
    mActive =  false;
    /* unregister the notify fn from the mmmm_camera_t object*/

    ALOGI("%s: Stop the thread \n", __func__);
    /* call stop() in parent class to stop the monitor thread*/
    //stream_info = mHalCamCtrl->getChannelInterface();

    ret = streamOff(0);
    if(MM_CAMERA_OK != ret) {
      ALOGE ("%s: camera preview stop err=%d\n", __func__, ret);
    }
#if 0
    ret = cam_config_unprepare_buf(mCameraId, MM_CAMERA_CH_PREVIEW);
    if(ret != MM_CAMERA_OK) {
      ALOGE("%s:Unreg preview buf err=%d\n", __func__, ret);
      //ret = BAD_VALUE;
    }
#endif
    /* In case of a clean stop, we need to clean all buffers*/
    ALOGE("Debug : %s : Buffer Unprepared",__func__);
    /*free camera_memory handles and return buffer back to surface*/
    ret= QCameraStream::deinitStream();
    ALOGE(": %s : De init Channel",__func__);
    if(ret != MM_CAMERA_OK) {
      ALOGE("%s:Deinit preview channel failed=%d\n", __func__, ret);
      //ret = BAD_VALUE;
    }
    ALOGE("%s: X", __func__);

  }
void QCameraStream_SnapshotMain::release()
{
    streamOff(0);
    deinitStream();

}
void QCameraStream_SnapshotThumbnail::release()
{
    streamOff(0);
    deinitStream();
}