bool VideoPreview::showConfigDialog(QWidget *parent) { VideoPreviewConfigDialog d(parent); d.setVideoFile(videoFile()); d.setDVDDevice(DVDDevice()); d.setCols(cols()); d.setRows(rows()); d.setInitialStep(initialStep()); d.setMaxWidth(maxWidth()); d.setDisplayOSD(displayOSD()); d.setAspectRatio(aspectRatio()); d.setFormat(extractFormat()); d.setSaveLastDirectory(save_last_directory); if (d.exec() == QDialog::Accepted) { setVideoFile(d.videoFile()); setDVDDevice(d.DVDDevice()); setCols(d.cols()); setRows(d.rows()); setInitialStep(d.initialStep()); setMaxWidth(d.maxWidth()); setDisplayOSD(d.displayOSD()); setAspectRatio(d.aspectRatio()); setExtractFormat(d.format()); save_last_directory = d.saveLastDirectory(); return true; } return false; }
void SystemStub_SDL::init(const char *title, bool opengl, bool windowed, bool aspect, int windowW, int windowH) { SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_JOYSTICK); SDL_ShowCursor(SDL_DISABLE); int flags = opengl ? SDL_WINDOW_OPENGL : 0; if (windowed) { flags |= SDL_WINDOW_RESIZABLE; } else { flags |= SDL_WINDOW_FULLSCREEN_DESKTOP; windowW = 0; windowH = 0; } _window = SDL_CreateWindow(title, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, windowW, windowH, flags); SDL_GetWindowSize(_window, &_w, &_h); _renderer = SDL_CreateRenderer(_window, -1, SDL_RENDERER_ACCELERATED); if (!windowed) { setAspectRatio(_w, _h); if (!opengl && aspect) { SDL_RenderSetLogicalSize(_renderer, 320 * 3, 200 * 4); } } else { _aspectRatio[0] = _aspectRatio[1] = 0.; _aspectRatio[2] = _aspectRatio[3] = 1.; } _joystick = 0; if (SDL_NumJoysticks() > 0) { _joystick = SDL_JoystickOpen(0); } }
void RatioLayoutedFrame::setImage(const QImage& image)//, QMutex* image_mutex) { qimage_mutex_.lock(); qimage_ = image.copy(); qimage_mutex_.unlock(); setAspectRatio(qimage_.width(), qimage_.height()); emit delayed_update(); }
void configureFromRead( const VideoFFmpegReader& reader ) { setWidth ( reader.width() ); setHeight ( reader.height() ); setAspectRatio ( reader.aspectRatio() ); setFps ( reader.fps() ); setBitRate ( reader.bitRate() ); setFormat ( reader.formatName() ); setCodec ( reader.codecName() ); }
void Settings::readSettings() { setLanguage(value(KEY_LANGUAGE, defaultValue(KEY_LANGUAGE)).toString()); setPlaylist(value(KEY_PLAYLIST, defaultValue(KEY_PLAYLIST)).toString()); setPlaylistUpdate(value(KEY_PLAYLIST_UPDATE, defaultValue(KEY_PLAYLIST_UPDATE)).toBool()); setPlaylistUpdateUrl(value(KEY_PLAYLIST_UPDATE_URL, defaultValue(KEY_PLAYLIST_UPDATE_URL)).toString()); setRadioCategory(value(KEY_RADIO_CATEGORY, defaultValue(KEY_RADIO_CATEGORY)).toString()); setHdCategory(value(KEY_HD_CATEGORY, defaultValue(KEY_HD_CATEGORY)).toString()); setUdpxy(value(KEY_UDPXY, defaultValue(KEY_UDPXY)).toBool()); setUdpxyUrl(value(KEY_UDPXY_URL, defaultValue(KEY_UDPXY_URL)).toString()); setUdpxyPort(value(KEY_UDPXY_PORT, defaultValue(KEY_UDPXY_PORT)).toInt()); setWidth(value(KEY_WIDTH, defaultValue(KEY_WIDTH)).toInt()); setHeight(value(KEY_HEIGHT, defaultValue(KEY_HEIGHT)).toInt()); setPosX(value(KEY_POS_X, defaultValue(KEY_POS_X)).toInt()); setPosY(value(KEY_POS_Y, defaultValue(KEY_POS_Y)).toInt()); setOsd(value(KEY_OSD, defaultValue(KEY_OSD)).toBool()); setTrayEnabled(value(KEY_TRAY_ENABLED, defaultValue(KEY_TRAY_ENABLED)).toBool()); setHideToTray(value(KEY_HIDE_TO_TRAY, defaultValue(KEY_HIDE_TO_TRAY)).toBool()); setMouseWheel(value(KEY_MOUSE_WHEEL, defaultValue(KEY_MOUSE_WHEEL)).toString()); setRememberGuiSession(value(KEY_REMEMBER_GUI_SESSION, defaultValue(KEY_REMEMBER_GUI_SESSION)).toBool()); setIcons(value(KEY_ICONS, defaultValue(KEY_ICONS)).toString()); setVout(value(KEY_VOUT, defaultValue(KEY_VOUT)).toInt()); setAout(value(KEY_AOUT, defaultValue(KEY_AOUT)).toInt()); setYuvToRgb(value(KEY_YUV_TO_RGB, defaultValue(KEY_MUTE_ON_MINIMIZE)).toBool()); setSpdif(value(KEY_SPDIF, defaultValue(KEY_SPDIF)).toBool()); setRememberVideoSettings(value(KEY_REMEMBER_VIDEO_SETTINGS, defaultValue(KEY_REMEMBER_VIDEO_SETTINGS)).toBool()); setRememberVideoPerChannel(value(KEY_REMEMBER_VIDEO_PER_CHANNEL, defaultValue(KEY_REMEMBER_VIDEO_PER_CHANNEL)).toBool()); setAspectRatio(value(KEY_ASPECT_RATIO, defaultValue(KEY_ASPECT_RATIO)).toInt()); setCropRatio(value(KEY_CROP_RATIO, defaultValue(KEY_CROP_RATIO)).toInt()); setDeinterlacing(value(KEY_DEINTERLACING, defaultValue(KEY_DEINTERLACING)).toInt()); setAudioLanguage(value(KEY_AUDIO_LANGUAGE, defaultValue(KEY_AUDIO_LANGUAGE)).toString()); setSubtitleLanguage(value(KEY_SUBTITLE_LANGUAGE, defaultValue(KEY_SUBTITLE_LANGUAGE)).toString()); setMuteOnMinimize(value(KEY_MUTE_ON_MINIMIZE, defaultValue(KEY_MUTE_ON_MINIMIZE)).toBool()); setTeletext(value(KEY_TELETEXT, defaultValue(KEY_TELETEXT)).toBool()); setRecorderDirectory(value(KEY_RECORDER_DIRECTORY, defaultValue(KEY_RECORDER_DIRECTORY)).toString()); setSnapshotsDirectory(value(KEY_SNAPSHOTS_DIRECTORY, defaultValue(KEY_SNAPSHOTS_DIRECTORY)).toString()); setSessionAutoplay(value(KEY_SESSION_AUTOPLAY, defaultValue(KEY_SESSION_AUTOPLAY)).toBool()); setSessionChannel(value(KEY_SESSION_CHANNEL, defaultValue(KEY_SESSION_CHANNEL)).toInt()); setSessionRememberVolume(value(KEY_SESSION_REMEMBER_VOLUME, defaultValue(KEY_SESSION_REMEMBER_VOLUME)).toBool()); setSessionVolume(value(KEY_SESSION_VOLUME, defaultValue(KEY_SESSION_VOLUME)).toInt()); setXmltvUpdate(value(KEY_XMLTV_UPDATE, defaultValue(KEY_XMLTV_UPDATE)).toBool()); setXmltvUpdateLocation(value(KEY_XMLTV_UPDATE_LOCATION, defaultValue(KEY_XMLTV_UPDATE_LOCATION)).toString()); setXmltvUpdateRemote(value(KEY_XMLTV_UPDATE_REMOTE, defaultValue(KEY_XMLTV_UPDATE_REMOTE)).toBool()); }
/*! * Defines a perspective projection based on \a fieldOfView, \a aspectRatio, \a * nearPlane, \a farPlane. */ void QCameraLens::setPerspectiveProjection(float fieldOfView, float aspectRatio, float nearPlane, float farPlane) { Q_D(QCameraLens); bool block = blockNotifications(true); setFieldOfView(fieldOfView); setAspectRatio(aspectRatio); setNearPlane(nearPlane); setFarPlane(farPlane); setProjectionType(PerspectiveProjection); blockNotifications(block); d->updateProjectionMatrix(); }
void CameraProperty::invokeEvent(Event* event) { if (auto resizeEvent = dynamic_cast<ResizeEvent*>(event)) { uvec2 canvasSize = resizeEvent->size(); // Do not set aspect ratio if canvas size is 0 in any dimension. if (canvasSize.x > 0 && canvasSize.y > 0) { const double width{static_cast<double>(canvasSize[0])}; const double height{static_cast<double>(canvasSize[1])}; setAspectRatio(static_cast<float>(width / height)); } } else { PropertyOwner::invokeEvent(event); } }
void QIrrlichtWidget::resizeEvent(QResizeEvent *event) { // qDebug() << "QIrrlichtWidget::resizeEvent"; if (m_IrrDevice == 0) { return; } int newWidth = event->size().width(); int newHeight = event->size().height(); m_IrrDevice->getVideoDriver()->OnResize(irr::core::dimension2d<irr::u32>(newWidth, newHeight)); setAspectRatio(); }
/* this function is regularly called, checks if video parameters changed and triggers appropriate actions */ void cVideo::VideoParamWatchdog(void) { static unsigned int _v_info = (unsigned int) -1; unsigned int v_info; if (fd == -1) return; ioctl(fd, MPEG_VID_GET_V_INFO_RAW, &v_info); if (_v_info != v_info) { lt_debug("%s params changed. old: %08x new: %08x\n", __FUNCTION__, _v_info, v_info); setAspectRatio(-1, -1); } _v_info = v_info; }
Camera::Camera() : frustumDirty_(true), viewDirty_(true), projectionDirty_(true), orthographic_(false), nearClip_(DEFAULT_NEARCLIP), farClip_(DEFAULT_FARCLIP), fov_(DEFAULT_CAMERA_FOV), orthoSize_(DEFAULT_ORTHOSIZE), aspectRatio_(1.0f), zoom_(1.0f), fillMode_(FILL_SOLID) { IntVector2 renderSize = Graphics::getInstance()->getViewport(); setAspectRatio((float) renderSize.x_ / renderSize.y_); }
void ccImage::setData(const QImage& image) { //previous image? if (!m_image.isNull()) unbindTexture(); m_image = image; m_width = m_image.width(); m_height = m_image.height(); setAspectRatio(m_height>0 ? (float)m_width/(float)m_height : 1.0f); //default behavior (this will be updated later, depending //on the OpenGL version of the bound QGLWidget) m_texU = 1.0; m_texV = 1.0; }
virtual void update(const Input& input, float delta) { setAspectRatio(input.getWindow().getWidth() / (float) input.getWindow().getHeight()); if (input.getKeyPressed(SDL_SCANCODE_W)) { getTransform().moveForward(delta * m_CAMERA_SPEED); } if (input.getKeyPressed(SDL_SCANCODE_A)) { getTransform().moveLeft(delta * m_CAMERA_SPEED); } if (input.getKeyPressed(SDL_SCANCODE_S)) { getTransform().moveForward(-1 * delta * m_CAMERA_SPEED); } if (input.getKeyPressed(SDL_SCANCODE_D)) { getTransform().moveLeft(-1 * delta * m_CAMERA_SPEED); } if (input.getKeyPressed(SDL_SCANCODE_SPACE)) { getTransform().moveUp(delta * m_CAMERA_SPEED); } if (input.getKeyPressed(SDL_SCANCODE_LCTRL)) { getTransform().moveUp(-1 * delta * m_CAMERA_SPEED); } if (input.getKeyPressedLast(SDL_SCANCODE_ESCAPE)) { m_mouseGrabbed = false; input.showCursor(true); } glm::vec2 windowCenter = glm::vec2(input.getWindow().getWidth() / 2.0f, input.getWindow().getHeight() / 2.0f); if (!m_mouseGrabbed && input.getMousePressedLast(SDL_BUTTON_LEFT)) { m_mouseGrabbed = true; input.showCursor(false); input.setCursorPosition(windowCenter); } else if (m_mouseGrabbed) { float dx = input.getMousePositionX() - windowCenter.x; float dy = input.getMousePositionY() - windowCenter.y; getTransform().turnLeft(dx * 0.01f); getTransform().turnUp(dy * 0.01f); input.setCursorPosition(windowCenter); } }
//---------------------------------------- void ofCamera::setupOffAxisViewPortal(const ofVec3f & topLeft, const ofVec3f & bottomLeft, const ofVec3f & bottomRight){ ofVec3f bottomEdge = bottomRight - bottomLeft; // plane x axis ofVec3f leftEdge = topLeft - bottomLeft; // plane y axis ofVec3f bottomEdgeNorm = bottomEdge.getNormalized(); ofVec3f leftEdgeNorm = leftEdge.getNormalized(); ofVec3f bottomLeftToCam = this->getPosition() - bottomLeft; ofVec3f cameraLookVector = leftEdgeNorm.getCrossed(bottomEdgeNorm); ofVec3f cameraUpVector = bottomEdgeNorm.getCrossed(cameraLookVector); lookAt(cameraLookVector + this->getPosition(), cameraUpVector); //lensoffset ofVec2f lensOffset; lensOffset.x = -bottomLeftToCam.dot(bottomEdgeNorm) * 2.0f / bottomEdge.length() + 1.0f; lensOffset.y = -bottomLeftToCam.dot(leftEdgeNorm) * 2.0f / leftEdge.length() + 1.0f; setLensOffset(lensOffset); setAspectRatio( bottomEdge.length() / leftEdge.length() ); float distanceAlongOpticalAxis = abs(bottomLeftToCam.dot(cameraLookVector)); setFov(2.0f * RAD_TO_DEG * atan( (leftEdge.length() / 2.0f) / distanceAlongOpticalAxis)); }
// Konstruktor // w*h = 1 // w/h = AR CameraController::CameraController(RenderSystem& renderSubSystem, float aspectRatio) : m_position (), m_zoom ( 1.0f ), m_rotation ( 0.0f ), m_minZoom ( FLT_MIN ), m_maxZoom ( FLT_MAX ), m_viewWidth ( 0.0f ), // will be set later m_viewHeight ( 0.0f ), // " m_refViewWidth ( 0.0f ), // " m_refViewHeight ( 0.0f ), // " m_renderSubSystem ( renderSubSystem ), m_isMovingSmoothly ( false ), m_cameraDeparture (), m_cameraDestination (), m_moveTimeElapsed ( 0.0f ), m_moveTotalTimeToArrive ( 0.0f ), m_isRotatingSmoothly ( false ), m_startingAngle ( 0.0f ), m_endingAngle ( 0.0f ), m_rotateTimeElapsed ( 0.0f ), m_rotateTotalTimeToArrive ( 0.0f ) { setAspectRatio(aspectRatio); }
void cVideo::Pig(int x, int y, int w, int h, int /*osd_w*/, int /*osd_h*/) { /* x = y = w = h = -1 -> reset / "hide" PIG */ if (x == -1 && y == -1 && w == -1 && h == -1) { setZoom(-1); setAspectRatio(-1, -1); return; } SCALEINFO s; memset(&s, 0, sizeof(s)); s.src.hori_size = 720; s.src.vert_size = 576; s.des.hori_off = x; s.des.vert_off = y; s.des.hori_size = w; s.des.vert_size = h; lt_debug("%s src: %d:%d:%d:%d dst: %d:%d:%d:%d", __FUNCTION__, s.src.hori_off,s.src.vert_off,s.src.hori_size,s.src.vert_size, s.des.hori_off,s.des.vert_off,s.des.hori_size,s.des.vert_size); fop(ioctl, MPEG_VID_SET_DISPMODE, VID_DISPMODE_SCALE); fop(ioctl, MPEG_VID_SCALE_ON); fop(ioctl, MPEG_VID_SET_SCALE_POS, &s); }
void setAspectRatio(const glm::vec2& size) { setAspectRatio(size.x / size.y); }
/** * Changes the aspect ratio of all samples to the ratio between the given width and height. * * @param[in] width The width to relate the given height to. * @param[in] height The height defining the aspect ratio relative to the width. */ static void setAspectRatio(int width, int height) { setAspectRatio(static_cast<double>(height) / static_cast<double>(width)); }
void RgbImageWindow::plotImage(Attributes *attr, SettingsDialog *settings) { HyperCube *cube = m_cube; QImage image(cube->GetLines(), cube->GetColumns(), QImage::Format_RGB32); setAspectRatio(); if (settings->getTypeOfMethod()!=2) { RgbProfile profile; if (settings->getTypeOfMethod()==0) profile.readStd((RgbProfile::CieProfiles)settings->getTypeOfStdProfile()); else if (settings->getTypeOfMethod()==1) profile.readFromFile(settings->getFileName()); switch (cube->GetFormatType()) { case type_int8: RgbProfilePlot<qint8>(cube,profile,image); break; case type_uint8: RgbProfilePlot<quint8>(cube,profile,image); break; case type_int16: RgbProfilePlot<qint16>(cube,profile,image); break; case type_uint16: RgbProfilePlot<quint16>(cube,profile,image); break; case type_int32: RgbProfilePlot<qint32>(cube,profile,image); break; case type_uint32: RgbProfilePlot<quint32>(cube,profile,image); break; case type_int64: RgbProfilePlot<qint64>(cube,profile,image); break; case type_uint64: RgbProfilePlot<quint64>(cube,profile,image); break; case type_float: RgbProfilePlot<float>(cube,profile,image); break; case type_double: RgbProfilePlot<double>(cube,profile,image); break; default: RgbProfilePlot<qint8>(cube,profile,image); break; } } else if (settings->getTypeOfMethod()==2) { switch (cube->GetFormatType()) { case type_int8: RgbChannelPlot<qint8>(cube,settings->getRCh(),settings->getGCh(),settings->getBCh(),image); break; case type_uint8: RgbChannelPlot<quint8>(cube,settings->getRCh(),settings->getGCh(),settings->getBCh(),image); break; case type_int16: RgbChannelPlot<qint16>(cube,settings->getRCh(),settings->getGCh(),settings->getBCh(),image); break; case type_uint16: RgbChannelPlot<quint16>(cube,settings->getRCh(),settings->getGCh(),settings->getBCh(),image); break; case type_int32: RgbChannelPlot<qint32>(cube,settings->getRCh(),settings->getGCh(),settings->getBCh(),image); break; case type_uint32: RgbChannelPlot<quint32>(cube,settings->getRCh(),settings->getGCh(),settings->getBCh(),image); break; case type_int64: RgbChannelPlot<qint64>(cube,settings->getRCh(),settings->getGCh(),settings->getBCh(),image); break; case type_uint64: RgbChannelPlot<quint64>(cube,settings->getRCh(),settings->getGCh(),settings->getBCh(),image); break; case type_float: RgbChannelPlot<float>(cube,settings->getRCh(),settings->getGCh(),settings->getBCh(),image); break; case type_double: RgbChannelPlot<double>(cube,settings->getRCh(),settings->getGCh(),settings->getBCh(),image); break; default: RgbChannelPlot<qint8>(cube,settings->getRCh(),settings->getGCh(),settings->getBCh(),image); break; } } else { return; } showAtCustomplot(image); // ui->centralwidget->adjustSize(); // this->adjustSize(); }
/*! Set the aspect ratio between the scale of the reference axis and the other scales. The default ratio is 1.0 \param ratio Aspect ratio \sa aspectRatio() */ void QwtPlotRescaler::setAspectRatio( double ratio ) { for ( int axis = 0; axis < QwtPlot::axisCnt; axis++ ) setAspectRatio( axis, ratio ); }
bool AkVCam::PluginInterface::createDevice(const std::string &deviceId, const std::wstring &description, const std::vector<VideoFormat> &formats) { AkLoggerLog("AkVCam::PluginInterface::createDevice"); StreamPtr stream; // Create one device. auto pluginRef = reinterpret_cast<CMIOHardwarePlugInRef>(this->d); auto device = std::make_shared<Device>(pluginRef); device->setDeviceId(deviceId); device->connectAddListener(this, &PluginInterface::addListener); device->connectRemoveListener(this, &PluginInterface::removeListener); this->m_devices.push_back(device); // Define device properties. device->properties().setProperty(kCMIOObjectPropertyName, description.c_str()); device->properties().setProperty(kCMIOObjectPropertyManufacturer, CMIO_PLUGIN_VENDOR); device->properties().setProperty(kCMIODevicePropertyModelUID, CMIO_PLUGIN_PRODUCT); device->properties().setProperty(kCMIODevicePropertyLinkedCoreAudioDeviceUID, ""); device->properties().setProperty(kCMIODevicePropertyLinkedAndSyncedCoreAudioDeviceUID, ""); device->properties().setProperty(kCMIODevicePropertySuspendedByUser, UInt32(0)); device->properties().setProperty(kCMIODevicePropertyHogMode, pid_t(-1), false); device->properties().setProperty(kCMIODevicePropertyDeviceMaster, pid_t(-1)); device->properties().setProperty(kCMIODevicePropertyExcludeNonDALAccess, UInt32(0)); device->properties().setProperty(kCMIODevicePropertyDeviceIsAlive, UInt32(1)); device->properties().setProperty(kCMIODevicePropertyDeviceUID, deviceId.c_str()); device->properties().setProperty(kCMIODevicePropertyTransportType, UInt32(kIOAudioDeviceTransportTypePCI)); device->properties().setProperty(kCMIODevicePropertyDeviceIsRunningSomewhere, UInt32(0)); if (device->createObject() != kCMIOHardwareNoError) goto createDevice_failed; stream = device->addStream(); // Register one stream for this device. if (!stream) goto createDevice_failed; stream->setFormats(formats); stream->properties().setProperty(kCMIOStreamPropertyDirection, UInt32(0)); if (device->registerStreams() != kCMIOHardwareNoError) { device->registerStreams(false); goto createDevice_failed; } // Register the device. if (device->registerObject() != kCMIOHardwareNoError) { device->registerObject(false); device->registerStreams(false); goto createDevice_failed; } device->setBroadcasting(this->d->m_ipcBridge.broadcaster(deviceId)); device->setMirror(this->d->m_ipcBridge.isHorizontalMirrored(deviceId), this->d->m_ipcBridge.isVerticalMirrored(deviceId)); device->setScaling(this->d->m_ipcBridge.scalingMode(deviceId)); device->setAspectRatio(this->d->m_ipcBridge.aspectRatioMode(deviceId)); device->setSwapRgb(this->d->m_ipcBridge.swapRgb(deviceId)); return true; createDevice_failed: this->m_devices.erase(std::prev(this->m_devices.end())); return false; }