Enlightenment CVS committal
Author : xenith
Project : misc
Module : envision
Dir : misc/envision/src
Modified Files:
callbacks.c envision.c envision.h
Log Message:
Start of code for aspect ratios.
===================================================================
RCS file: /cvsroot/enlightenment/misc/envision/src/callbacks.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -3 -r1.2 -r1.3
--- callbacks.c 9 Aug 2004 07:38:15 -0000 1.2
+++ callbacks.c 14 Aug 2004 08:19:19 -0000 1.3
@@ -1,5 +1,71 @@
#include "envision.h"
+/* if the canvas is resized - resize the video too */
+void
+canvas_resize(Ecore_Evas *ee)
+{
+ Evas * evas = ecore_evas_get(ee);
+ Evas_Object * edje = evas_object_name_find(evas, "edje");
+ Evas_Object * emotion = evas_object_name_find(evas, "emotion");
+ Evas_Coord x, y, w, h;
+ int vw, vh;
+ double ratio;
+
+ /* resize the video object AND retain aspect ratio */
+ /* get the video size in pixels */
+ emotion_object_size_get(emotion, &vw, &vh);
+ /* get the video ratio */
+ ratio = emotion_object_ratio_get(emotion);
+ /* if the ratio > 0.0 then the video wants awidth / height ratio on the */
+ /* screen as returned indicated by this ratio value. this is irrespective */
+ /* of the pixel size of the video and indicates the video wants to scale */
+ if (ratio > 0.0) {
+ x = 0;
+ y = (h - (w / ratio)) / 2;
+
+ if (y < 0) {
+ y = 0;
+ x = (w - (h * ratio)) / 2;
+ w = h * ratio;
+ } else {
+ h = w / ratio;
+ }
+
+ evas_object_resize(edje, w, h);
+ } else {
+ if (vh > 0) {
+ /* generate ratio from the pixel size */
+ ratio = (double)vw / (double)vh;
+ } else {
+ ratio = 1.0;
+ }
+
+ x = 0;
+ y = (h - (w / ratio)) / 2;
+
+ if (y < 0) {
+ y = 0;
+ x = (w - (h * ratio)) / 2;
+ w = h * ratio;
+ } else {
+ h = w / ratio;
+ }
+
+ evas_object_resize(edje, w, h);
+ }
+}
+
+void
+ecore_resize(Ecore_Evas *ee)
+{
+ Evas * evas = ecore_evas_get(ee);
+ Evas_Object * edje = evas_object_name_find(evas, "edje");
+ int ws = 0, hs = 0;
+
+ ecore_evas_geometry_get(ee, NULL, NULL, &ws, &hs);
+ evas_object_resize(edje, (Evas_Coord)ws, (Evas_Coord)hs);
+}
+
void
pause_callback(void *data, Evas_Object *obj, const char *emission, const char *source)
{
@@ -80,6 +146,7 @@
{
Envision * e = data;
double volume;
+ char vol_str[3];
volume = emotion_object_audio_volume_get(e->gui.emotion);
volume = volume + 0.10;
@@ -96,6 +163,7 @@
{
Envision * e = data;
double volume;
+ char vol_str[3];
volume = emotion_object_audio_volume_get(e->gui.emotion);
volume = volume - 0.10;
@@ -129,17 +197,6 @@
}
void
-ecore_resize(Ecore_Evas *ee)
-{
- int ws = 0, hs = 0;
- Evas * evas = ecore_evas_get(ee);
- Evas_Object * edje = evas_object_name_find(evas, "edje");
-
- ecore_evas_geometry_get(ee, NULL, NULL, &ws, &hs);
- evas_object_resize(edje, (Evas_Coord)ws, (Evas_Coord)hs);
-}
-
-void
update_timer(void *data, Evas_Object *obj, void *event_info)
{
Envision * e = data;
===================================================================
RCS file: /cvsroot/enlightenment/misc/envision/src/envision.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -3 -r1.10 -r1.11
--- envision.c 9 Aug 2004 07:38:15 -0000 1.10
+++ envision.c 14 Aug 2004 08:19:20 -0000 1.11
@@ -16,17 +16,17 @@
int
main(int argc, char **argv)
{
- if(argc < 1) {
- printf("Envision - EFL-Powered DVD Player\n");
- printf("=================================\n");
+ if(argc < 2) {
+ printf("Envision - Enlightenment Media Player\n");
+ printf("=====================================\n");
printf("Usage: %s [video]\n", argv[0]);
return(1);
}
Envision * e = NULL;
double volume, vid_len;
- Evas_Coord minw, minh;
- int w, h;
+ char vol_str[3];
+ Evas_Coord minw, minh, w, h;
e = envision_new();
e->config.width = 400;
@@ -41,7 +41,8 @@
// Setup evas canvas
e->gui.ee = ecore_evas_software_x11_new(NULL, 0, 0, 0, e->config.width,
e->config.height);
- ecore_evas_title_set(e->gui.ee, "Envision DVD Player");
+ ecore_evas_title_set(e->gui.ee, "Envision Media Player");
+ ecore_evas_name_class_set(e->gui.ee, "envision", "Envision");
ecore_evas_borderless_set(e->gui.ee, 1);
ecore_evas_shaped_set(e->gui.ee, 1);
ecore_evas_show(e->gui.ee);
@@ -76,6 +77,7 @@
printf("Emotion: Playing - %s Length: %d\n",
argv[1], (double)emotion_object_play_length_get(e->gui.emotion));
emotion_object_play_set(e->gui.emotion, 1);
+ evas_object_name_set(e->gui.emotion, "emotion");
/* EDJE STUFF */
===================================================================
RCS file: /cvsroot/enlightenment/misc/envision/src/envision.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -3 -r1.2 -r1.3
--- envision.h 9 Aug 2004 07:38:15 -0000 1.2
+++ envision.h 14 Aug 2004 08:19:20 -0000 1.3
@@ -6,8 +6,6 @@
#include <Emotion.h>
#include <Edje.h>
-char vol_str[3];
-
typedef struct {
int width;
int height;
@@ -31,6 +29,9 @@
void envision_delete(Envision *e);
// callbacks.c
+void canvas_resize(Ecore_Evas *ee);
+void ecore_resize(Ecore_Evas *ee);
+void update_timer(void *data, Evas_Object *obj, void *event_info);
void quit_edjecallback(void *data, Evas_Object *obj, const char *emission,
const char *source);
void raisevol_edjecallback(void *data, Evas_Object *obj, const char *emission,
@@ -43,8 +44,6 @@
const char *emission, const char *source);
void seekbackward_edjecallback(void *data, Evas_Object *obj,
const char *emission, const char *source);
-void ecore_resize(Ecore_Evas *ee);
-void update_timer(void *data, Evas_Object *obj, void *event_info);
void pause_callback(void *data, Evas_Object *obj, const char *emission,
const char *source);
void play_callback(void *data, Evas_Object *obj, const char *emission,
-------------------------------------------------------
SF.Net email is sponsored by Shop4tech.com-Lowest price on Blank Media
100pk Sonic DVD-R 4x for only $29 -100pk Sonic DVD+R for only $33
Save 50% off Retail on Ink & Toner - Free Shipping and Free Gift.
http://www.shop4tech.com/z/Inkjet_Cartridges/9_108_r285
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs