gpt4 book ai didi

android - QCamera似乎坏了

转载 作者:塔克拉玛干 更新时间:2023-11-03 06:44:11 25 4
gpt4 key购买 nike

为了使用我的手机摄像头(在 Nexus 5 上),我使用以下代码:

camera = new QCamera;
camera->setViewfinder(ui->viewFinder);
ui->viewFinder->show();

ui->stackedWidget->setGeometry(0,0, 1000, 1700);
ui->viewFinder->setGeometry(0, 0, 1000, 1700);

camera->start(); // to start the viewfinder
qDebug() << camera->error() << camera->errorString();
qDebug() << camera->state() << camera->status();

来自 Qt doc但它什么也没做。我在头文件中添加了正确的包含,在 .pro 文件中添加了 QT += multimedia multimediawidgets

输出是:

QCamera::NoError ""
QCamera::UnloadedState QCamera::UnloadedStatus

这有点奇怪,因为如果 start() 函数失败,它应该抛出一个错误:

void QCamera::start() [slot] Starts the camera.

State is changed to QCamera::ActiveState if camera is started successfully, otherwise error() signal is emitted.

While the camera state is changed to QCamera::ActiveState, starting the camera service can be asynchronous with the actual status reported with QCamera::status property.

编辑

QList<QCameraInfo> cameras = QCameraInfo::availableCameras();
foreach (const QCameraInfo &cameraInfo, cameras) {
qDebug() << cameraInfo.deviceName();
}

输出:

"back"

"front"

所以 QT 检测到设备。

编辑 2

这是一些似乎包含一些错误的日志,但由于这是我的第一个 Android 应用程序,我并不完全了解发生了什么:

D/dalvikvm(21060): GC_CONCURRENT freed 172K, 2% free 17025K/17228K, paused 5ms+1ms, total 22ms
D/dalvikvm(21060): Trying to load lib /data/data/org.qtproject.example.HUD/lib/libgnustl_shared.so 0x42cb2588
D/dalvikvm(21060): Added shared lib /data/data/org.qtproject.example.HUD/lib/libgnustl_shared.so 0x42cb2588
D/dalvikvm(21060): No JNI_OnLoad found in /data/data/org.qtproject.example.HUD/lib/libgnustl_shared.so 0x42cb2588, skipping init
D/dalvikvm(21060): Trying to load lib /data/data/org.qtproject.example.HUD/lib/libQt5Core.so 0x42cb2588
D/dalvikvm(21060): Added shared lib /data/data/org.qtproject.example.HUD/lib/libQt5Core.so 0x42cb2588
D/dalvikvm(21060): Trying to load lib /data/data/org.qtproject.example.HUD/lib/libQt5Gui.so 0x42cb2588
D/dalvikvm(21060): Added shared lib /data/data/org.qtproject.example.HUD/lib/libQt5Gui.so 0x42cb2588
D/dalvikvm(21060): No JNI_OnLoad found in /data/data/org.qtproject.example.HUD/lib/libQt5Gui.so 0x42cb2588, skipping init
D/dalvikvm(21060): Trying to load lib /data/data/org.qtproject.example.HUD/lib/libQt5Network.so 0x42cb2588
D/dalvikvm(21060): Added shared lib /data/data/org.qtproject.example.HUD/lib/libQt5Network.so 0x42cb2588
I/Qt (21060): Network start
D/dalvikvm(21060): Trying to load lib /data/data/org.qtproject.example.HUD/lib/libQt5Multimedia.so 0x42cb2588
D/dalvikvm(21060): Added shared lib /data/data/org.qtproject.example.HUD/lib/libQt5Multimedia.so 0x42cb2588
D/dalvikvm(21060): No JNI_OnLoad found in /data/data/org.qtproject.example.HUD/lib/libQt5Multimedia.so 0x42cb2588, skipping init
D/dalvikvm(21060): Trying to load lib /data/data/org.qtproject.example.HUD/lib/libQt5Widgets.so 0x42cb2588
D/dalvikvm(21060): Added shared lib /data/data/org.qtproject.example.HUD/lib/libQt5Widgets.so 0x42cb2588
D/dalvikvm(21060): No JNI_OnLoad found in /data/data/org.qtproject.example.HUD/lib/libQt5Widgets.so 0x42cb2588, skipping init
D/dalvikvm(21060): Trying to load lib /data/data/org.qtproject.example.HUD/lib/libQt5OpenGL.so 0x42cb2588
D/dalvikvm(21060): Added shared lib /data/data/org.qtproject.example.HUD/lib/libQt5OpenGL.so 0x42cb2588
D/dalvikvm(21060): No JNI_OnLoad found in /data/data/org.qtproject.example.HUD/lib/libQt5OpenGL.so 0x42cb2588, skipping init
D/dalvikvm(21060): Trying to load lib /data/data/org.qtproject.example.HUD/lib/libQt5MultimediaWidgets.so 0x42cb2588
D/dalvikvm(21060): Added shared lib /data/data/org.qtproject.example.HUD/lib/libQt5MultimediaWidgets.so 0x42cb2588
D/dalvikvm(21060): No JNI_OnLoad found in /data/data/org.qtproject.example.HUD/lib/libQt5MultimediaWidgets.so 0x42cb2588, skipping init
D/dalvikvm(21060): Trying to load lib /data/data/org.qtproject.example.HUD/lib/libQt5Positioning.so 0x42cb2588
D/dalvikvm(21060): Added shared lib /data/data/org.qtproject.example.HUD/lib/libQt5Positioning.so 0x42cb2588
D/dalvikvm(21060): No JNI_OnLoad found in /data/data/org.qtproject.example.HUD/lib/libQt5Positioning.so 0x42cb2588, skipping init
D/dalvikvm(21060): Trying to load lib /data/data/org.qtproject.example.HUD/qt-reserved-files/plugins/platforms/android/libqtforandroid.so 0x42cb2588
D/dalvikvm(21060): Added shared lib /data/data/org.qtproject.example.HUD/qt-reserved-files/plugins/platforms/android/libqtforandroid.so 0x42cb2588
I/Qt (21060): qt start
D/dalvikvm(21060): Trying to load lib /data/data/org.qtproject.example.HUD/qt-reserved-files/plugins/mediaservice/libqtmedia_android.so 0x42cb2588
D/dalvikvm(21060): Added shared lib /data/data/org.qtproject.example.HUD/qt-reserved-files/plugins/mediaservice/libqtmedia_android.so 0x42cb2588
D/dalvikvm(21060): Trying to load lib /data/data/org.qtproject.example.HUD/qt-reserved-files/plugins/position/libqtposition_android.so 0x42cb2588
D/dalvikvm(21060): Added shared lib /data/data/org.qtproject.example.HUD/qt-reserved-files/plugins/position/libqtposition_android.so 0x42cb2588
I/QtPositioning(21060): Positioning start
D/dalvikvm(21060): Trying to load lib /data/app-lib/org.qtproject.example.HUD-1/libHUD.so 0x42cb2588
D/dalvikvm(21060): Added shared lib /data/app-lib/org.qtproject.example.HUD-1/libHUD.so 0x42cb2588
D/dalvikvm(21060): No JNI_OnLoad found in /data/app-lib/org.qtproject.example.HUD-1/libHUD.so 0x42cb2588, skipping init
I/Adreno-EGL(21060): <qeglDrvAPI_eglInitialize:320>: EGL 1.4 QUALCOMM Build: I0404c4692afb8623f95c43aeb6d5e13ed4b30ddbDate: 11/06/13
D/OpenGLRenderer(21060): Enabling debug mode 0

最佳答案

我想你的问题的答案就在这里;

https://bugreports.qt-project.org/browse/QTBUG-38233?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel

基本上 - 它不起作用。

我可以确认相机永远不会在 QT 5.3 分支下进入模式 8。5.2.1 允许拍摄图像,但取景器不起作用。

我不确定发生了什么,或者他们为什么会停止支持此代码。

关于android - QCamera似乎坏了,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23992663/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com