有没有办法禁止在 GStreamer 中为视频打开一个新的 window?

Is there a way to disable opening a new window in GStreamer for videos?

我正在用 gtk 制作一个应用程序。我需要一种方法来仅播放 mp4 文件的音频。

var player = Gst.ElementFactory.make("playbin", "play");
player.uri = "http://ks4.imslp.info/files/imglnks/usimg/e/ea/IMSLP478767-PMLP776231-Plas_yn_Rhiw.mp4";
player.set_state(Gst.State.PLAYING);

我只想播放音频;我不希望 GStreamer 打开 window 来显示视频。

勾选playbinflags属性:

  flags               : Flags to control behaviour
                        flags: readable, writable
                        Flags "GstPlayFlags" Default: 0x00000617, "soft-colorbalance+deinterlace+soft-volume+text+audio+video"
                           (0x00000001): video            - Render the video stream
                           (0x00000002): audio            - Render the audio stream
                           (0x00000004): text             - Render subtitles
                           (0x00000008): vis              - Render visualisation when no video is present
                           (0x00000010): soft-volume      - Use software volume
                           (0x00000020): native-audio     - Only use native audio formats
                           (0x00000040): native-video     - Only use native video formats
                           (0x00000080): download         - Attempt progressive download buffering
                           (0x00000100): buffering        - Buffer demuxed/parsed data
                           (0x00000200): deinterlace      - Deinterlace video if necessary
                           (0x00000400): soft-colorbalance - Use software color balance
                           (0x00000800): force-filters    - Force audio/video filter(s) to be applied

因此,当您 select 排除 video 的标志组合时,它不应呈现视频路径。