update @version's
[profile/ivi/emotion.git] / src / lib / Emotion.h
1 #ifndef EMOTION_H
2 #define EMOTION_H
3
4 /**
5  * @file
6  * @brief Emotion Media Library
7  *
8  * These routines are used for Emotion.
9  */
10
11 /**
12  *
13  * @mainpage Emotion Library Documentation
14  *
15  * @version 1.7.0
16  * @date 2003-2012
17  *
18  * @section intro What is Emotion?
19  *
20  * A media object library for Evas and Ecore.
21  *
22  * Emotion is a library that allows playing audio and video files, using one of
23  * its backends (gstreamer or xine).
24  *
25  * It is integrated into Ecore through its mainloop, and is transparent to the
26  * user of the library how the decoding of audio and video is being done. Once
27  * the objects are created, the user can set callbacks to the specific events
28  * and set options to this object, all in the main loop (no threads are needed).
29  *
30  * Emotion is also integrated with Evas. The emotion object returned by
31  * emotion_object_add() is an Evas smart object, so it can be manipulated with
32  * default Evas object functions. Callbacks can be added to the signals emitted
33  * by this object with evas_object_smart_callback_add().
34  *
35  * @section work How does Emotion work?
36  *
37  * The Emotion library uses Evas smart objects to allow you to manipulate the
38  * created object as any other Evas object, and to connect to its signals,
39  * handling them when needed. It's also possible to swallow Emotion objects
40  * inside Edje themes, and expect it to behave as a normal image or rectangle
41  * when regarding to its dimensions.
42  *
43  * To instantiate an Emotion object, the simple code below is enough:
44  *
45  * @code
46  * em = emotion_object_add(e);
47  * emotion_object_init(em, NULL);
48  *
49  * emotion_object_file_set(em, file_path);
50  *
51  * evas_object_move(em, 0, 0);
52  * evas_object_resize(em, WIDTH, HEIGHT);
53  * evas_object_show(em);
54  *
55  * emotion_object_play_set(em, EINA_TRUE);
56  * @endcode
57  *
58  * See the @ref Emotion_API for a better reference.
59  * 
60  * Please see the @ref authors page for contact details.
61  * 
62  */
63
64 /**
65  * 
66  * @page authors Authors
67  * 
68  * @author Carsten Haitzler <raster@rasterman.com>
69  * @author Vincent Torri <torri@maths.univ-evry.fr>
70  * @author Nicolas Aguirre <aguirre.nicolas@gmail.com>
71  * @author Sebastian Dransfeld <sd@tango.flipp.net>
72  * @author Cedric Bail <cedric.bail@free.fr>
73  * 
74  * Please contact <enlightenment-devel@lists.sourceforge.net> to get in
75  * contact with the developers and maintainers.
76  * 
77  */
78
79 #include <Evas.h>
80
81 #ifdef EAPI
82 # undef EAPI
83 #endif
84
85 #ifdef _WIN32
86 # ifdef EFL_EMOTION_BUILD
87 #  ifdef DLL_EXPORT
88 #   define EAPI __declspec(dllexport)
89 #  else
90 #   define EAPI
91 #  endif /* ! DLL_EXPORT */
92 # else
93 #  define EAPI __declspec(dllimport)
94 # endif /* ! EFL_EMOTION_BUILD */
95 #else
96 # ifdef __GNUC__
97 #  if __GNUC__ >= 4
98 #   define EAPI __attribute__ ((visibility("default")))
99 #  else
100 #   define EAPI
101 #  endif
102 # else
103 #  define EAPI
104 # endif
105 #endif /* ! _WIN32 */
106
107 /**
108  * @file Emotion.h
109  * @brief The file that provides Emotion the API, with functions available for
110  *        play, seek, change volume, etc.
111  */
112
113 enum _Emotion_Module
114 {
115   EMOTION_MODULE_XINE,
116   EMOTION_MODULE_GSTREAMER
117 };
118
119 enum _Emotion_Event
120 {
121    EMOTION_EVENT_MENU1, // Escape Menu
122    EMOTION_EVENT_MENU2, // Title Menu
123    EMOTION_EVENT_MENU3, // Root Menu
124    EMOTION_EVENT_MENU4, // Subpicture Menu
125    EMOTION_EVENT_MENU5, // Audio Menu
126    EMOTION_EVENT_MENU6, // Angle Menu
127    EMOTION_EVENT_MENU7, // Part Menu
128    EMOTION_EVENT_UP,
129    EMOTION_EVENT_DOWN,
130    EMOTION_EVENT_LEFT,
131    EMOTION_EVENT_RIGHT,
132    EMOTION_EVENT_SELECT,
133    EMOTION_EVENT_NEXT,
134    EMOTION_EVENT_PREV,
135    EMOTION_EVENT_ANGLE_NEXT,
136    EMOTION_EVENT_ANGLE_PREV,
137    EMOTION_EVENT_FORCE,
138    EMOTION_EVENT_0,
139    EMOTION_EVENT_1,
140    EMOTION_EVENT_2,
141    EMOTION_EVENT_3,
142    EMOTION_EVENT_4,
143    EMOTION_EVENT_5,
144    EMOTION_EVENT_6,
145    EMOTION_EVENT_7,
146    EMOTION_EVENT_8,
147    EMOTION_EVENT_9,
148    EMOTION_EVENT_10
149 };
150
151 /**
152  * @enum _Emotion_Meta_Info
153  *
154  * Used for retrieving information about the media file being played.
155  *
156  * @see emotion_object_meta_info_get()
157  *
158  * @ingroup Emotion_Info
159  */
160 enum _Emotion_Meta_Info
161 {
162    EMOTION_META_INFO_TRACK_TITLE, /**< track title */
163    EMOTION_META_INFO_TRACK_ARTIST, /**< artist name */
164    EMOTION_META_INFO_TRACK_ALBUM, /**< album name */
165    EMOTION_META_INFO_TRACK_YEAR, /**< track year */
166    EMOTION_META_INFO_TRACK_GENRE, /**< track genre */
167    EMOTION_META_INFO_TRACK_COMMENT, /**< track comments */
168    EMOTION_META_INFO_TRACK_DISC_ID, /**< track disc ID */
169    EMOTION_META_INFO_TRACK_COUNT /**< track count - number of the track in the album */
170 };
171
172 /**
173  * @enum _Emotion_Vis
174  *
175  * Used for displaying a visualization on the emotion object.
176  *
177  * @see emotion_object_vis_set()
178  *
179  * @ingroup Emotion_Visualization
180  */
181 enum _Emotion_Vis
182 {
183   EMOTION_VIS_NONE, /**< no visualization set */
184   EMOTION_VIS_GOOM, /**< goom */
185   EMOTION_VIS_LIBVISUAL_BUMPSCOPE, /**< bumpscope */
186   EMOTION_VIS_LIBVISUAL_CORONA, /**< corona */
187   EMOTION_VIS_LIBVISUAL_DANCING_PARTICLES, /**< dancing particles */
188   EMOTION_VIS_LIBVISUAL_GDKPIXBUF, /**< gdkpixbuf */
189   EMOTION_VIS_LIBVISUAL_G_FORCE, /**< G force */
190   EMOTION_VIS_LIBVISUAL_GOOM, /**< goom */
191   EMOTION_VIS_LIBVISUAL_INFINITE, /**< infinite */
192   EMOTION_VIS_LIBVISUAL_JAKDAW, /**< jakdaw */
193   EMOTION_VIS_LIBVISUAL_JESS, /**< jess */
194   EMOTION_VIS_LIBVISUAL_LV_ANALYSER, /**< lv analyser */
195   EMOTION_VIS_LIBVISUAL_LV_FLOWER, /**< lv flower */
196   EMOTION_VIS_LIBVISUAL_LV_GLTEST, /**< lv gltest */
197   EMOTION_VIS_LIBVISUAL_LV_SCOPE, /**< lv scope */
198   EMOTION_VIS_LIBVISUAL_MADSPIN, /**< madspin */
199   EMOTION_VIS_LIBVISUAL_NEBULUS, /**< nebulus */
200   EMOTION_VIS_LIBVISUAL_OINKSIE, /**< oinksie */
201   EMOTION_VIS_LIBVISUAL_PLASMA, /**< plasma */
202   EMOTION_VIS_LAST /* sentinel */
203 };
204
205 /**
206  * @enum Emotion_Suspend
207  *
208  * Used for emotion pipeline ressource management.
209  *
210  * @see emotion_object_suspend_set()
211  * @see emotion_object_suspend_get()
212  *
213  * @ingroup Emotion_Ressource
214  */
215 typedef enum
216 {
217   EMOTION_WAKEUP, /**< pipeline is up and running */
218   EMOTION_SLEEP, /**< turn off hardware ressource usage like overlay */
219   EMOTION_DEEP_SLEEP, /**< destroy the pipeline, but keep full resolution pixels output around */
220   EMOTION_HIBERNATE /**< destroy the pipeline, and keep half resolution or object resolution if lower */
221 } Emotion_Suspend;
222
223 /**
224  * @enum _Emotion_Aspect
225  * Defines the aspect ratio option.
226  */
227 enum _Emotion_Aspect
228 {
229   EMOTION_ASPECT_KEEP_NONE, /**< ignore video aspect ratio */
230   EMOTION_ASPECT_KEEP_WIDTH, /**< respect video aspect, fitting its width inside the object width */
231   EMOTION_ASPECT_KEEP_HEIGHT, /**< respect video aspect, fitting its height inside the object height */
232   EMOTION_ASPECT_KEEP_BOTH, /**< respect video aspect, fitting it inside the object area */
233   EMOTION_ASPECT_CROP, /**< respect video aspect, cropping exceding area */
234   EMOTION_ASPECT_CUSTOM, /**< use custom borders/crop for the video */
235 };
236
237 typedef enum _Emotion_Module    Emotion_Module;
238 typedef enum _Emotion_Event     Emotion_Event;
239 typedef enum _Emotion_Meta_Info Emotion_Meta_Info; /**< Meta info type to be retrieved. */
240 typedef enum _Emotion_Vis       Emotion_Vis; /**< Type of visualization. */
241 typedef enum _Emotion_Aspect    Emotion_Aspect; /**< Aspect ratio option. */
242
243 #define EMOTION_CHANNEL_AUTO -1
244 #define EMOTION_CHANNEL_DEFAULT 0
245
246 #ifdef __cplusplus
247 extern "C" {
248 #endif
249
250 #define EMOTION_VERSION_MAJOR 1
251 #define EMOTION_VERSION_MINOR 7
252    
253    typedef struct _Emotion_Version
254      {
255         int major;
256         int minor;
257         int micro;
258         int revision;
259      } Emotion_Version;
260    
261    EAPI extern Emotion_Version *emotion_version;
262    
263 /* api calls available */
264
265 /**
266  * @brief How to create, initialize, manipulate and connect to signals of an
267  * Emotion object.
268  * @defgroup Emotion_API API available for manipulating Emotion object.
269  *
270  * @{
271  *
272  * Emotion provides an Evas smart object that allows to play, control and
273  * display a video or audio file. The API is synchronous but not everything
274  * happens immediately. There are also some signals to report changed states.
275  *
276  * Basically, once the object is created and initialized, a file will be set to
277  * it, and then it can be resized, moved, and controlled by other Evas object
278  * functions.
279  *
280  * However, the decoding of the music and video occurs not in the Ecore main
281  * loop, but usually in another thread (this depends on the module being used).
282  * The synchronization between this other thread and the main loop not visible
283  * to the end user of the library. The user can just register callbacks to the
284  * available signals to receive information about the changed states, and can
285  * call other functions from the API to request more changes on the current
286  * loaded file.
287  *
288  * There will be a delay between an API being called and it being really
289  * executed, since this request will be done in the main thread, and it needs to
290  * be sent to the decoding thread. For this reason, always call functions like
291  * emotion_object_size_get() or emotion_object_length_get() after some signal
292  * being sent, like "playback_started" or "open_done". @ref
293  * emotion_signals_example.c "This example demonstrates this behavior".
294  *
295  * @section signals Available signals
296  * The Evas_Object returned by emotion_object_add() has a number of signals that
297  * can be listened to using evas' smart callbacks mechanism. All signals have
298  * NULL as event info. The following is a list of interesting signals:
299  * @li "playback_started" - Emitted when the playback starts
300  * @li "playback_finished" - Emitted when the playback finishes
301  * @li "frame_decode" - Emitted every time a frame is decoded
302  * @li "open_done" - Emitted when the media file is opened
303  * @li "position_update" - Emitted when emotion_object_position_set is called
304  * @li "decode_stop" - Emitted after the last frame is decoded
305  *
306  * @section Examples
307  *
308  * The following examples exemplify the emotion usage. There's also the
309  * emotion_test binary that is distributed with this library and cover the
310  * entire API, but since it is too long and repetitive to be explained, its code
311  * is just displayed as another example.
312  *
313  * @li @ref emotion_basic_example_c
314  * @li @ref emotion_signals_example.c "Emotion signals"
315  * @li @ref emotion_test_main.c "emotion_test - full API usage"
316  *
317  */
318
319 /**
320  * @defgroup Emotion_Init Creation and initialization functions
321  */
322
323 /**
324  * @defgroup Emotion_Audio Audio control functions
325  */
326
327 /**
328  * @defgroup Emotion_Video Video control functions
329  */
330
331 /**
332  * @defgroup Emotion_Visualization Visualization control functions
333  */
334
335 /**
336  * @defgroup Emotion_Info Miscellaneous information retrieval functions
337  */
338
339 /**
340  * @defgroup Emotion_Ressource Video ressource management
341  */
342
343 EAPI Eina_Bool emotion_init(void);
344 EAPI Eina_Bool emotion_shutdown(void);
345
346 /**
347  * @brief Add an emotion object to the canvas.
348  *
349  * @param evas The canvas where the object will be added to.
350  * @return The emotion object just created.
351  *
352  * This function creates an emotion object and adds it to the specified @p evas.
353  * The returned object can be manipulated as any other Evas object, using the
354  * default object manipulation functions - evas_object_*.
355  *
356  * After creating the object with this function, it's still necessary to
357  * initialize it with emotion_object_init(), and if an audio file is going to be
358  * played with this object instead of a video, use
359  * emotion_object_video_mute_set().
360  *
361  * The next step is to open the desired file with emotion_object_file_set(), and
362  * start playing it with emotion_object_play_set().
363  *
364  * @see emotion_object_init()
365  * @see emotion_object_video_mute_set()
366  * @see emotion_object_file_set()
367  * @see emotion_object_play_set()
368  *
369  * @ingroup Emotion_Init
370  */
371 EAPI Evas_Object *emotion_object_add                   (Evas *evas);
372
373 /**
374  * @brief Set the specified option for the current module.
375  *
376  * @param obj The emotion object which the option is being set to.
377  * @param opt The option that is being set. Currently supported optiosn: "video"
378  * and "audio".
379  * @param val The value of the option. Currently only supports "off" (?!?!?!)
380  *
381  * This function allows one to mute the video or audio of the emotion object.
382  *
383  * @note Please don't use this function, consider using
384  * emotion_object_audio_mute_set() and emotion_object_video_mute_set() instead.
385  *
386  * @see emotion_object_audio_mute_set()
387  * @see emotion_object_video_mute_set()
388  *
389  * @ingroup Emotion_Init
390  */
391 EAPI void         emotion_object_module_option_set     (Evas_Object *obj, const char *opt, const char *val);
392
393 /**
394  * @brief Initializes an emotion object with the specified module.
395  *
396  * @param obj The emotion object to be initialized.
397  * @param module_filename The name of the module to be used (gstreamer or xine).
398  * @return @c EINA_TRUE if the specified module was successfully initialized for
399  * this object, @c EINA_FALSE otherwise.
400  *
401  * This function is required after creating the emotion object, in order to
402  * specify which module will be used with this object. Different objects can
403  * use different modules to play a media file. The current supported modules are
404  * @b gstreamer and @b xine.
405  *
406  * To use any of them, you need to make sure that support for them was compiled
407  * correctly.
408  *
409  * @note It's possible to disable the build of a module with
410  * --disable-module_name.
411  *
412  * @see emotion_object_add()
413  * @see emotion_object_file_set()
414  *
415  * @ingroup Emotion_Init
416  */
417 EAPI Eina_Bool    emotion_object_init                  (Evas_Object *obj, const char *module_filename);
418
419 /**
420  * @brief Set borders for the emotion object.
421  *
422  * @param obj The emotion object where borders are being set.
423  * @param l The left border.
424  * @param r The right border.
425  * @param t The top border.
426  * @param b The bottom border.
427  *
428  * This function sets borders for the emotion video object (just when a video is
429  * present). When positive values are given to one of the parameters, a border
430  * will be added to the respective position of the object, representing that
431  * size on the original video size. However, if the video is scaled up or down
432  * (i.e. the emotion object size is different from the video size), the borders
433  * will be scaled respectively too.
434  *
435  * If a negative value is given to one of the parameters, instead of a border,
436  * that respective side of the video will be cropped.
437  *
438  * It's possible to set a color for the added borders (default is transparent)
439  * with emotion_object_bg_color_set(). By default, an Emotion object doesn't
440  * have any border.
441  *
442  * @see emotion_object_border_get()
443  * @see emotion_object_bg_color_set()
444  *
445  * @ingroup Emotion_Video
446  */
447 EAPI void emotion_object_border_set(Evas_Object *obj, int l, int r, int t, int b);
448
449 /**
450  * @brief Get the borders set for the emotion object.
451  *
452  * @param obj The emotion object from which the borders are being retrieved.
453  * @param l The left border.
454  * @param r The right border.
455  * @param t The top border.
456  * @param b The bottom border.
457  *
458  * @see emotion_object_border_set()
459  *
460  * @ingroup Emotion_Video
461  */
462 EAPI void emotion_object_border_get(const Evas_Object *obj, int *l, int *r, int *t, int *b);
463
464 /**
465  * @brief Set a color for the background rectangle of this emotion object.
466  *
467  * @param obj The emotion object where the background color is being set.
468  * @param r Red component of the color.
469  * @param g Green component of the color.
470  * @param b Blue component of the color.
471  * @param a Alpha channel of the color.
472  *
473  * This is useful when a border is added to any side of the Emotion object. The
474  * area between the edge of the video and the edge of the object will be filled
475  * with the specified color.
476  *
477  * The default color is 0, 0, 0, 0 (transparent).
478  *
479  * @see emotion_object_bg_color_get()
480  *
481  * @ingroup Emotion_Video
482  */
483 EAPI void emotion_object_bg_color_set(Evas_Object *obj, int r, int g, int b, int a);
484
485 /**
486  * @brief Get the background color set for the emotion object.
487  *
488  * @param obj The emotion object from which the background color is being retrieved.
489  * @param r Red component of the color.
490  * @param g Green component of the color.
491  * @param b Blue component of the color.
492  * @param a AAlpha channel of the color.
493  *
494  * @see emotion_object_bg_color_set()
495  *
496  * @ingroup Emotion_Video
497  */
498 EAPI void emotion_object_bg_color_get(const Evas_Object *obj, int *r, int *g, int *b, int *a);
499
500 /**
501  * @brief Set whether emotion should keep the aspect ratio of the video.
502  *
503  * @param obj The emotion object where to set the aspect.
504  * @param a The aspect ratio policy.
505  *
506  * Instead of manually calculating the required border to set with
507  * emotion_object_border_set(), and using this to fix the aspect ratio of the
508  * video when the emotion object has a different aspect, it's possible to just
509  * set the policy to be used.
510  *
511  * The options are:
512  *
513  * - @b #EMOTION_ASPECT_KEEP_NONE - ignore the video aspect ratio, and reset any
514  *   border set to 0, stretching the video inside the emotion object area. This
515  *   option is similar to EVAS_ASPECT_CONTROL_NONE size hint.
516  * - @b #EMOTION_ASPECT_KEEP_WIDTH - respect the video aspect ratio, fitting the
517  *   video width inside the object width. This option is similar to
518  *   EVAS_ASPECT_CONTROL_HORIZONTAL size hint.
519  * - @b #EMOTION_ASPECT_KEEP_HEIGHT - respect the video aspect ratio, fitting
520  *   the video height inside the object height. This option is similar to
521  *   EVAS_ASPECT_CONTROL_VERTIAL size hint.
522  * - @b #EMOTION_ASPECT_KEEP_BOTH - respect the video aspect ratio, fitting both
523  *   its width and height inside the object area. This option is similar to
524  *   EVAS_ASPECT_CONTROL_BOTH size hint. It's the effect called letterboxing.
525  * - @b #EMOTION_ASPECT_CROP - respect the video aspect ratio, fitting the width
526  *   or height inside the object area, and cropping the exceding areas of the
527  *   video in height or width. It's the effect called pan-and-scan.
528  * - @b #EMOTION_ASPECT_CUSTOM - ignore the video aspect ratio, and use the
529  *   current set from emotion_object_border_set().
530  *
531  * @note Calling this function with any value except #EMOTION_ASPECT_CUSTOM will
532  * invalidate borders set with emotion_object_border_set().
533  *
534  * @note Calling emotion_object_border_set() will automatically set the aspect
535  * policy to #EMOTION_ASPECT_CUSTOM.
536  *
537  * @see emotion_object_border_set()
538  * @see emotion_object_keep_aspect_get()
539  *
540  * @ingroup Emotion_Video
541  */
542 EAPI void emotion_object_keep_aspect_set(Evas_Object *obj, Emotion_Aspect a);
543
544 /**
545  * @brief Get the current emotion aspect ratio policy.
546  *
547  * @param obj The emotion object from which we are fetching the aspect ratio
548  * policy.
549  * @return The current aspect ratio policy.
550  *
551  * @see emotion_object_keep_aspect_set()
552  *
553  * @ingroup Emotion_Video
554  */
555 EAPI Emotion_Aspect emotion_object_keep_aspect_get(const Evas_Object *obj);
556
557 /**
558  * @brief Set the file to be played in the Emotion object.
559  *
560  * @param obj The emotion object where the file is being loaded.
561  * @param filename Path to the file to be loaded. It can be absolute or relative
562  * path.
563  * @return EINA_TRUE if the new file could be loaded successfully, and
564  * EINA_FALSE if the file could not be loaded. This happens when the filename is
565  * could not be found, when the module couldn't open the file, when no module is
566  * initialized in this object, or when the @p filename is the same as the
567  * one previously set.
568  *
569  * This function sets the file to be used with this emotion object. If the
570  * object already has another file set, this file will be unset and unloaded,
571  * and the new file will be loaded to this emotion object. The seek position
572  * will be set to 0, and the emotion object will be paused, instead of playing.
573  *
574  * If there was already a filename set, and it's the same as the one being set
575  * now, this function does nothing and returns EINA_FALSE.
576  *
577  * Use @c NULL as argument to @p filename if you want to unload the current file
578  * but don't want to load anything else.
579  *
580  * @see emotion_object_init()
581  * @see emotion_object_play_set()
582  * @see emotion_object_file_get()
583  *
584  * @ingroup Emotion_Init
585  */
586 EAPI Eina_Bool    emotion_object_file_set              (Evas_Object *obj, const char *filename);
587
588 /**
589  * @brief Get the filename of the file associated with the emotion object.
590  *
591  * @param obj The emotion object from which the filename will be retrieved.
592  * @return The path to the file loaded into this emotion object.
593  *
594  * This function returns the path of the file loaded in this emotion object. If
595  * no object is loaded, it will return @c NULL.
596  *
597  * @note Don't free or change the string returned by this function in any way.
598  * If you want to unset it, use @c emotion_object_file_set(obj, NULL).
599  *
600  * @see emotion_object_file_set()
601  *
602  * @ingroup Emotion_Init
603  */
604 EAPI const char  *emotion_object_file_get              (const Evas_Object *obj);
605 /**
606  * @defgroup Emotion_Play Play control functions
607  *
608  * @{
609  */
610 /**
611  *
612  * @brief Set play/pause state of the media file.
613  *
614  * @param obj The emotion object whose state will be changed.
615  * @param play EINA_TRUE to play, EINA_FALSE to pause.
616  *
617  * This functions sets the currently playing status of the video. Using this
618  * function to play or pause the video doesn't alter it's current position.
619  */
620 EAPI void         emotion_object_play_set              (Evas_Object *obj, Eina_Bool play);
621 /**
622  * @brief Get play/pause state of the media file.
623  *
624  * @param obj The emotion object from which the state will be retrieved.
625  * @return EINA_TRUE if playing. EINA_FALSE if not playing.
626  */
627 EAPI Eina_Bool    emotion_object_play_get              (const Evas_Object *obj);
628 /**
629  * @brief Set the position in the media file.
630  *
631  * @param obj The emotion object whose position will be changed.
632  * @param sec The position(in seconds) to which the media file will be set.
633  *
634  * This functions sets the current position of the media file to @p sec, this
635  * only works on seekable streams. Setting the position doesn't change the
636  * playing state of the media file.
637  *
638  * @see emotion_object_seekable_get
639  */
640 EAPI void         emotion_object_position_set          (Evas_Object *obj, double sec);
641 /**
642  * @brief Get the position in the media file.
643  *
644  * @param obj The emotion object from which the position will be retrieved.
645  * @return The position of the media file.
646  *
647  * The position is returned as the number of seconds since the beginning of the
648  * media file.
649  */
650 EAPI double       emotion_object_position_get          (const Evas_Object *obj);
651
652 /**
653  * @brief Get the percentual size of the buffering cache.
654  *
655  * @param obj The emotion object from which the buffer size will be retrieved.
656  * @return The buffer percent size, ranging from 0.0 to 1.0
657  *
658  * The buffer size is returned as a number between 0.0 and 1.0, 0.0 means
659  * the buffer if empty, 1.0 means full.
660  * If no buffering is in progress 1.0 is returned. In all other cases (maybe
661  * the backend don't support buffering) 1.0 is returned, thus you can always
662  * check for buffer_size < 1.0 to know if buffering is in progress.
663  *
664  * @warning Generic backend don't implement this (will return 1.0).
665  */
666 EAPI double       emotion_object_buffer_size_get       (const Evas_Object *obj);
667
668 /**
669  * @brief Get whether the media file is seekable.
670  *
671  * @param obj The emotion object from which the seekable status will be
672  * retrieved.
673  * @return EINA_TRUE if the media file is seekable, EINA_FALSE otherwise.
674  */
675 EAPI Eina_Bool    emotion_object_seekable_get          (const Evas_Object *obj);
676 /**
677  * @brief Get the length of play for the media file.
678  *
679  * @param obj The emotion object from which the length will be retrieved.
680  * @return The length of the media file in seconds.
681  *
682  * This function returns the length of the media file in seconds.
683  *
684  * @warning This will return 0 if called before the "length_change" signal has,
685  * been emitted.
686  */
687 EAPI double       emotion_object_play_length_get       (const Evas_Object *obj);
688
689 /**
690  * @brief Set the play speed of the media file.
691  *
692  * @param obj The emotion object whose speed will be set.
693  * @param speed The speed to be set in the range [0,infinity)
694  *
695  * This function sets the speed with which the media file will be played. 1.0
696  * represents the normal speed, 2 double speed, 0.5 half speed and so on.
697  *
698  * @warning The only backend that implements this is the experimental VLC
699  * backend.
700  */
701 EAPI void         emotion_object_play_speed_set        (Evas_Object *obj, double speed);
702 /**
703  * @brief Get  the play speed of the media file.
704  *
705  * @param obj The emotion object from which the filename will be retrieved.
706  * @return The current speed of the media file.
707  *
708  * @see emotion_object_play_speed_set
709  */
710 EAPI double       emotion_object_play_speed_get        (const Evas_Object *obj);
711 /**
712  * @brief Get how much of the file has been played.
713  *
714  * @param obj The emotion object from which the filename will be retrieved.
715  * @return The progress of the media file.
716  *
717  * @warning Don't change of free the returned string.
718  * @warning gstreamer xine backends don't implement this(will return NULL).
719  */
720 EAPI const char  *emotion_object_progress_info_get     (const Evas_Object *obj);
721 /**
722  * @brief Get how much of the file has been played.
723  *
724  * @param obj The emotion object from which the filename will be retrieved
725  * @return The progress of the media file.
726  *
727  * This function gets the progress in playing the file, the return value is in
728  * the [0, 1] range.
729  *
730  * @warning gstreamer xine backends don't implement this(will return 0).
731  */
732 EAPI double       emotion_object_progress_status_get   (const Evas_Object *obj);
733 /**
734  * @}
735  */
736 EAPI Eina_Bool    emotion_object_video_handled_get     (const Evas_Object *obj);
737 EAPI Eina_Bool    emotion_object_audio_handled_get     (const Evas_Object *obj);
738
739 /**
740  * @brief Retrieve the video aspect ratio of the media file loaded.
741  *
742  * @param obj The emotion object which the video aspect ratio will be retrieved
743  * from.
744  * @return The video aspect ratio of the file loaded.
745  *
746  * This function returns the video aspect ratio (width / height) of the file
747  * loaded. It can be used to adapt the size of the emotion object in the canvas,
748  * so the aspect won't be changed (by wrongly resizing the object). Or to crop
749  * the video correctly, if necessary.
750  *
751  * The described behavior can be applied like following. Consider a given
752  * emotion object that we want to position inside an area, which we will
753  * represent by @c w and @c h. Since we want to position this object either
754  * stretching, or filling the entire area but overflowing the video, or just
755  * adjust the video to fit inside the area without keeping the aspect ratio, we
756  * must compare the video aspect ratio with the area aspect ratio:
757  * @code
758  * int w = 200, h = 300; // an arbitrary value which represents the area where
759  *                       // the video would be placed
760  * int vw, vh;
761  * double r, vr = emotion_object_ratio_get(obj);
762  * r = (double)w / h;
763  * @endcode
764  *
765  * Now, if we want to make the video fit inside the area, the following code
766  * would do it:
767  * @code
768  * if (vr > r) // the video is wider than the area
769  *   {
770  *      vw = w;
771  *      vh = w / vr;
772  *   }
773  * else // the video is taller than the area
774  *   {
775  *      vh = h;
776  *      vw = h * vr;
777  *   }
778  * evas_object_resize(obj, vw, vh);
779  * @endcode
780  *
781  * And for keeping the aspect ratio but making the video fill the entire area,
782  * overflowing the content which can't fit inside it, we would do:
783  * @code
784  * if (vr > r) // the video is wider than the area
785  *   {
786  *      vh = h;
787  *      vw = h * vr;
788  *   }
789  * else // the video is taller than the area
790  *   {
791  *      vw = w;
792  *      vh = w / vr;
793  *   }
794  * evas_object_resize(obj, vw, vh);
795  * @endcode
796  *
797  * Finally, by just resizing the video to the video area, we would have the
798  * video stretched:
799  * @code
800  * vw = w;
801  * vh = h;
802  * evas_object_resize(obj, vw, vh);
803  * @endcode
804  *
805  * The following diagram exemplifies what would happen to the video,
806  * respectively, in each case:
807  *
808  * @image html emotion_ratio.png
809  * @image latex emotion_ratio.eps width=\textwidth
810  *
811  * @note This function returns the aspect ratio that the video @b should be, but
812  * sometimes the reported size from emotion_object_size_get() represents a
813  * different aspect ratio. You can safely resize the video to respect the aspect
814  * ratio returned by @b this function.
815  *
816  * @see emotion_object_size_get()
817  *
818  * @ingroup Emotion_Video
819  */
820 EAPI double       emotion_object_ratio_get             (const Evas_Object *obj);
821
822 /**
823  * @brief Retrieve the video size of the loaded file.
824  *
825  * @param obj The object from which we are retrieving the video size.
826  * @param iw A pointer to a variable where the width will be stored.
827  * @param ih A pointer to a variable where the height will be stored.
828  *
829  * This function returns the reported size of the loaded video file. If a file
830  * that doesn't contain a video channel is loaded, then this size can be
831  * ignored.
832  *
833  * The value reported by this function should be consistent with the aspect
834  * ratio returned by emotion_object_ratio_get(), but sometimes the information
835  * stored in the file is wrong. So use the ratio size reported by
836  * emotion_object_ratio_get(), since it is more likely going to be accurate.
837  *
838  * @note Use @c NULL for @p iw or @p ih if you don't need one of these values.
839  *
840  * @see emotion_object_ratio_get()
841  *
842  * @ingroup Emotion_Video
843  */
844 EAPI void         emotion_object_size_get              (const Evas_Object *obj, int *iw, int *ih);
845
846 /**
847  * @brief Sets whether to use of high-quality image scaling algorithm
848  * of the given video object.
849  *
850  * When enabled, a higher quality video scaling algorithm is used when
851  * scaling videos to sizes other than the source video. This gives
852  * better results but is more computationally expensive.
853  *
854  * @param obj The given video object.
855  * @param smooth Whether to use smooth scale or not.
856  *
857  * @see emotion_object_smooth_scale_get()
858  *
859  * @ingroup Emotion_Video
860  */
861 EAPI void         emotion_object_smooth_scale_set      (Evas_Object *obj, Eina_Bool smooth);
862
863 /**
864  * @brief Gets whether the high-quality image scaling algorithm
865  * of the given video object is used.
866  *
867  * @param obj The given video object.
868  * @return Whether the smooth scale is used or not.
869  *
870  * @see emotion_object_smooth_scale_set()
871  *
872  * @ingroup Emotion_Video
873  */
874 EAPI Eina_Bool    emotion_object_smooth_scale_get      (const Evas_Object *obj);
875 EAPI void         emotion_object_event_simple_send     (Evas_Object *obj, Emotion_Event ev);
876
877 /**
878  * @brief Set the audio volume.
879  *
880  * @param obj The object where the volume is being set.
881  * @param vol The new volume parameter. Range is from 0.0 to 1.0.
882  *
883  * Sets the audio volume of the stream being played. This has nothing to do with
884  * the system volume. This volume will be multiplied by the system volume. e.g.:
885  * if the current volume level is 0.5, and the system volume is 50%, it will be
886  * 0.5 * 0.5 = 0.25.
887  *
888  * The default value depends on the module used. This value doesn't get changed
889  * when another file is loaded.
890  *
891  * @see emotion_object_audio_volume_get()
892  *
893  * @ingroup Emotion_Audio
894  */
895 EAPI void         emotion_object_audio_volume_set      (Evas_Object *obj, double vol);
896
897 /**
898  * @brief Get the audio volume.
899  *
900  * @param obj The object from which we are retrieving the volume.
901  * @return The current audio volume level for this object.
902  *
903  * Get the current value for the audio volume level. Range is from 0.0 to 1.0.
904  * This volume is set with emotion_object_audio_volume_set().
905  *
906  * @see emotion_object_audio_volume_set()
907  *
908  * @ingroup Emotion_Audio
909  */
910 EAPI double       emotion_object_audio_volume_get      (const Evas_Object *obj);
911
912 /**
913  * @brief Set the mute audio option for this object.
914  *
915  * @param obj The object which we are setting the mute audio option.
916  * @param mute Whether the audio should be muted (@c EINA_TRUE) or not (@c
917  * EINA_FALSE).
918  *
919  * This function sets the mute audio option for this emotion object. The current
920  * module used for this object can use this to avoid decoding the audio portion
921  * of the loaded media file.
922  *
923  * @see emotion_object_audio_mute_get()
924  * @see emotion_object_video_mute_set()
925  *
926  * @ingroup Emotion_Audio
927  */
928 EAPI void         emotion_object_audio_mute_set        (Evas_Object *obj, Eina_Bool mute);
929
930 /**
931  * @brief Get the mute audio option of this object.
932  *
933  * @param obj The object which we are retrieving the mute audio option from.
934  * @return Whether the audio is muted (@c EINA_TRUE) or not (@c EINA_FALSE).
935  *
936  * This function return the mute audio option from this emotion object. It can
937  * be set with emotion_object_audio_mute_set().
938  *
939  * @see emotion_object_audio_mute_set()
940  *
941  * @ingroup Emotion_Audio
942  */
943 EAPI Eina_Bool    emotion_object_audio_mute_get        (const Evas_Object *obj);
944 EAPI int          emotion_object_audio_channel_count   (const Evas_Object *obj);
945 EAPI const char  *emotion_object_audio_channel_name_get(const Evas_Object *obj, int channel);
946 EAPI void         emotion_object_audio_channel_set     (Evas_Object *obj, int channel);
947 EAPI int          emotion_object_audio_channel_get     (const Evas_Object *obj);
948
949 /**
950  * @brief Set the mute video option for this object.
951  *
952  * @param obj The object which we are setting the mute video option.
953  * @param mute Whether the video should be muted (@c EINA_TRUE) or not (@c
954  * EINA_FALSE).
955  *
956  * This function sets the mute video option for this emotion object. The
957  * current module used for this object can use this information to avoid
958  * decoding the video portion of the loaded media file.
959  *
960  * @see emotion_object_video_mute_get()
961  * @see emotion_object_audio_mute_set()
962  *
963  * @ingroup Emotion_Video
964  */
965 EAPI void         emotion_object_video_mute_set        (Evas_Object *obj, Eina_Bool mute);
966
967 /**
968  * @brief Get the mute video option of this object.
969  *
970  * @param obj The object which we are retrieving the mute video option from.
971  * @return Whether the video is muted (@c EINA_TRUE) or not (@c EINA_FALSE).
972  *
973  * This function returns the mute video option from this emotion object. It can
974  * be set with emotion_object_video_mute_set().
975  *
976  * @see emotion_object_video_mute_set()
977  *
978  * @ingroup Emotion_Video
979  */
980 EAPI Eina_Bool    emotion_object_video_mute_get        (const Evas_Object *obj);
981
982 /**
983  * @brief Get the number of available video channel
984  *
985  * @param obj The object which we are retrieving the channel count from
986  * @return the number of available channel.
987  *
988  * @see emotion_object_video_channel_name_get()
989  *
990  * @ingroup Emotion_Video
991  */
992 EAPI int          emotion_object_video_channel_count   (const Evas_Object *obj);
993 EAPI const char  *emotion_object_video_channel_name_get(const Evas_Object *obj, int channel);
994 EAPI void         emotion_object_video_channel_set     (Evas_Object *obj, int channel);
995 EAPI int          emotion_object_video_channel_get     (const Evas_Object *obj);
996 EAPI void         emotion_object_spu_mute_set          (Evas_Object *obj, Eina_Bool mute);
997 EAPI Eina_Bool    emotion_object_spu_mute_get          (const Evas_Object *obj);
998 EAPI int          emotion_object_spu_channel_count     (const Evas_Object *obj);
999 EAPI const char  *emotion_object_spu_channel_name_get  (const Evas_Object *obj, int channel);
1000 EAPI void         emotion_object_spu_channel_set       (Evas_Object *obj, int channel);
1001 EAPI int          emotion_object_spu_channel_get       (const Evas_Object *obj);
1002 EAPI int          emotion_object_chapter_count         (const Evas_Object *obj);
1003 EAPI void         emotion_object_chapter_set           (Evas_Object *obj, int chapter);
1004 EAPI int          emotion_object_chapter_get           (const Evas_Object *obj);
1005 EAPI const char  *emotion_object_chapter_name_get      (const Evas_Object *obj, int chapter);
1006 EAPI void         emotion_object_eject                 (Evas_Object *obj);
1007
1008 /**
1009  * @brief Get the dvd title from this emotion object.
1010  *
1011  * @param obj The object which the title will be retrieved from.
1012  * @return A string containing the title.
1013  *
1014  * This function is only useful when playing a DVD.
1015  *
1016  * @note Don't change or free the string returned by this function.
1017  *
1018  * @ingroup Emotion_Info
1019  */
1020 EAPI const char  *emotion_object_title_get             (const Evas_Object *obj);
1021 EAPI const char  *emotion_object_ref_file_get          (const Evas_Object *obj);
1022 EAPI int          emotion_object_ref_num_get           (const Evas_Object *obj);
1023 EAPI int          emotion_object_spu_button_count_get  (const Evas_Object *obj);
1024 EAPI int          emotion_object_spu_button_get        (const Evas_Object *obj);
1025
1026 /**
1027  * @brief Retrieve meta information from this file being played.
1028  *
1029  * @param obj The object which the meta info will be extracted from.
1030  * @param meta The type of meta information that will be extracted.
1031  *
1032  * This function retrieves information about the file loaded. It can retrieve
1033  * the track title, artist name, album name, etc. See @ref Emotion_Meta_Info
1034  * for all the possibilities.
1035  *
1036  * The meta info may be not available on all types of files. It will return @c
1037  * NULL if the the file doesn't have meta info, or if this specific field is
1038  * empty.
1039  *
1040  * @note Don't change or free the string returned by this function.
1041  *
1042  * @see Emotion_Meta_Info
1043  *
1044  * @ingroup Emotion_Info
1045  */
1046 EAPI const char  *emotion_object_meta_info_get         (const Evas_Object *obj, Emotion_Meta_Info meta);
1047
1048 /**
1049  * @brief Set the visualization to be used with this object.
1050  *
1051  * @param obj The object where the visualization will be set on.
1052  * @param visualization The type of visualization to be used.
1053  *
1054  * The @p visualization specified will be played instead of a video. This is
1055  * commonly used to display a visualization for audio only files (musics).
1056  *
1057  * The available visualizations are @ref Emotion_Vis.
1058  *
1059  * @see Emotion_Vis
1060  * @see emotion_object_vis_get()
1061  * @see emotion_object_vis_supported()
1062  *
1063  * @ingroup Emotion_Visualization
1064  */
1065 EAPI void         emotion_object_vis_set               (Evas_Object *obj, Emotion_Vis visualization);
1066
1067 /**
1068  * @brief Get the type of visualization in use by this emotion object.
1069  *
1070  * @param obj The emotion object which the visualization is being retrieved
1071  * from.
1072  * @return The type of visualization in use by this object.
1073  *
1074  * The type of visualization can be set by emotion_object_vis_set().
1075  *
1076  * @see Emotion_Vis
1077  * @see emotion_object_vis_set()
1078  * @see emotion_object_vis_supported()
1079  *
1080  * @ingroup Emotion_Visualization
1081  */
1082 EAPI Emotion_Vis  emotion_object_vis_get               (const Evas_Object *obj);
1083
1084 /**
1085  * @brief Query whether a type of visualization is supported by this object.
1086  *
1087  * @param obj The object which the query is being ran on.
1088  * @param visualization The type of visualization that is being queried.
1089  * @return EINA_TRUE if the visualization is supported, EINA_FALSE otherwise.
1090  *
1091  * This can be used to check if a visualization is supported. e.g.: one wants to
1092  * display a list of available visualizations for a specific object.
1093  *
1094  * @see Emotion_Vis
1095  * @see emotion_object_vis_set()
1096  * @see emotion_object_vis_get()
1097  *
1098  * @ingroup Emotion_Visualization
1099  */
1100 EAPI Eina_Bool    emotion_object_vis_supported         (const Evas_Object *obj, Emotion_Vis visualization);
1101
1102 /**
1103  * @brief Raise priority of an object so it will have a priviledged access to hardware ressource.
1104  *
1105  * @param obj The object which the query is being ran on.
1106  * @param priority EINA_TRUE means give me a priority access to the hardware ressource.
1107  *
1108  * Hardware have a few dedicated hardware pipeline that process the video at no cost for the CPU.
1109  * Especially on SoC, you mostly have one (on mobile phone SoC) or two (on Set Top Box SoC) when
1110  * Picture in Picture is needed. And most application just have a few video stream that really
1111  * deserve high frame rate, hiogh quality output. That's why this call is for.
1112  *
1113  * Please note that if Emotion can't acquire a priviledged hardware ressource, it will fallback
1114  * to the no-priority path. This work on the first asking first get basis system.
1115  *
1116  * @see emotion_object_priority_get()
1117  *
1118  * @ingroup Emotion_Ressource
1119  */
1120 EAPI void         emotion_object_priority_set(Evas_Object *obj, Eina_Bool priority);
1121
1122 /**
1123  * @brief Get the actual priority of an object.
1124  *
1125  * @param obj The object which the query is being ran on.
1126  * @return EINA_TRUE if the object has a priority access to the hardware.
1127  *
1128  * This actually return the priority status of an object. If it failed to have a priviledged
1129  * access to the hardware, it will return EINA_FALSE.
1130  *
1131  * @see emotion_object_priority_get()
1132  *
1133  * @ingroup Emotion_Ressource
1134  */
1135 EAPI Eina_Bool    emotion_object_priority_get(const Evas_Object *obj);
1136
1137 /**
1138  * @brief Change the state of an object pipeline.
1139  *
1140  * @param obj The object which the query is being ran on.
1141  * @param state The new state for the object.
1142  *
1143  * Changing the state of a pipeline should help preserve the battery of an embedded device.
1144  * But it will only work sanely if the pipeline is not playing at the time you change its
1145  * state. Depending on the engine all state may be not implemented.
1146  *
1147  * @see Emotion_Suspend
1148  * @see emotion_object_suspend_get()
1149  *
1150  * @ingroup Emotion_Ressource
1151  */
1152 EAPI void         emotion_object_suspend_set(Evas_Object *obj, Emotion_Suspend state);
1153
1154 /**
1155  * @brief Get the current state of the pipeline
1156  *
1157  * @param obj The object which the query is being ran on.
1158  * @return the current state of the pipeline.
1159  *
1160  * @see Emotion_Suspend
1161  * @see emotion_object_suspend_set()
1162  *
1163  * @ingroup Emotion_Ressource
1164  */
1165 EAPI Emotion_Suspend emotion_object_suspend_get(Evas_Object *obj);
1166
1167 /**
1168  * @brief Load the last known position if available
1169  *
1170  * @param obj The object which the query is being ran on.
1171  *
1172  * By using Xattr, Emotion is able, if the system permitt it, to store and retrieve
1173  * the latest position. It should trigger some smart callback to let the application
1174  * know when it succeed or fail. Every operation is fully asynchronous and not
1175  * linked to the actual engine used to play the vide.
1176  *
1177  * @see emotion_object_last_position_save()
1178  *
1179  * @ingroup Emotion_Info
1180  */
1181 EAPI void         emotion_object_last_position_load(Evas_Object *obj);
1182
1183 /**
1184  * @brief Save the lastest position if possible
1185  *
1186  * @param obj The object which the query is being ran on.
1187  *
1188  * By using Xattr, Emotion is able, if the system permitt it, to store and retrieve
1189  * the latest position. It should trigger some smart callback to let the application
1190  * know when it succeed or fail. Every operation is fully asynchronous and not
1191  * linked to the actual engine used to play the vide.
1192  *
1193  * @see emotion_object_last_position_load()
1194  *
1195  * @ingroup Emotion_Info
1196  */
1197 EAPI void         emotion_object_last_position_save(Evas_Object *obj);
1198
1199 /**
1200  * @brief Do we have a chance to play that file
1201  *
1202  * @param file A stringshared filename that we want to know if Emotion can play.
1203  *
1204  * This just actually look at the extention of the file, it doesn't check the mime-type
1205  * nor if the file is actually sane. So this is just an hint for your application.
1206  *
1207  * @see emotion_object_extension_may_play_get()
1208  */
1209 EAPI Eina_Bool    emotion_object_extension_may_play_fast_get(const char *file);
1210
1211 /**
1212  * @brief Do we have a chance to play that file
1213  *
1214  * @param file A filename that we want to know if Emotion can play.
1215  *
1216  * This just actually look at the extention of the file, it doesn't check the mime-type
1217  * nor if the file is actually sane. So this is just an hint for your application.
1218  *
1219  * @see emotion_object_extension_may_play_fast_get()
1220  */
1221 EAPI Eina_Bool    emotion_object_extension_may_play_get(const char *file);
1222
1223 /**
1224  * @brief Get the actual image object that contains the pixels of the video stream
1225  *
1226  * @param obj The object which the query is being ran on.
1227  *
1228  * This function is usefull when you want to get a direct access to the pixels.
1229  *
1230  * @see emotion_object_image_get()
1231  */
1232 EAPI Evas_Object *emotion_object_image_get(const Evas_Object *obj);
1233
1234 /**
1235  * @defgroup Emotion_Webcam API available for accessing webcam
1236  */
1237
1238 typedef struct _Emotion_Webcam Emotion_Webcam; /**< Webcam description */
1239
1240 EAPI extern int EMOTION_WEBCAM_UPDATE; /**< Ecore_Event triggered when a new webcam is plugged in */
1241
1242 /**
1243  * @brief Get a list of active and available webcam
1244  *
1245  * @return the list of available webcam at the time of the call.
1246  *
1247  * It will return the current live list of webcam. It is updated before
1248  * triggering EMOTION_WEBCAM_UPDATE and should never be modified.
1249  *
1250  * @ingroup Emotion_Webcam
1251  */
1252 EAPI const Eina_List *emotion_webcams_get(void);
1253
1254 /**
1255  * @brief Get the human understandable name of a Webcam
1256  *
1257  * @param ew The webcam to get the name from.
1258  * @return the actual human readable name.
1259  *
1260  * @ingroup Emotion_Webcam
1261  */
1262 EAPI const char      *emotion_webcam_name_get(const Emotion_Webcam *ew);
1263
1264 /**
1265  * @brief Get the uri of a Webcam that will be understood by emotion
1266  *
1267  * @param ew The webcam to get the uri from.
1268  * @return the actual uri that emotion will later understood.
1269  *
1270  * @ingroup Emotion_Webcam
1271  */
1272 EAPI const char      *emotion_webcam_device_get(const Emotion_Webcam *ew);
1273
1274 /**
1275  * @}
1276  */
1277
1278 #ifdef __cplusplus
1279 }
1280 #endif
1281
1282 #endif