-rw-r--r-- | noncore/multimedia/opieplayer2/lib.cpp | 16 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/lib.h | 13 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/xinecontrol.cpp | 2 |
3 files changed, 26 insertions, 5 deletions
diff --git a/noncore/multimedia/opieplayer2/lib.cpp b/noncore/multimedia/opieplayer2/lib.cpp index 1e0dc21..6431de7 100644 --- a/noncore/multimedia/opieplayer2/lib.cpp +++ b/noncore/multimedia/opieplayer2/lib.cpp | |||
@@ -61,43 +61,57 @@ extern "C" { | |||
61 | void null_set_fullscreen( const xine_vo_driver_t* self, int screen ); | 61 | void null_set_fullscreen( const xine_vo_driver_t* self, int screen ); |
62 | int null_is_scaling( const xine_vo_driver_t* self ); | 62 | int null_is_scaling( const xine_vo_driver_t* self ); |
63 | void null_set_scaling( const xine_vo_driver_t* self, int scale ); | 63 | void null_set_scaling( const xine_vo_driver_t* self, int scale ); |
64 | void null_set_gui_width( const xine_vo_driver_t* self, int width ); | 64 | void null_set_gui_width( const xine_vo_driver_t* self, int width ); |
65 | void null_set_gui_height( const xine_vo_driver_t* self, int height ); | 65 | void null_set_gui_height( const xine_vo_driver_t* self, int height ); |
66 | void null_set_mode( const xine_vo_driver_t* self, int depth, int rgb ); | 66 | void null_set_mode( const xine_vo_driver_t* self, int depth, int rgb ); |
67 | void null_set_videoGamma( const xine_vo_driver_t* self , int value ); | 67 | void null_set_videoGamma( const xine_vo_driver_t* self , int value ); |
68 | void null_display_handler( const xine_vo_driver_t* self, display_xine_frame_t t, void* user_data ); | 68 | void null_display_handler( const xine_vo_driver_t* self, display_xine_frame_t t, void* user_data ); |
69 | } | 69 | } |
70 | 70 | ||
71 | using namespace XINE; | 71 | using namespace XINE; |
72 | 72 | ||
73 | Lib::Lib( XineVideoWidget* widget ) | 73 | Lib::Lib( InitializationMode initMode, XineVideoWidget* widget ) |
74 | { | 74 | { |
75 | m_video = false; | 75 | m_video = false; |
76 | m_wid = widget; | 76 | m_wid = widget; |
77 | printf("Lib"); | 77 | printf("Lib"); |
78 | QString configPath = QDir::homeDirPath() + "/Settings/opiexine.cf"; | 78 | QString configPath = QDir::homeDirPath() + "/Settings/opiexine.cf"; |
79 | // get the configuration | 79 | // get the configuration |
80 | 80 | ||
81 | // not really OO, should be an extra class, later | 81 | // not really OO, should be an extra class, later |
82 | if ( !QFile::exists(configPath) ) { | 82 | if ( !QFile::exists(configPath) ) { |
83 | QFile f(configPath); | 83 | QFile f(configPath); |
84 | f.open(IO_WriteOnly); | 84 | f.open(IO_WriteOnly); |
85 | QTextStream ts( &f ); | 85 | QTextStream ts( &f ); |
86 | ts << "misc.memcpy_method:glibc\n"; | 86 | ts << "misc.memcpy_method:glibc\n"; |
87 | f.close(); | 87 | f.close(); |
88 | } | 88 | } |
89 | 89 | ||
90 | if ( initMode == InitializeImmediately ) | ||
91 | initialize(); | ||
92 | else | ||
93 | assert( false ); | ||
94 | } | ||
95 | |||
96 | void Lib::run() | ||
97 | { | ||
98 | assert( false ); | ||
99 | } | ||
100 | |||
101 | void Lib::initialize() | ||
102 | { | ||
90 | m_xine = xine_new( ); | 103 | m_xine = xine_new( ); |
91 | 104 | ||
105 | QString configPath = QDir::homeDirPath() + "/Settings/opiexine.cf"; | ||
92 | xine_config_load( m_xine, QFile::encodeName( configPath ) ); | 106 | xine_config_load( m_xine, QFile::encodeName( configPath ) ); |
93 | 107 | ||
94 | xine_init( m_xine ); | 108 | xine_init( m_xine ); |
95 | 109 | ||
96 | // allocate oss for sound | 110 | // allocate oss for sound |
97 | // and fb for framebuffer | 111 | // and fb for framebuffer |
98 | m_audioOutput = xine_open_audio_driver( m_xine, "oss", NULL ); | 112 | m_audioOutput = xine_open_audio_driver( m_xine, "oss", NULL ); |
99 | m_videoOutput = ::init_video_out_plugin( m_xine, NULL, xine_display_frame, this ); | 113 | m_videoOutput = ::init_video_out_plugin( m_xine, NULL, xine_display_frame, this ); |
100 | 114 | ||
101 | 115 | ||
102 | //xine_open_video_driver( m_xine, NULL, XINE_VISUAL_TYPE_FB, NULL); | 116 | //xine_open_video_driver( m_xine, NULL, XINE_VISUAL_TYPE_FB, NULL); |
103 | 117 | ||
diff --git a/noncore/multimedia/opieplayer2/lib.h b/noncore/multimedia/opieplayer2/lib.h index aba2ec9..6363918 100644 --- a/noncore/multimedia/opieplayer2/lib.h +++ b/noncore/multimedia/opieplayer2/lib.h | |||
@@ -46,36 +46,39 @@ | |||
46 | class XineVideoWidget; | 46 | class XineVideoWidget; |
47 | 47 | ||
48 | namespace XINE { | 48 | namespace XINE { |
49 | 49 | ||
50 | /** | 50 | /** |
51 | * Lib wrapps the simple interface | 51 | * Lib wrapps the simple interface |
52 | * of libxine for easy every day use | 52 | * of libxine for easy every day use |
53 | * This will become a full C++ Wrapper | 53 | * This will become a full C++ Wrapper |
54 | * It supports playing, pausing, info, | 54 | * It supports playing, pausing, info, |
55 | * stooping, seeking. | 55 | * stooping, seeking. |
56 | */ | 56 | */ |
57 | class Frame; | 57 | class Frame; |
58 | class Lib : public ThreadUtil::Channel | 58 | class Lib : public ThreadUtil::Channel, private ThreadUtil::Thread |
59 | { | 59 | { |
60 | Q_OBJECT | 60 | Q_OBJECT |
61 | public: | 61 | public: |
62 | Lib(XineVideoWidget* = 0); | 62 | enum InitializationMode { InitializeImmediately, InitializeInThread }; |
63 | |||
64 | Lib( InitializationMode initMode, XineVideoWidget* = 0); | ||
65 | |||
63 | ~Lib(); | 66 | ~Lib(); |
64 | static int majorVersion(); | 67 | static int majorVersion(); |
65 | static int minorVersion(); | 68 | static int minorVersion(); |
66 | static int subVersion(); | 69 | static int subVersion(); |
67 | 70 | ||
68 | 71 | ||
69 | void resize ( const QSize &s ); | 72 | void resize ( const QSize &s ); |
70 | 73 | ||
71 | int play( const QString& fileName, | 74 | int play( const QString& fileName, |
72 | int startPos = 0, | 75 | int startPos = 0, |
73 | int start_time = 0 ); | 76 | int start_time = 0 ); |
74 | void stop(); | 77 | void stop(); |
75 | void pause( bool toggle ); | 78 | void pause( bool toggle ); |
76 | 79 | ||
77 | int speed() const; | 80 | int speed() const; |
78 | 81 | ||
79 | /** | 82 | /** |
80 | * Set the speed of the stream, if codec supports it | 83 | * Set the speed of the stream, if codec supports it |
81 | * XINE_SPEED_PAUSE 0 | 84 | * XINE_SPEED_PAUSE 0 |
@@ -174,25 +177,29 @@ namespace XINE { | |||
174 | */ | 177 | */ |
175 | int error() const; | 178 | int error() const; |
176 | 179 | ||
177 | signals: | 180 | signals: |
178 | 181 | ||
179 | void stopped(); | 182 | void stopped(); |
180 | 183 | ||
181 | void initialized(); | 184 | void initialized(); |
182 | 185 | ||
183 | protected: | 186 | protected: |
184 | virtual void receiveMessage( ThreadUtil::ChannelMessage *msg, SendType sendType ); | 187 | virtual void receiveMessage( ThreadUtil::ChannelMessage *msg, SendType sendType ); |
185 | 188 | ||
189 | virtual void run(); | ||
190 | |||
186 | private: | 191 | private: |
192 | void initialize(); | ||
193 | |||
187 | int m_bytes_per_pixel; | 194 | int m_bytes_per_pixel; |
188 | bool m_video:1; | 195 | bool m_video:1; |
189 | XineVideoWidget *m_wid; | 196 | XineVideoWidget *m_wid; |
190 | xine_t *m_xine; | 197 | xine_t *m_xine; |
191 | xine_stream_t *m_stream; | 198 | xine_stream_t *m_stream; |
192 | xine_cfg_entry_t *m_config; | 199 | xine_cfg_entry_t *m_config; |
193 | xine_vo_driver_t *m_videoOutput; | 200 | xine_vo_driver_t *m_videoOutput; |
194 | xine_ao_driver_t* m_audioOutput; | 201 | xine_ao_driver_t* m_audioOutput; |
195 | xine_event_queue_t *m_queue; | 202 | xine_event_queue_t *m_queue; |
196 | 203 | ||
197 | void handleXineEvent( const xine_event_t* t ); | 204 | void handleXineEvent( const xine_event_t* t ); |
198 | void handleXineEvent( int type ); | 205 | void handleXineEvent( int type ); |
diff --git a/noncore/multimedia/opieplayer2/xinecontrol.cpp b/noncore/multimedia/opieplayer2/xinecontrol.cpp index efa9934..1aa3daa 100644 --- a/noncore/multimedia/opieplayer2/xinecontrol.cpp +++ b/noncore/multimedia/opieplayer2/xinecontrol.cpp | |||
@@ -37,25 +37,25 @@ | |||
37 | #include <qpe/qcopenvelope_qws.h> | 37 | #include <qpe/qcopenvelope_qws.h> |
38 | #include <qpe/qpeapplication.h> | 38 | #include <qpe/qpeapplication.h> |
39 | #include "xinecontrol.h" | 39 | #include "xinecontrol.h" |
40 | #include "mediaplayerstate.h" | 40 | #include "mediaplayerstate.h" |
41 | #include "xinevideowidget.h" | 41 | #include "xinevideowidget.h" |
42 | 42 | ||
43 | XineControl::XineControl( XineVideoWidget *xineWidget, | 43 | XineControl::XineControl( XineVideoWidget *xineWidget, |
44 | MediaPlayerState &_mediaPlayerState, | 44 | MediaPlayerState &_mediaPlayerState, |
45 | QObject *parent, const char *name ) | 45 | QObject *parent, const char *name ) |
46 | : QObject( parent, name ), mediaPlayerState( _mediaPlayerState ), xineVideoWidget( xineWidget ) | 46 | : QObject( parent, name ), mediaPlayerState( _mediaPlayerState ), xineVideoWidget( xineWidget ) |
47 | { | 47 | { |
48 | 48 | ||
49 | libXine = new XINE::Lib( xineWidget ); | 49 | libXine = new XINE::Lib( XINE::Lib::InitializeImmediately, xineWidget ); |
50 | 50 | ||
51 | init(); | 51 | init(); |
52 | } | 52 | } |
53 | 53 | ||
54 | XineControl::XineControl( XINE::Lib *xine, XineVideoWidget *xineWidget, | 54 | XineControl::XineControl( XINE::Lib *xine, XineVideoWidget *xineWidget, |
55 | MediaPlayerState &_mediaPlayerState, | 55 | MediaPlayerState &_mediaPlayerState, |
56 | QObject *parent, const char *name ) | 56 | QObject *parent, const char *name ) |
57 | : QObject( parent, name ), libXine( xine ), mediaPlayerState( _mediaPlayerState ), xineVideoWidget( xineWidget ) | 57 | : QObject( parent, name ), libXine( xine ), mediaPlayerState( _mediaPlayerState ), xineVideoWidget( xineWidget ) |
58 | { | 58 | { |
59 | init(); | 59 | init(); |
60 | } | 60 | } |
61 | 61 | ||