New external test: video player in pure edje

SVN revision: 76554
This commit is contained in:
Davide Andreoli 2012-09-12 19:26:50 +00:00
parent 0ef2708002
commit e77bd359ad
3 changed files with 207 additions and 0 deletions

View File

@ -832,4 +832,188 @@ embryo script and from C code.";
}
}
}
group { name: "external/video";
parts {
COMMON_EXTERNAL_UNDER
part { name: "ext_label1";
type: EXTERNAL;
source: "elm/label";
clip_to: "clip";
description { state: "default" 0.0;
max: 200 50;
align: 0.5 0.0;
params {
string: "label" "<b>Simple videoplayer in pure edje</>\
<br>Just choose a video file, click 'play' and enjoy your movie :)<br>\
<b>BUGS:</> Video don't emit signals, some external props are missing.";
}
}
}
part { name: "ext_video1";
type: EXTERNAL;
source: "elm/video";
clip_to: "clip";
description { state: "default" 0.0;
align: 0.5 0.0;
rel1.offset: 12 60;
rel2.offset: -12 60;
}
}
part { name: "ext_button1";
type: EXTERNAL;
source: "elm/button";
clip_to: "clip";
description { state: "default" 0.0;
max: 60 40;
align: 0.1 0.0;
rel1 {
to: "ext_slider1";
relative: 0.0 -1.0;
}
params {
string: "label" "play";
bool: "disabled" 1;
}
}
}
part { name: "ext_button2";
type: EXTERNAL;
source: "elm/button";
clip_to: "clip";
description { state: "default" 0.0;
max: 60 40;
align: 0.5 0.0;
rel1 {
to: "ext_slider1";
relative: 0.0 -1.0;
}
params {
string: "label" "pause";
bool: "disabled" 1;
}
}
}
part { name: "ext_button3";
type: EXTERNAL;
source: "elm/button";
clip_to: "clip";
description { state: "default" 0.0;
max: 60 40;
align: 0.9 0.0;
rel1 {
to: "ext_slider1";
relative: 0.0 -1.0;
}
params {
string: "label" "stop";
bool: "disabled" 1;
}
}
}
part { name: "ext_slider1";
type: EXTERNAL;
source: "elm/slider";
clip_to: "clip";
description { state: "default" 0.0;
max: 9999 40;
align: 0.0 0.0;
rel1 {
to: "ext_slider2";
relative: 0.0 -1.0;
}
params {
string: "label" "Volume";
string: "indicator format" "%.3f";
}
}
}
part { name: "ext_slider2";
type: EXTERNAL;
source: "elm/slider";
clip_to: "clip";
description { state: "default" 0.0;
max: 9999 40;
align: 0.0 0.0;
rel1 {
to: "ext_fsentry";
relative: 0.0 -1.0;
}
params {
string: "label" "Position";
string: "indicator format" "%.3f";
bool: "disabled" 1;
}
}
}
part { name: "ext_fsentry";
type: EXTERNAL;
source: "elm/fileselector_entry";
clip_to: "clip";
description { state: "default" 0.0;
max: 9999 40;
align: 0.0 1.0;
rel1.offset: 6 -6;
rel2.offset: -6 -6;
params {
string: "label" "choose file";
}
}
}
COMMON_EXTERNAL_OVER
}
programs {
COMMON_EXTERNAL_PROGRAM
program { name: "play_clicked";
signal: "clicked";
source: "ext_button1";
action: PARAM_SET "ext_video1" "play" 1;
}
program { name: "pause_click";
signal: "clicked";
source: "ext_button2";
action: PARAM_SET "ext_video1" "pause" 1;
}
program { name: "stop_clicked";
signal: "clicked";
source: "ext_button3";
action: PARAM_SET "ext_video1" "stop" 1;
}
program { name: "volume_slider";
signal: "changed";
source: "ext_slider1";
action: PARAM_COPY "ext_slider1" "value" "ext_video1" "audio level";
}
program { name: "position_slider";
signal: "changed";
source: "ext_slider2";
script {
// here we need to get the lenght of the video from external
// to calc the play position...
new Float:myval = external_param_get_float(PART:"ext_slider2", "value");
external_param_set_float(PART:"ext_video1", "play position", myval*100);
}
}
program { name: "file_chosen";
signal: "file,chosen";
source: "ext_fsentry";
action: PARAM_COPY "ext_fsentry" "path" "ext_video1" "uri";
after: "enable_bt1";
after: "enable_bt2";
after: "enable_bt3";
after: "update_volume_slider";
}
program { name: "enable_bt1";
action: PARAM_SET "ext_button1" "disabled" 0;
}
program { name: "enable_bt2";
action: PARAM_SET "ext_button2" "disabled" 0;
}
program { name: "enable_bt3";
action: PARAM_SET "ext_button3" "disabled" 0;
}
program { name: "update_volume_slider";
action: PARAM_COPY "ext_video1" "audio level" "ext_slider1" "value";
}
}
}
}

View File

@ -188,6 +188,7 @@ void test_external_button(void *data, Evas_Object *obj, void *event_info);
void test_external_slider(void *data, Evas_Object *obj, void *event_info);
void test_external_scroller(void *data, Evas_Object *obj, void *event_info);
void test_external_pbar(void *data, Evas_Object *obj, void *event_info);
void test_external_video(void *data, Evas_Object *obj, void *event_info);
#ifdef HAVE_EMOTION
void test_video(void *data, Evas_Object *obj, void *event_info);
#endif
@ -536,6 +537,7 @@ add_tests:
ADD_TEST(NULL, "Edje External", "ExtProgressBar", test_external_pbar);
ADD_TEST(NULL, "Edje External", "ExtScroller", test_external_scroller);
ADD_TEST(NULL, "Edje External", "ExtSlider", test_external_slider);
ADD_TEST(NULL, "Edje External", "ExtVideo", test_external_video);
//------------------------------//
ADD_TEST(NULL, "Toolbars", "Toolbar", test_toolbar);

View File

@ -168,5 +168,26 @@ test_external_pbar(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *eve
evas_object_show(win);
}
void
test_external_video(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
{
Evas_Object *win, *ly, *edje, *bt;
char buf[PATH_MAX];
win = elm_win_util_standard_add("ext_video", "Edje External Video");
elm_win_autodel_set(win, EINA_TRUE);
ly = elm_layout_add(win);
snprintf(buf, sizeof(buf), "%s/objects/test_external.edj", elm_app_data_dir_get());
elm_layout_file_set(ly, buf, "external/video");
evas_object_size_hint_weight_set(ly, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(ly, EVAS_HINT_FILL, EVAS_HINT_FILL);
elm_win_resize_object_add(win, ly);
evas_object_show(ly);
evas_object_resize(win, 320, 400);
evas_object_show(win);
}
#endif