Python-EFL: doc infra for emotion

SVN revision: 84365
This commit is contained in:
Davide Andreoli 2013-02-25 18:46:18 +00:00
parent 309666459a
commit dccea0e2f3
5 changed files with 103 additions and 5 deletions

View File

@ -6,6 +6,6 @@ efl Package
evas/evas
ecore/ecore
edje/edje
module-emotion
emotion/emotion
elementary/elementary

View File

@ -0,0 +1,4 @@
:class:`efl.emotion.Emotion` Class
==================================
.. autoclass:: efl.emotion.Emotion

84
doc/emotion/emotion.rst Normal file
View File

@ -0,0 +1,84 @@
:mod:`efl.emotion` Module
=========================
.. automodule:: efl.emotion
What is Emotion?
----------------
Emotion is a media object library for Evas and Ecore.
Emotion is a library that allows playing audio and video files, using one of
its backends (gstreamer, xine, vlc or generic shm player).
It is integrated into Ecore through its mainloop, and is transparent to the
user of the library how the decoding of audio and video is being done. Once
the objects are created, the user can set callbacks to the specific events
and set options to this object, all in the main loop (no threads are needed).
Emotion is also integrated with Evas. The emotion object returned by
emotion_object_add() is an Evas smart object, so it can be manipulated with
default Evas object functions. Callbacks can be added to the signals emitted
by this object with evas_object_smart_callback_add().
The Emotion library uses Evas smart objects to allow you to manipulate the
created object as any other Evas object, and to connect to its signals,
handling them when needed. It's also possible to swallow Emotion objects
inside Edje themes, and expect it to behave as a normal image or rectangle
when regarding to its dimensions.
How to use the Emotion object
-----------------------------
Emotion provides an Evas smart object that allows to play, control and
display a video or audio file. The API is synchronous but not everything
happens immediately. There are also some signals to report changed states.
Basically, once the object is created and initialized, a file will be set to
it, and then it can be resized, moved, and controlled by other Evas object
functions.
However, the decoding of the music and video occurs not in the Ecore main
loop, but usually in another thread (this depends on the module being used).
The synchronization between this other thread and the main loop not visible
to the end user of the library. The user can just register callbacks to the
available signals to receive information about the changed states, and can
call other functions from the API to request more changes on the current
loaded file.
There will be a delay between an API being called and it being really
executed, since this request will be done in the main thread, and it needs to
be sent to the decoding thread. For this reason, always call functions like
emotion_object_size_get() or emotion_object_length_get() after some signal
being sent, like "playback_started" or "open_done".
.. rubric:: Available signals
The Evas_Object returned by emotion_object_add() has a number of signals that
can be listened to using evas' smart callbacks mechanism. All signals have
NULL as event info. The following is a list of interesting signals:
- ``playback_started`` Emitted when the playback starts
- ``playback_finished`` Emitted when the playback finishes
- ``frame_decode`` Emitted every time a frame is decoded
- ``open_done`` Emitted when the media file is opened
- ``position_update`` Emitted when emotion_object_position_set is called
- ``decode_stop`` Emitted after the last frame is decoded
Reference
---------
.. toctree::
:maxdepth: 4
class-emotion
Inheritance diagram
-------------------
.. inheritance-diagram::
efl.emotion
:parts: 2

View File

@ -1,4 +0,0 @@
:mod:`efl.emotion` Module
-------------------------
.. automodule:: efl.emotion

View File

@ -109,6 +109,20 @@ def shutdown():
cdef class Emotion(evasObject):
"""
The emotion object
:param evas: The canvas where the object will be added to.
:return: The emotion object just created.
The object can be manipulated as any other Evas object, using the
default efl.evas.Object manipulation functions.
The next step is to open the desired file with file_set(), and
start playing it with play_set().
"""
def __cinit__(self, *a, **ka):
self._emotion_callbacks = {}