/** Set mode for a feature. * * @pre feature_set_ initialized for this camera * * @param finfo pointer to information for this feature * @param mode DC1394 mode desired * @return true if mode set successfully */ bool Features::setMode(dc1394feature_info_t *finfo, dc1394feature_mode_t mode) { dc1394feature_t feature = finfo->id; if (hasMode(finfo, mode)) { // first, make sure the feature is powered on setPower(finfo, DC1394_ON); ROS_DEBUG_STREAM("setting feature " << featureName(feature) << " mode to " << modeName(mode)); if (DC1394_SUCCESS != dc1394_feature_set_mode(camera_, feature, mode)) { ROS_WARN_STREAM("failed to set feature " << featureName(feature) << " mode to " << modeName(mode)); return false; } } else { // device does not support this mode for this feature ROS_DEBUG_STREAM("no " << modeName(mode) << " mode for feature " << featureName(feature)); return false; } return true; }
QMenu* Scene_item::contextMenu() { if(defaultContextMenu) { defaultContextMenu->setTitle(name()); return defaultContextMenu; } defaultContextMenu = new QMenu(name()); // defaultContextMenu->addAction(name()); // defaultContextMenu->addSeparator(); // QMenu* modeMenu = new QMenu(QObject::tr("Rendering mode"), // defaultContextMenu); for(unsigned int mode = 0; mode < NumberOfRenderingMode; ++mode) { if(!supportsRenderingMode(RenderingMode(mode))) continue; QString mName = modeName(RenderingMode(mode)); defaultContextMenu->addAction(tr("Set %1 mode") .arg(mName), this, slotName(RenderingMode(mode))); } // defaultContextMenu->addAction(modeMenu->menuAction()); return defaultContextMenu; }
uint KateAutoIndent::modeNumber (const QString &name) { for (int i = 0; i < modeCount(); ++i) if (modeName(i) == name) return i; return 0; }
QStringList KateAutoIndent::listIdentifiers () { QStringList l; for (int i = 0; i < modeCount(); ++i) l << modeName(i); return l; }
void LockManager::_dumpBucket(const LockBucket* bucket) const { StringBuilder sb; LockHeadMap::const_iterator it = bucket->data.begin(); while (it != bucket->data.end()) { const LockHead* lock = it->second; sb << "Lock @ " << lock << ": " << lock->resourceId.toString() << '\n'; sb << "GRANTED:\n"; for (const LockRequest* iter = lock->grantedQueueBegin; iter != NULL; iter = iter->next) { sb << '\t' << "LockRequest " << iter->locker->getId() << " @ " << iter->locker << ": " << "Mode = " << modeName(iter->mode) << "; " << "ConvertMode = " << modeName(iter->convertMode) << "; " << '\n'; } sb << '\n'; sb << "PENDING:\n"; for (const LockRequest* iter = lock->conflictQueueBegin; iter != NULL; iter = iter->next) { sb << '\t' << "LockRequest " << iter->locker->getId() << " @ " << iter->locker << ": " << "Mode = " << modeName(iter->mode) << "; " << "ConvertMode = " << modeName(iter->convertMode) << "; " << '\n'; } sb << '\n'; it++; } log() << sb.str(); }
void LockerImpl<IsForMMAPV1>::dump() const { StringBuilder ss; ss << "Locker id " << _id << " status: "; _lock.lock(); LockRequestsMap::ConstIterator it = _requests.begin(); while (!it.finished()) { ss << it.key().toString() << " " << lockRequestStatusName(it->status) << " in " << modeName(it->mode) << "; "; it.next(); } _lock.unlock(); log() << ss.str(); }
void UsbUiSettingModel::initializeModelData( int aModeId ) { myDebug() << ">>> UsbUiSettingModel::initializeModelData aModeId=" << aModeId; RUsb usbMan; if ( usbMan.Connect() == KErrNone ) { RArray<TInt> personalityIds; mPersonalityIds.clear(); if ( usbMan.GetPersonalityIds( personalityIds ) == KErrNone ) { for ( int i = 0; i < personalityIds.Count(); i++ ) { myDebug() << ">>> UsbUiSettingModel::initializeModelData personality ID =" << personalityIds[i]; if ( !isPersonalityHidden(usbMan, personalityIds[i]) ) { mPersonalityIds.append( personalityIds[i] ); QString friendlyName = getFriendlyName(usbMan, personalityIds[i]); QStringList displayList; //text-1 mode name displayList.append( modeName( friendlyName ) ); //text-2 description QString textId = TextIdPrefix + friendlyName + DescriptionIdPostfix; displayList.append( hbTrId(textId.toAscii()) ); QMap< int, QVariant > dataRow; dataRow[ Qt::DisplayRole ] = QVariant( displayList ); //icon-1 QString iconName = ModeIconNamePrefix + friendlyName; HbIcon icon(iconName); QList<QVariant> icons; icons << icon; dataRow[ Qt::DecorationRole ] = QVariant( icons ); mSettingsList << dataRow; } } } personalityIds.Close(); usbMan.Close(); } myDebug() << "<<< UsbUiSettingModel::initializeModelData"; }
// Rendering mode as a human readable string QString Scene_item::renderingModeName() const { return modeName(renderingMode()); }
void reset() { SDL_WM_SetCaption("Game Of Life | Joseph Dykstra", NULL); SDL_Event tEvent; int tSelection=-1, tX, tY, tClickSelection; printf("hi2.0\n"); while (tSelection==-1) { for (int j=0; j<NO_COLS; j++) { tX=SIZE+((BTN_WIDTH+SIZE)*j); for (int i=0; i<noBtns[j]; i++) { EZ_apply_rect(screen, EZ_new_rect(tX, BTN_Y(i,noBtns[j]), BTN_WIDTH, BTN_HEIGHT(noBtns[j])), modeColor[j][i]); EZ_apply_text(screen,modeName(i),font, EZ_new_rect(tX+SIZE,BTN_Y(i,noBtns[j])+(SIZE/2),0,0), EZ_Uint32_to_SDL(0x000000)); } //speedName(i), sizeName(i) } SDL_Flip(screen); while(SDL_PollEvent(&tEvent)) { if (tEvent.type==SDL_MOUSEBUTTONDOWN) { if (tEvent.button.x>BTN_X && tEvent.button.x<BTN_WIDTH+BTN_X) { for (int i=0; i<=noBtns[0]; i++) { if ( tEvent.button.y > BTN_Y(i,noBtns[0]) && tEvent.button.y < BTN_Y(i,noBtns[0])+BTN_HEIGHT(noBtns[0]) ) // tClickSelection=i; } } } if (tEvent.type==SDL_MOUSEBUTTONUP) { if (tEvent.button.x>BTN_X && tEvent.button.x<BTN_WIDTH+BTN_X) { for (int i=0; i<=noBtns[0]; i++) { if ( tEvent.button.y > BTN_Y(i,noBtns[0]) && tEvent.button.y < BTN_Y(i,noBtns[0])+BTN_HEIGHT(noBtns[0]) ) // { if (tClickSelection==i) tSelection=i; } } } } if (tEvent.type==SDL_QUIT) exit(0); } } printf("hi4\n"); make(tSelection); printf("hi5\n"); }
// Rendering mode as a human readable string QString CGAL::Three::Scene_item::renderingModeName() const { return modeName(renderingMode()); }
// Prepare video output int OutputGraphic (IDeckLinkDisplayMode* deckLinkDisplayMode) { IDeckLinkMutableVideoFrame* m_videoFrameGdi = NULL; if (deckLinkDisplayMode != NULL) { BSTR modeNameBSTR; if (deckLinkDisplayMode->GetName(&modeNameBSTR) == S_OK) { unsigned long m_frameWidth = 0; unsigned long m_frameHeight = 0; _bstr_t modeName(modeNameBSTR); m_frameWidth = deckLinkDisplayMode->GetWidth(); m_frameHeight = deckLinkDisplayMode->GetHeight(); printf("Using video mode: %s, width: %lu, height: %lu\n", (char*)modeName, m_frameWidth, m_frameHeight); // Use the first supported video mode if (deckLinkOutput->EnableVideoOutput(deckLinkDisplayMode->GetDisplayMode(), bmdVideoOutputFlagDefault) != S_OK) { fprintf(stderr, "Could not enable Video output\n"); } else { // Generate a key frame if (deckLinkOutput->CreateVideoFrame(m_frameWidth, m_frameHeight, m_frameWidth*4, bmdFormat8BitARGB, bmdFrameFlagFlipVertical, &m_videoFrameGdi) != S_OK) { fprintf(stderr, "Could not obtain the IDeckLinkOutput CreateVideoFrame interface\n"); } else { IDeckLinkKeyer* deckLinkKeyer = NULL; GdiDraw (m_videoFrameGdi); if (deckLink->QueryInterface(IID_IDeckLinkKeyer, (void**)&deckLinkKeyer) != S_OK) { fprintf(stderr, "Could not obtain the IDeckLinkOutput interface\n"); } else { int keyLevel = 0; deckLinkKeyer->Enable(false); // Enable internal keying for (int keyStep = 0; keyStep < 5; keyStep++) // Key in steps { deckLinkKeyer->SetLevel(keyLevel); // Set a keying level printf("Current key level: %d\n", keyLevel); deckLinkOutput->DisplayVideoFrameSync(m_videoFrameGdi); Sleep(3000); keyLevel += 60; } deckLinkKeyer->SetLevel(0); printf("Ramp up keying\n"); deckLinkKeyer->RampUp(100); Sleep(5000); printf("Ramp down keying\n"); deckLinkKeyer->RampDown(100); Sleep(5000); deckLinkKeyer->Disable(); deckLinkKeyer->Release(); } m_videoFrameGdi->Release(); } deckLinkOutput->DisableVideoOutput(); } } } return 0; }
int _tmain(int argc, _TCHAR* argv[]) { int numDevices = 0; HRESULT result; IDeckLinkAttributes *deckLinkAttributes = NULL; HRESULT attributeResult; BOOL keyingSupported; BOOL HDkeyingSupported; int selectedMode = 0; printf("GDI Keyer Sample Application\n\n"); // Initialize COM on this thread result = CoInitialize(NULL); if (FAILED(result)) { fprintf(stderr, "Initialization of COM failed - result = %08x.\n", result); return 1; } // Create an IDeckLinkIterator object to enumerate all DeckLink cards in the system result = CoCreateInstance(CLSID_CDeckLinkIterator, NULL, CLSCTX_ALL, IID_IDeckLinkIterator, (void**)&deckLinkIterator); if (FAILED(result)) { fprintf(stderr, "A DeckLink iterator could not be created. The DeckLink drivers may not be installed.\n"); return 1; } // Enumerate all cards in this system while (deckLinkIterator->Next(&deckLink) == S_OK) { BSTR deviceNameBSTR = NULL; // Increment the total number of DeckLink cards found numDevices++; if (numDevices > 1) printf("\n\n"); // *** Print the model name of the DeckLink card result = deckLink->GetModelName(&deviceNameBSTR); if (result == S_OK) { _bstr_t deviceName(deviceNameBSTR); printf("Found Blackmagic device: %s\n", (char*)deviceName); attributeResult = deckLink->QueryInterface(IID_IDeckLinkAttributes, (void**)&deckLinkAttributes); if (attributeResult != S_OK) { fprintf(stderr, "Could not obtain the IDeckLinkAttributes interface"); return 1; } else { attributeResult = deckLinkAttributes->GetFlag(BMDDeckLinkSupportsInternalKeying, &keyingSupported); // is keying supported on this device? if (attributeResult == S_OK && keyingSupported) { IDeckLinkDisplayModeIterator* displayModeIterator = NULL; IDeckLinkDisplayMode* deckLinkDisplayMode = NULL; attributeResult = deckLinkAttributes->GetFlag(BMDDeckLinkSupportsHDKeying, &HDkeyingSupported); if (attributeResult == S_OK && HDkeyingSupported) printf("HD Mode keying supported.\n"); else printf("SD Mode Keying supported.\n"); // check if automode detection support - if so, use it for autodetection if (CheckFormatDetect(deckLinkAttributes) == 0) { fprintf(stderr, "Input mode detection not supported\n"); if (deckLink->QueryInterface(IID_IDeckLinkOutput, (void**)&deckLinkOutput) != S_OK) { fprintf(stderr, "Could not obtain the IDeckLinkOutput interface\n"); } else { int index = 0; if (deckLinkOutput->GetDisplayModeIterator(&displayModeIterator) != S_OK) { fprintf(stderr, "Could not obtain the display mode iterator\n"); } else { printf("\n"); while (displayModeIterator->Next(&deckLinkDisplayMode) == S_OK) { BSTR displayModeBSTR = NULL; int modeWidth; int modeHeight; BMDTimeValue frameRateDuration; BMDTimeScale frameRateScale; // Obtain the display mode's properties modeWidth = deckLinkDisplayMode->GetWidth(); modeHeight = deckLinkDisplayMode->GetHeight(); deckLinkDisplayMode->GetFrameRate(&frameRateDuration, &frameRateScale); if ((deckLinkDisplayMode->GetWidth() > 720) && !HDkeyingSupported) continue; if (deckLinkDisplayMode->GetName(&displayModeBSTR) == S_OK) { _bstr_t modeName(displayModeBSTR, false); // Skip HD modes on cards such as DeckLink SDI (only PAL/NTSC are supported for keying) printf("%d %-20s \t %d x %d \t %g FPS\n", index, (char*)modeName, modeWidth, modeHeight, (double)frameRateScale / (double)frameRateDuration); } deckLinkDisplayMode->Release(); index++; } displayModeIterator->Release(); printf("Select Mode (0-%d):\n", index-1); scanf_s("%d", &selectedMode); printf("Mode selected: %d\n", selectedMode); if(selectedMode < index) { int modeCount = 0; if (deckLinkOutput->GetDisplayModeIterator(&displayModeIterator) != S_OK) { fprintf(stderr, "Could not obtain the display mode iterator\n"); } else { while(displayModeIterator->Next(&deckLinkDisplayMode) == S_OK) { if (selectedMode == modeCount) { OutputGraphic(deckLinkDisplayMode); deckLinkDisplayMode->Release(); break; } deckLinkDisplayMode->Release(); modeCount++; } displayModeIterator->Release(); } } else { printf("Illegal video mode selected\n"); } } deckLinkOutput->Release(); } } } deckLinkAttributes->Release(); printf("Press Enter key to exit.\n"); _getch(); } } deckLink->Release(); // Release the IDeckLink instance when we've finished with it to prevent leaks } if (deckLinkIterator != NULL) deckLinkIterator->Release(); // If no DeckLink cards were found in the system, inform the users if (numDevices == 0) printf("No Blackmagic Design devices were found.\n"); // Uninitalize COM on this thread CoUninitialize(); return 0; }