예제 #1
0
    static TestCustomTableView* create(TableViewDataSource* dataSource, Size size)
    {
        auto table = new (std::nothrow) TestCustomTableView();
        table->initWithViewSize(size, nullptr);
        table->autorelease();
        table->setDataSource(dataSource);
        table->_updateCellPositions();
        table->_updateContentSize();

        return table;
    }
예제 #2
0
status_t MediaPlayer::setDataSource(int fd, int64_t offset, int64_t length)
{
    LOGV("setDataSource(%d, %lld, %lld)", fd, offset, length);
    status_t err = UNKNOWN_ERROR;
    const sp<IMediaPlayerService>& service(getMediaPlayerService());
    if (service != 0) {
        sp<IMediaPlayer> player(service->create(getpid(), this, fd, offset, length));
        err = setDataSource(player);
    }
    return err;
}
예제 #3
0
status_t MediaPlayer::setDataSource(const char *url)
{
    LOGV("setDataSource(%s)", url);
    status_t err = BAD_VALUE;
    if (url != NULL) {
        const sp<IMediaPlayerService>& service(getMediaPlayerService());
        if (service != 0) {
            sp<IMediaPlayer> player(service->create(getpid(), this, url));
            err = setDataSource(player);
        }
    }
    return err;
}
void DocumentLoader::attachToFrame()
{
    WebCore::DocumentLoader::attachToFrame();

    if (m_dataSource) {
        refDataSource();
        return;
    }

    // We may get to here without having a datasource, when the data
    // is coming from the page cache.
    GRefPtr<WebKitWebDataSource> dataSource(adoptGRef(kitNew(this)));
    setDataSource(dataSource.get());
}
예제 #5
0
 /**
  * Create a Property \b mirroring another PropertyBase.
  * It copies the name and description, and \b shallow copies
  * the value.
  * @see ready() to inspect if the creation succeeded.
  */
 Property( base::PropertyBase* source)
     : base::PropertyBase(source ? source->getName() : "", source ? source->getDescription() : "")
 {
     if ( source ) {
         base::DataSourceBase::shared_ptr dsb = source->getDataSource();
         if ( !setDataSource(dsb) ) {
              log(Error) << "Cannot initialize Property from " << source->getName() << ": ";
              if ( dsb ) {
                  log() << "incompatible type ( destination type: " << getType() << ", source type: " << dsb->getTypeName() << ")." << endlog();
              } else {
                  log() << "source Property was not ready." << endlog();
              }
         }
     }
 }
void DataMatrix::changeFile(DataSourcePtr in_file) {
  Q_ASSERT(myLockStatus() == KstRWLock::WRITELOCKED);

  if (!in_file) {
    Debug::self()->log(i18n("Data file for vector %1 was not opened.", Name()), Debug::Warning);
  }
  setDataSource(in_file);
  if (dataSource()) {
    dataSource()->writeLock();
  }
  reset();
  if (dataSource()) {
    dataSource()->unlock();
  }
}
void DataMatrix::commonConstructor(DataSourcePtr in_file, const QString &field,
                                   int reqXStart, int reqYStart, int reqNX, int reqNY,
                                   bool doAve, bool doSkip, int skip, double minX, double minY,
                                   double stepX, double stepY) {
  _reqXStart = reqXStart;
  _reqYStart = reqYStart;
  _reqNX = reqNX;
  _reqNY = reqNY;
  setDataSource(in_file);
  _field = field;
  _doAve = doAve;
  _doSkip = doSkip;
  _skip = skip;
  _minX = minX;
  _minY = minY;
  _stepX = stepX;
  _stepY = stepY;
  _invertXHint = false;
  _invertYHint = false;

  _saveable = true;
  _editable = true;

  if (!dataSource()) {
    Debug::self()->log(i18n("Data file for matrix %1 was not opened.", Name()), Debug::Warning);
  } else {
    const DataInfo info = dataSource()->matrix().dataInfo(_field);
    _samplesPerFrameCache = info.samplesPerFrame;
    _invertXHint = info.invertXHint;
    _invertYHint = info.invertYHint;
  }

  _aveReadBuffer = 0L;
  _aveReadBufferSize = 0;
  _lastXStart = 0;
  _lastYStart = 0;
  _lastNX = 1;
  _lastNY = 1;
  _lastDoAve = false;
  _lastDoSkip = false;;
  _lastSkip = 1;

  _resetFieldMetadata();

}
예제 #8
0
int _tmain(int argc, _TCHAR* argv[])
{
    int ret = -1;
    initFFmpegContext();

    int file_count = sizeof(strInputFileName) / sizeof(strInputFileName[0]);
    for (int i = 0; i < file_count; i++)
    {
        const char* pFileName = strInputFileName[i];
        ret = setDataSource(pFileName);

        getFrameAt(-1, THUMB_WIDTH, THUMB_HEIGHT);
    }

    //pause
    printf("finished, pause ....\n");
    getchar();

    return 0;
}
예제 #9
0
status_t MediaPlayerService::Client::setDataSource(const char *url)
{
    LOGV("setDataSource(%s)", url);
    if (url == NULL)
        return UNKNOWN_ERROR;

    if (strncmp(url, "content://", 10) == 0) {
        // get a filedescriptor for the content Uri and
        // pass it to the setDataSource(fd) method

        String16 url16(url);
        int fd = android::openContentProviderFile(url16);
        if (fd < 0)
        {
            LOGE("Couldn't open fd for %s", url);
            return UNKNOWN_ERROR;
        }
        setDataSource(fd, 0, 0x7fffffffffLL); // this sets mStatus
        close(fd);
        return mStatus;
    } else {
        player_type playerType = getPlayerType(url);
        LOGV("player type = %d", playerType);

        // create the right type of player
        sp<MediaPlayerBase> p = createPlayer(playerType);
        if (p == NULL) return NO_INIT;

        if (!p->hardwareOutput()) {
            mAudioOutput = new AudioOutput();
            static_cast<MediaPlayerInterface*>(p.get())->setAudioSink(mAudioOutput);
        }

        // now set data source
        LOGV(" setDataSource");
        mStatus = p->setDataSource(url);
        if (mStatus == NO_ERROR) mPlayer = p;
        return mStatus;
    }
}
예제 #10
0
void UiController::initEmptyModelGrad()
{
    int factors = 3, baseFactors = 2;
    _experimentTable = ExperimentTable::createExperimentTable(ReplicaGradient, factors, baseFactors, _interactionLevel);

    for(int i = 0; i < factors; i++)
    {
        _experimentTable->x().setXcenter(i, 0);
        _experimentTable->x().setXdelta(i, 0.5);
    }

    _view->updateInputs(*_experimentTable);

    std::vector<double> d, v;

    for(int i = 0; i < factors; i++)
    {
        d.push_back(1);
        v.push_back(0);
    }

    setDataSource(baseFactors, factors, v, d, QStringList() << "" << "" << "");
}
예제 #11
0
//====================================================
void Table::createAmpOverviews (Array<float, CriticalSection> csndInputData)
{
    //This method creates smaller amp overview arrays using the
    //original table data...
    tableData.amps.clear();
    tableData.y.clear();
    overview.maxAmps.clear();
    overview.minAmps.clear();

    tableData.amps = csndInputData;

    //Logger::writeToLog(String(tableData.amps.size()));
    zeroAmpPosition = convertAmpToPixel(0);

    // Filling overview arrays. The original table data is broken into
    //separate blocks. The max and min values are then stored from each block.
    //Block size is dependent on the max zoom level we use for overviews.
    float incr = (float)tableSize / (getWidth()*maxZoomForOverview);
    float maxBlockValue, minBlockValue;
    for (float i=0; i<tableSize; i+=incr)
    {
        maxBlockValue = minBlockValue = tableData.amps[(int)i+0.5];
        for (int j=0; j<(int)incr+0.5; j++)   //loop for current block
        {
            if (tableData.amps[(int)i+j+0.5] > maxBlockValue)
                maxBlockValue = tableData.amps[(int)i+j+0.5];
            if (tableData.amps[(int)i+j+0.5] < minBlockValue)
                minBlockValue = tableData.amps[(int)i+j+0.5];
        }
        overview.maxAmps.add (maxBlockValue);
        overview.minAmps.add (minBlockValue);
    }
    setDataSource (zoom);
    //if(drawOriginalTableData==false)
    //createEnvPath();
    //makeTableEditable();
}
예제 #12
0
bool QgsProjectBadLayerGuiHandler::findMissingFile( QString const & fileFilters, QDomNode & layerNode )
{
  // Prepend that file name to the valid file format filter list since it
  // makes it easier for the user to not only find the original file, but to
  // perhaps find a similar file.

  QFileInfo originalDataSource( dataSource( layerNode ) );

  QString memoryQualifier;    // to differentiate between last raster and
  // vector directories

  switch ( dataType( layerNode ) )
  {
    case IS_VECTOR:
    {
      memoryQualifier = "lastVectorFileFilter";

      break;
    }
    case IS_RASTER:
    {
      memoryQualifier = "lastRasterFileFilter";

      break;
    }
    default:
      QgsDebugMsg( "unable to determine data type" );
      return false;
  }

  // Prepend the original data source base name to make it easier to pick it
  // out from a list of other files; however the appropriate filter strings
  // for the file type will also be added in case the file name itself has
  // changed, too.

  QString myFileFilters = originalDataSource.fileName() + ";;" + fileFilters;

  QStringList selectedFiles;
  QString enc;
  QString title = QObject::tr( "Where is '%1' (original location: %2)?" )
                  .arg( originalDataSource.fileName(),
                        originalDataSource.absoluteFilePath() );

  bool retVal = QgisGui::openFilesRememberingFilter( memoryQualifier,
                myFileFilters,
                selectedFiles,
                enc,
                title,
                true );

  if ( selectedFiles.isEmpty() )
  {
    return retVal;
  }
  else
  {
    setDataSource( layerNode, selectedFiles.first() );
    if ( ! QgsProject::instance()->read( layerNode ) )
    {
      QgsDebugMsg( "unable to re-read layer" );
    }
  }
  return retVal;
} // findMissingFile
예제 #13
0
bool UiController::loadModel(const QString &fileName)
{
    if (fileName=="") return false;
    //_experimentTable->load(fileName.toAscii().data());

    QFile file(fileName);

    if(!file.open(QIODevice::ReadOnly))
        return false;
    QTextStream srcStream(&file);

    /* очень нужная штука для расшифровки кодировки*/
    QTextCodec *codec = QTextCodec::codecForName("Windows-1251");
    if (codec!= NULL)
    {
        srcStream.setCodec(codec);
    }
    else
    {
        assert(1);
    }

    int ModelType;
    srcStream >> ModelType;
    if (0 == ModelType)
    {
        _ModelType = EXTRSEARCH;
    }
    else
    {
        _ModelType = MATHMODEL;
    }
    _experimentTable = ExperimentTable::createExperimentTable(ReplicaGradient, 2, 1, 1, "", "grad");

    bool r = _experimentTable->load(fileName.toAscii().data());

    if(r)
    {
        size_t factors = _experimentTable->x().count();
        std::vector<double> d, v;

        for(size_t i = 0; i < factors; i++)
        {
            d.push_back(_experimentTable->x().xDelta((int)i) * 2);
            v.push_back(_experimentTable->x().xCenter((int)i));
        }

        QString displayFunction="";
        QString cornerMetric="";
        QStringList EvalFuncData;
        EvalFuncData.append(_experimentTable->getEvaluateFunction());
        if (EvalFuncData.count()>0)
        {
            displayFunction =_experimentTable->getEvaluateFunction().at(0);
            cornerMetric = _experimentTable->getEvaluateFunction().at(1);
        }
        setDataSource(_experimentTable->x().generalFactorCount(),
                      factors, v, d,
                      _experimentTable->x().factorsDescriptions(),
                      displayFunction,
                      cornerMetric
                     );
        _interactionLevel = _experimentTable->x().getInteractionLevel();

        if ("" != _experimentTable->getEvaluateFunction().at(0)) {
            //init _experimentTable from data source dataSrc
            int replicaDelim = pow(2., _dataSrc->inputsCount()) / pow(2., _dataSrc->actualInputsCount());


                QString displayFunction1 = _dataSrc->getEvaluateFunction().at(0);
                QString conerMeasure = _dataSrc->getEvaluateFunction().at(1);
                _experimentTable = ExperimentTable::createExperimentTable(ReplicaGradient, _dataSrc->inputsCount(), replicaDelim, _interactionLevel, displayFunction1, conerMeasure);

            assert(_dataSrc->inputsCount() == _experimentTable->x().count());
            assert(_dataSrc->actualInputsCount() == _experimentTable->x().generalFactorCount());
            assert(_experimentTable->rowCount() >= pow(2., _dataSrc->actualInputsCount()));

            _experimentTable->x().setFactorsDescriptions(_dataSrc->getDescriptions());

            for(int i = 0; i < _dataSrc->inputsCount(); i++)
            {
                _experimentTable->x().setXcenter(i, _dataSrc->centerFor(i));
                double min, max;
                _dataSrc->intervalFor(i, &min, &max);
                _experimentTable->x().setXdelta(i, max / 2.);
            }

                for(int i = 0; i < _experimentTable->rowCount(); i++)
                {
                    std::vector<int> coords;

                    for(int j = 0; j < _experimentTable->x().count(); j++)
                        coords.push_back((int)_experimentTable->x().norm_at(j, i));

                    std::vector<double> yy = _dataSrc->getYdata(coords); //request y data for coords.
                    std::vector<YInfo> info;

                    for(size_t j = 0; j < yy.size(); j++)
                    {
                        YInfo inf;
                        inf.IsTrusted = true;
                        inf.Value = yy[j];
                        info.push_back(inf);
                    }

                    _experimentTable->y().set_at(i, info); //add it to table
                }

            _view->updateInputs(*_experimentTable);
            if (_isFormulaModel)
                _view->updateYY(*_experimentTable);

            return true;
        } else {

            if (EvalFuncData.count()>0)
            {
                if (""!=EvalFuncData.at(0))
                {
                    for(int i = 0; i < _experimentTable->rowCount(); i++)
                    {
                        std::vector<int> coords;

                        for(int j = 0; j < _experimentTable->x().count(); j++)
                            coords.push_back((int)_experimentTable->x().norm_at(j, i));

                        std::vector<double> yy = _dataSrc->getYdata(coords); //request y data for coords.
                        std::vector<YInfo> info;

                        for(size_t j = 0; j < yy.size(); j++)
                        {
                            YInfo inf;
                            inf.IsTrusted = true;
                            inf.Value = yy[j];
                            info.push_back(inf);
                        }

                        _experimentTable->y().set_at(i, info); //add it to table
                    }
                }
            }
            _paral = _experimentTable->y().getParal();
            _interactionLevel = _experimentTable->x().getInteractionLevel();
            _modelHasData = true;
            _view->updateInputs(*_experimentTable);
            _view->updateBcoefs(*_experimentTable);
            _view->updateYY(*_experimentTable);
            //_view->updateGr(*_experimentTable);

        }

    }
    return r;
}
예제 #14
0
KexiDBImageBox::KexiDBImageBox(bool designMode, QWidget *parent)
        : KexiFrame(parent /* Qt 4 not neede: , Qt::WNoAutoErase*/)
        , KexiFormDataItemInterface()
        , m_alignment(Qt::AlignAuto | Qt::AlignTop)
//2.0 moved to FormWidgetInterface      , m_designMode(designMode)
        , m_readOnly(false)
        , m_scaledContents(false)
        , m_smoothTransformation(true)
        , m_keepAspectRatio(true)
        , m_insideSetData(false)
        , m_setFocusOnButtonAfterClosingPopup(false)
//        , m_lineWidthChanged(false)
        , m_paintEventEnabled(true)
        , m_dropDownButtonVisible(true)
        , m_insideSetPalette(false)
{
    setDesignMode(designMode);
    installEventFilter(this);
    setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
    QPalette pal(palette());
    pal.setBrush(backgroundRole(), QBrush(Qt::transparent));
    KexiFrame::setPalette(pal);

    //setup context menu
    m_contextMenu = new KexiImageContextMenu(this);
    m_contextMenu->installEventFilter(this);

    if (designMode) {
        m_chooser = 0;
    } else {
        m_chooser = new KexiDropDownButton(this);
        m_chooser->setFocusPolicy(Qt::StrongFocus);
        m_chooser->setMenu(m_contextMenu);
        setFocusProxy(m_chooser);
        m_chooser->installEventFilter(this);
//  m_chooser->setPalette(qApp->palette());
//  hlyr->addWidget(m_chooser);
    }

    setFrameShape(QFrame::Box);
    setFrameShadow(QFrame::Plain);
    setFrameColor(palette().color(QPalette::Foreground));

    m_paletteBackgroundColorChanged = false; //set this here, not before

    connect(m_contextMenu, SIGNAL(updateActionsAvailabilityRequested(bool&,bool&)),
            this, SLOT(slotUpdateActionsAvailabilityRequested(bool&,bool&)));
    connect(m_contextMenu, SIGNAL(insertFromFileRequested(KUrl)),
            this, SLOT(handleInsertFromFileAction(KUrl)));
    connect(m_contextMenu, SIGNAL(saveAsRequested(QString)),
            this, SLOT(handleSaveAsAction(QString)));
    connect(m_contextMenu, SIGNAL(cutRequested()),
            this, SLOT(handleCutAction()));
    connect(m_contextMenu, SIGNAL(copyRequested()),
            this, SLOT(handleCopyAction()));
    connect(m_contextMenu, SIGNAL(pasteRequested()),
            this, SLOT(handlePasteAction()));
    connect(m_contextMenu, SIGNAL(clearRequested()),
            this, SLOT(clear()));
    connect(m_contextMenu, SIGNAL(showPropertiesRequested()),
            this, SLOT(handleShowPropertiesAction()));

// connect(m_contextMenu, SIGNAL(aboutToHide()), this, SLOT(slotAboutToHidePopupMenu()));
// if (m_chooser) {
    //we couldn't use m_chooser->setPopup() because of drawing problems
//  connect(m_chooser, SIGNAL(pressed()), this, SLOT(slotChooserPressed()));
//  connect(m_chooser, SIGNAL(released()), this, SLOT(slotChooserReleased()));
//  connect(m_chooser, SIGNAL(toggled(bool)), this, SLOT(slotToggled(bool)));
// }

    KexiFrame::setLineWidth(0);
    setDataSource(QString());   //to initialize popup menu and actions availability
}
 status_t GstPlayer::setDataSource (const char *url,
     const KeyedVector < String8, String8 > *headers)
 {
   LOGI ("setDataSource('%s')", url);
   return setDataSource (url);
 }
예제 #16
0
//====================================================
void Table::applyZoom (int zoomInput)
{
    zoom = zoomInput;
    setDataSource(zoom);
    this->repaint();
}
예제 #17
0
/**
 *  This will rebuild the image from the data source.  It should be invoked
 *  when the scroll bar is moved, the plot area is resize or the color or
 *  intensity tables are changed.  It should not be called directly from
 *  other threads.
 */
void SpectrumDisplay::updateImage()
{
    if ( m_dataSource == 0 )
    {
        return;   // no image data to update
    }

    if ( dataSourceRangeChanged() )
    {
        setDataSource( m_dataSource );   // re-initialize with the altered source
    }

    QRect display_rect;
    getDisplayRectangle( display_rect );

    double scale_y_min = m_dataSource->getYMin();
    double scale_y_max = m_dataSource->getYMax();

    double scale_x_min  = m_totalXMin;
    double scale_x_max  = m_totalXMax;
    double x_step = (m_totalXMax - m_totalXMin)/2000;

    m_rangeHandler->getRange( scale_x_min, scale_x_max, x_step );

    int n_rows = (int)m_dataSource->getNRows();
    int n_cols = SVUtils::NumSteps( scale_x_min, scale_x_max, x_step );

    // This works for linear or log scales
    if ( n_rows == 0 || n_cols == 0 )
    {
        return;                          // can't draw empty image
    }

    if ( m_sliderHandler->vSliderOn() )
    {
        int y_min;
        int y_max;
        m_sliderHandler->getVSliderInterval( y_min, y_max );

        double new_y_min = 0;
        double new_y_max = 0;

        SVUtils::Interpolate( 0, n_rows, y_min,
                              scale_y_min, scale_y_max, new_y_min );
        SVUtils::Interpolate( 0, n_rows, y_max,
                              scale_y_min, scale_y_max, new_y_max );

        scale_y_min = new_y_min;
        scale_y_max = new_y_max;
    }

    if ( m_sliderHandler->hSliderOn() )
    {
        int x_min;
        int x_max;
        m_sliderHandler->getHSliderInterval( x_min, x_max );
        // NOTE: The interval [xmin,xmax] is always
        // found linearly.  For log_x, we need to adjust it

        double new_x_min = 0;
        double new_x_max = 0;

        if ( x_step > 0 )       // linear scale, so interpolate linearly
        {
            SVUtils::Interpolate( 0, n_cols, x_min,
                                  scale_x_min, scale_x_max, new_x_min );
            SVUtils::Interpolate( 0, n_cols, x_max,
                                  scale_x_min, scale_x_max, new_x_max );
        }
        else                    // log scale, so interpolate "logarithmically"
        {
            SVUtils::LogInterpolate( 0, n_cols, x_min,
                                     scale_x_min, scale_x_max, new_x_min );
            SVUtils::LogInterpolate( 0, n_cols, x_max,
                                     scale_x_min, scale_x_max, new_x_max );
        }

        scale_x_min = new_x_min;
        scale_x_max = new_x_max;
    }

    if ( n_rows > display_rect.height() )
    {
        n_rows = display_rect.height();
    }

    if ( n_cols > display_rect.width() )
    {
        n_cols = display_rect.width();
    }

    bool is_log_x = ( x_step < 0 );
    // NOTE: The DataArray is deleted
    m_dataArray = m_dataSource->getDataArray( scale_x_min, scale_x_max,
                  scale_y_min, scale_y_max,
                  n_rows, n_cols,
                  is_log_x );

    is_log_x = m_dataArray->isLogX();       // Data source might not be able to
    // provide log binned data, so check
    // if log binned data was returned.

    m_spectrumPlot->setAxisScale( QwtPlot::xBottom, m_dataArray->getXMin(),
                                  m_dataArray->getXMax() );

    if ( is_log_x )
    {
        QwtLog10ScaleEngine* log_engine = new QwtLog10ScaleEngine();
        m_spectrumPlot->setAxisScaleEngine( QwtPlot::xBottom, log_engine );
    }
    else
    {
        QwtLinearScaleEngine* linear_engine = new QwtLinearScaleEngine();
        m_spectrumPlot->setAxisScaleEngine( QwtPlot::xBottom, linear_engine );
    }

    m_spectrumPlot->setAxisScale( QwtPlot::yLeft, m_dataArray->getYMin(),
                                  m_dataArray->getYMax() );

    m_spectrumPlotItem->setData( m_dataArray,
                                 &m_positiveColorTable,
                                 &m_negativeColorTable );
    m_spectrumPlot->replot();

    setVGraph( m_pointedAtX );
    setHGraph( m_pointedAtY );
}
	CCControlBase::~CCControlBase()	{
		setBackGroundSprite(nullptr);
		setDataSource(nullptr);

		CC_SAFE_RELEASE_NULL(_valueKey);
	}
	bool PluginOptionsDialog::init()	{
		CCDictionary* dataSource(NetworkState::getInstanceDictionary(
			SL_SERIALIZEKEY_PLUGIN_GLOBAL_SETTINGS));

		// configure once
		Dictionary::setObjectIfNotExist(dataSource, 
			CCString::create("networklessons"),SL_SERIALIZEKEY_PEER_SESSION_PASSWORD);
		Dictionary::setObjectIfNotExist(dataSource, 
			CCDouble::create(50),SL_SERIALIZEKEY_PHYSICSFRAMERATE);

		setDataSource(dataSource);

		CCSize ctrlSize(CCSizeMake(0,0));

		CCArray* optionCtrls = CCArray::create();

		CCControlBase* ctrlContainer(nullptr);
		if(_pluginLayerContent != nullptr)	{
			if(_pluginLayerContent->getPluginHasNetwork())	{
				ctrlContainer = ControlUtils::createEditBox("Session password:"******"Physics framerate (hz):", ctrlSize);
				ctrlContainer->setValueKey(SL_SERIALIZEKEY_PHYSICSFRAMERATE);
				ctrlContainer->getCtrlLayoutFlags().addFlag(ECtrlLayoutFlag_ResetPreferredSizeOnSerialize);
				ctrlContainer->deserialize(dataSource);
				optionCtrls->addObject(ctrlContainer);
				// TODO: @student : check this code - this is an example how to track edit box changes
				_ctrlPhysicsFrameRate = dynamic_cast<CCControlEditBox*>(ctrlContainer);
			}
		}

		if(optionCtrls->count() == 0)	{
			ctrlContainer = ControlUtils::createValueBox("Option Info:", ctrlSize, "no plugin wide options available");
			optionCtrls->addObject(ctrlContainer);
		}

		CCControlColumn* ctrlOptionsContainer = ControlUtils::createControlColumn(optionCtrls,ctrlSize);
		ctrlOptionsContainer->getCtrlFlags().removeFlag(ECtrlFlag_UseScissorTest);

		CCArray* dialogCtrls = CCArray::create();
		dialogCtrls->addObject(ctrlOptionsContainer);
		dialogCtrls->addObject(createOkBtn());

		CCControlColumn* ctrlDialogContainer = ControlUtils::createControlColumn(dialogCtrls,ctrlSize);
		ctrlDialogContainer->getCtrlFlags().removeFlag(ECtrlFlag_UseScissorTest);

		CCSize dlgSize(ctrlDialogContainer->getContentSize());
		setPreferredSize(ctrlSize);

		// call the base class here we don't want all those background sprites
		bool initialized(CCControlBase::init());

		addChild(ctrlDialogContainer);
		setCtrlColumn(ctrlDialogContainer);

		// read the data from the datastore
		// we need to redo the layout as we have some edit controls 
		// inside this dialog
		// so force a new layout
		deserializeAll(getDataSource(), true);

		return initialized;
	}
예제 #20
0
LineGraph::LineGraph()
{
    setDataSource(&m_defaultDataSource);
}
status_t BnMediaMetadataRetriever::onTransact(
    uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags)
{
    switch (code) {
        case DISCONNECT: {
            CHECK_INTERFACE(IMediaMetadataRetriever, data, reply);
            disconnect();
            return NO_ERROR;
        } break;
        case SET_DATA_SOURCE_URL: {
            CHECK_INTERFACE(IMediaMetadataRetriever, data, reply);

            sp<IMediaHTTPService> httpService;
            if (data.readInt32()) {
                httpService =
                    interface_cast<IMediaHTTPService>(data.readStrongBinder());
            }

            const char* srcUrl = data.readCString();

            KeyedVector<String8, String8> headers;
            size_t numHeaders = (size_t) data.readInt64();
            for (size_t i = 0; i < numHeaders; ++i) {
                String8 key = data.readString8();
                String8 value = data.readString8();
                headers.add(key, value);
            }

            reply->writeInt32(
                    setDataSource(
                        httpService, srcUrl, numHeaders > 0 ? &headers : NULL));

            return NO_ERROR;
        } break;
        case SET_DATA_SOURCE_FD: {
            CHECK_INTERFACE(IMediaMetadataRetriever, data, reply);
            int fd = data.readFileDescriptor();
            int64_t offset = data.readInt64();
            int64_t length = data.readInt64();
            reply->writeInt32(setDataSource(fd, offset, length));
            return NO_ERROR;
        } break;
        case SET_DATA_SOURCE_CALLBACK: {
            CHECK_INTERFACE(IMediaMetadataRetriever, data, reply);
            sp<IDataSource> source =
                interface_cast<IDataSource>(data.readStrongBinder());
            reply->writeInt32(setDataSource(source));
            return NO_ERROR;
        } break;
        case GET_FRAME_AT_TIME: {
            CHECK_INTERFACE(IMediaMetadataRetriever, data, reply);
            int64_t timeUs = data.readInt64();
            int option = data.readInt32();
            ALOGV("getTimeAtTime: time(%" PRId64 " us) and option(%d)", timeUs, option);
#ifndef DISABLE_GROUP_SCHEDULE_HACK
            setSchedPolicy(data);
#endif
            sp<IMemory> bitmap = getFrameAtTime(timeUs, option);
            if (bitmap != 0) {  // Don't send NULL across the binder interface
                reply->writeInt32(NO_ERROR);
                reply->writeStrongBinder(IInterface::asBinder(bitmap));
            } else {
                reply->writeInt32(UNKNOWN_ERROR);
            }
#ifndef DISABLE_GROUP_SCHEDULE_HACK
            restoreSchedPolicy();
#endif
            return NO_ERROR;
        } break;
        case EXTRACT_ALBUM_ART: {
            CHECK_INTERFACE(IMediaMetadataRetriever, data, reply);
#ifndef DISABLE_GROUP_SCHEDULE_HACK
            setSchedPolicy(data);
#endif
            sp<IMemory> albumArt = extractAlbumArt();
            if (albumArt != 0) {  // Don't send NULL across the binder interface
                reply->writeInt32(NO_ERROR);
                reply->writeStrongBinder(IInterface::asBinder(albumArt));
            } else {
                reply->writeInt32(UNKNOWN_ERROR);
            }
#ifndef DISABLE_GROUP_SCHEDULE_HACK
            restoreSchedPolicy();
#endif
            return NO_ERROR;
        } break;
        case EXTRACT_METADATA: {
            CHECK_INTERFACE(IMediaMetadataRetriever, data, reply);
#ifndef DISABLE_GROUP_SCHEDULE_HACK
            setSchedPolicy(data);
#endif
            int keyCode = data.readInt32();
            const char* value = extractMetadata(keyCode);
            if (value != NULL) {  // Don't send NULL across the binder interface
                reply->writeInt32(NO_ERROR);
                reply->writeCString(value);
            } else {
                reply->writeInt32(UNKNOWN_ERROR);
            }
#ifndef DISABLE_GROUP_SCHEDULE_HACK
            restoreSchedPolicy();
#endif
            return NO_ERROR;
        } break;
        default:
            return BBinder::onTransact(code, data, reply, flags);
    }
}
예제 #22
0
void Table::applyZoom (int zoomInput)
{
	zoom = zoomInput;
	setDataSource(zoom);
}
status_t BnMediaPlayer::onTransact(
    uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags)
{
    switch(code) {
        case DISCONNECT: {
            CHECK_INTERFACE(IMediaPlayer, data, reply);
            disconnect();
            return NO_ERROR;
        } break;
        case SET_DATA_SOURCE_URL: {
            CHECK_INTERFACE(IMediaPlayer, data, reply);
            const char* url = data.readCString();
            KeyedVector<String8, String8> headers;
            int32_t numHeaders = data.readInt32();
            for (int i = 0; i < numHeaders; ++i) {
                String8 key = data.readString8();
                String8 value = data.readString8();
                headers.add(key, value);
            }
            reply->writeInt32(setDataSource(url, numHeaders > 0 ? &headers : NULL));
            return NO_ERROR;
        } break;
        case SET_DATA_SOURCE_FD: {
            CHECK_INTERFACE(IMediaPlayer, data, reply);
            int fd = data.readFileDescriptor();
            int64_t offset = data.readInt64();
            int64_t length = data.readInt64();
            reply->writeInt32(setDataSource(fd, offset, length));
            return NO_ERROR;
        }
        case SET_DATA_SOURCE_STREAM: {
            CHECK_INTERFACE(IMediaPlayer, data, reply);
            sp<IStreamSource> source =
                interface_cast<IStreamSource>(data.readStrongBinder());
            reply->writeInt32(setDataSource(source));
            return NO_ERROR;
        }
        case SET_VIDEO_SURFACETEXTURE: {
            CHECK_INTERFACE(IMediaPlayer, data, reply);
            sp<ISurfaceTexture> surfaceTexture =
                    interface_cast<ISurfaceTexture>(data.readStrongBinder());
            reply->writeInt32(setVideoSurfaceTexture(surfaceTexture));
            return NO_ERROR;
        } break;
        case PREPARE_ASYNC: {
            CHECK_INTERFACE(IMediaPlayer, data, reply);
            reply->writeInt32(prepareAsync());
            return NO_ERROR;
        } break;
        case START: {
            CHECK_INTERFACE(IMediaPlayer, data, reply);
            reply->writeInt32(start());
            return NO_ERROR;
        } break;
        case STOP: {
            CHECK_INTERFACE(IMediaPlayer, data, reply);
            reply->writeInt32(stop());
            return NO_ERROR;
        } break;
        case IS_PLAYING: {
            CHECK_INTERFACE(IMediaPlayer, data, reply);
            bool state;
            status_t ret = isPlaying(&state);
            reply->writeInt32(state);
            reply->writeInt32(ret);
            return NO_ERROR;
        } break;
        case PAUSE: {
            CHECK_INTERFACE(IMediaPlayer, data, reply);
            reply->writeInt32(pause());
            return NO_ERROR;
        } break;
        case SEEK_TO: {
            CHECK_INTERFACE(IMediaPlayer, data, reply);
            reply->writeInt32(seekTo(data.readInt32()));
            return NO_ERROR;
        } break;
        case GET_CURRENT_POSITION: {
            CHECK_INTERFACE(IMediaPlayer, data, reply);
            int msec;
            status_t ret = getCurrentPosition(&msec);
            reply->writeInt32(msec);
            reply->writeInt32(ret);
            return NO_ERROR;
        } break;
        case GET_DURATION: {
            CHECK_INTERFACE(IMediaPlayer, data, reply);
            int msec;
            status_t ret = getDuration(&msec);
            reply->writeInt32(msec);
            reply->writeInt32(ret);
            return NO_ERROR;
        } break;
        case RESET: {
            CHECK_INTERFACE(IMediaPlayer, data, reply);
            reply->writeInt32(reset());
            return NO_ERROR;
        } break;
        case SET_AUDIO_STREAM_TYPE: {
            CHECK_INTERFACE(IMediaPlayer, data, reply);
            reply->writeInt32(setAudioStreamType(data.readInt32()));
            return NO_ERROR;
        } break;
        case SET_LOOPING: {
            CHECK_INTERFACE(IMediaPlayer, data, reply);
            reply->writeInt32(setLooping(data.readInt32()));
            return NO_ERROR;
        } break;
        case SET_VOLUME: {
            CHECK_INTERFACE(IMediaPlayer, data, reply);
            float leftVolume = data.readFloat();
            float rightVolume = data.readFloat();
            reply->writeInt32(setVolume(leftVolume, rightVolume));
            return NO_ERROR;
        } break;
        case INVOKE: {
            CHECK_INTERFACE(IMediaPlayer, data, reply);
            status_t result = invoke(data, reply);
            return result;
        } break;
        case SET_METADATA_FILTER: {
            CHECK_INTERFACE(IMediaPlayer, data, reply);
            reply->writeInt32(setMetadataFilter(data));
            return NO_ERROR;
        } break;
        case GET_METADATA: {
            CHECK_INTERFACE(IMediaPlayer, data, reply);
            bool update_only = static_cast<bool>(data.readInt32());
            bool apply_filter = static_cast<bool>(data.readInt32());
            const status_t retcode = getMetadata(update_only, apply_filter, reply);
            reply->setDataPosition(0);
            reply->writeInt32(retcode);
            reply->setDataPosition(0);
            return NO_ERROR;
        } break;
        case SET_AUX_EFFECT_SEND_LEVEL: {
            CHECK_INTERFACE(IMediaPlayer, data, reply);
            reply->writeInt32(setAuxEffectSendLevel(data.readFloat()));
            return NO_ERROR;
        } break;
        case ATTACH_AUX_EFFECT: {
            CHECK_INTERFACE(IMediaPlayer, data, reply);
            reply->writeInt32(attachAuxEffect(data.readInt32()));
            return NO_ERROR;
        } break;
        case SET_PARAMETER: {
            CHECK_INTERFACE(IMediaPlayer, data, reply);
            int key = data.readInt32();

            Parcel request;
            if (data.dataAvail() > 0) {
                request.appendFrom(
                        const_cast<Parcel *>(&data), data.dataPosition(), data.dataAvail());
            }
            request.setDataPosition(0);
            reply->writeInt32(setParameter(key, request));
            return NO_ERROR;
        } break;
        case GET_PARAMETER: {
            CHECK_INTERFACE(IMediaPlayer, data, reply);
            return getParameter(data.readInt32(), reply);
        } break;
        default:
            return BBinder::onTransact(code, data, reply, flags);
    }
}
예제 #24
0
bool AudioThumbnail::setSource (InputSource* const newSource)
{
    clear();

    return newSource != nullptr && setDataSource (new LevelDataSource (*this, newSource));
}
예제 #25
0
void SecondaryRequest::setDataSource(Request *req) {
   if (req)
      setDataSource(req->getDataSource());
}