예제 #1
0
void TV3DManager::connect() {
    auto glCanvas = Application::getInstance()->getGLWidget();
    int width = glCanvas->getDeviceWidth();
    int height = glCanvas->getDeviceHeight();
    Camera& camera = *Application::getInstance()->getCamera();

    configureCamera(camera, width, height);
}
예제 #2
0
파일: TV3DManager.cpp 프로젝트: Chris7/hifi
void TV3DManager::connect() {
    Application* app = Application::getInstance();
    int width = app->getGLWidget()->width();
    int height = app->getGLWidget()->height();
    Camera& camera = *app->getCamera();

    configureCamera(camera, width, height);
}
예제 #3
0
void FastWorldDrawer::Draw() {

    clearView();

    configureCamera();

    paintGround();
    paintDecorations();
    paintCorpses();
    paintProjectiles();
    paintMonsters();
    paintHeroes();

    paintEffects();

    paintCursor();

}
예제 #4
0
int mainStreaming(char* ip) {
    // Prepare the application context to get video stream
    AppOMXContext ctx = AppOMXContext_Construct(ip) ;
    initAppOMX(&ctx) ;
    configureCamera(&ctx) ;
    configureEncoder(&ctx) ;
    configureNullSink(&ctx) ;

    // Configure ports to capture and compress video stream
    tunneling(&ctx) ;
    enablePorts(&ctx) ;
    allocateBuffers(&ctx) ;
    portsReady(&ctx) ;

    // Capture and make video streaming over Wifi connection
    while (1) {
        ctx.capture(&ctx) ;
    }
    return 0 ;
}
예제 #5
0
status_t CameraSource::initWithCameraAccess(
        const sp<ICamera>& camera,
        const sp<ICameraRecordingProxy>& proxy,
        int32_t cameraId,
        const String16& clientName,
        uid_t clientUid,
        Size videoSize,
        int32_t frameRate,
        bool storeMetaDataInVideoBuffers) {
    ALOGV("initWithCameraAccess");
    status_t err = OK;

    if ((err = isCameraAvailable(camera, proxy, cameraId,
            clientName, clientUid)) != OK) {
        ALOGE("Camera connection could not be established.");
        return err;
    }
    CameraParameters params(mCamera->getParameters());
    if ((err = isCameraColorFormatSupported(params)) != OK) {
        return err;
    }

    // Set the camera to use the requested video frame size
    // and/or frame rate.
    if ((err = configureCamera(&params,
                    videoSize.width, videoSize.height,
                    frameRate))) {
        return err;
    }

    // Check on video frame size and frame rate.
    CameraParameters newCameraParams(mCamera->getParameters());
    if ((err = checkVideoSize(newCameraParams,
                videoSize.width, videoSize.height)) != OK) {
        return err;
    }
    if ((err = checkFrameRate(newCameraParams, frameRate)) != OK) {
        return err;
    }

    // Set the preview display. Skip this if mSurface is null because
    // applications may already set a surface to the camera.
    if (mSurface != NULL) {
        // This CHECK is good, since we just passed the lock/unlock
        // check earlier by calling mCamera->setParameters().
        CHECK_EQ((status_t)OK, mCamera->setPreviewTarget(mSurface));
    }

    // By default, do not store metadata in video buffers
    mIsMetaDataStoredInVideoBuffers = false;
    mCamera->storeMetaDataInBuffers(false);
    if (storeMetaDataInVideoBuffers) {
        if (OK == mCamera->storeMetaDataInBuffers(true)) {
            mIsMetaDataStoredInVideoBuffers = true;
        }
    }

    int64_t glitchDurationUs = (1000000LL / mVideoFrameRate);
    if (glitchDurationUs > mGlitchDurationThresholdUs) {
        mGlitchDurationThresholdUs = glitchDurationUs;
    }

    // XXX: query camera for the stride and slice height
    // when the capability becomes available.
    mMeta = new MetaData;
    mMeta->setCString(kKeyMIMEType,  MEDIA_MIMETYPE_VIDEO_RAW);
    mMeta->setInt32(kKeyColorFormat, mColorFormat);
    mMeta->setInt32(kKeyWidth,       mVideoSize.width);
    mMeta->setInt32(kKeyHeight,      mVideoSize.height);
    mMeta->setInt32(kKeyStride,      mVideoSize.width);
    mMeta->setInt32(kKeySliceHeight, mVideoSize.height);
    mMeta->setInt32(kKeyFrameRate,   mVideoFrameRate);
    return OK;
}
예제 #6
0
/* 
 * Draws & initializes all the widgets of the main window 
 */
void MainWindow::initWidgets() 
{
    setPlainCaption("QtKam");

    /* Construct Actions */
    saveAction = KStdAction::save(this, SLOT(saveSelected()),this); 
    quitAction = KStdAction::quit(this, SLOT(close()),this);
    deleteAction = new KAction(i18n("Delete"), "edittrash",
                    Key_Delete, this, SLOT(deleteSelected()), this);
    downloadThumbsAction = new KAction(i18n("Download Thumbs"), "queue",
                    CTRL + Key_T, this, SLOT(downloadThumbs()), this);
    selectAllAction = new KAction(i18n("Select &All"), SHIFT + Key_A,
                    this, SLOT(selectAll()), this);      
    invertSelectionAction = new KAction(i18n("&Invert Selection"),
                    SHIFT + Key_I, this, SLOT(selectInverse()), this); 
    clearSelectionAction = new KAction(i18n("&Clear Selection"),
                    SHIFT + Key_N, this, SLOT(selectNone()), this);
    selectCameraAction = new KAction(i18n("Select &Camera"),  
                    CTRL + Key_C, this, SLOT(selectCamera()), this);
    initCameraAction = new KAction(i18n("Reset Camera"),
                    "connect_creating", CTRL + Key_R, this, 
                    SLOT(initCamera()), this);
    configureCameraAction = new KAction(i18n("&Configure"), 
                    0, this, SLOT(configureCamera()), this);
    cameraInformationAction = new KAction(i18n("&Information"),
                    0, this, SLOT(cameraInformation()), this);
    cameraManualAction = new KAction(i18n("&Manual"), 
                    0, this, SLOT(cameraManual()), this);
    cameraAboutAction = new KAction(i18n("&About the driver"),
                    0, this, SLOT(cameraAbout()), this);
                 
    /* Initialize actions */
    saveAction->setEnabled(false);
    deleteAction->setEnabled(false);

    /* Create & initialize icon view */
    iconView = new KIconView(this);
    iconView->setMode(KIconView::Select);
    iconView->setSelectionMode(KIconView::Multi);
    iconView->setItemsMovable(false);
    iconView->setResizeMode(KIconView::Adjust);
    connect(iconView,SIGNAL(selectionChanged()),
            this,SLOT(selectionChanged()));
    setCentralWidget(iconView);
    
    /* Create file menu */
    fileMenu = new KPopupMenu();
    saveAction->plug(fileMenu);
    deleteAction->plug(fileMenu);
    fileMenu->insertSeparator();
    quitAction->plug(fileMenu);

    /* Create edit menu */
    editMenu = new KPopupMenu();
    selectAllAction->plug(editMenu);
    invertSelectionAction->plug(editMenu); 
    clearSelectionAction->plug(editMenu);
    
    /* Create command menu */
    commandMenu = new KPopupMenu();
    initCameraAction->plug(commandMenu);
    downloadThumbsAction->plug(commandMenu);
    
    /* Camera menu */
    cameraMenu = new KPopupMenu();
    selectCameraAction->plug(cameraMenu);
    cameraMenu->insertSeparator();
    configureCameraAction->plug(cameraMenu);
    cameraInformationAction->plug(cameraMenu);
    cameraManualAction->plug(cameraMenu);
    cameraAboutAction->plug(cameraMenu);

    /* Help menu */
    help = helpMenu();
    
    /* Menu Bar */
    menuBar()->insertItem(i18n("&File"), fileMenu);
    menuBar()->insertItem(i18n("&Edit"), editMenu);
    menuBar()->insertItem(i18n("&Command"),commandMenu);
    menuBar()->insertItem(i18n("C&amera"),cameraMenu);
    menuBar()->insertItem(i18n("&Help"), help);
   
    /* Create toolbar */
    downloadThumbsAction->plug(toolBar());
    saveAction->plug(toolBar());
    deleteAction->plug(toolBar());
}
status_t CameraSource::initWithCameraAccess(
        const sp<ICamera>& camera,
        const sp<ICameraRecordingProxy>& proxy,
        int32_t cameraId,
        Size videoSize,
        int32_t frameRate,
        bool storeMetaDataInVideoBuffers) {
    LOGV("initWithCameraAccess");
    status_t err = OK;

    if ((err = isCameraAvailable(camera, proxy, cameraId)) != OK) {
        LOGE("Camera connection could not be established.");
        return err;
    }
    CameraParameters params(mCamera->getParameters());
    if ((err = isCameraColorFormatSupported(params)) != OK) {
        return err;
    }

    // Set the camera to use the requested video frame size
    // and/or frame rate.
    if ((err = configureCamera(&params,
                    videoSize.width, videoSize.height,
                    frameRate))) {
        return err;
    }

    // Check on video frame size and frame rate.
    CameraParameters newCameraParams(mCamera->getParameters());
    if ((err = checkVideoSize(newCameraParams,
                videoSize.width, videoSize.height)) != OK) {
        return err;
    }
    if ((err = checkFrameRate(newCameraParams, frameRate)) != OK) {
        return err;
    }

    // This CHECK is good, since we just passed the lock/unlock
    // check earlier by calling mCamera->setParameters().
    CHECK_EQ(OK, mCamera->setPreviewDisplay(mSurface));

    // By default, do not store metadata in video buffers
    mIsMetaDataStoredInVideoBuffers = false;
    mCamera->storeMetaDataInBuffers(false);
    if (storeMetaDataInVideoBuffers) {
        if (OK == mCamera->storeMetaDataInBuffers(true)) {
            mIsMetaDataStoredInVideoBuffers = true;
        }
    }

#ifdef QCOM_HARDWARE
    const char *hfr_str = params.get("video-hfr");
    int32_t hfr = -1;
    if ( hfr_str != NULL ) {
      hfr = atoi(hfr_str);
    }
    if(hfr < 0) {
      LOGW("Invalid hfr value(%d) set from app. Disabling HFR.", hfr);
      hfr = 0;
    }
#endif

    int64_t glitchDurationUs = (1000000LL / mVideoFrameRate);
    if (glitchDurationUs > mGlitchDurationThresholdUs) {
        mGlitchDurationThresholdUs = glitchDurationUs;
    }

    // XXX: query camera for the stride and slice height
    // when the capability becomes available.
#ifdef STE_HARDWARE
    int stride = newCameraParams.getInt(CameraParameters::KEY_RECORD_STRIDE);
    int sliceHeight = newCameraParams.getInt(CameraParameters::KEY_RECORD_SLICE_HEIGHT);
#endif

    mMeta = new MetaData;
    mMeta->setCString(kKeyMIMEType,  MEDIA_MIMETYPE_VIDEO_RAW);
    mMeta->setInt32(kKeyColorFormat, mColorFormat);
    mMeta->setInt32(kKeyWidth,       mVideoSize.width);
    mMeta->setInt32(kKeyHeight,      mVideoSize.height);
#ifndef STE_HARDWARE
    mMeta->setInt32(kKeyStride,      mVideoSize.width);
    mMeta->setInt32(kKeySliceHeight, mVideoSize.height);
#else
    mMeta->setInt32(kKeyStride,      stride != -1 ? stride : mVideoSize.width);
    mMeta->setInt32(kKeySliceHeight, sliceHeight != -1 ? sliceHeight : mVideoSize.height);
#endif
    mMeta->setInt32(kKeyFrameRate,   mVideoFrameRate);
#ifdef QCOM_HARDWARE
    mMeta->setInt32(kKeyHFR, hfr);
#endif
    return OK;
}
예제 #8
0
void TV3DManager::connect() {
    auto deviceSize = qApp->getDeviceSize();
    configureCamera(*(qApp->getCamera()), deviceSize.width(), deviceSize.height());
}