I have an app heavily dependent on Multimedia.

it took me about a week and a half total

i created a header "Qt6Bridge.h" that defines a bunch of stuff one way or 
another depending on qt5 or qt6 (have to keep qt5 build alive until Qt6 has all 
the functionality in need).

eg:

#ifndef _H_Qt6Bridge
#define _H_Qt6Bridge

#if _QT_
#include "CFUtils.h"
#include <QAudioOutput>

#if _QT6_
        #include <QList>
        #include <QVideoFrameFormat>
        #include <QAudioDevice>
        #include <QVideoSink>
        #include <QAudioSink>
        #include <QCameraDevice>
        #include <QMediaDevices>
        #include <QMediaMetaData>

        typedef QVideoFrameFormat               QtVideoFrameFormat;
        typedef QVideoFrameFormat::PixelFormat  QtVideoFramePixFormat;

        typedef QVideoSink                      QtAbstractVideoSurface;

        #define getVideoSurface()               videoSink()
        #define getAvailableVideoDevices()      QMediaDevices::videoInputs()
        #define setMediaSoure                   setSource
        #define QMediaPlayer_PlaybackState      QMediaPlayer::PlaybackState
        #define getPlaybackState()              playbackState()

        // ------------------------
        typedef QAudioDevice                    QtAudioDevice;

        typedef QAudioDevice::Mode              QtAudioDeviceMode;
        #define QtAudioDeviceMode_Input         QAudioDevice::Input
        #define QtAudioDeviceMode_Output        QAudioDevice::Output

        QList<QAudioDevice>                     
getAvailableAudioDevices(QtAudioDeviceMode ioMode);
        #define getDefaultAudioDevice()         
QMediaDevices::defaultAudioOutput()

        #define QAudioFormat_SampleType         QAudioFormat::SampleFormat
        #define getSampleType()                 sampleFormat()
        #define getSupportedSampleTypes()       supportedSampleFormats()
        #define bitsPerSample()                 bytesPerSample() * 8

        typedef QAudioSink                      QtAudioSink;

        namespace QSound {
                void    play(const QString& path);
        };

        // ------------------------
        typedef QCameraDevice                   QtCameraDevice;

        // ------------------------
        #define getDeviceName()                 description()

#else   //      _QT6_
        #include <QVideoSurfaceFormat>
        #include <QAudioDeviceInfo>
        #include <QAbstractVideoSurface>
        #include <QCameraInfo>
        #include <QSound>

        typedef QVideoSurfaceFormat             QtVideoFrameFormat;
        typedef QVideoFrame::PixelFormat        QtVideoFramePixFormat;

        typedef QAbstractVideoSurface           QtAbstractVideoSurface;

        #define getVideoSurface()               videoSurface()
        #define getAvailableVideoDevices()      QCameraInfo::availableCameras()
        #define setMediaSoure                   setMedia
        #define QMediaPlayer_PlaybackState      QMediaPlayer::State
        #define getPlaybackState()              state()

        // ------------------------
        typedef QAudioDeviceInfo                QtAudioDevice;

        typedef QAudio::Mode                    QtAudioDeviceMode;
        #define QtAudioDeviceMode_Input         QAudio::AudioInput
        #define QtAudioDeviceMode_Output        QAudio::AudioOutput

        #define getAvailableAudioDevices(_type) 
QAudioDeviceInfo::availableDevices(_type)
        #define getDefaultAudioDevice()         
QAudioDeviceInfo::defaultOutputDevice()

        #define QAudioFormat_SampleType         QAudioFormat::SampleType
        #define getSampleType()                 sampleType()
        #define getSupportedSampleTypes()       supportedSampleTypes()
        #define bitsPerSample()                 sampleSize()

        typedef QAudioOutput                    QtAudioSink;
        // ------------------------
        typedef QCameraInfo                     QtCameraDevice;

        // ------------------------
        #define getDeviceName()                 deviceName()
#endif  //      !_QT6_

#endif  //      _QT_
#endif  // _H_Qt6Bridge

I also had to write my own "QVideoFrame_fromImage()" cuz that func no longer 
exists

the rest was working around the fact that you can't multiplex video frames any 
more:
https://bugreports.qt.io/browse/QTBUG-95127
https://bugreports.qt.io/browse/QTBUG-95542

and i'm waiting still on the ability to get predictable audio samples from the 
decoder:
https://bugreports.qt.io/browse/QTBUG-95766



> On Aug 30, 2021, at 9:30 AM, Nuno Santos <nuno.san...@imaginando.pt> wrote:
> 
> Thiago,
> 
> Thanks for the clarification.
> 
> I was convinced that qmake was not available anymore. My bad! :/
> 
> Still, I think 10 days of evaluation is a really short period of time.
> 
> I would love to hear feedback from people who have started porting their 
> software to Qt 6 and how the effort of such migration.
> 
> Regards,
> 
> Nuno
> 
>> On 30 Aug 2021, at 17:16, Thiago Macieira <thiago.macie...@intel.com> wrote:
>> 
>> On Monday, 30 August 2021 04:22:52 PDT Nuno Santos wrote:
>>> I would say that taking into account the fact that Qt has a new building
>>> system and qmake is not available anymore, porting an existing project
>>> takes much more than 10 days.
>> 
>> That's incorrect. qmake is still available.

_______________________________________________
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest

Reply via email to