Skip to content

Commit 1d0eb7c

Browse files
committed
Some corrections in docs
1 parent 05cce32 commit 1d0eb7c

File tree

8 files changed

+46
-81
lines changed

8 files changed

+46
-81
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
#Movie decoder for Python based on MoviePy
22

33
This library allows you to play and render movies in Python. It is based on the
4-
(rather excellent) [MoviePy](http://zulko.github.io/moviepy/) module created by Zulko, which offers a convenient Python interface to ffmpeg. This library should hence be able to decode any format that ffmpeg supports. If ffmpeg is not found to be installed, moviepy will download it for you on first usage, which may take some time (keep an eye on that terminal/command prompt to see the download progress).
4+
(rather excellent) [MoviePy](http://zulko.github.io/moviepy/) module created by Zulko, which offers a convenient Python interface to ffmpeg. This library should hence be able to decode any format that ffmpeg supports. If ffmpeg is not found to be installed, moviepy will download it for you on first use, which may take some time (keep an eye on that terminal/command prompt to see the download progress).
55

6-
The actual rendering of each frame one will have to implement himself, but you can use the play.py module included in this repository as an example. The `play.py` file contains an example of how to play a video using OpenGL+pygame for the video rendering and pyaudio for audio playback (using pygame.mixer is also an option, but that doesn't work smoothly yet).
6+
One will have to implement the actual rendering of each frame himself, but you can use the play.py module included in this repository as an example. The `play.py` shows how to play a video using OpenGL+pygame for the video rendering and pyaudio for audio playback (using pygame.mixer is also an option, but that doesn't work smoothly yet).
77

88
To see it run right away, you can invoke play.py with the following options:
99

docs/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
SPHINXOPTS =
66
SPHINXBUILD = sphinx-build
77
PAPER =
8-
BUILDDIR = ../../_docs/media_player_mpy
8+
BUILDDIR = ../../_docs/python-mediadecoder
99
PDFBUILDDIR = /tmp
1010
PDF = ../manual.pdf
1111

docs/source/api.rst

Lines changed: 10 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ Example player
55
--------------
66

77
.. automodule:: play
8-
:members: videoPlayer
9-
:special-members:
8+
:members: VideoPlayer
9+
:special-members: __init__
1010

1111

1212
Main classes
@@ -18,14 +18,14 @@ This is the main class that retrieves video and audio frames from MoviePy/ffmpeg
1818
You can supply Decoder with callback functions that handle stream data once it
1919
is available.
2020

21-
.. automodule:: media_player.decoder
21+
.. automodule:: mediadecoder.decoder
2222
:members:
2323
:special-members: __init__
2424

2525
Timer
2626
~~~~~
2727

28-
.. automodule:: media_player.timer
28+
.. automodule:: mediadecoder.timer
2929
:members:
3030
:special-members: __init__
3131

@@ -35,60 +35,16 @@ Sound renderers
3535
This module contains objects that handle the audio frames supplied by Decoder.
3636
At the moment, the only one that is stable is the PyAudioSoundRenderer.
3737

38-
.. automodule:: media_player.sound_renderers
39-
:members:
40-
:special-members: __init__
41-
42-
43-
OpenSesame specific classes
44-
---------------------------
45-
These classes are for internal usage when the module is used as a plugin in
46-
OpenSesame, but they can nonetheless serve as examples that demonstrate how to
47-
implement rendering for various windowing toolkits (i.e. pygame, pyglet, pyopengl)
48-
49-
50-
Pygame Handler
51-
~~~~~~~~~~~~~~
52-
Serves as a base class for the Legacy and Expyriment handlers.
53-
54-
.. automodule:: media_player.handlers.pygame_handler
55-
:members:
56-
:special-members: __init__
57-
58-
OpenGL Handler
59-
~~~~~~~~~~~~~~
60-
Serves as a base class for the Psychopy and Expyriment handlers. These use
61-
pyglet.gl and pyOpenGL respectively, but the API difference between these is marginal.
62-
This permits us to use one base class for both GL implementations.
63-
64-
.. automodule:: media_player.handlers.opengl_renderer
65-
:members:
66-
:special-members: __init__
67-
68-
Legacy Handler
69-
~~~~~~~~~~~~~~
70-
Handles rendering and event processing when the legacy backend is used. The
71-
legacy backend only uses pygame.
72-
73-
.. automodule:: media_player.handlers.legacy_handler
74-
:members:
75-
:special-members: __init__
76-
77-
Expyriment Handler
78-
~~~~~~~~~~~~~~~~~~
79-
Handles rendering and event processing when the Expyriment backend is used.
80-
The expyriment backend uses pyOpenGL for stimulus presentation, and pygame for
81-
event processing.
38+
Pygame
39+
^^^^^^
8240

83-
.. automodule:: media_player.handlers.expyriment_handler
41+
.. automodule:: mediadecoder.soundrenderers.pygamerenderer
8442
:members:
8543
:special-members: __init__
8644

87-
Psychopy Handler
88-
~~~~~~~~~~~~~~~~
89-
Handles rendering and event processing when the psychopy backend is used. Psychopy
90-
uses `pyglet` for both frame rendering and event processing.
45+
Pyaudio
46+
^^^^^^^
9147

92-
.. automodule:: media_player.handlers.psychopy_handler
48+
.. automodule:: mediadecoder.soundrenderers.pyaudiorenderer
9349
:members:
9450
:special-members: __init__

docs/source/conf.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,8 @@
2626
# add these directories to sys.path here. If the directory is relative to the
2727
# documentation root, use os.path.abspath to make it absolute, like shown here.
2828
# sys.path.insert(0, os.path.abspath('.'))
29-
30-
sys.path.insert(0, os.path.abspath("../../media_player_mpy"))
31-
import media_player
29+
sys.path.insert(0, os.path.abspath("../../"))
30+
import mediadecoder
3231

3332
# -- General configuration ------------------------------------------------
3433

@@ -70,7 +69,7 @@
7069
master_doc = 'index'
7170

7271
# General information about the project.
73-
project = u'MoviePy Media Player'
72+
project = u'MoviePy Media Decoder'
7473
copyright = u'2016, Daniel Schreij'
7574
author = u'Daniel Schreij'
7675

@@ -79,9 +78,9 @@
7978
# built documents.
8079
#
8180
# The short X.Y version.
82-
version = media_player.__version__
81+
version = mediadecoder.__version__
8382
# The full version, including alpha/beta/rc tags.
84-
release = media_player.__version__
83+
release = mediadecoder.__version__
8584

8685
# The language for content autogenerated by Sphinx. Refer to documentation
8786
# for a list of supported languages.
@@ -279,7 +278,7 @@
279278
# One entry per manual page. List of tuples
280279
# (source start file, name, description, authors, manual section).
281280
man_pages = [
282-
(master_doc, 'moviepymediaplayer', u'Moviepy Media Player Documentation',
281+
(master_doc, 'moviepymediaplayer', u'Moviepy Media Decoder Documentation',
283282
[author], 1)
284283
]
285284

@@ -293,7 +292,7 @@
293292
# (source start file, target name, title, author,
294293
# dir menu entry, description, category)
295294
texinfo_documents = [
296-
(master_doc, 'MoviepyMediaPlayer', u'Moviepy Media Player Documentation',
295+
(master_doc, 'MoviepyMediaPlayer', u'Moviepy Media Decoder Documentation',
297296
author, 'MoviepyMediaPlayer', 'One line description of project.',
298297
'Miscellaneous'),
299298
]

docs/source/dependencies.md

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,11 @@
22

33
This module depends on the following other libraries.
44

5-
- MoviePy (http://zulko.github.io/moviepy/)
6-
- pyAudio (https://people.csail.mit.edu/hubert/pyaudio/)
5+
- MoviePy (<http://zulko.github.io/moviepy/>)
6+
- pyaudio (<https://people.csail.mit.edu/hubert/pyaudio/>)
7+
- numpy (<http://www.numpy.org/>)
78

89
That should be enough to get you started when you plan to implement your own rendering functions to display the video frames. If you also want to be able to view the example provided by `play.py` you furthermore need
910

10-
- pygame (http://www.pygame.org/)
11-
- pyOpenGL (http://pyopengl.sourceforge.net/)
12-
13-
When importing as a stand alone, you may get notices that 'psychopy' or 'expyriment' were unable to be imported. Don't mind these messages because they are only relevant for when this module is used with OpenSesame.
11+
- pygame (<http://www.pygame.org/>)
12+
- pyOpenGL (<http://pyopengl.sourceforge.net/>)

docs/source/index.rst

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,25 @@
33
You can adapt this file completely to your liking, but it should at least
44
contain the root `toctree` directive.
55
6-
MoviePy Media Player documentation
7-
================================================
6+
Media decoder documentation
7+
===========================
88

9-
This library allows you to play and render movies in Python. It is based on the
10-
(rather excellent) MoviePy_ module created by Zulko, which offers a convenient Python interface to ffmpeg. This library should hence be able to render any media format that ffmpeg supports. If ffmpeg is not found to be installed, moviepy will download it for you on first usage, which may take some time (keep an eye on that terminal/command prompt to track the download progress).
9+
This library allows you to decode and render movies in Python. It is based on
10+
the (rather excellent) MoviePy_ module created by Zulko, which offers a convenient
11+
Python interface to ffmpeg. This library should hence be able to render any media
12+
format that ffmpeg supports. If ffmpeg is not found, moviepy will download it for
13+
you on first usage, which may take some time
14+
(so keep an eye on that terminal/command prompt to track the download progress).
1115

12-
This module is mainly designed to serve as a plugin for the OpenSesame_ experiment builder, but it also works on its own. The ``play.py`` contains an example of how to play a video using OpenGL+pygame for the video rendering and pyaudio for audio playback (using pygame.mixer is also an option, but that doesn't work smoothly yet). You can play a video by calling ``python play.py <path_to_videofile>`` from the command line.
16+
This library's main purpose is to decode video and/or audio files and supply the
17+
user with video and audio frames depending on the playtime of the media stream.
18+
The user thus has to take care of the rendering of these frames himself (although
19+
modules for sound rendering are included in the package.
20+
The ``play.py`` contains an example of how to play a video using OpenGL+pygame for
21+
the video rendering and pyaudio for audio playback (using pygame.mixer is also an
22+
option, but that doesn't work smoothly yet). You can play a video by calling
23+
``python play.py <path_to_videofile>`` from the command line or
24+
``python play.py -h`` to view all command line options.
1325

1426
.. toctree::
1527
:maxdepth: 2
@@ -21,5 +33,4 @@ This module is mainly designed to serve as a plugin for the OpenSesame_ experime
2133
View on Github_
2234

2335
.. _MoviePy: http://zulko.github.io/moviepy/
24-
.. _OpenSesame: http://osdoc.cogsci.nl
25-
.. _Github: https://github.com/dschreij/media_player_mpy
36+
.. _Github: https://github.com/dschreij/python-mediadecoder

mediadecoder/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
__version__ = "0.1.1"
1+
__version__ = "0.1.2"
22
__author__ = "Daniel Schreij"
33
__license__ = "MIT"
44

play.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
from mediadecoder.decoder import Decoder
1515
from mediadecoder.soundrenderers import *
1616

17-
class videoPlayer():
17+
class VideoPlayer():
1818
""" This is an example videoplayer that uses pygame+pyopengl to render a video.
1919
It uses the Decoder object to decode the video- and audiostream frame by frame.
2020
It shows each videoframe in a window and places the audioframes in a buffer
@@ -304,7 +304,7 @@ def pause(self):
304304
sys.exit(2)
305305

306306
windowRes = tuple(map(int,resolution))
307-
myVideoPlayer = videoPlayer(windowRes, fullscreen = args.fullscreen,
307+
myVideoPlayer = VideoPlayer(windowRes, fullscreen = args.fullscreen,
308308
soundrenderer = args.soundrenderer, loop=args.loop)
309309
myVideoPlayer.load_media(args.mediafile)
310310
logging.debug("Starting video")

0 commit comments

Comments
 (0)