Exemplo n.º 1
0
	status_t MPlayer::pause()
	{
		LOGV("MPlayer::pause");
		if ( mState == MP_STATE_STARTED ) {
			mState=MP_STATE_PAUSED;
			setPauseState();
		}
	
		return NO_ERROR;
		

	}
Exemplo n.º 2
0
void PlayerWin::mousePressEvent(QMouseEvent *event)
{
    if(event->button()==Qt::RightButton)
    {
        QMenu *menu= new QMenu;
        QAction *pauseAct = new QAction(tr(this->state==1?"暂停&P":"播放&P"), this);
        QAction *stopAct = new QAction(tr("停止&S"), this);
        QAction *wideAct = new QAction(tr(this->isWideModel==true?"退出精简模式":"精简模式"), this);
        QAction *openAct = new QAction(tr("打开本地文件&O"), this);

        QAction *loadAct = new QAction(tr("视频片切换"), this);
        QMenu *loadMenu= new QMenu;
        QAction *loadPreAct = new QAction(tr("上一片"), this);
        QAction *loadCurAct = new QAction(tr("重载当前"), this);
        QAction *loadNextAct = new QAction(tr("下一片"), this);
        loadMenu->addAction(loadPreAct);
        //loadMenu->addAction(loadCurAct);
        loadMenu->addAction(loadNextAct);
        loadAct->setMenu(loadMenu);

        QAction *subAct = new QAction(tr("外挂字幕"), this);
        subAct->setCheckable(true);
        subAct->setChecked((subtitleWidget->isVisible())?true:false);

        connect(pauseAct, SIGNAL(triggered()), this, SLOT(setPauseState()));
        connect(stopAct, SIGNAL(triggered()), this, SLOT(setStopState()));
        connect(wideAct, SIGNAL(triggered()), this, SLOT(setWideModel()));
        connect(openAct, SIGNAL(triggered()), this, SLOT(openFile()));
        connect(loadPreAct, SIGNAL(triggered()), this, SLOT(loadPreSlice()));
        connect(loadCurAct, SIGNAL(triggered()), this, SLOT(loadCurSlice()));
        connect(loadNextAct, SIGNAL(triggered()), this, SLOT(loadNextSlice()));
        connect(subAct, SIGNAL(triggered(bool)), this, SLOT(showSubtitleWidget(bool)));

        menu->addAction(pauseAct);
        menu->addAction(stopAct);
        menu->addAction(wideAct);
        menu->addAction(openAct);
        menu->addSeparator();
        menu->addAction(loadAct);
        menu->addAction(subAct);
        menu->exec(QCursor::pos());
    }
Exemplo n.º 3
0
    int Control( demux_t *p_demux_filter, int i_query, va_list args )
    {
        if( !m_enabled && i_query != DEMUX_FILTER_ENABLE )
            return demux_vaControl( p_demux_filter->p_next, i_query, args );

        switch (i_query)
        {
        case DEMUX_GET_POSITION:
        {
            double pos = getPosition();
            if( pos >= 0 )
            {
                *va_arg( args, double * ) = pos;
                return VLC_SUCCESS;
            }
            return VLC_EGENERIC;
        }
        case DEMUX_GET_TIME:
        {
            vlc_tick_t time = getTime();
            if( time >= 0 )
            {
                *va_arg(args, vlc_tick_t *) = time;
                return VLC_SUCCESS;
            }
            return VLC_EGENERIC;
        }
        case DEMUX_GET_LENGTH:
        {
            int ret;
            va_list ap;

            va_copy( ap, args );
            ret = demux_vaControl( p_demux_filter->p_next, i_query, args );
            if( ret == VLC_SUCCESS )
                m_length = *va_arg( ap, vlc_tick_t * );
            va_end( ap );
            return ret;
        }

        case DEMUX_CAN_SEEK:
        {
            int ret;
            va_list ap;

            va_copy( ap, args );
            ret = demux_vaControl( p_demux_filter->p_next, i_query, args );
            if( ret == VLC_SUCCESS )
                m_can_seek = *va_arg( ap, bool* );
            va_end( ap );
            return ret;
        }

        case DEMUX_SET_POSITION:
        {
            double pos = va_arg( args, double );
            /* Force unprecise seek */
            int ret = demux_Control( p_demux->p_next, DEMUX_SET_POSITION, pos, false );
            if( ret != VLC_SUCCESS )
                return ret;

            resetTimes();
            resetDemuxEof();
            return VLC_SUCCESS;
        }
        case DEMUX_SET_TIME:
        {
            vlc_tick_t time = va_arg( args, vlc_tick_t );
            /* Force unprecise seek */
            int ret = demux_Control( p_demux->p_next, DEMUX_SET_TIME, time, false );
            if( ret != VLC_SUCCESS )
                return ret;

            resetTimes();
            resetDemuxEof();
            return VLC_SUCCESS;
        }
        case DEMUX_SET_PAUSE_STATE:
        {
            va_list ap;

            va_copy( ap, args );
            int paused = va_arg( ap, int );
            va_end( ap );

            setPauseState( paused != 0 );
            break;
        }
        case DEMUX_SET_ES:
            /* Seek back to the last known pos when changing tracks. This will
             * flush sout streams, make sout del/add called right away and
             * clear CC buffers. */
            seekBack(m_last_time, m_last_pos);
            resetTimes();
            resetDemuxEof();
            break;
        case DEMUX_FILTER_ENABLE:
            p_renderer = static_cast<chromecast_common *>(
                        var_InheritAddress( p_demux, CC_SHARED_VAR_NAME ) );
            assert(p_renderer != NULL);
            m_enabled = true;
            init();
            return VLC_SUCCESS;

        case DEMUX_FILTER_DISABLE:

            deinit();

            /* Seek back to last known position. Indeed we don't want to resume
             * from the input position that can be more than 1 minutes forward
             * (depending on the CC buffering policy). */
            seekBack(m_last_time, m_last_pos);

            m_enabled = false;
            p_renderer = NULL;

            return VLC_SUCCESS;
        }

        return demux_vaControl( p_demux_filter->p_next, i_query, args );
    }