You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
1.2 KiB
33 lines
1.2 KiB
#include "qtavwidget.h"
|
|
|
|
#define AVDEBUG() qDebug("%s %s @%d", __FILE__, __FUNCTION__, __LINE__);
|
|
|
|
using namespace QtAV;
|
|
const qreal kVolumeInterval = 0.04;
|
|
|
|
extern QStringList idsToNames(QVector<VideoDecoderId> ids);
|
|
extern QVector<VideoDecoderId> idsFromNames(const QStringList& names);
|
|
|
|
void QLabelSetElideText(QLabel *label, QString text, int W = 0){
|
|
QFontMetrics metrix(label->font());
|
|
int width = label->width() - label->indent() - label->margin();
|
|
if (W || label->parent()) {
|
|
int w = W;
|
|
if (!w)
|
|
w = ((QWidget*)label->parent())->width();
|
|
width = qMax(w - label->indent() - label->margin() - 13*(30), 0); //TODO: why 30?
|
|
}
|
|
QString clippedText = metrix.elidedText(text, Qt::ElideRight, width);
|
|
label->setText(clippedText);
|
|
}
|
|
|
|
QtAVWidget::QtAVWidget(QWidget *parent) : QWidget(parent){
|
|
QtAV::Widgets::registerRenderers();
|
|
mpPlayer = new AVPlayer(this);
|
|
//mIsReady = true;
|
|
VideoRenderer *vo = VideoRenderer::create((VideoRendererId)property("rendererId").toInt());
|
|
if (!vo || !vo->isAvailable() || !vo->widget()) {
|
|
QMessageBox::critical(0, QString::fromLatin1("QtAV"), tr("Video renderer is ") + tr("not availabe on your platform!"));
|
|
}
|
|
//setRenderer(vo);
|
|
}
|