Skip to content

Commit

Permalink
Merge tag 'v6.2.9-lts' into tqtc/lts-6.2-opensource
Browse files Browse the repository at this point in the history
Qt 6.2.9-lts release

Conflicts solved:
	dependencies.yaml

Change-Id: I9a291807ff898ed1df7803ea9b1e8b127d84d6d4
  • Loading branch information
Tarja Sundqvist committed Jun 7, 2024
2 parents 34dc084 + 393f262 commit 034f7a6
Show file tree
Hide file tree
Showing 21 changed files with 185 additions and 130 deletions.
2 changes: 1 addition & 1 deletion .cmake.conf
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
set(QT_REPO_MODULE_VERSION "6.2.8")
set(QT_REPO_MODULE_VERSION "6.2.9")
set(QT_REPO_MODULE_PRERELEASE_VERSION_SEGMENT "")
6 changes: 3 additions & 3 deletions dependencies.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
dependencies:
../tqtc-qtbase:
ref: 4c1c38dede55565afa846685b3e19cf8f1cfed0c
ref: f131837a9fcc83dcfb70a0a91b1baacb6ccf14a2
required: true
../tqtc-qtdeclarative:
ref: 9919f58fce6329a233ca885188d0aba5f484e546
ref: a1b4a68d1165115779ac925f43847a5735671917
required: false
../tqtc-qtshadertools:
ref: 754297822b244b98494e5ab09ca024a2e7acb54a
ref: c0efa3c44c056e1307e25ad8f3dd6db6f19ef135
required: true
1 change: 1 addition & 0 deletions examples/multimedia/declarative-camera/CameraListPopup.qml
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ Popup {
onClicked: {
view.currentIndex = index
cameraListPopup.currentValue = modelData
popup.selected()
}
}
}
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
86 changes: 82 additions & 4 deletions examples/multimedia/video/recorder/doc/src/recorder.qdoc
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

/*!
\example multimedia/video/recorder
\title QML Recorder Example
\title QML Video Recorder
\ingroup multimedia_examples
\ingroup video_examples_qml
\ingroup camera_examples_qml
Expand All @@ -37,10 +37,88 @@
\image qmlrecorder.jpg

\e{QML Recorder} demonstrates a simple application that can record
audio and or video files using the camera and microphone.
audio and video separate or together, using a microphone, a camera.

\include examples-run.qdocinc

The example uses the QML Camera and AudioInput objects connected to a MediaCaptureSession.
A MediaRecorder object is then used to record the captured audio and video.
\section1 Overview
At its core, this is a QML application, see
\l{Getting Started Programming with Qt Quick}. This documentation is focused
on how this example uses the \l{Qt Multimedia QML types}.

\image qml-recorder-overview.gif "Animation cycling through qml objects declared in main.qml"

The example uses the QML \l Camera and \l AudioInput types connected to a
\l CaptureSession. A \l MediaRecorder object is then used to record the
captured audio and video.

In addition to QtMultimedia, features of Qt Quick Windows, Controls, and
Layouts are used to implement the graphic user interface and functionality.
Playback won't be covered here, for that see the \l{QML Media Player Example}.

The example demonstrates the following:
\list
\li Input devices can be selected.
\li An input type switched off.
\li Settings for capturing such as quality, codec choice, file format,
and assigning metadata.
\li Captured files are stored and can be played back.
\endlist

\section1 Recording

The application implements recording.

\section2 captureSession

In \c main.qml, \c captureSession is declared like so:

\quotefromfile video/recorder/main.qml
\skipto CaptureSession
\printto MediaRecorder

\section2 recorder

In \c main.qml, the \l MediaRecorder \c recorder handles recording media
as well as capturing a thumbnail for the file and appending it to a ListModel,
\c mediaList.
\printto Playback

\c mediaList is declared in the \l Frame \c mediaListFrame
\quotefromfile video/recorder/main.qml
\skipto Frame
\printuntil playback: playback

\section2 controls

\image qml-recorder-control-bar-overview.gif

These are defined in \c Controls.qml and declared in main.qml.

Its root is a \l Row that contains the \l{Column}{Columns} \c inputControls,
\c recordButton, \c optionButtons, each defined in their own .qml files.

\section3 Selecting a video source

Defined in \c VideoSourceSelect.qml, \c VideoSourceSlect is comprised of a
\l Switch and a \l ComboBox and enables the user to select from available
cameras.

\quotefromfile video/recorder/VideoSourceSelect.qml
\skipto Row
\printto ComboBox

\c comboBox, declared in the above snippet, assigns the current video source.

\printuntil camera.cameraDevice = currentValue.camera

\section3 Selecting an audio input

Implemented in the same way as \l{Selecting a camera} and defined in
\c AudioInputSelect.qml like so:

\quotefromfile video/recorder/AudioInputSelect.qml
\skipto Row
\printto audioInput.device = currentValue

*/
7 changes: 5 additions & 2 deletions examples/multimediawidgets/camera/android/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,16 @@
android:extractNativeLibs="true"
android:hardwareAccelerated="true"
android:label="-- %%INSERT_APP_NAME%% --"
android:requestLegacyExternalStorage="true">
android:requestLegacyExternalStorage="true"
android:allowBackup="true"
android:fullBackupOnly="false">
<activity
android:name="org.qtproject.qt.android.bindings.QtActivity"
android:configChanges="orientation|uiMode|screenLayout|screenSize|smallestScreenSize|layoutDirection|locale|fontScale|keyboard|keyboardHidden|navigation|mcc|mnc|density"
android:label="-- %%INSERT_APP_NAME%% --"
android:launchMode="singleTop"
android:screenOrientation="portrait">
android:screenOrientation="portrait"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,7 @@
import android.graphics.ImageFormat;
import android.graphics.SurfaceTexture;
import android.util.Log;
import java.io.File;
import java.io.FileOutputStream;
import java.lang.Math;
import android.media.ExifInterface;
import java.io.ByteArrayOutputStream;
import java.lang.String;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Matrix;

public class QtCameraListener implements Camera.ShutterCallback,
Camera.PictureCallback,
Expand Down Expand Up @@ -208,68 +200,6 @@ public void onShutter()
@Override
public void onPictureTaken(byte[] data, Camera camera)
{
File outputFile = null;
try {
outputFile = File.createTempFile("pic_", ".jpg", QtMultimediaUtils.getCacheDirectory());
FileOutputStream out = new FileOutputStream(outputFile);

// we just want to read the exif...
BitmapFactory.decodeByteArray(data, 0, data.length)
.compress(Bitmap.CompressFormat.JPEG, 10, out);

ExifInterface exif = new ExifInterface(outputFile.getAbsolutePath());
int orientation = exif.getAttributeInt(ExifInterface.TAG_ORIENTATION,
ExifInterface.ORIENTATION_UNDEFINED);

int degree = 0;

switch (orientation) {
case ExifInterface.ORIENTATION_ROTATE_90:
degree = 90;
break;
case ExifInterface.ORIENTATION_ROTATE_180:
degree = 180;
break;
case ExifInterface.ORIENTATION_ROTATE_270:
degree = 270;
break;
}

Camera.CameraInfo info = new Camera.CameraInfo();
Camera.getCameraInfo(m_cameraId, info);

int rotation = (info.orientation - degree + 360) % 360;

Bitmap source = BitmapFactory.decodeByteArray(data, 0, data.length);
Matrix matrix = new Matrix();
matrix.postRotate(rotation);

if (info.facing == CameraInfo.CAMERA_FACING_FRONT) {
matrix.postScale(-1, 1, source.getWidth() / 2.0f, source.getHeight() / 2.0f);
}

Bitmap rotatedBitmap = Bitmap.createBitmap(source, 0, 0, source.getWidth(),
source.getHeight(), matrix, true);

ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
rotatedBitmap.compress(Bitmap.CompressFormat.JPEG, 100, outputStream);
byte[] byteArray = outputStream.toByteArray();

rotatedBitmap.recycle();
source.recycle();

notifyPictureCaptured(m_cameraId, byteArray);

return;

} catch (Exception e) {
Log.w(TAG, "Error fixing bitmap orientation.");
e.printStackTrace();
} finally {
if (outputFile != null && outputFile.exists())
outputFile.delete();
}

notifyPictureCaptured(m_cameraId, data);
}

Expand Down
2 changes: 1 addition & 1 deletion src/multimedia/audio/qaudioformat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,7 @@ QDebug operator<<(QDebug dbg, QAudioFormat::SampleFormat type)

QDebug operator<<(QDebug dbg, const QAudioFormat &f)
{
dbg << "QAudioFormat(" << f.sampleRate() << "Hz, " << f.channelCount() << "Channels, " << f.sampleFormat() << "Format";
dbg << "QAudioFormat(" << f.sampleRate() << "Hz, " << f.channelCount() << "Channels, " << f.sampleFormat() << "Format )";
return dbg;
}
#endif
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -233,13 +233,11 @@ void QAndroidCamera::onCameraOpened()
if (m_cameraSession->camera()->isZoomSupported()) {
m_zoomRatios = m_cameraSession->camera()->getZoomRatios();
qreal maxZoom = m_zoomRatios.last() / qreal(100);
if (m_maximumZoom != maxZoom) {
m_maximumZoom = maxZoom;
}
maximumZoomFactorChanged(maxZoom);
zoomTo(1, -1);
} else {
m_zoomRatios.clear();
m_maximumZoom = 1.0;
maximumZoomFactorChanged(1.0);
}

m_minExposureCompensationIndex = m_cameraSession->camera()->getMinExposureCompensation();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,6 @@ private Q_SLOTS:
bool m_continuousVideoFocusSupported = false;
bool m_focusPointSupported = false;

float m_maximumZoom;
QList<int> m_zoomRatios;

QList<QCamera::ExposureMode> m_supportedExposureModes;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -698,6 +698,22 @@ void QAndroidCameraSession::onNewPreviewFrame(const QVideoFrame &frame)

void QAndroidCameraSession::onCameraPictureCaptured(const QVideoFrame &frame)
{
// Frame needs to be correctly rotated before image proccessing. We are using
// the same rotation angle that was used for preview with setDisplayOrientation
auto rotation = QVideoFrame::Rotation0;
switch (currentCameraRotation()) {
case 90:
rotation = QVideoFrame::Rotation90;
break;
case 180:
rotation = QVideoFrame::Rotation180;
break;
case 270:
rotation = QVideoFrame::Rotation270;
break;
}
const_cast<QVideoFrame&>(frame).setRotationAngle(rotation);

// Loading and saving the captured image can be slow, do it in a separate thread
(void)QtConcurrent::run(&QAndroidCameraSession::processCapturedImage, this,
m_currentImageCaptureId, frame, m_imageCaptureToBuffer,
Expand Down
Loading

0 comments on commit 034f7a6

Please sign in to comment.