This example shows that some of the information available from the emotion object, like the media file play length, aspect ratio, etc. can be not available just after setting the file to the emotion object.
One callback is declared for each of the following signals, and some of the info about the file is displayed. Also notice that the order that these signals are emitted can change depending on the module being used. Following is the full source code of this example:
#include <Ecore.h>
#include <Evas.h>
#include <stdio.h>
#define WIDTH (320)
#define HEIGHT (240)
static void
{
int w, h;
printf("meta title: %s\n",
printf("seek position: %0.3f\n",
printf("play length: %0.3f\n",
printf("is seekable: %d\n",
printf("video geometry: %dx%d\n", w, h);
printf("video width / height ratio: %0.3f\n",
printf("\n");
}
static void
_playback_started_cb(
void *data,
Evas_Object *o,
void *event_info)
{
printf(">>> Emotion object started playback.\n");
_display_info(o);
}
static void
_playback_finished_cb(
void *data,
Evas_Object *o,
void *event_info)
{
printf(">>> Emotion object finished playback.\n");
_display_info(o);
}
static void
_open_done_cb(
void *data,
Evas_Object *o,
void *event_info)
{
printf(">>> Emotion object open done.\n");
_display_info(o);
}
static void
_position_update_cb(
void *data,
Evas_Object *o,
void *event_info)
{
printf(">>> Emotion object first position update.\n");
_display_info(o);
}
static void
_frame_decode_cb(
void *data,
Evas_Object *o,
void *event_info)
{
printf(">>> Emotion object first frame decode.\n");
_display_info(o);
}
static void
_decode_stop_cb(
void *data,
Evas_Object *o,
void *event_info)
{
printf(">>> Emotion object decode stop.\n");
_display_info(o);
}
static void
_frame_resize_cb(
void *data,
Evas_Object *o,
void *event_info)
{
printf(">>> Emotion object frame resize.\n");
_display_info(o);
}
static void
{
o, "playback_started", _playback_started_cb, NULL);
o, "playback_finished", _playback_finished_cb, NULL);
o, "open_done", _open_done_cb, NULL);
o, "position_update", _position_update_cb, NULL);
o, "frame_decode", _frame_decode_cb, NULL);
o, "decode_stop", _decode_stop_cb, NULL);
o, "frame_resize", _frame_resize_cb, NULL);
}
int
main(int argc, const char *argv[])
{
Ecore_Evas *ee;
const char *filename = NULL;
const char *module = NULL;
if (argc < 2)
{
printf("At least one argument is necessary. Usage:\n");
printf("\t%s <filename> [module_name]\n", argv[0]);
goto error;
}
filename = argv[1];
if (argc >= 3)
module = argv[2];
return EXIT_FAILURE;
if (!ee)
goto error;
fprintf(stderr, "Emotion: \"%s\" module could not be initialized.\n", module);
_display_info(em);
_setup_emotion_callbacks(em);
fprintf(stderr, "Emotion: Could not load the file \"%s\"\n", filename);
return 0;
error:
return -1;
}