void VideoPlayer::videoEndFunc( const libvlc_event_t*, void* data )
{
    VideoPlayer* stream = (VideoPlayer*)data;
    stream->_status = INVALID;
    stream->_playedTime++;
    if ( stream->getLoopingMode()==osg::ImageStream::LOOPING )
        stream->_requiresReplay = true;
}
Beispiel #2
0
int main(int argc, char **argv)
{
    QApplication app(argc, argv);

    VideoPlayer player;
    player.show();

    return app.exec(); 
}
Beispiel #3
0
int main(int argc, char *argv[])
{
    QApplication app(argc, argv);

    VideoPlayer player;
    player.resize(320, 240);
    player.show();

    return app.exec();
}
Beispiel #4
0
int main(int argc, char *argv[])
{
    QApplication app(argc, argv);

    VideoPlayer player;
    player.resize(320, 240);
//    player.show();

    QMediaPlayer *player = new QMediaPlayer;
    player->show();
    return app.exec();
}
Beispiel #5
0
VideoPlayer *VideoPlayer::create(const char *file, int width, int height)
{
    VideoPlayer * player = new VideoPlayer();
    
    if (player && player->init(file, width, height)) {
        player->autorelease();
    } else {
        delete player;
        player = nullptr;
    }
    
    return player;
}
Beispiel #6
0
	virtual void OnResume()
	{
		if (mVideoPlayer)
		{
			mVideoPlayer->Resume();
		}
	}
Beispiel #7
0
	virtual void OnPause()
	{
		if (mVideoPlayer)
		{
			mVideoPlayer->Pasue();
		}
	}
Beispiel #8
0
	virtual void OnUpdate()
	{
		if (mVideoPlayer != NULL)
		{
			mVideoPlayer->Track();
		}
	}
Beispiel #9
0
	virtual void OnInit()
	{
		MGUI::FontManager::Instance()->Load("Sample.font");

		MGUI::Layout * layout = new MGUI::Layout(NULL, NULL);
		layout->SetAlign(MGUI::eAlign::STRETCH);

		mVideoPlayer = VDO_CreatePlayer("Demo13/konqi.ogg", ePixelFormat::R8G8B8, VIDEO_FLAG_AUDIO | VIDEO_FLAG_LOOPED);
		if (mVideoPlayer != NULL)
		{
			MGUI::ImageBox * img = new MGUI::ImageBox(NULL, layout);
			img->SetAlign(MGUI::eAlign::CENTER);
			img->SetSkinAlignedEx(mVideoPlayer->GetVideoTexture());

			mVideoPlayer->Start();
		}
	}
void SquareAdded::mouseReleaseEvent( QMouseEvent *event)
{
    if(timer->isActive())
    {
        qDebug() << "Released - Time Remaining: " << timer->remainingTime();
        timer->stop();

        emit clicked();
    }
    else
    {
        group.setLoopCount(0);
        VideoPlayer *player = new VideoPlayer;
        player->resize(500,400);
        player->show();
    }
}
Beispiel #11
0
//static
void * VideoPlayer::doTimeCounter(void *args)
{
    LOG_START();
    VideoPlayer *player = static_cast<VideoPlayer*>(args);
    
    while(! player->mStop) {
        int base = (int)(24.0 / player->mTimeScale);
        if (player->mTimeBase % base == 0) {
            player->doUpdatePicture(player);
        }
        usleep(1000000 / 600);
        player->mTimeBase = (player->mTimeBase + 1) % 600;
    }
    
    LOG_END();
    
    return nullptr;
}
Beispiel #12
0
int main(int argc, char *argv[])
{
    QApplication a(argc, argv);

    QTranslator ts;
    if (ts.load(qApp->applicationDirPath() + "/i18n/QtAV_" + QLocale::system().name()))
        a.installTranslator(&ts);
    QTranslator qtts;
    if (qtts.load("qt_" + QLocale::system().name()))
        a.installTranslator(&qtts);

    VideoPlayer w;
    w.show();
    if (a.arguments().size() > 1)
        w.play(a.arguments().last());
    
    return a.exec();
}
Beispiel #13
0
int main(int argc, char **argv)
{
    QApplication app(argc, argv);
    app.setApplicationName("GraphicsView Video Player");
    app.setQuitOnLastWindowClosed(true);

    if (!QGLFormat::hasOpenGL() || !QGLFramebufferObject::hasOpenGLFramebufferObjects()) {
    QMessageBox::information(0, "OpenGL framebuffer objects 2",
                 "This system does not support OpenGL/framebuffer objects.");
        return -1;
    }

    VideoPlayer player;
    player.show();

    if (argc == 2) {
        player.openFile(QString(argv[1]));
    }

    return app.exec(); 
}
Beispiel #14
0
int main(int argc, char *argv[])
{
  if (argc < 2)
  {
    std::cout << "Usage: " << argv[0] << " <Video resource name>" << std::endl;
    exit(0);
  }

  Application app;
  app.run ();

  VideoPlayer player;
  player.playVideo (argv[1]);
  while (player.isPlaying ())
  {
    player.update ();
	if (player.isPlaying() == false || !app.render())
      break;
  }

  return 0;
}
Beispiel #15
0
//static
void *VideoPlayer::doProcessVideo(void *args)
{
    AVFrame *frame;
    AVPicture *picture;
    AVPacket packet;
    int got_frame = 0;
    
    VideoPlayer *player = static_cast<VideoPlayer*>(args);
    
    while(! player->mStop) {
        
        if (player->mSeek) {
            player->doSeek();
        }
        
        if (player->mAccurateSeek) {
            player->doAccurateSeek();
        }

        if (av_read_frame(player->mFormatCtx, &packet) < 0) {
            vLOGE("END OF FILE.\n");
            player->mVideoEndCallback(player, "stop");
            av_free_packet(&packet);
            break;
        }
        
        if (packet.stream_index == player->mVideoStreamIndex) {
            
            avcodec_decode_video2(player->mCodecCtx, player->mFrame, &got_frame, &packet);
            
            if (got_frame == 0) {
                vLOGE("Do not get a frame.\n");
                av_free_packet(&packet);
                continue;
            }
            
            picture = new AVPicture;
            if (! picture) {
                vLOGE("new AVPicture failed.");
                continue;
            }

            avpicture_alloc(picture, PIX_FMT_RGB24, player->mWidth, player->mHeight);

            sws_scale (player->mImageConvertCtx,
                       player->mFrame->data,
                       player->mFrame->linesize,
                       0, player->mCodecCtx->height,
                       picture->data,
                       picture->linesize);
            
            player->mPictureRingBuffer.enqueue(picture);
            
        } else {
            vLOGE("Not video stream packet, ignore it.\n");
        }
        
        av_free_packet(&packet);
        usleep(10);
        
    }
    
    return nullptr;
}
void* VideoPlayer::lockFunc( void* data, void** p_pixels )
{
    VideoPlayer* stream = (VideoPlayer*)data;
    *p_pixels = (void*)stream->data();
    return NULL;
}
void VideoPlayer::unlockFunc( void* data, void* id, void* const* p_pixels )
{
    VideoPlayer* stream = (VideoPlayer*)data;
    stream->dirty();
}