summaryrefslogtreecommitdiff
path: root/noncore/multimedia/opieplayer2
authorzecke <zecke>2002-07-09 13:49:34 (UTC)
committer zecke <zecke>2002-07-09 13:49:34 (UTC)
commit87bb55055c826b6c75d4a66a7ff6e21058cf6361 (patch) (unidiff)
tree000f68448ce3b903da00a3e5a2ad24140a18f85b /noncore/multimedia/opieplayer2
parente99adc2029808f6276474c95e8587607a4bd8091 (diff)
downloadopie-87bb55055c826b6c75d4a66a7ff6e21058cf6361.zip
opie-87bb55055c826b6c75d4a66a7ff6e21058cf6361.tar.gz
opie-87bb55055c826b6c75d4a66a7ff6e21058cf6361.tar.bz2
Update the lib
Diffstat (limited to 'noncore/multimedia/opieplayer2') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/lib.cpp40
-rw-r--r--noncore/multimedia/opieplayer2/lib.h47
-rw-r--r--noncore/multimedia/opieplayer2/nullvideo.c37
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
@@ -7,13 +7,20 @@
7 7
8#include "frame.h" 8#include "frame.h"
9#include "lib.h" 9#include "lib.h"
10 10
11 11
12extern "C" { 12extern "C" {
13vo_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
16using namespace XINE; 23using namespace XINE;
17 24
18Lib::Lib() { 25Lib::Lib() {
19 printf("Lib"); 26 printf("Lib");
@@ -44,19 +51,22 @@ Lib::Lib() {
44 i++; 51 i++;
45 } 52 }
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
55Lib::~Lib() { 64Lib::~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
61} 71}
62 72
@@ -113,7 +123,31 @@ Frame Lib::currentFrame() {
113 Frame frame; 123 Frame frame;
114 return frame; 124 return frame;
115}; 125};
116int Lib::error() { 126int Lib::error() {
117 return xine_get_error( m_xine ); 127 return xine_get_error( m_xine );
118}; 128};
119 129void Lib::handleXineEvent( xine_event_t* t ) {
130 if ( t->type == XINE_EVENT_PLAYBACK_FINISHED )
131 emit stopped();
132}
133void Lib::setShowVideo( bool video ) {
134 ::null_set_show_video( m_videoOutput, video );
135}
136bool Lib::isShowingVideo() {
137 return ::null_is_showing_video( m_videoOutput );
138}
139void Lib::showVideoFullScreen( bool fullScreen ) {
140 ::null_set_fullscreen( m_videoOutput, fullScreen );
141}
142bool Lib::isVideoFullScreen() {
143 return ::null_is_fullscreen( m_videoOutput );
144}
145void Lib::setScaling( bool scale ) {
146 ::null_set_scaling( m_videoOutput, scale );
147}
148bool Lib::isScaling() {
149 return ::null_is_scaling( m_videoOutput );
150}
151void 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
@@ -2,25 +2,28 @@
2 2
3#ifndef ZECKEXINELIB_H 3#ifndef ZECKEXINELIB_H
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
10namespace XINE { 12namespace XINE {
11 13
12 /** 14 /**
13 * Lib wrapps the simple interface 15 * Lib wrapps the simple interface
14 * of libxine for easy every day use 16 * of libxine for easy every day use
15 * This will become a full C++ Wrapper 17 * This will become a full C++ Wrapper
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();
25 int majorVersion()/*const*/; 28 int majorVersion()/*const*/;
26 int minorVersion()/*const*/; 29 int minorVersion()/*const*/;
@@ -42,19 +45,61 @@ namespace XINE {
42 //in seconds 45 //in seconds
43 int currentTime()/*const*/; 46 int currentTime()/*const*/;
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
60#endif 105#endif
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
@@ -10,13 +10,15 @@
10 10
11typedef struct null_driver_s null_driver_t; 11typedef struct null_driver_s null_driver_t;
12 12
13struct null_driver_s { 13struct 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};
18typedef struct opie_frame_s opie_frame_t; 20typedef struct opie_frame_s opie_frame_t;
19struct opie_frame_s { 21struct opie_frame_s {
20 vo_frame_t frame; 22 vo_frame_t frame;
21 char* name; 23 char* name;
22 int version; 24 int version;
@@ -144,12 +146,15 @@ static int null_redraw_needed( vo_driver_t* self ){
144 146
145 147
146vo_driver_t* init_video_out_plugin( config_values_t* conf, 148vo_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;
154 vo->vo_driver.alloc_frame = null_alloc_frame; 159 vo->vo_driver.alloc_frame = null_alloc_frame;
155 vo->vo_driver.update_frame_format = null_update_frame_format; 160 vo->vo_driver.update_frame_format = null_update_frame_format;
@@ -178,6 +183,36 @@ static vo_info_t vo_info_null = {
178}; 183};
179 184
180vo_info_t *get_video_out_plugin_info(){ 185vo_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 */
198int null_is_showing_video( vo_driver_t* self ){
199 null_driver_t* this = (null_driver_t*)self;
200 return this->m_show_video;
201}
202void null_set_show_video( vo_driver_t* self, int show ) {
203 ((null_driver_t*)self)->m_show_video = show;
204}
205
206int null_is_fullscreen( vo_driver_t* self ){
207 return ((null_driver_t*)self)->m_video_fullscreen;
208}
209void null_set_fullscreen( vo_driver_t* self, int screen ){
210 ((null_driver_t*)self)->m_video_fullscreen = screen;
211}
212int null_is_scaling( vo_driver_t* self ){
213 return ((null_driver_t*)self)->m_is_scaling;
214}
215void null_set_scaling( vo_driver_t* self, int scale ){
216 ((null_driver_t*)self)->m_is_scaling = scale;
217}
218