media: audio visualization support (phase 1)

support audio visualization for typop, tycat
This is just first phase with hard coded type (EMOTION_VIS_LIBVISUAL_INFINITE)

TODO:
1. configurable visualizing type in option
2. hide visualizing option if it is not supported.
   (it's currently supported with "gstreamer" engine)
devs/discomfitor/cc
Wonguk Jeong 8 years ago
parent 1f68d2836b
commit bce172cc87
  1. 5
      src/bin/config.c
  2. 1
      src/bin/config.h
  3. 17
      src/bin/main.c
  4. 1
      src/bin/main.h
  5. 20
      src/bin/media.c
  6. 1
      src/bin/media.h
  7. 24
      src/bin/options_video.c
  8. 15
      src/bin/termio.c
  9. 1
      src/bin/termio.h

@ -102,6 +102,8 @@ config_init(void)
(edd_base, Config, "opacity", opacity, EET_T_INT);
EET_DATA_DESCRIPTOR_ADD_BASIC
(edd_base, Config, "mute", mute, EET_T_UCHAR);
EET_DATA_DESCRIPTOR_ADD_BASIC
(edd_base, Config, "visualize", visualize, EET_T_UCHAR);
EET_DATA_DESCRIPTOR_ADD_BASIC
(edd_base, Config, "urg_bell", urg_bell, EET_T_UCHAR);
EET_DATA_DESCRIPTOR_ADD_BASIC
@ -216,6 +218,7 @@ config_sync(const Config *config_src, Config *config)
config->bell_rings = config_src->bell_rings;
config->active_links = config_src->active_links;
config->mute = config_src->mute;
config->visualize = config_src->visualize;
config->urg_bell = config_src->urg_bell;
config->multi_instance = config_src->multi_instance;
config->application_server = config_src->application_server;
@ -342,6 +345,7 @@ config_load(const char *key)
config->active_links = EINA_TRUE;
config->vidmod = 0;
config->mute = EINA_FALSE;
config->visualize = EINA_FALSE;
config->urg_bell = EINA_TRUE;
config->multi_instance = EINA_FALSE;
config->application_server = EINA_FALSE;
@ -418,6 +422,7 @@ config_fork(Config *config)
CPY(translucent);
CPY(opacity);
CPY(mute);
CPY(visualize);
CPY(urg_bell);
CPY(multi_instance);
CPY(application_server);

@ -46,6 +46,7 @@ struct _Config
Eina_Bool translucent;
int opacity;
Eina_Bool mute;
Eina_Bool visualize;
Eina_Bool urg_bell;
Eina_Bool multi_instance;
Eina_Bool application_server;

@ -1981,6 +1981,23 @@ main_media_mute_update(const Config *config)
}
}
void
main_media_visualize_update(const Config *config)
{
Win *wn;
Term *term;
Eina_List *l, *ll;
EINA_LIST_FOREACH(wins, l, wn)
{
EINA_LIST_FOREACH(wn->terms, ll, term)
{
if (term->media) media_visualize_set(term->media, config->visualize);
termio_media_visualize_set(term->term, config->visualize);
}
}
}
void
main_config_sync(const Config *config)
{

@ -16,6 +16,7 @@ void main_close(Evas_Object *win, Evas_Object *term);
void main_trans_update(const Config *config);
void main_media_update(const Config *config);
void main_media_mute_update(const Config *config);
void main_media_visualize_update(const Config *config);
void main_config_sync(const Config *config);
void change_theme(Evas_Object *win, Config *config);

@ -773,6 +773,7 @@ _type_mov_init(Evas_Object *obj)
media_play_set(obj, EINA_TRUE);
if (sd->config->mute) media_mute_set(obj, EINA_TRUE);
if (sd->config->visualize) media_visualize_set(obj, EINA_TRUE);
}
static void
@ -1280,6 +1281,25 @@ media_mute_set(Evas_Object *obj, Eina_Bool mute)
edje_object_signal_emit(sd->o_ctrl, "mute,unset", "terminology");
}
void
media_visualize_set(Evas_Object *obj, Eina_Bool visualize)
{
Media *sd = evas_object_smart_data_get(obj);
if ((!sd) || (sd->type != TYPE_MOV)) return;
if (visualize)
{
/*
* FIXME: configure visualizing type, not hard coded one
*/
if (!emotion_object_vis_supported(sd->o_img, EMOTION_VIS_LIBVISUAL_INFINITE))
ERR(_("Media visualizing is not supported"));
else
emotion_object_vis_set(sd->o_img, EMOTION_VIS_LIBVISUAL_INFINITE);
}
else
emotion_object_vis_set(sd->o_img, EMOTION_VIS_NONE);
}
void
media_play_set(Evas_Object *obj, Eina_Bool play)
{

@ -28,6 +28,7 @@ void media_play_set(Evas_Object *obj, Eina_Bool play);
Eina_Bool media_play_get(Evas_Object *obj);
void media_position_set(Evas_Object *obj, double pos);
void media_volume_set(Evas_Object *obj, double vol);
void media_visualize_set(Evas_Object *obj, Eina_Bool visualize);
void media_stop(Evas_Object *obj);
const char *media_get(const Evas_Object *obj);
int media_src_type_get(const char *src);

@ -41,6 +41,16 @@ _cb_op_video_mute_chg(void *data, Evas_Object *obj, void *event EINA_UNUSED)
config_save(config, NULL);
}
static void
_cb_op_video_visualize_chg(void *data, Evas_Object *obj, void *event EINA_UNUSED)
{
Evas_Object *term = data;
Config *config = termio_config_get(term);
config->visualize = elm_check_state_get(obj);
main_media_visualize_update(config);
config_save(config, NULL);
}
static void
_cb_op_video_vidmod_chg(void *data, Evas_Object *obj, void *event EINA_UNUSED)
{
@ -112,6 +122,20 @@ options_video(Evas_Object *opbox, Evas_Object *term)
evas_object_show(o);
evas_object_smart_callback_add(o, "changed",
_cb_op_video_mute_chg, term);
/*
* TODO: visualizing type configuration
*/
o = elm_check_add(opbox);
evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, 0.0);
evas_object_size_hint_align_set(o, EVAS_HINT_FILL, 0.5);
elm_object_text_set(o, _("Audio visualized"));
elm_check_state_set(o, config->visualize);
elm_box_pack_end(bx0, o);
evas_object_show(o);
evas_object_smart_callback_add(o, "changed",
_cb_op_video_visualize_chg, term);
o = elm_separator_add(opbox);
evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, 0.0);
evas_object_size_hint_align_set(o, EVAS_HINT_FILL, 0.5);

@ -377,6 +377,21 @@ termio_media_mute_set(Evas_Object *obj, Eina_Bool mute)
}
}
void
termio_media_visualize_set(Evas_Object *obj, Eina_Bool visualize)
{
Termio *sd = evas_object_smart_data_get(obj);
Eina_List *l;
Termblock *blk;
EINA_SAFETY_ON_NULL_RETURN(sd);
EINA_LIST_FOREACH(sd->pty->block.active, l, blk)
{
if (blk->obj && !blk->edje)
media_visualize_set(blk->obj, visualize);
}
}
Eina_Bool
termio_selection_exists(const Evas_Object *obj)
{

@ -36,6 +36,7 @@ Evas_Object *termio_win_get(Evas_Object *obj);
const char *termio_title_get(Evas_Object *obj);
const char *termio_icon_name_get(Evas_Object *obj);
void termio_media_mute_set(Evas_Object *obj, Eina_Bool mute);
void termio_media_visualize_set(Evas_Object *obj, Eina_Bool visualize);
void termio_config_set(Evas_Object *obj, Config *config);
Config *termio_config_get(const Evas_Object *obj);

Loading…
Cancel
Save