diff options
Diffstat (limited to 'src/plugins/multimedia/windows/mediacapture/qwindowsmediadevicereader.cpp')
-rw-r--r-- | src/plugins/multimedia/windows/mediacapture/qwindowsmediadevicereader.cpp | 58 |
1 files changed, 12 insertions, 46 deletions
diff --git a/src/plugins/multimedia/windows/mediacapture/qwindowsmediadevicereader.cpp b/src/plugins/multimedia/windows/mediacapture/qwindowsmediadevicereader.cpp index cbb070595..2bdc4ea7d 100644 --- a/src/plugins/multimedia/windows/mediacapture/qwindowsmediadevicereader.cpp +++ b/src/plugins/multimedia/windows/mediacapture/qwindowsmediadevicereader.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2021 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2021 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #include "qwindowsmediadevicereader_p.h" @@ -45,7 +9,7 @@ #include <qaudiodevice.h> #include <private/qmemoryvideobuffer_p.h> #include <private/qwindowsmfdefs_p.h> -#include <private/qwindowsiupointer_p.h> +#include <private/qcomptr_p.h> #include <QtCore/qdebug.h> #include <mmdeviceapi.h> @@ -58,7 +22,7 @@ QWindowsMediaDeviceReader::QWindowsMediaDeviceReader(QObject *parent) : QObject(parent) { m_durationTimer.setInterval(100); - connect(&m_durationTimer, SIGNAL(timeout()), this, SLOT(updateDuration())); + connect(&m_durationTimer, &QTimer::timeout, this, &QWindowsMediaDeviceReader::updateDuration); } QWindowsMediaDeviceReader::~QWindowsMediaDeviceReader() @@ -246,7 +210,7 @@ HRESULT QWindowsMediaDeviceReader::prepareVideoStream(DWORD mediaTypeIndex) // and the stride, which we need to convert the frame later hr = MFGetStrideForBitmapInfoHeader(subtype.Data1, m_frameWidth, &m_stride); if (SUCCEEDED(hr)) { - + m_stride = qAbs(m_stride); UINT32 frameRateNum, frameRateDen; hr = MFGetAttributeRatio(m_videoMediaType, MF_MT_FRAME_RATE, &frameRateNum, &frameRateDen); if (SUCCEEDED(hr)) { @@ -674,9 +638,9 @@ QMediaRecorder::Error QWindowsMediaDeviceReader::startRecording( if (!m_active || m_recording || (videoFormat == GUID_NULL && audioFormat == GUID_NULL)) return QMediaRecorder::ResourceError; - QWindowsIUPointer<IMFAttributes> writerAttributes; + ComPtr<IMFAttributes> writerAttributes; - HRESULT hr = MFCreateAttributes(writerAttributes.address(), 2); + HRESULT hr = MFCreateAttributes(writerAttributes.GetAddressOf(), 2); if (FAILED(hr)) return QMediaRecorder::ResourceError; @@ -690,9 +654,9 @@ QMediaRecorder::Error QWindowsMediaDeviceReader::startRecording( if (FAILED(hr)) return QMediaRecorder::ResourceError; - QWindowsIUPointer<IMFSinkWriter> sinkWriter; + ComPtr<IMFSinkWriter> sinkWriter; hr = MFCreateSinkWriterFromURL(reinterpret_cast<LPCWSTR>(fileName.utf16()), - nullptr, writerAttributes.get(), sinkWriter.address()); + nullptr, writerAttributes.Get(), sinkWriter.GetAddressOf()); if (FAILED(hr)) return QMediaRecorder::LocationNotWritable; @@ -738,7 +702,7 @@ QMediaRecorder::Error QWindowsMediaDeviceReader::startRecording( if (FAILED(hr)) return QMediaRecorder::ResourceError; - m_sinkWriter = sinkWriter.release(); + m_sinkWriter = sinkWriter.Detach(); m_lastDuration = -1; m_currentDuration = 0; updateDuration(); @@ -1048,3 +1012,5 @@ STDMETHODIMP QWindowsMediaDeviceReader::OnMarker(DWORD, LPVOID) } QT_END_NAMESPACE + +#include "moc_qwindowsmediadevicereader_p.cpp" |