A media object library for Evas and Ecore.
Emotion is a library that allows playing audio and video files.
It is integrated into Ecore through its mainloop, and is transparent to the user of the library how the decoding of audio and video is being done. Once the objects are created, the user can set callbacks to the specific events and set options to this object, all in the main loop (no threads are needed).
The Emotion library uses Evas smart objects to allow you to manipulate the created object as any other Evas object, and to connect to its signals, handling them when needed. It's also possible to swallow Emotion objects inside Edje themes, and expect it to behave as a normal image or rectangle when regarding to its dimensions.
Emotion is a library your application links to. The procedure for this is very simple. You simply have to compile your application with the appropriate compiler flags that the pkg-config
script outputs. For example:
After you understood what Emotion is and installed it in your system you should proceed understanding the programming interface. We'd recommend you to take a while to learn Ecore and Evas to get started.
#ifndef EFL_BETA_API_SUPPORT
# define EFL_BETA_API_SUPPORT
#endif
#include <Eo.h>
#include <Ecore.h>
#include <Evas.h>
#include <stdio.h>
#define WIDTH (320)
#define HEIGHT (240)
static void
{
printf("Emotion object started playback.\n");
}
int
main(int argc, const char *argv[])
{
Ecore_Evas *ee;
Evas *e;
Evas_Object *bg, *em;
const char *filename = NULL;
if (argc < 2)
{
printf("One argument is necessary. Usage:\n");
printf("\t%s <filename>\n", argv[0]);
}
filename = argv[1];
return EXIT_FAILURE;
if (!ee)
goto error;
emotion_object_init(em, NULL);
efl_event_callback_add
(em, EFL_CANVAS_VIDEO_EVENT_PLAYBACK_START, _playback_started_cb, NULL);
return 0;
error:
fprintf(stderr, "error: Requires at least one Evas engine built and linked"
" to ecore-evas for this example to run properly.\n");
return -1;
}
EAPI int ecore_evas_init(void)
Inits the Ecore_Evas system.
Definition ecore_evas.c:608
EAPI void ecore_evas_show(Ecore_Evas *ee)
Shows an Ecore_Evas' window.
Definition ecore_evas.c:1494
EAPI Evas * ecore_evas_get(const Ecore_Evas *ee)
Gets an Ecore_Evas's Evas.
Definition ecore_evas.c:1314
EAPI Ecore_Evas * ecore_evas_new(const char *engine_name, int x, int y, int w, int h, const char *extra_options)
Creates a new Ecore_Evas based on engine name and common parameters.
Definition ecore_evas.c:1053
EAPI int ecore_evas_shutdown(void)
Shuts down the Ecore_Evas system.
Definition ecore_evas.c:672
EAPI void ecore_evas_free(Ecore_Evas *ee)
Frees an Ecore_Evas.
Definition ecore_evas.c:1097
void ecore_main_loop_begin(void)
Runs the application main loop.
Definition ecore_main.c:1311
#define EINA_TRUE
boolean value TRUE (numerical value 1)
Definition eina_types.h:539
#define EINA_UNUSED
Used to indicate that a function parameter is purposely unused.
Definition eina_types.h:339
EMOTION_API Evas_Object * emotion_object_add(Evas *evas)
Add an emotion object to the canvas.
Definition emotion_smart.c:237
EMOTION_API Eina_Bool emotion_object_file_set(Evas_Object *obj, const char *filename)
Set the file to be played in the Emotion object.
Definition emotion_smart.c:355
EMOTION_API void emotion_object_play_set(Evas_Object *obj, Eina_Bool play)
Set play/pause state of the media file.
Definition emotion_smart.c:653
EVAS_API void evas_object_show(Evas_Object *eo_obj)
Makes the given Evas object visible.
Definition evas_object_main.c:1814
EVAS_API void evas_object_name_set(Evas_Object *eo_obj, const char *name)
Sets the name of the given Evas object to the given name.
Definition evas_name.c:5
EVAS_API void evas_object_color_set(Evas_Object *obj, int r, int g, int b, int a)
Sets the general/main color of the given Evas object to the given one.
Definition evas_object_main.c:2024
EVAS_API void evas_object_move(Evas_Object *obj, Evas_Coord x, Evas_Coord y)
Move the given Evas object to the given location inside its canvas' viewport.
Definition evas_object_main.c:1171
EVAS_API void evas_object_resize(Evas_Object *obj, Evas_Coord w, Evas_Coord h)
Changes the size of the given Evas object.
Definition evas_object_main.c:1236
EVAS_API Evas_Object * evas_object_rectangle_add(Evas *e)
Adds a rectangle to the given evas.
Definition evas_object_rectangle.c:78