Cimbali / pympress

Pympress is a simple yet powerful PDF reader designed for dual-screen presentations
https://cimbali.github.io/pympress/
GNU General Public License v2.0
1.18k stars 89 forks source link

Fix muting audio in gstreamer backend #279

Closed f0k closed 1 year ago

f0k commented 1 year ago

The current implementation of mute() for the gstreamer backend sets the 'mute' property of the playbin. However, this seems to be completely ignored, at least while in the READY or PAUSED state. (Maybe it would work in the PLAYING state, I haven't tried.)

This PR goes a different route by completely disabling or enabling audio for the playbin via its 'flags' property. This works fine in the READY state and fixes #277. I haven't been able to figure out whether the 0x02 constant lives under some name in Python land.

Disclaimer: I haven't tested whether this also works in the PAUSED or PLAYING state, as mute() is currently only called upon initialization of a document page, as far as I know.

Cimbali commented 1 year ago

Thanks for the fix! Can’t find the flags either, but you can just make a module-level GST_PLAYFLAGS_AUDIO constant that points to the doc page you linked.

f0k commented 1 year ago

Figured out how to inspect for the flag values.

Cimbali commented 1 year ago

Merged in 3a2726750e5c31edc040a932100b1c64e230ce02. I reworked the introspection commit to have some fallbacks as all the __-guarded values aren’t exactly public API.