From f3418a540d01cd62050a1f7590be4ce760fceee5 Mon Sep 17 00:00:00 2001 From: "Carsten Haitzler (Rasterman)" Date: Tue, 28 Jan 2014 14:52:03 +0900 Subject: [PATCH] add lowquality option for video --- TODO | 1 - src/bin/key.c | 4 ++++ src/bin/video.c | 25 +++++++++++++++++++++++-- src/bin/video.h | 2 ++ 4 files changed, 29 insertions(+), 3 deletions(-) diff --git a/TODO b/TODO index 694a3a6..86b4da7 100644 --- a/TODO +++ b/TODO @@ -16,5 +16,4 @@ * add subtitle file cmdline * loop all option * show busy anim until opened cb or failure -* quality option (smooth) * add button/control top-left next to audio to do fullscreen/normal toggle diff --git a/src/bin/key.c b/src/bin/key.c index 138d4d0..352d8ae 100644 --- a/src/bin/key.c +++ b/src/bin/key.c @@ -164,6 +164,10 @@ key_handle(Evas_Object *win, Evas_Event_Key_Down *ev) video_ratio_size_get(inf->vid, &w, &h); if ((w > 1) && (h > 1)) evas_object_resize(win, w, h); } + else if (!strcmp(ev->keyname, "y")) + { + video_lowquality_set(inf->vid, !video_lowquality_get(inf->vid)); + } else if (!strcmp(ev->keyname, "z")) { if (inf->zoom_mode == 0) inf->zoom_mode = 1; diff --git a/src/bin/video.c b/src/bin/video.c index 6976614..264816c 100644 --- a/src/bin/video.c +++ b/src/bin/video.c @@ -20,6 +20,7 @@ struct _Video Eina_Bool down : 1; } down; Eina_Bool nosmooth : 1; + Eina_Bool lowqual : 1; Eina_Bool loop : 1; Eina_Bool fill : 1; }; @@ -289,7 +290,8 @@ _unsmooth_timeout(void *data) evas_object_geometry_get(data, &ox, &oy, &ow, &oh); sd->smooth_timer = NULL; sd->nosmooth = EINA_FALSE; - emotion_object_smooth_scale_set(sd->o_vid, !sd->nosmooth); + emotion_object_smooth_scale_set(sd->o_vid, + (!sd->nosmooth) & (!sd->lowqual)); return EINA_FALSE; } @@ -308,7 +310,8 @@ _smooth_handler(Evas_Object *obj) { sd->nosmooth = EINA_TRUE; sd->resizes = 0; - emotion_object_smooth_scale_set(sd->o_vid, !sd->nosmooth); + emotion_object_smooth_scale_set(sd->o_vid, + (!sd->nosmooth) & (!sd->lowqual)); if (sd->smooth_timer) sd->smooth_timer = ecore_timer_del(sd->smooth_timer); sd->smooth_timer = ecore_timer_add(interval * 10, @@ -803,6 +806,24 @@ video_event_send(Evas_Object *obj, Emotion_Event ev) emotion_object_event_simple_send(sd->o_vid, ev); } +void +video_lowquality_set(Evas_Object *obj, Eina_Bool lowq) +{ + Video *sd = evas_object_smart_data_get(obj); + if (!sd) return; + sd->lowqual = lowq; + emotion_object_smooth_scale_set(sd->o_vid, + (!sd->nosmooth) & (!sd->lowqual)); +} + +Eina_Bool +video_lowquality_get(Evas_Object *obj) +{ + Video *sd = evas_object_smart_data_get(obj); + if (!sd) return EINA_FALSE; + return sd->lowqual; +} + // emotion_object_seekable_get // emotion_object_play_speed_set diff --git a/src/bin/video.h b/src/bin/video.h index ed5aaa1..be644f0 100644 --- a/src/bin/video.h +++ b/src/bin/video.h @@ -43,5 +43,7 @@ const char *video_spu_channel_name_get(Evas_Object *obj, int chan); int video_spu_button_count(Evas_Object *obj); int video_spu_button_get(Evas_Object *obj); void video_event_send(Evas_Object *obj, Emotion_Event ev); +void video_lowquality_set(Evas_Object *obj, Eina_Bool lowq); +Eina_Bool video_lowquality_get(Evas_Object *obj); #endif