summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/lib.cpp2
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
@@ -61,192 +61,194 @@ extern "C" {
61 void null_set_scaling( const xine_vo_driver_t* self, int scale ); 61 void null_set_scaling( const xine_vo_driver_t* self, int scale );
62 void null_set_gui_width( const xine_vo_driver_t* self, int width ); 62 void null_set_gui_width( const xine_vo_driver_t* self, int width );
63 void null_set_gui_height( const xine_vo_driver_t* self, int height ); 63 void null_set_gui_height( const xine_vo_driver_t* self, int height );
64 void null_set_mode( const xine_vo_driver_t* self, int depth, int rgb ); 64 void null_set_mode( const xine_vo_driver_t* self, int depth, int rgb );
65 void null_set_videoGamma( const xine_vo_driver_t* self , int value ); 65 void null_set_videoGamma( const xine_vo_driver_t* self , int value );
66 void null_display_handler( const xine_vo_driver_t* self, display_xine_frame_t t, void* user_data ); 66 void null_display_handler( const xine_vo_driver_t* self, display_xine_frame_t t, void* user_data );
67 67
68 void null_preload_decoders( xine_stream_t *stream ); 68 void null_preload_decoders( xine_stream_t *stream );
69} 69}
70 70
71using namespace XINE; 71using namespace XINE;
72 72
73Lib::Lib( InitializationMode initMode, XineVideoWidget* widget ) 73Lib::Lib( InitializationMode initMode, XineVideoWidget* widget )
74{ 74{
75 m_initialized = false; 75 m_initialized = false;
76 m_duringInitialization = false; 76 m_duringInitialization = false;
77 m_video = false; 77 m_video = false;
78 m_wid = widget; 78 m_wid = widget;
79 printf("Lib"); 79 printf("Lib");
80 QString configPath = QDir::homeDirPath() + "/Settings/opiexine.cf"; 80 QString configPath = QDir::homeDirPath() + "/Settings/opiexine.cf";
81 // get the configuration 81 // get the configuration
82 82
83 // not really OO, should be an extra class, later 83 // not really OO, should be an extra class, later
84 if ( !QFile::exists(configPath) ) { 84 if ( !QFile::exists(configPath) ) {
85 QFile f(configPath); 85 QFile f(configPath);
86 f.open(IO_WriteOnly); 86 f.open(IO_WriteOnly);
87 QTextStream ts( &f ); 87 QTextStream ts( &f );
88 ts << "misc.memcpy_method:glibc\n"; 88 ts << "misc.memcpy_method:glibc\n";
89 ts << "# uncomment if you experience double speed audio \n #audio.oss_sync_method:softsync\n"; 89 ts << "# uncomment if you experience double speed audio \n #audio.oss_sync_method:softsync\n";
90 ts << "codec.ffmpeg_pp_quality:3\n"; 90 ts << "codec.ffmpeg_pp_quality:3\n";
91 ts << "audio.num_buffers:50\n"; 91 ts << "audio.num_buffers:50\n";
92 ts << "audio.size_buffers:4096\n"; 92 ts << "audio.size_buffers:4096\n";
93 ts << "video.num_buffers:20\n"; 93 ts << "video.num_buffers:20\n";
94 ts << "video.size_buffers:4096\n"; 94 ts << "video.size_buffers:4096\n";
95 ts << "audio.out_num_audio_buf:16\n"; 95 ts << "audio.out_num_audio_buf:16\n";
96 ts << "audio.out_size_audio_buf:8096\n"; 96 ts << "audio.out_size_audio_buf:8096\n";
97 ts << "audio.out_size_zero_buf:1024\n"; 97 ts << "audio.out_size_zero_buf:1024\n";
98 ts << "audio.passthrough_offset:0\n"; 98 ts << "audio.passthrough_offset:0\n";
99 f.close(); 99 f.close();
100 } 100 }
101 101
102 if ( initMode == InitializeImmediately ) { 102 if ( initMode == InitializeImmediately ) {
103 initialize(); 103 initialize();
104 m_initialized = true; 104 m_initialized = true;
105 } 105 }
106 else 106 else
107 start(); 107 start();
108} 108}
109 109
110void Lib::run() 110void 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
118void Lib::initialize() 118void 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
148Lib::~Lib() { 148Lib::~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
164void Lib::resize ( const QSize &s ) { 166void 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
173int Lib::majorVersion() { 175int 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
179int Lib::minorVersion() { 181int 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
185int Lib::subVersion() { 187int 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
191int Lib::play( const QString& fileName, int startPos, int start_time ) { 193int 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
203void Lib::stop() { 205void Lib::stop() {
204 assert( m_initialized ); 206 assert( m_initialized );
205 xine_stop( m_stream ); 207 xine_stop( m_stream );
206 xine_set_param( m_stream, XINE_PARAM_AUDIO_CLOSE_DEVICE, 1); 208 xine_set_param( m_stream, XINE_PARAM_AUDIO_CLOSE_DEVICE, 1);
207} 209}
208 210
209void Lib::pause( bool toggle ) { 211void Lib::pause( bool toggle ) {
210 assert( m_initialized ); 212 assert( m_initialized );
211 213
212 if ( toggle ) { 214 if ( toggle ) {
213 xine_set_param( m_stream, XINE_PARAM_SPEED, XINE_SPEED_PAUSE ); 215 xine_set_param( m_stream, XINE_PARAM_SPEED, XINE_SPEED_PAUSE );
214 xine_set_param( m_stream, XINE_PARAM_AUDIO_CLOSE_DEVICE, 1); 216 xine_set_param( m_stream, XINE_PARAM_AUDIO_CLOSE_DEVICE, 1);
215 } 217 }
216 218
217 else { 219 else {
218 xine_set_param( m_stream, XINE_PARAM_SPEED, XINE_SPEED_NORMAL ); 220 xine_set_param( m_stream, XINE_PARAM_SPEED, XINE_SPEED_NORMAL );
219 } 221 }
220} 222}
221 223
222int Lib::speed() const { 224int Lib::speed() const {
223 assert( m_initialized ); 225 assert( m_initialized );
224 226
225 return xine_get_param ( m_stream, XINE_PARAM_SPEED ); 227 return xine_get_param ( m_stream, XINE_PARAM_SPEED );
226} 228}
227 229
228void Lib::setSpeed( int speed ) { 230void Lib::setSpeed( int speed ) {
229 assert( m_initialized ); 231 assert( m_initialized );
230 232
231 xine_set_param ( m_stream, XINE_PARAM_SPEED, speed ); 233 xine_set_param ( m_stream, XINE_PARAM_SPEED, speed );
232} 234}
233 235
234int Lib::status() const { 236int Lib::status() const {
235 assert( m_initialized ); 237 assert( m_initialized );
236 238
237 return xine_get_status( m_stream ); 239 return xine_get_status( m_stream );
238} 240}
239 241
240int Lib::currentPosition() const { 242int Lib::currentPosition() const {
241 assert( m_initialized ); 243 assert( m_initialized );
242 244
243 int pos, time, length; 245 int pos, time, length;
244 xine_get_pos_length( m_stream, &pos, &time, &length ); 246 xine_get_pos_length( m_stream, &pos, &time, &length );
245 return pos; 247 return pos;
246} 248}
247 249
248int Lib::currentTime() const { 250int Lib::currentTime() const {
249 assert( m_initialized ); 251 assert( m_initialized );
250 252
251 int pos, time, length; 253 int pos, time, length;
252 pos = time = length = 0; 254 pos = time = length = 0;