Package upload
[framework/uifw/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 0.2.0
16  * @date 2003-2011
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 enum _Emotion_Aspect
224 {
225   EMOTION_ASPECT_KEEP_NONE, /**< ignore video aspect ratio */
226   EMOTION_ASPECT_KEEP_WIDTH, /**< respect video aspect, fitting its width inside the object width */
227   EMOTION_ASPECT_KEEP_HEIGHT, /**< respect video aspect, fitting its height inside the object height */
228   EMOTION_ASPECT_KEEP_BOTH, /**< respect video aspect, fitting it inside the object area */
229   EMOTION_ASPECT_CROP, /**< respect video aspect, cropping exceding area */
230   EMOTION_ASPECT_CUSTOM, /**< use custom borders/crop for the video */
231 };
232
233 typedef enum _Emotion_Module    Emotion_Module;
234 typedef enum _Emotion_Event     Emotion_Event;
235 typedef enum _Emotion_Meta_Info Emotion_Meta_Info; /**< Meta info type to be retrieved. */
236 typedef enum _Emotion_Vis       Emotion_Vis; /**< Type of visualization. */
237 typedef enum _Emotion_Aspect    Emotion_Aspect; /**< Aspect ratio option. */
238
239 #define EMOTION_CHANNEL_AUTO -1
240 #define EMOTION_CHANNEL_DEFAULT 0
241
242 #ifdef __cplusplus
243 extern "C" {
244 #endif
245
246 /* api calls available */
247
248 /**
249  * @brief How to create, initialize, manipulate and connect to signals of an
250  * Emotion object.
251  * @defgroup Emotion_API API available for manipulating Emotion object.
252  *
253  * @{
254  *
255  * Emotion provides an Evas smart object that allows to play, control and
256  * display a video or audio file. The API is synchronous but not everything
257  * happens immediately. There are also some signals to report changed states.
258  *
259  * Basically, once the object is created and initialized, a file will be set to
260  * it, and then it can be resized, moved, and controlled by other Evas object
261  * functions.
262  *
263  * However, the decoding of the music and video occurs not in the Ecore main
264  * loop, but usually in another thread (this depends on the module being used).
265  * The synchronization between this other thread and the main loop not visible
266  * to the end user of the library. The user can just register callbacks to the
267  * available signals to receive information about the changed states, and can
268  * call other functions from the API to request more changes on the current
269  * loaded file.
270  *
271  * There will be a delay between an API being called and it being really
272  * executed, since this request will be done in the main thread, and it needs to
273  * be sent to the decoding thread. For this reason, always call functions like
274  * emotion_object_size_get() or emotion_object_length_get() after some signal
275  * being sent, like "playback_started" or "open_done". @ref
276  * emotion_signals_example.c "This example demonstrates this behavior".
277  *
278  * @section signals Available signals
279  * The Evas_Object returned by emotion_object_add() has a number of signals that
280  * can be listened to using evas' smart callbacks mechanism. All signals have
281  * NULL as event info. The following is a list of interesting signals:
282  * @li "playback_started" - Emitted when the playback starts
283  * @li "playback_finished" - Emitted when the playback finishes
284  * @li "frame_decode" - Emitted every time a frame is decoded
285  * @li "open_done" - Emitted when the media file is opened
286  * @li "position_update" - Emitted when emotion_object_position_set is called
287  * @li "decode_stop" - Emitted after the last frame is decoded
288  *
289  * @section Examples
290  *
291  * The following examples exemplify the emotion usage. There's also the
292  * emotion_test binary that is distributed with this library and cover the
293  * entire API, but since it is too long and repetitive to be explained, its code
294  * is just displayed as another example.
295  *
296  * @li @ref emotion_basic_example_c
297  * @li @ref emotion_signals_example.c "Emotion signals"
298  * @li @ref emotion_test_main.c "emotion_test - full API usage"
299  *
300  */
301
302 /**
303  * @defgroup Emotion_Init Creation and initialization functions
304  */
305
306 /**
307  * @defgroup Emotion_Audio Audio control functions
308  */
309
310 /**
311  * @defgroup Emotion_Video Video control functions
312  */
313
314 /**
315  * @defgroup Emotion_Visualization Visualization control functions
316  */
317
318 /**
319  * @defgroup Emotion_Info Miscellaneous information retrieval functions
320  */
321
322 /**
323  * @defgroup Emotion_Ressource Video ressource management
324  */
325
326 EAPI Eina_Bool emotion_init(void);
327 EAPI Eina_Bool emotion_shutdown(void);
328
329 /**
330  * @brief Add an emotion object to the canvas.
331  *
332  * @param evas The canvas where the object will be added to.
333  * @return The emotion object just created.
334  *
335  * This function creates an emotion object and adds it to the specified @p evas.
336  * The returned object can be manipulated as any other Evas object, using the
337  * default object manipulation functions - evas_object_*.
338  *
339  * After creating the object with this function, it's still necessary to
340  * initialize it with emotion_object_init(), and if an audio file is going to be
341  * played with this object instead of a video, use
342  * emotion_object_video_mute_set().
343  *
344  * The next step is to open the desired file with emotion_object_file_set(), and
345  * start playing it with emotion_object_play_set().
346  *
347  * @see emotion_object_init()
348  * @see emotion_object_video_mute_set()
349  * @see emotion_object_file_set()
350  * @see emotion_object_play_set()
351  *
352  * @ingroup Emotion_Init
353  */
354 EAPI Evas_Object *emotion_object_add                   (Evas *evas);
355
356 /**
357  * @brief Set the specified option for the current module.
358  *
359  * @param obj The emotion object which the option is being set to.
360  * @param opt The option that is being set. Currently supported optiosn: "video"
361  * and "audio".
362  * @param val The value of the option. Currently only supports "off" (?!?!?!)
363  *
364  * This function allows one to mute the video or audio of the emotion object.
365  *
366  * @note Please don't use this function, consider using
367  * emotion_object_audio_mute_set() and emotion_object_video_mute_set() instead.
368  *
369  * @see emotion_object_audio_mute_set()
370  * @see emotion_object_video_mute_set()
371  *
372  * @ingroup Emotion_Audio
373  * @ingroup Emotion_Video
374  */
375 EAPI void         emotion_object_module_option_set     (Evas_Object *obj, const char *opt, const char *val);
376
377 /**
378  * @brief Initializes an emotion object with the specified module.
379  *
380  * @param obj The emotion object to be initialized.
381  * @param module_filename The name of the module to be used (gstreamer or xine).
382  * @return @c EINA_TRUE if the specified module was successfully initialized for
383  * this object, @c EINA_FALSE otherwise.
384  *
385  * This function is required after creating the emotion object, in order to
386  * specify which module will be used with this object. Different objects can
387  * use different modules to play a media file. The current supported modules are
388  * @b gstreamer and @b xine.
389  *
390  * To use any of them, you need to make sure that support for them was compiled
391  * correctly.
392  *
393  * @note It's possible to disable the build of a module with
394  * --disable-module_name.
395  *
396  * @see emotion_object_add()
397  * @see emotion_object_file_set()
398  *
399  * @ingroup Emotion_Init
400  */
401 EAPI Eina_Bool    emotion_object_init                  (Evas_Object *obj, const char *module_filename);
402
403 /**
404  * @brief Set borders for the emotion object.
405  *
406  * @param obj The emotion object where borders are being set.
407  * @param l The left border.
408  * @param r The right border.
409  * @param t The top border.
410  * @param b The bottom border.
411  *
412  * This function sets borders for the emotion video object (just when a video is
413  * present). When positive values are given to one of the parameters, a border
414  * will be added to the respective position of the object, representing that
415  * size on the original video size. However, if the video is scaled up or down
416  * (i.e. the emotion object size is different from the video size), the borders
417  * will be scaled respectively too.
418  *
419  * If a negative value is given to one of the parameters, instead of a border,
420  * that respective side of the video will be cropped.
421  *
422  * It's possible to set a color for the added borders (default is transparent)
423  * with emotion_object_bg_color_set(). By default, an Emotion object doesn't
424  * have any border.
425  *
426  * @see emotion_object_border_get()
427  * @see emotion_object_bg_color_set()
428  *
429  * @ingroup Emotion_Video
430  */
431 EAPI void emotion_object_border_set(Evas_Object *obj, int l, int r, int t, int b);
432
433 /**
434  * @brief Get the borders set for the emotion object.
435  *
436  * @param obj The emotion object from which the borders are being retrieved.
437  * @param l The left border.
438  * @param r The right border.
439  * @param t The top border.
440  * @param b The bottom border.
441  *
442  * @see emotion_object_border_set()
443  *
444  * @ingroup Emotion_Video
445  */
446 EAPI void emotion_object_border_get(const Evas_Object *obj, int *l, int *r, int *t, int *b);
447
448 /**
449  * @brief Set a color for the background rectangle of this emotion object.
450  *
451  * @param obj The emotion object where the background color is being set.
452  * @param r Red component of the color.
453  * @param g Green component of the color.
454  * @param b Blue component of the color.
455  * @param a Alpha channel of the color.
456  *
457  * This is useful when a border is added to any side of the Emotion object. The
458  * area between the edge of the video and the edge of the object will be filled
459  * with the specified color.
460  *
461  * The default color is 0, 0, 0, 0 (transparent).
462  *
463  * @see emotion_object_bg_color_get()
464  *
465  * @ingroup Emotion_Video
466  */
467 EAPI void emotion_object_bg_color_set(Evas_Object *obj, int r, int g, int b, int a);
468
469 /**
470  * @brief Get the background color set for the emotion object.
471  *
472  * @param obj The emotion object from which the background color is being retrieved.
473  * @param r Red component of the color.
474  * @param g Green component of the color.
475  * @param b Blue component of the color.
476  * @param a AAlpha channel of the color.
477  *
478  * @see emotion_object_bg_color_set()
479  *
480  * @ingroup Emotion_Video
481  */
482 EAPI void emotion_object_bg_color_get(const Evas_Object *obj, int *r, int *g, int *b, int *a);
483
484 /**
485  * @brief Set whether emotion should keep the aspect ratio of the video.
486  *
487  * @param obj The emotion object where to set the aspect.
488  * @param a The aspect ratio policy.
489  *
490  * Instead of manually calculating the required border to set with
491  * emotion_object_border_set(), and using this to fix the aspect ratio of the
492  * video when the emotion object has a different aspect, it's possible to just
493  * set the policy to be used.
494  *
495  * The options are:
496  *
497  * - @b #EMOTION_ASPECT_KEEP_NONE - ignore the video aspect ratio, and reset any
498  *   border set to 0, stretching the video inside the emotion object area. This
499  *   option is similar to EVAS_ASPECT_CONTROL_NONE size hint.
500  * - @b #EMOTION_ASPECT_KEEP_WIDTH - respect the video aspect ratio, fitting the
501  *   video width inside the object width. This option is similar to
502  *   EVAS_ASPECT_CONTROL_HORIZONTAL size hint.
503  * - @b #EMOTION_ASPECT_KEEP_HEIGHT - respect the video aspect ratio, fitting
504  *   the video height inside the object height. This option is similar to
505  *   EVAS_ASPECT_CONTROL_VERTIAL size hint.
506  * - @b #EMOTION_ASPECT_KEEP_BOTH - respect the video aspect ratio, fitting both
507  *   its width and height inside the object area. This option is similar to
508  *   EVAS_ASPECT_CONTROL_BOTH size hint. It's the effect called letterboxing.
509  * - @b #EMOTION_ASPECT_CROP - respect the video aspect ratio, fitting the width
510  *   or height inside the object area, and cropping the exceding areas of the
511  *   video in height or width. It's the effect called pan-and-scan.
512  * - @b #EMOTION_ASPECT_CUSTOM - ignore the video aspect ratio, and use the
513  *   current set from emotion_object_border_set().
514  *
515  * @note Calling this function with any value except #EMOTION_ASPECT_CUSTOM will
516  * invalidate borders set with emotion_object_border_set().
517  *
518  * @note Calling emotion_object_border_set() will automatically set the aspect
519  * policy to #EMOTION_ASPECT_CUSTOM.
520  *
521  * @see emotion_object_border_set()
522  * @see emotion_object_keep_aspect_get()
523  *
524  * @ingroup Emotion_Video
525  */
526 EAPI void emotion_object_keep_aspect_set(Evas_Object *obj, Emotion_Aspect a);
527
528 /**
529  * @brief Get the current emotion aspect ratio policy.
530  *
531  * @param obj The emotion object from which we are fetching the aspect ratio
532  * policy.
533  * @return The current aspect ratio policy.
534  *
535  * @see emotion_object_keep_aspect_set()
536  *
537  * @ingroup Emotion_Video
538  */
539 EAPI Emotion_Aspect emotion_object_keep_aspect_get(const Evas_Object *obj);
540
541 /**
542  * @brief Set the file to be played in the Emotion object.
543  *
544  * @param obj The emotion object where the file is being loaded.
545  * @param filename Path to the file to be loaded. It can be absolute or relative
546  * path.
547  * @return EINA_TRUE if the new file could be loaded successfully, and
548  * EINA_FALSE if the file could not be loaded. This happens when the filename is
549  * could not be found, when the module couldn't open the file, when no module is
550  * initialized in this object, or when the @p filename is the same as the
551  * one previously set.
552  *
553  * This function sets the file to be used with this emotion object. If the
554  * object already has another file set, this file will be unset and unloaded,
555  * and the new file will be loaded to this emotion object. The seek position
556  * will be set to 0, and the emotion object will be paused, instead of playing.
557  *
558  * If there was already a filename set, and it's the same as the one being set
559  * now, this function does nothing and returns EINA_FALSE.
560  *
561  * Use @c NULL as argument to @p filename if you want to unload the current file
562  * but don't want to load anything else.
563  *
564  * @see emotion_object_init()
565  * @see emotion_object_play_set()
566  * @see emotion_object_file_get()
567  *
568  * @ingroup Emotion_Init
569  */
570 EAPI Eina_Bool    emotion_object_file_set              (Evas_Object *obj, const char *filename);
571
572 /**
573  * @brief Get the filename of the file associated with the emotion object.
574  *
575  * @param obj The emotion object from which the filename will be retrieved.
576  * @return The path to the file loaded into this emotion object.
577  *
578  * This function returns the path of the file loaded in this emotion object. If
579  * no object is loaded, it will return @c NULL.
580  *
581  * @note Don't free or change the string returned by this function in any way.
582  * If you want to unset it, use @c emotion_object_file_set(obj, NULL).
583  *
584  * @see emotion_object_file_set()
585  *
586  * @ingroup Emotion_Init
587  */
588 EAPI const char  *emotion_object_file_get              (const Evas_Object *obj);
589 /**
590  * @defgroup Emotion_Play Play control functions
591  *
592  * @{
593  */
594 /**
595  *
596  * @brief Set play/pause state of the media file.
597  *
598  * @param obj The emotion object whose state will be changed.
599  * @param play EINA_TRUE to play, EINA_FALSE to pause.
600  *
601  * This functions sets the currently playing status of the video. Using this
602  * function to play or pause the video doesn't alter it's current position.
603  */
604 EAPI void         emotion_object_play_set              (Evas_Object *obj, Eina_Bool play);
605 /**
606  * @brief Get play/pause state of the media file.
607  *
608  * @param obj The emotion object from which the state will be retrieved.
609  * @return EINA_TRUE if playing. EINA_FALSE if not playing.
610  */
611 EAPI Eina_Bool    emotion_object_play_get              (const Evas_Object *obj);
612 /**
613  * @brief Set the position in the media file.
614  *
615  * @param obj The emotion object whose position will be changed.
616  * @param sec The position(in seconds) to which the media file will be set.
617  *
618  * This functions sets the current position of the media file to @p sec, this
619  * only works on seekable streams. Setting the position doesn't change the
620  * playing state of the media file.
621  *
622  * @see emotion_object_seekable_get
623  */
624 EAPI void         emotion_object_position_set          (Evas_Object *obj, double sec);
625 /**
626  * @brief Get the position in the media file.
627  *
628  * @param obj The emotion object from which the position will be retrieved.
629  * @return The position of the media file.
630  *
631  * The position is returned as the number of seconds since the beginning of the
632  * media file.
633  */
634 EAPI double       emotion_object_position_get          (const Evas_Object *obj);
635 /**
636  * @brief Get whether the media file is seekable.
637  *
638  * @param obj The emotion object from which the seekable status will be
639  * retrieved.
640  * @return EINA_TRUE if the media file is seekable, EINA_FALSE otherwise.
641  */
642 EAPI Eina_Bool    emotion_object_seekable_get          (const Evas_Object *obj);
643 /**
644  * @brief Get the length of play for the media file.
645  *
646  * @param obj The emotion object from which the length will be retrieved.
647  * @return The length of the media file in seconds.
648  *
649  * This function returns the length of the media file in seconds.
650  *
651  * @warning This will return 0 if called before the "length_change" signal has,
652  * been emitted.
653  */
654 EAPI double       emotion_object_play_length_get       (const Evas_Object *obj);
655
656 /**
657  * @brief Set the play speed of the media file.
658  *
659  * @param obj The emotion object whose speed will be set.
660  * @param speed The speed to be set in the range [0,infinity)
661  *
662  * This function sets the speed with which the media file will be played. 1.0
663  * represents the normal speed, 2 double speed, 0.5 half speed and so on.
664  *
665  * @warning The only backend that implements this is the experimental VLC
666  * backend.
667  */
668 EAPI void         emotion_object_play_speed_set        (Evas_Object *obj, double speed);
669 /**
670  * @brief Get  the play speed of the media file.
671  *
672  * @param obj The emotion object from which the filename will be retrieved.
673  * @return The current speed of the media file.
674  *
675  * @see emotion_object_play_speed_set
676  */
677 EAPI double       emotion_object_play_speed_get        (const Evas_Object *obj);
678 /**
679  * @brief Get how much of the file has been played.
680  *
681  * @param obj The emotion object from which the filename will be retrieved.
682  * @return The progress of the media file.
683  *
684  * @warning Don't change of free the returned string.
685  * @warning gstreamer xine backends don't implement this(will return NULL).
686  */
687 EAPI const char  *emotion_object_progress_info_get     (const Evas_Object *obj);
688 /**
689  * @brief Get how much of the file has been played.
690  *
691  * @param obj The emotion object from which the filename will be retrieved
692  * @return The progress of the media file.
693  *
694  * This function gets the progress in playing the file, the return value is in
695  * the [0, 1] range.
696  *
697  * @warning gstreamer xine backends don't implement this(will return 0).
698  */
699 EAPI double       emotion_object_progress_status_get   (const Evas_Object *obj);
700 /**
701  * @}
702  */
703 EAPI Eina_Bool    emotion_object_video_handled_get     (const Evas_Object *obj);
704 EAPI Eina_Bool    emotion_object_audio_handled_get     (const Evas_Object *obj);
705
706 /**
707  * @brief Retrieve the video aspect ratio of the media file loaded.
708  *
709  * @param obj The emotion object which the video aspect ratio will be retrieved
710  * from.
711  * @return The video aspect ratio of the file loaded.
712  *
713  * This function returns the video aspect ratio (width / height) of the file
714  * loaded. It can be used to adapt the size of the emotion object in the canvas,
715  * so the aspect won't be changed (by wrongly resizing the object). Or to crop
716  * the video correctly, if necessary.
717  *
718  * The described behavior can be applied like following. Consider a given
719  * emotion object that we want to position inside an area, which we will
720  * represent by @c w and @c h. Since we want to position this object either
721  * stretching, or filling the entire area but overflowing the video, or just
722  * adjust the video to fit inside the area without keeping the aspect ratio, we
723  * must compare the video aspect ratio with the area aspect ratio:
724  * @code
725  * int w = 200, h = 300; // an arbitrary value which represents the area where
726  *                       // the video would be placed
727  * int vw, vh;
728  * double r, vr = emotion_object_ratio_get(obj);
729  * r = (double)w / h;
730  * @endcode
731  *
732  * Now, if we want to make the video fit inside the area, the following code
733  * would do it:
734  * @code
735  * if (vr > r) // the video is wider than the area
736  *   {
737  *      vw = w;
738  *      vh = w / vr;
739  *   }
740  * else // the video is taller than the area
741  *   {
742  *      vh = h;
743  *      vw = h * vr;
744  *   }
745  * evas_object_resize(obj, vw, vh);
746  * @endcode
747  *
748  * And for keeping the aspect ratio but making the video fill the entire area,
749  * overflowing the content which can't fit inside it, we would do:
750  * @code
751  * if (vr > r) // the video is wider than the area
752  *   {
753  *      vh = h;
754  *      vw = h * vr;
755  *   }
756  * else // the video is taller than the area
757  *   {
758  *      vw = w;
759  *      vh = w / vr;
760  *   }
761  * evas_object_resize(obj, vw, vh);
762  * @endcode
763  *
764  * Finally, by just resizing the video to the video area, we would have the
765  * video stretched:
766  * @code
767  * vw = w;
768  * vh = h;
769  * evas_object_resize(obj, vw, vh);
770  * @endcode
771  *
772  * The following diagram exemplifies what would happen to the video,
773  * respectively, in each case:
774  *
775  * @image html emotion_ratio.png
776  * @image latex emotion_ratio.eps width=\textwidth
777  *
778  * @note This function returns the aspect ratio that the video @b should be, but
779  * sometimes the reported size from emotion_object_size_get() represents a
780  * different aspect ratio. You can safely resize the video to respect the aspect
781  * ratio returned by @b this function.
782  *
783  * @see emotion_object_size_get()
784  *
785  * @ingroup Emotion_Video
786  */
787 EAPI double       emotion_object_ratio_get             (const Evas_Object *obj);
788
789 /**
790  * @brief Retrieve the video size of the loaded file.
791  *
792  * @param obj The object from which we are retrieving the video size.
793  * @param iw A pointer to a variable where the width will be stored.
794  * @param iw A pointer to a variable where the height will be stored.
795  *
796  * This function returns the reported size of the loaded video file. If a file
797  * that doesn't contain a video channel is loaded, then this size can be
798  * ignored.
799  *
800  * The value reported by this function should be consistent with the aspect
801  * ratio returned by emotion_object_ratio_get(), but sometimes the information
802  * stored in the file is wrong. So use the ratio size reported by
803  * emotion_object_ratio_get(), since it is more likely going to be accurate.
804  *
805  * @note Use @c NULL for @p iw or @p ih if you don't need one of these values.
806  *
807  * @see emotion_object_ratio_get()
808  *
809  * @ingroup Emotion_Video
810  */
811 EAPI void         emotion_object_size_get              (const Evas_Object *obj, int *iw, int *ih);
812
813 /**
814  * @brief Sets whether to use of high-quality image scaling algorithm
815  * of the given video object.
816  *
817  * When enabled, a higher quality video scaling algorithm is used when
818  * scaling videos to sizes other than the source video. This gives
819  * better results but is more computationally expensive.
820  *
821  * @param obj The given video object.
822  * @param smooth Whether to use smooth scale or not.
823  *
824  * @see emotion_object_smooth_scale_get()
825  *
826  * @ingroup Emotion_Video
827  */
828 EAPI void         emotion_object_smooth_scale_set      (Evas_Object *obj, Eina_Bool smooth);
829
830 /**
831  * @brief Gets whether the high-quality image scaling algorithm
832  * of the given video object is used.
833  *
834  * @param obj The given video object.
835  * @return Whether the smooth scale is used or not.
836  *
837  * @see emotion_object_smooth_scale_set()
838  *
839  * @ingroup Emotion_Video
840  */
841 EAPI Eina_Bool    emotion_object_smooth_scale_get      (const Evas_Object *obj);
842 EAPI void         emotion_object_event_simple_send     (Evas_Object *obj, Emotion_Event ev);
843
844 /**
845  * @brief Set the audio volume.
846  *
847  * @param obj The object where the volume is being set.
848  * @param vol The new volume parameter. Range is from 0.0 to 1.0.
849  *
850  * Sets the audio volume of the stream being played. This has nothing to do with
851  * the system volume. This volume will be multiplied by the system volume. e.g.:
852  * if the current volume level is 0.5, and the system volume is 50%, it will be
853  * 0.5 * 0.5 = 0.25.
854  *
855  * The default value depends on the module used. This value doesn't get changed
856  * when another file is loaded.
857  *
858  * @see emotion_object_audio_volume_get()
859  *
860  * @ingroup Emotion_Audio
861  */
862 EAPI void         emotion_object_audio_volume_set      (Evas_Object *obj, double vol);
863
864 /**
865  * @brief Get the audio volume.
866  *
867  * @param obj The object from which we are retrieving the volume.
868  * @return The current audio volume level for this object.
869  *
870  * Get the current value for the audio volume level. Range is from 0.0 to 1.0.
871  * This volume is set with emotion_object_audio_volume_set().
872  *
873  * @see emotion_object_audio_volume_set()
874  *
875  * @ingroup Emotion_Audio
876  */
877 EAPI double       emotion_object_audio_volume_get      (const Evas_Object *obj);
878
879 /**
880  * @brief Set the mute audio option for this object.
881  *
882  * @param obj The object which we are setting the mute audio option.
883  * @param mute Whether the audio should be muted (@c EINA_TRUE) or not (@c
884  * EINA_FALSE).
885  *
886  * This function sets the mute audio option for this emotion object. The current
887  * module used for this object can use this to avoid decoding the audio portion
888  * of the loaded media file.
889  *
890  * @see emotion_object_audio_mute_get()
891  * @see emotion_object_video_mute_set()
892  *
893  * @ingroup Emotion_Audio
894  */
895 EAPI void         emotion_object_audio_mute_set        (Evas_Object *obj, Eina_Bool mute);
896
897 /**
898  * @brief Get the mute audio option of this object.
899  *
900  * @param obj The object which we are retrieving the mute audio option from.
901  * @return Whether the audio is muted (@c EINA_TRUE) or not (@c EINA_FALSE).
902  *
903  * This function return the mute audio option from this emotion object. It can
904  * be set with emotion_object_audio_mute_set().
905  *
906  * @see emotion_object_audio_mute_set()
907  *
908  * @ingroup Emotion_Audio
909  */
910 EAPI Eina_Bool    emotion_object_audio_mute_get        (const Evas_Object *obj);
911 EAPI int          emotion_object_audio_channel_count   (const Evas_Object *obj);
912 EAPI const char  *emotion_object_audio_channel_name_get(const Evas_Object *obj, int channel);
913 EAPI void         emotion_object_audio_channel_set     (Evas_Object *obj, int channel);
914 EAPI int          emotion_object_audio_channel_get     (const Evas_Object *obj);
915
916 /**
917  * @brief Set the mute video option for this object.
918  *
919  * @param obj The object which we are setting the mute video option.
920  * @param mute Whether the video should be muted (@c EINA_TRUE) or not (@c
921  * EINA_FALSE).
922  *
923  * This function sets the mute video option for this emotion object. The
924  * current module used for this object can use this information to avoid
925  * decoding the video portion of the loaded media file.
926  *
927  * @see emotion_object_video_mute_get()
928  * @see emotion_object_audio_mute_set()
929  *
930  * @ingroup Emotion_Video
931  */
932 EAPI void         emotion_object_video_mute_set        (Evas_Object *obj, Eina_Bool mute);
933
934 /**
935  * @brief Get the mute video option of this object.
936  *
937  * @param obj The object which we are retrieving the mute video option from.
938  * @return Whether the video is muted (@c EINA_TRUE) or not (@c EINA_FALSE).
939  *
940  * This function returns the mute video option from this emotion object. It can
941  * be set with emotion_object_video_mute_set().
942  *
943  * @see emotion_object_video_mute_set()
944  *
945  * @ingroup Emotion_Video
946  */
947 EAPI Eina_Bool    emotion_object_video_mute_get        (const Evas_Object *obj);
948
949 /**
950  * @brief Get the number of available video channel
951  *
952  * @param obj The object which we are retrieving the channel count from
953  * @return the number of available channel.
954  *
955  * @see emotion_object_video_channel_name_get()
956  *
957  * @ingroup Emotion_Video
958  */
959 EAPI int          emotion_object_video_channel_count   (const Evas_Object *obj);
960 EAPI const char  *emotion_object_video_channel_name_get(const Evas_Object *obj, int channel);
961 EAPI void         emotion_object_video_channel_set     (Evas_Object *obj, int channel);
962 EAPI int          emotion_object_video_channel_get     (const Evas_Object *obj);
963 EAPI void         emotion_object_spu_mute_set          (Evas_Object *obj, Eina_Bool mute);
964 EAPI Eina_Bool    emotion_object_spu_mute_get          (const Evas_Object *obj);
965 EAPI int          emotion_object_spu_channel_count     (const Evas_Object *obj);
966 EAPI const char  *emotion_object_spu_channel_name_get  (const Evas_Object *obj, int channel);
967 EAPI void         emotion_object_spu_channel_set       (Evas_Object *obj, int channel);
968 EAPI int          emotion_object_spu_channel_get       (const Evas_Object *obj);
969 EAPI int          emotion_object_chapter_count         (const Evas_Object *obj);
970 EAPI void         emotion_object_chapter_set           (Evas_Object *obj, int chapter);
971 EAPI int          emotion_object_chapter_get           (const Evas_Object *obj);
972 EAPI const char  *emotion_object_chapter_name_get      (const Evas_Object *obj, int chapter);
973 EAPI void         emotion_object_eject                 (Evas_Object *obj);
974
975 /**
976  * @brief Get the dvd title from this emotion object.
977  *
978  * @param obj The object which the title will be retrieved from.
979  * @return A string containing the title.
980  *
981  * This function is only useful when playing a DVD.
982  *
983  * @note Don't change or free the string returned by this function.
984  *
985  * @ingroup Emotion_Info
986  */
987 EAPI const char  *emotion_object_title_get             (const Evas_Object *obj);
988 EAPI const char  *emotion_object_ref_file_get          (const Evas_Object *obj);
989 EAPI int          emotion_object_ref_num_get           (const Evas_Object *obj);
990 EAPI int          emotion_object_spu_button_count_get  (const Evas_Object *obj);
991 EAPI int          emotion_object_spu_button_get        (const Evas_Object *obj);
992
993 /**
994  * @brief Retrieve meta information from this file being played.
995  *
996  * @param obj The object which the meta info will be extracted from.
997  * @param meta The type of meta information that will be extracted.
998  *
999  * This function retrieves information about the file loaded. It can retrieve
1000  * the track title, artist name, album name, etc. See @ref Emotion_Meta_Info
1001  * for all the possibilities.
1002  *
1003  * The meta info may be not available on all types of files. It will return @c
1004  * NULL if the the file doesn't have meta info, or if this specific field is
1005  * empty.
1006  *
1007  * @note Don't change or free the string returned by this function.
1008  *
1009  * @see Emotion_Meta_Info
1010  *
1011  * @ingroup Emotion_Info
1012  */
1013 EAPI const char  *emotion_object_meta_info_get         (const Evas_Object *obj, Emotion_Meta_Info meta);
1014
1015 /**
1016  * @brief Set the visualization to be used with this object.
1017  *
1018  * @param obj The object where the visualization will be set on.
1019  * @param visualization The type of visualization to be used.
1020  *
1021  * The @p visualization specified will be played instead of a video. This is
1022  * commonly used to display a visualization for audio only files (musics).
1023  *
1024  * The available visualizations are @ref Emotion_Vis.
1025  *
1026  * @see Emotion_Vis
1027  * @see emotion_object_vis_get()
1028  * @see emotion_object_vis_supported()
1029  *
1030  * @ingroup Emotion_Visualization
1031  */
1032 EAPI void         emotion_object_vis_set               (Evas_Object *obj, Emotion_Vis visualization);
1033
1034 /**
1035  * @brief Get the type of visualization in use by this emotion object.
1036  *
1037  * @param obj The emotion object which the visualization is being retrieved
1038  * from.
1039  * @return The type of visualization in use by this object.
1040  *
1041  * The type of visualization can be set by emotion_object_vis_set().
1042  *
1043  * @see Emotion_Vis
1044  * @see emotion_object_vis_set()
1045  * @see emotion_object_vis_supported()
1046  *
1047  * @ingroup Emotion_Visualization
1048  */
1049 EAPI Emotion_Vis  emotion_object_vis_get               (const Evas_Object *obj);
1050
1051 /**
1052  * @brief Query whether a type of visualization is supported by this object.
1053  *
1054  * @param obj The object which the query is being ran on.
1055  * @param visualization The type of visualization that is being queried.
1056  * @return EINA_TRUE if the visualization is supported, EINA_FALSE otherwise.
1057  *
1058  * This can be used to check if a visualization is supported. e.g.: one wants to
1059  * display a list of available visualizations for a specific object.
1060  *
1061  * @see Emotion_Vis
1062  * @see emotion_object_vis_set()
1063  * @see emotion_object_vis_get()
1064  *
1065  * @ingroup Emotion_Visualization
1066  */
1067 EAPI Eina_Bool    emotion_object_vis_supported         (const Evas_Object *obj, Emotion_Vis visualization);
1068
1069 /**
1070  * @brief Raise priority of an object so it will have a priviledged access to hardware ressource.
1071  *
1072  * @param obj The object which the query is being ran on.
1073  * @param priority EINA_TRUE means give me a priority access to the hardware ressource.
1074  *
1075  * Hardware have a few dedicated hardware pipeline that process the video at no cost for the CPU.
1076  * Especially on SoC, you mostly have one (on mobile phone SoC) or two (on Set Top Box SoC) when
1077  * Picture in Picture is needed. And most application just have a few video stream that really
1078  * deserve high frame rate, hiogh quality output. That's why this call is for.
1079  *
1080  * Please note that if Emotion can't acquire a priviledged hardware ressource, it will fallback
1081  * to the no-priority path. This work on the first asking first get basis system.
1082  *
1083  * @see emotion_object_priority_get()
1084  *
1085  * @ingroup Emotion_Ressource
1086  */
1087 EAPI void         emotion_object_priority_set(Evas_Object *obj, Eina_Bool priority);
1088
1089 /**
1090  * @brief Get the actual priority of an object.
1091  *
1092  * @param obj The object which the query is being ran on.
1093  * @return EINA_TRUE if the object has a priority access to the hardware.
1094  *
1095  * This actually return the priority status of an object. If it failed to have a priviledged
1096  * access to the hardware, it will return EINA_FALSE.
1097  *
1098  * @see emotion_object_priority_get()
1099  *
1100  * @ingroup Emotion_Ressource
1101  */
1102 EAPI Eina_Bool    emotion_object_priority_get(const Evas_Object *obj);
1103
1104 /**
1105  * @brief Change the state of an object pipeline.
1106  *
1107  * @param obj The object which the query is being ran on.
1108  * @param state The new state for the object.
1109  *
1110  * Changing the state of a pipeline should help preserve the battery of an embedded device.
1111  * But it will only work sanely if the pipeline is not playing at the time you change its
1112  * state. Depending on the engine all state may be not implemented.
1113  *
1114  * @see Emotion_Suspend
1115  * @see emotion_object_suspend_get()
1116  *
1117  * @ingroup Emotion_Ressource
1118  */
1119 EAPI void         emotion_object_suspend_set(Evas_Object *obj, Emotion_Suspend state);
1120
1121 /**
1122  * @brief Get the current state of the pipeline
1123  *
1124  * @param obj The object which the query is being ran on.
1125  * @return the current state of the pipeline.
1126  *
1127  * @see Emotion_Suspend
1128  * @see emotion_object_suspend_set()
1129  *
1130  * @ingroup Emotion_Ressource
1131  */
1132 EAPI Emotion_Suspend emotion_object_suspend_get(Evas_Object *obj);
1133
1134 /**
1135  * @brief Load the last known position if available
1136  *
1137  * @param obj The object which the query is being ran on.
1138  *
1139  * By using Xattr, Emotion is able, if the system permitt it, to store and retrieve
1140  * the latest position. It should trigger some smart callback to let the application
1141  * know when it succeed or fail. Every operation is fully asynchronous and not
1142  * linked to the actual engine used to play the vide.
1143  *
1144  * @see emotion_object_last_position_save()
1145  *
1146  * @ingroup Emotion_Info
1147  */
1148 EAPI void         emotion_object_last_position_load(Evas_Object *obj);
1149
1150 /**
1151  * @brief Save the lastest position if possible
1152  *
1153  * @param obj The object which the query is being ran on.
1154  *
1155  * By using Xattr, Emotion is able, if the system permitt it, to store and retrieve
1156  * the latest position. It should trigger some smart callback to let the application
1157  * know when it succeed or fail. Every operation is fully asynchronous and not
1158  * linked to the actual engine used to play the vide.
1159  *
1160  * @see emotion_object_last_position_load()
1161  *
1162  * @ingroup Emotion_Info
1163  */
1164 EAPI void         emotion_object_last_position_save(Evas_Object *obj);
1165
1166 /**
1167  * @brief Do we have a chance to play that file
1168  *
1169  * @param file A stringshared filename that we want to know if Emotion can play.
1170  *
1171  * This just actually look at the extention of the file, it doesn't check the mime-type
1172  * nor if the file is actually sane. So this is just an hint for your application.
1173  *
1174  * @see emotion_object_extension_may_play_get()
1175  */
1176 EAPI Eina_Bool    emotion_object_extension_may_play_fast_get(const char *file);
1177
1178 /**
1179  * @brief Do we have a chance to play that file
1180  *
1181  * @param file A filename that we want to know if Emotion can play.
1182  *
1183  * This just actually look at the extention of the file, it doesn't check the mime-type
1184  * nor if the file is actually sane. So this is just an hint for your application.
1185  *
1186  * @see emotion_object_extension_may_play_fast_get()
1187  */
1188 EAPI Eina_Bool    emotion_object_extension_may_play_get(const char *file);
1189
1190 /**
1191  * @brief Get the actual image object that contains the pixels of the video stream
1192  *
1193  * @param obj The object which the query is being ran on.
1194  *
1195  * This function is usefull when you want to get a direct access to the pixels.
1196  *
1197  * @see emotion_object_image_get()
1198  */
1199 EAPI Evas_Object *emotion_object_image_get(const Evas_Object *obj);
1200
1201 /**
1202  * @defgroup Emotion_Webcam
1203  */
1204
1205 typedef struct _Emotion_Webcam Emotion_Webcam; /**< Webcam description */
1206
1207 EAPI extern int EMOTION_WEBCAM_UPDATE; /**< Ecore_Event triggered when a new webcam is plugged in */
1208
1209 /**
1210  * @brief Get a list of active and available webcam
1211  *
1212  * @return the list of available webcam at the time of the call.
1213  *
1214  * It will return the current live list of webcam. It is updated before
1215  * triggering EMOTION_WEBCAM_UPDATE and should never be modified.
1216  *
1217  * @ingroup Emotion_Webcam
1218  */
1219 EAPI const Eina_List *emotion_webcams_get(void);
1220
1221 /**
1222  * @brief Get the human understandable name of a Webcam
1223  *
1224  * @param ew The webcam to get the name from.
1225  * @return the actual human readable name.
1226  *
1227  * @ingroup Emotion_Webcam
1228  */
1229 EAPI const char      *emotion_webcam_name_get(const Emotion_Webcam *ew);
1230
1231 /**
1232  * @brief Get the uri of a Webcam that will be understood by emotion
1233  *
1234  * @param ew The webcam to get the uri from.
1235  * @return the actual uri that emotion will later understood.
1236  *
1237  * @ingroup Emotion_Webcam
1238  */
1239 EAPI const char      *emotion_webcam_device_get(const Emotion_Webcam *ew);
1240
1241 /**
1242  * @}
1243  */
1244
1245 #ifdef __cplusplus
1246 }
1247 #endif
1248
1249 #endif