-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 | |||
@@ -11,5 +11,12 @@ | |||
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 | ||
@@ -48,11 +55,14 @@ Lib::Lib() { | |||
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; |
@@ -117,3 +127,27 @@ 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 | |||
@@ -6,4 +6,6 @@ | |||
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 | ||
@@ -18,5 +20,6 @@ namespace XINE { | |||
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(); |
@@ -46,6 +49,45 @@ namespace XINE { | |||
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; |
@@ -54,4 +96,7 @@ namespace XINE { | |||
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 | }; |
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 | |||
@@ -14,5 +14,7 @@ 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; |
@@ -148,4 +150,7 @@ vo_driver_t* init_video_out_plugin( config_values_t* conf, | |||
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 | ||
@@ -182,2 +187,32 @@ vo_info_t *get_video_out_plugin_info(){ | |||
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 | |||