media: have media_src_type_get() use extn api
This commit is contained in:
parent
8eec8afcc2
commit
cd4c168e3b
|
@ -1501,14 +1501,14 @@ media_get(const Evas_Object *obj)
|
||||||
}
|
}
|
||||||
|
|
||||||
Media_Type
|
Media_Type
|
||||||
media_src_type_get(const char *src)
|
media_src_type_get(const char *src, size_t len)
|
||||||
{
|
{
|
||||||
Media_Type type = MEDIA_TYPE_UNKNOWN;
|
Media_Type type = MEDIA_TYPE_UNKNOWN;
|
||||||
|
|
||||||
if (_is_fmt(src, extn_img)) type = MEDIA_TYPE_IMG;
|
if (extn_matches(src, len, extn_img)) type = MEDIA_TYPE_IMG;
|
||||||
else if (_is_fmt(src, extn_scale)) type = MEDIA_TYPE_SCALE;
|
else if (extn_matches(src, len, extn_scale)) type = MEDIA_TYPE_SCALE;
|
||||||
else if (_is_fmt(src, extn_edj)) type = MEDIA_TYPE_EDJE;
|
else if (extn_matches(src, len, extn_edj)) type = MEDIA_TYPE_EDJE;
|
||||||
else if (_is_fmt(src, extn_mov)) type = MEDIA_TYPE_MOV;
|
else if (extn_matches(src, len, extn_mov)) type = MEDIA_TYPE_MOV;
|
||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,7 @@ void media_volume_set(Evas_Object *obj, double vol);
|
||||||
void media_visualize_set(Evas_Object *obj, Eina_Bool visualize);
|
void media_visualize_set(Evas_Object *obj, Eina_Bool visualize);
|
||||||
void media_stop(Evas_Object *obj);
|
void media_stop(Evas_Object *obj);
|
||||||
const char *media_get(const Evas_Object *obj);
|
const char *media_get(const Evas_Object *obj);
|
||||||
Media_Type media_src_type_get(const char *src);
|
Media_Type media_src_type_get(const char *src, size_t len);
|
||||||
Evas_Object *media_control_get(const Evas_Object *obj);
|
Evas_Object *media_control_get(const Evas_Object *obj);
|
||||||
void media_unknown_handle(const char *handler, const char *src);
|
void media_unknown_handle(const char *handler, const char *src);
|
||||||
|
|
||||||
|
|
|
@ -185,7 +185,7 @@ _grid_content_get(void *data, Evas_Object *obj, const char *part)
|
||||||
if (extn_matches(item->path, len, extn_edj))
|
if (extn_matches(item->path, len, extn_edj))
|
||||||
return media_add(obj, item->path, config,
|
return media_add(obj, item->path, config,
|
||||||
MEDIA_BG, MEDIA_TYPE_EDJE);
|
MEDIA_BG, MEDIA_TYPE_EDJE);
|
||||||
type = media_src_type_get(item->path);
|
type = media_src_type_get(item->path, len);
|
||||||
return media_add(obj, item->path, config, MEDIA_THUMB, type);
|
return media_add(obj, item->path, config, MEDIA_THUMB, type);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -788,7 +788,8 @@ _activate_link(Evas_Object *obj, Eina_Bool may_inline)
|
||||||
escaped = ecore_file_escape_name(path);
|
escaped = ecore_file_escape_name(path);
|
||||||
if (escaped)
|
if (escaped)
|
||||||
{
|
{
|
||||||
Media_Type type = media_src_type_get(path);
|
size_t len = strlen(path);
|
||||||
|
Media_Type type = media_src_type_get(path, len);
|
||||||
if (may_inline && _should_inline(obj))
|
if (may_inline && _should_inline(obj))
|
||||||
{
|
{
|
||||||
if ((type == MEDIA_TYPE_IMG) ||
|
if ((type == MEDIA_TYPE_IMG) ||
|
||||||
|
@ -839,7 +840,8 @@ _activate_link(Evas_Object *obj, Eina_Bool may_inline)
|
||||||
escaped = ecore_file_escape_name(s);
|
escaped = ecore_file_escape_name(s);
|
||||||
if (escaped)
|
if (escaped)
|
||||||
{
|
{
|
||||||
Media_Type type = media_src_type_get(link);
|
size_t len = strlen(link);
|
||||||
|
Media_Type type = media_src_type_get(link, len);
|
||||||
if (may_inline && _should_inline(obj))
|
if (may_inline && _should_inline(obj))
|
||||||
{
|
{
|
||||||
evas_object_smart_callback_call(obj, "popup", NULL);
|
evas_object_smart_callback_call(obj, "popup", NULL);
|
||||||
|
@ -1345,7 +1347,8 @@ _cb_link_down(void *data,
|
||||||
|
|
||||||
if (sd->config->helper.inline_please)
|
if (sd->config->helper.inline_please)
|
||||||
{
|
{
|
||||||
Media_Type type = media_src_type_get(raw_link);
|
size_t len = strlen(raw_link);
|
||||||
|
Media_Type type = media_src_type_get(raw_link, len);
|
||||||
|
|
||||||
if ((type == MEDIA_TYPE_IMG) ||
|
if ((type == MEDIA_TYPE_IMG) ||
|
||||||
(type == MEDIA_TYPE_SCALE) ||
|
(type == MEDIA_TYPE_SCALE) ||
|
||||||
|
@ -1820,7 +1823,7 @@ _smart_media_clicked(void *data, Evas_Object *obj, void *_info EINA_UNUSED)
|
||||||
{
|
{
|
||||||
if (blk->link)
|
if (blk->link)
|
||||||
{
|
{
|
||||||
Media_Type type = media_src_type_get(blk->link);
|
Media_Type type = media_src_type_get(blk->link, strlen(blk->link));
|
||||||
Config *config = termio_config_get(data);
|
Config *config = termio_config_get(data);
|
||||||
|
|
||||||
if (config)
|
if (config)
|
||||||
|
@ -2429,7 +2432,7 @@ _block_media_activate(Evas_Object *obj, Termblock *blk)
|
||||||
else
|
else
|
||||||
media |= MEDIA_RECOVER | MEDIA_SAVE;
|
media |= MEDIA_RECOVER | MEDIA_SAVE;
|
||||||
|
|
||||||
type = media_src_type_get(blk->path);
|
type = media_src_type_get(blk->path, strlen(blk->path));
|
||||||
blk->obj = media_add(obj, blk->path, sd->config, media, type);
|
blk->obj = media_add(obj, blk->path, sd->config, media, type);
|
||||||
|
|
||||||
if (type == MEDIA_TYPE_MOV)
|
if (type == MEDIA_TYPE_MOV)
|
||||||
|
|
|
@ -5749,8 +5749,9 @@ _popmedia_unknown(Term *term, const char *src, Eina_Bool from_user_interaction)
|
||||||
{
|
{
|
||||||
Media_Type type;
|
Media_Type type;
|
||||||
Config *config = termio_config_get(term->termio);
|
Config *config = termio_config_get(term->termio);
|
||||||
|
size_t len = strlen(src);
|
||||||
|
|
||||||
type = media_src_type_get(src);
|
type = media_src_type_get(src, len);
|
||||||
if (type == MEDIA_TYPE_UNKNOWN)
|
if (type == MEDIA_TYPE_UNKNOWN)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_ECORE_CON_URL_HEAD
|
#ifdef HAVE_ECORE_CON_URL_HEAD
|
||||||
|
@ -6907,7 +6908,8 @@ _term_media_update(Term *term, const Config *config)
|
||||||
_cb_media_del);
|
_cb_media_del);
|
||||||
evas_object_del(term->media);
|
evas_object_del(term->media);
|
||||||
}
|
}
|
||||||
type = media_src_type_get(config->background);
|
type = media_src_type_get(config->background,
|
||||||
|
strlen(config->background));
|
||||||
term->media = o = media_add(term->wn->win,
|
term->media = o = media_add(term->wn->win,
|
||||||
config->background, config,
|
config->background, config,
|
||||||
MEDIA_BG, type);
|
MEDIA_BG, type);
|
||||||
|
|
Loading…
Reference in New Issue