summaryrefslogtreecommitdiff
authorsimon <simon>2002-12-10 22:27:04 (UTC)
committer simon <simon>2002-12-10 22:27:04 (UTC)
commit0ee7b9eb000d0ca5dfeab074e45488d0bc44314b (patch) (side-by-side diff)
treeb10a90cc3a9eb5566bfa9219634f35954447dd68
parent34418795f4bef0466fc92aa9dfd8f25210bc2bc5 (diff)
downloadopie-0ee7b9eb000d0ca5dfeab074e45488d0bc44314b.zip
opie-0ee7b9eb000d0ca5dfeab074e45488d0bc44314b.tar.gz
opie-0ee7b9eb000d0ca5dfeab074e45488d0bc44314b.tar.bz2
- factor out the expensive xine initialization code into a separate method,
as preparation
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/lib.cpp17
-rw-r--r--noncore/multimedia/opieplayer2/lib.h2
2 files changed, 14 insertions, 5 deletions
diff --git a/noncore/multimedia/opieplayer2/lib.cpp b/noncore/multimedia/opieplayer2/lib.cpp
index 9e818eb..641cbca 100644
--- a/noncore/multimedia/opieplayer2/lib.cpp
+++ b/noncore/multimedia/opieplayer2/lib.cpp
@@ -29,24 +29,25 @@
Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#include <stdio.h>
#include <stdlib.h>
#include <qimage.h>
#include <qtextstream.h>
#include <qpe/resource.h>
#include <qfile.h>
+#include <qdir.h>
#include <qgfx_qws.h>
#include <qdirectpainter_qws.h>
#include <assert.h>
#include "xinevideowidget.h"
#include "frame.h"
#include "lib.h"
typedef void (*display_xine_frame_t) (void *user_data, uint8_t* frame,
@@ -64,40 +65,45 @@ extern "C" {
void null_set_gui_height( const xine_vo_driver_t* self, int height );
void null_set_mode( const xine_vo_driver_t* self, int depth, int rgb );
void null_set_videoGamma( const xine_vo_driver_t* self , int value );
void null_display_handler( const xine_vo_driver_t* self, display_xine_frame_t t, void* user_data );
}
using namespace XINE;
Lib::Lib( XineVideoWidget* widget ) {
m_video = false;
m_wid = widget;
printf("Lib");
- QCString str( getenv("HOME") );
- str += "/Settings/opiexine.cf";
+ QString configPath = QDir::homeDirPath() + "/Settings/opiexine.cf";
// get the configuration
// not really OO, should be an extra class, later
- if ( !QFile(str).exists() ) {
- QFile f(str);
+ if ( !QFile::exists(configPath) ) {
+ QFile f(configPath);
f.open(IO_WriteOnly);
QTextStream ts( &f );
ts << "misc.memcpy_method:glibc\n";
f.close();
}
+ initialize();
+}
+
+void Lib::initialize()
+{
m_xine = xine_new( );
- xine_config_load( m_xine, str.data() );
+ QString configPath = QDir::homeDirPath() + "/Settings/opiexine.cf";
+ xine_config_load( m_xine, QFile::encodeName( configPath ) );
xine_init( m_xine );
// allocate oss for sound
// and fb for framebuffer
m_audioOutput = xine_open_audio_driver( m_xine, "oss", NULL );
m_videoOutput = ::init_video_out_plugin( m_xine, NULL, xine_display_frame, this );
//xine_open_video_driver( m_xine, NULL, XINE_VISUAL_TYPE_FB, NULL);
@@ -107,24 +113,25 @@ Lib::Lib( XineVideoWidget* widget ) {
if (m_wid != 0 ) {
printf( "!0\n" );
resize ( m_wid-> size ( ) );
::null_set_mode( m_videoOutput, qt_screen->depth(), qt_screen->pixelType() );
m_wid->repaint();
}
m_queue = xine_event_new_queue (m_stream);
xine_event_create_listener_thread (m_queue, xine_event_handler, this);
+
}
Lib::~Lib() {
// free( m_config );
xine_close( m_stream );
xine_event_dispose_queue( m_queue );
xine_dispose( m_stream );
xine_exit( m_xine );
diff --git a/noncore/multimedia/opieplayer2/lib.h b/noncore/multimedia/opieplayer2/lib.h
index 37a4f9a..d546c99 100644
--- a/noncore/multimedia/opieplayer2/lib.h
+++ b/noncore/multimedia/opieplayer2/lib.h
@@ -172,24 +172,26 @@ namespace XINE {
* XINE_ERROR_DEMUXER_FAILED 3
*/
int error() const;
signals:
void stopped();
protected:
virtual void receiveMessage( ThreadUtil::ChannelMessage *msg, SendType sendType );
private:
+ void initialize();
+
int m_bytes_per_pixel;
bool m_video:1;
XineVideoWidget *m_wid;
xine_t *m_xine;
xine_stream_t *m_stream;
xine_cfg_entry_t *m_config;
xine_vo_driver_t *m_videoOutput;
xine_ao_driver_t* m_audioOutput;
xine_event_queue_t *m_queue;
void handleXineEvent( const xine_event_t* t );
void handleXineEvent( int type );