author | llornkcor <llornkcor> | 2002-04-10 19:13:40 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-04-10 19:13:40 (UTC) |
commit | 9237a75548f9b932fbb1900d8ea28dbee9da81ac (patch) (unidiff) | |
tree | a0249408df5ce581af8bcee5b6f58bcee1db461a /core/multimedia | |
parent | 11d754ffa429875b526c49f125d8a844c5cda3d8 (diff) | |
download | opie-9237a75548f9b932fbb1900d8ea28dbee9da81ac.zip opie-9237a75548f9b932fbb1900d8ea28dbee9da81ac.tar.gz opie-9237a75548f9b932fbb1900d8ea28dbee9da81ac.tar.bz2 |
bug fix
-rw-r--r-- | core/multimedia/opieplayer/libmad/libmadplugin.cpp | 13 | ||||
-rw-r--r-- | core/multimedia/opieplayer/libmad/libmadplugin.h | 2 | ||||
-rw-r--r-- | core/multimedia/opieplayer/libmpeg3/mpeg3io.c | 20 | ||||
-rw-r--r-- | core/multimedia/opieplayer/playlistselection.cpp | 18 | ||||
-rw-r--r-- | core/multimedia/opieplayer/playlistselection.h | 4 | ||||
-rw-r--r-- | core/multimedia/opieplayer/playlistwidget.cpp | 98 |
6 files changed, 102 insertions, 53 deletions
diff --git a/core/multimedia/opieplayer/libmad/libmadplugin.cpp b/core/multimedia/opieplayer/libmad/libmadplugin.cpp index 9f8ba65..8ede537 100644 --- a/core/multimedia/opieplayer/libmad/libmadplugin.cpp +++ b/core/multimedia/opieplayer/libmad/libmadplugin.cpp | |||
@@ -34,2 +34,3 @@ | |||
34 | #include <qapplication.h> | 34 | #include <qapplication.h> |
35 | #include <qpe/config.h> | ||
35 | 36 | ||
@@ -49,2 +50,3 @@ extern "C" { | |||
49 | #define MPEG_BUFFER_SIZE 65536 | 50 | #define MPEG_BUFFER_SIZE 65536 |
51 | //#define MPEG_BUFFER_SIZE 32768 //16384 // 8192 | ||
50 | //#define debugMsg(a) qDebug(a) | 52 | //#define debugMsg(a) qDebug(a) |
@@ -167,3 +169,6 @@ bool LibMadPlugin::open( const QString& path ) { | |||
167 | debugMsg( "LibMadPlugin::open" ); | 169 | debugMsg( "LibMadPlugin::open" ); |
168 | 170 | Config cfg("MediaPlayer"); | |
171 | cfg.setGroup("Options"); | ||
172 | bufferSize = cfg.readNumEntry("MPeg_BufferSize",MPEG_BUFFER_SIZE); | ||
173 | qDebug("buffer size is %d", bufferSize); | ||
169 | d->bad_last_frame = 0; | 174 | d->bad_last_frame = 0; |
@@ -199,3 +204,3 @@ bool LibMadPlugin::open( const QString& path ) { | |||
199 | if (d->input.data == 0) { | 204 | if (d->input.data == 0) { |
200 | d->input.data = (unsigned char *)malloc(MPEG_BUFFER_SIZE); | 205 | d->input.data = (unsigned char *)malloc( bufferSize /*MPEG_BUFFER_SIZE*/); |
201 | if (d->input.data == 0) { | 206 | if (d->input.data == 0) { |
@@ -371,3 +376,3 @@ bool LibMadPlugin::read() { | |||
371 | do { | 376 | do { |
372 | len = ::read(d->input.fd, d->input.data + d->input.length, MPEG_BUFFER_SIZE - d->input.length); | 377 | len = ::read(d->input.fd, d->input.data + d->input.length, bufferSize /* MPEG_BUFFER_SIZE*/ - d->input.length); |
373 | } | 378 | } |
@@ -382,3 +387,3 @@ bool LibMadPlugin::read() { | |||
382 | 387 | ||
383 | assert(MPEG_BUFFER_SIZE - d->input.length >= MAD_BUFFER_GUARD); | 388 | assert(bufferSize /*MPEG_BUFFER_SIZE*/ - d->input.length >= MAD_BUFFER_GUARD); |
384 | 389 | ||
diff --git a/core/multimedia/opieplayer/libmad/libmadplugin.h b/core/multimedia/opieplayer/libmad/libmadplugin.h index b240b77..46cd4a1 100644 --- a/core/multimedia/opieplayer/libmad/libmadplugin.h +++ b/core/multimedia/opieplayer/libmad/libmadplugin.h | |||
@@ -105,3 +105,3 @@ private: | |||
105 | QString info; | 105 | QString info; |
106 | 106 | int bufferSize; | |
107 | }; | 107 | }; |
diff --git a/core/multimedia/opieplayer/libmpeg3/mpeg3io.c b/core/multimedia/opieplayer/libmpeg3/mpeg3io.c index c5807a7..c5cae00 100644 --- a/core/multimedia/opieplayer/libmpeg3/mpeg3io.c +++ b/core/multimedia/opieplayer/libmpeg3/mpeg3io.c | |||
@@ -36,12 +36,12 @@ long mpeg3io_get_total_bytes(mpeg3_fs_t *fs) | |||
36 | { | 36 | { |
37 | /* | 37 | |
38 | * struct stat st; | 38 | struct stat st; |
39 | * if(stat(fs->path, &st) < 0) return 0; | 39 | if(stat(fs->path, &st) < 0) return 0; |
40 | * return (long)st.st_size; | 40 | return (long)st.st_size; |
41 | */ | 41 | |
42 | 42 | ||
43 | fseek(fs->fd, 0, SEEK_END); | 43 | /* fseek(fs->fd, 0, SEEK_END); */ |
44 | fs->total_bytes = ftell(fs->fd); | 44 | /* fs->total_bytes = ftell(fs->fd); */ |
45 | fseek(fs->fd, 0, SEEK_SET); | 45 | /* fseek(fs->fd, 0, SEEK_SET); */ |
46 | return fs->total_bytes; | 46 | /* return fs->total_bytes; */ |
47 | } | 47 | } |
diff --git a/core/multimedia/opieplayer/playlistselection.cpp b/core/multimedia/opieplayer/playlistselection.cpp index 6259b3f..8f3711a 100644 --- a/core/multimedia/opieplayer/playlistselection.cpp +++ b/core/multimedia/opieplayer/playlistselection.cpp | |||
@@ -21,2 +21,4 @@ | |||
21 | #include <qpe/resource.h> | 21 | #include <qpe/resource.h> |
22 | #include <qpe/config.h> | ||
23 | |||
22 | #include <qpainter.h> | 24 | #include <qpainter.h> |
@@ -52,3 +54,3 @@ PlayListSelection::PlayListSelection( QWidget *parent, const char *name ) | |||
52 | { | 54 | { |
53 | qDebug("starting playlistselector"); | 55 | // qDebug("starting playlistselector"); |
54 | // #ifdef USE_PLAYLIST_BACKGROUND | 56 | // #ifdef USE_PLAYLIST_BACKGROUND |
@@ -187 +189,15 @@ void PlayListSelection::unSelect() | |||
187 | } \ No newline at end of file | 189 | } \ No newline at end of file |
190 | |||
191 | void PlayListSelection::writeCurrent( Config& cfg ) { | ||
192 | cfg.setGroup("PlayList"); | ||
193 | QListViewItem *item = selectedItem(); | ||
194 | if ( item ) | ||
195 | cfg.writeEntry("current", item->text(0) ); | ||
196 | qDebug(item->text(0)); | ||
197 | |||
198 | } | ||
199 | |||
200 | void PlayListSelection::setSelectedItem(const QString &strk ) { | ||
201 | // setSelected( item, TRUE ); | ||
202 | // ensureItemVisible( selectedItem() ); | ||
203 | } | ||
diff --git a/core/multimedia/opieplayer/playlistselection.h b/core/multimedia/opieplayer/playlistselection.h index ba37271..d10bc82 100644 --- a/core/multimedia/opieplayer/playlistselection.h +++ b/core/multimedia/opieplayer/playlistselection.h | |||
@@ -25,3 +25,3 @@ | |||
25 | #include <qpe/applnk.h> | 25 | #include <qpe/applnk.h> |
26 | 26 | #include <qpe/config.h> | |
27 | 27 | ||
@@ -40,2 +40,4 @@ public slots: | |||
40 | void unSelect(); | 40 | void unSelect(); |
41 | void writeCurrent( Config &); | ||
42 | void setSelectedItem( const QString & ); | ||
41 | bool prev(); | 43 | bool prev(); |
diff --git a/core/multimedia/opieplayer/playlistwidget.cpp b/core/multimedia/opieplayer/playlistwidget.cpp index 3b8f6d7..63df715 100644 --- a/core/multimedia/opieplayer/playlistwidget.cpp +++ b/core/multimedia/opieplayer/playlistwidget.cpp | |||
@@ -27,2 +27,3 @@ | |||
27 | #include <qpe/lnkproperties.h> | 27 | #include <qpe/lnkproperties.h> |
28 | #include <qpe/storage.h> | ||
28 | 29 | ||
@@ -218,2 +219,5 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl ) | |||
218 | audioView->setAllColumnsShowFocus(TRUE); | 219 | audioView->setAllColumnsShowFocus(TRUE); |
220 | // audioView->setMultiSelection( TRUE ); | ||
221 | // audioView->setSelectionMode( QListView::Extended); | ||
222 | |||
219 | tabWidget->insertTab(aTab,tr("Audio")); | 223 | tabWidget->insertTab(aTab,tr("Audio")); |
@@ -240,2 +244,5 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl ) | |||
240 | videoView->setAllColumnsShowFocus(TRUE); | 244 | videoView->setAllColumnsShowFocus(TRUE); |
245 | // videoView->setMultiSelection( TRUE ); | ||
246 | // videoView->setSelectionMode( QListView::Extended); | ||
247 | |||
241 | QPEApplication::setStylusOperation( videoView->viewport(),QPEApplication::RightOnHold); | 248 | QPEApplication::setStylusOperation( videoView->viewport(),QPEApplication::RightOnHold); |
@@ -320,5 +327,4 @@ void PlayListWidget::readConfig( Config& cfg ) { | |||
320 | cfg.setGroup("PlayList"); | 327 | cfg.setGroup("PlayList"); |
321 | 328 | QString currentString = cfg.readEntry("current", "" ); | |
322 | int noOfFiles = cfg.readNumEntry("NumberOfFiles", 0 ); | 329 | int noOfFiles = cfg.readNumEntry("NumberOfFiles", 0 ); |
323 | |||
324 | for ( int i = 0; i < noOfFiles; i++ ) { | 330 | for ( int i = 0; i < noOfFiles; i++ ) { |
@@ -328,3 +334,3 @@ void PlayListWidget::readConfig( Config& cfg ) { | |||
328 | DocLnk lnk( linkFile ); | 334 | DocLnk lnk( linkFile ); |
329 | if ( lnk.isValid() ) | 335 | if ( lnk.isValid() ) { |
330 | d->selectedFiles->addToSelection( lnk ); | 336 | d->selectedFiles->addToSelection( lnk ); |
@@ -332,2 +338,4 @@ void PlayListWidget::readConfig( Config& cfg ) { | |||
332 | } | 338 | } |
339 | // d->selectedFiles->setSelectedItem( (const QString &)currentString); | ||
340 | } | ||
333 | 341 | ||
@@ -335,6 +343,6 @@ void PlayListWidget::readConfig( Config& cfg ) { | |||
335 | void PlayListWidget::writeConfig( Config& cfg ) const { | 343 | void PlayListWidget::writeConfig( Config& cfg ) const { |
336 | cfg.setGroup("PlayList"); | ||
337 | 344 | ||
345 | d->selectedFiles->writeCurrent( cfg); | ||
346 | cfg.setGroup("PlayList"); | ||
338 | int noOfFiles = 0; | 347 | int noOfFiles = 0; |
339 | |||
340 | d->selectedFiles->first(); | 348 | d->selectedFiles->first(); |
@@ -345,2 +353,3 @@ void PlayListWidget::writeConfig( Config& cfg ) const { | |||
345 | entryName.sprintf( "File%i", noOfFiles + 1 ); | 353 | entryName.sprintf( "File%i", noOfFiles + 1 ); |
354 | qDebug(entryName); | ||
346 | cfg.writeEntry( entryName, lnk->linkFile() ); | 355 | cfg.writeEntry( entryName, lnk->linkFile() ); |
@@ -363,7 +372,5 @@ void PlayListWidget::writeConfig( Config& cfg ) const { | |||
363 | } | 372 | } |
364 | } while ( d->selectedFiles->next() ); | 373 | } |
365 | 374 | while ( d->selectedFiles->next() ); | |
366 | cfg.writeEntry("NumberOfFiles", noOfFiles ); | 375 | cfg.writeEntry("NumberOfFiles", noOfFiles ); |
367 | |||
368 | |||
369 | } | 376 | } |
@@ -388,7 +395,7 @@ void PlayListWidget::clearList() { | |||
388 | void PlayListWidget::addAllToList() { | 395 | void PlayListWidget::addAllToList() { |
389 | DocLnkSet files; | 396 | DocLnkSet filesAll; |
390 | Global::findDocuments(&files, "video/*;audio/*"); | 397 | Global::findDocuments(&filesAll, "video/*;audio/*"); |
391 | QListIterator<DocLnk> dit( files.children() ); | 398 | QListIterator<DocLnk> Adit( filesAll.children() ); |
392 | for ( ; dit.current(); ++dit ) | 399 | for ( ; Adit.current(); ++Adit ) |
393 | d->selectedFiles->addToSelection( **dit ); | 400 | d->selectedFiles->addToSelection( **Adit ); |
394 | } | 401 | } |
@@ -397,4 +404,4 @@ void PlayListWidget::addAllToList() { | |||
397 | void PlayListWidget::addAllMusicToList() { | 404 | void PlayListWidget::addAllMusicToList() { |
398 | DocLnkSet files; | 405 | // DocLnkSet files; |
399 | Global::findDocuments(&files, "audio/*"); | 406 | // Global::findDocuments(&files, "audio/*"); |
400 | QListIterator<DocLnk> dit( files.children() ); | 407 | QListIterator<DocLnk> dit( files.children() ); |
@@ -406,5 +413,3 @@ void PlayListWidget::addAllMusicToList() { | |||
406 | void PlayListWidget::addAllVideoToList() { | 413 | void PlayListWidget::addAllVideoToList() { |
407 | DocLnkSet files; | 414 | QListIterator<DocLnk> dit( vFiles.children() ); |
408 | Global::findDocuments(&files, "video/*"); | ||
409 | QListIterator<DocLnk> dit( files.children() ); | ||
410 | for ( ; dit.current(); ++dit ) | 415 | for ( ; dit.current(); ++dit ) |
@@ -590,9 +595,12 @@ void PlayListWidget::saveList() { | |||
590 | writeConfig( cfg ); | 595 | writeConfig( cfg ); |
591 | if( playLists->selected()->name() == filename) { | ||
592 | // qDebug("same name so delete lnk"); | ||
593 | QFile().remove(playLists->selected()->file()); | ||
594 | QFile().remove(playLists->selected()->linkFile()); | ||
595 | playLists->reread(); | ||
596 | } | ||
597 | 596 | ||
597 | // qDebug("same name so delete lnk??"); | ||
598 | // if( playLists->selected()->name() == filename) { | ||
599 | |||
600 | // qDebug("same name so delete lnk"); | ||
601 | // QFile().remove(playLists->selected()->file()); | ||
602 | // QFile().remove(playLists->selected()->linkFile()); | ||
603 | // playLists->reread(); | ||
604 | // } | ||
605 | // qDebug("new doclnk"); | ||
598 | DocLnk lnk; | 606 | DocLnk lnk; |
@@ -603,2 +611,3 @@ void PlayListWidget::saveList() { | |||
603 | lnk.setName( filename); //sets file name | 611 | lnk.setName( filename); //sets file name |
612 | qDebug(filename); | ||
604 | if(!lnk.writeLink()) | 613 | if(!lnk.writeLink()) |
@@ -623,7 +632,10 @@ void PlayListWidget::loadList( const DocLnk & lnk) { | |||
623 | readConfig(cfg); | 632 | readConfig(cfg); |
633 | |||
624 | tabWidget->setCurrentPage(0); | 634 | tabWidget->setCurrentPage(0); |
635 | |||
625 | Config config( "MediaPlayer" ); | 636 | Config config( "MediaPlayer" ); |
626 | config.writeEntry("CurrentPlaylist", name); | 637 | config.writeEntry("CurrentPlaylist", name); |
627 | d->selectedFiles->first(); | 638 | // d->selectedFiles->first(); |
628 | } | 639 | } |
640 | |||
629 | } | 641 | } |
@@ -785,3 +797,4 @@ void PlayListWidget::btnPlay(bool b) { | |||
785 | tabWidget->setCurrentPage(1); | 797 | tabWidget->setCurrentPage(1); |
786 | d->selectedFiles->unSelect(); | 798 | audioView->clearSelection(); |
799 | // d->selectedFiles->unSelect(); | ||
787 | // mediaPlayerState->setPlaying(FALSE); | 800 | // mediaPlayerState->setPlaying(FALSE); |
@@ -796,3 +809,4 @@ void PlayListWidget::btnPlay(bool b) { | |||
796 | tabWidget->setCurrentPage(2); | 809 | tabWidget->setCurrentPage(2); |
797 | d->selectedFiles->unSelect(); | 810 | videoView->clearSelection(); |
811 | // d->selectedFiles->unSelect(); | ||
798 | // mediaPlayerState->setPlaying(FALSE); | 812 | // mediaPlayerState->setPlaying(FALSE); |
@@ -907,4 +921,8 @@ void PlayListWidget::populateAudioView() { | |||
907 | // files.~DocLnkSet(); | 921 | // files.~DocLnkSet(); |
922 | StorageInfo storageInfo; | ||
923 | const QList<FileSystem> &fs = storageInfo.fileSystems(); | ||
924 | |||
908 | Global::findDocuments(&files, "audio/*"); | 925 | Global::findDocuments(&files, "audio/*"); |
909 | QListIterator<DocLnk> dit( files.children() ); | 926 | QListIterator<DocLnk> dit( files.children() ); |
927 | QListIterator<FileSystem> it ( fs ); | ||
910 | audioView->clear(); | 928 | audioView->clear(); |
@@ -912,7 +930,9 @@ void PlayListWidget::populateAudioView() { | |||
912 | for ( ; dit.current(); ++dit ) { | 930 | for ( ; dit.current(); ++dit ) { |
931 | for( ; it.current(); ++it ){ | ||
932 | const QString name = (*it)->name(); | ||
933 | const QString path = (*it)->path(); | ||
934 | if(dit.current()->file().find(path) != -1 ) storage=name; | ||
935 | } | ||
936 | |||
913 | QListViewItem * newItem; | 937 | QListViewItem * newItem; |
914 | if(dit.current()->file().find("/mnt/cf") != -1 ) storage=tr("CF"); | ||
915 | else if(dit.current()->file().find("/mnt/hda") != -1 ) storage=tr("CF"); | ||
916 | else if(dit.current()->file().find("/mnt/card") != -1 ) storage=tr("SD"); | ||
917 | else storage=tr("RAM"); | ||
918 | if ( QFile( dit.current()->file()).exists() ) { | 938 | if ( QFile( dit.current()->file()).exists() ) { |
@@ -925,4 +945,8 @@ void PlayListWidget::populateAudioView() { | |||
925 | void PlayListWidget::populateVideoView() { | 945 | void PlayListWidget::populateVideoView() { |
946 | StorageInfo storageInfo; | ||
947 | const QList<FileSystem> &fs = storageInfo.fileSystems(); | ||
948 | |||
926 | Global::findDocuments(&vFiles, "video/*"); | 949 | Global::findDocuments(&vFiles, "video/*"); |
927 | QListIterator<DocLnk> Vdit( vFiles.children() ); | 950 | QListIterator<DocLnk> Vdit( vFiles.children() ); |
951 | QListIterator<FileSystem> it ( fs ); | ||
928 | videoView->clear(); | 952 | videoView->clear(); |
@@ -930,6 +954,8 @@ void PlayListWidget::populateVideoView() { | |||
930 | for ( ; Vdit.current(); ++Vdit ) { | 954 | for ( ; Vdit.current(); ++Vdit ) { |
931 | if( Vdit.current()->file().find("/mnt/cf") != -1 ) storage=tr("CF"); | 955 | for( ; it.current(); ++it ){ |
932 | else if( Vdit.current()->file().find("/mnt/hda") != -1 ) storage=tr("CF"); | 956 | const QString name = (*it)->name(); |
933 | else if( Vdit.current()->file().find("/mnt/card") != -1 ) storage=tr("SD"); | 957 | const QString path = (*it)->path(); |
934 | else storage=tr("RAM"); | 958 | if( Vdit.current()->file().find(path) != -1 ) storage=name; |
959 | } | ||
960 | |||
935 | QListViewItem * newItem; | 961 | QListViewItem * newItem; |