Ejemplo n.º 1
0
void PhMediaPanel::setClock(PhClock *clock)
{
	_clock = clock;
	if(_clock) {
		setTCType(_clock->timeCodeType());
		ui->_timecodeLabel->setText(PhTimeCode::stringFromFrame(_clock->frame(), _clock->timeCodeType()));
		connect(_clock, SIGNAL(frameChanged(PhFrame, PhTimeCodeType)), this, SLOT(onFrameChanged(PhFrame, PhTimeCodeType)));
		connect(_clock, SIGNAL(rateChanged(PhRate)), this, SLOT(onRateChanged(PhRate)));
		connect(_clock, SIGNAL(tcTypeChanged(PhTimeCodeType)), this, SLOT(onTimeCodeTypeChanged(PhTimeCodeType)));
	}
}
Ejemplo n.º 2
0
void InputManager::UpdateRate()
{
    /* Update Rate */
    float f_new_rate = var_GetFloat( p_input, "rate" );
    if( f_new_rate != f_rate )
    {
        f_rate = f_new_rate;
        /* Update rate */
        emit rateChanged( f_rate );
    }
}
Ejemplo n.º 3
0
/* Define the Input used.
   Add the callbacks on input
   p_input is held once here */
void InputManager::setInput( input_thread_t *_p_input )
{
    delInput();
    p_input = _p_input;
    if( p_input != NULL )
    {
        msg_Dbg( p_intf, "IM: Setting an input" );
        vlc_object_hold( p_input );
        addCallbacks();

        UpdateStatus();
        UpdateName();
        UpdateArt();
        UpdateTeletext();
        UpdateNavigation();
        UpdateVout();

        p_item = input_GetItem( p_input );
        emit rateChanged( var_GetFloat( p_input, "rate" ) );

        /* Get Saved Time */
        if( p_item->i_type == ITEM_TYPE_FILE )
        {
            int i_time = RecentsMRL::getInstance( p_intf )->time( p_item->psz_uri );
            if( i_time > 0 &&
                    !var_GetFloat( p_input, "run-time" ) &&
                    !var_GetFloat( p_input, "start-time" ) &&
                    !var_GetFloat( p_input, "stop-time" ) )
            {
                emit resumePlayback( (int64_t)i_time * 1000 );
            }
        }
    }
    else
    {
        p_item = NULL;
        assert( !p_input_vbi );
        emit rateChanged( var_InheritFloat( p_intf, "rate" ) );
    }
}
/* delete Input if it ever existed.
   Delete the callbacls on input
   p_input is released once here */
void InputManager::delInput()
{
    if( !p_input ) return;
    msg_Dbg( p_intf, "IM: Deleting the input" );

    delCallbacks();
    i_old_playing_status = END_S;
    p_item               = NULL;
    oldName              = "";
    artUrl               = "";
    b_video              = false;
    timeA                = 0;
    timeB                = 0;
    f_rate               = 0. ;

    if( p_input_vbi )
    {
        vlc_object_release( p_input_vbi );
        p_input_vbi = NULL;
    }

    vlc_object_release( p_input );
    p_input = NULL;

    emit positionUpdated( -1.0, 0 ,0 );
    emit rateChanged( var_InheritFloat( p_intf, "rate" ) );
    emit nameChanged( "" );
    emit chapterChanged( 0 );
    emit titleChanged( 0 );
    emit playingStatusChanged( END_S );

    emit teletextPossible( false );
    emit AtoBchanged( false, false );
    emit voutChanged( false );
    emit voutListChanged( NULL, 0 );

    /* Reset all InfoPanels but stats */
    emit artChanged( NULL );
    emit artChanged( "" );
    emit infoChanged( NULL );
    emit currentMetaChanged( (input_item_t *)NULL );

    emit encryptionChanged( false );
    emit recordingStateChanged( false );

    emit cachingChanged( 1 );
}
GraphicStripSyncTestWindow::GraphicStripSyncTestWindow(GraphicStripSyncTestSettings *settings) :
	PhDocumentWindow(settings),
	ui(new Ui::GraphicStripSyncTestWindow),
	_settings(settings),
	_sonySlave(PhTimeCodeType25, _settings)
{
	ui->setupUi(this);
	_strip = ui->stripView->strip();
	_strip->setSettings(_settings);
	_doc = _strip->doc();
	_clock = _strip->clock();
	_clockSynchroniser.setStripClock(_clock);

	connect(ui->actionOpen, SIGNAL(triggered()), this, SLOT(onOpenFile()));

	connect(_clock, SIGNAL(frameChanged(PhFrame, PhTimeCodeType)), this, SLOT(onFrameChanged(PhFrame, PhTimeCodeType)));
	connect(_clock, SIGNAL(rateChanged(PhRate)), this, SLOT(onRateChanged(PhRate)));

	if(_sonySlave.open()) {
		_clock = _sonySlave.clock();
		_clockSynchroniser.setSonyClock(_clock);
		connect(ui->stripView, SIGNAL(beforePaint(int)), &_sonySlave, SLOT(checkVideoSync(int)));
	}
void MediaPlayerPrivateAVFoundation::dispatchNotification()
{
    ASSERT(isMainThread());

    Notification notification = Notification();
    {
        MutexLocker lock(m_queueMutex);
        
        if (m_queuedNotifications.isEmpty())
            return;
        
        if (!m_delayCallbacks) {
            // Only dispatch one notification callback per invocation because they can cause recursion.
            notification = m_queuedNotifications.first();
            m_queuedNotifications.remove(0);
        }
        
        if (!m_queuedNotifications.isEmpty() && !m_mainThreadCallPending)
            callOnMainThread(mainThreadCallback, this);

        if (!notification.isValid())
            return;
    }

    if (notification.type() != Notification::FunctionType)
        LOG(Media, "MediaPlayerPrivateAVFoundation::dispatchNotification(%p) - dispatching %s", this, notificationName(notification));

    switch (notification.type()) {
    case Notification::ItemDidPlayToEndTime:
        didEnd();
        break;
    case Notification::ItemTracksChanged:
        tracksChanged();
        updateStates();
        break;
    case Notification::ItemStatusChanged:
        updateStates();
        break;
    case Notification::ItemSeekableTimeRangesChanged:
        seekableTimeRangesChanged();
        updateStates();
        break;
    case Notification::ItemLoadedTimeRangesChanged:
        loadedTimeRangesChanged();
        updateStates();
        break;
    case Notification::ItemPresentationSizeChanged:
        sizeChanged();
        updateStates();
        break;
    case Notification::ItemIsPlaybackLikelyToKeepUpChanged:
        updateStates();
        break;
    case Notification::ItemIsPlaybackBufferEmptyChanged:
        updateStates();
        break;
    case Notification::ItemIsPlaybackBufferFullChanged:
        updateStates();
        break;
    case Notification::PlayerRateChanged:
        updateStates();
        rateChanged();
        break;
    case Notification::PlayerTimeChanged:
        timeChanged(notification.time());
        break;
    case Notification::SeekCompleted:
        seekCompleted(notification.finished());
        break;
    case Notification::AssetMetadataLoaded:
        metadataLoaded();
        updateStates();
        break;
    case Notification::AssetPlayabilityKnown:
        updateStates();
        playabilityKnown();
        break;
    case Notification::DurationChanged:
        invalidateCachedDuration();
        break;
    case Notification::ContentsNeedsDisplay:
        contentsNeedsDisplay();
        break;
    case Notification::InbandTracksNeedConfiguration:
        m_inbandTrackConfigurationPending = false;
        configureInbandTracks();
        break;
    case Notification::FunctionType:
        notification.function()();
        break;
    case Notification::TargetIsWirelessChanged:
#if ENABLE(WIRELESS_PLAYBACK_TARGET)
        playbackTargetIsWirelessChanged();
#endif
        break;

    case Notification::None:
        ASSERT_NOT_REACHED();
        break;
    }
}
void MediaPlayerPrivateAVFoundation::dispatchNotification()
{
    ASSERT(isMainThread());

    Notification notification = Notification();
    {
        MutexLocker lock(m_queueMutex);
        
        if (m_queuedNotifications.isEmpty())
            return;
        
        if (!m_delayCallbacks) {
            // Only dispatch one notification callback per invocation because they can cause recursion.
            notification = m_queuedNotifications.first();
            m_queuedNotifications.remove(0);
        }
        
        if (!m_queuedNotifications.isEmpty() && !m_mainThreadCallPending)
            callOnMainThread(mainThreadCallback, this);
        
        if (!notification.isValid())
            return;
    }

    LOG(Media, "MediaPlayerPrivateAVFoundation::dispatchNotification(%p) - dispatching %d", this, static_cast<int>(notification.type()));

    switch (notification.type()) {
    case Notification::ItemDidPlayToEndTime:
        didEnd();
        break;
    case Notification::ItemTracksChanged:
        tracksChanged();
        updateStates();
        break;
    case Notification::ItemStatusChanged:
        updateStates();
        break;
    case Notification::ItemSeekableTimeRangesChanged:
        seekableTimeRangesChanged();
        updateStates();
        break;
    case Notification::ItemLoadedTimeRangesChanged:
        loadedTimeRangesChanged();
        updateStates();
        break;
    case Notification::ItemPresentationSizeChanged:
        sizeChanged();
        updateStates();
        break;
    case Notification::ItemIsPlaybackLikelyToKeepUpChanged:
        updateStates();
        break;
    case Notification::ItemIsPlaybackBufferEmptyChanged:
        updateStates();
        break;
    case Notification::ItemIsPlaybackBufferFullChanged:
        updateStates();
        break;
    case Notification::PlayerRateChanged:
        updateStates();
        rateChanged();
        break;
    case Notification::PlayerTimeChanged:
        timeChanged(notification.time());
        break;
    case Notification::SeekCompleted:
        seekCompleted(notification.finished());
        break;
    case Notification::AssetMetadataLoaded:
        metadataLoaded();
        updateStates();
        break;
    case Notification::AssetPlayabilityKnown:
        updateStates();
        playabilityKnown();
        break;
    case Notification::DurationChanged:
        invalidateCachedDuration();
        break;

    case Notification::None:
        ASSERT_NOT_REACHED();
        break;
    }
}
Ejemplo n.º 8
0
void QVFbRateDialog::cancel()
{
    rateChanged(oldRate);
    reject();
}
Ejemplo n.º 9
0
/* delete Input if it ever existed.
   Delete the callbacls on input
   p_input is released once here */
void InputManager::delInput()
{
    if( !p_input ) return;
    msg_Dbg( p_intf, "IM: Deleting the input" );

    /* Save time / position */
    char *uri = input_item_GetURI( p_item );
    if( uri != NULL ) {
        float f_pos = var_GetFloat( p_input , "position" );
        int64_t i_time = -1;

        if( f_pos >= 0.05f && f_pos <= 0.95f
         && var_GetInteger( p_input, "length" ) >= 60 * CLOCK_FREQ )
            i_time = var_GetInteger( p_input, "time");

        RecentsMRL::getInstance( p_intf )->setTime( qfu(uri), i_time );
        free(uri);
    }

    delCallbacks();
    i_old_playing_status = END_S;
    p_item               = NULL;
    oldName              = "";
    artUrl               = "";
    b_video              = false;
    timeA                = 0;
    timeB                = 0;
    f_rate               = 0. ;

    if( p_input_vbi )
    {
        vlc_object_release( p_input_vbi );
        p_input_vbi = NULL;
    }

    vlc_object_release( p_input );
    p_input = NULL;

    emit positionUpdated( -1.0, 0 ,0 );
    emit rateChanged( var_InheritFloat( p_intf, "rate" ) );
    emit nameChanged( "" );
    emit chapterChanged( 0 );
    emit titleChanged( 0 );
    emit playingStatusChanged( END_S );

    emit teletextPossible( false );
    emit AtoBchanged( false, false );
    emit voutChanged( false );
    emit voutListChanged( NULL, 0 );

    /* Reset all InfoPanels but stats */
    emit artChanged( NULL );
    emit artChanged( "" );
    emit infoChanged( NULL );
    emit currentMetaChanged( (input_item_t *)NULL );

    emit encryptionChanged( false );
    emit recordingStateChanged( false );

    emit cachingChanged( 0.0 );
}
Ejemplo n.º 10
0
MonoChainDemo::MonoChainDemo(QWidget *parent) :
    DemoWidget(parent)
{
    ui->labelMass->hide();
    ui->labelMassValue->hide();
    ui->horizontalSlider->hide();
    ui->pushButtonMax->move(ui->dispCurve->x()+10,ui->dispCurve->y()+50);
    ui->labelOmega->move(ui->labelOmega->x()-3,ui->labelOmega->y()-1);
    ui->labelKValue->move(ui->dispCurve->x()+ui->dispCurve->width()/2+195,ui->dispCurve->y()+ui->dispCurve->height()-26);
    ui->labelW0->setPixmap(QPixmap(":/images/omega1.png"));
    ui->labelHuyeybl->hide();
    ui->labelHuyeybl_2->hide();
    ui->labelAcMaxFormula->hide();
    ui->labelOptMaxFormula->hide();
    ui->labelOptMinFormula->hide();
    QObject::connect(ui->pushButtonMax,  SIGNAL(clicked()), this, SLOT(rateChanged()));
    QObject::connect(ui->verticalSlider, SIGNAL(valueChanged(int)), this, SLOT(rateChanged()));
    QObject::connect(ui->verticalSlider, SIGNAL(sliderMoved(int)), this, SLOT(rateChanged()));
    QObject::connect(ui->verticalSlider, SIGNAL(sliderMoved(int)), this, SLOT(on_verticalSlider_sliderMoved(int)));
    //create chain
    chainSettings setting(18, 1500, currRate, 1650/10*17, 16);
    myChain = new Monochain(setting, *springGradient, *massGradient);
    backgroundChain = new Monochain(setting, *backgroundSpringGradient, *backgroundMassGradient);

    scene->addItem(backgroundChain->drawAt(0,0));
    backgroundChain->pause(true);
    scene->addItem(myChain->drawAt(0,0));
    pause();
    connect(myChain->getTimer(), SIGNAL(timeout()), this, SLOT(time_slot()));

    ui->dispCurve->xAxis->setRange(0,M_PI);
    ui->dispCurve->yAxis->setRange(0,1.1);
    ui->dispCurve->yAxis->setAutoTickStep(0);
    ui->dispCurve->yAxis->setTickStep(1.0);
    for (int i = 0; i < 101; ++i)
    {
        k1[i] = i*M_PI/100;
        omega1[i] = sin(k1[i]/2);
        if (absF(omega1[i] - currRate/(2*sqrt(myChain->getCoefficient()/(*myChain)[0]->getMass()))) <= 0.5*ui->dispCurve->yAxis->range().upper/100)
        {
            kDot[0] = k1[i];
            omegaDot[0] = omega1[i];
        }
    }
    qDebug() << k1[100] << "k1";
    //draw plot
    ui->dispCurve->graph(0)->setData(k1,omega1);
    QPen graphPen(blueDotPen);
    graphPen.setWidthF(2.0);
    graphPen.setColor(QColor(Qt::red));
    ui->dispCurve->graph(0)->setPen(graphPen);
    ui->dispCurve->addGraph();
    ui->dispCurve->graph(1)->setLineStyle(QCPGraph::lsNone);
    ui->dispCurve->graph(1)->setScatterStyle(QCPScatterStyle(QCPScatterStyle::ssCircle, 7));
    ui->dispCurve->graph(1)->setPen(blueDotPen);
    qDebug() << kDot[0] << omegaDot[0];
    ui->dispCurve->graph(1)->setData(kDot,omegaDot);
    ui->dispCurve->replot();
    num = QString("<html><head/><body><p><span style=\" font-size:12pt;\"><font size = 5>ω = %1ω<sub>0</sub></font></span></p></body></html>").arg(currRate/(2*sqrt(myChain->getCoefficient()/(*myChain)[0]->getMass())),0,'gb',2);
    ui->labelOmega->setText(num);
    num = QString("<html><head/><body><p><span style=\" font-size:12pt;\">   = %1</span></p></body></html>").arg(kDot[0],0,'gb',2);
    ui->labelKValue->setText(num);
    w0 = 1;
    ui->dispCurve->yAxis->setAutoTickLabels(false);
    omegaTickLabel.clear();
    omegaTickLabel << "" << "ωₒ";
    ui->dispCurve->yAxis->setTickVectorLabels(omegaTickLabel);
    ui->labelChastota->move(ui->pushButtonMax->x(),ui->pushButtonMax->y()-ui->labelChastota->height()-20);
    ui->verticalSlider->setSliderPosition(currRate/ui->dispCurve->yAxis->range().upper*100.0/(2*sqrt(myChain->getCoefficient()/(*myChain)[0]->getMass())));
}