diff options
author | jaseg <code@jaseg.net> | 2019-11-30 21:15:57 +0100 |
---|---|---|
committer | jaseg <code@jaseg.net> | 2019-12-01 21:25:04 +0100 |
commit | 49e6f6f6d0a3340c2664792cdb5bcc059dc24ea9 (patch) | |
tree | 1f34fa964ea79a0a75b753685bc72b580e8c5375 /README.rst | |
parent | 3d6155871447ef5c5e4d54c39eb8ff573a3b49e9 (diff) | |
download | python-mpv-49e6f6f6d0a3340c2664792cdb5bcc059dc24ea9.tar.gz python-mpv-49e6f6f6d0a3340c2664792cdb5bcc059dc24ea9.tar.bz2 python-mpv-49e6f6f6d0a3340c2664792cdb5bcc059dc24ea9.zip |
Add stream protocol handling
This allows you to directly feed bytes into mpv without going through a
file, FIFO etc. first. The new API is:
@player.register_stream_protocol(name)
@player.python_stream(name, size)
@player.python_stream_catchall
See their docstrings for their usage.
Diffstat (limited to 'README.rst')
-rw-r--r-- | README.rst | 18 |
1 files changed, 18 insertions, 0 deletions
@@ -135,6 +135,24 @@ Playlist handling print(player.playlist) player.wait_for_playback() +Directly feeding mpv data from python +..................................... + +.. code:: python + + #!/usr/bin/env python3 + import mpv + + player = mpv.MPV() + @player.python_stream('foo') + def reader(): + with open('test.webm', 'rb') as f: + while True: + yield f.read(1024*1024) + + player.play('python://foo') + player.wait_for_playback() + PyQT embedding .............. |