summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/multimedia/opieplayer/om3u.cpp7
-rw-r--r--noncore/multimedia/opieplayer2/lib.cpp2
-rw-r--r--noncore/multimedia/opieplayer2/om3u.cpp13
3 files changed, 14 insertions, 8 deletions
diff --git a/core/multimedia/opieplayer/om3u.cpp b/core/multimedia/opieplayer/om3u.cpp
index 8b92a8c..778eb22 100644
--- a/core/multimedia/opieplayer/om3u.cpp
+++ b/core/multimedia/opieplayer/om3u.cpp
@@ -1,172 +1,175 @@
1/* 1/*
2                This file is part of the Opie Project 2                This file is part of the Opie Project
3 3
4 Copyright (c) 2002 L. Potter <ljp@llornkcor.com> 4 Copyright (c) 2002 L. Potter <ljp@llornkcor.com>
5 =. 5 =.
6 .=l. 6 .=l.
7           .>+-= 7           .>+-=
8 _;:,     .>    :=|. This program is free software; you can 8 _;:,     .>    :=|. This program is free software; you can
9.> <`_,   >  .   <= redistribute it and/or modify it under 9.> <`_,   >  .   <= redistribute it and/or modify it under
10:`=1 )Y*s>-.--   : the terms of the GNU General Public 10:`=1 )Y*s>-.--   : the terms of the GNU General Public
11.="- .-=="i,     .._ License as published by the Free Software 11.="- .-=="i,     .._ License as published by the Free Software
12 - .   .-<_>     .<> Foundation; either version 2 of the License, 12 - .   .-<_>     .<> Foundation; either version 2 of the License,
13     ._= =}       : or (at your option) any later version. 13     ._= =}       : or (at your option) any later version.
14    .%`+i>       _;_. 14    .%`+i>       _;_.
15    .i_,=:_.      -<s. This program is distributed in the hope that 15    .i_,=:_.      -<s. This program is distributed in the hope that
16     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 16     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
17    : ..    .:,     . . . without even the implied warranty of 17    : ..    .:,     . . . without even the implied warranty of
18    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 18    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
19  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU 19  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
20..}^=.=       =       ; General Public License for more 20..}^=.=       =       ; General Public License for more
21++=   -.     .`     .: details. 21++=   -.     .`     .: details.
22 :     =  ...= . :.=- 22 :     =  ...= . :.=-
23 -.   .:....=;==+<; You should have received a copy of the GNU 23 -.   .:....=;==+<; You should have received a copy of the GNU
24  -_. . .   )=.  = General Public License along with 24  -_. . .   )=.  = General Public License along with
25    --        :-=` this library; see the file COPYING.LIB. 25    --        :-=` this library; see the file COPYING.LIB.
26 If not, write to the Free Software Foundation, 26 If not, write to the Free Software Foundation,
27 Inc., 59 Temple Place - Suite 330, 27 Inc., 59 Temple Place - Suite 330,
28 Boston, MA 02111-1307, USA. 28 Boston, MA 02111-1307, USA.
29 29
30*/ 30*/
31 31
32#include "playlistwidget.h" 32#include "playlistwidget.h"
33#include "om3u.h" 33#include "om3u.h"
34 34
35#include <qpe/applnk.h> 35#include <qpe/applnk.h>
36#include <qpe/qpeapplication.h> 36#include <qpe/qpeapplication.h>
37#include <qpe/storage.h> 37#include <qpe/storage.h>
38#include <qpe/mimetype.h> 38#include <qpe/mimetype.h>
39#include <qpe/global.h> 39#include <qpe/global.h>
40#include <qpe/resource.h> 40#include <qpe/resource.h>
41 41
42#include <qdir.h> 42#include <qdir.h>
43#include <qregexp.h> 43#include <qregexp.h>
44#include <qstring.h> 44#include <qstring.h>
45#include <qtextstream.h> 45#include <qtextstream.h>
46#include <qstringlist.h> 46#include <qstringlist.h>
47#include <qcstring.h> 47#include <qcstring.h>
48 48
49static inline QString fullBaseName ( const QFileInfo &fi ) 49static inline QString fullBaseName ( const QFileInfo &fi )
50{ 50{
51 QString str = fi. fileName ( ); 51 QString str = fi. fileName ( );
52 return str. left ( str. findRev ( '.' )); 52 return str. left ( str. findRev ( '.' ));
53} 53}
54 54
55 55
56//extern PlayListWidget *playList; 56//extern PlayListWidget *playList;
57 57
58Om3u::Om3u( const QString &filePath, int mode) 58Om3u::Om3u( const QString &filePath, int mode)
59 : QStringList (){ 59 : QStringList (){
60//qDebug("<<<<<<<new m3u "+filePath); 60//qDebug("<<<<<<<new m3u "+filePath);
61 f.setName(filePath); 61 f.setName(filePath);
62 f.open(mode); 62 f.open(mode);
63} 63}
64 64
65Om3u::~Om3u(){} 65Om3u::~Om3u(){}
66 66
67void Om3u::readM3u() { 67void Om3u::readM3u() {
68// qDebug("<<<<<<reading m3u "+f.name()); 68// qDebug("<<<<<<reading m3u "+f.name());
69 QTextStream t(&f); 69 QTextStream t(&f);
70 t.setEncoding(QTextStream::UnicodeUTF8);
70 QString s; 71 QString s;
71 while ( !t.atEnd() ) { 72 while ( !t.atEnd() ) {
72 s=t.readLine(); 73 s=t.readLine();
73 // qDebug(s); 74 // qDebug(s);
74 if( s.find( "#", 0, TRUE) == -1 ) { 75 if( s.find( "#", 0, TRUE) == -1 ) {
75 if( s.left(2) == "E:" || s.left(2) == "P:" ) { 76 if( s.left(2) == "E:" || s.left(2) == "P:" ) {
76 s = s.right( s.length() -2 ); 77 s = s.right( s.length() -2 );
77 QFileInfo f( s ); 78 QFileInfo f( s );
78 QString name = fullBaseName ( f ); 79 QString name = fullBaseName ( f );
79 name = name.right( name.length() - name.findRev( "\\", -1, TRUE ) -1 ); 80 name = name.right( name.length() - name.findRev( "\\", -1, TRUE ) -1 );
80 s=s.replace( QRegExp( "\\" ), "/" ); 81 s=s.replace( QRegExp( "\\" ), "/" );
81 append(s); 82 append(s);
82 // qDebug(s); 83 // qDebug(s);
83 } else { // is url 84 } else { // is url
84 s.replace( QRegExp( "%20" )," " ); 85 s.replace( QRegExp( "%20" )," " );
85 QString name; 86 QString name;
86 // if( name.left( 4 ) == "http" ) { 87 // if( name.left( 4 ) == "http" ) {
87 // name = s.right( s.length() - 7 ); 88 // name = s.right( s.length() - 7 );
88 // } else { 89 // } else {
89 name = s; 90 name = s;
90 // } 91 // }
91 append(name); 92 append(name);
92 // qDebug(name); 93 // qDebug(name);
93 } 94 }
94 } 95 }
95 } 96 }
96} 97}
97 98
98void Om3u::readPls() { //it's a pls file 99void Om3u::readPls() { //it's a pls file
99 QTextStream t( &f ); 100 QTextStream t( &f );
101 t.setEncoding(QTextStream::UnicodeUTF8);
100 QString s; 102 QString s;
101 while ( !t.atEnd() ) { 103 while ( !t.atEnd() ) {
102 s = t.readLine(); 104 s = t.readLine();
103 if( s.left(4) == "File" ) { 105 if( s.left(4) == "File" ) {
104 s = s.right( s.length() - 6 ); 106 s = s.right( s.length() - 6 );
105 s.replace( QRegExp( "%20" )," "); 107 s.replace( QRegExp( "%20" )," ");
106// qDebug( "adding " + s + " to playlist" ); 108// qDebug( "adding " + s + " to playlist" );
107 // numberofentries=2 109 // numberofentries=2
108 // File1=http 110 // File1=http
109 // Title 111 // Title
110 // Length 112 // Length
111 // Version 113 // Version
112 // File2=http 114 // File2=http
113 s = s.replace( QRegExp( "\\" ), "/" ); 115 s = s.replace( QRegExp( "\\" ), "/" );
114 QFileInfo f( s ); 116 QFileInfo f( s );
115 QString name = fullBaseName ( f ); 117 QString name = fullBaseName ( f );
116 if( name.left( 4 ) == "http" ) { 118 if( name.left( 4 ) == "http" ) {
117 name = s.right( s.length() - 7); 119 name = s.right( s.length() - 7);
118 } else { 120 } else {
119 name = s; 121 name = s;
120 } 122 }
121 name = name.right( name.length() - name.findRev( "\\", -1, TRUE) - 1 ); 123 name = name.right( name.length() - name.findRev( "\\", -1, TRUE) - 1 );
122 if( s.at( s.length() - 4) == '.') // if this is probably a file 124 if( s.at( s.length() - 4) == '.') // if this is probably a file
123 append(s); 125 append(s);
124 else { //if its a url 126 else { //if its a url
125 if( name.right( 1 ).find( '/' ) == -1) { 127 if( name.right( 1 ).find( '/' ) == -1) {
126 s += "/"; 128 s += "/";
127 } 129 }
128 append(s); 130 append(s);
129 } 131 }
130 } 132 }
131 } 133 }
132} 134}
133 135
134void Om3u::write() { //writes list to m3u file 136void Om3u::write() { //writes list to m3u file
135 QString list; 137 QString list;
138 QTextStream t(&f);
139 t.setEncoding(QTextStream::UnicodeUTF8);
136 if(count()>0) { 140 if(count()>0) {
137 for ( QStringList::ConstIterator it = begin(); it != end(); ++it ) { 141 for ( QStringList::ConstIterator it = begin(); it != end(); ++it ) {
138 // qDebug(*it); 142 // qDebug(*it);
139 list += *it+"\n"; 143 t << *it << "\n";
140 } 144 }
141 f.writeBlock( list, list.length() );
142 } 145 }
143// f.close(); 146// f.close();
144} 147}
145 148
146void Om3u::add(const QString &filePath) { //adds to m3u file 149void Om3u::add(const QString &filePath) { //adds to m3u file
147 append(filePath); 150 append(filePath);
148} 151}
149 152
150void Om3u::remove(const QString &filePath) { //removes from m3u list 153void Om3u::remove(const QString &filePath) { //removes from m3u list
151 QString list, currentFile; 154 QString list, currentFile;
152 if(count()>0) { 155 if(count()>0) {
153 for ( QStringList::ConstIterator it = begin(); it != end(); ++it ) { 156 for ( QStringList::ConstIterator it = begin(); it != end(); ++it ) {
154 currentFile=*it; 157 currentFile=*it;
155 // qDebug(*it); 158 // qDebug(*it);
156 159
157 if( filePath != currentFile) 160 if( filePath != currentFile)
158 list += currentFile+"\n"; 161 list += currentFile+"\n";
159 } 162 }
160 f.writeBlock( list, list.length() ); 163 f.writeBlock( list, list.length() );
161 } 164 }
162} 165}
163 166
164void Om3u::deleteFile(const QString &filePath) {//deletes m3u file 167void Om3u::deleteFile(const QString &filePath) {//deletes m3u file
165 f.close(); 168 f.close();
166 f.remove(); 169 f.remove();
167 170
168} 171}
169 172
170void Om3u::close() { //closes m3u file 173void Om3u::close() { //closes m3u file
171 f.close(); 174 f.close();
172} 175}
diff --git a/noncore/multimedia/opieplayer2/lib.cpp b/noncore/multimedia/opieplayer2/lib.cpp
index 00cfa33..664ec65 100644
--- a/noncore/multimedia/opieplayer2/lib.cpp
+++ b/noncore/multimedia/opieplayer2/lib.cpp
@@ -1,433 +1,433 @@
1/* 1/*
2                This file is part of the Opie Project 2                This file is part of the Opie Project
3 3
4              Copyright (c) 2002 Max Reiss <harlekin@handhelds.org> 4              Copyright (c) 2002 Max Reiss <harlekin@handhelds.org>
5 Copyright (c) 2002 LJP <> 5 Copyright (c) 2002 LJP <>
6 Copyright (c) 2002 Holger Freyther <zecke@handhelds.org> 6 Copyright (c) 2002 Holger Freyther <zecke@handhelds.org>
7 =. 7 =.
8 .=l. 8 .=l.
9           .>+-= 9           .>+-=
10 _;:,     .>    :=|. This program is free software; you can 10 _;:,     .>    :=|. This program is free software; you can
11.> <`_,   >  .   <= redistribute it and/or modify it under 11.> <`_,   >  .   <= redistribute it and/or modify it under
12:`=1 )Y*s>-.--   : the terms of the GNU General Public 12:`=1 )Y*s>-.--   : the terms of the GNU General Public
13.="- .-=="i,     .._ License as published by the Free Software 13.="- .-=="i,     .._ License as published by the Free Software
14 - .   .-<_>     .<> Foundation; either version 2 of the License, 14 - .   .-<_>     .<> Foundation; either version 2 of the License,
15     ._= =}       : or (at your option) any later version. 15     ._= =}       : or (at your option) any later version.
16    .%`+i>       _;_. 16    .%`+i>       _;_.
17    .i_,=:_.      -<s. This program is distributed in the hope that 17    .i_,=:_.      -<s. This program is distributed in the hope that
18     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 18     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
19    : ..    .:,     . . . without even the implied warranty of 19    : ..    .:,     . . . without even the implied warranty of
20    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 20    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
21  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU 21  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
22..}^=.=       =       ; Library General Public License for more 22..}^=.=       =       ; Library General Public License for more
23++=   -.     .`     .: details. 23++=   -.     .`     .: details.
24 :     =  ...= . :.=- 24 :     =  ...= . :.=-
25 -.   .:....=;==+<; You should have received a copy of the GNU 25 -.   .:....=;==+<; You should have received a copy of the GNU
26  -_. . .   )=.  = Library General Public License along with 26  -_. . .   )=.  = Library General Public License along with
27    --        :-=` this library; see the file COPYING.LIB. 27    --        :-=` this library; see the file COPYING.LIB.
28 If not, write to the Free Software Foundation, 28 If not, write to the Free Software Foundation,
29 Inc., 59 Temple Place - Suite 330, 29 Inc., 59 Temple Place - Suite 330,
30 Boston, MA 02111-1307, USA. 30 Boston, MA 02111-1307, USA.
31 31
32*/ 32*/
33 33
34 34
35#include <qtextstream.h> 35#include <qtextstream.h>
36 36
37#include <qdir.h> 37#include <qdir.h>
38 38
39#include <qgfx_qws.h> 39#include <qgfx_qws.h>
40#include <qdirectpainter_qws.h> 40#include <qdirectpainter_qws.h>
41 41
42#include <assert.h> 42#include <assert.h>
43 43
44#include "xinevideowidget.h" 44#include "xinevideowidget.h"
45#include "frame.h" 45#include "frame.h"
46#include "lib.h" 46#include "lib.h"
47 47
48 48
49typedef void (*display_xine_frame_t) (void *user_data, uint8_t* frame, 49typedef void (*display_xine_frame_t) (void *user_data, uint8_t* frame,
50 int width, int height,int bytes ); 50 int width, int height,int bytes );
51 51
52extern "C" { 52extern "C" {
53 xine_vo_driver_t* init_video_out_plugin( xine_t *xine, void* video, display_xine_frame_t, void * ); 53 xine_vo_driver_t* init_video_out_plugin( xine_t *xine, void* video, display_xine_frame_t, void * );
54 int null_is_showing_video( const xine_vo_driver_t* self ); 54 int null_is_showing_video( const xine_vo_driver_t* self );
55 void null_set_show_video( const xine_vo_driver_t* self, int show ); 55 void null_set_show_video( const xine_vo_driver_t* self, int show );
56 int null_is_fullscreen( const xine_vo_driver_t* self ); 56 int null_is_fullscreen( const xine_vo_driver_t* self );
57 void null_set_fullscreen( const xine_vo_driver_t* self, int screen ); 57 void null_set_fullscreen( const xine_vo_driver_t* self, int screen );
58 int null_is_scaling( const xine_vo_driver_t* self ); 58 int null_is_scaling( const xine_vo_driver_t* self );
59 void null_set_scaling( const xine_vo_driver_t* self, int scale ); 59 void null_set_scaling( const xine_vo_driver_t* self, int scale );
60 void null_set_gui_width( const xine_vo_driver_t* self, int width ); 60 void null_set_gui_width( const xine_vo_driver_t* self, int width );
61 void null_set_gui_height( const xine_vo_driver_t* self, int height ); 61 void null_set_gui_height( const xine_vo_driver_t* self, int height );
62 void null_set_mode( const xine_vo_driver_t* self, int depth, int rgb ); 62 void null_set_mode( const xine_vo_driver_t* self, int depth, int rgb );
63 void null_set_videoGamma( const xine_vo_driver_t* self , int value ); 63 void null_set_videoGamma( const xine_vo_driver_t* self , int value );
64 void null_display_handler( const xine_vo_driver_t* self, display_xine_frame_t t, void* user_data ); 64 void null_display_handler( const xine_vo_driver_t* self, display_xine_frame_t t, void* user_data );
65 65
66 void null_preload_decoders( xine_stream_t *stream ); 66 void null_preload_decoders( xine_stream_t *stream );
67} 67}
68 68
69using namespace XINE; 69using namespace XINE;
70 70
71Lib::Lib( InitializationMode initMode, XineVideoWidget* widget ) 71Lib::Lib( InitializationMode initMode, XineVideoWidget* widget )
72{ 72{
73 m_initialized = false; 73 m_initialized = false;
74 m_duringInitialization = false; 74 m_duringInitialization = false;
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 ts << "# uncomment if you experience double speed audio \n #audio.oss_sync_method:softsync\n"; 87 ts << "# uncomment if you experience double speed audio \n #audio.oss_sync_method:softsync\n";
88 ts << "codec.ffmpeg_pp_quality:3\n"; 88 ts << "codec.ffmpeg_pp_quality:3\n";
89 ts << "audio.num_buffers:50\n"; 89 ts << "audio.num_buffers:50\n";
90 ts << "audio.size_buffers:4096\n"; 90 ts << "audio.size_buffers:4096\n";
91 ts << "video.num_buffers:20\n"; 91 ts << "video.num_buffers:20\n";
92 ts << "video.size_buffers:4096\n"; 92 ts << "video.size_buffers:4096\n";
93 ts << "audio.out_num_audio_buf:16\n"; 93 ts << "audio.out_num_audio_buf:16\n";
94 ts << "audio.out_size_audio_buf:8096\n"; 94 ts << "audio.out_size_audio_buf:8096\n";
95 ts << "audio.out_size_zero_buf:1024\n"; 95 ts << "audio.out_size_zero_buf:1024\n";
96 ts << "audio.passthrough_offset:0\n"; 96 ts << "audio.passthrough_offset:0\n";
97 f.close(); 97 f.close();
98 } 98 }
99 99
100 if ( initMode == InitializeImmediately ) { 100 if ( initMode == InitializeImmediately ) {
101 initialize(); 101 initialize();
102 m_initialized = true; 102 m_initialized = true;
103 } 103 }
104 else 104 else
105 start(); 105 start();
106} 106}
107 107
108void Lib::run() 108void Lib::run()
109{ 109{
110 qDebug( "Lib::run() started" ); 110 qDebug( "Lib::run() started" );
111 initialize(); 111 initialize();
112 m_initialized = true; 112 m_initialized = true;
113 qDebug( "Lib::run() finished" ); 113 qDebug( "Lib::run() finished" );
114} 114}
115 115
116void Lib::initialize() 116void Lib::initialize()
117{ 117{
118 m_duringInitialization = true; 118 m_duringInitialization = true;
119 m_xine = xine_new( ); 119 m_xine = xine_new( );
120 120
121 QString configPath = QDir::homeDirPath() + "/Settings/opiexine.cf"; 121 QString configPath = QDir::homeDirPath() + "/Settings/opiexine.cf";
122 xine_config_load( m_xine, QFile::encodeName( configPath ) ); 122 xine_config_load( m_xine, QFile::encodeName( configPath ) );
123 123
124 xine_init( m_xine ); 124 xine_init( m_xine );
125 125
126 // allocate oss for sound 126 // allocate oss for sound
127 // and fb for framebuffer 127 // and fb for framebuffer
128 m_audioOutput = xine_open_audio_driver( m_xine, "oss", NULL ); 128 m_audioOutput = xine_open_audio_driver( m_xine, "oss", NULL );
129 m_videoOutput = ::init_video_out_plugin( m_xine, NULL, xine_display_frame, this ); 129 m_videoOutput = ::init_video_out_plugin( m_xine, NULL, xine_display_frame, this );
130 130
131 131
132//xine_open_video_driver( m_xine, NULL, XINE_VISUAL_TYPE_FB, NULL); 132//xine_open_video_driver( m_xine, NULL, XINE_VISUAL_TYPE_FB, NULL);
133 133
134 134
135// null_display_handler( m_videoOutput, xine_display_frame, this ); 135// null_display_handler( m_videoOutput, xine_display_frame, this );
136 136
137 m_stream = xine_stream_new (m_xine, m_audioOutput, m_videoOutput ); 137 m_stream = xine_stream_new (m_xine, m_audioOutput, m_videoOutput );
138 138
139 if (m_wid != 0 ) { 139 if (m_wid != 0 ) {
140 printf( "!0\n" ); 140 printf( "!0\n" );
141 setWidget( m_wid ); 141 setWidget( m_wid );
142 } 142 }
143 143
144 m_queue = xine_event_new_queue (m_stream); 144 m_queue = xine_event_new_queue (m_stream);
145 145
146 xine_event_create_listener_thread (m_queue, xine_event_handler, this); 146 xine_event_create_listener_thread (m_queue, xine_event_handler, this);
147 147
148 ::null_preload_decoders( m_stream ); 148 ::null_preload_decoders( m_stream );
149 149
150 m_duringInitialization = false; 150 m_duringInitialization = false;
151} 151}
152 152
153Lib::~Lib() { 153Lib::~Lib() {
154 assert( isRunning() == false ); 154 assert( isRunning() == false );
155 assert( m_initialized ); 155 assert( m_initialized );
156 156
157// free( m_config ); 157// free( m_config );
158 158
159 xine_close( m_stream ); 159 xine_close( m_stream );
160 160
161 xine_event_dispose_queue( m_queue ); 161 xine_event_dispose_queue( m_queue );
162 162
163 xine_dispose( m_stream ); 163 xine_dispose( m_stream );
164 164
165 xine_exit( m_xine ); 165 xine_exit( m_xine );
166 /* FIXME either free or delete but valgrind bitches against both */ 166 /* FIXME either free or delete but valgrind bitches against both */
167 //free( m_videoOutput ); 167 //free( m_videoOutput );
168 //delete m_audioOutput; 168 //delete m_audioOutput;
169} 169}
170 170
171void Lib::resize ( const QSize &s ) { 171void Lib::resize ( const QSize &s ) {
172 assert( m_initialized || m_duringInitialization ); 172 assert( m_initialized || m_duringInitialization );
173 173
174 if ( s. width ( ) && s. height ( ) ) { 174 if ( s. width ( ) && s. height ( ) ) {
175 ::null_set_gui_width( m_videoOutput, s. width() ); 175 ::null_set_gui_width( m_videoOutput, s. width() );
176 ::null_set_gui_height( m_videoOutput, s. height() ); 176 ::null_set_gui_height( m_videoOutput, s. height() );
177 } 177 }
178} 178}
179 179
180int Lib::majorVersion() { 180int Lib::majorVersion() {
181 int major, minor, sub; 181 int major, minor, sub;
182 xine_get_version ( &major, &minor, &sub ); 182 xine_get_version ( &major, &minor, &sub );
183 return major; 183 return major;
184} 184}
185 185
186int Lib::minorVersion() { 186int Lib::minorVersion() {
187 int major, minor, sub; 187 int major, minor, sub;
188 xine_get_version ( &major, &minor, &sub ); 188 xine_get_version ( &major, &minor, &sub );
189 return minor; 189 return minor;
190} 190}
191 191
192int Lib::subVersion() { 192int Lib::subVersion() {
193 int major, minor, sub; 193 int major, minor, sub;
194 xine_get_version ( &major, &minor, &sub ); 194 xine_get_version ( &major, &minor, &sub );
195 return sub; 195 return sub;
196} 196}
197 197
198int Lib::play( const QString& fileName, int startPos, int start_time ) { 198int Lib::play( const QString& fileName, int startPos, int start_time ) {
199 assert( m_initialized ); 199 assert( m_initialized );
200 // FIXME actually a hack imho. Should not be needed to dispose the whole stream 200 // FIXME actually a hack imho. Should not be needed to dispose the whole stream
201 // but without we get wrong media length reads from libxine for the second media 201 // but without we get wrong media length reads from libxine for the second media
202 //xine_dispose ( m_stream ); 202 //xine_dispose ( m_stream );
203 203
204 QString str = fileName.stripWhiteSpace(); 204 QString str = fileName.stripWhiteSpace();
205 205
206 //m_stream = xine_stream_new (m_xine, m_audioOutput, m_videoOutput ); 206 //m_stream = xine_stream_new (m_xine, m_audioOutput, m_videoOutput );
207 //m_queue = xine_event_new_queue (m_stream); 207 //m_queue = xine_event_new_queue (m_stream);
208 //xine_event_create_listener_thread (m_queue, xine_event_handler, this); 208 //xine_event_create_listener_thread (m_queue, xine_event_handler, this);
209 209
210 if ( !xine_open( m_stream, QFile::encodeName(str.utf8() ).data() ) ) { 210 if ( !xine_open( m_stream, str.utf8().data() ) ) {
211 return 0; 211 return 0;
212 } 212 }
213 return xine_play( m_stream, startPos, start_time); 213 return xine_play( m_stream, startPos, start_time);
214} 214}
215 215
216void Lib::stop() { 216void Lib::stop() {
217 assert( m_initialized ); 217 assert( m_initialized );
218 218
219 qDebug("<<<<<<<< STOP IN LIB TRIGGERED >>>>>>>"); 219 qDebug("<<<<<<<< STOP IN LIB TRIGGERED >>>>>>>");
220 xine_stop( m_stream ); 220 xine_stop( m_stream );
221} 221}
222 222
223void Lib::pause( bool toggle ) { 223void Lib::pause( bool toggle ) {
224 assert( m_initialized ); 224 assert( m_initialized );
225 225
226 xine_set_param( m_stream, XINE_PARAM_SPEED, toggle ? XINE_SPEED_PAUSE : XINE_SPEED_NORMAL ); 226 xine_set_param( m_stream, XINE_PARAM_SPEED, toggle ? XINE_SPEED_PAUSE : XINE_SPEED_NORMAL );
227} 227}
228 228
229int Lib::speed() const { 229int Lib::speed() const {
230 assert( m_initialized ); 230 assert( m_initialized );
231 231
232 return xine_get_param ( m_stream, XINE_PARAM_SPEED ); 232 return xine_get_param ( m_stream, XINE_PARAM_SPEED );
233} 233}
234 234
235void Lib::setSpeed( int speed ) { 235void Lib::setSpeed( int speed ) {
236 assert( m_initialized ); 236 assert( m_initialized );
237 237
238 xine_set_param ( m_stream, XINE_PARAM_SPEED, speed ); 238 xine_set_param ( m_stream, XINE_PARAM_SPEED, speed );
239} 239}
240 240
241int Lib::status() const { 241int Lib::status() const {
242 assert( m_initialized ); 242 assert( m_initialized );
243 243
244 return xine_get_status( m_stream ); 244 return xine_get_status( m_stream );
245} 245}
246 246
247int Lib::currentPosition() const { 247int Lib::currentPosition() const {
248 assert( m_initialized ); 248 assert( m_initialized );
249 249
250 int pos, time, length; 250 int pos, time, length;
251 xine_get_pos_length( m_stream, &pos, &time, &length ); 251 xine_get_pos_length( m_stream, &pos, &time, &length );
252 return pos; 252 return pos;
253} 253}
254 254
255int Lib::currentTime() const { 255int Lib::currentTime() const {
256 assert( m_initialized ); 256 assert( m_initialized );
257 257
258 int pos, time, length; 258 int pos, time, length;
259 xine_get_pos_length( m_stream, &pos, &time, &length ); 259 xine_get_pos_length( m_stream, &pos, &time, &length );
260 if ( time > 0 ) { 260 if ( time > 0 ) {
261 return time/1000; 261 return time/1000;
262 } else { 262 } else {
263 return 0; 263 return 0;
264 } 264 }
265} 265}
266 266
267int Lib::length() const { 267int Lib::length() const {
268 assert( m_initialized ); 268 assert( m_initialized );
269 269
270 int pos, time, length; 270 int pos, time, length;
271/* dilb: patch to solve the wrong stream length reported to the GUI*/ 271/* dilb: patch to solve the wrong stream length reported to the GUI*/
272 int iRetVal=0, iTestLoop=0; 272 int iRetVal=0, iTestLoop=0;
273 273
274 do 274 do
275 { 275 {
276 iRetVal = xine_get_pos_length( m_stream, &pos, &time, &length ); 276 iRetVal = xine_get_pos_length( m_stream, &pos, &time, &length );
277 if (iRetVal) 277 if (iRetVal)
278 {/* if the function didn't return 0, then pos, time and length are valid.*/ 278 {/* if the function didn't return 0, then pos, time and length are valid.*/
279 return length/1000; 279 return length/1000;
280 } 280 }
281 /*don't poll too much*/ 281 /*don't poll too much*/
282 usleep(100000); 282 usleep(100000);
283 iTestLoop++; 283 iTestLoop++;
284 } 284 }
285 while ( iTestLoop < 10 ); /* if after 1s, we still don't have any 285 while ( iTestLoop < 10 ); /* if after 1s, we still don't have any
286valid stream, then return -1 (this value could be used to make the stream 286valid stream, then return -1 (this value could be used to make the stream
287unseekable, but it should never occur!! Mr. Murphy ? :) ) */ 287unseekable, but it should never occur!! Mr. Murphy ? :) ) */
288 288
289 return -1; 289 return -1;
290} 290}
291 291
292bool Lib::isSeekable() const { 292bool Lib::isSeekable() const {
293 assert( m_initialized ); 293 assert( m_initialized );
294 294
295 return xine_get_stream_info( m_stream, XINE_STREAM_INFO_SEEKABLE ); 295 return xine_get_stream_info( m_stream, XINE_STREAM_INFO_SEEKABLE );
296} 296}
297 297
298void Lib::seekTo( int time ) { 298void Lib::seekTo( int time ) {
299 assert( m_initialized ); 299 assert( m_initialized );
300 300
301 //xine_trick_mode ( m_stream, XINE_TRICK_MODE_SEEK_TO_TIME, time ); NOT IMPLEMENTED YET IN XINE :_( 301 //xine_trick_mode ( m_stream, XINE_TRICK_MODE_SEEK_TO_TIME, time ); NOT IMPLEMENTED YET IN XINE :_(
302 // since its now milliseconds we need *1000 302 // since its now milliseconds we need *1000
303 xine_play( m_stream, 0, time*1000 ); 303 xine_play( m_stream, 0, time*1000 );
304} 304}
305 305
306 306
307Frame Lib::currentFrame() const { 307Frame Lib::currentFrame() const {
308 assert( m_initialized ); 308 assert( m_initialized );
309 309
310 Frame frame; 310 Frame frame;
311 return frame; 311 return frame;
312}; 312};
313 313
314QString Lib::metaInfo( int number) const { 314QString Lib::metaInfo( int number) const {
315 assert( m_initialized ); 315 assert( m_initialized );
316 316
317 return xine_get_meta_info( m_stream, number ); 317 return xine_get_meta_info( m_stream, number );
318} 318}
319 319
320int Lib::error() const { 320int Lib::error() const {
321 assert( m_initialized ); 321 assert( m_initialized );
322 322
323 return xine_get_error( m_stream ); 323 return xine_get_error( m_stream );
324}; 324};
325 325
326void Lib::ensureInitialized() 326void Lib::ensureInitialized()
327{ 327{
328 if ( m_initialized ) 328 if ( m_initialized )
329 return; 329 return;
330 330
331 qDebug( "waiting for initialization thread to finish" ); 331 qDebug( "waiting for initialization thread to finish" );
332 wait(); 332 wait();
333 qDebug( "initialization thread finished!" ); 333 qDebug( "initialization thread finished!" );
334} 334}
335 335
336void Lib::setWidget( XineVideoWidget *widget ) 336void Lib::setWidget( XineVideoWidget *widget )
337{ 337{
338 m_wid = widget; 338 m_wid = widget;
339 resize ( m_wid-> size ( ) ); 339 resize ( m_wid-> size ( ) );
340 ::null_set_mode( m_videoOutput, qt_screen->depth(), qt_screen->pixelType() ); 340 ::null_set_mode( m_videoOutput, qt_screen->depth(), qt_screen->pixelType() );
341 m_wid->repaint(); 341 m_wid->repaint();
342} 342}
343 343
344void Lib::receiveMessage( ThreadUtil::ChannelMessage *msg, SendType sendType ) 344void Lib::receiveMessage( ThreadUtil::ChannelMessage *msg, SendType sendType )
345{ 345{
346 assert( sendType == ThreadUtil::Channel::OneWay ); 346 assert( sendType == ThreadUtil::Channel::OneWay );
347 handleXineEvent( msg->type() ); 347 handleXineEvent( msg->type() );
348 delete msg; 348 delete msg;
349} 349}
350 350
351void Lib::handleXineEvent( const xine_event_t* t ) { 351void Lib::handleXineEvent( const xine_event_t* t ) {
352 send( new ThreadUtil::ChannelMessage( t->type ), OneWay ); 352 send( new ThreadUtil::ChannelMessage( t->type ), OneWay );
353} 353}
354 354
355void Lib::handleXineEvent( int type ) { 355void Lib::handleXineEvent( int type ) {
356 assert( m_initialized ); 356 assert( m_initialized );
357 357
358 if ( type == XINE_EVENT_UI_PLAYBACK_FINISHED ) { 358 if ( type == XINE_EVENT_UI_PLAYBACK_FINISHED ) {
359 emit stopped(); 359 emit stopped();
360 } 360 }
361} 361}
362 362
363 363
364void Lib::setShowVideo( bool video ) { 364void Lib::setShowVideo( bool video ) {
365 assert( m_initialized ); 365 assert( m_initialized );
366 366
367 m_video = video; 367 m_video = video;
368 ::null_set_show_video( m_videoOutput, video ); 368 ::null_set_show_video( m_videoOutput, video );
369} 369}
370 370
371bool Lib::isShowingVideo() const { 371bool Lib::isShowingVideo() const {
372 assert( m_initialized ); 372 assert( m_initialized );
373 373
374 return ::null_is_showing_video( m_videoOutput ); 374 return ::null_is_showing_video( m_videoOutput );
375} 375}
376 376
377bool Lib::hasVideo() const { 377bool Lib::hasVideo() const {
378 assert( m_initialized ); 378 assert( m_initialized );
379 379
380 return xine_get_stream_info( m_stream, 18 ); 380 return xine_get_stream_info( m_stream, 18 );
381} 381}
382 382
383void Lib::showVideoFullScreen( bool fullScreen ) { 383void Lib::showVideoFullScreen( bool fullScreen ) {
384 assert( m_initialized ); 384 assert( m_initialized );
385 385
386 ::null_set_fullscreen( m_videoOutput, fullScreen ); 386 ::null_set_fullscreen( m_videoOutput, fullScreen );
387} 387}
388 388
389bool Lib::isVideoFullScreen() const { 389bool Lib::isVideoFullScreen() const {
390 assert( m_initialized ); 390 assert( m_initialized );
391 391
392 return ::null_is_fullscreen( m_videoOutput ); 392 return ::null_is_fullscreen( m_videoOutput );
393} 393}
394 394
395void Lib::setScaling( bool scale ) { 395void Lib::setScaling( bool scale ) {
396 assert( m_initialized ); 396 assert( m_initialized );
397 397
398 ::null_set_scaling( m_videoOutput, scale ); 398 ::null_set_scaling( m_videoOutput, scale );
399} 399}
400 400
401void Lib::setGamma( int value ) { 401void Lib::setGamma( int value ) {
402 assert( m_initialized ); 402 assert( m_initialized );
403 403
404 ::null_set_videoGamma( m_videoOutput, value ); 404 ::null_set_videoGamma( m_videoOutput, value );
405} 405}
406 406
407bool Lib::isScaling() const { 407bool Lib::isScaling() const {
408 assert( m_initialized ); 408 assert( m_initialized );
409 409
410 return ::null_is_scaling( m_videoOutput ); 410 return ::null_is_scaling( m_videoOutput );
411} 411}
412 412
413void Lib::xine_event_handler( void* user_data, const xine_event_t* t ) { 413void Lib::xine_event_handler( void* user_data, const xine_event_t* t ) {
414 ( (Lib*)user_data)->handleXineEvent( t ); 414 ( (Lib*)user_data)->handleXineEvent( t );
415} 415}
416 416
417void Lib::xine_display_frame( void* user_data, uint8_t *frame, 417void Lib::xine_display_frame( void* user_data, uint8_t *frame,
418 int width, int height, int bytes ) { 418 int width, int height, int bytes ) {
419 ( (Lib*)user_data)->drawFrame( frame, width, height, bytes ); 419 ( (Lib*)user_data)->drawFrame( frame, width, height, bytes );
420} 420}
421 421
422void Lib::drawFrame( uint8_t* frame, int width, int height, int bytes ) { 422void Lib::drawFrame( uint8_t* frame, int width, int height, int bytes ) {
423 assert( m_initialized ); 423 assert( m_initialized );
424 424
425 if ( !m_video ) { 425 if ( !m_video ) {
426 qWarning("not showing video now"); 426 qWarning("not showing video now");
427 return; 427 return;
428 } 428 }
429 429
430 assert( m_wid ); 430 assert( m_wid );
431 431
432 m_wid-> setVideoFrame ( frame, width, height, bytes ); 432 m_wid-> setVideoFrame ( frame, width, height, bytes );
433} 433}
diff --git a/noncore/multimedia/opieplayer2/om3u.cpp b/noncore/multimedia/opieplayer2/om3u.cpp
index 7183fb4..69e87e7 100644
--- a/noncore/multimedia/opieplayer2/om3u.cpp
+++ b/noncore/multimedia/opieplayer2/om3u.cpp
@@ -1,160 +1,163 @@
1/* 1/*
2                This file is part of the Opie Project 2                This file is part of the Opie Project
3 3
4 Copyright (c) 2002 L. Potter <ljp@llornkcor.com> 4 Copyright (c) 2002 L. Potter <ljp@llornkcor.com>
5 =. 5 =.
6 .=l. 6 .=l.
7           .>+-= 7           .>+-=
8 _;:,     .>    :=|. This program is free software; you can 8 _;:,     .>    :=|. This program is free software; you can
9.> <`_,   >  .   <= redistribute it and/or modify it under 9.> <`_,   >  .   <= redistribute it and/or modify it under
10:`=1 )Y*s>-.--   : the terms of the GNU General Public 10:`=1 )Y*s>-.--   : the terms of the GNU General Public
11.="- .-=="i,     .._ License as published by the Free Software 11.="- .-=="i,     .._ License as published by the Free Software
12 - .   .-<_>     .<> Foundation; either version 2 of the License, 12 - .   .-<_>     .<> Foundation; either version 2 of the License,
13     ._= =}       : or (at your option) any later version. 13     ._= =}       : or (at your option) any later version.
14    .%`+i>       _;_. 14    .%`+i>       _;_.
15    .i_,=:_.      -<s. This program is distributed in the hope that 15    .i_,=:_.      -<s. This program is distributed in the hope that
16     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 16     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
17    : ..    .:,     . . . without even the implied warranty of 17    : ..    .:,     . . . without even the implied warranty of
18    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 18    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
19  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU 19  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
20..}^=.=       =       ; General Public License for more 20..}^=.=       =       ; General Public License for more
21++=   -.     .`     .: details. 21++=   -.     .`     .: details.
22 :     =  ...= . :.=- 22 :     =  ...= . :.=-
23 -.   .:....=;==+<; You should have received a copy of the GNU 23 -.   .:....=;==+<; You should have received a copy of the GNU
24  -_. . .   )=.  = General Public License along with 24  -_. . .   )=.  = General Public License along with
25    --        :-=` this library; see the file COPYING.LIB. 25    --        :-=` this library; see the file COPYING.LIB.
26 If not, write to the Free Software Foundation, 26 If not, write to the Free Software Foundation,
27 Inc., 59 Temple Place - Suite 330, 27 Inc., 59 Temple Place - Suite 330,
28 Boston, MA 02111-1307, USA. 28 Boston, MA 02111-1307, USA.
29 29
30*/ 30*/
31 31
32#include "playlistwidget.h" 32#include "playlistwidget.h"
33#include "om3u.h" 33#include "om3u.h"
34 34
35#include <qpe/applnk.h> 35#include <qpe/applnk.h>
36#include <qpe/qpeapplication.h> 36#include <qpe/qpeapplication.h>
37#include <qpe/storage.h> 37#include <qpe/storage.h>
38#include <qpe/mimetype.h> 38#include <qpe/mimetype.h>
39#include <qpe/global.h> 39#include <qpe/global.h>
40#include <qpe/resource.h> 40#include <qpe/resource.h>
41 41
42#include <qdir.h> 42#include <qdir.h>
43#include <qregexp.h> 43#include <qregexp.h>
44#include <qstring.h> 44#include <qstring.h>
45#include <qtextstream.h> 45#include <qtextstream.h>
46#include <qstringlist.h> 46#include <qstringlist.h>
47#include <qcstring.h> 47#include <qcstring.h>
48 48
49//extern PlayListWidget *playList; 49//extern PlayListWidget *playList;
50 50
51Om3u::Om3u( const QString &filePath, int mode) 51Om3u::Om3u( const QString &filePath, int mode)
52 : QStringList (){ 52 : QStringList (){
53qDebug("<<<<<<<new m3u "+filePath); 53qDebug("<<<<<<<new m3u "+filePath);
54 f.setName(filePath); 54 f.setName(filePath);
55 f.open(mode); 55 f.open(mode);
56} 56}
57 57
58Om3u::~Om3u(){} 58Om3u::~Om3u(){}
59 59
60void Om3u::readM3u() { 60void Om3u::readM3u() {
61// qDebug("<<<<<<reading m3u "+f.name()); 61// qDebug("<<<<<<reading m3u "+f.name());
62 QTextStream t(&f); 62 QTextStream t(&f);
63 QString s; 63 t.setEncoding(QTextStream::UnicodeUTF8);
64 QString s;
64 while ( !t.atEnd() ) { 65 while ( !t.atEnd() ) {
65 s=t.readLine(); 66 s=t.readLine();
66// qDebug(s); 67// qDebug(s);
67 if( s.find( "#", 0, TRUE) == -1 ) { 68 if( s.find( "#", 0, TRUE) == -1 ) {
68 if( s.left(2) == "E:" || s.left(2) == "P:" ) { 69 if( s.left(2) == "E:" || s.left(2) == "P:" ) {
69 s = s.right( s.length() -2 ); 70 s = s.right( s.length() -2 );
70 QFileInfo f( s ); 71 QFileInfo f( s );
71 QString name = f.baseName(); 72 QString name = f.baseName();
72 name = name.right( name.length() - name.findRev( "\\", -1, TRUE ) -1 ); 73 name = name.right( name.length() - name.findRev( "\\", -1, TRUE ) -1 );
73 s=s.replace( QRegExp( "\\" ), "/" ); 74 s=s.replace( QRegExp( "\\" ), "/" );
74 append(s); 75 append(s);
75// qDebug(s); 76// qDebug(s);
76 } else { // is url 77 } else { // is url
77 QString name; 78 QString name;
78 name = s; 79 name = s;
79 append(name); 80 append(name);
80 } 81 }
81 } 82 }
82 } 83 }
83} 84}
84 85
85void Om3u::readPls() { //it's a pls file 86void Om3u::readPls() { //it's a pls file
86 QTextStream t( &f ); 87 QTextStream t( &f );
87 QString s; 88 t.setEncoding(QTextStream::UnicodeUTF8);
89 QString s;
88 while ( !t.atEnd() ) { 90 while ( !t.atEnd() ) {
89 s = t.readLine(); 91 s = t.readLine();
90 if( s.left(4) == "File" ) { 92 if( s.left(4) == "File" ) {
91 s = s.right( s.length() - s.find("=",0,true)-1 ); 93 s = s.right( s.length() - s.find("=",0,true)-1 );
92 s = s.stripWhiteSpace(); 94 s = s.stripWhiteSpace();
93 s.replace( QRegExp( "%20" )," "); 95 s.replace( QRegExp( "%20" )," ");
94// qDebug( "adding " + s + " to playlist" ); 96// qDebug( "adding " + s + " to playlist" );
95 // numberofentries=2 97 // numberofentries=2
96 // File1=http 98 // File1=http
97 // Title 99 // Title
98 // Length 100 // Length
99 // Version 101 // Version
100 // File2=http 102 // File2=http
101 s = s.replace( QRegExp( "\\" ), "/" ); 103 s = s.replace( QRegExp( "\\" ), "/" );
102 QFileInfo f( s ); 104 QFileInfo f( s );
103 QString name = f.baseName(); 105 QString name = f.baseName();
104 if( name.left( 4 ) == "http" ) { 106 if( name.left( 4 ) == "http" ) {
105 name = s.right( s.length() - 7); 107 name = s.right( s.length() - 7);
106 } else { 108 } else {
107 name = s; 109 name = s;
108 } 110 }
109 name = name.right( name.length() - name.findRev( "\\", -1, TRUE) - 1 ); 111 name = name.right( name.length() - name.findRev( "\\", -1, TRUE) - 1 );
110 if( s.at( s.length() - 4) == '.') // if this is probably a file 112 if( s.at( s.length() - 4) == '.') // if this is probably a file
111 append(s); 113 append(s);
112 else { //if its a url 114 else { //if its a url
113// if( name.right( 1 ).find( '/' ) == -1) { 115// if( name.right( 1 ).find( '/' ) == -1) {
114// s += "/"; 116// s += "/";
115// } 117// }
116 append(s); 118 append(s);
117 } 119 }
118 } 120 }
119 } 121 }
120} 122}
121 123
122void Om3u::write() { //writes list to m3u file 124void Om3u::write() { //writes list to m3u file
123 QString list; 125 QString list;
124 if(count()>0) { 126 QTextStream t(&f);
127 t.setEncoding(QTextStream::UnicodeUTF8);
128 if(count()>0) {
125 for ( QStringList::ConstIterator it = begin(); it != end(); ++it ) { 129 for ( QStringList::ConstIterator it = begin(); it != end(); ++it ) {
126// qDebug(*it); 130// qDebug(*it);
127 list += *it+"\n"; 131 t << *it << "\n";
128 } 132 }
129 f.writeBlock( list, list.length() );
130 } 133 }
131// f.close(); 134// f.close();
132} 135}
133 136
134void Om3u::add(const QString &filePath) { //adds to m3u file 137void Om3u::add(const QString &filePath) { //adds to m3u file
135 append(filePath); 138 append(filePath);
136} 139}
137 140
138void Om3u::remove(const QString &filePath) { //removes from m3u list 141void Om3u::remove(const QString &filePath) { //removes from m3u list
139 QString list, currentFile; 142 QString list, currentFile;
140 if(count()>0) { 143 if(count()>0) {
141 for ( QStringList::ConstIterator it = begin(); it != end(); ++it ) { 144 for ( QStringList::ConstIterator it = begin(); it != end(); ++it ) {
142 currentFile=*it; 145 currentFile=*it;
143 // qDebug(*it); 146 // qDebug(*it);
144 147
145 if( filePath != currentFile) 148 if( filePath != currentFile)
146 list += currentFile+"\n"; 149 list += currentFile+"\n";
147 } 150 }
148 f.writeBlock( list, list.length() ); 151 f.writeBlock( list, list.length() );
149 } 152 }
150} 153}
151 154
152void Om3u::deleteFile(const QString &/*filePath*/) {//deletes m3u file 155void Om3u::deleteFile(const QString &/*filePath*/) {//deletes m3u file
153 f.close(); 156 f.close();
154 f.remove(); 157 f.remove();
155 158
156} 159}
157 160
158void Om3u::close() { //closes m3u file 161void Om3u::close() { //closes m3u file
159 f.close(); 162 f.close();
160} 163}