-rw-r--r-- | noncore/multimedia/opieplayer2/lib.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/noncore/multimedia/opieplayer2/lib.cpp b/noncore/multimedia/opieplayer2/lib.cpp index 6ed4cea..9f0d448 100644 --- a/noncore/multimedia/opieplayer2/lib.cpp +++ b/noncore/multimedia/opieplayer2/lib.cpp | |||
@@ -109,96 +109,98 @@ Lib::Lib( InitializationMode initMode, XineVideoWidget* widget ) | |||
109 | 109 | ||
110 | void Lib::run() | 110 | void Lib::run() |
111 | { | 111 | { |
112 | odebug << "Lib::run() started" << oendl; | 112 | odebug << "Lib::run() started" << oendl; |
113 | initialize(); | 113 | initialize(); |
114 | m_initialized = true; | 114 | m_initialized = true; |
115 | odebug << "Lib::run() finished" << oendl; | 115 | odebug << "Lib::run() finished" << oendl; |
116 | } | 116 | } |
117 | 117 | ||
118 | void Lib::initialize() | 118 | void Lib::initialize() |
119 | { | 119 | { |
120 | m_duringInitialization = true; | 120 | m_duringInitialization = true; |
121 | m_xine = xine_new( ); | 121 | m_xine = xine_new( ); |
122 | 122 | ||
123 | QString configPath = QDir::homeDirPath() + "/Settings/opiexine.cf"; | 123 | QString configPath = QDir::homeDirPath() + "/Settings/opiexine.cf"; |
124 | xine_config_load( m_xine, QFile::encodeName( configPath ) ); | 124 | xine_config_load( m_xine, QFile::encodeName( configPath ) ); |
125 | 125 | ||
126 | xine_init( m_xine ); | 126 | xine_init( m_xine ); |
127 | 127 | ||
128 | // allocate oss for sound | 128 | // allocate oss for sound |
129 | // and fb for framebuffer | 129 | // and fb for framebuffer |
130 | m_audioOutput = xine_open_audio_driver( m_xine, "oss", NULL ); | 130 | m_audioOutput = xine_open_audio_driver( m_xine, "oss", NULL ); |
131 | m_videoOutput = ::init_video_out_plugin( m_xine, NULL, xine_display_frame, this ); | 131 | m_videoOutput = ::init_video_out_plugin( m_xine, NULL, xine_display_frame, this ); |
132 | 132 | ||
133 | m_stream = xine_stream_new (m_xine, m_audioOutput, m_videoOutput ); | 133 | m_stream = xine_stream_new (m_xine, m_audioOutput, m_videoOutput ); |
134 | xine_set_param( m_stream, XINE_PARAM_AUDIO_CLOSE_DEVICE, 1); | 134 | xine_set_param( m_stream, XINE_PARAM_AUDIO_CLOSE_DEVICE, 1); |
135 | 135 | ||
136 | if (m_wid != 0 ) | 136 | if (m_wid != 0 ) |
137 | setWidget( m_wid ); | 137 | setWidget( m_wid ); |
138 | 138 | ||
139 | 139 | ||
140 | m_queue = xine_event_new_queue (m_stream); | 140 | m_queue = xine_event_new_queue (m_stream); |
141 | xine_event_create_listener_thread (m_queue, xine_event_handler, this); | 141 | xine_event_create_listener_thread (m_queue, xine_event_handler, this); |
142 | 142 | ||
143 | ::null_preload_decoders( m_stream ); | 143 | ::null_preload_decoders( m_stream ); |
144 | 144 | ||
145 | m_duringInitialization = false; | 145 | m_duringInitialization = false; |
146 | } | 146 | } |
147 | 147 | ||
148 | Lib::~Lib() { | 148 | Lib::~Lib() { |
149 | assert( isRunning() == false ); | 149 | assert( isRunning() == false ); |
150 | assert( m_initialized ); | 150 | assert( m_initialized ); |
151 | 151 | ||
152 | // free( m_config ); | 152 | // free( m_config ); |
153 | 153 | ||
154 | xine_close( m_stream ); | 154 | xine_close( m_stream ); |
155 | xine_event_dispose_queue( m_queue ); | 155 | xine_event_dispose_queue( m_queue ); |
156 | xine_dispose( m_stream ); | 156 | xine_dispose( m_stream ); |
157 | xine_close_audio_driver(m_xine,m_audioOutput); | ||
158 | xine_close_video_driver(m_xine,m_videoOutput); | ||
157 | xine_exit( m_xine ); | 159 | xine_exit( m_xine ); |
158 | 160 | ||
159 | /* FIXME either free or delete but valgrind bitches against both */ | 161 | /* FIXME either free or delete but valgrind bitches against both */ |
160 | //free( m_videoOutput ); | 162 | //free( m_videoOutput ); |
161 | //delete m_audioOutput; | 163 | //delete m_audioOutput; |
162 | } | 164 | } |
163 | 165 | ||
164 | void Lib::resize ( const QSize &s ) { | 166 | void Lib::resize ( const QSize &s ) { |
165 | assert( m_initialized || m_duringInitialization ); | 167 | assert( m_initialized || m_duringInitialization ); |
166 | 168 | ||
167 | if ( s. width ( ) && s. height ( ) ) { | 169 | if ( s. width ( ) && s. height ( ) ) { |
168 | ::null_set_gui_width( m_videoOutput, s. width() ); | 170 | ::null_set_gui_width( m_videoOutput, s. width() ); |
169 | ::null_set_gui_height( m_videoOutput, s. height() ); | 171 | ::null_set_gui_height( m_videoOutput, s. height() ); |
170 | } | 172 | } |
171 | } | 173 | } |
172 | 174 | ||
173 | int Lib::majorVersion() { | 175 | int Lib::majorVersion() { |
174 | int major, minor, sub; | 176 | int major, minor, sub; |
175 | xine_get_version ( &major, &minor, &sub ); | 177 | xine_get_version ( &major, &minor, &sub ); |
176 | return major; | 178 | return major; |
177 | } | 179 | } |
178 | 180 | ||
179 | int Lib::minorVersion() { | 181 | int Lib::minorVersion() { |
180 | int major, minor, sub; | 182 | int major, minor, sub; |
181 | xine_get_version ( &major, &minor, &sub ); | 183 | xine_get_version ( &major, &minor, &sub ); |
182 | return minor; | 184 | return minor; |
183 | } | 185 | } |
184 | 186 | ||
185 | int Lib::subVersion() { | 187 | int Lib::subVersion() { |
186 | int major, minor, sub; | 188 | int major, minor, sub; |
187 | xine_get_version ( &major, &minor, &sub ); | 189 | xine_get_version ( &major, &minor, &sub ); |
188 | return sub; | 190 | return sub; |
189 | } | 191 | } |
190 | 192 | ||
191 | int Lib::play( const QString& fileName, int startPos, int start_time ) { | 193 | int Lib::play( const QString& fileName, int startPos, int start_time ) { |
192 | assert( m_initialized ); | 194 | assert( m_initialized ); |
193 | 195 | ||
194 | QString str = fileName.stripWhiteSpace(); | 196 | QString str = fileName.stripWhiteSpace(); |
195 | 197 | ||
196 | 198 | ||
197 | if ( !xine_open( m_stream, str.utf8().data() ) ) { | 199 | if ( !xine_open( m_stream, str.utf8().data() ) ) { |
198 | return 0; | 200 | return 0; |
199 | } | 201 | } |
200 | return xine_play( m_stream, startPos, start_time); | 202 | return xine_play( m_stream, startPos, start_time); |
201 | } | 203 | } |
202 | 204 | ||
203 | void Lib::stop() { | 205 | void Lib::stop() { |
204 | assert( m_initialized ); | 206 | assert( m_initialized ); |