-rw-r--r-- | noncore/multimedia/opieplayer2/lib.cpp | 40 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/lib.h | 47 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/nullvideo.c | 37 |
3 files changed, 119 insertions, 5 deletions
diff --git a/noncore/multimedia/opieplayer2/lib.cpp b/noncore/multimedia/opieplayer2/lib.cpp index 0ea85dd..69ff492 100644 --- a/noncore/multimedia/opieplayer2/lib.cpp +++ b/noncore/multimedia/opieplayer2/lib.cpp | |||
@@ -9,9 +9,16 @@ | |||
9 | #include "lib.h" | 9 | #include "lib.h" |
10 | 10 | ||
11 | 11 | ||
12 | extern "C" { | 12 | extern "C" { |
13 | vo_driver_t* init_video_out_plugin( config_values_t* conf, void* video); | 13 | vo_driver_t* init_video_out_plugin( config_values_t* conf, void* video); |
14 | int null_is_showing_video( vo_driver_t* self ); | ||
15 | void null_set_show_video( vo_driver_t* self, int show ); | ||
16 | int null_is_fullscreen( vo_driver_t* self ); | ||
17 | void null_set_fullscreen( vo_driver_t* self, int screen ); | ||
18 | int null_is_scaling( vo_driver_t* self ); | ||
19 | void null_set_scaling( vo_driver_t* self, int scale ); | ||
20 | |||
14 | } | 21 | } |
15 | 22 | ||
16 | using namespace XINE; | 23 | using namespace XINE; |
17 | 24 | ||
@@ -46,15 +53,18 @@ Lib::Lib() { | |||
46 | // m_xine = xine_init( m_videoOutput, | 53 | // m_xine = xine_init( m_videoOutput, |
47 | // m_audioOutput, | 54 | // m_audioOutput, |
48 | // m_config ); | 55 | // m_config ); |
49 | // test loading | 56 | // test loading |
50 | m_videoOutput = ::init_video_out_plugin( m_config, NULL ); | 57 | m_videoOutput = ::init_video_out_plugin( m_config, NULL ); |
51 | m_xine = xine_init( m_videoOutput, | 58 | m_xine = xine_init( m_videoOutput, |
52 | m_audioOutput, m_config ); | 59 | m_audioOutput, m_config ); |
60 | // install the event handler | ||
61 | xine_register_event_listener( m_xine, xine_event_handler, this ); | ||
53 | } | 62 | } |
54 | 63 | ||
55 | Lib::~Lib() { | 64 | Lib::~Lib() { |
56 | delete m_config; | 65 | delete m_config; |
66 | xine_remove_event_listener( m_xine, xine_event_handler ); | ||
57 | xine_exit( m_xine ); | 67 | xine_exit( m_xine ); |
58 | delete m_videoOutput; | 68 | delete m_videoOutput; |
59 | //delete m_audioOutput; | 69 | //delete m_audioOutput; |
60 | 70 | ||
@@ -115,5 +125,29 @@ Frame Lib::currentFrame() { | |||
115 | }; | 125 | }; |
116 | int Lib::error() { | 126 | int Lib::error() { |
117 | return xine_get_error( m_xine ); | 127 | return xine_get_error( m_xine ); |
118 | }; | 128 | }; |
119 | 129 | void Lib::handleXineEvent( xine_event_t* t ) { | |
130 | if ( t->type == XINE_EVENT_PLAYBACK_FINISHED ) | ||
131 | emit stopped(); | ||
132 | } | ||
133 | void Lib::setShowVideo( bool video ) { | ||
134 | ::null_set_show_video( m_videoOutput, video ); | ||
135 | } | ||
136 | bool Lib::isShowingVideo() { | ||
137 | return ::null_is_showing_video( m_videoOutput ); | ||
138 | } | ||
139 | void Lib::showVideoFullScreen( bool fullScreen ) { | ||
140 | ::null_set_fullscreen( m_videoOutput, fullScreen ); | ||
141 | } | ||
142 | bool Lib::isVideoFullScreen() { | ||
143 | return ::null_is_fullscreen( m_videoOutput ); | ||
144 | } | ||
145 | void Lib::setScaling( bool scale ) { | ||
146 | ::null_set_scaling( m_videoOutput, scale ); | ||
147 | } | ||
148 | bool Lib::isScaling() { | ||
149 | return ::null_is_scaling( m_videoOutput ); | ||
150 | } | ||
151 | void Lib::xine_event_handler( void* user_data, xine_event_t* t ) { | ||
152 | ((Lib*)user_data)->handleXineEvent( t ); | ||
153 | } | ||
diff --git a/noncore/multimedia/opieplayer2/lib.h b/noncore/multimedia/opieplayer2/lib.h index d9dc931..00a1248 100644 --- a/noncore/multimedia/opieplayer2/lib.h +++ b/noncore/multimedia/opieplayer2/lib.h | |||
@@ -4,8 +4,10 @@ | |||
4 | #define ZECKEXINELIB_H | 4 | #define ZECKEXINELIB_H |
5 | 5 | ||
6 | #include <qcstring.h> | 6 | #include <qcstring.h> |
7 | #include <qstring.h> | 7 | #include <qstring.h> |
8 | #include <qobject.h> | ||
9 | |||
8 | #include <xine.h> | 10 | #include <xine.h> |
9 | 11 | ||
10 | namespace XINE { | 12 | namespace XINE { |
11 | 13 | ||
@@ -16,9 +18,10 @@ namespace XINE { | |||
16 | * It supports playing, pausing, info, | 18 | * It supports playing, pausing, info, |
17 | * stooping, seeking. | 19 | * stooping, seeking. |
18 | */ | 20 | */ |
19 | class Frame; | 21 | class Frame; |
20 | class Lib { | 22 | class Lib : public QObject { |
23 | Q_OBJECT | ||
21 | public: | 24 | public: |
22 | Lib(); | 25 | Lib(); |
23 | ~Lib(); | 26 | ~Lib(); |
24 | QCString version(); | 27 | QCString version(); |
@@ -44,16 +47,58 @@ namespace XINE { | |||
44 | int length() /*const*/; | 47 | int length() /*const*/; |
45 | 48 | ||
46 | bool isSeekable()/*const*/; | 49 | bool isSeekable()/*const*/; |
47 | 50 | ||
51 | /** | ||
52 | * Whether or not to show video output | ||
53 | */ | ||
54 | void setShowVideo(bool video); | ||
55 | |||
56 | /** | ||
57 | * is we show video | ||
58 | */ | ||
59 | bool isShowingVideo() /*const*/; | ||
60 | |||
61 | /** | ||
62 | * | ||
63 | */ | ||
64 | void showVideoFullScreen( bool fullScreen ); | ||
65 | |||
66 | /** | ||
67 | * | ||
68 | */ | ||
69 | bool isVideoFullScreen()/*const*/ ; | ||
70 | |||
71 | /** | ||
72 | * | ||
73 | */ | ||
74 | bool isScaling(); | ||
75 | |||
76 | /** | ||
77 | * | ||
78 | */ | ||
79 | void setScaling( bool ); | ||
80 | /** | ||
81 | * test | ||
82 | */ | ||
48 | Frame currentFrame()/*const*/; | 83 | Frame currentFrame()/*const*/; |
84 | |||
85 | /** | ||
86 | * Returns the error code | ||
87 | */ | ||
49 | int error() /*const*/; | 88 | int error() /*const*/; |
89 | |||
90 | signals: | ||
91 | void stopped(); | ||
50 | private: | 92 | private: |
51 | xine_t *m_xine; | 93 | xine_t *m_xine; |
52 | config_values_t *m_config; | 94 | config_values_t *m_config; |
53 | vo_driver_t *m_videoOutput; | 95 | vo_driver_t *m_videoOutput; |
54 | ao_driver_t* m_audioOutput; | 96 | ao_driver_t* m_audioOutput; |
55 | 97 | ||
98 | void handleXineEvent( xine_event_t* t ); | ||
99 | // C -> C++ bridge for the event system | ||
100 | static void xine_event_handler( void* user_data, xine_event_t* t); | ||
56 | }; | 101 | }; |
57 | }; | 102 | }; |
58 | 103 | ||
59 | 104 | ||
diff --git a/noncore/multimedia/opieplayer2/nullvideo.c b/noncore/multimedia/opieplayer2/nullvideo.c index 5224862..b8b8eb3 100644 --- a/noncore/multimedia/opieplayer2/nullvideo.c +++ b/noncore/multimedia/opieplayer2/nullvideo.c | |||
@@ -12,9 +12,11 @@ typedef struct null_driver_s null_driver_t; | |||
12 | 12 | ||
13 | struct null_driver_s { | 13 | struct null_driver_s { |
14 | vo_driver_t vo_driver; | 14 | vo_driver_t vo_driver; |
15 | uint32_t m_capabilities; | 15 | uint32_t m_capabilities; |
16 | 16 | int m_show_video; | |
17 | int m_video_fullscreen; | ||
18 | int m_is_scaling; | ||
17 | }; | 19 | }; |
18 | typedef struct opie_frame_s opie_frame_t; | 20 | typedef struct opie_frame_s opie_frame_t; |
19 | struct opie_frame_s { | 21 | struct opie_frame_s { |
20 | vo_frame_t frame; | 22 | vo_frame_t frame; |
@@ -146,8 +148,11 @@ static int null_redraw_needed( vo_driver_t* self ){ | |||
146 | vo_driver_t* init_video_out_plugin( config_values_t* conf, | 148 | vo_driver_t* init_video_out_plugin( config_values_t* conf, |
147 | void* video ){ | 149 | void* video ){ |
148 | null_driver_t *vo; | 150 | null_driver_t *vo; |
149 | vo = (null_driver_t*)malloc( sizeof(null_driver_t ) ); | 151 | vo = (null_driver_t*)malloc( sizeof(null_driver_t ) ); |
152 | vo->m_show_video = 0; // false | ||
153 | vo->m_video_fullscreen = 0; | ||
154 | vo->m_is_scaling = 0; | ||
150 | /* memset? */ | 155 | /* memset? */ |
151 | 156 | ||
152 | /* install callback handlers*/ | 157 | /* install callback handlers*/ |
153 | vo->vo_driver.get_capabilities = null_get_capabilities; | 158 | vo->vo_driver.get_capabilities = null_get_capabilities; |
@@ -180,4 +185,34 @@ static vo_info_t vo_info_null = { | |||
180 | vo_info_t *get_video_out_plugin_info(){ | 185 | vo_info_t *get_video_out_plugin_info(){ |
181 | vo_info_null.description = _("xine video output plugin using null device"); | 186 | vo_info_null.description = _("xine video output plugin using null device"); |
182 | return &vo_info_null; | 187 | return &vo_info_null; |
183 | } | 188 | } |
189 | |||
190 | /* this is special for this device */ | ||
191 | /** | ||
192 | * We know that we will be controled by the XINE LIB++ | ||
193 | */ | ||
194 | |||
195 | /** | ||
196 | * | ||
197 | */ | ||
198 | int null_is_showing_video( vo_driver_t* self ){ | ||
199 | null_driver_t* this = (null_driver_t*)self; | ||
200 | return this->m_show_video; | ||
201 | } | ||
202 | void null_set_show_video( vo_driver_t* self, int show ) { | ||
203 | ((null_driver_t*)self)->m_show_video = show; | ||
204 | } | ||
205 | |||
206 | int null_is_fullscreen( vo_driver_t* self ){ | ||
207 | return ((null_driver_t*)self)->m_video_fullscreen; | ||
208 | } | ||
209 | void null_set_fullscreen( vo_driver_t* self, int screen ){ | ||
210 | ((null_driver_t*)self)->m_video_fullscreen = screen; | ||
211 | } | ||
212 | int null_is_scaling( vo_driver_t* self ){ | ||
213 | return ((null_driver_t*)self)->m_is_scaling; | ||
214 | } | ||
215 | void null_set_scaling( vo_driver_t* self, int scale ){ | ||
216 | ((null_driver_t*)self)->m_is_scaling = scale; | ||
217 | } | ||
218 | |||