本文整理汇总了C++中VideoOutput::setOutAspectRatioMode方法的典型用法代码示例。如果您正苦于以下问题:C++ VideoOutput::setOutAspectRatioMode方法的具体用法?C++ VideoOutput::setOutAspectRatioMode怎么用?C++ VideoOutput::setOutAspectRatioMode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类VideoOutput
的用法示例。
在下文中一共展示了VideoOutput::setOutAspectRatioMode方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Logger
//.........这里部分代码省略.........
options.print();
return 0;
}
QApplication a(argc, argv);
load_qm(QStringList() << "player", options.value("language").toString());
sLogfile = fopen(QString(qApp->applicationDirPath() + "/log.txt").toUtf8().constData(), "w+");
if (!sLogfile) {
qWarning("Failed to open log file");
sLogfile = stdout;
}
qInstallMessageHandler(Logger);
QOption op = options.option("vo");
QString vo = op.value().toString();
if (!op.isSet()) {
QString exe(a.arguments().at(0));
int i = exe.lastIndexOf('-');
if (i > 0) {
vo = exe.mid(i+1, exe.indexOf('.') - i - 1);
}
}
qDebug("vo: %s", vo.toUtf8().constData());
vo = vo.toLower();
if (vo != "gl" && vo != "d2d" && vo != "gdi" && vo != "xv" && vo != "qt")
vo = "gl";
QString title = "QtAV " /*+ vo + " "*/ + QtAV_Version_String_Long() + " [email protected]";
#ifndef QT_NO_OPENGL
VideoRendererId vid = VideoRendererId_GLWidget2;
#else
VideoRendererId vid = VideoRendererId_Widget;
#endif
// TODO: move to VideoRendererTypes or factory to query name
struct {
const char* name;
VideoRendererId id;
} vid_map[] = {
{ "gl", VideoRendererId_GLWidget2 },
{ "d2d", VideoRendererId_Direct2D },
{ "gdi", VideoRendererId_GDI },
{ "xv", VideoRendererId_XV },
{ "qt", VideoRendererId_Widget },
{ 0, 0 }
};
for (int i = 0; vid_map[i].name; ++i) {
if (vo == vid_map[i].name) {
vid = vid_map[i].id;
break;
}
}
VideoOutput *renderer = new VideoOutput(vid); //or VideoRenderer
if (!renderer) {
QMessageBox::critical(0, "QtAV", "vo '" + vo + "' not supported");
return 1;
}
//renderer->scaleInRenderer(false);
renderer->setOutAspectRatioMode(VideoRenderer::VideoAspectRatio);
MainWindow window;
window.show();
window.setWindowTitle(title);
window.setRenderer(renderer);
int w = renderer->widget()->width();
int h = renderer->widget()->width()*9/16;
int x = window.x();
int y = window.y();
op = options.option("width");
w = op.value().toInt();
op = options.option("height");
h = op.value().toInt();
op = options.option("x");
if (op.isSet())
x = op.value().toInt();
op = options.option("y");
if (op.isSet())
y = op.value().toInt();
window.resize(w, h);
window.move(x, y);
if (options.value("fullscreen").toBool())
window.showFullScreen();
window.enableAudio(options.value("ao").toString() != "null");
op = options.option("vd");
if (op.isSet()) {
QStringList vd = op.value().toString().split(";", QString::SkipEmptyParts);
if (!vd.isEmpty())
window.setVideoDecoderNames(vd);
}
if (options.value("no-ffmpeg-log").toBool())
setFFmpegLogHandler(0);
op = options.option("file");
if (op.isSet()) {
window.play(op.value().toString());
}
int ret = a.exec();
return ret;
}