Hi all,
i would like to make a proof of concept for displaying a jpeg video
stream with evas. I will compare this to gtk. It is for a project that
should run on the new Freerunner from Openmoko so performance is relevant.
My problem:
the evas function: evas_object_image_file_set(image, "test.png", "");
takes the filename as parameter. But my jpeg image is not a file. It
stay in memory only. I do not want to write it at a file.
My question:
Which is the recommended way to read a image from memory in evas?
(I attached my testing code with comments that focus on my intention)
best regards Timo
#include <stdlib.h>
#include <stdio.h>
#include <Evas.h>
#include <Ecore_Evas.h>
#include <Ecore.h>
#define WIDTH 480
#define HEIGHT 640
static int MAX_IMAGESIZE = 1024 * 512;
Ecore_Evas * ee;
Evas * evas;
Evas_Object * base_rect;
static unsigned char *frame=NULL; // buffer for incoming frame
int main(){
evas_init();
ecore_init();
ecore_evas_init();
ee = ecore_evas_software_x11_new(NULL, 0, 0, 0, WIDTH, HEIGHT);
ecore_evas_title_set(ee, "Ecore_Evas Template");
ecore_evas_borderless_set(ee, 0);
ecore_evas_show(ee);
evas = ecore_evas_get(ee);
evas_font_path_append(evas, "fonts/");
base_rect = evas_object_rectangle_add(evas);
evas_object_resize(base_rect, (double)WIDTH, (double)HEIGHT);
evas_object_color_set(base_rect, 244, 243, 242, 255);
evas_object_show(base_rect);
if ( ( frame = malloc ( MAX_IMAGESIZE ) ) == NULL ) {
perror( "not enough memory for worker thread\n" );
exit ( EXIT_FAILURE );
}
// Image loading in memory
// just for demonstration in my real app the image came from a udp stream
FILE *f = fopen("test.png","r");
size_t len=fread(frame,sizeof(char),MAX_IMAGESIZE,f);
// now the image stay in the frame buffer
FILE *stream = open_memstream (frame, len); // i can make a stream of the memory
// I know there is a function to load images from file
// but i do not found any function in api that takes a stream
Evas_Object *image;
/* create an image object */
image = evas_object_image_add(evas);
// for this function i need an alternative to support streams or directly from memory
evas_object_image_file_set(image, "test.png", "");
evas_object_name_set(image, "image");
evas_object_move(image, 0, 0);
evas_object_resize(image, 320, 240);
evas_object_image_fill_set(image, 0, 0, 100, 100);
evas_object_show(image);
ecore_main_loop_begin();
/* when the main event loop exits, shutdown our libraries */
ecore_evas_shutdown();
ecore_shutdown();
evas_shutdown();
return 0;
}
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
enlightenment-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel