From 2ad014e0e7ba833ce157f674d30361c141ef5026 Mon Sep 17 00:00:00 2001 From: raster Date: Tue, 9 Oct 2012 10:40:06 +0000 Subject: [PATCH] handle direct youtube media links as mov style. :) git-svn-id: http://svn.enlightenment.org/svn/e/trunk/terminology@77634 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33 --- src/bin/media.c | 39 +++++++++++++++++++++++---------------- 1 file changed, 23 insertions(+), 16 deletions(-) diff --git a/src/bin/media.c b/src/bin/media.c index 89f5192..418abc6 100644 --- a/src/bin/media.c +++ b/src/bin/media.c @@ -845,6 +845,7 @@ media_add(Evas_Object *parent, const char *src, const Config *config, int mode, Evas *e; Evas_Object *obj; Media *sd; + int t; EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL); e = evas_object_evas_get(parent); @@ -861,7 +862,7 @@ media_add(Evas_Object *parent, const char *src, const Config *config, int mode, sd->tmpfd = -1; #if HAVE_MKSTEMPS - if (link_is_url(sd->src)) + if (link_is_url(sd->src) && 0) { const char *ext = NULL; char *tbuf; @@ -941,26 +942,27 @@ media_add(Evas_Object *parent, const char *src, const Config *config, int mode, if (!sd->url) sd->realf = eina_stringshare_add(sd->src); - if (_is_fmt(sd->src, extn_img)) + t = media_src_type_get(sd->src); + switch (t) { + case TYPE_IMG: if (!sd->url) _type_img_init(obj); - if (type) *type = TYPE_IMG; - } - else if (_is_fmt(sd->src, extn_scale)) - { + break; + case TYPE_SCALE: if (!sd->url) _type_scale_init(obj); - if (type) *type = TYPE_SCALE; - } - else if (_is_fmt(sd->src, extn_edj)) - { + break; + case TYPE_EDJE: if (!sd->url) _type_edje_init(obj); - if (type) *type = TYPE_EDJE; - } - else if (_is_fmt(sd->src, extn_mov)) - { - if (!sd->url) _type_mov_init(obj); - if (type) *type = TYPE_MOV; + break; + case TYPE_MOV: +// media can stream a url... +// if (!sd->url) + _type_mov_init(obj); + break; + default: + break; } + if (type) *type = t; return obj; } @@ -1025,5 +1027,10 @@ media_src_type_get(const char *src) else if (_is_fmt(src, extn_scale)) type = TYPE_SCALE; else if (_is_fmt(src, extn_edj)) type = TYPE_EDJE; else if (_is_fmt(src, extn_mov)) type = TYPE_MOV; + // handle youtube direct url's + else if ((!strncasecmp(src, "http://", 7)) && + (strstr(src, ".youtube.com/")) && + (strchr(src, '=')) && + (strchr(src, '&'))) type = TYPE_MOV; return type; } -- 2.7.4