summaryrefslogtreecommitdiff
path: root/legacy/emotion/src/modules/vlc/emotion_vlc.h
diff options
context:
space:
mode:
authorVincent Torri <vincent.torri@gmail.com>2008-09-27 21:07:53 +0000
committerVincent Torri <vincent.torri@gmail.com>2008-09-27 21:07:53 +0000
commit0829e2e3bc5c81c103a706e5724962424e714332 (patch)
treed4a9d46dfdc59a5f2be24798fea89546aa7351fa /legacy/emotion/src/modules/vlc/emotion_vlc.h
parent7d07153e8f557809008cdf93af1a04261329efa0 (diff)
add vlc backend
SVN revision: 36280
Diffstat (limited to '')
-rw-r--r--legacy/emotion/src/modules/vlc/emotion_vlc.h182
1 files changed, 182 insertions, 0 deletions
diff --git a/legacy/emotion/src/modules/vlc/emotion_vlc.h b/legacy/emotion/src/modules/vlc/emotion_vlc.h
new file mode 100644
index 0000000000..84faccce9f
--- /dev/null
+++ b/legacy/emotion/src/modules/vlc/emotion_vlc.h
@@ -0,0 +1,182 @@
1/*
2 * SICMA AERO SEAT
3 * code@ife-sit.info
4 */
5
6#ifndef EMOTION_VLC_H
7#define EMOTION_VLC_H
8
9#include <vlc/vlc.h>
10#include <fcntl.h>
11#include <pthread.h>
12
13
14/* default values */
15#define WIDTH 10
16#define HEIGHT 10
17
18/* internal values */
19#define EVENT_BEG_ID 6
20#define NB_EVENTS 14
21
22/* checking macros */
23#define ASSERT_EV(ev) if(!ev)
24#define ASSERT_EV_M(ev) if(!ev->vlc_m)
25#define ASSERT_EV_MP(ev) if(!ev->vlc_mp)
26#define ASSERT_EV_VLC(ev) if(!ev->vlc_player)
27
28#ifdef DEBUG
29#define CATCH(ex) if(libvlc_exception_raised(ex)){ \
30 fprintf(stderr,"VLC EX [%s]::%s:%d %s\n", __FILE__,__func__,__LINE__, \
31 libvlc_exception_get_message(ex)); \
32 }libvlc_exception_clear(ex);
33#else
34#define CATCH(ex) libvlc_exception_clear(ex);
35#endif
36
37/* internal events */
38#define VLC_NEW_FRAME 1
39#define VLC_RESIZE 2
40#define VLC_CHANGE_VOL 3
41
42typedef struct _Emotion_Vlc_Video Emotion_Vlc_Video;
43typedef struct _Emotion_Vlc_Video_Frame Emotion_Vlc_Video_Frame;
44typedef struct _Emotion_Vlc_Event Emotion_Vlc_Event;
45
46/* module api EMOTION --> VLC */
47static unsigned char em_init (Evas_Object *obj, void **emotion_video, Emotion_Module_Options *opt);
48static int em_shutdown (void *ef);
49static unsigned char em_file_open (const char *file, Evas_Object *obj, void *ef);
50static void em_file_close (void *ef);
51static void em_play (void *ef, double pos);
52static void em_stop (void *ef);
53static void em_size_get (void *ef, int *w, int *h);
54static void em_pos_set (void *ef, double pos);
55static void em_vis_set (void *ef, Emotion_Vis vis);
56static double em_len_get (void *ef);
57static int em_fps_num_get (void *ef);
58static int em_fps_den_get (void *ef);
59static double em_fps_get (void *ef);
60static double em_pos_get (void *ef);
61static Emotion_Vis em_vis_get (void *ef);
62static double em_ratio_get (void *ef);
63static int em_seekable (void *ef);
64static void em_frame_done (void *ef);
65static Emotion_Format em_format_get (void *ef);
66static void em_video_data_size_get (void *ef, int *w, int *h);
67static int em_bgra_data_get (void *ef, unsigned char **bgra_data);
68static void em_event_feed (void *ef, int event);
69static void em_event_mouse_button_feed (void *ef, int button, int x, int y);
70static void em_event_mouse_move_feed (void *ef, int x, int y);
71static int em_video_channel_count (void *ef);
72static void em_video_channel_set (void *ef, int channel);
73static int em_video_channel_get (void *ef);
74static const char *em_video_channel_name_get (void *ef, int channel);
75static void em_video_channel_mute_set (void *ef, int mute);
76static int em_video_channel_mute_get (void *ef);
77static int em_audio_channel_count (void *ef);
78static void em_audio_channel_set (void *ef, int channel);
79static int em_audio_channel_get (void *ef);
80static const char *em_audio_channel_name_get (void *ef, int channel);
81static void em_audio_channel_mute_set (void *ef, int mute);
82static int em_audio_channel_mute_get (void *ef);
83static void em_audio_channel_volume_set(void *ef, double vol);
84static double em_audio_channel_volume_get(void *ef);
85static int em_spu_channel_count (void *ef);
86static void em_spu_channel_set (void *ef, int channel);
87static int em_spu_channel_get (void *ef);
88static const char *em_spu_channel_name_get (void *ef, int channel);
89static void em_spu_channel_mute_set (void *ef, int mute);
90static int em_spu_channel_mute_get (void *ef);
91static int em_chapter_count (void *ef);
92static void em_chapter_set (void *ef, int chapter);
93static int em_chapter_get (void *ef);
94static const char *em_chapter_name_get (void *ef, int chapter);
95static void em_speed_set (void *ef, double speed);
96static double em_speed_get (void *ef);
97static int em_eject (void *ef);
98static const char *em_meta_get (void *ef, int meta);
99
100/* entry points for module */
101unsigned char module_open(Evas_Object *obj, const Emotion_Video_Module **module, void **video, Emotion_Module_Options *opt);
102void module_close(Emotion_Video_Module *module, void *video);
103
104typedef struct _vlc_event_t {
105 libvlc_event_type_t type;
106 int data_length;
107 void * data;
108} vlc_event_t;
109
110/* emotion/vlc main structure */
111struct _Emotion_Vlc_Video
112{
113 /* vlc objects */
114 libvlc_instance_t * vlc_player;
115 libvlc_media_player_t * vlc_mp;
116 libvlc_media_t * vlc_m;
117 libvlc_exception_t * vlc_ex;
118 libvlc_event_manager_t * vlc_evtmngr;
119
120 /* vlc datas */
121 char clock[64], cunlock[64], cdata[64];
122 char width[32], height[32], pitch[32];
123
124 int fd_read, fd_write;
125 int fd_slave_read, fd_slave_write;
126 Ecore_Fd_Handler *fd_handler;
127
128 char *filename;
129 volatile double len;
130 volatile double pos;
131 double fps;
132 double ratio;
133 int w, h;
134 Evas_Object *obj;
135 Emotion_Vlc_Video_Frame *cur_frame;
136 volatile int spu_channel;
137 volatile int audio_channel;
138 volatile int video_channel;
139 volatile int fq;
140 Emotion_Vis vis;
141 unsigned char play : 1;
142 unsigned char just_loaded : 1;
143 unsigned char video_mute : 1;
144 unsigned char audio_mute : 1;
145 unsigned char spu_mute : 1;
146 unsigned char opt_no_video : 1;
147 unsigned char opt_no_audio : 1;
148 volatile unsigned char delete_me : 1;
149 volatile unsigned char opening : 1;
150 volatile unsigned char closing : 1;
151 volatile unsigned char have_vo : 1;
152 volatile unsigned char play_ok : 1;
153};
154
155/* structure for frames 2 buffers to keep integrity */
156struct _Emotion_Vlc_Video_Frame
157{
158 unsigned char *frame;
159 unsigned char *frame_A;
160 unsigned char *frame_B;
161 pthread_mutex_t frame_copy_lock;
162};
163
164
165/* internal util calls */
166static void *_em_lock (void *par);
167static void _em_unlock (void *par);
168static void _em_event (const libvlc_event_t *event, void* data);
169static void _em_resize (Emotion_Vlc_Video *ev, int x, int y);
170static int _em_fd_active (void *data, Ecore_Fd_Handler *fdh);
171static int _em_reload_vlc (Emotion_Vlc_Video *ev);
172void* _em_slave_thread (void * t);
173/* internal event struct */
174
175struct _Emotion_Vlc_Event
176{
177 int type;
178 int mtype;
179};
180
181#endif
182