summaryrefslogtreecommitdiff
path: root/legacy/emotion/src/lib/emotion_smart.c
diff options
context:
space:
mode:
authorCarsten Haitzler <raster@rasterman.com>2004-06-24 10:55:43 +0000
committerCarsten Haitzler <raster@rasterman.com>2004-06-24 10:55:43 +0000
commit2505c9ec3c6f174d9293181609b1478a6f50ad36 (patch)
tree44b362dec08de0165c97973853436e6d66d31be0 /legacy/emotion/src/lib/emotion_smart.c
parentb97f6616289f206d70b8eb351ae0a1a6d013fcca (diff)
support events coming from xine a lot better...
still need to support title, artist etc. for mp3's and such... SVN revision: 10579
Diffstat (limited to '')
-rw-r--r--legacy/emotion/src/lib/emotion_smart.c175
1 files changed, 174 insertions, 1 deletions
diff --git a/legacy/emotion/src/lib/emotion_smart.c b/legacy/emotion/src/lib/emotion_smart.c
index a4304b697d..d33da425b8 100644
--- a/legacy/emotion/src/lib/emotion_smart.c
+++ b/legacy/emotion/src/lib/emotion_smart.c
@@ -46,6 +46,20 @@ struct _Smart_Data
46 46
47 unsigned char play : 1; 47 unsigned char play : 1;
48 unsigned char seek : 1; 48 unsigned char seek : 1;
49
50 char *title;
51 struct {
52 char *info;
53 double stat;
54 } progress;
55 struct {
56 char *file;
57 int num;
58 } ref;
59 struct {
60 int button_num;
61 int button;
62 } spu;
49}; 63};
50 64
51static void _mouse_move(void *data, Evas *ev, Evas_Object *obj, void *event_info); 65static void _mouse_move(void *data, Evas *ev, Evas_Object *obj, void *event_info);
@@ -135,7 +149,20 @@ emotion_object_file_set(Evas_Object *obj, const char *file)
135 if ((file) && (sd->file) && (!strcmp(file, sd->file))) return; 149 if ((file) && (sd->file) && (!strcmp(file, sd->file))) return;
136 if (sd->file) free(sd->file); 150 if (sd->file) free(sd->file);
137 sd->file = NULL; 151 sd->file = NULL;
138 152 if (sd->title) free(sd->title);
153 sd->title = NULL;
154 if (sd->progress.info) free(sd->progress.info);
155 sd->progress.info = NULL;
156 sd->progress.stat = 0.0;
157 if (sd->ref.file) free(sd->ref.file);
158 sd->ref.file = NULL;
159 sd->ref.num = 0;
160 sd->spu.button_num = 0;
161 sd->spu.button = -1;
162 sd->ratio = 1.0;
163 sd->pos = 0;
164 sd->seek_pos = 0;
165 sd->len = 0;
139 if (file) 166 if (file)
140 { 167 {
141 int w, h; 168 int w, h;
@@ -598,6 +625,70 @@ emotion_object_eject(Evas_Object *obj)
598 sd->module->eject(sd->video); 625 sd->module->eject(sd->video);
599} 626}
600 627
628const char *
629emotion_object_title_get(Evas_Object *obj)
630{
631 Smart_Data *sd;
632
633 E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, NULL);
634 return sd->title;
635}
636
637const char *
638emotion_object_progress_info_get(Evas_Object *obj)
639{
640 Smart_Data *sd;
641
642 E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, NULL);
643 return sd->progress.info;
644}
645
646double
647emotion_object_progress_status_get(Evas_Object *obj)
648{
649 Smart_Data *sd;
650
651 E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, 0.0);
652 return sd->progress.stat;
653}
654
655const char *
656emotion_object_ref_file_get(Evas_Object *obj)
657{
658 Smart_Data *sd;
659
660 E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, NULL);
661 return sd->ref.file;
662}
663
664int
665emotion_object_ref_num_get(Evas_Object *obj)
666{
667 Smart_Data *sd;
668
669 E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, 0);
670 return sd->ref.num;
671}
672
673int
674emotion_object_spu_button_count_get(Evas_Object *obj)
675{
676 Smart_Data *sd;
677
678 E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, 0);
679 return sd->spu.button_num;
680}
681
682int
683emotion_object_spu_button_get(Evas_Object *obj)
684{
685 Smart_Data *sd;
686
687 E_SMART_OBJ_GET_RETURN(sd, obj, E_OBJ_NAME, 0);
688 return sd->spu.button;
689}
690
691
601 692
602 693
603 694
@@ -650,6 +741,8 @@ _emotion_frame_resize(Evas_Object *obj, int w, int h, double ratio)
650 evas_object_image_size_get(sd->obj, &iw, &ih); 741 evas_object_image_size_get(sd->obj, &iw, &ih);
651 if ((w != iw) || (h != ih)) 742 if ((w != iw) || (h != ih))
652 { 743 {
744 if (h > 0) sd->ratio = (double)w / (double)h;
745 else sd->ratio = 1.0;
653 evas_object_image_size_set(sd->obj, w, h); 746 evas_object_image_size_set(sd->obj, w, h);
654 changed = 1; 747 changed = 1;
655 } 748 }
@@ -661,6 +754,83 @@ _emotion_frame_resize(Evas_Object *obj, int w, int h, double ratio)
661 if (changed) evas_object_smart_callback_call(obj, "frame_resize", NULL); 754 if (changed) evas_object_smart_callback_call(obj, "frame_resize", NULL);
662} 755}
663 756
757void
758_emotion_decode_stop(Evas_Object *obj)
759{
760 Smart_Data *sd;
761
762 E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME);
763 if (sd->play)
764 {
765 sd->play = 0;
766 evas_object_smart_callback_call(obj, "decode_stop", NULL);
767 }
768}
769
770void
771_emotion_channels_change(Evas_Object *obj)
772{
773 Smart_Data *sd;
774
775 E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME);
776 evas_object_smart_callback_call(obj, "channels_change", NULL);
777}
778
779void
780_emotion_title_set(Evas_Object *obj, char *title)
781{
782 Smart_Data *sd;
783
784 E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME);
785 if (sd->title) free(sd->title);
786 sd->title = strdup(title);
787 evas_object_smart_callback_call(obj, "title_change", NULL);
788}
789
790void
791_emotion_progress_set(Evas_Object *obj, char *info, double stat)
792{
793 Smart_Data *sd;
794
795 E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME);
796 if (sd->progress.info) free(sd->progress.info);
797 sd->progress.info = strdup(info);
798 sd->progress.stat = stat;
799 evas_object_smart_callback_call(obj, "progress_change", NULL);
800}
801
802void
803_emotion_file_ref_set(Evas_Object *obj, char *file, int num)
804{
805 Smart_Data *sd;
806
807 E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME);
808 if (sd->ref.file) free(sd->ref.file);
809 sd->ref.file = strdup(file);
810 sd->ref.num = num;
811 evas_object_smart_callback_call(obj, "ref_change", NULL);
812}
813
814void
815_emotion_spu_button_num_set(Evas_Object *obj, int num)
816{
817 Smart_Data *sd;
818
819 E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME);
820 sd->spu.button_num = num;
821 evas_object_smart_callback_call(obj, "button_num_change", NULL);
822}
823
824void
825_emotion_spu_button_set(Evas_Object *obj, int button)
826{
827 Smart_Data *sd;
828
829 E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME);
830 sd->spu.button = button;
831 evas_object_smart_callback_call(obj, "button_change", NULL);
832}
833
664 834
665/****************************/ 835/****************************/
666/* Internal object routines */ 836/* Internal object routines */
@@ -803,6 +973,7 @@ _smart_add(Evas_Object * obj)
803 evas_object_image_pixels_get_callback_set(sd->obj, _pixels_get, sd); 973 evas_object_image_pixels_get_callback_set(sd->obj, _pixels_get, sd);
804 evas_object_smart_member_add(sd->obj, obj); 974 evas_object_smart_member_add(sd->obj, obj);
805 sd->ratio = 1.0; 975 sd->ratio = 1.0;
976 sd->spu.button = -1;
806 evas_object_image_alpha_set(sd->obj, 0); 977 evas_object_image_alpha_set(sd->obj, 0);
807 evas_object_smart_data_set(obj, sd); 978 evas_object_smart_data_set(obj, sd);
808} 979}
@@ -819,6 +990,8 @@ _smart_del(Evas_Object * obj)
819 evas_object_del(sd->obj); 990 evas_object_del(sd->obj);
820 if (sd->file) free(sd->file); 991 if (sd->file) free(sd->file);
821 if (sd->job) ecore_job_del(sd->job); 992 if (sd->job) ecore_job_del(sd->job);
993 if (sd->progress.info) free(sd->progress.info);
994 if (sd->ref.file) free(sd->ref.file);
822 free(sd); 995 free(sd);
823} 996}
824 997