Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. LibVLC into an opengl QGraphicsScene

LibVLC into an opengl QGraphicsScene

Scheduled Pinned Locked Moved General and Desktop
1 Posts 1 Posters 2.4k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    bunjee
    wrote on last edited by
    #1

    Greetings cute community,

    I'm currently trying to render a VLC video inside a QGraphicsScene.

    I'm using the following code:
    @//------------------------------------------------------------------------------------------
    // VLC callbacks
    //------------------------------------------------------------------------------------------

    /* static */ void * Player::lock(void * data, void ** buffer)
    {
    Player * player = static_cast<Player *> (data);

    *buffer = player->_image.bits();
    
    return NULL;
    

    }

    /* static */ void Player::unlock(void * data, void *, void * const *)
    {
    Player * player = static_cast<Player *> (data);

    QCoreApplication::postEvent(player, new QEvent(QEvent::User));
    

    }

    //------------------------------------------------------------------------------------------

    bool Player::event(QEvent * event)
    {
    if (event->type() == QEvent::User)
    {
    update();

        return true;
    }
    else return QObject::event(event);
    

    }

    void Player::paint(QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget)
    {
    painter->setRenderHint(QPainter::SmoothPixmapTransform, true);

    painter->setBrush(Qt::black);
    
    painter->drawRect(option->rect);
    
    painter->drawImage(0, 0, _image);
    
    // The next call is very slow, even using an Opengl viewport
    painter->drawImage(_targetRect, _image, QRectF(0, 0, _image.width(), _image.height()));
    

    }@

    I'm testing with a 1080p video. For some reason the drawImage call seems to slow things down. This is not a surprise in software, but it's also pretty slow in Opengl.

    My question is, assuming I want to use Opengl, is there a faster way to render a video frame into a QGraphicsScene using Qt 4.8 ?

    Thanks.

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved