int enna_mediaplayer_init(void) { mp = calloc(1, sizeof(Enna_Mediaplayer)); mp->uri = NULL; mp->label = NULL; mp->engine = strdup(mp_cfg.engine); mp->player = emotion_object_add(evas_object_evas_get(enna->layout)); emotion_object_init(mp->player, mp->engine); evas_object_layer_set(mp->player, -1); mp->play_state = STOPPED; /* Create Ecore Event ID */ ENNA_EVENT_MEDIAPLAYER_EOS = ecore_event_type_new(); ENNA_EVENT_MEDIAPLAYER_METADATA_UPDATE = ecore_event_type_new(); ENNA_EVENT_MEDIAPLAYER_START = ecore_event_type_new(); ENNA_EVENT_MEDIAPLAYER_STOP = ecore_event_type_new(); ENNA_EVENT_MEDIAPLAYER_PAUSE = ecore_event_type_new(); ENNA_EVENT_MEDIAPLAYER_UNPAUSE = ecore_event_type_new(); ENNA_EVENT_MEDIAPLAYER_PREV = ecore_event_type_new(); ENNA_EVENT_MEDIAPLAYER_NEXT = ecore_event_type_new(); ENNA_EVENT_MEDIAPLAYER_SEEK = ecore_event_type_new(); return 1; }
void dvb_init(char *module, char *file, char *swallow) { Evas_Object *o; if (o_dvb_bg) return; if (mdl) free(mdl); mdl = strdup(module); if (swal) free(swal); swal = strdup(swallow); o = edje_object_add(evas); edje_object_file_set(o, theme, "video_container"); o_dvb_bg = o; o = emotion_object_add(evas); if (!emotion_object_init(o, module)) { printf("ERROR!\n"); } evas_object_smart_callback_add(o, "frame_decode", dvb_obj_frame_decode_cb, NULL); evas_object_smart_callback_add(o, "frame_resize", dvb_obj_frame_resize_cb, NULL); evas_object_smart_callback_add(o, "length_change", dvb_obj_length_change_cb, NULL); evas_object_smart_callback_add(o, "decode_stop", dvb_obj_stopped_cb, NULL); evas_object_smart_callback_add(o, "channels_change", dvb_obj_channels_cb, NULL); evas_object_smart_callback_add(o, "title_change", dvb_obj_title_cb, NULL); evas_object_smart_callback_add(o, "progress_change", dvb_obj_progress_cb, NULL); evas_object_smart_callback_add(o, "ref_change", dvb_obj_ref_cb, NULL); evas_object_smart_callback_add(o, "button_num_change", dvb_obj_button_num_cb, NULL); evas_object_smart_callback_add(o, "button_change", dvb_obj_button_cb, NULL); o_dvb = o; channel = 0; emotion_object_file_set(o_dvb, "dvb://0"); emotion_object_play_set(o_dvb, 1); emotion_object_audio_mute_set(o_dvb, 0); emotion_object_audio_volume_set(o_dvb, 1.0); layout_swallow(swallow, o_dvb_bg); edje_extern_object_aspect_set(o_dvb, EDJE_ASPECT_CONTROL_BOTH, 640, 480); edje_object_part_swallow(o_dvb_bg, "video", o_dvb); dvb_resize(); evas_object_show(o_dvb); evas_object_show(o_dvb_bg); _hide_timer = ecore_timer_add(10.0, dvb_menu_bg_hide_tmer_cb, NULL); /* FIXME: add this video to recently played list */ }
static Evas_Object * _create_emotion_object(Evas *e) { Evas_Object *em = emotion_object_add(e); emotion_object_init(em, "generic"); evas_object_smart_callback_add( em, "playback_started", _playback_started_cb, NULL); evas_object_smart_callback_add( em, "playback_finished", _playback_stopped_cb, NULL); return em; }
static void dvb_obj_stopped_cb(void *data, Evas_Object *obj, void *event_info) { Evas_Object *o; char buf[256]; printf("dvb stopped!\n"); o = emotion_object_add(evas_object_evas_get(obj)); if (!emotion_object_init(o, mdl)) { printf("ERROR!\n"); } evas_object_del(o_dvb); evas_object_smart_callback_add(o, "frame_decode", dvb_obj_frame_decode_cb, NULL); evas_object_smart_callback_add(o, "frame_resize", dvb_obj_frame_resize_cb, NULL); evas_object_smart_callback_add(o, "length_change", dvb_obj_length_change_cb, NULL); evas_object_smart_callback_add(o, "decode_stop", dvb_obj_stopped_cb, NULL); evas_object_smart_callback_add(o, "channels_change", dvb_obj_channels_cb, NULL); evas_object_smart_callback_add(o, "title_change", dvb_obj_title_cb, NULL); evas_object_smart_callback_add(o, "progress_change", dvb_obj_progress_cb, NULL); evas_object_smart_callback_add(o, "ref_change", dvb_obj_ref_cb, NULL); evas_object_smart_callback_add(o, "button_num_change", dvb_obj_button_num_cb, NULL); evas_object_smart_callback_add(o, "button_change", dvb_obj_button_cb, NULL); o_dvb = o; snprintf(buf, sizeof(buf), "dvb://%i", channel); emotion_object_file_set(o_dvb, buf); emotion_object_play_set(o_dvb, 1); emotion_object_audio_mute_set(o_dvb, 0); emotion_object_audio_volume_set(o_dvb, 1.0); layout_swallow(swal, o_dvb_bg); edje_extern_object_aspect_set(o_dvb, EDJE_ASPECT_CONTROL_BOTH, 640, 480); edje_object_part_swallow(o_dvb_bg, "video", o_dvb); dvb_resize(); evas_object_show(o_dvb); // if (!dvb_stopped_job) // dvb_stopped_job = ecore_job_add(dvb_stopped_job_cb, data); }
int main(int argc, char** argv) { Eina_Bool ret; Ecore_Evas *ecore_evas; Evas *evas; Evas_Object *bg, *video; Evas_Map *m; if(argc != 2) { fprintf(stderr, "Usage: %s moviefile\n", argv[0]); return 1; } ecore_init(); ecore_evas_init(); emotion_init(); ecore_evas = ecore_evas_new ("software_x11", 300, 200, WINDOW_WIDTH, WINDOW_HEIGHT, NULL); if (!ecore_evas) goto end; ecore_evas_callback_delete_request_set(ecore_evas, main_delete_request); // ecore_evas_callback_resize_set(ecore_evas, main_resize); ecore_evas_title_set(ecore_evas, "Evas Media Test Program"); // ecore_evas_name_class_set(ecore_evas, "evas_media_test", "main"); ecore_evas_show(ecore_evas); evas = ecore_evas_get(ecore_evas); bg = evas_object_rectangle_add(evas); evas_object_color_set(bg, 0x00, 0x00, 0x00, 0xff); evas_object_move(bg, 0, 0); evas_object_resize(bg, WINDOW_WIDTH, WINDOW_HEIGHT); evas_object_show(bg); video = emotion_object_add(evas); evas_object_move(video, 0, 0); evas_object_resize(video, WINDOW_WIDTH, WINDOW_HEIGHT); ret = emotion_object_init(video, "gstreamer"); if(ret != EINA_TRUE) { fprintf(stderr, "faild to emotion_object_init\n"); goto end; } ret = emotion_object_file_set(video, argv[1]); if(ret != EINA_TRUE) { fprintf(stderr, "emotion_object_file_set\n"); goto end; } emotion_object_play_set(video, EINA_TRUE); evas_object_show(video); m = evas_map_new(4); evas_map_util_points_populate_from_object(m, video); // 2d rotate // evas_map_util_rotate(m, 90, 0 + (WINDOW_WIDTH/2), 0 + (WINDOW_HEIGHT/2)); // 3d rotate //evas_map_util_3d_rotate(m, 10.0, 10.0, 0.0, 0, 0, 0); evas_object_map_set(video, m); evas_object_map_enable_set(video, EINA_TRUE); ecore_event_handler_add(ECORE_EVENT_KEY_DOWN, key_cb, video); ecore_main_loop_begin(); end: if(ecore_evas) ecore_evas_free(ecore_evas); evas_map_free(m); emotion_shutdown(); ecore_evas_shutdown(); ecore_shutdown(); return 0; }
int main(int argc, const char *argv[]) { Ecore_Evas *ee; Evas *e; Evas_Object *bg, *em; 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]; if (!ecore_evas_init()) return EXIT_FAILURE; /* this will give you a window with an Evas canvas under the first * engine available */ ee = ecore_evas_new(NULL, 10, 10, WIDTH, HEIGHT, NULL); if (!ee) goto error; ecore_evas_show(ee); /* the canvas pointer, de facto */ e = ecore_evas_get(ee); /* adding a background to this example */ bg = evas_object_rectangle_add(e); evas_object_name_set(bg, "our dear rectangle"); evas_object_color_set(bg, 255, 255, 255, 255); /* white bg */ evas_object_move(bg, 0, 0); /* at canvas' origin */ evas_object_resize(bg, WIDTH, HEIGHT); /* covers full canvas */ evas_object_show(bg); /* Creating the emotion object */ em = emotion_object_add(e); /* Try to load the specified module - NULL for auto-discover */ if (!emotion_object_init(em, module)) fprintf(stderr, "Emotion: \"%s\" module could not be initialized.\n", module); _display_info(em); _setup_emotion_callbacks(em); if (!emotion_object_file_set(em, filename)) fprintf(stderr, "Emotion: Could not load the file \"%s\"\n", filename); evas_object_move(em, 0, 0); evas_object_resize(em, WIDTH, HEIGHT); evas_object_show(em); emotion_object_play_set(em, EINA_TRUE); ecore_main_loop_begin(); ecore_evas_free(ee); ecore_evas_shutdown(); return 0; ecore_evas_free(ee); error: ecore_evas_shutdown(); return -1; }