diff --git a/.gitignore b/.gitignore index 835d654fe..8612113f0 100644 --- a/.gitignore +++ b/.gitignore @@ -31,6 +31,7 @@ examples/libraries/extras-scintillaedit/extras-scintillaedit examples/libraries/qt-multimedia/qt-multimedia examples/libraries/qt-network/qt-network examples/libraries/qt-printsupport/qt-printsupport +examples/libraries/qt6-multimedia/qt6-multimedia examples/libraries/restricted-extras-qscintilla/restricted-extras-qscintilla # android temporary build files diff --git a/cmd/genbindings/config-allowlist.go b/cmd/genbindings/config-allowlist.go index 4f966dfa2..956dac39a 100644 --- a/cmd/genbindings/config-allowlist.go +++ b/cmd/genbindings/config-allowlist.go @@ -210,6 +210,10 @@ func AllowMethod(className string, mm CppMethod) error { return ErrTooComplex // Present in Qt 5.15 and 6.4, missing in Qt 6.7 } + if className == "QWaveDecoder" && mm.MethodName == "setIODevice" { + return ErrTooComplex // Qt 6: Present in header, but no-op method was not included in compiled library + } + return nil // OK, allow } diff --git a/examples/libraries/qt6-multimedia/README.md b/examples/libraries/qt6-multimedia/README.md new file mode 100644 index 000000000..7c98ff8a6 --- /dev/null +++ b/examples/libraries/qt6-multimedia/README.md @@ -0,0 +1,3 @@ +The audio file `pixabay-public-domain-strong-hit-36455.mp3` in this directory was sourced from: https://pixabay.com/sound-effects/strong-hit-36455/ + +It was placed into the public domain by the author @axilirate . diff --git a/examples/libraries/qt6-multimedia/main.go b/examples/libraries/qt6-multimedia/main.go new file mode 100644 index 000000000..826dbc84c --- /dev/null +++ b/examples/libraries/qt6-multimedia/main.go @@ -0,0 +1,41 @@ +package main + +import ( + "log" + "os" + "path/filepath" + + qt "github.com/mappu/miqt/qt6" + "github.com/mappu/miqt/qt6/multimedia" +) + +func main() { + + qt.NewQApplication(os.Args) + + srcFile, err := filepath.Abs("pixabay-public-domain-strong-hit-36455.mp3") + if err != nil { + panic(err) + } + + player := multimedia.NewQMediaPlayer() + output := multimedia.NewQAudioOutput() + + player.SetAudioOutput(output) + player.SetSource(qt.QUrl_FromLocalFile(srcFile)) + output.SetVolume(50) + player.OnPlaybackStateChanged(func(s multimedia.QMediaPlayer__PlaybackState) { + + log.Printf("- Playback state: %v", s) + + if s == multimedia.QMediaPlayer__StoppedState { + log.Printf("Playback complete.") + qt.QCoreApplication_Exit() + } + }) + + log.Printf("Playback starting...") + player.Play() + + qt.QApplication_Exec() +} diff --git a/examples/libraries/qt6-multimedia/pixabay-public-domain-strong-hit-36455.mp3 b/examples/libraries/qt6-multimedia/pixabay-public-domain-strong-hit-36455.mp3 new file mode 100644 index 000000000..e7ed00635 Binary files /dev/null and b/examples/libraries/qt6-multimedia/pixabay-public-domain-strong-hit-36455.mp3 differ diff --git a/qt6/multimedia/gen_qwavedecoder.cpp b/qt6/multimedia/gen_qwavedecoder.cpp index 665d51721..1adb5e0ee 100644 --- a/qt6/multimedia/gen_qwavedecoder.cpp +++ b/qt6/multimedia/gen_qwavedecoder.cpp @@ -79,10 +79,6 @@ long long QWaveDecoder_Pos(const QWaveDecoder* self) { return static_cast(_ret); } -void QWaveDecoder_SetIODevice(QWaveDecoder* self, QIODevice* device) { - self->setIODevice(device); -} - long long QWaveDecoder_Size(const QWaveDecoder* self) { qint64 _ret = self->size(); return static_cast(_ret); diff --git a/qt6/multimedia/gen_qwavedecoder.go b/qt6/multimedia/gen_qwavedecoder.go index ee08a9d48..473b8169e 100644 --- a/qt6/multimedia/gen_qwavedecoder.go +++ b/qt6/multimedia/gen_qwavedecoder.go @@ -123,10 +123,6 @@ func (this *QWaveDecoder) Pos() int64 { return (int64)(C.QWaveDecoder_Pos(this.h)) } -func (this *QWaveDecoder) SetIODevice(device *qt6.QIODevice) { - C.QWaveDecoder_SetIODevice(this.h, (*C.QIODevice)(device.UnsafePointer())) -} - func (this *QWaveDecoder) Size() int64 { return (int64)(C.QWaveDecoder_Size(this.h)) } diff --git a/qt6/multimedia/gen_qwavedecoder.h b/qt6/multimedia/gen_qwavedecoder.h index a5684501b..08b250bd2 100644 --- a/qt6/multimedia/gen_qwavedecoder.h +++ b/qt6/multimedia/gen_qwavedecoder.h @@ -42,7 +42,6 @@ bool QWaveDecoder_Open(QWaveDecoder* self, int mode); void QWaveDecoder_Close(QWaveDecoder* self); bool QWaveDecoder_Seek(QWaveDecoder* self, long long pos); long long QWaveDecoder_Pos(const QWaveDecoder* self); -void QWaveDecoder_SetIODevice(QWaveDecoder* self, QIODevice* device); long long QWaveDecoder_Size(const QWaveDecoder* self); bool QWaveDecoder_IsSequential(const QWaveDecoder* self); long long QWaveDecoder_BytesAvailable(const QWaveDecoder* self);