int GonkNativeWindow::hook_perform(ANativeWindow* window, int operation, ...)
{
    va_list args;
    va_start(args, operation);
    GonkNativeWindow* c = getSelf(window);
    return c->perform(operation, args);
}
/* static */ void
GonkNativeWindow::RecycleCallback(TextureClient* client, void* closure) {
  GonkNativeWindow* nativeWindow =
    static_cast<GonkNativeWindow*>(closure);

  client->ClearRecycleCallback();
  nativeWindow->returnBuffer(client);
}
Example #3
0
void
GonkCameraHardware::OnNewFrame()
{
  if (mClosing) {
    return;
  }
  GonkNativeWindow* window = static_cast<GonkNativeWindow*>(mWindow.get());
  nsRefPtr<GraphicBufferLocked> buffer = window->getCurrentBuffer();
  ReceiveFrame(mTarget, buffer);
}
int
GonkCameraHardware::StartPreview()
{
  if (mWindow.get()) {
    GonkNativeWindow* window = static_cast<GonkNativeWindow*>(mWindow.get());
    window->abandon();
  } else {
    mWindow = new GonkNativeWindow(this);
    mHardware->setPreviewWindow(mWindow);
  }

  mHardware->enableMsgType(CAMERA_MSG_PREVIEW_FRAME);
  return mHardware->startPreview();
}
Example #5
0
void
GonkCameraHardware::ReleaseHandle(uint32_t aHwHandle)
{
  GonkCameraHardware* hw = GetHardware(aHwHandle);
  DOM_CAMERA_LOGI("%s: aHwHandle = %d, hw = %p (sHwHandle = %d)\n", __func__, aHwHandle, (void*)hw, sHwHandle);
  if (!hw) {
    return;
  }

  DOM_CAMERA_LOGI("%s: before: sHwHandle = %d\n", __func__, sHwHandle);
  sHwHandle += 1; // invalidate old handles before deleting
  hw->mClosing = true;
  hw->mHardware->disableMsgType(CAMERA_MSG_ALL_MSGS);
  hw->mHardware->stopPreview();
  hw->mHardware->release();
  GonkNativeWindow* window = static_cast<GonkNativeWindow*>(hw->mWindow.get());
  window->abandon();
  DOM_CAMERA_LOGI("%s: after: sHwHandle = %d\n", __func__, sHwHandle);
  delete hw;     // destroy the camera hardware instance
}
int GonkNativeWindow::hook_cancelBuffer(ANativeWindow* window,
        ANativeWindowBuffer* buffer)
{
    GonkNativeWindow* c = getSelf(window);
    return c->cancelBuffer(buffer);
}
int GonkNativeWindow::hook_dequeueBuffer(ANativeWindow* window,
        ANativeWindowBuffer** buffer)
{
    GonkNativeWindow* c = getSelf(window);
    return c->dequeueBuffer(buffer);
}
int GonkNativeWindow::hook_setSwapInterval(ANativeWindow* window, int interval)
{
    GonkNativeWindow* c = getSelf(window);
    return c->setSwapInterval(interval);
}