-rw-r--r-- | noncore/multimedia/opieplayer2/lib.cpp | 5 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/lib.h | 1 |
2 files changed, 5 insertions, 1 deletions
diff --git a/noncore/multimedia/opieplayer2/lib.cpp b/noncore/multimedia/opieplayer2/lib.cpp index 040eab3..cef46a1 100644 --- a/noncore/multimedia/opieplayer2/lib.cpp +++ b/noncore/multimedia/opieplayer2/lib.cpp | |||
@@ -64,24 +64,25 @@ extern "C" { | |||
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( InitializationMode initMode, XineVideoWidget* widget ) | 73 | Lib::Lib( InitializationMode initMode, XineVideoWidget* widget ) |
74 | { | 74 | { |
75 | m_initialized = false; | 75 | m_initialized = false; |
76 | m_duringInitialization = false; | ||
76 | m_video = false; | 77 | m_video = false; |
77 | m_wid = widget; | 78 | m_wid = widget; |
78 | printf("Lib"); | 79 | printf("Lib"); |
79 | QString configPath = QDir::homeDirPath() + "/Settings/opiexine.cf"; | 80 | QString configPath = QDir::homeDirPath() + "/Settings/opiexine.cf"; |
80 | // get the configuration | 81 | // get the configuration |
81 | 82 | ||
82 | // not really OO, should be an extra class, later | 83 | // not really OO, should be an extra class, later |
83 | if ( !QFile::exists(configPath) ) { | 84 | if ( !QFile::exists(configPath) ) { |
84 | QFile f(configPath); | 85 | QFile f(configPath); |
85 | f.open(IO_WriteOnly); | 86 | f.open(IO_WriteOnly); |
86 | QTextStream ts( &f ); | 87 | QTextStream ts( &f ); |
87 | ts << "misc.memcpy_method:glibc\n"; | 88 | ts << "misc.memcpy_method:glibc\n"; |
@@ -94,24 +95,25 @@ Lib::Lib( InitializationMode initMode, XineVideoWidget* widget ) | |||
94 | } | 95 | } |
95 | else | 96 | else |
96 | assert( false ); | 97 | assert( false ); |
97 | } | 98 | } |
98 | 99 | ||
99 | void Lib::run() | 100 | void Lib::run() |
100 | { | 101 | { |
101 | assert( false ); | 102 | assert( false ); |
102 | } | 103 | } |
103 | 104 | ||
104 | void Lib::initialize() | 105 | void Lib::initialize() |
105 | { | 106 | { |
107 | m_duringInitialization = true; | ||
106 | m_xine = xine_new( ); | 108 | m_xine = xine_new( ); |
107 | 109 | ||
108 | QString configPath = QDir::homeDirPath() + "/Settings/opiexine.cf"; | 110 | QString configPath = QDir::homeDirPath() + "/Settings/opiexine.cf"; |
109 | xine_config_load( m_xine, QFile::encodeName( configPath ) ); | 111 | xine_config_load( m_xine, QFile::encodeName( configPath ) ); |
110 | 112 | ||
111 | xine_init( m_xine ); | 113 | xine_init( m_xine ); |
112 | 114 | ||
113 | // allocate oss for sound | 115 | // allocate oss for sound |
114 | // and fb for framebuffer | 116 | // and fb for framebuffer |
115 | m_audioOutput = xine_open_audio_driver( m_xine, "oss", NULL ); | 117 | m_audioOutput = xine_open_audio_driver( m_xine, "oss", NULL ); |
116 | m_videoOutput = ::init_video_out_plugin( m_xine, NULL, xine_display_frame, this ); | 118 | m_videoOutput = ::init_video_out_plugin( m_xine, NULL, xine_display_frame, this ); |
117 | 119 | ||
@@ -125,46 +127,47 @@ void Lib::initialize() | |||
125 | 127 | ||
126 | if (m_wid != 0 ) { | 128 | if (m_wid != 0 ) { |
127 | printf( "!0\n" ); | 129 | printf( "!0\n" ); |
128 | resize ( m_wid-> size ( ) ); | 130 | resize ( m_wid-> size ( ) ); |
129 | ::null_set_mode( m_videoOutput, qt_screen->depth(), qt_screen->pixelType() ); | 131 | ::null_set_mode( m_videoOutput, qt_screen->depth(), qt_screen->pixelType() ); |
130 | 132 | ||
131 | // m_wid->repaint(); | 133 | // m_wid->repaint(); |
132 | } | 134 | } |
133 | 135 | ||
134 | m_queue = xine_event_new_queue (m_stream); | 136 | m_queue = xine_event_new_queue (m_stream); |
135 | 137 | ||
136 | xine_event_create_listener_thread (m_queue, xine_event_handler, this); | 138 | xine_event_create_listener_thread (m_queue, xine_event_handler, this); |
139 | m_duringInitialization = false; | ||
137 | } | 140 | } |
138 | 141 | ||
139 | Lib::~Lib() { | 142 | Lib::~Lib() { |
140 | assert( isRunning() == false ); | 143 | assert( isRunning() == false ); |
141 | assert( m_initialized ); | 144 | assert( m_initialized ); |
142 | 145 | ||
143 | // free( m_config ); | 146 | // free( m_config ); |
144 | 147 | ||
145 | xine_close( m_stream ); | 148 | xine_close( m_stream ); |
146 | 149 | ||
147 | xine_event_dispose_queue( m_queue ); | 150 | xine_event_dispose_queue( m_queue ); |
148 | 151 | ||
149 | xine_dispose( m_stream ); | 152 | xine_dispose( m_stream ); |
150 | 153 | ||
151 | xine_exit( m_xine ); | 154 | xine_exit( m_xine ); |
152 | /* FIXME either free or delete but valgrind bitches against both */ | 155 | /* FIXME either free or delete but valgrind bitches against both */ |
153 | //free( m_videoOutput ); | 156 | //free( m_videoOutput ); |
154 | //delete m_audioOutput; | 157 | //delete m_audioOutput; |
155 | } | 158 | } |
156 | 159 | ||
157 | void Lib::resize ( const QSize &s ) { | 160 | void Lib::resize ( const QSize &s ) { |
158 | assert( m_initialized ); | 161 | assert( m_initialized || m_duringInitialization ); |
159 | 162 | ||
160 | if ( s. width ( ) && s. height ( ) ) { | 163 | if ( s. width ( ) && s. height ( ) ) { |
161 | ::null_set_gui_width( m_videoOutput, s. width() ); | 164 | ::null_set_gui_width( m_videoOutput, s. width() ); |
162 | ::null_set_gui_height( m_videoOutput, s. height() ); | 165 | ::null_set_gui_height( m_videoOutput, s. height() ); |
163 | } | 166 | } |
164 | } | 167 | } |
165 | 168 | ||
166 | int Lib::majorVersion() { | 169 | int Lib::majorVersion() { |
167 | int major, minor, sub; | 170 | int major, minor, sub; |
168 | xine_get_version ( &major, &minor, &sub ); | 171 | xine_get_version ( &major, &minor, &sub ); |
169 | return major; | 172 | return major; |
170 | } | 173 | } |
diff --git a/noncore/multimedia/opieplayer2/lib.h b/noncore/multimedia/opieplayer2/lib.h index 7e3a912..9dd7385 100644 --- a/noncore/multimedia/opieplayer2/lib.h +++ b/noncore/multimedia/opieplayer2/lib.h | |||
@@ -184,24 +184,25 @@ namespace XINE { | |||
184 | void initialized(); | 184 | void initialized(); |
185 | 185 | ||
186 | protected: | 186 | protected: |
187 | virtual void receiveMessage( ThreadUtil::ChannelMessage *msg, SendType sendType ); | 187 | virtual void receiveMessage( ThreadUtil::ChannelMessage *msg, SendType sendType ); |
188 | 188 | ||
189 | virtual void run(); | 189 | virtual void run(); |
190 | 190 | ||
191 | private: | 191 | private: |
192 | void initialize(); | 192 | void initialize(); |
193 | 193 | ||
194 | int m_bytes_per_pixel; | 194 | int m_bytes_per_pixel; |
195 | bool m_initialized:1; | 195 | bool m_initialized:1; |
196 | bool m_duringInitialization:1; | ||
196 | bool m_video:1; | 197 | bool m_video:1; |
197 | XineVideoWidget *m_wid; | 198 | XineVideoWidget *m_wid; |
198 | xine_t *m_xine; | 199 | xine_t *m_xine; |
199 | xine_stream_t *m_stream; | 200 | xine_stream_t *m_stream; |
200 | xine_cfg_entry_t *m_config; | 201 | xine_cfg_entry_t *m_config; |
201 | xine_vo_driver_t *m_videoOutput; | 202 | xine_vo_driver_t *m_videoOutput; |
202 | xine_ao_driver_t* m_audioOutput; | 203 | xine_ao_driver_t* m_audioOutput; |
203 | xine_event_queue_t *m_queue; | 204 | xine_event_queue_t *m_queue; |
204 | 205 | ||
205 | void handleXineEvent( const xine_event_t* t ); | 206 | void handleXineEvent( const xine_event_t* t ); |
206 | void handleXineEvent( int type ); | 207 | void handleXineEvent( int type ); |
207 | void drawFrame( uint8_t* frame, int width, int height, int bytes ); | 208 | void drawFrame( uint8_t* frame, int width, int height, int bytes ); |