summaryrefslogtreecommitdiff
path: root/legacy
diff options
context:
space:
mode:
authormoom16 <moom16>2005-07-08 20:28:50 +0000
committermoom16 <moom16@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>2005-07-08 20:28:50 +0000
commit8e204f7f5668256ec7508a6f88f8c9f8a3c4255e (patch)
tree03a5e471dd8353af13c1a931487a93f865e73acb /legacy
parent8e4e372d878c2a964d9b3ef123c7aa34f0691915 (diff)
* Cancel last changes since it seems there are some license problems.
Sorry guys, I didn't think GPLv2 was so "contaminating" SVN revision: 15677
Diffstat (limited to 'legacy')
-rw-r--r--legacy/emotion/src/lib/emotion_private.h12
-rw-r--r--legacy/emotion/src/lib/emotion_smart.c63
-rw-r--r--legacy/emotion/src/modules/emotion_xine.c40
-rw-r--r--legacy/emotion/src/modules/emotion_xine.h2
-rw-r--r--legacy/emotion/src/modules/xine/emotion_xine_vo_out.c109
5 files changed, 31 insertions, 195 deletions
diff --git a/legacy/emotion/src/lib/emotion_private.h b/legacy/emotion/src/lib/emotion_private.h
index 8afc748d4b..15eab8e56d 100644
--- a/legacy/emotion/src/lib/emotion_private.h
+++ b/legacy/emotion/src/lib/emotion_private.h
@@ -15,16 +15,8 @@
15#define META_TRACK_YEAR 6 15#define META_TRACK_YEAR 6
16#define META_TRACK_DISCID 7 16#define META_TRACK_DISCID 7
17 17
18typedef enum _Emotion_Format Emotion_Format;
19typedef struct _Emotion_Video_Module Emotion_Video_Module; 18typedef struct _Emotion_Video_Module Emotion_Video_Module;
20 19
21enum _Emotion_Format
22{
23 EMOTION_YV12,
24 EMOTION_YUY2, /* unused for now since evas does not support yuy2 format */
25 EMOTION_BGRA
26};
27
28struct _Emotion_Video_Module 20struct _Emotion_Video_Module
29{ 21{
30 unsigned char (*init) (Evas_Object *obj, void **video); 22 unsigned char (*init) (Evas_Object *obj, void **video);
@@ -43,10 +35,8 @@ struct _Emotion_Video_Module
43 int (*audio_handled) (void *ef); 35 int (*audio_handled) (void *ef);
44 int (*seekable) (void *ef); 36 int (*seekable) (void *ef);
45 void (*frame_done) (void *ef); 37 void (*frame_done) (void *ef);
46 Emotion_Format (*format_get) (void *ef); 38 void (*yuv_size_get) (void *ef, int *w, int *h);
47 void (*video_data_size_get) (void *ef, int *w, int *h);
48 int (*yuv_rows_get) (void *ef, int w, int h, unsigned char **yrows, unsigned char **urows, unsigned char **vrows); 39 int (*yuv_rows_get) (void *ef, int w, int h, unsigned char **yrows, unsigned char **urows, unsigned char **vrows);
49 int (*bgra_data_get) (void *ef, unsigned char **bgra_data);
50 void (*event_feed) (void *ef, int event); 40 void (*event_feed) (void *ef, int event);
51 void (*event_mouse_button_feed) (void *ef, int button, int x, int y); 41 void (*event_mouse_button_feed) (void *ef, int button, int x, int y);
52 void (*event_mouse_move_feed) (void *ef, int x, int y); 42 void (*event_mouse_move_feed) (void *ef, int x, int y);
diff --git a/legacy/emotion/src/lib/emotion_smart.c b/legacy/emotion/src/lib/emotion_smart.c
index a5596cb685..834841b038 100644
--- a/legacy/emotion/src/lib/emotion_smart.c
+++ b/legacy/emotion/src/lib/emotion_smart.c
@@ -982,55 +982,42 @@ _pos_set_job(void *data)
982static void 982static void
983_pixels_get(void *data, Evas_Object *obj) 983_pixels_get(void *data, Evas_Object *obj)
984{ 984{
985 Evas_Pixel_Import_Source ps;
985 int iw, ih, w, h; 986 int iw, ih, w, h;
987 int i;
988 unsigned char **rows;
986 Smart_Data *sd; 989 Smart_Data *sd;
987 Emotion_Format format;
988 990
989 sd = data; 991 sd = data;
990 evas_object_image_size_get(obj, &iw, &ih); 992 evas_object_image_size_get(obj, &iw, &ih);
991 sd->module->video_data_size_get(sd->video, &w, &h); 993 sd->module->yuv_size_get(sd->video, &w, &h);
992 if ((w != iw) || (h != ih)) 994 if ((w != iw) || (h != ih))
993 { 995 {
994 evas_object_image_size_set(obj, w, h); 996 evas_object_image_size_set(obj, w, h);
995 iw = w; 997 iw = w;
996 ih = h; 998 ih = h;
997 } 999 }
998 format = sd->module->format_get(sd->video); 1000 ps.format = EVAS_PIXEL_FORMAT_YUV420P_601;
999 if (format == EMOTION_YV12) 1001 ps.w = iw;
1000 { 1002 ps.h = ih;
1001 unsigned char **rows;
1002 Evas_Pixel_Import_Source ps;
1003 1003
1004 ps.format = EVAS_PIXEL_FORMAT_YUV420P_601; 1004 ps.rows = malloc(ps.h * 2 * sizeof(void *));
1005 ps.w = iw; 1005 if (!ps.rows)
1006 ps.h = ih;
1007
1008 ps.rows = malloc(ps.h * 2 * sizeof(void *));
1009 if (!ps.rows)
1010 {
1011 sd->module->frame_done(sd->video);
1012 return;
1013 }
1014
1015 rows = (unsigned char **)ps.rows;
1016
1017 if (sd->module->yuv_rows_get(sd->video, iw, ih,
1018 rows,
1019 &rows[ps.h],
1020 &rows[ps.h + (ps.h / 2)]))
1021 evas_object_image_pixels_import(obj, &ps);
1022 evas_object_image_pixels_dirty_set(obj, 0);
1023 free(ps.rows);
1024 }
1025 else if (format == EMOTION_BGRA)
1026 { 1006 {
1027 unsigned char *bgra_data; 1007 sd->module->frame_done(sd->video);
1028 if (sd->module->bgra_data_get(sd->video, &bgra_data)); 1008 return;
1029 {
1030 evas_object_image_data_set(obj, bgra_data);
1031 }
1032 } 1009 }
1033 1010
1011
1012 rows = (unsigned char **)ps.rows;
1013
1014 if (sd->module->yuv_rows_get(sd->video, iw, ih,
1015 rows,
1016 &rows[ps.h],
1017 &rows[ps.h + (ps.h / 2)]))
1018 evas_object_image_pixels_import(obj, &ps);
1019 evas_object_image_pixels_dirty_set(obj, 0);
1020 free(ps.rows);
1034 sd->module->frame_done(sd->video); 1021 sd->module->frame_done(sd->video);
1035} 1022}
1036 1023
diff --git a/legacy/emotion/src/modules/emotion_xine.c b/legacy/emotion/src/modules/emotion_xine.c
index d2c53acd50..d7c225bd0a 100644
--- a/legacy/emotion/src/modules/emotion_xine.c
+++ b/legacy/emotion/src/modules/emotion_xine.c
@@ -16,10 +16,8 @@ static double em_pos_get(void *ef);
16static double em_ratio_get(void *ef); 16static double em_ratio_get(void *ef);
17static int em_seekable(void *ef); 17static int em_seekable(void *ef);
18static void em_frame_done(void *ef); 18static void em_frame_done(void *ef);
19static Emotion_Format em_format_get(void *ef); 19static void em_yuv_size_get(void *ef, int *w, int *h);
20static void em_video_data_size_get(void *ef, int *w, int *h);
21static int em_yuv_rows_get(void *ef, int w, int h, unsigned char **yrows, unsigned char **urows, unsigned char **vrows); 20static int em_yuv_rows_get(void *ef, int w, int h, unsigned char **yrows, unsigned char **urows, unsigned char **vrows);
22static int em_bgra_data_get(void *ef, unsigned char **bgra_data);
23static void em_event_feed(void *ef, int event); 21static void em_event_feed(void *ef, int event);
24static void em_event_mouse_button_feed(void *ef, int button, int x, int y); 22static void em_event_mouse_button_feed(void *ef, int button, int x, int y);
25static void em_event_mouse_move_feed(void *ef, int x, int y); 23static void em_event_mouse_move_feed(void *ef, int x, int y);
@@ -546,21 +544,8 @@ em_frame_done(void *ef)
546 } 544 }
547} 545}
548 546
549static Emotion_Format em_format_get(void *ef)
550{
551 Emotion_Xine_Video *ev;
552 Emotion_Xine_Video_Frame *fr;
553
554 ev = (Emotion_Xine_Video *)ef;
555 fr = ev->cur_frame;
556
557 if (fr)
558 return fr->format;
559 return EMOTION_YV12;
560}
561
562static void 547static void
563em_video_data_size_get(void *ef, int *w, int *h) 548em_yuv_size_get(void *ef, int *w, int *h)
564{ 549{
565 Emotion_Xine_Video *ev; 550 Emotion_Xine_Video *ev;
566 Emotion_Xine_Video_Frame *fr; 551 Emotion_Xine_Video_Frame *fr;
@@ -598,23 +583,6 @@ em_yuv_rows_get(void *ef, int w, int h, unsigned char **yrows, unsigned char **u
598 return 0; 583 return 0;
599} 584}
600 585
601static int
602em_bgra_data_get(void *ef, unsigned char **bgra_data)
603{
604 Emotion_Xine_Video *ev;
605 Emotion_Xine_Video_Frame *fr;
606
607 ev = (Emotion_Xine_Video *)ef;
608 fr = ev->cur_frame;
609 if (!fr) return 0;
610 if (fr->bgra_data)
611 {
612 *bgra_data = fr->bgra_data;
613 return 1;
614 }
615 return 0;
616}
617
618static void 586static void
619em_event_feed(void *ef, int event) 587em_event_feed(void *ef, int event)
620{ 588{
@@ -1369,10 +1337,8 @@ static Emotion_Video_Module em_module =
1369 em_audio_handled, /* audio_handled */ 1337 em_audio_handled, /* audio_handled */
1370 em_seekable, /* seekable */ 1338 em_seekable, /* seekable */
1371 em_frame_done, /* frame_done */ 1339 em_frame_done, /* frame_done */
1372 em_format_get, /* format_get */ 1340 em_yuv_size_get, /* yuv_size_get */
1373 em_video_data_size_get, /* video_data_size_get */
1374 em_yuv_rows_get, /* yuv_rows_get */ 1341 em_yuv_rows_get, /* yuv_rows_get */
1375 em_bgra_data_get, /* bgra_data_get */
1376 em_event_feed, /* event_feed */ 1342 em_event_feed, /* event_feed */
1377 em_event_mouse_button_feed, /* event_mouse_button_feed */ 1343 em_event_mouse_button_feed, /* event_mouse_button_feed */
1378 em_event_mouse_move_feed, /* event_mouse_move_feed */ 1344 em_event_mouse_move_feed, /* event_mouse_move_feed */
diff --git a/legacy/emotion/src/modules/emotion_xine.h b/legacy/emotion/src/modules/emotion_xine.h
index 47bab1a73a..f796bc9369 100644
--- a/legacy/emotion/src/modules/emotion_xine.h
+++ b/legacy/emotion/src/modules/emotion_xine.h
@@ -57,9 +57,7 @@ struct _Emotion_Xine_Video_Frame
57{ 57{
58 int w, h; 58 int w, h;
59 double ratio; 59 double ratio;
60 Emotion_Format format;
61 unsigned char *y, *u, *v; 60 unsigned char *y, *u, *v;
62 unsigned char *bgra_data;
63 int y_stride, u_stride, v_stride; 61 int y_stride, u_stride, v_stride;
64 Evas_Object *obj; 62 Evas_Object *obj;
65 double timestamp; 63 double timestamp;
diff --git a/legacy/emotion/src/modules/xine/emotion_xine_vo_out.c b/legacy/emotion/src/modules/xine/emotion_xine_vo_out.c
index 3f90fff7ba..391f9acfd1 100644
--- a/legacy/emotion/src/modules/xine/emotion_xine_vo_out.c
+++ b/legacy/emotion/src/modules/xine/emotion_xine_vo_out.c
@@ -94,8 +94,6 @@ static void _emotion_overlay_blend (vo_driver_t *vo_driver, vo_f
94static void _emotion_overlay_mem_blend_8 (uint8_t *mem, uint8_t val, uint8_t o, size_t sz); 94static void _emotion_overlay_mem_blend_8 (uint8_t *mem, uint8_t val, uint8_t o, size_t sz);
95static void _emotion_overlay_blend_yuv (uint8_t *dst_base[3], vo_overlay_t * img_overl, int dst_width, int dst_height, int dst_pitches[3]); 95static void _emotion_overlay_blend_yuv (uint8_t *dst_base[3], vo_overlay_t * img_overl, int dst_width, int dst_height, int dst_pitches[3]);
96 96
97static void _emotion_yuy2_to_bgra32 (int width, int height, unsigned char *src, unsigned char *dst);
98
99/***************************************************************************/ 97/***************************************************************************/
100static vo_info_t _emotion_info = 98static vo_info_t _emotion_info =
101{ 99{
@@ -217,7 +215,7 @@ _emotion_capabilities_get(vo_driver_t *vo_driver)
217 215
218 dv = (Emotion_Driver *)vo_driver; 216 dv = (Emotion_Driver *)vo_driver;
219// printf("emotion: _emotion_capabilities_get()\n"); 217// printf("emotion: _emotion_capabilities_get()\n");
220 return VO_CAP_YV12 | VO_CAP_YUY2; 218 return VO_CAP_YV12;
221} 219}
222 220
223/***************************************************************************/ 221/***************************************************************************/
@@ -360,7 +358,6 @@ _emotion_frame_format_update(vo_driver_t *vo_driver, vo_frame_t *vo_frame, uint3
360 { 358 {
361 int y_size, uv_size; 359 int y_size, uv_size;
362 360
363 fr->frame.format = EMOTION_YV12;
364 fr->vo_frame.pitches[0] = 8 * ((width + 7) / 8); 361 fr->vo_frame.pitches[0] = 8 * ((width + 7) / 8);
365 fr->vo_frame.pitches[1] = 8 * ((width + 15) / 16); 362 fr->vo_frame.pitches[1] = 8 * ((width + 15) / 16);
366 fr->vo_frame.pitches[2] = 8 * ((width + 15) / 16); 363 fr->vo_frame.pitches[2] = 8 * ((width + 15) / 16);
@@ -377,49 +374,19 @@ _emotion_frame_format_update(vo_driver_t *vo_driver, vo_frame_t *vo_frame, uint3
377 fr->frame.y = fr->vo_frame.base[0]; 374 fr->frame.y = fr->vo_frame.base[0];
378 fr->frame.u = fr->vo_frame.base[1]; 375 fr->frame.u = fr->vo_frame.base[1];
379 fr->frame.v = fr->vo_frame.base[2]; 376 fr->frame.v = fr->vo_frame.base[2];
380 fr->frame.bgra_data = NULL;
381 fr->frame.y_stride = fr->vo_frame.pitches[0]; 377 fr->frame.y_stride = fr->vo_frame.pitches[0];
382 fr->frame.u_stride = fr->vo_frame.pitches[1]; 378 fr->frame.u_stride = fr->vo_frame.pitches[1];
383 fr->frame.v_stride = fr->vo_frame.pitches[2]; 379 fr->frame.v_stride = fr->vo_frame.pitches[2];
384 fr->frame.obj = dv->ev->obj; 380 fr->frame.obj = dv->ev->obj;
385 } 381 }
386 break; 382 break;
387 case XINE_IMGFMT_YUY2:
388 {
389 int y_size, uv_size;
390
391 fr->frame.format = EMOTION_BGRA;
392 fr->vo_frame.pitches[0] = 8 * ((width + 3) / 4);
393 fr->vo_frame.pitches[1] = 0;
394 fr->vo_frame.pitches[2] = 0;
395
396 fr->vo_frame.base[0] = malloc(fr->vo_frame.pitches[0] * height);
397 fr->vo_frame.base[1] = NULL;
398 fr->vo_frame.base[2] = NULL;
399
400 fr->frame.w = fr->width;
401 fr->frame.h = fr->height;
402 fr->frame.ratio = fr->vo_frame.ratio;
403 fr->frame.y = NULL;
404 fr->frame.u = NULL;
405 fr->frame.v = NULL;
406 fr->frame.bgra_data = malloc(fr->width * fr->height * 4);
407 fr->frame.y_stride = 0;
408 fr->frame.u_stride = 0;
409 fr->frame.v_stride = 0;
410 fr->frame.obj = dv->ev->obj;
411 }
412 break;
413 default: 383 default:
414 break; 384 break;
415 } 385 }
416 if (((format == XINE_IMGFMT_YV12) 386 if (((format == XINE_IMGFMT_YV12)
417 && ((fr->vo_frame.base[0] == NULL) 387 && ((fr->vo_frame.base[0] == NULL)
418 || (fr->vo_frame.base[1] == NULL) 388 || (fr->vo_frame.base[1] == NULL)
419 || (fr->vo_frame.base[2] == NULL))) 389 || (fr->vo_frame.base[2] == NULL))))
420 || ((format == XINE_IMGFMT_YUY2)
421 && ((fr->vo_frame.base[0] == NULL)
422 || (fr->frame.bgra_data == NULL))))
423 { 390 {
424 _emotion_frame_data_free(fr); 391 _emotion_frame_data_free(fr);
425 } 392 }
@@ -441,11 +408,6 @@ _emotion_frame_display(vo_driver_t *vo_driver, vo_frame_t *vo_frame)
441 { 408 {
442 void *buf; 409 void *buf;
443 int ret; 410 int ret;
444
445 if (fr->format == XINE_IMGFMT_YUY2)
446 {
447 _emotion_yuy2_to_bgra32(fr->width, fr->height, fr->vo_frame.base[0], fr->frame.bgra_data);
448 }
449 411
450 buf = &(fr->frame); 412 buf = &(fr->frame);
451 fr->frame.timestamp = (double)fr->vo_frame.vpts / 90000.0; 413 fr->frame.timestamp = (double)fr->vo_frame.vpts / 90000.0;
@@ -482,11 +444,6 @@ _emotion_frame_data_free(Emotion_Frame *fr)
482 fr->frame.u = fr->vo_frame.base[1]; 444 fr->frame.u = fr->vo_frame.base[1];
483 fr->frame.v = fr->vo_frame.base[2]; 445 fr->frame.v = fr->vo_frame.base[2];
484 } 446 }
485 if (fr->frame.bgra_data)
486 {
487 free(fr->frame.bgra_data);
488 fr->frame.bgra_data = NULL;
489 }
490} 447}
491 448
492static void 449static void
@@ -715,65 +672,3 @@ static void _emotion_overlay_blend_yuv(uint8_t *dst_base[3], vo_overlay_t * img_
715 } 672 }
716 } 673 }
717} 674}
718
719/*MoOm:
720* yuy2 to bgra converter taken from vgrabbj (http://vgrabbj.gecius.de)
721* This code is under GPLv2. Copyright Jens Gecius.
722* If it causes problem with emotion BSD license, tell me, I'll remove it!
723* TODO: Really need to improve this converter!
724*/
725#define LIMIT(x) ((x) > 0xffff ? 0xff : ((x) <= 0xff ? 0 : ((x) >> 8 )))
726
727static void
728_emotion_yuy2_to_bgra32(int width, int height, unsigned char *src, unsigned char *dst)
729{
730 int line, col, linewidth;
731 int y, yy;
732 int u, v;
733 int vr, ug, vg, ub;
734 int r, g, b;
735 unsigned char *py, *pu, *pv;
736
737 linewidth = width - (width >> 1);
738 py = src;
739 pu = src + 1;
740 pv = src + 3;
741
742 y = *py;
743 yy = y << 8;
744 u = *pu - 128;
745 ug = 88 * u;
746 ub = 454 * u;
747 v = *pv - 128;
748 vg = 183 * v;
749 vr = 359 * v;
750
751 for (line = 0; line < height; line++)
752 {
753 for (col = 0; col < width; col++)
754 {
755 r = LIMIT(yy + vr);
756 g = LIMIT(yy - ug - vg);
757 b = LIMIT(yy + ub);
758 *dst++ = b;
759 *dst++ = g;
760 *dst++ = r;
761 *dst++ = 0;
762
763 py += 2;
764 y = *py;
765 yy = y << 8;
766 if ((col & 1) == 1)
767 {
768 pu += 4; //skip yvy every second y
769 pv += 4; //skip yuy every second y
770 }
771 u = *pu - 128;
772 ug = 88 * u;
773 ub = 454 * u;
774 v = *pv - 128;
775 vg = 183 * v;
776 vr = 359 * v;
777 }
778 }
779}