//------------------------------------------------------------------------------------------
// 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);
}
//------------------------------------------------------------------------------------------
bool Player
::event(QEvent * event
) {
if (event
->type
() == QEvent::User) {
update();
return true;
}
}
{
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()));
}
//------------------------------------------------------------------------------------------
// 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()));
}
To copy to clipboard, switch view to plain text mode
I'm testing with a 1080p video. For some reason the
Bookmarks