Enlightenment CVS committal Author : moom16 Project : e17 Module : libs/emotion
Dir : e17/libs/emotion/src/lib Modified Files: emotion_private.h emotion_smart.c Log Message: * Add support of yuy2 to emotion_xine module. So now, we can play wmv movies! I had to make some module API changes: - rename yuv_size_get to video_data_size_get - add the function "Emotion_Format (*format_get) (void *ef);" in Emotion_Video_Module. This function should return the format used by the video (EMOTION_YV12, EMOTION_YUY2 or EMOTION_BGRA). I use a yuy2->bgra converter since evas doesn't support YUY2. This converter should be rewrite since it's really not optimized and since it is under GPLv2 (emotion is under BSD). I added an explicit comment above the function for that, but it'd be better to use a converter under BSD. If it's really incompatible with emotion license, I will remove it. =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/emotion/src/lib/emotion_private.h,v retrieving revision 1.5 retrieving revision 1.6 diff -u -3 -r1.5 -r1.6 --- emotion_private.h 24 Apr 2005 14:42:49 -0000 1.5 +++ emotion_private.h 8 Jul 2005 19:56:46 -0000 1.6 @@ -15,8 +15,16 @@ #define META_TRACK_YEAR 6 #define META_TRACK_DISCID 7 +typedef enum _Emotion_Format Emotion_Format; typedef struct _Emotion_Video_Module Emotion_Video_Module; +enum _Emotion_Format +{ + EMOTION_YV12, + EMOTION_YUY2, /* unused for now since evas does not support yuy2 format */ + EMOTION_BGRA +}; + struct _Emotion_Video_Module { unsigned char (*init) (Evas_Object *obj, void **video); @@ -35,8 +43,10 @@ int (*audio_handled) (void *ef); int (*seekable) (void *ef); void (*frame_done) (void *ef); - void (*yuv_size_get) (void *ef, int *w, int *h); + Emotion_Format (*format_get) (void *ef); + void (*video_data_size_get) (void *ef, int *w, int *h); int (*yuv_rows_get) (void *ef, int w, int h, unsigned char **yrows, unsigned char **urows, unsigned char **vrows); + int (*bgra_data_get) (void *ef, unsigned char **bgra_data); void (*event_feed) (void *ef, int event); void (*event_mouse_button_feed) (void *ef, int button, int x, int y); void (*event_mouse_move_feed) (void *ef, int x, int y); =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/emotion/src/lib/emotion_smart.c,v retrieving revision 1.12 retrieving revision 1.13 diff -u -3 -r1.12 -r1.13 --- emotion_smart.c 18 Jun 2005 05:29:25 -0000 1.12 +++ emotion_smart.c 8 Jul 2005 19:56:47 -0000 1.13 @@ -982,42 +982,55 @@ static void _pixels_get(void *data, Evas_Object *obj) { - Evas_Pixel_Import_Source ps; int iw, ih, w, h; - int i; - unsigned char **rows; Smart_Data *sd; + Emotion_Format format; sd = data; evas_object_image_size_get(obj, &iw, &ih); - sd->module->yuv_size_get(sd->video, &w, &h); + sd->module->video_data_size_get(sd->video, &w, &h); if ((w != iw) || (h != ih)) { - evas_object_image_size_set(obj, w, h); - iw = w; - ih = h; + evas_object_image_size_set(obj, w, h); + iw = w; + ih = h; } - ps.format = EVAS_PIXEL_FORMAT_YUV420P_601; - ps.w = iw; - ps.h = ih; - - ps.rows = malloc(ps.h * 2 * sizeof(void *)); - if (!ps.rows) + format = sd->module->format_get(sd->video); + if (format == EMOTION_YV12) { - sd->module->frame_done(sd->video); - return; - } + unsigned char **rows; + Evas_Pixel_Import_Source ps; + ps.format = EVAS_PIXEL_FORMAT_YUV420P_601; + ps.w = iw; + ps.h = ih; + + ps.rows = malloc(ps.h * 2 * sizeof(void *)); + if (!ps.rows) + { + sd->module->frame_done(sd->video); + return; + } - rows = (unsigned char **)ps.rows; - - if (sd->module->yuv_rows_get(sd->video, iw, ih, - rows, - &rows[ps.h], - &rows[ps.h + (ps.h / 2)])) - evas_object_image_pixels_import(obj, &ps); - evas_object_image_pixels_dirty_set(obj, 0); - free(ps.rows); + rows = (unsigned char **)ps.rows; + + if (sd->module->yuv_rows_get(sd->video, iw, ih, + rows, + &rows[ps.h], + &rows[ps.h + (ps.h / 2)])) + evas_object_image_pixels_import(obj, &ps); + evas_object_image_pixels_dirty_set(obj, 0); + free(ps.rows); + } + else if (format == EMOTION_BGRA) + { + unsigned char *bgra_data; + if (sd->module->bgra_data_get(sd->video, &bgra_data)); + { + evas_object_image_data_set(obj, bgra_data); + } + } + sd->module->frame_done(sd->video); } ------------------------------------------------------- This SF.Net email is sponsored by the 'Do More With Dual!' webinar happening July 14 at 8am PDT/11am EDT. We invite you to explore the latest in dual core and dual graphics technology at this free one hour event hosted by HP, AMD, and NVIDIA. To register visit http://www.hp.com/go/dualwebinar _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs