From 793cf2dff35dffe3ec4c7b24252947dde758a1b2 Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Sun, 27 Jan 2013 01:04:32 -0600 Subject: Rename a number of libraries and executables to avoid conflicts with KDE4 --- Makefile.am.in | 2 +- README | 2 +- arts/builder/execdlg.cpp | 2 +- arts/builder/main.cpp | 2 +- arts/builder/main.h | 2 +- arts/tools/artscontrolapplet.cpp | 2 +- arts/tools/artscontrolapplet.h | 2 +- configure.in.in | 14 +- doc/kioslave/Makefile.am | 4 - doc/kioslave/audiocd.docbook | 208 ---- doc/krec/index.docbook | 2 +- doc/tdeioslave/Makefile.am | 4 + doc/tdeioslave/audiocd.docbook | 208 ++++ juk/artsplayer.cpp | 2 +- juk/cache.cpp | 2 +- juk/collectionlist.cpp | 2 +- juk/collectionlist.h | 2 +- juk/deletedialog.cpp | 2 +- juk/directorylist.cpp | 2 +- juk/filerenamer.cpp | 6 +- juk/gstreamerplayer.cpp | 2 +- juk/keydialog.cpp | 2 +- juk/main.cpp | 4 +- juk/mediafiles.cpp | 4 +- juk/nowplaying.cpp | 2 +- juk/playlist.cpp | 8 +- juk/playlistcollection.cpp | 2 +- juk/playlistsplitter.h | 2 +- juk/tageditor.cpp | 2 +- juk/tagguesser.cpp | 2 +- juk/tagrenameroptions.cpp | 4 +- juk/tracksequencemanager.cpp | 2 +- juk/webimagefetcherdialog.cpp | 2 +- juk/webimagefetcherdialog.h | 2 +- kaboodle/Makefile.am | 2 +- kaboodle/conf.cpp | 2 +- kaboodle/engine.cpp | 2 +- kaboodle/kaboodleapp.cpp | 2 +- kaboodle/userinterface.cpp | 4 +- kaboodle/view.cpp | 2 +- kaudiocreator/Makefile.am | 2 +- kaudiocreator/encoder_prefs.kcfgc | 2 +- kaudiocreator/encoderconfigimp.cpp | 4 +- kaudiocreator/jobqueimp.cpp | 2 +- kaudiocreator/kaudiocreator.h | 2 +- kaudiocreator/prefs.kcfgc | 2 +- kaudiocreator/ripper.cpp | 2 +- kaudiocreator/ripper.h | 2 +- kaudiocreator/tracksimp.cpp | 2 +- kfile-plugins/Makefile.am | 22 - kfile-plugins/RETURNED_ITEMS | 86 -- kfile-plugins/au/Makefile.am | 22 - kfile-plugins/au/kfile_au.cpp | 172 --- kfile-plugins/au/kfile_au.desktop | 67 -- kfile-plugins/au/kfile_au.h | 38 - kfile-plugins/avi/Makefile.am | 22 - kfile-plugins/avi/kfile_avi.cpp | 540 --------- kfile-plugins/avi/kfile_avi.desktop | 68 -- kfile-plugins/avi/kfile_avi.h | 91 -- kfile-plugins/flac/Makefile.am | 22 - kfile-plugins/flac/configure.in.in | 1 - kfile-plugins/flac/kfile_flac.cpp | 282 ----- kfile-plugins/flac/kfile_flac.desktop | 62 -- kfile-plugins/flac/kfile_flac.h | 51 - kfile-plugins/m3u/Makefile.am | 22 - kfile-plugins/m3u/kfile_m3u.cpp | 87 -- kfile-plugins/m3u/kfile_m3u.desktop | 71 -- kfile-plugins/m3u/kfile_m3u.h | 40 - kfile-plugins/mp3/Makefile.am | 22 - kfile-plugins/mp3/configure.in.in | 1 - kfile-plugins/mp3/kfile_mp3.cpp | 307 ------ kfile-plugins/mp3/kfile_mp3.desktop | 70 -- kfile-plugins/mp3/kfile_mp3.h | 42 - kfile-plugins/mpc/Makefile.am | 22 - kfile-plugins/mpc/configure.in.in | 1 - kfile-plugins/mpc/kfile_mpc.cpp | 253 ----- kfile-plugins/mpc/kfile_mpc.desktop | 56 - kfile-plugins/mpc/kfile_mpc.h | 49 - kfile-plugins/mpeg/Makefile.am | 22 - kfile-plugins/mpeg/kfile_mpeg.cpp | 582 ---------- kfile-plugins/mpeg/kfile_mpeg.desktop | 55 - kfile-plugins/mpeg/kfile_mpeg.h | 71 -- kfile-plugins/ogg/Makefile.am | 22 - kfile-plugins/ogg/configure.in.in | 1 - kfile-plugins/ogg/kfile_ogg.cpp | 357 ------ kfile-plugins/ogg/kfile_ogg.desktop | 68 -- kfile-plugins/ogg/kfile_ogg.h | 46 - kfile-plugins/ogg/vcedit.c | 331 ------ kfile-plugins/ogg/vcedit.h | 56 - kfile-plugins/sid/Makefile.am | 22 - kfile-plugins/sid/kfile_sid.cpp | 227 ---- kfile-plugins/sid/kfile_sid.desktop | 60 - kfile-plugins/sid/kfile_sid.h | 43 - kfile-plugins/theora/Makefile.am | 22 - kfile-plugins/theora/configure.in.bot | 7 - kfile-plugins/theora/configure.in.in | 26 - kfile-plugins/theora/kfile_theora.cpp | 322 ------ kfile-plugins/theora/kfile_theora.desktop | 60 - kfile-plugins/theora/kfile_theora.h | 43 - kfile-plugins/wav/Makefile.am | 22 - kfile-plugins/wav/kfile_wav.cpp | 173 --- kfile-plugins/wav/kfile_wav.desktop | 67 -- kfile-plugins/wav/kfile_wav.h | 38 - kioslave/Makefile.am | 5 - kioslave/audiocd/HACKING | 25 - kioslave/audiocd/Makefile.am | 33 - kioslave/audiocd/audiocd.cpp | 1159 -------------------- kioslave/audiocd/audiocd.h | 126 --- kioslave/audiocd/audiocd.protocol | 16 - kioslave/audiocd/audiocd.upd | 4 - kioslave/audiocd/configure.in.bot | 0 kioslave/audiocd/configure.in.in | 46 - kioslave/audiocd/kcmaudiocd/Makefile.am | 17 - kioslave/audiocd/kcmaudiocd/audiocd.desktop | 182 --- kioslave/audiocd/kcmaudiocd/audiocdconfig.ui | 628 ----------- kioslave/audiocd/kcmaudiocd/kcmaudiocd.cpp | 267 ----- kioslave/audiocd/kcmaudiocd/kcmaudiocd.h | 66 -- kioslave/audiocd/plugins/Makefile.am | 21 - kioslave/audiocd/plugins/audiocdencoder.cpp | 95 -- kioslave/audiocd/plugins/audiocdencoder.h | 145 --- kioslave/audiocd/plugins/flac/Makefile.am | 13 - kioslave/audiocd/plugins/flac/encoderflac.cpp | 214 ---- kioslave/audiocd/plugins/flac/encoderflac.h | 61 -- kioslave/audiocd/plugins/lame/Makefile.am | 18 - .../audiocd/plugins/lame/audiocd_lame_encoder.kcfg | 138 --- .../plugins/lame/audiocd_lame_encoder.kcfgc | 4 - .../audiocd/plugins/lame/collectingprocess.cpp | 134 --- kioslave/audiocd/plugins/lame/collectingprocess.h | 73 -- kioslave/audiocd/plugins/lame/encoderlame.cpp | 366 ------- kioslave/audiocd/plugins/lame/encoderlame.h | 68 -- kioslave/audiocd/plugins/lame/encoderlameconfig.ui | 930 ---------------- kioslave/audiocd/plugins/vorbis/Makefile.am | 18 - .../plugins/vorbis/audiocd_vorbis_encoder.kcfg | 84 -- .../plugins/vorbis/audiocd_vorbis_encoder.kcfgc | 4 - kioslave/audiocd/plugins/vorbis/encodervorbis.cpp | 336 ------ kioslave/audiocd/plugins/vorbis/encodervorbis.h | 68 -- .../audiocd/plugins/vorbis/encodervorbisconfig.ui | 425 ------- kioslave/audiocd/plugins/wav/Makefile.am | 15 - kioslave/audiocd/plugins/wav/encodercda.cpp | 67 -- kioslave/audiocd/plugins/wav/encodercda.h | 61 -- kioslave/audiocd/plugins/wav/encoderwav.cpp | 85 -- kioslave/audiocd/plugins/wav/encoderwav.h | 56 - kioslave/audiocd/upgrade-metadata.sh | 28 - kmix/kmix.cpp | 2 +- kmix/kmixapplet.cpp | 2 +- kmix/kmixctrl.cpp | 2 +- kmix/kmixerwidget.cpp | 2 +- kmix/mdwenum.cpp | 2 +- kmix/mdwslider.cpp | 2 +- kmix/mdwswitch.cpp | 2 +- kmix/mixdevice.h | 2 +- kmix/mixdevicewidget.cpp | 2 +- kmix/mixer.cpp | 2 +- kmix/mixset.cpp | 2 +- krec/krecconfig_files.cpp | 2 +- krec/krecconfig_fileswidget.cpp | 2 +- krec/krecconfigure.cpp | 2 +- krec/krecfile.cpp | 2 +- krec/krecglobal.cpp | 4 +- krec/krecglobal.h | 2 +- krec/krecnewproperties.cpp | 8 +- krec/krecord.cpp | 6 +- krec/mp3_export/krecexport_mp3.cpp | 4 +- krec/ogg_export/krecexport_ogg.cpp | 4 +- kscd/kscd.cpp | 4 +- kscd/kscd.h | 2 +- kscd/prefs.kcfgc | 2 +- libkcddb/asynchttplookup.cpp | 2 +- libkcddb/asynchttpsubmit.cpp | 2 +- libkcddb/asyncsmtpsubmit.h | 2 +- libkcddb/httplookup.cpp | 2 +- libkcddb/httpsubmit.cpp | 2 +- libkcddb/kcmcddb/Makefile.am | 2 +- libkcddb/kcmcddb/cddbconfigwidget.cpp | 2 +- libkcddb/kcmcddb/kcmcddb.cpp | 4 +- libkcddb/kcmcddb/libkcddb.desktop | 2 +- libkcddb/sites.cpp | 2 +- libkcddb/smtpsubmit.cpp | 2 +- libkcddb/synchttplookup.cpp | 4 +- libkcddb/synchttpsubmit.cpp | 4 +- libkcddb/syncsmtpsubmit.cpp | 4 +- noatun/Makefile.am | 8 +- noatun/library/app.cpp | 4 +- noatun/library/cmodule.cpp | 2 +- noatun/library/downloader.cpp | 2 +- noatun/library/engine.cpp | 2 +- noatun/library/equalizer.cpp | 4 +- noatun/library/ksaver.cpp | 2 +- noatun/library/noatuntags/tags.cpp | 2 +- noatun/library/playlist.cpp | 2 +- noatun/library/playlistsaver.cpp | 2 +- noatun/library/vequalizer.cpp | 4 +- noatun/modules/excellent/userinterface.cpp | 4 +- noatun/modules/htmlexport/htmlexport.h | 6 +- noatun/modules/infrared/irprefs.cpp | 2 +- noatun/modules/kaiman/pref.cpp | 2 +- noatun/modules/kaiman/userinterface.cpp | 6 +- noatun/modules/kjofol-skin/Makefile.am | 2 +- noatun/modules/kjofol-skin/kjbutton.cpp | 2 +- noatun/modules/kjofol-skin/kjloader.cpp | 2 +- noatun/modules/kjofol-skin/kjprefs.cpp | 4 +- noatun/modules/kjofol-skin/kjprefs.h | 2 +- noatun/modules/kjofol-skin/kjvis.cpp | 2 +- noatun/modules/marquis/marquis.cpp | 2 +- noatun/modules/metatag/edit.cpp | 2 +- noatun/modules/metatag/metatag.cpp | 4 +- noatun/modules/noatunui/userinterface.cpp | 4 +- noatun/modules/simple/userinterface.cpp | 2 +- noatun/modules/splitplaylist/view.cpp | 8 +- noatun/modules/splitplaylist/view.h | 2 +- noatun/modules/systray/systray.cpp | 4 +- noatun/modules/systray/yhconfig.kcfgc | 2 +- noatun/modules/voiceprint/prefs.cpp | 2 +- noatun/modules/winskin/fileInfo.cpp | 2 +- noatun/modules/winskin/guiSpectrumAnalyser.cpp | 2 +- noatun/modules/winskin/waDigit.cpp | 2 +- noatun/modules/winskin/waInfo.cpp | 2 +- noatun/modules/winskin/waSkin.cpp | 2 +- noatun/modules/winskin/waSkinManager.cpp | 4 +- noatun/modules/winskin/winSkinConfig.cpp | 6 +- tdefile-plugins/Makefile.am | 22 + tdefile-plugins/RETURNED_ITEMS | 86 ++ tdefile-plugins/au/Makefile.am | 22 + tdefile-plugins/au/tdefile_au.cpp | 172 +++ tdefile-plugins/au/tdefile_au.desktop | 67 ++ tdefile-plugins/au/tdefile_au.h | 38 + tdefile-plugins/avi/Makefile.am | 22 + tdefile-plugins/avi/tdefile_avi.cpp | 540 +++++++++ tdefile-plugins/avi/tdefile_avi.desktop | 68 ++ tdefile-plugins/avi/tdefile_avi.h | 91 ++ tdefile-plugins/flac/Makefile.am | 22 + tdefile-plugins/flac/configure.in.in | 1 + tdefile-plugins/flac/tdefile_flac.cpp | 282 +++++ tdefile-plugins/flac/tdefile_flac.desktop | 62 ++ tdefile-plugins/flac/tdefile_flac.h | 51 + tdefile-plugins/m3u/Makefile.am | 22 + tdefile-plugins/m3u/tdefile_m3u.cpp | 87 ++ tdefile-plugins/m3u/tdefile_m3u.desktop | 71 ++ tdefile-plugins/m3u/tdefile_m3u.h | 40 + tdefile-plugins/mp3/Makefile.am | 22 + tdefile-plugins/mp3/configure.in.in | 1 + tdefile-plugins/mp3/tdefile_mp3.cpp | 307 ++++++ tdefile-plugins/mp3/tdefile_mp3.desktop | 70 ++ tdefile-plugins/mp3/tdefile_mp3.h | 42 + tdefile-plugins/mpc/Makefile.am | 22 + tdefile-plugins/mpc/configure.in.in | 1 + tdefile-plugins/mpc/tdefile_mpc.cpp | 253 +++++ tdefile-plugins/mpc/tdefile_mpc.desktop | 56 + tdefile-plugins/mpc/tdefile_mpc.h | 49 + tdefile-plugins/mpeg/Makefile.am | 22 + tdefile-plugins/mpeg/tdefile_mpeg.cpp | 582 ++++++++++ tdefile-plugins/mpeg/tdefile_mpeg.desktop | 55 + tdefile-plugins/mpeg/tdefile_mpeg.h | 71 ++ tdefile-plugins/ogg/Makefile.am | 22 + tdefile-plugins/ogg/configure.in.in | 1 + tdefile-plugins/ogg/tdefile_ogg.cpp | 357 ++++++ tdefile-plugins/ogg/tdefile_ogg.desktop | 68 ++ tdefile-plugins/ogg/tdefile_ogg.h | 46 + tdefile-plugins/ogg/vcedit.c | 331 ++++++ tdefile-plugins/ogg/vcedit.h | 56 + tdefile-plugins/sid/Makefile.am | 22 + tdefile-plugins/sid/tdefile_sid.cpp | 227 ++++ tdefile-plugins/sid/tdefile_sid.desktop | 60 + tdefile-plugins/sid/tdefile_sid.h | 43 + tdefile-plugins/theora/Makefile.am | 22 + tdefile-plugins/theora/configure.in.bot | 7 + tdefile-plugins/theora/configure.in.in | 26 + tdefile-plugins/theora/tdefile_theora.cpp | 322 ++++++ tdefile-plugins/theora/tdefile_theora.desktop | 60 + tdefile-plugins/theora/tdefile_theora.h | 43 + tdefile-plugins/wav/Makefile.am | 22 + tdefile-plugins/wav/tdefile_wav.cpp | 173 +++ tdefile-plugins/wav/tdefile_wav.desktop | 67 ++ tdefile-plugins/wav/tdefile_wav.h | 38 + tdeioslave/Makefile.am | 5 + tdeioslave/audiocd/HACKING | 25 + tdeioslave/audiocd/Makefile.am | 33 + tdeioslave/audiocd/audiocd.cpp | 1159 ++++++++++++++++++++ tdeioslave/audiocd/audiocd.h | 126 +++ tdeioslave/audiocd/audiocd.protocol | 16 + tdeioslave/audiocd/audiocd.upd | 4 + tdeioslave/audiocd/configure.in.bot | 0 tdeioslave/audiocd/configure.in.in | 46 + tdeioslave/audiocd/kcmaudiocd/Makefile.am | 17 + tdeioslave/audiocd/kcmaudiocd/audiocd.desktop | 182 +++ tdeioslave/audiocd/kcmaudiocd/audiocdconfig.ui | 628 +++++++++++ tdeioslave/audiocd/kcmaudiocd/kcmaudiocd.cpp | 267 +++++ tdeioslave/audiocd/kcmaudiocd/kcmaudiocd.h | 66 ++ tdeioslave/audiocd/plugins/Makefile.am | 21 + tdeioslave/audiocd/plugins/audiocdencoder.cpp | 95 ++ tdeioslave/audiocd/plugins/audiocdencoder.h | 145 +++ tdeioslave/audiocd/plugins/flac/Makefile.am | 13 + tdeioslave/audiocd/plugins/flac/encoderflac.cpp | 214 ++++ tdeioslave/audiocd/plugins/flac/encoderflac.h | 61 ++ tdeioslave/audiocd/plugins/lame/Makefile.am | 18 + .../audiocd/plugins/lame/audiocd_lame_encoder.kcfg | 138 +++ .../plugins/lame/audiocd_lame_encoder.kcfgc | 4 + .../audiocd/plugins/lame/collectingprocess.cpp | 134 +++ .../audiocd/plugins/lame/collectingprocess.h | 73 ++ tdeioslave/audiocd/plugins/lame/encoderlame.cpp | 366 +++++++ tdeioslave/audiocd/plugins/lame/encoderlame.h | 68 ++ .../audiocd/plugins/lame/encoderlameconfig.ui | 930 ++++++++++++++++ tdeioslave/audiocd/plugins/vorbis/Makefile.am | 18 + .../plugins/vorbis/audiocd_vorbis_encoder.kcfg | 84 ++ .../plugins/vorbis/audiocd_vorbis_encoder.kcfgc | 4 + .../audiocd/plugins/vorbis/encodervorbis.cpp | 336 ++++++ tdeioslave/audiocd/plugins/vorbis/encodervorbis.h | 68 ++ .../audiocd/plugins/vorbis/encodervorbisconfig.ui | 425 +++++++ tdeioslave/audiocd/plugins/wav/Makefile.am | 15 + tdeioslave/audiocd/plugins/wav/encodercda.cpp | 67 ++ tdeioslave/audiocd/plugins/wav/encodercda.h | 61 ++ tdeioslave/audiocd/plugins/wav/encoderwav.cpp | 85 ++ tdeioslave/audiocd/plugins/wav/encoderwav.h | 56 + tdeioslave/audiocd/upgrade-metadata.sh | 28 + tdemid/channel.cpp | 2 +- tdemid/channelview.cpp | 2 +- tdemid/collectdlg.cpp | 2 +- tdemid/kdisptext.cpp | 2 +- tdemid/main.cpp | 2 +- tdemid/midicfgdlg.cpp | 2 +- tdemid/tdemidclient.cpp | 26 +- tdemid/tdemidclient.h | 2 +- tdemid/tdemidframe.cpp | 4 +- xine_artsplugin/tools/thumbnail/videocreator.h | 2 +- 324 files changed, 11840 insertions(+), 11840 deletions(-) delete mode 100644 doc/kioslave/Makefile.am delete mode 100644 doc/kioslave/audiocd.docbook create mode 100644 doc/tdeioslave/Makefile.am create mode 100644 doc/tdeioslave/audiocd.docbook delete mode 100644 kfile-plugins/Makefile.am delete mode 100644 kfile-plugins/RETURNED_ITEMS delete mode 100644 kfile-plugins/au/Makefile.am delete mode 100644 kfile-plugins/au/kfile_au.cpp delete mode 100644 kfile-plugins/au/kfile_au.desktop delete mode 100644 kfile-plugins/au/kfile_au.h delete mode 100644 kfile-plugins/avi/Makefile.am delete mode 100644 kfile-plugins/avi/kfile_avi.cpp delete mode 100644 kfile-plugins/avi/kfile_avi.desktop delete mode 100644 kfile-plugins/avi/kfile_avi.h delete mode 100644 kfile-plugins/flac/Makefile.am delete mode 100644 kfile-plugins/flac/configure.in.in delete mode 100644 kfile-plugins/flac/kfile_flac.cpp delete mode 100644 kfile-plugins/flac/kfile_flac.desktop delete mode 100644 kfile-plugins/flac/kfile_flac.h delete mode 100644 kfile-plugins/m3u/Makefile.am delete mode 100644 kfile-plugins/m3u/kfile_m3u.cpp delete mode 100644 kfile-plugins/m3u/kfile_m3u.desktop delete mode 100644 kfile-plugins/m3u/kfile_m3u.h delete mode 100644 kfile-plugins/mp3/Makefile.am delete mode 100644 kfile-plugins/mp3/configure.in.in delete mode 100644 kfile-plugins/mp3/kfile_mp3.cpp delete mode 100644 kfile-plugins/mp3/kfile_mp3.desktop delete mode 100644 kfile-plugins/mp3/kfile_mp3.h delete mode 100644 kfile-plugins/mpc/Makefile.am delete mode 100644 kfile-plugins/mpc/configure.in.in delete mode 100644 kfile-plugins/mpc/kfile_mpc.cpp delete mode 100644 kfile-plugins/mpc/kfile_mpc.desktop delete mode 100644 kfile-plugins/mpc/kfile_mpc.h delete mode 100644 kfile-plugins/mpeg/Makefile.am delete mode 100644 kfile-plugins/mpeg/kfile_mpeg.cpp delete mode 100644 kfile-plugins/mpeg/kfile_mpeg.desktop delete mode 100644 kfile-plugins/mpeg/kfile_mpeg.h delete mode 100644 kfile-plugins/ogg/Makefile.am delete mode 100644 kfile-plugins/ogg/configure.in.in delete mode 100644 kfile-plugins/ogg/kfile_ogg.cpp delete mode 100644 kfile-plugins/ogg/kfile_ogg.desktop delete mode 100644 kfile-plugins/ogg/kfile_ogg.h delete mode 100644 kfile-plugins/ogg/vcedit.c delete mode 100644 kfile-plugins/ogg/vcedit.h delete mode 100644 kfile-plugins/sid/Makefile.am delete mode 100644 kfile-plugins/sid/kfile_sid.cpp delete mode 100644 kfile-plugins/sid/kfile_sid.desktop delete mode 100644 kfile-plugins/sid/kfile_sid.h delete mode 100644 kfile-plugins/theora/Makefile.am delete mode 100644 kfile-plugins/theora/configure.in.bot delete mode 100644 kfile-plugins/theora/configure.in.in delete mode 100644 kfile-plugins/theora/kfile_theora.cpp delete mode 100644 kfile-plugins/theora/kfile_theora.desktop delete mode 100644 kfile-plugins/theora/kfile_theora.h delete mode 100644 kfile-plugins/wav/Makefile.am delete mode 100644 kfile-plugins/wav/kfile_wav.cpp delete mode 100644 kfile-plugins/wav/kfile_wav.desktop delete mode 100644 kfile-plugins/wav/kfile_wav.h delete mode 100644 kioslave/Makefile.am delete mode 100644 kioslave/audiocd/HACKING delete mode 100644 kioslave/audiocd/Makefile.am delete mode 100644 kioslave/audiocd/audiocd.cpp delete mode 100644 kioslave/audiocd/audiocd.h delete mode 100644 kioslave/audiocd/audiocd.protocol delete mode 100644 kioslave/audiocd/audiocd.upd delete mode 100644 kioslave/audiocd/configure.in.bot delete mode 100644 kioslave/audiocd/configure.in.in delete mode 100644 kioslave/audiocd/kcmaudiocd/Makefile.am delete mode 100644 kioslave/audiocd/kcmaudiocd/audiocd.desktop delete mode 100644 kioslave/audiocd/kcmaudiocd/audiocdconfig.ui delete mode 100644 kioslave/audiocd/kcmaudiocd/kcmaudiocd.cpp delete mode 100644 kioslave/audiocd/kcmaudiocd/kcmaudiocd.h delete mode 100644 kioslave/audiocd/plugins/Makefile.am delete mode 100644 kioslave/audiocd/plugins/audiocdencoder.cpp delete mode 100644 kioslave/audiocd/plugins/audiocdencoder.h delete mode 100644 kioslave/audiocd/plugins/flac/Makefile.am delete mode 100644 kioslave/audiocd/plugins/flac/encoderflac.cpp delete mode 100644 kioslave/audiocd/plugins/flac/encoderflac.h delete mode 100644 kioslave/audiocd/plugins/lame/Makefile.am delete mode 100644 kioslave/audiocd/plugins/lame/audiocd_lame_encoder.kcfg delete mode 100644 kioslave/audiocd/plugins/lame/audiocd_lame_encoder.kcfgc delete mode 100644 kioslave/audiocd/plugins/lame/collectingprocess.cpp delete mode 100644 kioslave/audiocd/plugins/lame/collectingprocess.h delete mode 100644 kioslave/audiocd/plugins/lame/encoderlame.cpp delete mode 100644 kioslave/audiocd/plugins/lame/encoderlame.h delete mode 100644 kioslave/audiocd/plugins/lame/encoderlameconfig.ui delete mode 100644 kioslave/audiocd/plugins/vorbis/Makefile.am delete mode 100644 kioslave/audiocd/plugins/vorbis/audiocd_vorbis_encoder.kcfg delete mode 100644 kioslave/audiocd/plugins/vorbis/audiocd_vorbis_encoder.kcfgc delete mode 100644 kioslave/audiocd/plugins/vorbis/encodervorbis.cpp delete mode 100644 kioslave/audiocd/plugins/vorbis/encodervorbis.h delete mode 100644 kioslave/audiocd/plugins/vorbis/encodervorbisconfig.ui delete mode 100644 kioslave/audiocd/plugins/wav/Makefile.am delete mode 100644 kioslave/audiocd/plugins/wav/encodercda.cpp delete mode 100644 kioslave/audiocd/plugins/wav/encodercda.h delete mode 100644 kioslave/audiocd/plugins/wav/encoderwav.cpp delete mode 100644 kioslave/audiocd/plugins/wav/encoderwav.h delete mode 100755 kioslave/audiocd/upgrade-metadata.sh create mode 100644 tdefile-plugins/Makefile.am create mode 100644 tdefile-plugins/RETURNED_ITEMS create mode 100644 tdefile-plugins/au/Makefile.am create mode 100644 tdefile-plugins/au/tdefile_au.cpp create mode 100644 tdefile-plugins/au/tdefile_au.desktop create mode 100644 tdefile-plugins/au/tdefile_au.h create mode 100644 tdefile-plugins/avi/Makefile.am create mode 100644 tdefile-plugins/avi/tdefile_avi.cpp create mode 100644 tdefile-plugins/avi/tdefile_avi.desktop create mode 100644 tdefile-plugins/avi/tdefile_avi.h create mode 100644 tdefile-plugins/flac/Makefile.am create mode 100644 tdefile-plugins/flac/configure.in.in create mode 100644 tdefile-plugins/flac/tdefile_flac.cpp create mode 100644 tdefile-plugins/flac/tdefile_flac.desktop create mode 100644 tdefile-plugins/flac/tdefile_flac.h create mode 100644 tdefile-plugins/m3u/Makefile.am create mode 100644 tdefile-plugins/m3u/tdefile_m3u.cpp create mode 100644 tdefile-plugins/m3u/tdefile_m3u.desktop create mode 100644 tdefile-plugins/m3u/tdefile_m3u.h create mode 100644 tdefile-plugins/mp3/Makefile.am create mode 100644 tdefile-plugins/mp3/configure.in.in create mode 100644 tdefile-plugins/mp3/tdefile_mp3.cpp create mode 100644 tdefile-plugins/mp3/tdefile_mp3.desktop create mode 100644 tdefile-plugins/mp3/tdefile_mp3.h create mode 100644 tdefile-plugins/mpc/Makefile.am create mode 100644 tdefile-plugins/mpc/configure.in.in create mode 100644 tdefile-plugins/mpc/tdefile_mpc.cpp create mode 100644 tdefile-plugins/mpc/tdefile_mpc.desktop create mode 100644 tdefile-plugins/mpc/tdefile_mpc.h create mode 100644 tdefile-plugins/mpeg/Makefile.am create mode 100644 tdefile-plugins/mpeg/tdefile_mpeg.cpp create mode 100644 tdefile-plugins/mpeg/tdefile_mpeg.desktop create mode 100644 tdefile-plugins/mpeg/tdefile_mpeg.h create mode 100644 tdefile-plugins/ogg/Makefile.am create mode 100644 tdefile-plugins/ogg/configure.in.in create mode 100644 tdefile-plugins/ogg/tdefile_ogg.cpp create mode 100644 tdefile-plugins/ogg/tdefile_ogg.desktop create mode 100644 tdefile-plugins/ogg/tdefile_ogg.h create mode 100644 tdefile-plugins/ogg/vcedit.c create mode 100644 tdefile-plugins/ogg/vcedit.h create mode 100644 tdefile-plugins/sid/Makefile.am create mode 100644 tdefile-plugins/sid/tdefile_sid.cpp create mode 100644 tdefile-plugins/sid/tdefile_sid.desktop create mode 100644 tdefile-plugins/sid/tdefile_sid.h create mode 100644 tdefile-plugins/theora/Makefile.am create mode 100644 tdefile-plugins/theora/configure.in.bot create mode 100644 tdefile-plugins/theora/configure.in.in create mode 100644 tdefile-plugins/theora/tdefile_theora.cpp create mode 100644 tdefile-plugins/theora/tdefile_theora.desktop create mode 100644 tdefile-plugins/theora/tdefile_theora.h create mode 100644 tdefile-plugins/wav/Makefile.am create mode 100644 tdefile-plugins/wav/tdefile_wav.cpp create mode 100644 tdefile-plugins/wav/tdefile_wav.desktop create mode 100644 tdefile-plugins/wav/tdefile_wav.h create mode 100644 tdeioslave/Makefile.am create mode 100644 tdeioslave/audiocd/HACKING create mode 100644 tdeioslave/audiocd/Makefile.am create mode 100644 tdeioslave/audiocd/audiocd.cpp create mode 100644 tdeioslave/audiocd/audiocd.h create mode 100644 tdeioslave/audiocd/audiocd.protocol create mode 100644 tdeioslave/audiocd/audiocd.upd create mode 100644 tdeioslave/audiocd/configure.in.bot create mode 100644 tdeioslave/audiocd/configure.in.in create mode 100644 tdeioslave/audiocd/kcmaudiocd/Makefile.am create mode 100644 tdeioslave/audiocd/kcmaudiocd/audiocd.desktop create mode 100644 tdeioslave/audiocd/kcmaudiocd/audiocdconfig.ui create mode 100644 tdeioslave/audiocd/kcmaudiocd/kcmaudiocd.cpp create mode 100644 tdeioslave/audiocd/kcmaudiocd/kcmaudiocd.h create mode 100644 tdeioslave/audiocd/plugins/Makefile.am create mode 100644 tdeioslave/audiocd/plugins/audiocdencoder.cpp create mode 100644 tdeioslave/audiocd/plugins/audiocdencoder.h create mode 100644 tdeioslave/audiocd/plugins/flac/Makefile.am create mode 100644 tdeioslave/audiocd/plugins/flac/encoderflac.cpp create mode 100644 tdeioslave/audiocd/plugins/flac/encoderflac.h create mode 100644 tdeioslave/audiocd/plugins/lame/Makefile.am create mode 100644 tdeioslave/audiocd/plugins/lame/audiocd_lame_encoder.kcfg create mode 100644 tdeioslave/audiocd/plugins/lame/audiocd_lame_encoder.kcfgc create mode 100644 tdeioslave/audiocd/plugins/lame/collectingprocess.cpp create mode 100644 tdeioslave/audiocd/plugins/lame/collectingprocess.h create mode 100644 tdeioslave/audiocd/plugins/lame/encoderlame.cpp create mode 100644 tdeioslave/audiocd/plugins/lame/encoderlame.h create mode 100644 tdeioslave/audiocd/plugins/lame/encoderlameconfig.ui create mode 100644 tdeioslave/audiocd/plugins/vorbis/Makefile.am create mode 100644 tdeioslave/audiocd/plugins/vorbis/audiocd_vorbis_encoder.kcfg create mode 100644 tdeioslave/audiocd/plugins/vorbis/audiocd_vorbis_encoder.kcfgc create mode 100644 tdeioslave/audiocd/plugins/vorbis/encodervorbis.cpp create mode 100644 tdeioslave/audiocd/plugins/vorbis/encodervorbis.h create mode 100644 tdeioslave/audiocd/plugins/vorbis/encodervorbisconfig.ui create mode 100644 tdeioslave/audiocd/plugins/wav/Makefile.am create mode 100644 tdeioslave/audiocd/plugins/wav/encodercda.cpp create mode 100644 tdeioslave/audiocd/plugins/wav/encodercda.h create mode 100644 tdeioslave/audiocd/plugins/wav/encoderwav.cpp create mode 100644 tdeioslave/audiocd/plugins/wav/encoderwav.h create mode 100755 tdeioslave/audiocd/upgrade-metadata.sh diff --git a/Makefile.am.in b/Makefile.am.in index d77fa940..aaccab85 100644 --- a/Makefile.am.in +++ b/Makefile.am.in @@ -6,7 +6,7 @@ DISTCLEANFILES = inst-apps COMPILE_AFTER_arts = noatun krec akode_artsplugin COMPILE_AFTER_mpeglib = mpeglib_artsplug -COMPILE_AFTER_libkcddb = kaudiocreator kioslave kscd +COMPILE_AFTER_libkcddb = kaudiocreator tdeioslave kscd COMPILE_AFTER_akode = juk MAINTAINERCLEANFILES = subdirs configure.in acinclude.m4 SUBDIRS diff --git a/README b/README index 4f3c94c2..edb93c59 100644 --- a/README +++ b/README @@ -25,7 +25,7 @@ infrastructure of above applications: * arts: a versatily multimedia system the consists of various little building blocks that you (or an application) can combine in almost arbitrary ways to create sound and video processing pipes -* kfile-plugins: provide meta information about sound files +* tdefile-plugins: provide meta information about sound files * mpeglib: a library for MPEG 1 (layer I, II and III) encoded files * mpeglib_artsplug: wrapped mpeglib to make it aRts-aware * mpg123_artsplugin: a trimmed down mpg123 made aRts-compatible diff --git a/arts/builder/execdlg.cpp b/arts/builder/execdlg.cpp index 2aa4f608..9e4819e2 100644 --- a/arts/builder/execdlg.cpp +++ b/arts/builder/execdlg.cpp @@ -27,7 +27,7 @@ #include #include -#include +#include #include #include #include diff --git a/arts/builder/main.cpp b/arts/builder/main.cpp index c83a5091..87783267 100644 --- a/arts/builder/main.cpp +++ b/arts/builder/main.cpp @@ -48,7 +48,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/arts/builder/main.h b/arts/builder/main.h index f5a09457..5098ff60 100644 --- a/arts/builder/main.h +++ b/arts/builder/main.h @@ -26,7 +26,7 @@ #include #include -#include +#include #include #include diff --git a/arts/tools/artscontrolapplet.cpp b/arts/tools/artscontrolapplet.cpp index dc495322..41b55c71 100644 --- a/arts/tools/artscontrolapplet.cpp +++ b/arts/tools/artscontrolapplet.cpp @@ -17,7 +17,7 @@ #include #include -#include +#include #include #include #include diff --git a/arts/tools/artscontrolapplet.h b/arts/tools/artscontrolapplet.h index 06090c80..515e4fb4 100644 --- a/arts/tools/artscontrolapplet.h +++ b/arts/tools/artscontrolapplet.h @@ -24,7 +24,7 @@ #include #include -#include +#include class ArtsControlAppletPrivate; diff --git a/configure.in.in b/configure.in.in index b07980d1..bfaadb2e 100644 --- a/configure.in.in +++ b/configure.in.in @@ -116,7 +116,7 @@ AC_DEFUN([KDE_CHECK_OGGVORBIS], [have_vorbis_value=2], [have_vorbis_value=1]) if test "x$have_oggvorbis" = xyes; then - # for akode/plugins/xiph_decoder/ kioslave/audiocd/plugins/ and krec/ogg_export/ + # for akode/plugins/xiph_decoder/ tdeioslave/audiocd/plugins/ and krec/ogg_export/ VORBIS_LIBS="-lvorbis -logg" VORBISFILE_LIBS="-lvorbisfile" VORBISENC_LIBS="-lvorbisenc" @@ -124,7 +124,7 @@ AC_DEFUN([KDE_CHECK_OGGVORBIS], # for akode/plugins/xiph_decoder/ AC_DEFINE_UNQUOTED(HAVE_OGG_VORBIS, 1, [Define if you have ogg/vorbis installed]) - # for kioslave/audiocd/plugins/ and krec/ogg_export/ + # for tdeioslave/audiocd/plugins/ and krec/ogg_export/ AC_DEFINE_UNQUOTED(HAVE_VORBIS, $have_vorbis_value, [Define if you ogg/vorbis installed]) # for mpeglib/ @@ -301,7 +301,7 @@ AC_DEFUN([KDE_CHECK_CDPARANOIA], fi if test "x$have_cdparanoia" = xyes; then - # for kioslave/audiocd/ + # for tdeioslave/audiocd/ CDPARANOIA_LIBS="-lcdda_paranoia -lcdda_interface -lm" # for mpeglib/ @@ -310,7 +310,7 @@ AC_DEFUN([KDE_CHECK_CDPARANOIA], fi if test "x$have_cdparanoia_only_static" = xyes; then - # for kioslave/audiocd/ + # for tdeioslave/audiocd/ AC_DEFINE_UNQUOTED(CDPARANOIA_STATIC, 1, [Define if you only have a static cdparanoia]) fi @@ -328,7 +328,7 @@ AC_DEFUN([KDE_CHECK_LAME], [:], [have_lame=no], [-lm]) if test "x$have_lame" = xyes; then - # for krec/mp3_export/ (kioslave/audiocd/ uses the lame binary at runtime) + # for krec/mp3_export/ (tdeioslave/audiocd/ uses the lame binary at runtime) LAME_LIBS="-lmp3lame -lm" fi @@ -488,8 +488,8 @@ if test "x$with_cdparanoia" != xno; then fi fi -# for kioslave/audiocd/ -AM_CONDITIONAL(include_kioslave_audiocd, test "x$have_cdparanoia" = xyes) +# for tdeioslave/audiocd/ +AM_CONDITIONAL(include_tdeioslave_audiocd, test "x$have_cdparanoia" = xyes) AM_CONDITIONAL(include_kcm_audiocd, test "x$have_cdparanoia" = xyes) if test "x$have_cdparanoia" != xyes; then # kaudiocreator depends on kio_audiocd diff --git a/doc/kioslave/Makefile.am b/doc/kioslave/Makefile.am deleted file mode 100644 index 085981d9..00000000 --- a/doc/kioslave/Makefile.am +++ /dev/null @@ -1,4 +0,0 @@ - -KDE_LANG = en -KDE_DOCS = AUTO - diff --git a/doc/kioslave/audiocd.docbook b/doc/kioslave/audiocd.docbook deleted file mode 100644 index 982e1f23..00000000 --- a/doc/kioslave/audiocd.docbook +++ /dev/null @@ -1,208 +0,0 @@ -
-audiocd - - -&Rik.Hemsley; &Rik.Hemsley.mail; -BenjaminMeyer - - - -2004-09-16 -2.30.00 - - - -Allows treating audio CDs like a -real filesystem, where tracks are represented as files -and, when copied from the folder, are digitally extracted from the -CD. This ensures a perfect copy of the audio -data. - -To see how this slave works, insert an audio CD -in your &CD-ROM; drive and type audiocd:/ into -&konqueror;. Within a few seconds you should see a list of tracks and -some folders. - -Audio CDs don't really have folders, but -the audiocd slave provides them as a convenience. If you look inside -these folders you will see that they all contain the same number of -tracks. If you are connected to the Internet, some folders will have -the actual track titles shown as the filenames. - -The reason that these separate folders exist are so that you -can choose in which format you would like to listen to (or copy) the -tracks on the CD. - -If you drag a track from the Ogg -Vorbis folder and drop it on another &konqueror; window -open at your home folder, you should see a progress window showing -you that the track is being extracted from the CD and -saved to a file. Note that Ogg Vorbis is a compressed format, so the -file in your home folder will appear a great deal smaller than it -would have been if you had copied the raw data. - -The mechanism behind this is quite simple. When the audiocd slave -is asked to retrieve a track from the Ogg -Vorbis folder, it starts extracting the digital audio data -from the CD. As it sends the data over to the file in -your home folder, it simultaneously encodes it in Ogg Vorbis format -(CD audio is in an uncompressed format to start -with). - -You could also try dragging a file ending in .wav and dropping it on the &kde; Media -Player, &noatun;. In this case, the procedure that happens behind the -scenes is similar, except that instead of encoding the audio data in Ogg -Vorbis format, it is put through a very simple conversion, from raw -binary data (which the .cda files in -the toplevel folder represent) to RIFF WAV format, a -non-compressed format that most media players understand. - -&noatun; should quite happily play the .wav file, but if it has trouble, you may -consider using the option, explained -below. - - -Options - - - - -Set the path to the audio CD device, ⪚ -audiocd:/=/dev/sdc. -Normally, the slave will try to find a CD drive with -an audio CD inserted, but if it fails or you have -more than one CD drive, you may want to try this -option. Note that the configuration dialog allows you to set a default -value for this option. - - - - - - -Set the file name template, ⪚ -audiocd:/=Track %{number}. Note that the configuration dialog allows you to set a default value for this option. A warning that if you set it to an empty string no files will show up. - - - - - - -Set the album name template, ⪚ -audiocd:/=%{albumartist} %{albumtitle}. Note that the configuration dialog allows you to set a default value for this option. - - - - - - -Sets the process nice level for encoders, ⪚ -audiocd:/=niceLevel=10. Note that the configuration dialog allows you to set a default value for this option. - - - - - - -Set the amount of error detection and correction used when -extracting data. - - - -Level 0 - -No detection or correction. Only useful if you have a perfect -CD drive (unlikely). - - - - -Level 1 - -Enable basic error checking and correction. - - - - -Level 2 - -Default. Specifies that only a perfect extraction will be -accepted. - - - - -Note that there is a disadvantage to level 2. Extraction can be -very slow, so real-time digital playback may not work properly. If you -have a good quality CD drive (note that more -expensive does not necessarily mean better quality) then you probably -won't experience very slow extraction, but a poor drive may take days -(!) to extract the audio from one CD. - - - - - - - -Specify which Internet CD Database entry to use. Audio -CDs don't have track names, but the Internet -CD Database is a clever system which uses a special -unique identifier generated from the number and length of tracks on each -CD to cross-reference a track listing. Track listings -are contributed by the Internet community and made available to -all. Occasionally there will be multiple entries. You can specify which one to use. - -You can submit your own track listings using &kscd;, the &kde; -CD player. - -By default audiocd tries to pick the best one. - - - - - -Examples - -audiocd:/?device=/dev/scd0&paranoia_level=0&cddbChoice=0 - -Gives a listing of the tracks on the audio CD -inserted in /dev/scd0, which on -&Linux; specifies the first SCSI &CD-ROM; device. If -you copy tracks from the CD, digital extraction will -be performed without error correction or detection. The -CDDB Database entry 0 will be used. - - - - - -Frequently Asked Question - - -I get The file or folder / does not -exist. How do I fix that? I have an audio -CD in my drive! - - - -Try running cdparanoia - as yourself (not root). Do you see a track list? If not, -make sure you have permission to access the CD -device. If you're using SCSI emulation (possible if -you have an IDE CD writer) then -make sure you check that you have read and write permissions on the -generic SCSI device, which is probably /dev/sg0, /dev/sg1, &etc;. If it still doesn't work, -try typing audiocd:/?device=/dev/sg0 (or similar) -to tell kio_audiocd which device your &CD-ROM; is. - - - - - -
diff --git a/doc/krec/index.docbook b/doc/krec/index.docbook index 1b79e433..86ed8f3c 100644 --- a/doc/krec/index.docbook +++ b/doc/krec/index.docbook @@ -233,7 +233,7 @@ before you can be sure... Second important thing is that &arts; has to run in full-duplex mode. That means that &arts; is reading from the soundcard and writing to it at the same time. You have to start &kcontrol; and edit the soundsystem settings (or press Alt+F2 -and enter kcmshell arts). On the second tab-page you have to +and enter tdecmshell arts). On the second tab-page you have to make sure the checkbox for full-duplex is selected, clicking Apply restarts &arts; which means that you have to restart &krec; too. diff --git a/doc/tdeioslave/Makefile.am b/doc/tdeioslave/Makefile.am new file mode 100644 index 00000000..085981d9 --- /dev/null +++ b/doc/tdeioslave/Makefile.am @@ -0,0 +1,4 @@ + +KDE_LANG = en +KDE_DOCS = AUTO + diff --git a/doc/tdeioslave/audiocd.docbook b/doc/tdeioslave/audiocd.docbook new file mode 100644 index 00000000..982e1f23 --- /dev/null +++ b/doc/tdeioslave/audiocd.docbook @@ -0,0 +1,208 @@ +
+audiocd + + +&Rik.Hemsley; &Rik.Hemsley.mail; +BenjaminMeyer + + + +2004-09-16 +2.30.00 + + + +Allows treating audio CDs like a +real filesystem, where tracks are represented as files +and, when copied from the folder, are digitally extracted from the +CD. This ensures a perfect copy of the audio +data. + +To see how this slave works, insert an audio CD +in your &CD-ROM; drive and type audiocd:/ into +&konqueror;. Within a few seconds you should see a list of tracks and +some folders. + +Audio CDs don't really have folders, but +the audiocd slave provides them as a convenience. If you look inside +these folders you will see that they all contain the same number of +tracks. If you are connected to the Internet, some folders will have +the actual track titles shown as the filenames. + +The reason that these separate folders exist are so that you +can choose in which format you would like to listen to (or copy) the +tracks on the CD. + +If you drag a track from the Ogg +Vorbis folder and drop it on another &konqueror; window +open at your home folder, you should see a progress window showing +you that the track is being extracted from the CD and +saved to a file. Note that Ogg Vorbis is a compressed format, so the +file in your home folder will appear a great deal smaller than it +would have been if you had copied the raw data. + +The mechanism behind this is quite simple. When the audiocd slave +is asked to retrieve a track from the Ogg +Vorbis folder, it starts extracting the digital audio data +from the CD. As it sends the data over to the file in +your home folder, it simultaneously encodes it in Ogg Vorbis format +(CD audio is in an uncompressed format to start +with). + +You could also try dragging a file ending in .wav and dropping it on the &kde; Media +Player, &noatun;. In this case, the procedure that happens behind the +scenes is similar, except that instead of encoding the audio data in Ogg +Vorbis format, it is put through a very simple conversion, from raw +binary data (which the .cda files in +the toplevel folder represent) to RIFF WAV format, a +non-compressed format that most media players understand. + +&noatun; should quite happily play the .wav file, but if it has trouble, you may +consider using the option, explained +below. + + +Options + + + + +Set the path to the audio CD device, ⪚ +audiocd:/=/dev/sdc. +Normally, the slave will try to find a CD drive with +an audio CD inserted, but if it fails or you have +more than one CD drive, you may want to try this +option. Note that the configuration dialog allows you to set a default +value for this option. + + + + + + +Set the file name template, ⪚ +audiocd:/=Track %{number}. Note that the configuration dialog allows you to set a default value for this option. A warning that if you set it to an empty string no files will show up. + + + + + + +Set the album name template, ⪚ +audiocd:/=%{albumartist} %{albumtitle}. Note that the configuration dialog allows you to set a default value for this option. + + + + + + +Sets the process nice level for encoders, ⪚ +audiocd:/=niceLevel=10. Note that the configuration dialog allows you to set a default value for this option. + + + + + + +Set the amount of error detection and correction used when +extracting data. + + + +Level 0 + +No detection or correction. Only useful if you have a perfect +CD drive (unlikely). + + + + +Level 1 + +Enable basic error checking and correction. + + + + +Level 2 + +Default. Specifies that only a perfect extraction will be +accepted. + + + + +Note that there is a disadvantage to level 2. Extraction can be +very slow, so real-time digital playback may not work properly. If you +have a good quality CD drive (note that more +expensive does not necessarily mean better quality) then you probably +won't experience very slow extraction, but a poor drive may take days +(!) to extract the audio from one CD. + + + + + + + +Specify which Internet CD Database entry to use. Audio +CDs don't have track names, but the Internet +CD Database is a clever system which uses a special +unique identifier generated from the number and length of tracks on each +CD to cross-reference a track listing. Track listings +are contributed by the Internet community and made available to +all. Occasionally there will be multiple entries. You can specify which one to use. + +You can submit your own track listings using &kscd;, the &kde; +CD player. + +By default audiocd tries to pick the best one. + + + + + +Examples + +audiocd:/?device=/dev/scd0&paranoia_level=0&cddbChoice=0 + +Gives a listing of the tracks on the audio CD +inserted in /dev/scd0, which on +&Linux; specifies the first SCSI &CD-ROM; device. If +you copy tracks from the CD, digital extraction will +be performed without error correction or detection. The +CDDB Database entry 0 will be used. + + + + + +Frequently Asked Question + + +I get The file or folder / does not +exist. How do I fix that? I have an audio +CD in my drive! + + + +Try running cdparanoia + as yourself (not root). Do you see a track list? If not, +make sure you have permission to access the CD +device. If you're using SCSI emulation (possible if +you have an IDE CD writer) then +make sure you check that you have read and write permissions on the +generic SCSI device, which is probably /dev/sg0, /dev/sg1, &etc;. If it still doesn't work, +try typing audiocd:/?device=/dev/sg0 (or similar) +to tell kio_audiocd which device your &CD-ROM; is. + + + + + +
diff --git a/juk/artsplayer.cpp b/juk/artsplayer.cpp index 4022b0f1..d6905f0e 100644 --- a/juk/artsplayer.cpp +++ b/juk/artsplayer.cpp @@ -21,7 +21,7 @@ #if HAVE_ARTS #include -#include +#include #include #include diff --git a/juk/cache.cpp b/juk/cache.cpp index 0183c560..bb7c2956 100644 --- a/juk/cache.cpp +++ b/juk/cache.cpp @@ -15,7 +15,7 @@ #include #include -#include +#include #include #include #include diff --git a/juk/collectionlist.cpp b/juk/collectionlist.cpp index 13b6d6b4..7b22542e 100644 --- a/juk/collectionlist.cpp +++ b/juk/collectionlist.cpp @@ -19,7 +19,7 @@ #include #include #include -#include +#include #include #include diff --git a/juk/collectionlist.h b/juk/collectionlist.h index 5df08023..c15dccc3 100644 --- a/juk/collectionlist.h +++ b/juk/collectionlist.h @@ -18,7 +18,7 @@ #include #include -#include +#include #include #include diff --git a/juk/deletedialog.cpp b/juk/deletedialog.cpp index 67958116..5bb3c4d3 100644 --- a/juk/deletedialog.cpp +++ b/juk/deletedialog.cpp @@ -18,7 +18,7 @@ #include #include #include -#include +#include #include #include diff --git a/juk/directorylist.cpp b/juk/directorylist.cpp index 43df3dda..c368a6c3 100644 --- a/juk/directorylist.cpp +++ b/juk/directorylist.cpp @@ -13,7 +13,7 @@ * * ***************************************************************************/ -#include +#include #include #include #include diff --git a/juk/filerenamer.cpp b/juk/filerenamer.cpp index e21a484d..e9c997aa 100644 --- a/juk/filerenamer.cpp +++ b/juk/filerenamer.cpp @@ -23,9 +23,9 @@ #include #include #include -#include -#include -#include +#include +#include +#include #include #include #include diff --git a/juk/gstreamerplayer.cpp b/juk/gstreamerplayer.cpp index a45678a3..4b893815 100644 --- a/juk/gstreamerplayer.cpp +++ b/juk/gstreamerplayer.cpp @@ -17,7 +17,7 @@ #if HAVE_GSTREAMER #include -#include +#include #include #include diff --git a/juk/keydialog.cpp b/juk/keydialog.cpp index 6b3d278a..ea73277f 100644 --- a/juk/keydialog.cpp +++ b/juk/keydialog.cpp @@ -15,7 +15,7 @@ #include "keydialog.h" -#include +#include #include #include diff --git a/juk/main.cpp b/juk/main.cpp index 6fbb0930..3db558df 100644 --- a/juk/main.cpp +++ b/juk/main.cpp @@ -19,8 +19,8 @@ #include #include #include -#include -#include +#include +#include #include "juk.h" diff --git a/juk/mediafiles.cpp b/juk/mediafiles.cpp index d105d1cd..94382b23 100644 --- a/juk/mediafiles.cpp +++ b/juk/mediafiles.cpp @@ -13,10 +13,10 @@ * * ***************************************************************************/ -#include +#include #include #include -#include +#include #include "mediafiles.h" diff --git a/juk/nowplaying.cpp b/juk/nowplaying.cpp index 1125cdd6..03f679ae 100644 --- a/juk/nowplaying.cpp +++ b/juk/nowplaying.cpp @@ -17,7 +17,7 @@ #include #include #include -#include +#include #include #include diff --git a/juk/playlist.cpp b/juk/playlist.cpp index a60d0c05..1f33b4be 100644 --- a/juk/playlist.cpp +++ b/juk/playlist.cpp @@ -13,7 +13,7 @@ * * ***************************************************************************/ -#include +#include #include #include #include @@ -23,11 +23,11 @@ #include #include #include -#include +#include #include #include -#include -#include +#include +#include #include #include diff --git a/juk/playlistcollection.cpp b/juk/playlistcollection.cpp index 11c8a27a..bff1e7c9 100644 --- a/juk/playlistcollection.cpp +++ b/juk/playlistcollection.cpp @@ -39,7 +39,7 @@ #include #include #include -#include +#include #include #include diff --git a/juk/playlistsplitter.h b/juk/playlistsplitter.h index c33621d3..8e9f0e0f 100644 --- a/juk/playlistsplitter.h +++ b/juk/playlistsplitter.h @@ -16,7 +16,7 @@ #ifndef PLAYLISTSPLITTER_H #define PLAYLISTSPLITTER_H -#include +#include #include diff --git a/juk/tageditor.cpp b/juk/tageditor.cpp index 0b4d041b..efff323d 100644 --- a/juk/tageditor.cpp +++ b/juk/tageditor.cpp @@ -25,7 +25,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/juk/tagguesser.cpp b/juk/tagguesser.cpp index 57714842..ae165c6e 100644 --- a/juk/tagguesser.cpp +++ b/juk/tagguesser.cpp @@ -9,7 +9,7 @@ #include "tagguesser.h" #include -#include +#include #include #include #include diff --git a/juk/tagrenameroptions.cpp b/juk/tagrenameroptions.cpp index b9b40fbb..50c3083b 100644 --- a/juk/tagrenameroptions.cpp +++ b/juk/tagrenameroptions.cpp @@ -16,8 +16,8 @@ #include #include #include -#include -#include +#include +#include #include "tagrenameroptions.h" diff --git a/juk/tracksequencemanager.cpp b/juk/tracksequencemanager.cpp index 828c61d5..4f7ae64f 100644 --- a/juk/tracksequencemanager.cpp +++ b/juk/tracksequencemanager.cpp @@ -13,7 +13,7 @@ * * ***************************************************************************/ -#include +#include #include #include #include diff --git a/juk/webimagefetcherdialog.cpp b/juk/webimagefetcherdialog.cpp index 303d53ab..5a2de5b2 100644 --- a/juk/webimagefetcherdialog.cpp +++ b/juk/webimagefetcherdialog.cpp @@ -15,7 +15,7 @@ ***************************************************************************/ #include -#include +#include #include #include #include diff --git a/juk/webimagefetcherdialog.h b/juk/webimagefetcherdialog.h index a3b60378..4af0cf41 100644 --- a/juk/webimagefetcherdialog.h +++ b/juk/webimagefetcherdialog.h @@ -18,7 +18,7 @@ #define WEBIMAGEFETCHERDIALOG_H #include -#include +#include #include "webimagefetcher.h" diff --git a/kaboodle/Makefile.am b/kaboodle/Makefile.am index 1f39c8f4..88177b35 100644 --- a/kaboodle/Makefile.am +++ b/kaboodle/Makefile.am @@ -1,4 +1,4 @@ -INCLUDES = -I$(kde_includes)/kio -I$(kde_includes)/arts $(all_includes) +INCLUDES = -I$(kde_includes)/tdeio -I$(kde_includes)/arts $(all_includes) SUBDIRS = pics actions diff --git a/kaboodle/conf.cpp b/kaboodle/conf.cpp index 3bab0768..2c66f5a8 100644 --- a/kaboodle/conf.cpp +++ b/kaboodle/conf.cpp @@ -23,7 +23,7 @@ // used in advertising or otherwise to promote the sale, use or other dealings // in this Software without prior written authorization from the author(s). -#include +#include #include #include #include diff --git a/kaboodle/engine.cpp b/kaboodle/engine.cpp index 5909dbcd..0b3c42f4 100644 --- a/kaboodle/engine.cpp +++ b/kaboodle/engine.cpp @@ -26,7 +26,7 @@ extern "C" #include } -#include +#include #include #include #include diff --git a/kaboodle/kaboodleapp.cpp b/kaboodle/kaboodleapp.cpp index 6aced727..e153c725 100644 --- a/kaboodle/kaboodleapp.cpp +++ b/kaboodle/kaboodleapp.cpp @@ -22,7 +22,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ******************************************************************/ #include -#include +#include #include "kaboodleapp.h" #include "userinterface.h" diff --git a/kaboodle/userinterface.cpp b/kaboodle/userinterface.cpp index 5deaad05..ffc04c48 100644 --- a/kaboodle/userinterface.cpp +++ b/kaboodle/userinterface.cpp @@ -23,9 +23,9 @@ // in this Software without prior written authorization from the author(s). #include -#include +#include #include -#include +#include #include #include #include diff --git a/kaboodle/view.cpp b/kaboodle/view.cpp index bde6e9f4..509fb7b0 100644 --- a/kaboodle/view.cpp +++ b/kaboodle/view.cpp @@ -23,7 +23,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include #include -#include +#include #include #include #include diff --git a/kaudiocreator/Makefile.am b/kaudiocreator/Makefile.am index ba0f65ad..1f926de6 100644 --- a/kaudiocreator/Makefile.am +++ b/kaudiocreator/Makefile.am @@ -35,7 +35,7 @@ appdatadir = $(kde_datadir)/kaudiocreator servicedata_DATA = audiocd_extract.desktop servicedatadir = $(kde_datadir)/konqueror/servicemenus -updatedir = $(kde_datadir)/kconf_update +updatedir = $(kde_datadir)/tdeconf_update update_DATA = kaudiocreator-meta.upd kaudiocreator-libkcddb.upd update_SCRIPTS = upgrade-kaudiocreator-metadata.sh diff --git a/kaudiocreator/encoder_prefs.kcfgc b/kaudiocreator/encoder_prefs.kcfgc index 075a4321..c34a8641 100644 --- a/kaudiocreator/encoder_prefs.kcfgc +++ b/kaudiocreator/encoder_prefs.kcfgc @@ -1,4 +1,4 @@ -# Code generation options for kconfig_compiler +# Code generation options for tdeconfig_compiler File=kaudiocreator_encoders.kcfg #IncludeFiles=defines.h ClassName=EncoderPrefs diff --git a/kaudiocreator/encoderconfigimp.cpp b/kaudiocreator/encoderconfigimp.cpp index cc4d1ad5..b02ca614 100644 --- a/kaudiocreator/encoderconfigimp.cpp +++ b/kaudiocreator/encoderconfigimp.cpp @@ -24,10 +24,10 @@ #include #include -#include +#include #include #include -#include +#include /** * Constructor. diff --git a/kaudiocreator/jobqueimp.cpp b/kaudiocreator/jobqueimp.cpp index 81c0431d..1083f738 100644 --- a/kaudiocreator/jobqueimp.cpp +++ b/kaudiocreator/jobqueimp.cpp @@ -24,7 +24,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/kaudiocreator/kaudiocreator.h b/kaudiocreator/kaudiocreator.h index 0ba8f6aa..5624c563 100644 --- a/kaudiocreator/kaudiocreator.h +++ b/kaudiocreator/kaudiocreator.h @@ -22,7 +22,7 @@ #define KAUDIOCREATOR_H #include -#include +#include class KJanusWidget; class TracksImp; diff --git a/kaudiocreator/prefs.kcfgc b/kaudiocreator/prefs.kcfgc index dc784e77..1b3d28ff 100644 --- a/kaudiocreator/prefs.kcfgc +++ b/kaudiocreator/prefs.kcfgc @@ -1,4 +1,4 @@ -# Code generation options for kconfig_compiler +# Code generation options for tdeconfig_compiler File=kaudiocreator.kcfg #IncludeFiles=defines.h ClassName=Prefs diff --git a/kaudiocreator/ripper.cpp b/kaudiocreator/ripper.cpp index e2366fd7..2060278f 100644 --- a/kaudiocreator/ripper.cpp +++ b/kaudiocreator/ripper.cpp @@ -27,7 +27,7 @@ #include #include #include -#include +#include /** * Constructor, load settings. diff --git a/kaudiocreator/ripper.h b/kaudiocreator/ripper.h index 3804b8ad..1d79c0e8 100644 --- a/kaudiocreator/ripper.h +++ b/kaudiocreator/ripper.h @@ -22,7 +22,7 @@ #define RIPPER_H #include "job.h" -#include +#include #include #include diff --git a/kaudiocreator/tracksimp.cpp b/kaudiocreator/tracksimp.cpp index c9296547..73656e07 100644 --- a/kaudiocreator/tracksimp.cpp +++ b/kaudiocreator/tracksimp.cpp @@ -23,7 +23,7 @@ #include #include -#include +#include #include #include #include diff --git a/kfile-plugins/Makefile.am b/kfile-plugins/Makefile.am deleted file mode 100644 index fc127f02..00000000 --- a/kfile-plugins/Makefile.am +++ /dev/null @@ -1,22 +0,0 @@ -if include_ogg_SUBDIR -KFILE_OGG_SUBDIR=ogg -endif - -if include_flac_SUBDIR -KFILE_FLAC_SUBDIR=flac -endif - -if include_mp3_SUBDIR -KFILE_MP3_SUBDIR=mp3 -endif - -if include_mpc_SUBDIR -KFILE_MPC_SUBDIR=mpc -endif - -if include_theora_SUBDIR -KFILE_THEORA_SUBDIR=theora -endif - -SUBDIRS=m3u $(KFILE_MP3_SUBDIR) $(KFILE_MPC_SUBDIR) au avi mpeg wav sid $(KFILE_OGG_SUBDIR) \ - $(KFILE_FLAC_SUBDIR) $(KFILE_THEORA_SUBDIR) diff --git a/kfile-plugins/RETURNED_ITEMS b/kfile-plugins/RETURNED_ITEMS deleted file mode 100644 index ffe878d3..00000000 --- a/kfile-plugins/RETURNED_ITEMS +++ /dev/null @@ -1,86 +0,0 @@ -If you add a new plugin here, add the list of returned items to this file. - -The returned items are: - - -mp3 plugin: -=========== - -type key W/A details ------------------------------------------------------------------------- -String Title +/+ only if id3v1 tag exists / max. 30 characters -String Artist +/+ only if id3v1 tag exists / max. 30 characters -String Album +/+ only if id3v1 tag exists / max. 30 characters -String Comment +/+ only if id3v1 tag exists / max. 28 characters -String Date +/+ only if id3v1 tag exists / max. 4 characters -Int Tracknumber +/+ only if id3v1.1 tag exists / 0-255 -Bool CRC -/- -Bool Original -/- -Bool Copyright -/- -String Length -/- -Int Bitrate -/- in kbps -Int Frequency -/- in Hz -Double Version -/- mpeg version, 1, 2, or 2.5 -Int Layer -/- 1, 2 or 3 -Int Channels -/- number of audio channels, 1 for mono, 2 stereo - -type is the QVariant::type() of that key. -W/A is writable/addable, - means no, + means yes. If a key is addable, it's -also removable - -ogg plugin: -=========== - -type key W/A details ------------------------------------------------------------------------- -Int Version -/- -Int Channels -/- -Int Bitrate upper -/- might also be a string containing i18n("none") -Int Bitrate lower -/- might also be a string containing i18n("none") -Int Bitrate nominal -/- might also be a string containing i18n("none") -Int Bitrate -/- average bitrate -String Length -/- - -Other keys corresponding to the vorbis comment keys are returned as editable -String. If there are several equal vorbis comment keys, e.g. 3 Artists, the -first one is called "Artist", the second one (not yet) "Artist(2)" and so on. - -Common keys that are recommended in the vorbiscomment docs: -Title, Version, Album, Tracknumber, Artist, Organization, Description, Genre, -Date, Location, Copyright, Isirc - - - -au plugin: -=========== - -type key W/A details ------------------------------------------------------------------------- -Int Length -/- Length in seconds -Int Sample Rate -/- Sample rate of sample in Hz -Int Channels -/- No. of channels -String Encoding -/- Data encoding (e.g. 8-bit ISDN u-law) - - -avi plugin: -=========== - -type key W/A details ------------------------------------------------------------------------- -Int Length -/- Length in seconds/minutes/hours -Size Resolution -/- Resolution in pixels -Int Frame rate -/- Frame rate -String Video codec -/- The video codec symbol (e.g. mp42 or div3) - - -theora plugin: -=========== - -type key W/A details ------------------------------------------------------------------------- -Int Length -/- Length in seconds/minutes/hours -Size Resolution -/- Resolution in pixels -Int Frame rate -/- Frame rate -Int Quality -/- Quality of the encoding -Int Channels -/- Number of audio channels -Int Sample rate -/- Sample rate of sample in Hz diff --git a/kfile-plugins/au/Makefile.am b/kfile-plugins/au/Makefile.am deleted file mode 100644 index f9a1649b..00000000 --- a/kfile-plugins/au/Makefile.am +++ /dev/null @@ -1,22 +0,0 @@ -## Makefile.am for au file meta info plugin - -# set the include path for X, qt and KDE -INCLUDES = $(all_includes) - -# these are the headers for your project -noinst_HEADERS = kfile_au.h - -kde_module_LTLIBRARIES = kfile_au.la - -kfile_au_la_SOURCES = kfile_au.cpp -kfile_au_la_LDFLAGS = $(all_libraries) $(KDE_RPATH) $(LIB_QT) -lDCOP $(LIB_TDECORE) $(LIB_TDEUI) -ltdefx $(LIB_KIO) -ltdetexteditor -module $(KDE_PLUGIN) -kfile_au_la_LIBADD = $(LIB_KIO) - -# let automoc handle all of the meta source files (moc) -METASOURCES = AUTO - -messages: - $(XGETTEXT) kfile_au.cpp -o $(podir)/kfile_au.pot - -services_DATA = kfile_au.desktop -servicesdir = $(kde_servicesdir) diff --git a/kfile-plugins/au/kfile_au.cpp b/kfile-plugins/au/kfile_au.cpp deleted file mode 100644 index 8a2108a9..00000000 --- a/kfile-plugins/au/kfile_au.cpp +++ /dev/null @@ -1,172 +0,0 @@ -/* This file is part of the KDE project - * Copyright (C) 2002 Shane Wright - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public - * License as published by the Free Software Foundation version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - * - */ - -#include -#include "kfile_au.h" - -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -#if !defined(__osf__) -#include -#else -typedef unsigned long uint32_t; -typedef unsigned short uint16_t; -#endif - -typedef KGenericFactory AuFactory; - -K_EXPORT_COMPONENT_FACTORY(kfile_au, AuFactory( "kfile_au" )) - -KAuPlugin::KAuPlugin(TQObject *parent, const char *name, - const TQStringList &args) - - : KFilePlugin(parent, name, args) -{ - KFileMimeTypeInfo* info = addMimeTypeInfo( "audio/basic" ); - - KFileMimeTypeInfo::GroupInfo* group = 0L; - - group = addGroupInfo(info, "Technical", i18n("Technical Details")); - - KFileMimeTypeInfo::ItemInfo* item; - - item = addItemInfo(group, "Length", i18n("Length"), TQVariant::Int); - setSuffix(item, "s"); - - item = addItemInfo(group, "Sample Rate", i18n("Sample Rate"), TQVariant::Int); - setSuffix(item, "Hz"); - - item = addItemInfo(group, "Channels", i18n("Channels"), TQVariant::Int); - - item = addItemInfo(group, "Encoding", i18n("Encoding"), TQVariant::String); - -} - -bool KAuPlugin::readInfo( KFileMetaInfo& info, uint what) -{ - // the file signature, wants to be tidier... - const char fsig[] = { 0x2e, 0x73, 0x6e, 0x64 }; - - // a dword buffer for input - char inbuf[4]; - - // some vars for the file properties - uint32_t datasize; - uint32_t encoding; - uint32_t samplerate; - uint32_t channels; - uint16_t bytespersample; - - if ( info.path().isEmpty() ) // remote file - return false; - - TQFile file(info.path()); - - if (!file.open(IO_ReadOnly)) - { - kdDebug(7034) << "Couldn't open " << TQFile::encodeName(info.path()).data() << endl; - return false; - } - - TQDataStream dstream(&file); - - // AU files are big-endian - dstream.setByteOrder(TQDataStream::BigEndian); - - - // Read and verify the signature - dstream.readRawBytes(inbuf, 4); - if (memcmp(fsig, inbuf, 4)) - return false; - - // skip unwanted bits - file.at(8); - - // grab the bits we want - dstream >> datasize; - dstream >> encoding; - dstream >> samplerate; - dstream >> channels; - - // add the info - KFileMetaInfoGroup group = appendGroup(info, "Technical"); - appendItem(group, "Sample Rate", (uint) samplerate); - appendItem(group, "Channels", (uint) channels); - - // work out the encoding - switch (encoding) { - case 1 : - appendItem(group, "Encoding", i18n("8-bit ISDN u-law")); - bytespersample = 1; - break; - case 2 : - appendItem(group, "Encoding", i18n("8-bit linear PCM [REF-PCM]")); - bytespersample = 1; - break; - case 3 : - appendItem(group, "Encoding", i18n("16-bit linear PCM")); - bytespersample = 2; - break; - case 4 : - appendItem(group, "Encoding", i18n("24-bit linear PCM")); - bytespersample = 3; - break; - case 5 : - appendItem(group, "Encoding", i18n("32-bit linear PCM")); - bytespersample = 4; - break; - case 6 : - appendItem(group, "Encoding", i18n("32-bit IEEE floating point")); - bytespersample = 4; - break; - case 7 : - appendItem(group, "Encoding", i18n("64-bit IEEE floating point")); - bytespersample = 8; - break; - case 23 : - appendItem(group, "Encoding", i18n("8-bit ISDN u-law compressed")); - bytespersample = 1; - break; - default : - appendItem(group, "Encoding", i18n("Unknown")); - bytespersample = 0; - } - - // work out length from bytespersample + channels + size - if ((channels > 0) && (datasize > 0) && (datasize != 0xFFFFFFFF) && (bytespersample > 0) && (samplerate > 0)) { - uint32_t length = datasize / channels / bytespersample / samplerate; - appendItem(group, "Length", (uint) length); - } else { - appendItem(group, "Length", "???"); - } - - return true; -} - -#include "kfile_au.moc" diff --git a/kfile-plugins/au/kfile_au.desktop b/kfile-plugins/au/kfile_au.desktop deleted file mode 100644 index eee2964d..00000000 --- a/kfile-plugins/au/kfile_au.desktop +++ /dev/null @@ -1,67 +0,0 @@ -[Desktop Entry] -Type=Service -Name=AU Info -Name[af]=Au Inligting -Name[bg]=Информация за AU -Name[br]=Titouroù AU -Name[bs]=AU informacije -Name[ca]=Informació AU -Name[cs]=AU info -Name[cy]=Gwybodaeth AU -Name[da]=AU-info -Name[de]=AU-Info -Name[el]=Πληροφορίες AU -Name[eo]=AU-informo -Name[es]=Info AU -Name[et]=AU info -Name[eu]=AU informazioa -Name[fa]=اطلاعات AU -Name[fi]=AU-tiedot -Name[fr]=Informations AU -Name[gl]=Información AU -Name[he]=מידע AU -Name[hi]=AU जानकारी -Name[hr]=AU Informacije -Name[hu]=AU-jellemzők -Name[is]=AU upplýsingar -Name[it]=Informazioni AU -Name[ja]=AU 情報 -Name[kk]=AU мәліметі -Name[km]=ព័ត៌មាន AU -Name[ko]=AU 정보 -Name[lt]=AU informacija -Name[mk]=AU информации -Name[nb]=AU informasjon -Name[nds]=AU-Info -Name[ne]=AU सूचना -Name[nl]=AU-informatie -Name[nn]=AU-info -Name[pa]=AU ਜਾਣਕਾਰੀ -Name[pl]=Informacja o pliku AU -Name[pt]=Informação do AU -Name[pt_BR]=Informação sobre AU -Name[ro]=Informaţii AU -Name[ru]=Сведения о AU -Name[se]=AU-dieđut -Name[sk]=AU info -Name[sl]=Podatki o AU -Name[sr]=Информације о AU-у -Name[sr@Latn]=Informacije o AU-u -Name[sv]=AU-information -Name[ta]=AU தகவல் -Name[tg]=AU Ахборот -Name[th]=ข้อมูล AU -Name[tr]=AU Bilgisi -Name[uk]=Інформація по AU -Name[uz]=XBM haqida maʼlumot -Name[uz@cyrillic]=XBM ҳақида маълумот -Name[xh]=Ulwazi lwe AU -Name[zh_CN]=AU 信息 -Name[zh_HK]=AU 資訊 -Name[zh_TW]=AU 資訊 -Name[zu]=Ulwazi lwe-AU -ServiceTypes=KFilePlugin -X-TDE-Library=kfile_au -MimeType=audio/basic -PreferredGrous=Technical -PreferredItems=Length,Sample Rate,Channels,Encoding diff --git a/kfile-plugins/au/kfile_au.h b/kfile-plugins/au/kfile_au.h deleted file mode 100644 index ca38161e..00000000 --- a/kfile-plugins/au/kfile_au.h +++ /dev/null @@ -1,38 +0,0 @@ -/* This file is part of the KDE project - * Copyright (C) 2002 Shane Wright - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public - * License as published by the Free Software Foundation version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - * - */ - -#ifndef __KFILE_AU_H__ -#define __KFILE_AU_H__ - -#include - -class TQStringList; - -class KAuPlugin: public KFilePlugin -{ - Q_OBJECT - - -public: - KAuPlugin( TQObject *parent, const char *name, const TQStringList& args ); - - virtual bool readInfo( KFileMetaInfo& info, uint what); -}; - -#endif diff --git a/kfile-plugins/avi/Makefile.am b/kfile-plugins/avi/Makefile.am deleted file mode 100644 index 43590f82..00000000 --- a/kfile-plugins/avi/Makefile.am +++ /dev/null @@ -1,22 +0,0 @@ -## Makefile.am for avi file meta info plugin - -# set the include path for X, qt and KDE -INCLUDES = $(all_includes) - -# these are the headers for your project -noinst_HEADERS = kfile_avi.h - -kde_module_LTLIBRARIES = kfile_avi.la - -kfile_avi_la_SOURCES = kfile_avi.cpp -kfile_avi_la_LDFLAGS = $(all_libraries) $(KDE_RPATH) $(LIB_QT) -lDCOP $(LIB_TDECORE) $(LIB_TDEUI) -ltdefx $(LIB_KIO) -ltdetexteditor -module $(KDE_PLUGIN) -kfile_avi_la_LIBADD = $(LIB_KIO) - -# let automoc handle all of the meta source files (moc) -METASOURCES = AUTO - -messages: rc.cpp - $(XGETTEXT) kfile_avi.cpp -o $(podir)/kfile_avi.pot - -services_DATA = kfile_avi.desktop -servicesdir = $(kde_servicesdir) diff --git a/kfile-plugins/avi/kfile_avi.cpp b/kfile-plugins/avi/kfile_avi.cpp deleted file mode 100644 index 131ae027..00000000 --- a/kfile-plugins/avi/kfile_avi.cpp +++ /dev/null @@ -1,540 +0,0 @@ -/* This file is part of the KDE project - * Copyright (C) 2002 Shane Wright - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public - * License as published by the Free Software Foundation version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - * - */ - - -#include -#include "kfile_avi.h" - -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -#if !defined(__osf__) -#include -#else -typedef unsigned short uint16_t; -typedef unsigned int uint32_t; -typedef unsigned long long uint64_t; -#endif - -typedef KGenericFactory AviFactory; - -K_EXPORT_COMPONENT_FACTORY(kfile_avi, AviFactory( "kfile_avi" )) - -KAviPlugin::KAviPlugin(TQObject *parent, const char *name, - const TQStringList &args) - - : KFilePlugin(parent, name, args) -{ - KFileMimeTypeInfo* info = addMimeTypeInfo( "video/x-msvideo" ); - - KFileMimeTypeInfo::GroupInfo* group = 0L; - - group = addGroupInfo(info, "Technical", i18n("Technical Details")); - - KFileMimeTypeInfo::ItemInfo* item; - - item = addItemInfo(group, "Length", i18n("Length"), TQVariant::Int); - setUnit(item, KFileMimeTypeInfo::Seconds); - - item = addItemInfo(group, "Resolution", i18n("Resolution"), TQVariant::Size); - - item = addItemInfo(group, "Frame rate", i18n("Frame Rate"), TQVariant::Int); - setSuffix(item, i18n("fps")); - - item = addItemInfo(group, "Video codec", i18n("Video Codec"), TQVariant::String); - item = addItemInfo(group, "Audio codec", i18n("Audio Codec"), TQVariant::String); - -} - -bool KAviPlugin::read_avi() -{ - static const char sig_riff[] = "RIFF"; - static const char sig_avi[] = "AVI "; - static const char sig_list[] = "LIST"; - static const char sig_junk[] = "JUNK"; - uint32_t dwbuf1; - - done_avih = false; - done_audio = false; - - // read AVI header - char charbuf1[5]; - charbuf1[4] = '\0'; - - // this must be RIFF - f.readBlock(charbuf1, 4); - if (memcmp(charbuf1, sig_riff, 4) != 0) - return false; - - dstream >> dwbuf1; - - // this must be AVI - f.readBlock(charbuf1, 4); - if (memcmp(charbuf1, sig_avi, 4) != 0) - return false; - - - // start reading AVI file - int counter = 0; - bool done = false; - do { - - // read header - f.readBlock(charbuf1, 4); - - kdDebug(7034) << "about to handle chunk with ID: " << charbuf1 << "\n"; - - if (memcmp(charbuf1, sig_list, 4) == 0) { - // if list - if (!read_list()) - return false; - - } else if (memcmp(charbuf1, sig_junk, 4) == 0) { - // if junk - - // read chunk size - dstream >> dwbuf1; - - kdDebug(7034) << "Skipping junk chunk length: " << dwbuf1 << "\n"; - - // skip junk - f.at( f.at() + dwbuf1 ); - - } else { - // something we dont understand yet - kdDebug(7034) << "Unknown chunk header found: " << charbuf1 << "\n"; - return false; - }; - - if ( - ((done_avih) && (strlen(handler_vids) > 0) && (done_audio)) || - f.atEnd()) { - kdDebug(7034) << "We're done!\n"; - done = true; - } - - // make sure we dont stay here forever - ++counter; - if (counter > 10) - done = true; - - } while (!done); - - return true; -} - - -bool KAviPlugin::read_list() -{ - const char sig_hdrl[] = "hdrl"; // header list - const char sig_strl[] = "strl"; // ...list - const char sig_movi[] = "movi"; // movie list - - uint32_t dwbuf1; - char charbuf1[5]; - charbuf1[4] = '\0'; - - kdDebug(7034) << "In read_list()\n"; - - // read size & list type - dstream >> dwbuf1; - f.readBlock(charbuf1, 4); - - // read the relevant bits of the list - if (memcmp(charbuf1, sig_hdrl, 4) == 0) { - // should be the main AVI header - if (!read_avih()) - return false; - - } else if (memcmp(charbuf1, sig_strl, 4) == 0) { - // should be some stream info - if (!read_strl()) - return false; - - } else if (memcmp(charbuf1, sig_movi, 4) == 0) { - // movie list - - kdDebug(7034) << "Skipping movi chunk length: " << dwbuf1 << "\n"; - - // skip past it - f.at( f.at() + dwbuf1 ); - - } else { - // unknown list type - kdDebug(7034) << "Unknown list type found: " << charbuf1 << "\n"; - } - - return true; -} - - -bool KAviPlugin::read_avih() -{ - static const char sig_avih[] = "avih"; // header list - - uint32_t dwbuf1; - char charbuf1[5]; - - // read header and length - f.readBlock(charbuf1, 4); - dstream >> dwbuf1; - - // not a valid avih? - if (memcmp(charbuf1, sig_avih, 4) != 0) { - kdDebug(7034) << "Chunk ID error, expected avih, got: " << charbuf1 << "\n"; - return false; - } - - // read all the avih fields - dstream >> avih_microsecperframe; - dstream >> avih_maxbytespersec; - dstream >> avih_reserved1; - dstream >> avih_flags; - dstream >> avih_totalframes; - dstream >> avih_initialframes; - dstream >> avih_streams; - dstream >> avih_buffersize; - dstream >> avih_width; - dstream >> avih_height; - dstream >> avih_scale; - dstream >> avih_rate; - dstream >> avih_start; - dstream >> avih_length; - - done_avih = true; - - return true; -} - - -bool KAviPlugin::read_strl() -{ - static const char sig_strh[] = "strh"; - static const char sig_strf[] = "strf"; - //static const char sig_strd[] = "strd"; - static const char sig_strn[] = "strn"; - static const char sig_list[] = "LIST"; - static const char sig_junk[] = "JUNK"; - - kdDebug(7034) << "in strl handler\n"; - - uint32_t dwbuf1; // buffer for block sizes - char charbuf1[5]; - - // loop through blocks - int counter = 0; - while (true) { - - // read type and size - f.readBlock(charbuf1, 4); // type - dstream >> dwbuf1; // size - - // detect type - if (memcmp(charbuf1, sig_strh, 4) == 0) { - // got strh - stream header - kdDebug(7034) << "Found strh, calling read_strh()\n"; - read_strh(dwbuf1); - - } else if (memcmp(charbuf1, sig_strf, 4) == 0) { - // got strf - stream format - kdDebug(7034) << "Found strf, calling read_strf()\n"; - read_strf(dwbuf1); - - } else if (memcmp(charbuf1, sig_strn, 4) == 0) { - // we ignore strn, but it can be recorded incorrectly so we have to cope especially - - // skip it - kdDebug(7034) << "Skipping strn chunk length: " << dwbuf1 << "\n"; - f.at( f.at() + dwbuf1 ); - - /* - this is a pretty annoying hack; many AVIs incorrectly report the - length of the strn field by 1 byte. Its possible that strn's - should be word aligned, but no mention in the specs... - - I'll clean/optimise this a touch soon - */ - - bool done = false; - unsigned char counter = 0; - while (!done) { - // read next marker - f.readBlock(charbuf1, 4); - - // does it look ok? - if ((memcmp(charbuf1, sig_list, 4) == 0) || - (memcmp(charbuf1, sig_junk, 4) == 0)) { - // yes, go back before it - f.at( f.at() - 4); - done = true; - } else { - // no, skip one space forward from where we were - f.at( f.at() - 3); - kdDebug(7034) << "Working around incorrectly marked strn length..." << "\n"; - } - - // make sure we don't stay here too long - ++counter; - if (counter>10) - done = true; - } - - } else if ((memcmp(charbuf1, sig_list, 4) == 0) || (memcmp(charbuf1, sig_junk, 4) == 0)) { - // we have come to the end of our stay here in strl, time to leave - - kdDebug(7034) << "Found LIST/JUNK, returning...\n"; - - // rollback before the id and size - f.at( f.at() - 8 ); - - // return back to the main avi parser - return true; - - } else { - // we have some other unrecognised block type - - kdDebug(7034) << "Sskipping unrecognised block\n"; - // just skip over it - f.at( f.at() + dwbuf1); - - } /* switch block type */ - - ++counter; - if (counter > 10) - return true; - - } /* while (true) */ - - // we should never get here -} - - -bool KAviPlugin::read_strh(uint32_t blocksize) -{ - static const char sig_vids[] = "vids"; // ...video - static const char sig_auds[] = "auds"; // ...audio - - uint32_t strh_flags; - uint32_t strh_reserved1; - uint32_t strh_initialframes; - uint32_t strh_scale; - uint32_t strh_rate; - uint32_t strh_start; - uint32_t strh_length; - uint32_t strh_buffersize; - uint32_t strh_quality; - uint32_t strh_samplesize; - - char charbuf1[5]; - char charbuf2[5]; - - - // get stream info type, and handler id - f.readBlock(charbuf1, 4); - f.readBlock(charbuf2, 4); - - // read the strh fields - dstream >> strh_flags; - dstream >> strh_reserved1; - dstream >> strh_initialframes; - dstream >> strh_scale; - dstream >> strh_rate; - dstream >> strh_start; - dstream >> strh_length; - dstream >> strh_buffersize; - dstream >> strh_quality; - dstream >> strh_samplesize; - - if (memcmp(&charbuf1, sig_vids, 4) == 0) { - // we are video! - - // save the handler - memcpy(handler_vids, charbuf2, 4); - kdDebug(7034) << "Video handler: " << handler_vids << "\n"; - - - } else if (memcmp(&charbuf1, sig_auds, 4) == 0) { - // we are audio! - - // save the handler - memcpy(handler_auds, charbuf2, 4); - kdDebug(7034) << "Audio handler: " << handler_auds << "\n"; - - // we want strf to get the audio codec - wantstrf = true; - - } else { - // we are something that we don't understand - - } - - // do we need to skip ahead any more? (usually yes , contrary to - // the AVI specs I've read...) - // note: 48 is 10 * uint32_t + 2*FOURCC; the 10 fields we read above, plus the two character fields - if (blocksize > 48) - f.at( f.at() + (blocksize - 48) ); - - return true; -} - - -bool KAviPlugin::read_strf(uint32_t blocksize) -{ - // do we want to do the strf? - if (wantstrf) { - // yes. we want the audio codec identifier out of it - - // get the 16bit audio codec ID - dstream >> handler_audio; - kdDebug(7034) << "Read audio codec ID: " << handler_audio << "\n"; - // skip past the rest of the stuff here for now - f.at( f.at() + blocksize - 2); - // we have audio - done_audio = true; - - } else { - // no, skip the strf - f.at( f.at() + blocksize ); - } - - return true; -} - - - -const char * KAviPlugin::resolve_audio(uint16_t id) -{ - /* - this really wants to use some sort of KDE global - list. To avoid bloat for the moment it only does - a few common codecs - */ - - static const char codec_unknown[] = I18N_NOOP("Unknown"); - static const char codec_01[] = "Microsoft PCM"; - static const char codec_02[] = "Microsoft ADPCM"; - static const char codec_50[] = "MPEG"; - static const char codec_55[] = "MP3"; - static const char codec_92[] = "AC3"; - static const char codec_160[] = "WMA1"; - static const char codec_161[] = "WMA2"; - static const char codec_162[] = "WMA3"; - static const char codec_2000[] = "DVM"; - switch (id) { - case 0x000 : return codec_unknown; break; - case 0x001 : return codec_01; break; - case 0x002 : return codec_02; break; - case 0x050 : return codec_50; break; - case 0x055 : return codec_55; break; - case 0x092 : return codec_92; break; - case 0x160 : return codec_160; break; - case 0x161 : return codec_161; break; - case 0x162 : return codec_162; break; - case 0x2000 : return codec_2000; break; - default : return codec_unknown; - } - - return NULL; -} - - -bool KAviPlugin::readInfo( KFileMetaInfo& info, uint /*what*/) -{ - /***************************************************/ - // prep - - memset(handler_vids, 0x00, 5); - memset(handler_auds, 0x00, 5); - - - /***************************************************/ - // sort out the file - - if (f.isOpen()) - f.close(); - - if ( info.path().isEmpty() ) // remote file - return false; - - f.setName(info.path()); - - // open file, set up stream and set endianness - if (!f.open(IO_ReadOnly)) - { - kdDebug(7034) << "Couldn't open " << TQFile::encodeName(info.path()).data() << endl; - return false; - } - //TQDataStream dstream(&file); - dstream.setDevice(&f); - - dstream.setByteOrder(TQDataStream::LittleEndian); - - - /***************************************************/ - // start reading stuff from it - - wantstrf = false; - - if (!read_avi()) { - kdDebug(7034) << "read_avi() failed!" << endl; - } - - /***************************************************/ - // set up our output - - if (done_avih) { - - KFileMetaInfoGroup group = appendGroup(info, "Technical"); - - if (0 != avih_microsecperframe) { - appendItem(group, "Frame rate", int(1000000 / avih_microsecperframe)); - } - appendItem(group, "Resolution", TQSize(avih_width, avih_height)); - - // work out and add length - uint64_t mylength = (uint64_t) ((float) avih_totalframes * (float) avih_microsecperframe / 1000000.0); - appendItem(group, "Length", int(mylength)); - - - if (strlen(handler_vids) > 0) - appendItem(group, "Video codec", handler_vids); - else - appendItem(group, "Video codec", i18n("Unknown")); - - if (done_audio) - appendItem(group, "Audio codec", i18n(resolve_audio(handler_audio))); - else - appendItem(group, "Audio codec", i18n("None")); - - } - - f.close(); - return true; -} - -#include "kfile_avi.moc" diff --git a/kfile-plugins/avi/kfile_avi.desktop b/kfile-plugins/avi/kfile_avi.desktop deleted file mode 100644 index 9a3866e4..00000000 --- a/kfile-plugins/avi/kfile_avi.desktop +++ /dev/null @@ -1,68 +0,0 @@ -[Desktop Entry] -Type=Service -Name=AVI Info -Name[af]=Avi Inligting -Name[bg]=Информация за AVI -Name[bn]=এ-ভি-আই (AVI) তথ্য -Name[br]=Titouroù AVI -Name[bs]=AVI informacije -Name[ca]=Informació AVI -Name[cs]=AVI info -Name[cy]=Gwybodaeth AVI -Name[da]=AVI-info -Name[de]=AVI-Info -Name[el]=Πληροφορίες AVI -Name[eo]=AVI-informo -Name[es]=Info AVI -Name[et]=AVI info -Name[eu]=AVI informazioa -Name[fa]=اطلاعات AVI -Name[fi]=AVI-tiedot -Name[fr]=Informations AVI -Name[gl]=Información AVI -Name[he]=מידע AVI -Name[hi]=AVI जानकारी -Name[hr]=AVI Informacije -Name[hu]=AVI-jellemzők -Name[is]=AVI upplýsingar -Name[it]=Informazioni AVI -Name[ja]=AVI 情報 -Name[kk]=AVI мәліметі -Name[km]=ព័ត៌មាន AVI -Name[ko]=AVI 정보 -Name[lt]=AVI informacija -Name[mk]=AVI информации -Name[nb]=AVI informasjon -Name[nds]=AVI-Info -Name[ne]=AVI सूचना -Name[nl]=AVI-informatie -Name[nn]=AVI-info -Name[pa]=AVI ਜਾਣਕਾਰੀ -Name[pl]=Informacja o pliku AVI -Name[pt]=Informação do AVI -Name[pt_BR]=Informação sobre AVI -Name[ro]=Informaţii AVI -Name[ru]=Сведения о AVI -Name[se]=AVI-dieđut -Name[sk]=AVI info -Name[sl]=Podatki o AVI -Name[sr]=Информације о AVI-ју -Name[sr@Latn]=Informacije o AVI-ju -Name[sv]=Avi-information -Name[ta]=AVI தகவல் -Name[tg]=AVI Ахборот -Name[th]=ข้อมูล AVI -Name[tr]=AVI Bilgisi -Name[uk]=Інформація по AVI -Name[uz]=AVI haqida maʼlumot -Name[uz@cyrillic]=AVI ҳақида маълумот -Name[xh]=Ulwazi lwe AVI -Name[zh_CN]=AVI 信息 -Name[zh_HK]=AVI 資訊 -Name[zh_TW]=AVI 資訊 -Name[zu]=Ulwazi lwe-AVI -ServiceTypes=KFilePlugin -X-TDE-Library=kfile_avi -MimeType=video/x-msvideo -PreferredGrous=Technical -PreferredItems=Length,Resolution,Frame rate,Video codec,Audio codec diff --git a/kfile-plugins/avi/kfile_avi.h b/kfile-plugins/avi/kfile_avi.h deleted file mode 100644 index a19e44b6..00000000 --- a/kfile-plugins/avi/kfile_avi.h +++ /dev/null @@ -1,91 +0,0 @@ -/* This file is part of the KDE project - * Copyright (C) 2002 Shane Wright - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public - * License as published by the Free Software Foundation version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - * - */ - -#ifndef __KFILE_AVI_H__ -#define __KFILE_AVI_H__ - -#include -#include - -#if !defined(__osf__) -#include -#else -typedef unsigned short uint16_t; -typedef unsigned int uint32_t; -#endif - - - -class TQStringList; - -class KAviPlugin: public KFilePlugin -{ - Q_OBJECT - - -public: - KAviPlugin( TQObject *parent, const char *name, const TQStringList& args ); - - - - virtual bool readInfo( KFileMetaInfo& info, uint what); - -private: - - bool read_avi(); - bool read_list(); - bool read_avih(); - bool read_strl(); - - bool read_strf(uint32_t blocksize); - bool read_strh(uint32_t blocksize); - - // methods to sort out human readable names for the codecs - const char * resolve_audio(uint16_t id); - - TQFile f; - TQDataStream dstream; - - // AVI header information - bool done_avih; - uint32_t avih_microsecperframe; - uint32_t avih_maxbytespersec; - uint32_t avih_reserved1; - uint32_t avih_flags; - uint32_t avih_totalframes; - uint32_t avih_initialframes; - uint32_t avih_streams; - uint32_t avih_buffersize; - uint32_t avih_width; - uint32_t avih_height; - uint32_t avih_scale; - uint32_t avih_rate; - uint32_t avih_start; - uint32_t avih_length; - - char handler_vids[5]; // leave room for trailing \0 - char handler_auds[5]; - uint16_t handler_audio; // the ID of the audio codec - bool done_audio; - - bool wantstrf; - -}; - -#endif diff --git a/kfile-plugins/flac/Makefile.am b/kfile-plugins/flac/Makefile.am deleted file mode 100644 index 34a0ffb3..00000000 --- a/kfile-plugins/flac/Makefile.am +++ /dev/null @@ -1,22 +0,0 @@ -## Makefile.am for FLAC file meta info plugin - -# set the include path for X, qt, KDE and TagLib -INCLUDES = $(all_includes) $(taglib_includes) - -# these are the headers for your project -noinst_HEADERS = kfile_flac.h - -kde_module_LTLIBRARIES = kfile_flac.la - -kfile_flac_la_SOURCES = kfile_flac.cpp -kfile_flac_la_LDFLAGS = $(all_libraries) $(KDE_RPATH) $(LIB_QT) -lDCOP $(LIB_TDECORE) $(LIB_TDEUI) -ltdefx $(LIB_KIO) -ltdetexteditor $(taglib_libs) -module $(KDE_PLUGIN) -kfile_flac_la_LIBADD = $(LIB_KIO) - -# let automoc handle all of the meta source files (moc) -METASOURCES = AUTO - -messages: rc.cpp - $(XGETTEXT) kfile_flac.cpp -o $(podir)/kfile_flac.pot - -services_DATA = kfile_flac.desktop -servicesdir = $(kde_servicesdir) diff --git a/kfile-plugins/flac/configure.in.in b/kfile-plugins/flac/configure.in.in deleted file mode 100644 index eeaeebf5..00000000 --- a/kfile-plugins/flac/configure.in.in +++ /dev/null @@ -1 +0,0 @@ -AM_CONDITIONAL(include_flac_SUBDIR, test "x$have_taglib" = xyes) diff --git a/kfile-plugins/flac/kfile_flac.cpp b/kfile-plugins/flac/kfile_flac.cpp deleted file mode 100644 index c621f74c..00000000 --- a/kfile-plugins/flac/kfile_flac.cpp +++ /dev/null @@ -1,282 +0,0 @@ -/* This file is part of the KDE project - * Copyright (C) 2003-2004 Allan Sandfeld Jensen - * - * Originally based upon the kfile_ogg plugin: - * Copyright (C) 2001, 2002 Rolf Magnus - * Interfacing to TagLib is copied from kfile_mp3 plugin: - * Copyright (C) 2003 Scott Wheeler - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public - * License as published by the Free Software Foundation version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - */ - -#include "kfile_flac.h" - -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -#include -#if (TAGLIB_MAJOR_VERSION>1) || \ - ((TAGLIB_MAJOR_VERSION==1) && (TAGLIB_MINOR_VERSION>=2)) -#define TAGLIB_1_2 -#endif - -#include -#include -#include -#ifdef TAGLIB_1_2 -#include -#endif - -#include -#include -#include - -K_EXPORT_COMPONENT_FACTORY(kfile_flac, KGenericFactory("kfile_flac")) - -KFlacPlugin::KFlacPlugin( TQObject *parent, const char *name, - const TQStringList &args ) - : KFilePlugin( parent, name, args ) -{ - kdDebug(7034) << "flac plugin\n"; - - makeMimeTypeInfo( "audio/x-flac" ); -#ifdef TAGLIB_1_2 - makeMimeTypeInfo( "audio/x-oggflac" ); -#endif - -} - -void KFlacPlugin::makeMimeTypeInfo(const TQString& mimeType) -{ - KFileMimeTypeInfo* info = addMimeTypeInfo( mimeType ); - - KFileMimeTypeInfo::GroupInfo* group = 0; - - // comment group - group = addGroupInfo(info, "Comment", i18n("Comment")); - setAttributes(group, KFileMimeTypeInfo::Addable | - KFileMimeTypeInfo::Removable); - - KFileMimeTypeInfo::ItemInfo* item = 0; - - item = addItemInfo(group, "Artist", i18n("Artist"), TQVariant::String); - setHint(item, KFileMimeTypeInfo::Author); - setAttributes(item, KFileMimeTypeInfo::Modifiable); - - item = addItemInfo(group, "Title", i18n("Title"), TQVariant::String); - setHint(item, KFileMimeTypeInfo::Name); - setAttributes(item, KFileMimeTypeInfo::Modifiable); - - item = addItemInfo(group, "Album", i18n("Album"), TQVariant::String); - setAttributes(item, KFileMimeTypeInfo::Modifiable); - - item = addItemInfo(group, "Genre", i18n("Genre"), TQVariant::String); - setAttributes(item, KFileMimeTypeInfo::Modifiable); - - item = addItemInfo(group, "Tracknumber", i18n("Track Number"), TQVariant::String); - setAttributes(item, KFileMimeTypeInfo::Modifiable); - - item = addItemInfo(group, "Date", i18n("Date"), TQVariant::String); - setAttributes(item, KFileMimeTypeInfo::Modifiable); - - item = addItemInfo(group, "Description", i18n("Description"), TQVariant::String); - setAttributes(item, KFileMimeTypeInfo::Modifiable); - - item = addItemInfo(group, "Organization", i18n("Organization"), TQVariant::String); - setAttributes(item, KFileMimeTypeInfo::Modifiable); - - item = addItemInfo(group, "Location", i18n("Location"), TQVariant::String); - setAttributes(item, KFileMimeTypeInfo::Modifiable); - - item = addItemInfo(group, "Copyright", i18n("Copyright"), TQVariant::String); - setAttributes(item, KFileMimeTypeInfo::Modifiable); - - - addVariableInfo(group, TQVariant::String, KFileMimeTypeInfo::Addable | - KFileMimeTypeInfo::Removable | - KFileMimeTypeInfo::Modifiable); - - // technical group - group = addGroupInfo(info, "Technical", i18n("Technical Details")); - setAttributes(group, 0); - - addItemInfo(group, "Channels", i18n("Channels"), TQVariant::Int); - - item = addItemInfo(group, "Sample Rate", i18n("Sample Rate"), TQVariant::Int); - setSuffix(item, i18n(" Hz")); - - item = addItemInfo(group, "Sample Width", i18n("Sample Width"), TQVariant::Int); - setSuffix(item, i18n(" bits")); - - item = addItemInfo(group, "Bitrate", i18n("Average Bitrate"), - TQVariant::Int); - setAttributes(item, KFileMimeTypeInfo::Averaged); - setHint(item, KFileMimeTypeInfo::Bitrate); - setSuffix(item, i18n( " kbps")); - - item = addItemInfo(group, "Length", i18n("Length"), TQVariant::Int); - setAttributes(item, KFileMimeTypeInfo::Cummulative); - setHint(item, KFileMimeTypeInfo::Length); - setUnit(item, KFileMimeTypeInfo::Seconds); -} - -bool KFlacPlugin::readInfo( KFileMetaInfo& info, uint what ) -{ - if ( info.path().isEmpty() ) // remote file - return false; - - bool readComment = false; - bool readTech = false; - if (what & (KFileMetaInfo::Fastest | - KFileMetaInfo::DontCare | - KFileMetaInfo::ContentInfo)) readComment = true; - - if (what & (KFileMetaInfo::Fastest | - KFileMetaInfo::DontCare | - KFileMetaInfo::TechnicalInfo)) readTech = true; - - TagLib::File *file = 0; - - if (info.mimeType() == "audio/x-flac") - file = new TagLib::FLAC::File(TQFile::encodeName(info.path()).data(), readTech); -#ifdef TAGLIB_1_2 - else - file = new TagLib::Ogg::FLAC::File(TQFile::encodeName(info.path()).data(), readTech); -#endif - - if (!file || !file->isValid()) - { - kdDebug(7034) << "Couldn't open " << file->name() << endl; - delete file; - return false; - } - - if(readComment && file->tag()) - { - KFileMetaInfoGroup commentgroup = appendGroup(info, "Comment"); - - TQString date = file->tag()->year() > 0 ? TQString::number(file->tag()->year()) : TQString(); - TQString track = file->tag()->track() > 0 ? TQString::number(file->tag()->track()) : TQString(); - - appendItem(commentgroup, "Title", TQString(TStringToQString(file->tag()->title())).stripWhiteSpace()); - appendItem(commentgroup, "Artist", TQString(TStringToQString(file->tag()->artist())).stripWhiteSpace()); - appendItem(commentgroup, "Album", TQString(TStringToQString(file->tag()->album())).stripWhiteSpace()); - appendItem(commentgroup, "Date", date); - appendItem(commentgroup, "Comment", TQString(TStringToQString(file->tag()->comment())).stripWhiteSpace()); - appendItem(commentgroup, "Tracknumber", track); - appendItem(commentgroup, "Genre", TQString(TStringToQString(file->tag()->genre())).stripWhiteSpace()); - } - - if (readTech && file->audioProperties()) - { - KFileMetaInfoGroup techgroup = appendGroup(info, "Technical"); - TagLib::FLAC::Properties *properties = - (TagLib::FLAC::Properties*)(file->audioProperties()); - - appendItem(techgroup, "Bitrate", properties->bitrate()); - appendItem(techgroup, "Sample Rate", properties->sampleRate()); - appendItem(techgroup, "Sample Width", properties->sampleWidth()); - appendItem(techgroup, "Channels", properties->channels()); - appendItem(techgroup, "Length", properties->length()); - } - - delete file; - return true; - -} - -/** - * Do translation between KFileMetaInfo items and TagLib::String in a tidy way. - */ - -class Translator -{ -public: - Translator(const KFileMetaInfo &info) : m_info(info) {} - TagLib::String operator[](const char *key) const - { - return QStringToTString(m_info["Comment"][key].value().toString()); - } - int toInt(const char *key) const - { - return m_info["Comment"][key].value().toInt(); - } -private: - const KFileMetaInfo &m_info; -}; - -bool KFlacPlugin::writeInfo(const KFileMetaInfo& info) const -{ - TagLib::File *file; - - if (!TagLib::File::isWritable(TQFile::encodeName(info.path()).data())) { - kdDebug(7034) << "can't write to " << info.path() << endl; - return false; - } - - if (info.mimeType() == "audio/x-flac") - file = new TagLib::FLAC::File(TQFile::encodeName(info.path()).data(), false); -#ifdef TAGLIB_1_2 - else - file = new TagLib::Ogg::FLAC::File(TQFile::encodeName(info.path()).data(), false); -#endif - - if(!file->isOpen()) - { - kdDebug(7034) << "couldn't open " << info.path() << endl; - delete file; - return false; - } - - Translator t(info); - - file->tag()->setTitle(t["Title"]); - file->tag()->setArtist(t["Artist"]); - file->tag()->setAlbum(t["Album"]); - file->tag()->setYear(t.toInt("Date")); - file->tag()->setComment(t["Comment"]); - file->tag()->setTrack(t.toInt("Tracknumber")); - file->tag()->setGenre(t["Genre"]); - - file->save(); - - delete file; - return true; -} - -TQValidator* KFlacPlugin::createValidator( const TQString&, - const TQString &group, const TQString &key, - TQObject* parent, const char* name) const -{ - if(key == "Tracknumber" || key == "Date") - { - return new TQIntValidator(0, 9999, parent, name); - } - else - return new TQRegExpValidator(TQRegExp(".*"), parent, name); -} - -#include "kfile_flac.moc" diff --git a/kfile-plugins/flac/kfile_flac.desktop b/kfile-plugins/flac/kfile_flac.desktop deleted file mode 100644 index f4c65815..00000000 --- a/kfile-plugins/flac/kfile_flac.desktop +++ /dev/null @@ -1,62 +0,0 @@ -[Desktop Entry] -Type=Service -Name=FLAC Info -Name[bg]=Информация за FLAC -Name[bn]=ফ্ল্যাক (FLAC) তথ্য -Name[br]=Titouroù FLAC -Name[bs]=FLAC informacije -Name[ca]=Informació FLAC -Name[cs]=FLAC info -Name[cy]=Gwybodaeth FLAC -Name[da]=FLAC-Info -Name[de]=FLAC-Info -Name[el]=Πληροφορίες FLAC -Name[es]=Info FLAC -Name[et]=FLAC info -Name[eu]=FLAC Informazioa -Name[fa]=اطلاعات FLAC -Name[fi]=FLAC-tiedot -Name[fr]=Informations FLAC -Name[gl]=Información FLAC -Name[he]=מידע FLAC -Name[hi]=FLAC जानकारी -Name[hu]=FLAC-jellemzők -Name[is]=AU upplýsingar -Name[it]=Informazioni FLAC -Name[ja]=FLAC 情報 -Name[kk]=FLAC мәліметі -Name[km]=ព័ត៌មាន FLAC -Name[ko]=FLAC 정보 -Name[lt]=FLAC informacija -Name[mk]=FLAC информации -Name[nb]=FLAC informasjon -Name[nds]=FLAC-Info -Name[ne]=FLAC सूचना -Name[nl]=FLAC-informatie -Name[nn]=FLAC-info -Name[pa]=FLAC ਜਾਣਕਾਰੀ -Name[pl]=Informacja o pliku FLAC -Name[pt]=Informação do FLAC -Name[pt_BR]=Informação sobre FLAC -Name[ro]=Informaţii FLAC -Name[ru]=Сведения о FLAC -Name[sk]=FLAC info -Name[sl]=Podatki o FLAC -Name[sr]=Информације о FLAC-у -Name[sr@Latn]=Informacije o FLAC-u -Name[sv]=FLAC-information -Name[ta]=FLAC தகவல் -Name[tg]=FLAC Ахборот -Name[th]=ขอมูล FLAC -Name[tr]=FLAC Bilgisi -Name[uk]=Інформація по FLAC -Name[uz]=FLAC haqida maʼlumot -Name[uz@cyrillic]=FLAC ҳақида маълумот -Name[zh_CN]=FLAC 信息 -Name[zh_HK]=FLAC 資訊 -Name[zh_TW]=FLAC 資訊 -ServiceTypes=KFilePlugin -X-TDE-Library=kfile_flac -MimeType=audio/x-flac;audio/x-oggflac -PreferredGroups=Comment,Technical -PreferredItems=Title,Artist,Album,Tracknumber,Genre,Bitrate,Length,Channels, Date,Description,Organization,Location,Copyright diff --git a/kfile-plugins/flac/kfile_flac.h b/kfile-plugins/flac/kfile_flac.h deleted file mode 100644 index 08f283ae..00000000 --- a/kfile-plugins/flac/kfile_flac.h +++ /dev/null @@ -1,51 +0,0 @@ -/* This file is part of the KDE project - * Copyright (C) 2003 Allan Sandfeld Jensen - * - * Originally based upon the kfile_ogg plugin: - * Copyright (C) 2001, 2002 Rolf Magnus - * Interfacing to TagLib is copied from kfile_mp3 plugin: - * Copyright (C) 2003 Scott Wheeler - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public - * License as published by the Free Software Foundation version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - */ - -#ifndef __KFILE_FLAC_H__ -#define __KFILE_FLAC_H__ - -#include - -class TQString; -class TQStringList; - -class KFlacPlugin: public KFilePlugin -{ - Q_OBJECT - - -public: - KFlacPlugin( TQObject *parent, const char *name, const TQStringList& args ); - - virtual bool readInfo( KFileMetaInfo& info, uint what); - virtual bool writeInfo( const KFileMetaInfo& info ) const; - virtual TQValidator* createValidator( const TQString& mimetype, - const TQString &group, - const TQString &key, - TQObject* parent, const char* name) const; -protected: - virtual void makeMimeTypeInfo(const TQString& mimeType); -}; - - -#endif diff --git a/kfile-plugins/m3u/Makefile.am b/kfile-plugins/m3u/Makefile.am deleted file mode 100644 index 11b59685..00000000 --- a/kfile-plugins/m3u/Makefile.am +++ /dev/null @@ -1,22 +0,0 @@ -## Makefile.am for m3u file meta info plugin - -# set the include path for X, qt and KDE -INCLUDES = $(all_includes) - -# these are the headers for your project -noinst_HEADERS = kfile_m3u.h - -kde_module_LTLIBRARIES = kfile_m3u.la - -kfile_m3u_la_SOURCES = kfile_m3u.cpp -kfile_m3u_la_LDFLAGS = $(all_libraries) $(KDE_RPATH) $(LIB_QT) -lDCOP $(LIB_TDECORE) $(LIB_TDEUI) -ltdefx $(LIB_KIO) -ltdetexteditor -module $(KDE_PLUGIN) -kfile_m3u_la_LIBADD = $(LIB_KSYCOCA) - -# let automoc handle all of the meta source files (moc) -METASOURCES = AUTO - -messages: rc.cpp - $(XGETTEXT) kfile_m3u.cpp -o $(podir)/kfile_m3u.pot - -services_DATA = kfile_m3u.desktop -servicesdir = $(kde_servicesdir) diff --git a/kfile-plugins/m3u/kfile_m3u.cpp b/kfile-plugins/m3u/kfile_m3u.cpp deleted file mode 100644 index 5fff1a08..00000000 --- a/kfile-plugins/m3u/kfile_m3u.cpp +++ /dev/null @@ -1,87 +0,0 @@ -/* This file is part of the KDE project - * Copyright (C) 2001, 2002 Rolf Magnus - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public - * License as published by the Free Software Foundation version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - * - * $Id$ - */ - -#include "kfile_m3u.h" - -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -typedef KGenericFactory M3uFactory; - -K_EXPORT_COMPONENT_FACTORY( kfile_m3u, M3uFactory( "kfile_m3u" ) ) - -KM3uPlugin::KM3uPlugin( TQObject *parent, const char *name, - const TQStringList &preferredItems ) - : KFilePlugin( parent, name, preferredItems ) -{ - kdDebug(7034) << "m3u plugin\n"; - - KFileMimeTypeInfo* info = addMimeTypeInfo( "audio/x-mpegurl" ); - - KFileMimeTypeInfo::GroupInfo* group; - - // tracks group - group = addGroupInfo(info, "Tracks", i18n("Tracks")); - addVariableInfo(group, TQVariant::String, 0); -} - -bool KM3uPlugin::readInfo( KFileMetaInfo& info, uint ) -{ - if ( info.path().isEmpty() ) // remote file - return false; - - TQFile f(info.path()); - if (!f.open(IO_ReadOnly)) return false; - TQTextStream str(&f); - str.setEncoding(TQTextStream::Locale); - - - KFileMetaInfoGroup group = appendGroup(info, "Tracks"); - - // for now treat all lines that don't start with # like entries - int num = 1; - while (!str.atEnd()) - { - TQString s = str.readLine(); - if (!s.startsWith("#")) - { - if (s.endsWith("\n")) s.truncate(s.length()-1); - - if (!s.stripWhiteSpace().isEmpty()) { - appendItem(group, i18n("Track %1").arg(num, 3), s); - num++; - } - } - } - - return true; -} - -#include "kfile_m3u.moc" diff --git a/kfile-plugins/m3u/kfile_m3u.desktop b/kfile-plugins/m3u/kfile_m3u.desktop deleted file mode 100644 index b9478b85..00000000 --- a/kfile-plugins/m3u/kfile_m3u.desktop +++ /dev/null @@ -1,71 +0,0 @@ -[Desktop Entry] -Type=Service -Name=M3U Playlist Info -Name[af]=M3u Liedjielys Inligting -Name[ar]=معلومات قوائم M3U -Name[az]=MP3 Mahnı Siyahısı İnfosu -Name[bg]=Информация за списък M3U -Name[bn]=এম-৩-ইউ (M3U) সঙ্গীত-তালিকা তথ্য -Name[br]=Titouroù Rollc'hoari MP3 -Name[bs]=M3U Playlist informacije -Name[ca]=Informació de selecció de peces M3U -Name[cs]=Informace o seznamu skladeb M3U -Name[cy]=Gwybodaeth Rhestr Chwarae M3U -Name[da]=M3U-spillelisteinfo -Name[de]=M3U-Wiedergabelisten-Info -Name[el]=Πληροφορίες λίστας αναπαραγωγής M3U -Name[eo]=M3U-ludlistinformo -Name[es]=Información de lista de reproducción M3U -Name[et]=M3U esitusnimekirja info -Name[eu]=M3U erreprodukzio-zerrenda informazioa -Name[fa]=اطلاعات فهرست پخش M3U -Name[fi]=M3U-soittolistan tiedot -Name[fr]=Informations sur une liste de lecture M3U -Name[ga]=Eolas Seinmliosta M3U -Name[gl]=Información de Lista M3U -Name[he]=מידע על רשימות ניגון של M3U -Name[hi]=M3U गीत-सूची जानकारी -Name[hr]=Informacije o M3U listi pjesama -Name[hu]=Az M3U lejátszási lista jellemzői -Name[is]=M3U lagalistaupplýsingar -Name[it]=Informazioni playlist M3U -Name[ja]=M3U プレイリスト情報 -Name[kk]=M3U орындау тізім мәліметі -Name[km]=ព័ត៌មាន​បញ្ជី​ចាក់ M3U -Name[ko]=M3U 재생목록 정보 -Name[lt]=M3U gaidaraščio informacija -Name[lv]=M3U Plejlistu Info -Name[mk]=Информации за M3U листа со нумери -Name[nb]=M3U spilleliste informasjon -Name[nds]=M3U-Weddergaavlist-Info -Name[ne]=M3U बजाउने सूची सूचना -Name[nl]=M3U Speellijst-informatie -Name[nn]=M3U-spelelisteinfo -Name[pa]=M3U ਸੰਗੀਤ-ਸੂਚੀ ਜਾਣਕਾਰੀ -Name[pl]=Informacja o liście nagrań w M3U -Name[pt]=Informação da Lista de Músicas M3U -Name[pt_BR]=Informações de listas de reprodução M3U -Name[ro]=Informaţii listă M3U -Name[ru]=Сведения о списке песен M3U -Name[se]=M3U-čuojahanlistodieđut -Name[sk]=Informácie o playliste M3U -Name[sl]=Podatki o predvajalnem seznamu M3U -Name[sr]=Информације о M3U листи нумера -Name[sr@Latn]=Informacije o M3U listi numera -Name[sv]=Information om M3U-spellista -Name[ta]=M3U பாடல்பட்டியல் தகவல் -Name[tg]=M3U Ахбороти Рӯйхати бозикуниҳо -Name[th]=ข้อมูลรายการเพลง M3U -Name[tr]=M3U Çalma Listesi Bilgisi -Name[uk]=Інформація списку композицій M3U -Name[ven]=Mavhungo a mutevhe wa tshitambi tsha M3U -Name[xh]=M3U Ulwazi Loluhlu Lokudlala -Name[zh_CN]=M3U 播放列表信息 -Name[zh_HK]=M3U 播放清單資訊 -Name[zh_TW]=M3U 播放清單資訊 -Name[zu]=Ulwazi Lohlu lokudlala lwe-M3U -ServiceTypes=KFilePlugin -X-TDE-Library=kfile_m3u -MimeType=audio/x-mpegurl -PreferredGroups=Tracks -PreferredItems= diff --git a/kfile-plugins/m3u/kfile_m3u.h b/kfile-plugins/m3u/kfile_m3u.h deleted file mode 100644 index b8534ef3..00000000 --- a/kfile-plugins/m3u/kfile_m3u.h +++ /dev/null @@ -1,40 +0,0 @@ -/* This file is part of the KDE project - * Copyright (C) 2001, 2002 Rolf Magnus - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public - * License as published by the Free Software Foundation version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - * - * $Id$ - */ - -#ifndef __KMIME_M3U_H__ -#define __KMIME_M3U_H__ - -#include -#include - -class TQStringList; - -class KM3uPlugin: public KFilePlugin -{ - Q_OBJECT - - -public: - KM3uPlugin( TQObject *parent, const char *name, const TQStringList& args ); - - virtual bool readInfo( KFileMetaInfo& info, uint what ); -}; - -#endif diff --git a/kfile-plugins/mp3/Makefile.am b/kfile-plugins/mp3/Makefile.am deleted file mode 100644 index 0c238b67..00000000 --- a/kfile-plugins/mp3/Makefile.am +++ /dev/null @@ -1,22 +0,0 @@ -## Makefile.am for mp3 file meta info plugin - -# set the include path for X, qt and KDE -INCLUDES = $(all_includes) $(taglib_includes) - -# these are the headers for your project -noinst_HEADERS = kfile_mp3.h - -kde_module_LTLIBRARIES = kfile_mp3.la - -kfile_mp3_la_SOURCES = kfile_mp3.cpp -kfile_mp3_la_LDFLAGS = $(all_libraries) $(KDE_RPATH) $(LIB_QT) -lDCOP $(LIB_TDECORE) $(LIB_TDEUI) -ltdefx $(LIB_KIO) -ltdetexteditor $(taglib_libs) -module $(KDE_PLUGIN) -kfile_mp3_la_LIBADD = $(LIB_KIO) - -# let automoc handle all of the meta source files (moc) -METASOURCES = AUTO - -messages: rc.cpp - $(XGETTEXT) kfile_mp3.cpp -o $(podir)/kfile_mp3.pot - -services_DATA = kfile_mp3.desktop -servicesdir = $(kde_servicesdir) diff --git a/kfile-plugins/mp3/configure.in.in b/kfile-plugins/mp3/configure.in.in deleted file mode 100644 index d04bc223..00000000 --- a/kfile-plugins/mp3/configure.in.in +++ /dev/null @@ -1 +0,0 @@ -AM_CONDITIONAL(include_mp3_SUBDIR, test "x$have_taglib" = xyes) diff --git a/kfile-plugins/mp3/kfile_mp3.cpp b/kfile-plugins/mp3/kfile_mp3.cpp deleted file mode 100644 index f686147c..00000000 --- a/kfile-plugins/mp3/kfile_mp3.cpp +++ /dev/null @@ -1,307 +0,0 @@ -/* This file is part of the KDE project - * Copyright (C) 2001, 2002 Rolf Magnus - * Copyright (C) 2002 Ryan Cumming - * Copyright (C) 2003 Scott Wheeler - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public - * License as published by the Free Software Foundation version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - */ - -#include "config.h" - -#include "kfile_mp3.h" - -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -typedef KGenericFactory Mp3Factory; - -K_EXPORT_COMPONENT_FACTORY(kfile_mp3, Mp3Factory( "kfile_mp3" )) - -KMp3Plugin::KMp3Plugin(TQObject *parent, const char *name, const TQStringList &args) - : KFilePlugin(parent, name, args) -{ - kdDebug(7034) << "mp3 plugin\n"; - - KFileMimeTypeInfo *info = addMimeTypeInfo("audio/x-mp3"); - - // id3 group - - KFileMimeTypeInfo::GroupInfo *group = addGroupInfo(info, "id3", i18n("ID3 Tag")); - - setAttributes(group, KFileMimeTypeInfo::Addable | - KFileMimeTypeInfo::Removable); - - KFileMimeTypeInfo::ItemInfo *item; - - item = addItemInfo(group, "Title", i18n("Title"), TQVariant::String); - setAttributes(item, KFileMimeTypeInfo::Modifiable); - setHint(item, KFileMimeTypeInfo::Name); - - item = addItemInfo(group, "Artist", i18n("Artist"), TQVariant::String); - setAttributes(item, KFileMimeTypeInfo::Modifiable); - setHint(item, KFileMimeTypeInfo::Author); - - item = addItemInfo(group, "Album", i18n("Album"), TQVariant::String); - setAttributes(item, KFileMimeTypeInfo::Modifiable); - - item = addItemInfo(group, "Date", i18n("Year"), TQVariant::String); - setAttributes(item, KFileMimeTypeInfo::Modifiable); - - item = addItemInfo(group, "Comment", i18n("Comment"), TQVariant::String); - setAttributes(item, KFileMimeTypeInfo::Modifiable); - setHint(item, KFileMimeTypeInfo::Description); - - item = addItemInfo(group, "Tracknumber", i18n("Track"), TQVariant::Int); - setAttributes(item, KFileMimeTypeInfo::Modifiable); - - item = addItemInfo(group, "Genre", i18n("Genre"), TQVariant::String); - setAttributes(item, KFileMimeTypeInfo::Modifiable); - - // technical group - - group = addGroupInfo(info, "Technical", i18n("Technical Details")); - - item = addItemInfo(group, "Version", i18n("Version"), TQVariant::Int); - setPrefix(item, i18n("MPEG ")); - - item = addItemInfo(group, "Layer", i18n("Layer"), TQVariant::Int); - item = addItemInfo(group, "CRC", i18n("CRC"), TQVariant::Bool); - item = addItemInfo(group, "Bitrate", i18n("Bitrate"), TQVariant::Int); - setAttributes(item, KFileMimeTypeInfo::Averaged); - setHint(item, KFileMimeTypeInfo::Bitrate); - setSuffix(item, i18n(" kbps")); - - item = addItemInfo(group, "Sample Rate", i18n("Sample Rate"), TQVariant::Int); - setSuffix(item, i18n("Hz")); - - item = addItemInfo(group, "Channels", i18n("Channels"), TQVariant::Int); - item = addItemInfo(group, "Copyright", i18n("Copyright"), TQVariant::Bool); - item = addItemInfo(group, "Original", i18n("Original"), TQVariant::Bool); - item = addItemInfo(group, "Length", i18n("Length"), TQVariant::Int); - setAttributes(item, KFileMimeTypeInfo::Cummulative); - setUnit(item, KFileMimeTypeInfo::Seconds); - item = addItemInfo(group, "Emphasis", i18n("Emphasis"), TQVariant::String); -} - -bool KMp3Plugin::readInfo(KFileMetaInfo &info, uint what) -{ - kdDebug(7034) << "mp3 plugin readInfo\n"; - - bool readId3 = false; - bool readTech = false; - - typedef enum KFileMetaInfo::What What; - - if(what & (KFileMetaInfo::Fastest | - KFileMetaInfo::DontCare | - KFileMetaInfo::ContentInfo)) - { - readId3 = true; - } - - if(what & (KFileMetaInfo::Fastest | - KFileMetaInfo::DontCare | - KFileMetaInfo::TechnicalInfo)) - { - readTech = true; - } - - if(!readId3 && !readTech) - return true; - - if ( info.path().isEmpty() ) // remote file - return false; - - TagLib::MPEG::File file(TQFile::encodeName(info.path()).data(), readTech); - - if(!file.isOpen()) - { - kdDebug(7034) << "Couldn't open " << file.name() << endl; - return false; - } - - if(readId3) - { - KFileMetaInfoGroup id3group = appendGroup(info, "id3"); - - TQString date = file.tag()->year() > 0 ? TQString::number(file.tag()->year()) : TQString(); - TQString track = file.tag()->track() > 0 ? TQString::number(file.tag()->track()) : TQString(); - - TQString title = TQString(TStringToQString(file.tag()->title())).stripWhiteSpace(); - if (!title.isEmpty()) - appendItem(id3group, "Title", title); - TQString artist = TQString(TStringToQString(file.tag()->artist())).stripWhiteSpace(); - if (!artist.isEmpty()) - appendItem(id3group, "Artist", artist); - TQString album = TQString(TStringToQString(file.tag()->album())).stripWhiteSpace(); - if (!album.isEmpty()) - appendItem(id3group, "Album", album); - appendItem(id3group, "Date", date); - TQString comment = TQString(TStringToQString(file.tag()->comment())).stripWhiteSpace(); - if (!comment.isEmpty()) - appendItem(id3group, "Comment", comment); - appendItem(id3group, "Tracknumber", track); - TQString genre = TQString(TStringToQString(file.tag()->genre())).stripWhiteSpace(); - if (!genre.isEmpty()) - appendItem(id3group, "Genre", genre); - } - - if(readTech) - { - KFileMetaInfoGroup techgroup = appendGroup(info, "Technical"); - - TQString version; - switch(file.audioProperties()->version()) - { - case TagLib::MPEG::Header::Version1: - version = "1.0"; - break; - case TagLib::MPEG::Header::Version2: - version = "2.0"; - break; - case TagLib::MPEG::Header::Version2_5: - version = "2.5"; - break; - } - - static const int dummy = 0; // TQVariant's bool constructor requires a dummy int value. - - // CRC and Emphasis aren't yet implemented in TagLib (not that I think anyone cares) - - appendItem(techgroup, "Version", version); - appendItem(techgroup, "Layer", file.audioProperties()->layer()); - // appendItem(techgroup, "CRC", file.audioProperties()->crc()); - appendItem(techgroup, "Bitrate", file.audioProperties()->bitrate()); - appendItem(techgroup, "Sample Rate", file.audioProperties()->sampleRate()); - appendItem(techgroup, "Channels", file.audioProperties()->channels()); - appendItem(techgroup, "Copyright", TQVariant(file.audioProperties()->isCopyrighted(), dummy)); - appendItem(techgroup, "Original", TQVariant(file.audioProperties()->isOriginal(), dummy)); - appendItem(techgroup, "Length", file.audioProperties()->length()); - // appendItem(techgroup, "Emphasis", file.audioProperties()->empahsis()); - } - - kdDebug(7034) << "reading finished\n"; - - return true; -} - -/** - * Do translation between KFileMetaInfo items and TagLib::String in a tidy way. - */ - -class Translator -{ -public: - Translator(const KFileMetaInfo &info) : m_info(info) {} - TagLib::String operator[](const char *key) const - { - return QStringToTString(m_info["id3"][key].value().toString()); - } - int toInt(const char *key) const - { - return m_info["id3"][key].value().toInt(); - } -private: - const KFileMetaInfo &m_info; -}; - -bool KMp3Plugin::writeInfo(const KFileMetaInfo &info) const -{ - TagLib::ID3v2::FrameFactory::instance()->setDefaultTextEncoding(TagLib::String::UTF8); - TagLib::MPEG::File file(TQFile::encodeName(info.path()).data(), false); - - if(!file.isOpen() || !TagLib::File::isWritable(file.name())) - { - kdDebug(7034) << "couldn't open " << info.path() << endl; - return false; - } - - Translator t(info); - - file.tag()->setTitle(t["Title"]); - file.tag()->setArtist(t["Artist"]); - file.tag()->setAlbum(t["Album"]); - file.tag()->setYear(t.toInt("Date")); - file.tag()->setComment(t["Comment"]); - file.tag()->setTrack(t.toInt("Tracknumber")); - file.tag()->setGenre(t["Genre"]); - - file.save(); - - return true; -} - -/** - * A validator that will suggest a list of strings, but allow for free form - * strings as well. - */ - -class ComboValidator : public KStringListValidator -{ -public: - ComboValidator(const TQStringList &list, bool rejecting, - bool fixupEnabled, TQObject *parent, const char *name) : - KStringListValidator(list, rejecting, fixupEnabled, parent, name) - { - - } - - virtual TQValidator::State validate(TQString &, int &) const - { - return TQValidator::Acceptable; - } -}; - -TQValidator *KMp3Plugin::createValidator(const TQString & /* mimetype */, - const TQString &group, const TQString &key, - TQObject *parent, const char *name) const -{ - kdDebug(7034) << "making a validator for " << group << "/" << key << endl; - - if(key == "Tracknumber" || key == "Date") - { - return new TQIntValidator(0, 9999, parent, name); - } - - if(key == "Genre") - { - TQStringList l; - TagLib::StringList genres = TagLib::ID3v1::genreList(); - for(TagLib::StringList::ConstIterator it = genres.begin(); it != genres.end(); ++it) - { - l.append(TStringToQString((*it))); - } - return new ComboValidator(l, false, true, parent, name); - } - - return 0; -} - -#include "kfile_mp3.moc" diff --git a/kfile-plugins/mp3/kfile_mp3.desktop b/kfile-plugins/mp3/kfile_mp3.desktop deleted file mode 100644 index bec8dcff..00000000 --- a/kfile-plugins/mp3/kfile_mp3.desktop +++ /dev/null @@ -1,70 +0,0 @@ -[Desktop Entry] -Type=Service -Name=MP3 Info -Name[af]=Mp3 Inligting -Name[ar]=معلومات MP3 -Name[bg]=Информация за MP3 -Name[bn]=এম-পি-৩ (MP3) তথ্য -Name[br]=Titouroù MP3 -Name[bs]=MP3 informacije -Name[ca]=Informació MP3 -Name[cs]=MP3 info -Name[cy]=Gwybodaeth MP3 -Name[da]=MP3-info -Name[de]=MP3-Info -Name[el]=Πληροφορίες MP3 -Name[eo]=MP3-informo -Name[es]=Info MP3 -Name[et]=MP3 info -Name[eu]=MP3 informazioa -Name[fa]=اطلاعات MP3 -Name[fi]=MP3-tiedot -Name[fr]=Informations Mpeg3 -Name[gl]=Información MP3 -Name[he]=מידע MP3 -Name[hi]=MP3 जानकारी -Name[hr]=Informacije o MP3 datoteci -Name[hu]=MP3-jellemzők -Name[is]=MP3 upplýsingar -Name[it]=Informazioni MP3 -Name[ja]=MP3 情報 -Name[kk]=MP3 мәліметі -Name[km]=ព័ត៌មាន MP3 -Name[ko]=MP3 정보 -Name[lt]=MP3 informacija -Name[mk]=MP3 информации -Name[nb]=MP3 informasjon -Name[nds]=MP3-Info -Name[ne]=MP3 सूचना -Name[nl]=MP3-informatie -Name[nn]=MP3-info -Name[pa]=MP3 ਜਾਣਕਾਰੀ -Name[pl]=Informacja o pliku MP3 -Name[pt]=Informação do MP3 -Name[pt_BR]=Informações sobre MP3 -Name[ro]=Informaţii MP3 -Name[ru]=Сведения о MP3 -Name[rw]=Amakuru MP3 -Name[se]=MP3-dieđut -Name[sl]=Podatki o MP3 -Name[sr]=Информације о MP3-ју -Name[sr@Latn]=Informacije o MP3-ju -Name[sv]=MP3-information -Name[ta]=MP3 தகவல் -Name[tg]=MP3 Ахборот -Name[th]=ข้อมูล MP3 -Name[tr]=MP3 Bilgisi -Name[uk]=Інформація по MP3 -Name[uz]=MP3 haqida maʼlumot -Name[uz@cyrillic]=MP3 ҳақида маълумот -Name[wa]=Infôrmåcion MP3 -Name[xh]=MP3 ulwazi -Name[zh_CN]=MP3 信息 -Name[zh_HK]=MP3 資訊 -Name[zh_TW]=MP3 資訊 -Name[zu]=Ulwazi lwe-MP3 -ServiceTypes=KFilePlugin -X-TDE-Library=kfile_mp3 -MimeType=audio/x-mp3 -PreferredGroups=id3,Technical -PreferredItems=Title,Artist,Album,Tracknumber,Genre,Bitrate,Length,Date,Comment,Sample Rate,Channels,Version,Layer,Copyright,Original,CRC diff --git a/kfile-plugins/mp3/kfile_mp3.h b/kfile-plugins/mp3/kfile_mp3.h deleted file mode 100644 index e913db2a..00000000 --- a/kfile-plugins/mp3/kfile_mp3.h +++ /dev/null @@ -1,42 +0,0 @@ -/* This file is part of the KDE project - * Copyright (C) 2001, 2002 Rolf Magnus - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public - * License as published by the Free Software Foundation version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - */ - -#ifndef __KFILE_MP3_H__ -#define __KFILE_MP3_H__ - -#include - -class TQStringList; - -class KMp3Plugin: public KFilePlugin -{ - Q_OBJECT - - -public: - KMp3Plugin(TQObject *parent, const char *name, const TQStringList &args); - - virtual bool readInfo( KFileMetaInfo& info, uint what ); - virtual bool writeInfo( const KFileMetaInfo& info) const; - virtual TQValidator *createValidator(const TQString &mimetype, - const TQString &group, - const TQString &key, - TQObject *parent, const char *name) const; -}; - -#endif diff --git a/kfile-plugins/mpc/Makefile.am b/kfile-plugins/mpc/Makefile.am deleted file mode 100644 index 11a639e7..00000000 --- a/kfile-plugins/mpc/Makefile.am +++ /dev/null @@ -1,22 +0,0 @@ -## Makefile.am for MPC file meta info plugin - -# set the include path for X, qt, KDE and TagLib -INCLUDES = $(all_includes) $(taglib_includes) - -# these are the headers for your project -noinst_HEADERS = kfile_mpc.h - -kde_module_LTLIBRARIES = kfile_mpc.la - -kfile_mpc_la_SOURCES = kfile_mpc.cpp -kfile_mpc_la_LDFLAGS = $(all_libraries) $(KDE_RPATH) $(LIB_QT) -lDCOP $(LIB_TDECORE) $(LIB_TDEUI) -ltdefx $(LIB_KIO) -ltdetexteditor $(taglib_libs) -module $(KDE_PLUGIN) -kfile_mpc_la_LIBADD = $(LIB_KIO) - -# let automoc handle all of the meta source files (moc) -METASOURCES = AUTO - -messages: rc.cpp - $(XGETTEXT) kfile_mpc.cpp -o $(podir)/kfile_mpc.pot - -services_DATA = kfile_mpc.desktop -servicesdir = $(kde_servicesdir) diff --git a/kfile-plugins/mpc/configure.in.in b/kfile-plugins/mpc/configure.in.in deleted file mode 100644 index 6590e6c5..00000000 --- a/kfile-plugins/mpc/configure.in.in +++ /dev/null @@ -1 +0,0 @@ -AM_CONDITIONAL(include_mpc_SUBDIR, test "x$have_taglib_mpc" = xyes) diff --git a/kfile-plugins/mpc/kfile_mpc.cpp b/kfile-plugins/mpc/kfile_mpc.cpp deleted file mode 100644 index 830feb54..00000000 --- a/kfile-plugins/mpc/kfile_mpc.cpp +++ /dev/null @@ -1,253 +0,0 @@ -/* This file is part of the KDE project - * Copyright (C) 2003-2004 Allan Sandfeld Jensen - * - * Originally based upon the kfile_ogg plugin: - * Copyright (C) 2001, 2002 Rolf Magnus - * Interfacing to TagLib is copied from kfile_mp3 plugin: - * Copyright (C) 2003 Scott Wheeler - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public - * License as published by the Free Software Foundation version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - */ - -#include "kfile_mpc.h" - -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -#include -#include -#include - -K_EXPORT_COMPONENT_FACTORY(kfile_mpc, KGenericFactory("kfile_mpc")) - -KMpcPlugin::KMpcPlugin( TQObject *parent, const char *name, - const TQStringList &args ) - : KFilePlugin( parent, name, args ) -{ - kdDebug(7034) << "mpc plugin\n"; - - KFileMimeTypeInfo* info = addMimeTypeInfo( "audio/x-musepack" ); - - KFileMimeTypeInfo::GroupInfo* group = 0; - - // comment group - group = addGroupInfo(info, "Comment", i18n("Comment")); - setAttributes(group, KFileMimeTypeInfo::Addable | - KFileMimeTypeInfo::Removable); - - KFileMimeTypeInfo::ItemInfo* item = 0; - - item = addItemInfo(group, "Artist", i18n("Artist"), TQVariant::String); - setHint(item, KFileMimeTypeInfo::Author); - setAttributes(item, KFileMimeTypeInfo::Modifiable); - - item = addItemInfo(group, "Title", i18n("Title"), TQVariant::String); - setHint(item, KFileMimeTypeInfo::Name); - setAttributes(item, KFileMimeTypeInfo::Modifiable); - - item = addItemInfo(group, "Album", i18n("Album"), TQVariant::String); - setAttributes(item, KFileMimeTypeInfo::Modifiable); - - item = addItemInfo(group, "Genre", i18n("Genre"), TQVariant::String); - setAttributes(item, KFileMimeTypeInfo::Modifiable); - - item = addItemInfo(group, "Tracknumber", i18n("Track Number"), TQVariant::String); - setAttributes(item, KFileMimeTypeInfo::Modifiable); - - item = addItemInfo(group, "Date", i18n("Date"), TQVariant::String); - setAttributes(item, KFileMimeTypeInfo::Modifiable); - - item = addItemInfo(group, "Description", i18n("Description"), TQVariant::String); - setAttributes(item, KFileMimeTypeInfo::Modifiable); - - item = addItemInfo(group, "Organization", i18n("Organization"), TQVariant::String); - setAttributes(item, KFileMimeTypeInfo::Modifiable); - - item = addItemInfo(group, "Location", i18n("Location"), TQVariant::String); - setAttributes(item, KFileMimeTypeInfo::Modifiable); - - item = addItemInfo(group, "Copyright", i18n("Copyright"), TQVariant::String); - setAttributes(item, KFileMimeTypeInfo::Modifiable); - - - addVariableInfo(group, TQVariant::String, KFileMimeTypeInfo::Addable | - KFileMimeTypeInfo::Removable | - KFileMimeTypeInfo::Modifiable); - - // technical group - group = addGroupInfo(info, "Technical", i18n("Technical Details")); - setAttributes(group, 0); - - addItemInfo(group, "Channels", i18n("Channels"), TQVariant::Int); - - addItemInfo(group, "Version", i18n("Version"), TQVariant::Int); - - item = addItemInfo(group, "Sample Rate", i18n("Sample Rate"), TQVariant::Int); - setSuffix(item, i18n(" Hz")); - - item = addItemInfo(group, "Bitrate", i18n("Average Bitrate"), - TQVariant::Int); - setAttributes(item, KFileMimeTypeInfo::Averaged); - setHint(item, KFileMimeTypeInfo::Bitrate); - setSuffix(item, i18n( " kbps")); - - item = addItemInfo(group, "Length", i18n("Length"), TQVariant::Int); - setAttributes(item, KFileMimeTypeInfo::Cummulative); - setHint(item, KFileMimeTypeInfo::Length); - setUnit(item, KFileMimeTypeInfo::Seconds); -} - -bool KMpcPlugin::readInfo( KFileMetaInfo& info, uint what ) -{ - - bool readComment = false; - bool readTech = false; - if (what & (KFileMetaInfo::Fastest | - KFileMetaInfo::DontCare | - KFileMetaInfo::ContentInfo)) readComment = true; - - if (what & (KFileMetaInfo::Fastest | - KFileMetaInfo::DontCare | - KFileMetaInfo::TechnicalInfo)) readTech = true; - - if ( info.path().isEmpty() ) // remote file - return false; - - TagLib::File *file = new TagLib::MPC::File(TQFile::encodeName(info.path()).data(), readTech); - - if (!file->isOpen()) - { - kdDebug(7034) << "Couldn't open " << file->name() << endl; - delete file; - return false; - } - - if(readComment) - { - KFileMetaInfoGroup commentgroup = appendGroup(info, "Comment"); - - TQString date = file->tag()->year() > 0 ? TQString::number(file->tag()->year()) : TQString(); - TQString track = file->tag()->track() > 0 ? TQString::number(file->tag()->track()) : TQString(); - - appendItem(commentgroup, "Title", TQString(TStringToQString(file->tag()->title())).stripWhiteSpace()); - appendItem(commentgroup, "Artist", TQString(TStringToQString(file->tag()->artist())).stripWhiteSpace()); - appendItem(commentgroup, "Album", TQString(TStringToQString(file->tag()->album())).stripWhiteSpace()); - appendItem(commentgroup, "Date", date); - appendItem(commentgroup, "Comment", TQString(TStringToQString(file->tag()->comment())).stripWhiteSpace()); - appendItem(commentgroup, "Tracknumber", track); - appendItem(commentgroup, "Genre", TQString(TStringToQString(file->tag()->genre())).stripWhiteSpace()); - } - - if (readTech) - { - KFileMetaInfoGroup techgroup = appendGroup(info, "Technical"); - TagLib::MPC::Properties *properties = - (TagLib::MPC::Properties*)(file->audioProperties()); - - appendItem(techgroup, "Bitrate", properties->bitrate()); - appendItem(techgroup, "Sample Rate", properties->sampleRate()); - appendItem(techgroup, "Channels", properties->channels()); - appendItem(techgroup, "Length", properties->length()); - appendItem(techgroup, "Version", properties->mpcVersion()); - } - - delete file; - return true; - -} - -/** - * Do translation between KFileMetaInfo items and TagLib::String in a tidy way. - */ - -class Translator -{ -public: - Translator(const KFileMetaInfo &info) : m_info(info) {} - TagLib::String operator[](const char *key) const - { - return QStringToTString(m_info["Comment"][key].value().toString()); - } - int toInt(const char *key) const - { - return m_info["Comment"][key].value().toInt(); - } -private: - const KFileMetaInfo &m_info; -}; - -bool KMpcPlugin::writeInfo(const KFileMetaInfo& info) const -{ - TagLib::File *file; - - if (!TagLib::File::isWritable(TQFile::encodeName(info.path()).data())) { - kdDebug(7034) << "can't write to " << info.path() << endl; - return false; - } - - file = new TagLib::MPC::File(TQFile::encodeName(info.path()).data(), false); - - if(!file->isOpen()) - { - kdDebug(7034) << "couldn't open " << info.path() << endl; - delete file; - return false; - } - - Translator t(info); - - file->tag()->setTitle(t["Title"]); - file->tag()->setArtist(t["Artist"]); - file->tag()->setAlbum(t["Album"]); - file->tag()->setYear(t.toInt("Date")); - file->tag()->setComment(t["Comment"]); - file->tag()->setTrack(t.toInt("Tracknumber")); - file->tag()->setGenre(t["Genre"]); - - file->save(); - - delete file; - return true; -} - -TQValidator* KMpcPlugin::createValidator( const TQString&, - const TQString &group, const TQString &key, - TQObject* parent, const char* name) const -{ - if(key == "Tracknumber" || key == "Date") - { - return new TQIntValidator(0, 9999, parent, name); - } - else - return new TQRegExpValidator(TQRegExp(".*"), parent, name); -} - -#include "kfile_mpc.moc" diff --git a/kfile-plugins/mpc/kfile_mpc.desktop b/kfile-plugins/mpc/kfile_mpc.desktop deleted file mode 100644 index f2dceec0..00000000 --- a/kfile-plugins/mpc/kfile_mpc.desktop +++ /dev/null @@ -1,56 +0,0 @@ -[Desktop Entry] -Type=Service -Name=Musepack Info -Name[bg]=Информация за Musepack -Name[br]=Titouroù Musepack -Name[bs]=Musepack informacije -Name[ca]=Informació Musepack -Name[cs]=Musepack info -Name[de]=Musepack-Info -Name[el]=Πληροφορίες Musepack -Name[eo]=epack-informo -Name[es]=Info Musepack -Name[et]=Musepacki info -Name[eu]=Musepack informazioa -Name[fa]=اطلاعات Musepack -Name[fi]=Musepack-tiedot -Name[fr]=Informations Musepack -Name[ga]=Eolas faoi Musepack -Name[gl]=Información Musepack -Name[he]=מידע Musepack -Name[hu]=Musepack-jellemzők -Name[is]=Musepack upplýsingar -Name[it]=Informazioni Musepack -Name[ja]=Musepack 情報 -Name[kk]=Musepack мәліметі -Name[km]=ព័ត៌មាន Musepack -Name[ko]=Musepack 정보 -Name[lt]=Musepack informacija -Name[mk]=Musepack информации -Name[nb]=Musepack-info -Name[nds]=Musepack-Info -Name[ne]=म्युजप्याक सूचना -Name[nl]=Musepack-informatie -Name[nn]=Musepack-info -Name[pa]=Musepack ਜਾਣਕਾਰੀ -Name[pl]=Informacja Musepack -Name[pt]=Informação do Musepack -Name[pt_BR]=Informações sobre Musepack -Name[ro]=Informaţii Musepack -Name[ru]=Сведения о Musepack -Name[sl]=Podatki o Musepack -Name[sr]=Информације о Musepack-у -Name[sr@Latn]=Informacije o Musepack-u -Name[sv]=Musepack-information -Name[ta]=MP3 தகவல் -Name[th]=ข้อมูล Musepack -Name[tr]=MusePack Bilgisi -Name[uk]=Інформація по Musepack -Name[zh_CN]=Musepack 信息 -Name[zh_HK]=Musepack 資訊 -Name[zh_TW]=Musepack 資訊 -ServiceTypes=KFilePlugin -X-TDE-Library=kfile_mpc -MimeType=audio/x-musepack -PreferredGroups=Comment,Technical -PreferredItems=Title,Artist,Album,Tracknumber,Genre,Bitrate,Length,Channels, Date,Description,Organization,Location,Copyright diff --git a/kfile-plugins/mpc/kfile_mpc.h b/kfile-plugins/mpc/kfile_mpc.h deleted file mode 100644 index c37fa953..00000000 --- a/kfile-plugins/mpc/kfile_mpc.h +++ /dev/null @@ -1,49 +0,0 @@ -/* This file is part of the KDE project - * Copyright (C) 2004 Allan Sandfeld Jensen - * - * Originally based upon the kfile_ogg plugin: - * Copyright (C) 2001, 2002 Rolf Magnus - * Interfacing to TagLib is copied from kfile_mp3 plugin: - * Copyright (C) 2003 Scott Wheeler - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public - * License as published by the Free Software Foundation version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - */ - -#ifndef __KFILE_MPC_H__ -#define __KFILE_MPC_H__ - -#include - -class TQString; -class TQStringList; - -class KMpcPlugin: public KFilePlugin -{ - Q_OBJECT - - -public: - KMpcPlugin( TQObject *parent, const char *name, const TQStringList& args ); - - virtual bool readInfo( KFileMetaInfo& info, uint what); - virtual bool writeInfo( const KFileMetaInfo& info ) const; - virtual TQValidator* createValidator( const TQString& mimetype, - const TQString &group, - const TQString &key, - TQObject* parent, const char* name) const; -}; - - -#endif diff --git a/kfile-plugins/mpeg/Makefile.am b/kfile-plugins/mpeg/Makefile.am deleted file mode 100644 index 00b40647..00000000 --- a/kfile-plugins/mpeg/Makefile.am +++ /dev/null @@ -1,22 +0,0 @@ -## Makefile.am for mpeg file meta info plugin - -# set the include path for X, qt and KDE -INCLUDES = $(all_includes) - -# these are the headers for your project -noinst_HEADERS = kfile_mpeg.h - -kde_module_LTLIBRARIES = kfile_mpeg.la - -kfile_mpeg_la_SOURCES = kfile_mpeg.cpp -kfile_mpeg_la_LDFLAGS = $(all_libraries) $(KDE_RPATH) $(LIB_QT) -lDCOP $(LIB_TDECORE) $(LIB_TDEUI) -ltdefx $(LIB_KIO) -ltdetexteditor -module $(KDE_PLUGIN) -kfile_mpeg_la_LIBADD = $(LIB_KIO) - -# let automoc handle all of the meta source files (moc) -METASOURCES = AUTO - -messages: rc.cpp - $(XGETTEXT) kfile_mpeg.cpp -o $(podir)/kfile_mpeg.pot - -services_DATA = kfile_mpeg.desktop -servicesdir = $(kde_servicesdir) diff --git a/kfile-plugins/mpeg/kfile_mpeg.cpp b/kfile-plugins/mpeg/kfile_mpeg.cpp deleted file mode 100644 index 4d51f64d..00000000 --- a/kfile-plugins/mpeg/kfile_mpeg.cpp +++ /dev/null @@ -1,582 +0,0 @@ -/* This file is part of the KDE project - * Copyright (C) 2005 Allan Sandfeld Jensen - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public - * License as published by the Free Software Foundation version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - * - */ - -// MPEG KFile plugin -// Based on reading sourcecode of mpeglib, xinelib and libmpeg3 -// and studying MPEG dumps. - -#include -#include "kfile_mpeg.h" - -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -// #include - -typedef unsigned char uint8_t; -typedef unsigned short uint16_t; -typedef unsigned int uint32_t; - -typedef KGenericFactory MpegFactory; - -K_EXPORT_COMPONENT_FACTORY(kfile_mpeg, MpegFactory( "kfile_mpeg" )) - -KMpegPlugin::KMpegPlugin(TQObject *parent, const char *name, - const TQStringList &args) - - : KFilePlugin(parent, name, args) -{ - KFileMimeTypeInfo* info = addMimeTypeInfo( "video/mpeg" ); - - KFileMimeTypeInfo::GroupInfo* group = 0L; - - group = addGroupInfo(info, "Technical", i18n("Technical Details")); - - KFileMimeTypeInfo::ItemInfo* item; - - item = addItemInfo(group, "Length", i18n("Length"), TQVariant::Int); - setUnit(item, KFileMimeTypeInfo::Seconds); - - item = addItemInfo(group, "Resolution", i18n("Resolution"), TQVariant::Size); - - item = addItemInfo(group, "Frame rate", i18n("Frame Rate"), TQVariant::Double); - setSuffix(item, i18n("fps")); - - item = addItemInfo(group, "Video codec", i18n("Video Codec"), TQVariant::String); - item = addItemInfo(group, "Audio codec", i18n("Audio Codec"), TQVariant::String); - - item = addItemInfo(group, "Aspect ratio", i18n("Aspect ratio"), TQVariant::String); -} - -// Frame-rate table from libmpeg3 -float frame_rate_table[16] = -{ - 0.0, /* Pad */ - (float)24000.0/1001.0, /* Official frame rates */ - (float)24.0, - (float)25.0, - (float)30000.0/1001.0, - (float)30.0, - (float)50.0, - (float)60000.0/1001.0, - (float)60.0, - - 1, /* Unofficial economy rates */ - 5, - 10, - 12, - 15, - 0, - 0, -}; - -/* Bitrate indexes */ -int bitrate_123[3][16] = - { {0,32,64,96,128,160,192,224,256,288,320,352,384,416,448,}, - {0,32,48,56, 64, 80, 96,112,128,160,192,224,256,320,384,}, - {0,32,40,48, 56, 64, 80, 96,112,128,160,192,224,256,320,} }; - -static const uint16_t sequence_start = 0x01b3; -static const uint16_t ext_sequence_start = 0x01b5; -static const uint16_t gop_start = 0x01b8; -static const uint16_t audio1_packet = 0x01c0; -static const uint16_t audio2_packet = 0x01d0; -static const uint16_t private1_packet = 0x01bd; -static const uint16_t private2_packet = 0x01bf; - -int KMpegPlugin::parse_seq() { - uint32_t buf; - dstream >> buf; - - horizontal_size = (buf >> 20); - vertical_size = (buf >> 8) & ((1<<12)-1); - aspect_ratio = (buf >> 4) & ((1<<4)-1); - int framerate_code = buf & ((1<<4)-1); - frame_rate = frame_rate_table[framerate_code]; - - dstream >> buf; - - bitrate = (buf >> 14); -// kdDebug(7034) << "bitrate: " << bitrate << endl; - bool has_intra_matrix = buf & 2; - bool has_non_intra_matrix = buf & 1; - - int matrix = 0; - if (has_intra_matrix) matrix +=64; - if (has_non_intra_matrix) matrix +=64; - - mpeg = 1; - return matrix; -} - -void KMpegPlugin::parse_seq_ext() { - uint32_t buf; - dstream >> buf; - - uint8_t type = buf >> 28; - if (type == 1) - mpeg = 2; - - /* - else - if (type == 2) { - dstream >> buf; - // These are display-sizes. I let them override physical sizes. - horizontal_size = (buf >> 18); - vertical_size = (buf >> 1) & ((1<<14)-1); -} */ -} - -long KMpegPlugin::parse_gop() { - uint32_t buf; - dstream >> buf; - dstream >> buf; - - int gop_hour = (buf>>26) & ((1<<5)-1); - kdDebug(7034) << "gop_hour: " << gop_hour << endl; - int gop_minute = (buf>>20) & ((1<<6)-1); - kdDebug(7034) << "gop_minute: " << gop_minute << endl; - int gop_second = (buf>>13) & ((1<<6)-1); - kdDebug(7034) << "gop_second: " << gop_second << endl; - int gop_frame = (buf>>7) & ((1<<6)-1); - kdDebug(7034) << "gop_frame: " << gop_frame << endl; - - long seconds = gop_hour*60*60 + gop_minute*60 + gop_second; - return (long)seconds; -} - -int KMpegPlugin::parse_audio() { - uint16_t len; - dstream >> len; -// kdDebug(7034) << "Length of audio packet: " << len << endl; - - uint8_t buf; - int i = 0; - for(i=0; i<20; i++) { - dstream >> buf; - if (buf == 0xff) { - dstream >> buf; - if ((buf & 0xe0) == 0xe0) - goto found_sync; - } - } - kdDebug(7034) << "MPEG audio sync not found" << endl; - return len-i; - -found_sync: - - int layer = ((buf >> 1) & 0x3); - if (layer == 1) - audio_type = 3; - else if (layer == 2) - audio_type = 2; - else if (layer == 3) - audio_type = 1; - else - kdDebug(7034) << "Invalid MPEG audio layer" << endl; - - dstream >> buf; - int bitrate_index = (buf & 0xf0) >> 4; - audio_rate = bitrate_123[3-layer][bitrate_index]; - - return len-3-i; -} - -int KMpegPlugin::skip_packet() { - uint16_t len; - dstream >> len; -// kdDebug(7034) << "Length of skipped packet: " << len << endl; - - return len; -} - -int KMpegPlugin::skip_riff_chunk() { - dstream.setByteOrder(TQDataStream::LittleEndian); - uint32_t len; - dstream >> len; -// std::cerr << "Length of skipped chunk: " << len << std::endl; - - dstream.setByteOrder(TQDataStream::BigEndian); - return len; -} - -int KMpegPlugin::parse_private() { - uint16_t len; - dstream >> len; -// kdDebug(7034) << "Length of private packet: " << len << endl; - - // Match AC3 packets - uint8_t subtype; - dstream >> subtype; - subtype = subtype >> 4; - if (subtype == 8) // AC3 - audio_type = 5; - else - if (subtype == 10) // LPCM - audio_type = 7; - - return len-1; -} - -bool KMpegPlugin::find_mpeg_in_cdxa() -{ - int skip_len = 0; - uint32_t magic; - uint32_t data_len; - // search for data chunk - while (true) { - dstream >> magic; - if (magic != 0x64617461) { // "fmt " - skip_len = skip_riff_chunk(); - if (!file.at(file.at()+skip_len)) return false; - continue; - } else { - // size of chunk - dstream >> data_len; - int block = 0; - // search for mpeg part - while(block < 32) { - // check for CDXA sync thingy - dstream >> magic; - // 00 ff ff ff ff ff ff ff ff ff ff ff 00 - if (magic == 0x00ffffff) { -// std::cerr << "Found CD sync" << std::endl; - // skip 20 bytes - if (!file.at(file.at()+20)) return false; - dstream >> magic; - if (magic == 0x000001ba) { -// std::cerr << "Found CDXA mpeg" << std::endl; - return true; - } - else { -// std::cerr << "CDXA block: #" <> magic; - if (magic == 0x52494646) // == "RIFF" - { - dstream >> magic; - dstream >> magic; - if (magic != 0x43445841) { // 0x43445841 == "CDXA" - kdDebug(7034) << "Unknown RIFF file" << endl; - return false; - } else { - if (!find_mpeg_in_cdxa()) return false; - } - } - else - if (magic != 0x000001ba) { - kdDebug(7034) << "Not a MPEG-PS file" << endl; - return false; - } -// file.at(0); - - uint8_t byte; - int skip_len = 0; - int state = 0; - int skimmed = 0; - int video_len = 0; - int searched = 0; - bool video_found = false, audio_found = false, gop_found = false; - // Search for MPEG packets - for(int i=0; i < 2048; i++) { - dstream >> byte; - skimmed++; - searched++; - if (video_len > 0) video_len--; - // Use a fast state machine to find 00 00 01 sync code - switch (state) { - case 0: - if (byte == 0) - state = 1; - else - state = 0; - break; - case 1: - if (byte == 0) - state = 2; - else - state = 0; - break; - case 2: - if (byte == 0) - state = 2; - else - if (byte == 1) - state = 3; - else - state = 0; - break; - case 3: { - skimmed -= 4; - if (skimmed) { -// kdDebug(7034) << "Bytes skimmed:" << skimmed << endl; - skimmed = 0; - } -// kdDebug(7034) << "Packet of type:" << TQString::number(byte,16) << endl; - switch (byte) { - case 0xb3: - if (video_found) break; - skip_len = parse_seq(); - video_found = true; - video_len -= 8; - video_len -= skip_len; - break; - case 0xb5: - parse_seq_ext(); - video_len -= 4; - break; - case 0xb8: - /* - if (!gop_found) { - start_time = parse_gop(); - gop_found = true; - kdDebug(7034) << "start_time: " << start_time << endl; - } - */ - /* nobreak */ - case 0x00: - case 0x01: - // skip the rest of the video data - if (video_len > 0 && video_found) - skip_len = video_len; - break; - /* - case 0xb2: - skip_len = parse_user(); - break; - */ - case 0xba: - skip_len = 8; - break; - case 0xbe: - // padding - skip_len = skip_packet(); - break; - case 0xe0: - // video data - if (video_found) - skip_len = skip_packet(); - else - video_len = skip_packet(); - break; - case 0xbd: - case 0xbf: - skip_len = parse_private(); - break; - case 0xc0: - case 0xd0: - skip_len = parse_audio(); - audio_found = true; - break; - default: -// kdDebug(7034) << "Unhandled packet of type:" << TQString::number(byte,16) << endl; - break; - } - state = 0; - break; - } - } - - if (video_found && audio_found /*&& gop_found*/) break; - if (skip_len) { - if (!file.at(file.at()+skip_len)) - return false; - searched += skip_len; - skip_len = 0; - } - } - /* - if (skimmed) - kdDebug(7034) << "Bytes skimmed:" << skimmed << endl; - kdDebug(7034) << "Bytes searched:" << searched << endl; - */ - - if (mpeg == 0) { - kdDebug(7034) << "No sequence-start found" << endl; - return false; - } - return true; -} - -// Search for the last GOP packet and read the time field -void KMpegPlugin::read_length() -{ - end_time = 0; - uint8_t byte; - int state = 0; - // Search for the last gop - file.at(file.size()-1024); - for(int j=1; j<64; j++) { -// dstream.setDevice(&file); -// dstream.setByteOrder(TQDataStream::BigEndian); - for(int i=0; i<1024; i++) { - dstream >> byte; - switch (state) { - case 0: - if (byte == 0) - state = 1; - else - state = 0; - break; - case 1: - if (byte == 0) - state = 2; - else - state = 0; - case 2: - if (byte == 0) - state = 2; - else - if (byte == 1) - state = 3; - else - state = 0; - case 3: - if (byte == 0xb8) { - end_time = parse_gop(); - kdDebug(7034) << "end_time: " << end_time << endl; - return; - } - state = 0; - } - } - state = 0; - file.at(file.size()-j*1024); - } - kdDebug(7034) << "No end GOP found" << endl; -} - -bool KMpegPlugin::readInfo( KFileMetaInfo& info, uint /*what*/) -{ - if ( info.path().isEmpty() ) // remote file - return false; - - file.setName(info.path()); - - // open file, set up stream and set endianness - if (!file.open(IO_ReadOnly)) - { - kdDebug(7034) << "Couldn't open " << TQFile::encodeName(info.path()).data() << endl; - return false; - } - - dstream.setDevice(&file); - dstream.setByteOrder(TQDataStream::BigEndian); - - start_time = end_time = 0L; - - if (!read_mpeg()) { - kdDebug(7034) << "read_mpeg() failed!" << endl; - } - else { - KFileMetaInfoGroup group = appendGroup(info, "Technical"); - - appendItem(group, "Frame rate", double(frame_rate)); - - appendItem(group, "Resolution", TQSize(horizontal_size, vertical_size)); - /* The GOP timings are completely bogus - read_length(); - if (end_time != 0) { - //long total_frames = end_time-start_time + 1; - long total_time = end_time; - appendItem(group, "Length", int(total_time)); - } - // and so is bitrate - long total_time = file.size()/((bitrate+audio_rate)*50); - appendItem(group, "Length", int(total_time)); - */ - if (mpeg == 1) - appendItem(group, "Video codec", "MPEG-1"); - else - appendItem(group, "Video codec", "MPEG-2"); - - switch (audio_type) { - case 1: - appendItem(group, "Audio codec", "MP1"); - break; - case 2: - appendItem(group, "Audio codec", "MP2"); - break; - case 3: - appendItem(group, "Audio codec", "MP3"); - break; - case 5: - appendItem(group, "Audio codec", "AC3"); - break; - case 7: - appendItem(group, "Audio codec", "PCM"); - break; - default: - appendItem(group, "Audio codec", i18n("Unknown")); - } - // MPEG 1 also has an aspect ratio setting, but it works differently, - // and I am not sure if it is used. - if (mpeg == 2) { - switch (aspect_ratio) { - case 1: - appendItem(group, "Aspect ratio", i18n("default")); - break; - case 2: - appendItem(group, "Aspect ratio", "4/3"); - break; - case 3: - appendItem(group, "Aspect ratio", "16/9"); - break; - case 4: - appendItem(group, "Aspect ratio", "2.11/1"); - break; - } - } - } - - file.close(); - return true; -} - -#include "kfile_mpeg.moc" diff --git a/kfile-plugins/mpeg/kfile_mpeg.desktop b/kfile-plugins/mpeg/kfile_mpeg.desktop deleted file mode 100644 index 024f448d..00000000 --- a/kfile-plugins/mpeg/kfile_mpeg.desktop +++ /dev/null @@ -1,55 +0,0 @@ -[Desktop Entry] -Type=Service -Name=MPEG Info -Name[bg]=Информация за MPEG -Name[bn]=এম-পেগ তথ্য -Name[br]=Titouroù MPEG -Name[bs]=MPEG informacije -Name[ca]=Informació MPEG -Name[cs]=MPEG info -Name[da]=MPEG-info -Name[de]=MPEG-Info -Name[el]=Πληροφορίες MPEG -Name[eo]=MPEG-informo -Name[es]=Info MPEG -Name[et]=MPEG info -Name[eu]=MPEG informazioa -Name[fa]=اطلاعات MPEG -Name[fi]=MPEG-tiedot -Name[fr]=Informations MPEG -Name[ga]=Eolas MPEG -Name[gl]=Información MPEG -Name[he]=מידע MPEG -Name[hu]=MPEG-jellemzők -Name[is]=MPEG upplýsingar -Name[it]=Informazioni MPEG -Name[ja]=MPEG 情報 -Name[kk]=MPEG мәліметі -Name[km]=ព័ត៌មាន MPEG -Name[ko]=MPEG 정보 -Name[lt]=MPEG informacija -Name[nb]=MPEG informasjon -Name[nds]=MPEG-Info -Name[ne]=एमपीईजी सूचना -Name[nl]=MPEG-info -Name[nn]=MPEG-info -Name[pa]=MPEG ਜਾਣਕਾਰੀ -Name[pl]=Informacja o pliku MPEG -Name[pt]=Informação do MPEG -Name[pt_BR]=Informações sobre MPEG -Name[ru]=Сведения о MPEG -Name[sl]=Podatki o MPEG -Name[sr]=Информације о MPEG-у -Name[sr@Latn]=Informacije o MPEG-u -Name[sv]=MPEG-information -Name[th]=ข้อมูล MPEG -Name[tr]=MP3 Bilgisi -Name[uk]=Інформація про MPEG -Name[zh_CN]=MPEG 信息 -Name[zh_HK]=MPEG 資訊 -Name[zh_TW]=MPEG 資訊 -ServiceTypes=KFilePlugin -X-TDE-Library=kfile_mpeg -MimeType=video/mpeg -PreferredGrous=Technical -PreferredItems=Length,Resolution,Frame rate,Video codec,Audio codec diff --git a/kfile-plugins/mpeg/kfile_mpeg.h b/kfile-plugins/mpeg/kfile_mpeg.h deleted file mode 100644 index c81114bf..00000000 --- a/kfile-plugins/mpeg/kfile_mpeg.h +++ /dev/null @@ -1,71 +0,0 @@ -/* This file is part of the KDE project - * Copyright (C) 2005 Allan Sandfeld Jensen - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public - * License as published by the Free Software Foundation version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - * - */ - -#ifndef __KFILE_MPEG_H__ -#define __KFILE_MPEG_H__ - -#include -#include - -class TQStringList; - -class KMpegPlugin: public KFilePlugin -{ - Q_OBJECT - - -public: - KMpegPlugin( TQObject *parent, const char *name, const TQStringList& args ); - - virtual bool readInfo( KFileMetaInfo& info, uint what); - -private: - int parse_seq(); - void parse_seq_ext(); - long parse_gop(); - int parse_audio(); - int parse_private(); - int skip_packet(); - int skip_riff_chunk(); - bool find_mpeg_in_cdxa(); - - bool read_mpeg(); - void read_length(); - - TQFile file; - TQDataStream dstream; - - // MPEG information - int horizontal_size; - int vertical_size; - int aspect_ratio; - int bitrate; - float frame_rate; - - int mpeg; - int audio_type; - int audio_rate; - - long start_time; - long end_time; - - -}; - -#endif diff --git a/kfile-plugins/ogg/Makefile.am b/kfile-plugins/ogg/Makefile.am deleted file mode 100644 index b53709a8..00000000 --- a/kfile-plugins/ogg/Makefile.am +++ /dev/null @@ -1,22 +0,0 @@ -## Makefile.am for ogg/vorbis file meta info plugin - -# set the include path for X, qt and KDE -INCLUDES = $(all_includes) - -# these are the headers for your project -noinst_HEADERS = kfile_ogg.h - -kde_module_LTLIBRARIES = kfile_ogg.la - -kfile_ogg_la_SOURCES = kfile_ogg.cpp vcedit.c -kfile_ogg_la_LDFLAGS = $(all_libraries) $(KDE_RPATH) $(LIB_QT) -lDCOP $(LIB_TDECORE) $(LIB_TDEUI) -ltdefx $(LIB_KIO) -ltdetexteditor -module $(KDE_PLUGIN) -kfile_ogg_la_LIBADD = $(LIB_KIO) -logg -lvorbis -lvorbisfile - -# let automoc handle all of the meta source files (moc) -METASOURCES = AUTO - -messages: rc.cpp - $(XGETTEXT) kfile_ogg.cpp -o $(podir)/kfile_ogg.pot - -services_DATA = kfile_ogg.desktop -servicesdir = $(kde_servicesdir) diff --git a/kfile-plugins/ogg/configure.in.in b/kfile-plugins/ogg/configure.in.in deleted file mode 100644 index 35218d34..00000000 --- a/kfile-plugins/ogg/configure.in.in +++ /dev/null @@ -1 +0,0 @@ -AM_CONDITIONAL(include_ogg_SUBDIR, test "x$have_oggvorbis" = xyes) diff --git a/kfile-plugins/ogg/kfile_ogg.cpp b/kfile-plugins/ogg/kfile_ogg.cpp deleted file mode 100644 index 30f96096..00000000 --- a/kfile-plugins/ogg/kfile_ogg.cpp +++ /dev/null @@ -1,357 +0,0 @@ -/* This file is part of the KDE project - * Copyright (C) 2001, 2002 Rolf Magnus - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public - * License as published by the Free Software Foundation version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - * - * $Id$ - */ - -#include "kfile_ogg.h" -#include "vcedit.h" - -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#include -#include - -// known translations for common ogg/vorbis keys -// from http://www.ogg.org/ogg/vorbis/doc/v-comment.html -static const char* const knownTranslations[] = { - I18N_NOOP("Title"), - I18N_NOOP("Version"), - I18N_NOOP("Album"), - I18N_NOOP("Tracknumber"), - I18N_NOOP("Artist"), - I18N_NOOP("Organization"), - I18N_NOOP("Description"), - I18N_NOOP("Genre"), - I18N_NOOP("Date"), - I18N_NOOP("Location"), - I18N_NOOP("Copyright") -// I18N_NOOP("Isrc") // dunno what an Isrc number is, the link is broken -}; - -K_EXPORT_COMPONENT_FACTORY(kfile_ogg, KGenericFactory("kfile_ogg")) - -KOggPlugin::KOggPlugin( TQObject *parent, const char *name, - const TQStringList &args ) - : KFilePlugin( parent, name, args ) -{ - kdDebug(7034) << "ogg plugin\n"; - - KFileMimeTypeInfo* info = addMimeTypeInfo( "audio/vorbis" ); - - KFileMimeTypeInfo::GroupInfo* group = 0; - - // comment group - group = addGroupInfo(info, "Comment", i18n("Comment")); - setAttributes(group, KFileMimeTypeInfo::Addable | - KFileMimeTypeInfo::Removable); - - KFileMimeTypeInfo::ItemInfo* item = 0; - - item = addItemInfo(group, "Artist", i18n("Artist"), TQVariant::String); - setHint(item, KFileMimeTypeInfo::Author); - setAttributes(item, KFileMimeTypeInfo::Modifiable); - - item = addItemInfo(group, "Title", i18n("Title"), TQVariant::String); - setHint(item, KFileMimeTypeInfo::Name); - setAttributes(item, KFileMimeTypeInfo::Modifiable); - - item = addItemInfo(group, "Album", i18n("Album"), TQVariant::String); - setAttributes(item, KFileMimeTypeInfo::Modifiable); - - item = addItemInfo(group, "Genre", i18n("Genre"), TQVariant::String); - setAttributes(item, KFileMimeTypeInfo::Modifiable); - - item = addItemInfo(group, "Tracknumber", i18n("Track Number"), TQVariant::String); - setAttributes(item, KFileMimeTypeInfo::Modifiable); - - item = addItemInfo(group, "Date", i18n("Date"), TQVariant::String); - setAttributes(item, KFileMimeTypeInfo::Modifiable); - - item = addItemInfo(group, "Description", i18n("Description"), TQVariant::String); - setAttributes(item, KFileMimeTypeInfo::Modifiable); - - item = addItemInfo(group, "Organization", i18n("Organization"), TQVariant::String); - setAttributes(item, KFileMimeTypeInfo::Modifiable); - - item = addItemInfo(group, "Location", i18n("Location"), TQVariant::String); - setAttributes(item, KFileMimeTypeInfo::Modifiable); - - item = addItemInfo(group, "Copyright", i18n("Copyright"), TQVariant::String); - setAttributes(item, KFileMimeTypeInfo::Modifiable); - - - addVariableInfo(group, TQVariant::String, KFileMimeTypeInfo::Addable | - KFileMimeTypeInfo::Removable | - KFileMimeTypeInfo::Modifiable); - - // technical group - - group = addGroupInfo(info, "Technical", i18n("Technical Details")); - setAttributes(group, 0); - - addItemInfo(group, "Version", i18n("Version"), TQVariant::Int); - addItemInfo(group, "Channels", i18n("Channels"), TQVariant::Int); - - item = addItemInfo(group, "Sample Rate", i18n("Sample Rate"), TQVariant::Int); - setSuffix(item, i18n(" Hz")); - - item = addItemInfo(group, "UpperBitrate", i18n("Upper Bitrate"), - TQVariant::Int); - setSuffix(item, i18n(" kbps")); - - item = addItemInfo(group, "LowerBitrate", i18n("Lower Bitrate"), - TQVariant::Int); - setSuffix(item, i18n(" kbps")); - - item = addItemInfo(group, "NominalBitrate", i18n("Nominal Bitrate"), - TQVariant::Int); - setSuffix(item, i18n(" kbps")); - - item = addItemInfo(group, "Bitrate", i18n("Average Bitrate"), - TQVariant::Int); - setAttributes(item, KFileMimeTypeInfo::Averaged); - setHint(item, KFileMimeTypeInfo::Bitrate); - setSuffix(item, i18n( " kbps")); - - item = addItemInfo(group, "Length", i18n("Length"), TQVariant::Int); - setAttributes(item, KFileMimeTypeInfo::Cummulative); - setUnit(item, KFileMimeTypeInfo::Seconds); -} - -bool KOggPlugin::readInfo( KFileMetaInfo& info, uint what ) -{ - // parts of this code taken from ogginfo.c of the vorbis-tools v1.0rc2 - FILE *fp; - OggVorbis_File vf; - int rc,i; - vorbis_comment *vc; - vorbis_info *vi; - - bool readComment = false; - bool readTech = false; - if (what & (KFileMetaInfo::Fastest | - KFileMetaInfo::DontCare | - KFileMetaInfo::ContentInfo)) readComment = true; - - if (what & (KFileMetaInfo::Fastest | - KFileMetaInfo::DontCare | - KFileMetaInfo::TechnicalInfo)) readTech = true; - - memset(&vf, 0, sizeof(OggVorbis_File)); - - if ( info.path().isEmpty() ) // remote file - return false; - - fp = fopen(TQFile::encodeName(info.path()),"rb"); - if (!fp) - { - kdDebug(7034) << "Unable to open " << TQFile::encodeName(info.path()).data() << endl; - return false; - } - - rc = ov_open(fp,&vf,NULL,0); - - if (rc < 0) - { - kdDebug(7034) << "Unable to understand " << TQFile::encodeName(info.path()).data() - << ", errorcode=" << rc << endl; - return false; - } - -// info.insert(KFileMetaInfoItem("Vendor", i18n("Vendor"), -// TQVariant(TQString(vi->vendor)))); - - // get the vorbis comments - if (readComment) - { - vc = ov_comment(&vf,-1); - - KFileMetaInfoGroup commentGroup = appendGroup(info, "Comment"); - - for (i=0; i < vc->comments; i++) - { - kdDebug(7034) << vc->user_comments[i] << endl; - TQStringList split = TQStringList::split("=", TQString::fromUtf8(vc->user_comments[i])); - split[0] = split[0].lower(); - split[0][0] = split[0][0].upper(); - - // we have to be sure that the i18n() string always has the same - // case. Oh, and is UTF8 ok here? - appendItem(commentGroup, split[0], split[1]); - } - } - - if (readTech) - { - KFileMetaInfoGroup techgroup = appendGroup(info, "Technical"); - // get other information about the file - vi = ov_info(&vf,-1); - if (vi) - { - - appendItem(techgroup, "Version", int(vi->version)); - appendItem(techgroup, "Channels", int(vi->channels)); - appendItem(techgroup, "Sample Rate", int(vi->rate)); - - if (vi->bitrate_upper > 0) - appendItem(techgroup, "UpperBitrate", - int(vi->bitrate_upper+500)/1000); - if (vi->bitrate_lower > 0) - appendItem(techgroup, "LowerBitrate", - int(vi->bitrate_lower+500)/1000); - if (vi->bitrate_nominal > 0) - appendItem(techgroup, "NominalBitrate", - int(vi->bitrate_nominal+500)/1000); - - if (ov_bitrate(&vf,-1) > 0) - appendItem(techgroup, "Bitrate", int(ov_bitrate(&vf,-1)+500)/1000); - - } - - appendItem(techgroup, "Length", int(ov_time_total(&vf,-1))); - } - - ov_clear(&vf); - - return true; -} - -bool KOggPlugin::writeInfo(const KFileMetaInfo& info) const -{ - // todo: add writing support - FILE* infile; - - infile = fopen(TQFile::encodeName(info.path()), "r"); - - if (!infile) - { - kdDebug(7034) << "couldn't open " << info.path() << endl; - return false; - } - - vcedit_state *state=vcedit_new_state(); - - if ( vcedit_open(state, infile)==-1 ) - { - kdDebug(7034) << "error in vcedit_open for " << info.path() << endl; - return false; - } - - struct vorbis_comment* oc = vcedit_comments(state); - struct vorbis_comment* vc = state->vc; - - if(vc) vorbis_comment_clear(vc); - - if (oc && oc->vendor) - { - vc->vendor = strdup(oc->vendor); - } - else - { - vc->vendor = strdup(""); - } - - KFileMetaInfoGroup group = info["Comment"]; - - TQStringList keys = group.keys(); - TQStringList::Iterator it; - for (it = keys.begin(); it!=keys.end(); ++it) - { - KFileMetaInfoItem item = group[*it]; - - if (!item.isEditable() || !(item.type()==TQVariant::String) ) - continue; - - TQCString key = item.key().upper().utf8(); - if (item.value().canCast(TQVariant::String)) - { - TQCString value = item.value().toString().utf8(); - - kdDebug(7034) << " writing tag " << key << "=" << value << endl; - - vorbis_comment_add_tag(vc, - const_cast(static_cast(key)), - const_cast(static_cast(value))); - } - else - kdWarning(7034) << "ignoring " << key << endl; - - } - - TQString filename; - - TQFileInfo fileinfo(info.path()); - - // follow symlinks - if (fileinfo.isSymLink()) - filename = fileinfo.readLink(); - else - filename = info.path(); - - // nothing in TQt or KDE to get the mode as an int? - struct stat s; - stat(TQFile::encodeName(filename), &s); - - KSaveFile sf(filename, s.st_mode); - FILE* outfile = sf.fstream(); - - if ( sf.status() || !outfile) - { - kdDebug(7034) << "couldn't create temp file\n"; - vcedit_clear(state); // frees comment entries and vendor - sf.abort(); - if (vc->vendor) free(vc->vendor); - vc->vendor = 0; - return false; - } - - - vcedit_write(state,outfile); // calls vcedit_clear() itself so we don't free anything - - if (vc->vendor) free(vc->vendor); - vc->vendor = 0; - - fclose(infile); - sf.close(); - - return true; -} - -TQValidator* KOggPlugin::createValidator( const TQString&, - const TQString &, const TQString &, - TQObject* parent, const char* name) const { - return new TQRegExpValidator(TQRegExp(".*"), parent, name); -} - -#include "kfile_ogg.moc" diff --git a/kfile-plugins/ogg/kfile_ogg.desktop b/kfile-plugins/ogg/kfile_ogg.desktop deleted file mode 100644 index bf0da7bc..00000000 --- a/kfile-plugins/ogg/kfile_ogg.desktop +++ /dev/null @@ -1,68 +0,0 @@ -[Desktop Entry] -Type=Service -Name=OGG Info -Name[af]=Ogg Inligting -Name[ar]=معلومات OGG -Name[bg]=Информация за OGG -Name[bn]=অগ তথ্য -Name[br]=Titouroù OGG -Name[bs]=OGG informacije -Name[ca]=Informació OGG -Name[cs]=OGG info -Name[cy]=Gwybodaeth OGG -Name[da]=OGG-info -Name[de]=OGG-Info -Name[el]=Πληροφορίες OGG -Name[eo]=OGG-informo -Name[es]=Info OGG -Name[et]=OGG info -Name[eu]=OGG informazioa -Name[fa]=اطلاعات OGG -Name[fi]=OGG-tiedot -Name[fr]=Informations Ogg Vorbis -Name[gl]=Información OGG -Name[he]=מידע OGG -Name[hi]=OGG जानकारी -Name[hr]=Informacije o OGG datoteci -Name[hu]=OGG-jellemzők -Name[is]=OGG upplýsingar -Name[it]=Informazioni OGG -Name[ja]=OGG 情報 -Name[kk]=OGG мәліметі -Name[km]=ព័ត៌មាន OGG -Name[ko]=OGG 정보 -Name[lt]=OGG informacija -Name[mk]=OGG информации -Name[nb]=OGG informasjon -Name[nds]=Ogg-Info -Name[ne]=अग सूचना -Name[nl]=OGG-informatie -Name[nn]=OGG-info -Name[pa]=OGG ਜਾਣਕਾਰੀ -Name[pl]=Informacja o pliku OGG -Name[pt]=Informação do OGG -Name[pt_BR]=Informação sobre OGG -Name[ro]=Informaţii OGG -Name[ru]=Сведения о OGG -Name[se]=OGG-dieđut -Name[sl]=Podatki o OGG -Name[sr]=Информације о OGG-у -Name[sr@Latn]=Informacije o OGG-u -Name[sv]=Ogg-information -Name[ta]=OGG தகவல் -Name[tg]=OGG Ахборот -Name[th]=ข้อมูล OGG -Name[tr]=OGG Bilgisi -Name[uk]=Інформація по OGG -Name[uz]=OGG haqida maʼlumot -Name[uz@cyrillic]=OGG ҳақида маълумот -Name[xh]=OGG Ulwazi -Name[zh_CN]=OGG 信息 -Name[zh_HK]=OGG 資訊 -Name[zh_TW]=OGG 資訊 -Name[zu]=Ulwazi lwe OGG -ServiceTypes=KFilePlugin -X-TDE-Library=kfile_ogg -MimeType=audio/vorbis -PreferredGroups=Comment,Technical -PreferredItems=Title,Artist,Album,Tracknumber,Genre,Bitrate,Length,Date,Description,Organization,Channels,UpperBitrate,LowerBitrate,NominalBitrate,Location,Copyright,Version diff --git a/kfile-plugins/ogg/kfile_ogg.h b/kfile-plugins/ogg/kfile_ogg.h deleted file mode 100644 index eb5411ea..00000000 --- a/kfile-plugins/ogg/kfile_ogg.h +++ /dev/null @@ -1,46 +0,0 @@ -/* This file is part of the KDE project - * Copyright (C) 2001, 2002 Rolf Magnus - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public - * License as published by the Free Software Foundation version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - * - * $Id$ - */ - -#ifndef __KFILE_OGG_H__ -#define __KFILE_OGG_H__ - -#include - -class TQString; -class TQStringList; - -class KOggPlugin: public KFilePlugin -{ - Q_OBJECT - - -public: - KOggPlugin( TQObject *parent, const char *name, const TQStringList& args ); - - virtual bool readInfo( KFileMetaInfo& info, uint what); - virtual bool writeInfo( const KFileMetaInfo& info ) const; - virtual TQValidator* createValidator( const TQString& mimetype, - const TQString &group, - const TQString &key, - TQObject* parent, const char* name) const; -}; - - -#endif diff --git a/kfile-plugins/ogg/vcedit.c b/kfile-plugins/ogg/vcedit.c deleted file mode 100644 index 76e31f6c..00000000 --- a/kfile-plugins/ogg/vcedit.c +++ /dev/null @@ -1,331 +0,0 @@ -/* This program is licensed under the GNU Library General Public License, version 2 - * - * (c) 2000-2001 Michael Smith - * - * Modified by Warren Spits - * - Handles vorbis files that are truncated or missing an eos flag. - * - * Comment editing backend, suitable for use by nice frontend interfaces. - * - * last modified: $Id$ - */ - -#include -#include -#include -#include -#include - -#include "vcedit.h" - -#define CHUNKSIZE 4096 - -vcedit_state *vcedit_new_state(void) -{ - vcedit_state *state = malloc(sizeof(vcedit_state)); - memset(state, 0, sizeof(vcedit_state)); - - return state; -} - -char *vcedit_error(vcedit_state *state) -{ - return state->lasterror; -} - -vorbis_comment *vcedit_comments(vcedit_state *state) -{ - return state->vc; -} - -static void vcedit_clear_internals(vcedit_state *state) -{ - if(state->vc) - { - vorbis_comment_clear(state->vc); - free(state->vc); - state->vc=NULL; - } - if(state->os) - { - ogg_stream_clear(state->os); - free(state->os); - state->os=NULL; - } - if(state->oy) - { - ogg_sync_clear(state->oy); - free(state->oy); - state->oy=NULL; - } -} - -void vcedit_clear(vcedit_state *state) -{ - if(state) - { - vcedit_clear_internals(state); - free(state); - } -} - -int vcedit_open(vcedit_state *state, FILE *in) -{ - return vcedit_open_callbacks(state, (void *)in, - (vcedit_read_func)fread, (vcedit_write_func)fwrite); -} - -int vcedit_open_callbacks(vcedit_state *state, void *in, - vcedit_read_func read_func, vcedit_write_func write_func) -{ - - char *buffer; - int bytes,i; - ogg_packet *header; - ogg_packet header_main; - ogg_packet header_comments; - ogg_packet header_codebooks; - ogg_page og; - vorbis_info vi; - - - state->in = in; - state->read = read_func; - state->write = write_func; - state->lasterror = 0; - - state->oy = malloc(sizeof(ogg_sync_state)); - ogg_sync_init(state->oy); - - buffer = ogg_sync_buffer(state->oy, CHUNKSIZE); - bytes = state->read(buffer, 1, CHUNKSIZE, state->in); - - ogg_sync_wrote(state->oy, bytes); - - if(ogg_sync_pageout(state->oy, &og) != 1) - { - if(byteslasterror = "Input truncated or empty."; - else - state->lasterror = "Input is not an Ogg bitstream."; - goto err; - } - - state->serial = ogg_page_serialno(&og); - - state->os = malloc(sizeof(ogg_stream_state)); - ogg_stream_init(state->os, state->serial); - - vorbis_info_init(&vi); - - state->vc = malloc(sizeof(vorbis_comment)); - vorbis_comment_init(state->vc); - - if(ogg_stream_pagein(state->os, &og) < 0) - { - state->lasterror = "Error reading first page of Ogg bitstream."; - goto err; - } - - if(ogg_stream_packetout(state->os, &header_main) != 1) - { - state->lasterror = "Error reading initial header packet."; - goto err; - } - - if(vorbis_synthesis_headerin(&vi, state->vc, &header_main) < 0) - { - state->lasterror = "Ogg bitstream does not contain vorbis data."; - goto err; - } - - state->mainlen = header_main.bytes; - state->mainbuf = malloc(state->mainlen); - memcpy(state->mainbuf, header_main.packet, header_main.bytes); - - i = 0; - header = &header_comments; - while(i<2) { - while(i<2) { - int result = ogg_sync_pageout(state->oy, &og); - if(result == 0) break; /* Too little data so far */ - else if(result == 1) - { - ogg_stream_pagein(state->os, &og); - while(i<2) - { - result = ogg_stream_packetout(state->os, header); - if(result == 0) break; - if(result == -1) - { - state->lasterror = "Corrupt secondary header."; - goto err; - } - vorbis_synthesis_headerin(&vi, state->vc, header); - if(i==1) - { - state->booklen = header->bytes; - state->bookbuf = malloc(state->booklen); - memcpy(state->bookbuf, header->packet, - header->bytes); - } - i++; - header = &header_codebooks; - } - } - } - - buffer = ogg_sync_buffer(state->oy, CHUNKSIZE); - bytes = state->read(buffer, 1, CHUNKSIZE, state->in); - if(bytes == 0 && i < 2) - { - state->lasterror = "EOF before end of vorbis headers."; - goto err; - } - ogg_sync_wrote(state->oy, bytes); - } - - /* Headers are done! */ - vorbis_info_clear(&vi); - return 0; - -err: - vcedit_clear_internals(state); - return -1; -} - -int vcedit_write(vcedit_state *state, void *out) -{ - ogg_stream_state streamout; - ogg_packet header_main; - ogg_packet header_comments; - ogg_packet header_codebooks; - - ogg_page ogout, ogin; - ogg_packet op; - int result, outresult; - char *buffer; - int bytes, eosin=0, eosout=0; - - state->lasterror = 0; - - header_main.bytes = state->mainlen; - header_main.packet = state->mainbuf; - header_main.b_o_s = 1; - header_main.e_o_s = 0; - header_main.granulepos = 0; - - header_codebooks.bytes = state->booklen; - header_codebooks.packet = state->bookbuf; - header_codebooks.b_o_s = 0; - header_codebooks.e_o_s = 0; - header_codebooks.granulepos = 0; - - ogg_stream_init(&streamout, state->serial); - - vorbis_commentheader_out(state->vc, &header_comments); - - ogg_stream_packetin(&streamout, &header_main); - ogg_stream_packetin(&streamout, &header_comments); - ogg_stream_packetin(&streamout, &header_codebooks); - - while((result = ogg_stream_flush(&streamout, &ogout))) - { - if(state->write(ogout.header,1,ogout.header_len, out) != - (size_t) ogout.header_len) - goto cleanup; - if(state->write(ogout.body,1,ogout.body_len, out) != - (size_t) ogout.body_len) - goto cleanup; - } - - /* We copy the first logical stream - * through, rewriting the stream. */ - while (1) - { - outresult = eosin ? ogg_stream_flush(&streamout, &ogout) : - ogg_stream_pageout(&streamout, &ogout); - if (outresult > 0) - { - if (state->write(ogout.header,1,ogout.header_len, - out) != (size_t) ogout.header_len) - goto cleanup; - if (state->write(ogout.body,1,ogout.body_len, - out) != (size_t) ogout.body_len) - goto cleanup; - if (ogg_page_eos(&ogout)) eosout = 1; - } - if (outresult != 0) continue; - if (eosout || (eosin && (result == 0))) break; - - while (1) - { - result = ogg_stream_packetout(state->os, &op); - if (result < 0) continue; - if (result > 0) ogg_stream_packetin(&streamout, &op); - if (eosin || (result > 0)) break; - - while (1) - { - result = ogg_sync_pageout(state->oy, &ogin); - - if (result < 0) continue; - if (result > 0) - { - ogg_stream_pagein(state->os, &ogin); - if (ogg_page_eos(&ogin)) eosin = 1; - } - if (eosin || (result > 0)) break; - - buffer = ogg_sync_buffer(state->oy, CHUNKSIZE); - bytes = state->read(buffer,1, CHUNKSIZE, state->in); - ogg_sync_wrote(state->oy, bytes); - if (bytes < CHUNKSIZE) eosin = 1; - } - } - } - - eosin=0; /* clear it, because not all paths to here do */ - eosout=1; /* handle input files that are truncated or without an eos flag */ - - /* We copy the rest of the stream (other logical streams) - * through, a page at a time. */ - while (1) - { - result = ogg_sync_pageout(state->oy, &ogout); - if (result > 0) - { - if (state->write(ogout.header,1,ogout.header_len, - out) != (size_t) ogout.header_len) - goto cleanup; - if (state->write(ogout.body,1,ogout.body_len, out) != - (size_t) ogout.body_len) - goto cleanup; - } - if (result != 0) continue; - if (eosin) break; - - buffer = ogg_sync_buffer(state->oy, CHUNKSIZE); - bytes = state->read(buffer,1, CHUNKSIZE, state->in); - ogg_sync_wrote(state->oy, bytes); - eosin = (bytes < CHUNKSIZE); - } - -cleanup: - ogg_stream_clear(&streamout); - ogg_packet_clear(&header_comments); - - free(state->mainbuf); - free(state->bookbuf); - - vcedit_clear_internals(state); - if(!(eosin && eosout)) - { - state->lasterror = - "Error writing stream to output. " - "Output stream may be corrupted or truncated."; - return -1; - } - - return 0; -} diff --git a/kfile-plugins/ogg/vcedit.h b/kfile-plugins/ogg/vcedit.h deleted file mode 100644 index 6be136ba..00000000 --- a/kfile-plugins/ogg/vcedit.h +++ /dev/null @@ -1,56 +0,0 @@ -/* This program is licensed under the GNU General Public License, version 2, - * a copy of which is included with this program. - * - * (c) 2000-2001 Michael Smith - * - * VCEdit header. - * - * last modified: $ID:$ - */ - -#ifndef __VCEDIT_H -#define __VCEDIT_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include -#include -#include - -typedef size_t (*vcedit_read_func)(void *, size_t, size_t, void *); -typedef size_t (*vcedit_write_func)(const void *, size_t, size_t, void *); - -typedef struct { - ogg_sync_state *oy; - ogg_stream_state *os; - - vorbis_comment *vc; - - vcedit_read_func read; - vcedit_write_func write; - - void *in; - long serial; - unsigned char *mainbuf; - unsigned char *bookbuf; - int mainlen; - int booklen; - char *lasterror; -} vcedit_state; - -extern vcedit_state * vcedit_new_state(void); -extern void vcedit_clear(vcedit_state *state); -extern vorbis_comment * vcedit_comments(vcedit_state *state); -extern int vcedit_open(vcedit_state *state, FILE *in); -extern int vcedit_open_callbacks(vcedit_state *state, void *in, - vcedit_read_func read_func, vcedit_write_func write_func); -extern int vcedit_write(vcedit_state *state, void *out); -extern char * vcedit_error(vcedit_state *state); - -#ifdef __cplusplus -} -#endif - -#endif /* __VCEDIT_H */ diff --git a/kfile-plugins/sid/Makefile.am b/kfile-plugins/sid/Makefile.am deleted file mode 100644 index 8f7d59be..00000000 --- a/kfile-plugins/sid/Makefile.am +++ /dev/null @@ -1,22 +0,0 @@ -## Makefile.am for sid file meta info plugin - -# set the include path for X, qt and KDE -INCLUDES = $(all_includes) $(taglib_includes) - -# these are the headers for your project -noinst_HEADERS = kfile_sid.h - -kde_module_LTLIBRARIES = kfile_sid.la - -kfile_sid_la_SOURCES = kfile_sid.cpp -kfile_sid_la_LDFLAGS = $(all_libraries) $(KDE_RPATH) $(LIB_QT) -lDCOP $(LIB_TDECORE) $(LIB_TDEUI) -ltdefx $(LIB_KIO) -ltdetexteditor -module $(KDE_PLUGIN) -kfile_sid_la_LIBADD = $(LIB_KIO) - -# let automoc handle all of the meta source files (moc) -METASOURCES = AUTO - -messages: rc.cpp - $(XGETTEXT) kfile_sid.cpp -o $(podir)/kfile_sid.pot - -services_DATA = kfile_sid.desktop -servicesdir = $(kde_servicesdir) diff --git a/kfile-plugins/sid/kfile_sid.cpp b/kfile-plugins/sid/kfile_sid.cpp deleted file mode 100644 index 33b35500..00000000 --- a/kfile-plugins/sid/kfile_sid.cpp +++ /dev/null @@ -1,227 +0,0 @@ -/* This file is part of the KDE project - * Copyright (C) 2003 Rolf Magnus - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public - * License as published by the Free Software Foundation version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - */ - -#include "kfile_sid.h" - -#include -#include -#include -#include - -#include -#include -#include - -#include -#include -#include -#include - -typedef KGenericFactory SidFactory; - -K_EXPORT_COMPONENT_FACTORY(kfile_sid, SidFactory("kfile_sid")) - -KSidPlugin::KSidPlugin(TQObject *parent, const char *name, - const TQStringList &args) - - : KFilePlugin(parent, name, args) -{ - kdDebug(7034) << "sid plugin\n"; - - KFileMimeTypeInfo* info = addMimeTypeInfo("audio/prs.sid"); - - KFileMimeTypeInfo::GroupInfo* group = 0L; - - // General group - group = addGroupInfo(info, "General", i18n("General")); - - KFileMimeTypeInfo::ItemInfo* item; - - item = addItemInfo(group, "Title", i18n("Title"), TQVariant::String); - setAttributes(item, KFileMimeTypeInfo::Modifiable); - setHint(item, KFileMimeTypeInfo::Name); - - item = addItemInfo(group, "Artist", i18n("Artist"), TQVariant::String); - setAttributes(item, KFileMimeTypeInfo::Modifiable); - setHint(item, KFileMimeTypeInfo::Author); - - item = addItemInfo(group, "Copyright", i18n("Copyright"), TQVariant::String); - setAttributes(item, KFileMimeTypeInfo::Modifiable); - setHint(item, KFileMimeTypeInfo::Description); - - // technical group - group = addGroupInfo(info, "Technical", i18n("Technical Details")); - - item = addItemInfo(group, "Version", i18n("Version"), TQVariant::Int); - setPrefix(item, i18n("PSID v")); - - addItemInfo(group, "Number of Songs", i18n("Number of Songs"), TQVariant::Int); - item = addItemInfo(group, "Start Song", i18n("Start Song"), TQVariant::Int); -} - -bool KSidPlugin::readInfo(KFileMetaInfo& info, uint /*what*/) -{ - if ( info.path().isEmpty() ) // remote file - return false; - TQFile file(info.path()); - if ( !file.open(IO_ReadOnly) ) - return false; - - int version; - int num_songs; - int start_song; - TQString name; - TQString artist; - TQString copyright; - - char buf[64] = { 0 }; - - if (4 != file.readBlock(buf, 4)) - return false; - if (strncmp(buf, "PSID", 4)) - return false; - - //read version - int ch; - if (0 > (ch = file.getch())) - return false; - version = ch << 8; - if (0 > (ch = file.getch())) - return false; - version+= ch; - - //read number of songs - file.at(0xE); - if (0 > (ch = file.getch())) - return false; - num_songs = ch << 8; - if (0 > (ch = file.getch())) - return false; - num_songs += ch; - - //start song - if (0 > (ch = file.getch())) - return false; - start_song = ch << 8; - if (0 > (ch = file.getch())) - return false; - start_song += ch; - - //name - file.at(0x16); - if (32 != file.readBlock(buf, 32)) - return false; - name = buf; - - //artist - if (32 != file.readBlock(buf, 32)) - return false; - artist = buf; - - //copyright - if (32 != file.readBlock(buf, 32)) - return false; - copyright = buf; - - TQString TODO("TODO"); - kdDebug(7034) << "sid plugin readInfo\n"; - - KFileMetaInfoGroup general = appendGroup(info, "General"); - - appendItem(general, "Title", name); - appendItem(general, "Artist", artist); - appendItem(general, "Copyright", copyright); - - KFileMetaInfoGroup tech = appendGroup(info, "Technical"); - - appendItem(tech, "Version", version); - appendItem(tech, "Number of Songs", num_songs); - appendItem(tech, "Start Song", start_song); - - kdDebug(7034) << "reading finished\n"; - return true; -} - -bool KSidPlugin::writeInfo(const KFileMetaInfo& info) const -{ - kdDebug(7034) << k_funcinfo << endl; - - char name[32] = {0}; - char artist[32] = {0}; - char copyright[32] = {0}; - - int file = 0; - TQString s; - - KFileMetaInfoGroup group = info.group("General"); - if (!group.isValid()) - goto failure; - - s = group.item("Title").value().toString(); - if (s.isNull()) goto failure; - strncpy(name, s.local8Bit(), 31); - - s = group.item("Artist").value().toString(); - if (s.isNull()) goto failure; - strncpy(artist, s.local8Bit(), 31); - - s = group.item("Copyright").value().toString(); - if (s.isNull()) goto failure; - strncpy(copyright, s.local8Bit(), 31); - - kdDebug(7034) << "Opening sid file " << info.path() << endl; - file = ::open(TQFile::encodeName(info.path()), O_WRONLY); - //name - if (-1 == ::lseek(file, 0x16, SEEK_SET)) - goto failure; - if (32 != ::write(file, name, 32)) - goto failure; - - //artist - if (32 != ::write(file, artist, 32)) - goto failure; - - //copyright - if (32 != write(file, copyright, 32)) - goto failure; - - close(file); - return true; - -failure: - if (file) close(file); - kdDebug(7034) << "something went wrong writing to sid file\n"; - return false; -} - -TQValidator* -KSidPlugin::createValidator(const TQString& /*mimetype*/, const TQString& group, - const TQString& /*key*/, TQObject* parent, - const char* name) const -{ - kdDebug(7034) << k_funcinfo << endl; - // all items in "General" group are strings of max length 31 - if (group == "General") - return new TQRegExpValidator(TQRegExp(".{,31}"), parent, name); - // all others are read-only - return 0; -} - - - -#include "kfile_sid.moc" diff --git a/kfile-plugins/sid/kfile_sid.desktop b/kfile-plugins/sid/kfile_sid.desktop deleted file mode 100644 index 22b2ded8..00000000 --- a/kfile-plugins/sid/kfile_sid.desktop +++ /dev/null @@ -1,60 +0,0 @@ -[Desktop Entry] -Type=Service -Name=SID Info -Name[bg]=Информация за SID -Name[br]=Titouroù SID -Name[bs]=SID informacije -Name[ca]=Informació SID -Name[cs]=SID info -Name[cy]=Gwybodaeth SID -Name[da]=SID-info -Name[de]=SID-Info -Name[el]=Πληροφορίες SID -Name[eo]=SID-informo -Name[es]=Info SID -Name[et]=SID info -Name[eu]=SID informazioa -Name[fa]=اطلاعات SID -Name[fi]=SID-tiedot -Name[fr]=Informations SID -Name[ga]=Eolas faoi SID -Name[gl]=Información SID -Name[he]=מידע SID -Name[hu]=SID-jellemzők -Name[is]=SID upplýsingar -Name[it]=Informazioni SID -Name[ja]=SID 情報 -Name[kk]=SID мәліметі -Name[km]=ព័ត៌មាន SID -Name[ko]=SID 정보 -Name[lt]=SID Informacija -Name[mk]=SID информации -Name[nb]=SID-info -Name[nds]=SID-Info -Name[ne]=एसआईडी सूचना -Name[nl]=SID-informatie -Name[nn]=SID-info -Name[pa]=SID ਜਾਣਕਾਰੀ -Name[pl]=Informacja CD -Name[pt]=Informação do SID -Name[pt_BR]=Informação sobre SID -Name[ro]=Informaţii SID -Name[ru]=Сведения о SID -Name[sk]=SID info -Name[sl]=Podatki o SID -Name[sr]=Информације о SID-у -Name[sr@Latn]=Informacije o SID-u -Name[sv]=SID-information -Name[ta]=SID தகவல் -Name[tg]=SID Ахборот -Name[th]=ข้อมูล SID -Name[tr]=SID Bilgisi -Name[uk]=Інформація по SID -Name[zh_CN]=SID 信息 -Name[zh_HK]=SID 資訊 -Name[zh_TW]=SID 資訊 -ServiceTypes=KFilePlugin -X-TDE-Library=kfile_sid -MimeType=audio/prs.sid -PreferredGroups=General,Technical -PreferredItems=Title,Artist,Copyright,Number of Songs,Start Song,Version diff --git a/kfile-plugins/sid/kfile_sid.h b/kfile-plugins/sid/kfile_sid.h deleted file mode 100644 index a69e2460..00000000 --- a/kfile-plugins/sid/kfile_sid.h +++ /dev/null @@ -1,43 +0,0 @@ -/* This file is part of the KDE project - * Copyright (C) 2003 Rolf Magnus - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public - * License as published by the Free Software Foundation version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - * - * $Id$ - */ - -#ifndef KFILE_SID_H -#define KFILE_SID_H - -#include - -class TQStringList; - -class KSidPlugin: public KFilePlugin -{ - Q_OBJECT - - -public: - KSidPlugin(TQObject *parent, const char *name, const TQStringList& args); - - virtual bool readInfo(KFileMetaInfo& info, uint what); - virtual bool writeInfo(const KFileMetaInfo& info) const; - TQValidator* createValidator(const TQString& mimetype, const TQString& group, - const TQString& key, TQObject* parent, - const char* name) const; -}; - -#endif diff --git a/kfile-plugins/theora/Makefile.am b/kfile-plugins/theora/Makefile.am deleted file mode 100644 index a2495cec..00000000 --- a/kfile-plugins/theora/Makefile.am +++ /dev/null @@ -1,22 +0,0 @@ -## Makefile.am for ogg/vorbis file meta info plugin - -# set the include path for X, qt and KDE -INCLUDES = $(all_includes) - -# these are the headers for your project -noinst_HEADERS = kfile_theora.h - -kde_module_LTLIBRARIES = kfile_theora.la - -kfile_theora_la_SOURCES = kfile_theora.cpp -kfile_theora_la_LDFLAGS = $(all_libraries) $(KDE_RPATH) $(LIB_QT) -lDCOP $(LIB_TDECORE) $(LIB_TDEUI) -ltdefx $(LIB_KIO) -ltdetexteditor -module $(KDE_PLUGIN) -kfile_theora_la_LIBADD = $(LIB_KIO) -logg -lvorbis -ltheora - -# let automoc handle all of the meta source files (moc) -METASOURCES = AUTO - -messages: rc.cpp - $(XGETTEXT) kfile_theora.cpp -o $(podir)/kfile_theora.pot - -services_DATA = kfile_theora.desktop -servicesdir = $(kde_servicesdir) diff --git a/kfile-plugins/theora/configure.in.bot b/kfile-plugins/theora/configure.in.bot deleted file mode 100644 index 926a39e9..00000000 --- a/kfile-plugins/theora/configure.in.bot +++ /dev/null @@ -1,7 +0,0 @@ -if test "x$with_theora" = xcheck && test "x$have_theora" = xno; then - echo "" - echo "Ogg Theora support was not found." - echo "a KFile-plugin for displaying Ogg Theora Information" - echo "has been disabled from compilation." - all_tests=bad -fi diff --git a/kfile-plugins/theora/configure.in.in b/kfile-plugins/theora/configure.in.in deleted file mode 100644 index b9d8836d..00000000 --- a/kfile-plugins/theora/configure.in.in +++ /dev/null @@ -1,26 +0,0 @@ -AC_DEFUN([KDE_CHECK_THEORA], -[ -have_theora=yes - -KDE_CHECK_HEADER(theora/theora.h, - [], [have_theora=no]) - -KDE_CHECK_LIB(theora, theora_info_init, - [], [have_theora=no], [-lvorbis -logg]) -]) - -AC_ARG_WITH(theora, - [AC_HELP_STRING(--with-theora, - [enable support for Ogg Theora @<:@default=check@:>@])], - [], with_theora=check) - -have_theora=no -if test "x$with_theora" != xno; then - KDE_CHECK_THEORA - - if test "x$with_theora" != xcheck && test "x$have_theora" != xyes; then - AC_MSG_ERROR([--with-theora was given, but test for Theora failed]) - fi -fi - -AM_CONDITIONAL(include_theora_SUBDIR, test "x$have_theora" = xyes) diff --git a/kfile-plugins/theora/kfile_theora.cpp b/kfile-plugins/theora/kfile_theora.cpp deleted file mode 100644 index aac38978..00000000 --- a/kfile-plugins/theora/kfile_theora.cpp +++ /dev/null @@ -1,322 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2004 by Jean-Baptiste Mardelle * - * bj@altern.org * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - ***************************************************************************/ - -#include -#include -#include "kfile_theora.h" - -#include -#include -#include - -#include "theora/theora.h" -#include "vorbis/codec.h" - -ogg_stream_state t_stream_state; -ogg_stream_state v_stream_state; - -int theora_p=0; -int vorbis_p=0; - -static int queue_page(ogg_page *page) -{ - if(theora_p) - ogg_stream_pagein(&t_stream_state,page); - if(vorbis_p) - ogg_stream_pagein(&v_stream_state,page); - return 0; -} - -static int buffer_data(FILE *in,ogg_sync_state *oy) -{ - char *buffer=ogg_sync_buffer(oy,4096); - int bytes=fread(buffer,1,4096,in); - ogg_sync_wrote(oy,bytes); - return(bytes); -} - -typedef KGenericFactory theoraFactory; - -K_EXPORT_COMPONENT_FACTORY(kfile_theora, theoraFactory( "kfile_theora" )) - -theoraPlugin::theoraPlugin(TQObject *parent, const char *name, - const TQStringList &args) - : KFilePlugin(parent, name, args) -{ -// kdDebug(7034) << "theora plugin\n"; - - KFileMimeTypeInfo* info = addMimeTypeInfo( "video/x-theora" ); - - KFileMimeTypeInfo::GroupInfo* group = 0; - KFileMimeTypeInfo::ItemInfo* item; - - // video group - - group = addGroupInfo(info, "Video", i18n("Video Details")); - setAttributes(group, 0); - item = addItemInfo(group, "Length", i18n("Length"), TQVariant::Int); - setUnit(item, KFileMimeTypeInfo::Seconds); - setHint(item, KFileMimeTypeInfo::Length); - item = addItemInfo(group, "Resolution", i18n("Resolution"), TQVariant::Size); - setHint(item, KFileMimeTypeInfo::Size); - setUnit(item, KFileMimeTypeInfo::Pixels); - item = addItemInfo(group, "FrameRate", i18n("Frame Rate"), TQVariant::Int); - setUnit(item, KFileMimeTypeInfo::FramesPerSecond); - item = addItemInfo(group, "TargetBitrate", i18n("Target Bitrate"), TQVariant::Int); - setUnit(item, KFileMimeTypeInfo::Bitrate); - item = addItemInfo(group, "Quality", i18n("Quality"), TQVariant::Int); - - // audio group - - group = addGroupInfo(info, "Audio", i18n("Audio Details")); - setAttributes(group, 0); - addItemInfo(group, "Channels", i18n("Channels"), TQVariant::Int); - - item = addItemInfo(group, "SampleRate", i18n("Sample Rate"), TQVariant::Int); - setUnit(item, KFileMimeTypeInfo::Hertz); -} - -bool theoraPlugin::readInfo( KFileMetaInfo& info, uint what) -{ - // most of the ogg stuff was borrowed from libtheora/examples/player_example.c - FILE *fp; - - ogg_sync_state o_sync_state; - ogg_packet o_packet; - ogg_page o_page; - - theora_info t_info; - theora_comment t_comment; - theora_state t_state; - vorbis_info v_info; - vorbis_comment v_comment; - - theora_p=0; - vorbis_p=0; - int theora_serial=0; - int stateflag=0; - - ogg_int64_t duration=0; - - // libtheora is still a bit unstable and sadly the init_ functions don't - // take care of things the way one would expect. So, let's do some explicit - // clearing of these fields. - - memset(&t_info, 0, sizeof(theora_info)); - memset(&t_comment, 0, sizeof(theora_comment)); - memset(&t_state, 0, sizeof(theora_state)); - - bool readTech = false; - - if (what & (KFileMetaInfo::Fastest | - KFileMetaInfo::DontCare | - KFileMetaInfo::TechnicalInfo)) - readTech = true; - - if ( info.path().isEmpty() ) // remote file - return false; - - fp = fopen(TQFile::encodeName(info.path()),"rb"); - if (!fp) - { - kdDebug(7034) << "Unable to open " << TQFile::encodeName(info.path()).data() << endl; - return false; - } - - ogg_sync_init(&o_sync_state); - - /* init supporting Vorbis structures needed in header parsing */ - vorbis_info_init(&v_info); - vorbis_comment_init(&v_comment); - - /* init supporting Theora structures needed in header parsing */ - theora_comment_init(&t_comment); - theora_info_init(&t_info); - - while(!stateflag && buffer_data(fp,&o_sync_state)!=0) - { - while (ogg_sync_pageout(&o_sync_state,&o_page)>0) - { - ogg_stream_state stream_test; - /* is this a mandated initial header? If not, stop parsing */ - if(!ogg_page_bos(&o_page)) - { - queue_page(&o_page); - stateflag=1; - break; - } - - ogg_stream_init(&stream_test,ogg_page_serialno(&o_page)); - ogg_stream_pagein(&stream_test,&o_page); - ogg_stream_packetout(&stream_test,&o_packet); - - /* identify the codec: try theora */ - if(!theora_p && theora_decode_header(&t_info,&t_comment,&o_packet)>=0) - { - /* it is theora */ - memcpy(&t_stream_state,&stream_test,sizeof(stream_test)); - theora_serial=ogg_page_serialno(&o_page); - theora_p=1; - } - else if(!vorbis_p && vorbis_synthesis_headerin(&v_info,&v_comment,&o_packet)>=0) - { - /* it is vorbis */ - memcpy(&v_stream_state,&stream_test,sizeof(stream_test)); - vorbis_p=1; - } - else - { - /* whatever it is, we don't care about it */ - ogg_stream_clear(&stream_test); - } - } - } - - /* we're expecting more header packets. */ - bool corruptedHeaders=false; - - while((theora_p && theora_p<3) || (vorbis_p && vorbis_p<3)) - { - int ret; - /* look for further theora headers */ - while(theora_p && (theora_p<3) && (ret=ogg_stream_packetout(&t_stream_state,&o_packet))) - { - if(ret<0) - { - kdDebug(7034)<<"Error parsing Theora stream headers; corrupt stream?\n"<0) - { - queue_page(&o_page); - /* demux into the appropriate stream */ - } - else - { - int ret=buffer_data(fp,&o_sync_state); /* someone needs more data */ - if(ret==0) - { - kdDebug(7034)<<"End of file while searching for codec headers."<0) - { - // The following line was commented out by Scott Wheeler - // We don't actually need to store all of the pages / packets in memory since - // (a) libtheora doesn't use them anyway in the one call that we make after this - // that usese t_state and (b) it basically buffers the entire file to memory if - // we queue them up like this and that sucks where a typical file size is a few - // hundred megs. - - // queue_page(&o_page); - } - if (theora_serial==ogg_page_serialno(&o_page)) - duration=(ogg_int64_t) theora_granule_time(&t_state,ogg_page_granulepos(&o_page)); - } - - if (readTech) - { - int stream_fps=0; - if (t_info.fps_denominator!=0) - stream_fps=t_info.fps_numerator/t_info.fps_denominator; - KFileMetaInfoGroup videogroup = appendGroup(info, "Video"); - appendItem(videogroup, "Length", int (duration)); - appendItem(videogroup, "Resolution", TQSize(t_info.frame_width,t_info.frame_height)); - appendItem(videogroup, "FrameRate", stream_fps); - appendItem(videogroup, "Quality", (int) t_info.quality); - - KFileMetaInfoGroup audiogroup = appendGroup(info, "Audio"); - appendItem(audiogroup, "Channels", v_info.channels); - appendItem(audiogroup, "SampleRate", int(v_info.rate)); - } - fclose(fp); - - if (vorbis_p) - { - ogg_stream_clear(&v_stream_state); - vorbis_comment_clear(&v_comment); - vorbis_info_clear(&v_info); - } - - ogg_stream_clear(&t_stream_state); - theora_clear(&t_state); - theora_comment_clear(&t_comment); - theora_info_clear(&t_info); - ogg_sync_clear(&o_sync_state); - - return true; -} - -#include "kfile_theora.moc" - diff --git a/kfile-plugins/theora/kfile_theora.desktop b/kfile-plugins/theora/kfile_theora.desktop deleted file mode 100644 index 215f3801..00000000 --- a/kfile-plugins/theora/kfile_theora.desktop +++ /dev/null @@ -1,60 +0,0 @@ -[Desktop Entry] -Type=Service -Name=theora Info -Name[bg]=Информация за theora -Name[bn]=থিওরা তথ্য -Name[br]=Titouroù diwar-benn theora -Name[bs]=theora informacije -Name[ca]=Informació theora -Name[cs]=theora info -Name[de]=Theora-Info -Name[el]=Πληροφορίες theora -Name[eo]=theora-informo -Name[es]=Info Theora -Name[et]=Theora info -Name[eu]=theora informazioa -Name[fa]=اطلاعات theora -Name[fi]=Theoran tiedot -Name[fr]=Informations theora -Name[ga]=Eolas faoi theora -Name[gl]=Información theora -Name[he]=מידע theora -Name[hu]=Theora-jellemzők -Name[is]=theora upplýsingar -Name[it]=Informazioni su theora -Name[ja]=theora 情報 -Name[kk]=theora мәліметі -Name[km]=ព័ត៌មាន theora -Name[ko]=theora 정보 -Name[lt]=theora Informacija -Name[mk]=theora информации -Name[nb]=theora-info -Name[nds]=Theora-Info -Name[ne]=थिवरा सूचना -Name[nl]=theora-informatie -Name[nn]=theora-info -Name[pa]=theora (ਥੋਰਾ) ਜਾਣਕਾਰੀ -Name[pl]=Informacja o pliku theora -Name[pt]=Informação do theora -Name[pt_BR]=Informação sobre theora -Name[ru]=Сведения о theora -Name[sk]=theora info -Name[sl]=Podatki o Theora -Name[sr]=Информације о theora-и -Name[sr@Latn]=Informacije o theora-i -Name[sv]=Theora-information -Name[ta]= தியோரா தகவல் -Name[th]=ข้อมูล theora -Name[tr]=theora Bilgisi -Name[uk]=Інформація по theora -Name[zh_CN]=theora 信息 -Name[zh_HK]=theora 資訊 -Name[zh_TW]=theora 資訊 -ServiceTypes=KFilePlugin -X-TDE-Library=kfile_theora -# change MimeType here! (example: inode/directory) -MimeType=video/x-theora -# change PreferredGroups here! (example: FolderInfo) -PreferredGroups= -# change PreferredItems here! (example: Items;Size) -PreferredItems=Size,Length diff --git a/kfile-plugins/theora/kfile_theora.h b/kfile-plugins/theora/kfile_theora.h deleted file mode 100644 index 815f92d9..00000000 --- a/kfile-plugins/theora/kfile_theora.h +++ /dev/null @@ -1,43 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2004 by Jean-Baptiste Mardelle * - * bj@altern.org * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - ***************************************************************************/ - -#ifndef __KFILE_THEORA_H__ -#define __KFILE_THEORA_H__ - -/** - * Note: For further information look into <$TDEDIR/include/kfilemetainfo.h> - */ -#include - -class TQStringList; - -class theoraPlugin: public KFilePlugin -{ - Q_OBJECT - - -public: - theoraPlugin( TQObject *parent, const char *name, const TQStringList& args ); - - virtual bool readInfo( KFileMetaInfo& info, uint what); -}; - -#endif // __KFILE_THEORA_H__ - diff --git a/kfile-plugins/wav/Makefile.am b/kfile-plugins/wav/Makefile.am deleted file mode 100644 index 5254d014..00000000 --- a/kfile-plugins/wav/Makefile.am +++ /dev/null @@ -1,22 +0,0 @@ -## Makefile.am for wav file meta info plugin - -# set the include path for X, qt and KDE -INCLUDES = $(all_includes) - -# these are the headers for your project -noinst_HEADERS = kfile_wav.h - -kde_module_LTLIBRARIES = kfile_wav.la - -kfile_wav_la_SOURCES = kfile_wav.cpp -kfile_wav_la_LDFLAGS = $(all_libraries) $(KDE_RPATH) $(LIB_QT) -lDCOP $(LIB_TDECORE) $(LIB_TDEUI) -ltdefx $(LIB_KIO) -ltdetexteditor -module $(KDE_PLUGIN) -kfile_wav_la_LIBADD = $(LIB_KIO) - -# let automoc handle all of the meta source files (moc) -METASOURCES = AUTO - -messages: rc.cpp - $(XGETTEXT) kfile_wav.cpp -o $(podir)/kfile_wav.pot - -services_DATA = kfile_wav.desktop -servicesdir = $(kde_servicesdir) diff --git a/kfile-plugins/wav/kfile_wav.cpp b/kfile-plugins/wav/kfile_wav.cpp deleted file mode 100644 index 50841d95..00000000 --- a/kfile-plugins/wav/kfile_wav.cpp +++ /dev/null @@ -1,173 +0,0 @@ -/* This file is part of the KDE project - * Copyright (C) 2002 Ryan Cumming - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public - * License as published by the Free Software Foundation version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - * - */ - -#include -#include "kfile_wav.h" - -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -#if !defined(__osf__) -#include -#else -typedef unsigned short uint16_t; -typedef unsigned int uint32_t; -#endif - -typedef KGenericFactory WavFactory; - -K_EXPORT_COMPONENT_FACTORY(kfile_wav, WavFactory( "kfile_wav" )) - -KWavPlugin::KWavPlugin(TQObject *parent, const char *name, - const TQStringList &args) - - : KFilePlugin(parent, name, args) -{ - KFileMimeTypeInfo* info = addMimeTypeInfo( "audio/x-wav" ); - - KFileMimeTypeInfo::GroupInfo* group = 0L; - - // "the" group - group = addGroupInfo(info, "Technical", i18n("Technical Details")); - - KFileMimeTypeInfo::ItemInfo* item; - - item = addItemInfo(group, "Sample Size", i18n("Sample Size"), TQVariant::Int); - setSuffix(item, i18n(" bits")); - - item = addItemInfo(group, "Sample Rate", i18n("Sample Rate"), TQVariant::Int); - setSuffix(item, i18n(" Hz")); - - item = addItemInfo(group, "Channels", i18n("Channels"), TQVariant::Int); - - item = addItemInfo(group, "Length", i18n("Length"), TQVariant::Int); - setAttributes(item, KFileMimeTypeInfo::Cummulative); - setUnit(item, KFileMimeTypeInfo::Seconds); -} - -bool KWavPlugin::readInfo( KFileMetaInfo& info, uint /*what*/) -{ - if ( info.path().isEmpty() ) // remote file - return false; - - TQFile file(info.path()); - - uint32_t format_size; - uint16_t format_tag; - uint16_t channel_count; - uint32_t sample_rate; - uint32_t bytes_per_second; - uint16_t bytes_per_sample; - uint16_t sample_size; - uint32_t data_size; - uint32_t unknown_chunk_size; - uint16_t unknown_chunk16; - bool have_fmt = false; - bool have_data = false; - TQIODevice::Offset file_length; - - const char *riff_signature = "RIFF"; - const char *wav_signature = "WAVE"; - const char *fmt_signature = "fmt "; - const char *data_signature = "data"; - char signature_buffer[4]; - - if (!file.open(IO_ReadOnly)) - { - kdDebug(7034) << "Couldn't open " << TQFile::encodeName(info.path()).data() << endl; - return false; - } - - file_length = file.size() - 100; // a bit of insurance - TQDataStream dstream(&file); - - // WAV files are little-endian - dstream.setByteOrder(TQDataStream::LittleEndian); - - // Read and verify the RIFF signature - dstream.readRawBytes(signature_buffer, 4); - if (memcmp(signature_buffer, riff_signature, 4)) - return false; - - // Skip the next bit (total file size, pretty useless) - file.at(8); - - // Read and verify the WAVE signature - dstream.readRawBytes(signature_buffer, 4); - if (memcmp(signature_buffer, wav_signature, 4)) - return false; - - // pretty dumb scanner, but better than what we had! - do - { - dstream.readRawBytes(signature_buffer, 4); - if (!memcmp(signature_buffer, fmt_signature, 4)) { - dstream >> format_size; - dstream >> format_tag; - dstream >> channel_count; - dstream >> sample_rate; - dstream >> bytes_per_second; - dstream >> bytes_per_sample; - dstream >> sample_size; - have_fmt = true; - if ( format_size > 16 ) { - for (unsigned int i = 0; i < (format_size-16+1)/2; i++) - dstream >> unknown_chunk16; - } - } else if (!memcmp(signature_buffer, data_signature, 4)) { - dstream >> data_size; - have_data = true; - } else { - dstream >> unknown_chunk_size; - for (unsigned int i = 0; i < (unknown_chunk_size+1)/2; i++) - dstream >> unknown_chunk16; - } - if (have_data && have_fmt) - break; - } while (file.at() < file_length); - - if ( (!have_data) || (!have_fmt) ) - return false; - - // These values are downright illegal - if ((!channel_count) || (!bytes_per_second)) - return false; - - KFileMetaInfoGroup group = appendGroup(info, "Technical"); - - - appendItem(group, "Sample Size", int(sample_size)); - appendItem(group, "Sample Rate", int(sample_rate)); - appendItem(group, "Channels", int(channel_count)); - unsigned int wav_seconds = data_size / bytes_per_second; - appendItem(group, "Length", int(wav_seconds)); - - return true; -} - -#include "kfile_wav.moc" diff --git a/kfile-plugins/wav/kfile_wav.desktop b/kfile-plugins/wav/kfile_wav.desktop deleted file mode 100644 index be468e1c..00000000 --- a/kfile-plugins/wav/kfile_wav.desktop +++ /dev/null @@ -1,67 +0,0 @@ -[Desktop Entry] -Type=Service -Name=WAV Info -Name[af]=Wav Inligting -Name[ar]=معلومات WAV -Name[bg]=Информация за WAV -Name[br]=Titouroù WAV -Name[bs]=WAV informacije -Name[ca]=Informació WAV -Name[cs]=WAV info -Name[cy]=Gwybodaeth WAV -Name[da]=WAV-info -Name[de]=WAV-Info -Name[el]=Πληροφορίες WAV -Name[eo]=WAV-informo -Name[es]=Info WAV -Name[et]=WAV info -Name[eu]=WAV informazioa -Name[fa]=اطلاعات WAV -Name[fi]=WAV-tiedot -Name[fr]=Informations Wave -Name[gl]=Información WAV -Name[he]=מידע WAV -Name[hi]=WAV जानकारी -Name[hr]=Informacije o WAV datoteci -Name[hu]=WAV-jellemzők -Name[is]=WAV upplýsingar -Name[it]=Informazioni WAV -Name[ja]=WAV 情報 -Name[kk]=WAV мәліметі -Name[km]=ព័ត៌មាន WAV -Name[ko]=WAV 정보 -Name[lt]=WAV informacija -Name[mk]=WAV информации -Name[nb]=WAV informasjon -Name[nds]=WAV-Info -Name[ne]=वाभ सूचना -Name[nl]=WAV-informatie -Name[nn]=WAV-info -Name[pa]=WAV ਜਾਣਕਾਰੀ -Name[pl]=Informacja o pliku WAV -Name[pt]=Informação do WAV -Name[pt_BR]=Informação sobre WAV -Name[ro]=Informaţii WAV -Name[ru]=Сведения о WAV -Name[se]=WAV-dieđut -Name[sl]=Podatki o WAV -Name[sr]=Информације о WAV-у -Name[sr@Latn]=Informacije o WAV-u -Name[sv]=Wav-information -Name[ta]=WAV தகவல் -Name[tg]=WAV Ахборот -Name[th]=ข้อมูล WAV -Name[tr]=WAV Bilgisi -Name[uk]=Інформація по WAV -Name[uz]=WAV haqida maʼlumot -Name[uz@cyrillic]=WAV ҳақида маълумот -Name[xh]=MAV Ulwazi -Name[zh_CN]=WAV 信息 -Name[zh_HK]=WAV 資訊 -Name[zh_TW]=WAV 資訊 -Name[zu]=Ulwazi lwe WAV -ServiceTypes=KFilePlugin -X-TDE-Library=kfile_wav -MimeType=audio/x-wav -PreferredGrous=Technical -PreferredItems=Length,Sample Rate,Sample Size,Channels diff --git a/kfile-plugins/wav/kfile_wav.h b/kfile-plugins/wav/kfile_wav.h deleted file mode 100644 index 7e14fc7f..00000000 --- a/kfile-plugins/wav/kfile_wav.h +++ /dev/null @@ -1,38 +0,0 @@ -/* This file is part of the KDE project - * Copyright (C) 2002 Ryan Cumming - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public - * License as published by the Free Software Foundation version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - * - */ - -#ifndef __KFILE_WAV_H__ -#define __KFILE_WAV_H__ - -#include - -class TQStringList; - -class KWavPlugin: public KFilePlugin -{ - Q_OBJECT - - -public: - KWavPlugin( TQObject *parent, const char *name, const TQStringList& args ); - - virtual bool readInfo( KFileMetaInfo& info, uint what); -}; - -#endif diff --git a/kioslave/Makefile.am b/kioslave/Makefile.am deleted file mode 100644 index 4586dcda..00000000 --- a/kioslave/Makefile.am +++ /dev/null @@ -1,5 +0,0 @@ -if include_kioslave_audiocd -AUDIOCD_SUBDIR=audiocd -endif - -SUBDIRS = $(AUDIOCD_SUBDIR) diff --git a/kioslave/audiocd/HACKING b/kioslave/audiocd/HACKING deleted file mode 100644 index dde6efc1..00000000 --- a/kioslave/audiocd/HACKING +++ /dev/null @@ -1,25 +0,0 @@ -// CODE LAYOUT - -audiocd.[h,cpp] - The main ioslave code. It contains the logic to rip audio from cd's. It loads all of the plugins that it can find. When it needs to encode, generate directories (and names of directories) it goes through it's list. audiocd uses libkcddb to retrieve its cddb entries and cdparinoia to retrieve the audio from the CD. - -plugins/audiocdencoder.[h,cpp] - The base class for all of the encoder plugins - -plugins/wav/* - The cda and wav "encoders" -plugins/flac/* - the flac encoder -plugins/lame/* - The mp3 encoder -plugins/vorbis/* - The ogg encoder - -kcmaudiocd/ - kcm configure dialog for the audiocd ioslave. It also loads the plugins and gets their configure dialogs and puts them into the tab dialog. - -// USERS - -Audiocd's "interface" is presented first to the users, It should be simple. The number of files/directories should be kept to a minimum. - -// APP SKIMMING - -Audiocd also has the ability to be "skimmed" by other tools. For example an outside application could retrieve the second track with: - -audiocd:/Wav/Track 02.wav?device=/dev/hd2&fileNameTemplate=Track %{number}&cddbChoice=1 - -This way apps can just query audiocd:/ for CDDB, present them to the users, and rip the tracks all without having to impliment it themselves. - diff --git a/kioslave/audiocd/Makefile.am b/kioslave/audiocd/Makefile.am deleted file mode 100644 index 736828e1..00000000 --- a/kioslave/audiocd/Makefile.am +++ /dev/null @@ -1,33 +0,0 @@ -if include_kcm_audiocd -AUDIO_CD_SUBDIRS = kcmaudiocd -endif -SUBDIRS = plugins $(AUDIO_CD_SUBDIRS) - -INCLUDES = -I$(top_srcdir)/libkcddb \ - -I$(top_builddir)/libkcddb $(all_includes) \ - -I$(top_srcdir)/kscd $(all_includes) \ - -I$(srcdir)/plugins $(all_includes) - -KDE_CXXFLAGS=$(ENABLE_PERMISSIVE_FLAG) - -kde_module_LTLIBRARIES = kio_audiocd.la - -kio_audiocd_la_SOURCES = audiocd.cpp - -kio_audiocd_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN) - -kio_audiocd_la_LIBADD = ./plugins/libaudiocdplugins.la $(LIB_KIO) $(CDPARANOIA_LIBS) $(top_builddir)/libkcddb/libkcddb.la $(top_builddir)/kscd/libkcompactdisc.la - -noinst_HEADERS = audiocd.h - -protocoldir = $(kde_servicesdir) -protocol_DATA = audiocd.protocol - -messages: - $(XGETTEXT) *.cpp -o $(podir)/kio_audiocd.pot - -updatedir = $(kde_datadir)/kconf_update -update_DATA = audiocd.upd -update_SCRIPTS = upgrade-metadata.sh - -audiocd.lo: ../../libkcddb/configbase.h diff --git a/kioslave/audiocd/audiocd.cpp b/kioslave/audiocd/audiocd.cpp deleted file mode 100644 index 7898be5a..00000000 --- a/kioslave/audiocd/audiocd.cpp +++ /dev/null @@ -1,1159 +0,0 @@ -/* - * Copyright (C) 2000 Rik Hemsley (rikkus) - * Copyright (C) 2000, 2001, 2002 Michael Matz - * Copyright (C) 2001 Carsten Duvenhorst - * Copyright (C) 2001 Adrian Schroeter - * Copyright (C) 2003 Richard Lärkäng - * Copyright (C) 2003 Scott Wheeler - * Copyright (C) 2004, 2005 Benjamin Meyer - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * ERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#include - -extern "C" -{ - #include - #include - void paranoiaCallback(long, int); - - #include - KDE_EXPORT int kdemain(int argc, char ** argv); -} - -#include "audiocd.h" -#include "plugins/audiocdencoder.h" - -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -// CDDB -#include -#include "kcompactdisc.h" - -using namespace TDEIO; -using namespace KCDDB; - -#define TQFL1(x) TQString::fromLatin1(x) -#define DEFAULT_CD_DEVICE "/dev/cdrom" -#define CDDB_INFORMATION "CDDB Information" - -using namespace AudioCD; - -static const KCmdLineOptions options[] = -{ - { "+protocol", I18N_NOOP("Protocol name"), 0 }, - { "+pool", I18N_NOOP("Socket name"), 0 }, - { "+app", I18N_NOOP("Socket name"), 0 }, - KCmdLineLastOption -}; - -int kdemain(int argc, char ** argv) -{ - // TDEApplication uses libkcddb which needs a valid kapp pointer - // GUIenabled must be true as libkcddb sometimes wants to communicate - // with the user - putenv(strdup("SESSION_MANAGER=")); - TDEApplication::disableAutoDcopRegistration(); - TDECmdLineArgs::init(argc, argv, "kio_audiocd", 0, 0, 0, 0); - TDECmdLineArgs::addCmdLineOptions(options); - TDEApplication app(false, true); - - kdDebug(7117) << "Starting " << getpid() << endl; - - TDECmdLineArgs* args = TDECmdLineArgs::parsedArgs(); - AudioCDProtocol slave(args->arg(0), args->arg(1), args->arg(2)); - slave.dispatchLoop(); - - kdDebug(7117) << "Done" << endl; - return 0; -} - -enum Which_dir { - Unknown = 0, // Error - Info, // CDDB info - Root, // The root directory, shows all these :) - FullCD, // Show a single file containing all of the data - EncoderDir // A directory created by an encoder -}; - -class AudioCDProtocol::Private { -public: - Private() : cd(KCompactDisc::Asynchronous) { - clearURLargs(); - s_info = i18n("Information"); - s_fullCD = i18n("Full CD"); - } - - void clearURLargs() { - req_allTracks = false; - which_dir = Unknown; - req_track = -1; - cddbUserChoice = -1; - } - - // The type/which of request - bool req_allTracks; - Which_dir which_dir; - int req_track; - TQString fname; - AudioCDEncoder *encoder_dir_type; - - // Misc settings - TQString device; // URL settable - int paranoiaLevel; // URL settable - bool reportErrors; - - // Directory strings, never change after init - TQString s_info; - TQString s_fullCD; - - // Current CD - unsigned discid; - unsigned tracks; - bool trackIsAudio[100]; - KCompactDisc cd; // keep it around so that we don't assume the disk changed between every stat() - - // CDDB items - KCDDB::CDDB::Result cddbResult; - CDInfoList cddbList; - int cddbUserChoice; // URL settable - KCDDB::CDInfo cddbBestChoice; - - // Template for .. - TQString fileNameTemplate; // URL settable - TQString albumTemplate; // URL settable - TQString rsearch; - TQString rreplace; - - // Current strings for this CD and or cddb selection - TQStringList templateTitles; - TQString templateAlbumName; -}; - -int paranoia_read_limited_error; - -AudioCDProtocol::AudioCDProtocol(const TQCString & protocol, const TQCString & pool, const TQCString & app) - : SlaveBase(protocol, pool, app) -{ - d = new Private; - - // Add encoders - AudioCDEncoder::findAllPlugins(this, encoders); - encoderTypeCDA = encoderFromExtension(".cda"); - encoderTypeWAV = encoderFromExtension(".wav"); - encoders.setAutoDelete(true); -} - -AudioCDProtocol::~AudioCDProtocol() -{ - delete d; -} - -AudioCDEncoder *AudioCDProtocol::encoderFromExtension(const TQString& extension) -{ - AudioCDEncoder *encoder; - for ( encoder = encoders.first(); encoder; encoder = encoders.next() ){ - if(TQString(".")+encoder->fileType() == extension) - return encoder; - } - Q_ASSERT(false); - return NULL; -} - -AudioCDEncoder *AudioCDProtocol::determineEncoder(const TQString & filename) -{ - int len = filename.length(); - int pos = filename.findRev('.'); - return encoderFromExtension(filename.right(len - pos)); -} - -struct cdrom_drive * AudioCDProtocol::initRequest(const KURL & url) -{ - if (url.hasHost()) - { - error(TDEIO::ERR_UNSUPPORTED_ACTION, - i18n("You cannot specify a host with this protocol. " - "Please use the audiocd:/ format instead.")); - return 0; - } - - // Load OUR Settings. - loadSettings(); - // Then url parameters can overrule our settings. - parseURLArgs(url); - - struct cdrom_drive * drive = getDrive(); - if (0 == drive) - return 0; - - // Update our knowledge of the disc - -#if defined(__linux__) - if(drive->ioctl_device_name && drive->ioctl_device_name[0]) - d->cd.setDevice(drive->ioctl_device_name, 50, false); - else - d->cd.setDevice(drive->cdda_device_name, 50, false); -#else - d->cd.setDevice(drive->cdda_device_name, 50, false); -#endif - -#if 0 - // FreeBSD's cdparanoia as of january 5th 2006 has rather broken - // support for non-SCSI devices. Although it finds ATA cdroms just - // fine, there is no straightforward way to discover the device - // name associated with the device, which throws the rest of audiocd - // for a loop. - // - if ( !(drive->dev) || (COOKED_IOCTL == drive->interface) ) - { - // For ATAPI devices, we have no real choice. Use the - // user selected value, even if there is none. - // - kdWarning(7117) << "Found an ATAPI device, assuming it is the one specified by the user." << endl; - d->cd.setDevice( d->device ); - } - else - { - kdDebug(7117) << "Found a SCSI or ATAPICAM device." << endl; - if ( strlen(drive->dev->device_path) > 0 ) - { - d->cd.setDevice( drive->dev->device_path ); - } - else - { - // But the device_path can be empty under some - // circumstances, so build a representation from - // the unit number and SCSI device name. - // - TQString devname = TQString::fromLatin1( "/dev/%1%2" ) - .arg( drive->dev->given_dev_name ) - .arg( drive->dev->given_unit_number ) ; - kdDebug(7117) << " Using derived name " << devname << endl; - d->cd.setDevice( devname ); - } - } -#endif - - if (d->cd.discId() != d->discid && d->cd.discId() != d->cd.missingDisc){ - d->discid = d->cd.discId(); - d->tracks = d->cd.tracks(); - for(uint i=0; i< d->cd.tracks(); i++) - d->trackIsAudio[i] = d->cd.isAudio(i+1); - - KCDDB::Client c; - d->cddbResult = c.lookup(d->cd.discSignature()); - d->cddbList = c.lookupResponse(); - d->cddbBestChoice = c.bestLookupResponse(); - generateTemplateTitles(); - } - - // Determine what file or folder that is wanted. - d->fname = url.fileName(false); - TQString dname = url.directory(true, false); - if (!dname.isEmpty() && dname[0] == '/') - dname = dname.mid(1); - - // Kong issue where they send dirs as files, double check - /* A hack, for when konqi wants to list the directory audiocd:/Bla - it really submits this URL, instead of audiocd:/Bla/ to us. We could - send (in listDir) the UDS_NAME as "Bla/" for directories, but then - konqi shows them as "Bla//" in the status line. */ - // See if it is an encoder directory - AudioCDEncoder *encoder; - for ( encoder = encoders.first(); encoder; encoder = encoders.next() ){ - if(encoder->type() == d->fname){ - dname = d->fname; - d->fname = ""; - break; - } - } - // Other Hard coded directories - if (dname.isEmpty() && (d->fname == d->s_info || d->fname == d->s_fullCD )) - { - dname = d->fname; - d->fname = ""; - } - // end hack - - - // See which directory they want - d->which_dir = Unknown; - for ( encoder = encoders.first(); encoder; encoder = encoders.next() ){ - if(encoder->type() == dname){ - d->which_dir = EncoderDir; - d->encoder_dir_type = encoder; - break; - } - } - if ( Unknown == d->which_dir ){ - if (dname.isEmpty()) - d->which_dir = Root; - else if (dname == d->s_info) - d->which_dir = Info; - else if (dname == d->s_fullCD) - d->which_dir = FullCD; - } - - // See if the url is a track - d->req_track = -1; - if (!d->fname.isEmpty()){ - TQString name(d->fname); - - // Remove extension - int dot = name.findRev('.'); - if (dot >= 0) - name.truncate(dot); - - // See if it matches a cddb title - uint trackNumber; - for (trackNumber = 0; trackNumber < d->tracks; trackNumber++){ - if (d->templateTitles[trackNumber] == name) - break; - } - if (trackNumber < d->tracks) - d->req_track = trackNumber; - else { - /* Not found in title list. Try hard to find a number in the - string. */ - unsigned int start = 0; - unsigned int end = 0; - // Find where the numbers start - while (start < name.length()){ - if (name[start++].isDigit()) - break; - } - // Find where the numbers end - for (end = start; end < name.length(); end++) - if (!name[end].isDigit()) - break; - if (start < name.length()){ - bool ok; - // The external representation counts from 1 so subtrac 1. - d->req_track = name.mid(start-1, end - start+2).toInt(&ok) - 1; - if (!ok) - d->req_track = -1; - } - } - } - if (d->req_track >= (int)d->tracks) - d->req_track = -1; - - // Are we in the directory that lists "full CD" files? - d->req_allTracks = (dname.contains(d->s_fullCD)); - - kdDebug(7117) << "dir=" << dname << " file=" << d->fname - << " req_track=" << d->req_track << " which_dir=" << d->which_dir << " full CD?=" << d->req_allTracks << endl; - return drive; -} - -bool AudioCDProtocol::getSectorsForRequest(struct cdrom_drive * drive, long & firstSector, long & lastSector) const -{ - if (d->req_allTracks) - { // we rip all the tracks of the CD - firstSector = cdda_track_firstsector(drive, 1); - lastSector = cdda_track_lastsector(drive, cdda_tracks(drive)); - } - else - { // we only rip the selected track - int trackNumber = d->req_track + 1; - - if (trackNumber <= 0 || trackNumber > cdda_tracks(drive)) - return false; - firstSector = cdda_track_firstsector(drive, trackNumber); - lastSector = cdda_track_lastsector(drive, trackNumber); - } - return true; -} - -void AudioCDProtocol::get(const KURL & url) -{ - struct cdrom_drive * drive = initRequest(url); - if (!drive) - return; - - if( d->fname.contains(i18n(CDDB_INFORMATION))){ - uint choice = 1; - if(d->fname != TQString("%1.txt").arg(i18n(CDDB_INFORMATION))){ - choice= d->fname.section('_',1,1).section('.',0,0).toInt(); - } - uint count = 1; - CDInfoList::iterator it; - bool found = false; - for ( it = d->cddbList.begin(); it != d->cddbList.end(); ++it ){ - if(count == choice){ - mimeType("text/html"); - data(TQCString( (*it).toString().latin1() )); - // send an empty TQByteArray to signal end of data. - data(TQByteArray()); - finished(); - found = true; - break; - } - count++; - } - if(!found && d->fname.contains(i18n(CDDB_INFORMATION)+":")){ - mimeType("text/html"); - //data(TQCString( d->fname.latin1() )); - // send an empty TQByteArray to signal end of data. - data(TQByteArray()); - finished(); - found = true; - } - if( !found ) - error(TDEIO::ERR_DOES_NOT_EXIST, url.path()); - cdda_close(drive); - return; - } - - long firstSector, lastSector; - if (!getSectorsForRequest(drive, firstSector, lastSector)) - { - error(TDEIO::ERR_DOES_NOT_EXIST, url.path()); - cdda_close(drive); - return; - } - - AudioCDEncoder *encoder = determineEncoder(d->fname); - if(!encoder){ - cdda_close(drive); - return; - } - - KCDDB::CDInfo info; - if(d->cddbResult == KCDDB::CDDB::Success){ - info = d->cddbBestChoice; - - int track = d->req_track; - - // hack - // do we rip the whole CD? - if (d->req_allTracks){ - track = 0; - // YES => the title of the file is the title of the CD - info.trackInfoList[track].title = info.title.utf8().data(); - } - encoder->fillSongInfo(info, track, ""); - } - long totalByteCount = CD_FRAMESIZE_RAW * (lastSector - firstSector + 1); - long time_secs = (8 * totalByteCount) / (44100 * 2 * 16); - - unsigned long size = encoder->size(time_secs); - totalSize(size); - emit mimeType(TQFL1(encoder->mimeType())); - - // Read data (track/disk) from the cd - paranoiaRead(drive, firstSector, lastSector, encoder, url.fileName(), size); - - // send an empty TQByteArray to signal end of data. - data(TQByteArray()); - - cdda_close(drive); - - finished(); -} - -void AudioCDProtocol::stat(const KURL & url) -{ - struct cdrom_drive * drive = initRequest(url); - if (!drive) - return; - - bool isFile = !d->fname.isEmpty(); - - // the track number. 0 if ripping - // the whole CD. - uint trackNumber = d->req_track + 1; - - if (!d->req_allTracks) - { // we only want to rip one track. - // does this track exist? - if (isFile && (trackNumber < 1 || trackNumber > d->tracks)) - { - error(TDEIO::ERR_DOES_NOT_EXIST, url.path()); - return; - } - } - - UDSEntry entry; - - UDSAtom atom; - atom.m_uds = TDEIO::UDS_NAME; - atom.m_str = url.fileName().replace('/', TQFL1("%2F")); - kdDebug(7117) << k_funcinfo << atom.m_str << endl; - entry.append(atom); - - atom.m_uds = TDEIO::UDS_FILE_TYPE; - atom.m_long = isFile ? S_IFREG : S_IFDIR; - entry.append(atom); - - const mode_t _umask = ::umask(0); - ::umask(_umask); - - atom.m_uds = TDEIO::UDS_ACCESS; - atom.m_long = 0666 & (~_umask); - entry.append(atom); - - atom.m_uds = TDEIO::UDS_SIZE; - if (!isFile) - { - atom.m_long = cdda_tracks(drive); - } - else - { - AudioCDEncoder *encoder = determineEncoder(d->fname); - long firstSector, lastSector; - getSectorsForRequest(drive, firstSector, lastSector); - atom.m_long = fileSize(firstSector, lastSector, encoder); - } - - entry.append(atom); - - statEntry(entry); - - cdda_close(drive); - - finished(); -} - -static void app_entry(UDSEntry& e, unsigned int uds, const TQString& str) -{ - UDSAtom a; - a.m_uds = uds; - a.m_str = str; - e.append(a); -} - -static void app_entry(UDSEntry& e, unsigned int uds, long l) -{ - UDSAtom a; - a.m_uds = uds; - a.m_long = l; - e.append(a); -} - -static void app_dir(UDSEntry& e, const TQString & n, size_t s) -{ - e.clear(); - app_entry(e, TDEIO::UDS_NAME, TQFile::decodeName(n.local8Bit())); - app_entry(e, TDEIO::UDS_FILE_TYPE, S_IFDIR); - app_entry(e, TDEIO::UDS_ACCESS, 0400); - app_entry(e, TDEIO::UDS_SIZE, s); - app_entry(e, TDEIO::UDS_MIME_TYPE, "inode/directory"); -} - -static void app_file(UDSEntry& e, const TQString & n, size_t s) -{ - e.clear(); - app_entry(e, TDEIO::UDS_NAME, TQFile::decodeName(n.local8Bit())); - app_entry(e, TDEIO::UDS_FILE_TYPE, S_IFREG); - app_entry(e, TDEIO::UDS_ACCESS, 0400); - app_entry(e, TDEIO::UDS_SIZE, s); -} - -void AudioCDProtocol::listDir(const KURL & url) -{ - struct cdrom_drive * drive = initRequest(url); - - // Some error checking before proceeding - if (!drive) - return; - - if (d->which_dir == Unknown){ - error(TDEIO::ERR_DOES_NOT_EXIST, url.path()); - cdda_close(drive); - return; - } - - if ( !d->fname.isEmpty() ){ - error(TDEIO::ERR_IS_FILE, url.path()); - cdda_close(drive); - return; - } - - // Generate templated names every time - // because the template might have changed. - generateTemplateTitles(); - - UDSEntry entry; - // If the tracks should be listed in this directory - bool list_tracks = true; - - if (d->which_dir == Info){ - CDInfoList::iterator it; - uint count = 1; - for ( it = d->cddbList.begin(); it != d->cddbList.end(); ++it ){ - (*it).toString(); - if(count == 1) - app_file(entry, TQString("%1.txt").arg(i18n(CDDB_INFORMATION)), ((*it).toString().length())+1); - else - app_file(entry, TQString("%1_%2.txt").arg(i18n(CDDB_INFORMATION)).arg(count), ((*it).toString().length())+1); - count++; - listEntry(entry, false); - } - // Error - if( count == 1 ) { - app_file(entry, TQString("%1: %2.txt").arg(i18n(CDDB_INFORMATION)).arg(CDDB::resultToString(d->cddbResult)), ((*it).toString().length())+1); - count++; - listEntry(entry, false); - } - - list_tracks = false; - } - - if (d->which_dir == Root){ - // List virtual directories. - app_dir(entry, d->s_fullCD, encoders.count()); - listEntry(entry, false); - - // Either >0 cddb results or cddb error file - app_dir(entry, d->s_info, d->cddbList.count()); - listEntry(entry, false); - - // List the encoders - AudioCDEncoder *encoder; - for ( encoder = encoders.first(); encoder; encoder = encoders.next() ){ - // Skip the directory that is in the root (you can still go in it, just don't show it) - if( encoder == encoderTypeWAV ) - continue; - app_dir(entry, encoder->type(), d->tracks); - listEntry(entry, false); - } - } - - // Now fill in the tracks for the current directory - if (list_tracks && d->which_dir == FullCD) { - // if we're listing the "full CD" subdirectory : - if ( (d->which_dir == FullCD) ) { - AudioCDEncoder *encoder; - for ( encoder = encoders.first(); encoder; encoder = encoders.next() ){ - if (d->cddbResult != KCDDB::CDDB::Success) - addEntry(d->s_fullCD, encoder, drive, -1); - else - addEntry(d->templateAlbumName, encoder, drive, -1); - } - } - } - - if (list_tracks && d->which_dir != FullCD) { - // listing another dir than the "FullCD" one. - for (uint trackNumber = 1; trackNumber <= d->tracks; trackNumber++) - { - // Skip data tracks - if (!d->trackIsAudio[trackNumber-1]) - continue; - - switch (d->which_dir) { - case Root:{ - addEntry(d->templateTitles[trackNumber - 1], - encoderTypeWAV, drive, trackNumber); - break; - } - case EncoderDir: - addEntry(d->templateTitles[trackNumber - 1], - d->encoder_dir_type, drive, trackNumber); - break; - case Info: - case Unknown: - default: - error(TDEIO::ERR_INTERNAL, url.path()); - cdda_close(drive); - return; - } - } - } - - totalSize(entry.count()); - listEntry(entry, true); - cdda_close(drive); - finished(); -} - -void AudioCDProtocol::addEntry(const TQString& trackTitle, AudioCDEncoder *encoder, struct cdrom_drive * drive, int trackNo) -{ - if(!encoder || !drive) - return; - - long theFileSize = 0; - if (trackNo == -1) - { // adding entry for the full CD - theFileSize = fileSize(cdda_track_firstsector(drive, 1), - cdda_track_lastsector(drive, cdda_tracks(drive)), - encoder); - } - else - { // adding one regular track - long firstSector = cdda_track_firstsector(drive, trackNo); - long lastSector = cdda_track_lastsector(drive, trackNo); - theFileSize = fileSize(firstSector, lastSector, encoder); - } - UDSEntry entry; - app_file(entry, trackTitle + TQString(".")+encoder->fileType(), theFileSize); - listEntry(entry, false); -} - -long AudioCDProtocol::fileSize(long firstSector, long lastSector, AudioCDEncoder *encoder) -{ - if(!encoder) - return 0; - - long filesize = CD_FRAMESIZE_RAW * ( lastSector - firstSector + 1 ); - long length_seconds = (filesize) / 176400; - - return encoder->size(length_seconds); -} - -struct cdrom_drive *AudioCDProtocol::getDrive() -{ - TQCString device(TQFile::encodeName(d->device)); - - struct cdrom_drive * drive = 0; - - if (!device.isEmpty() && device != "/") - drive = cdda_identify(device, CDDA_MESSAGE_PRINTIT, 0); - else - { - drive = cdda_find_a_cdrom(CDDA_MESSAGE_PRINTIT, 0); - - if (0 == drive) - { - if (TQFile(TQFile::decodeName(DEFAULT_CD_DEVICE)).exists()) - drive = cdda_identify(DEFAULT_CD_DEVICE, CDDA_MESSAGE_PRINTIT, 0); - } - } - - if (0 == drive) { - kdDebug(7117) << "Can't find an audio CD on: \"" << d->device << "\"" << endl; - - TQFileInfo fi(d->device); - if(!fi.isReadable()) - error(TDEIO::ERR_SLAVE_DEFINED, i18n("Device doesn't have read permissions for this account. Check the read permissions on the device.")); - else if(!fi.isWritable()) - error(TDEIO::ERR_SLAVE_DEFINED, i18n("Device doesn't have write permissions for this account. Check the write permissions on the device.")); - else if(!fi.exists()) - error(TDEIO::ERR_DOES_NOT_EXIST, d->device); - else error(TDEIO::ERR_SLAVE_DEFINED, -i18n("Unknown error. If you have a cd in the drive try running cdparanoia -vsQ as yourself (not root). Do you see a track list? If not, make sure you have permission to access the CD device. If you are using SCSI emulation (possible if you have an IDE CD writer) then make sure you check that you have read and write permissions on the generic SCSI device, which is probably /dev/sg0, /dev/sg1, etc.. If it still does not work, try typing audiocd:/?device=/dev/sg0 (or similar) to tell kio_audiocd which device your CD-ROM is.")); - return 0; - } - - if (0 != cdda_open(drive)) - { - kdDebug(7117) << "cdda_open failed" << endl; - error(TDEIO::ERR_CANNOT_OPEN_FOR_READING, d->device); - cdda_close(drive); - return 0; - } - - return drive; -} - -void AudioCDProtocol::paranoiaRead( - struct cdrom_drive * drive, - long firstSector, - long lastSector, - AudioCDEncoder* encoder, - const TQString& fileName, - unsigned long size - ) -{ - if(!encoder || !drive) - return; - - cdrom_paranoia * paranoia = paranoia_init(drive); - if (0 == paranoia) { - kdDebug(7117) << "paranoia_init failed" << endl; - return; - } - - int paranoiaLevel = PARANOIA_MODE_FULL ^ PARANOIA_MODE_NEVERSKIP; - switch (d->paranoiaLevel) - { - case 0: - paranoiaLevel = PARANOIA_MODE_DISABLE; - break; - - case 1: - paranoiaLevel |= PARANOIA_MODE_OVERLAP; - paranoiaLevel &= ~PARANOIA_MODE_VERIFY; - break; - - case 2: - paranoiaLevel |= PARANOIA_MODE_NEVERSKIP; - default: - break; - } - - paranoia_modeset(paranoia, paranoiaLevel); - - cdda_verbose_set(drive, CDDA_MESSAGE_PRINTIT, CDDA_MESSAGE_PRINTIT); - - paranoia_seek(paranoia, firstSector, SEEK_SET); - - long currentSector(firstSector); - - unsigned long processed = encoder->readInit(CD_FRAMESIZE_RAW * (lastSector - firstSector + 1)); - // TODO test for errors (processed<0)? - processedSize(processed); - bool ok = true; - - unsigned long lastSize = size; - unsigned long diff = 0; - - paranoia_read_limited_error = 0; - int warned = 0; - while (currentSector <= lastSector) - { - // TODO make the 5 configurable? The default in the lib is 20 fyi - int16_t * buf = paranoia_read_limited(paranoia, paranoiaCallback, 5); - if( warned == 0 && paranoia_read_limited_error >= 5 && d->reportErrors ){ - warning(i18n("AudioCD: Disk damage detected on this track, risk of data corruption.")); - warned = 1; - } - if (0 == buf) { - kdDebug(7117) << "Unrecoverable error in paranoia_read" << endl; - ok = false; - error( ERR_SLAVE_DEFINED, i18n( "Error reading audio data for %1 from the CD" ).arg( fileName ) ); - break; - } - - ++currentSector; - - int encoderProcessed = encoder->read(buf, CD_FRAMESAMPLES); - if(encoderProcessed == -1){ - kdDebug(7117) << "Encoder processing error, stopping." << endl; - ok = false; - TQString errMsg = i18n( "Couldn't read %1: encoding failed" ).arg( fileName ); - TQString details = encoder->lastErrorMessage(); - if ( !details.isEmpty() ) - errMsg += "\n" + details; - error( ERR_SLAVE_DEFINED, errMsg ); - break; - } - processed += encoderProcessed; - - /** - * Because compression size is so 'unknown' use some guesswork - * - * 1) First assume that the reported size is correct and - * only change the totalSize if the guess it outside a range of %5. - * 2) Only increase in size unless the decrease is %5 of last estimate. - * This prevents continues small changes which is just annoying. - */ - unsigned long end = lastSector - firstSector; - unsigned long cur = currentSector - firstSector; - unsigned long estSize = (processed / cur ) * end; - - // If our guess is within 5% of reported - // size then use the reported size. - unsigned long guess = (long)((100/(float)size)*estSize); - if((guess > 97 && guess < 103) || estSize == 0){ - if(processed > lastSize){ - totalSize(processed+1); - lastSize = processed; - } - } - else{ - float percentDone = ((float)cur/(float)end); - // Calculate estimated amount that will be wrong - diff = estSize - lastSize; - diff = (diff*(unsigned long)((100/(float)end)*(end-cur)))/2; - // Need 1% of data calculated as initial buffer, use %2 to be safe - if( percentDone < .02 ){ - //tqDebug("val: %f, diff: %ld", ((float)cur/(float)end), diff); - diff = 0; - } - - // We are growing larger, increase total. - if(lastSize < estSize){ - //tqDebug("lastGuess: %ld, guess: %ld diff: %ld", lastSize, estSize, diff); - totalSize(estSize+diff); - lastSize = estSize+diff; - } - else{ - int margin = (int)((percentDone)*75); - // Don't bother really trying until almost half way done. - if( percentDone <= .40 ) - margin = 7; - unsigned long low = lastSize - lastSize/margin; - if(estSize < low){ - //tqDebug("low: %ld, estSize: %ld, num: %i", low, estSize, margin); - totalSize( estSize ); - lastSize = estSize; - } - } - } - /** - * End estimation. - */ - //tqDebug("processed: %ld, totalSize: %ld", processed, estSize); - processedSize(processed); - } - - if(processed > size) - totalSize(processed); - - long encoderProcessed = encoder->readCleanup(); - if ( encoderProcessed >= 0 ) { - processed += encoderProcessed; - if(processed > size) - totalSize(processed); - processedSize(processed); - } - else if ( ok ) // i.e. no error message already emitted - error( ERR_SLAVE_DEFINED, i18n( "Couldn't read %1: encoding failed" ).arg( fileName ) ); - - paranoia_free(paranoia); - paranoia = 0; -} - -/** - * Read the settings from the URL - * @see loadSettings() - */ -void AudioCDProtocol::parseURLArgs(const KURL & url) -{ - d->clearURLargs(); - - TQString query(KURL::decode_string(url.query())); - - if (query.isEmpty() || query[0] != '?') - return; - - query = query.mid(1); // Strip leading '?'. - - TQStringList tokens(TQStringList::split('&', query)); - - for (TQStringList::ConstIterator it(tokens.begin()); it != tokens.end(); ++it) - { - TQString token(*it); - - int equalsPos(token.find('=')); - if (-1 == equalsPos) - continue; - - TQString attribute(token.left(equalsPos)); - TQString value(token.mid(equalsPos + 1)); - - if (attribute == TQFL1("device")) - d->device = value; - else if (attribute == TQFL1("paranoia_level")) - d->paranoiaLevel = value.toInt(); - else if (attribute == TQFL1("fileNameTemplate")) - d->fileNameTemplate = value; - else if (attribute == TQFL1("albumNameTemplate")) - d->albumTemplate = value; - else if (attribute == TQFL1("cddbChoice")) - d->cddbUserChoice = value.toInt(); - else if (attribute == TQFL1("niceLevel")){ - int niceLevel = value.toInt(); - if(setpriority(PRIO_PROCESS, getpid(), niceLevel) != 0) - kdDebug(7117) << "Setting nice level to (" << niceLevel << ") failed." << endl; - } - } -} - -/** - * Read the settings set by the kcm modules - * @see parseURLArgs() - */ -void AudioCDProtocol::loadSettings() -{ - TDEConfig *config = new TDEConfig(TQFL1("kcmaudiocdrc"), true /*readonly*/, false /*no kdeglobals*/); - - config->setGroup(TQFL1("CDDA")); - - if (!config->readBoolEntry(TQFL1("autosearch"),true)) { - d->device = config->readEntry(TQFL1("device"),TQFL1(DEFAULT_CD_DEVICE)); - } - - d->paranoiaLevel = 1; // enable paranoia error correction, but allow skipping - - if (config->readBoolEntry("disable_paranoia",false)) { - d->paranoiaLevel = 0; // disable all paranoia error correction - } - - if (config->readBoolEntry("never_skip",true)) { - d->paranoiaLevel = 2; - // never skip on errors of the medium, should be default for high quality - } - - d->reportErrors = config->readBoolEntry( "report_errors", false ); - - if(config->hasKey("niceLevel")) { - int niceLevel = config->readNumEntry("niceLevel", 0); - if(setpriority(PRIO_PROCESS, getpid(), niceLevel) != 0) - kdDebug(7117) << "Setting nice level to (" << niceLevel << ") failed." << endl; - } - - // The default track filename template - config->setGroup("FileName"); - d->fileNameTemplate = config->readEntry("file_name_template", "%{albumartist} - %{number} - %{title}"); - d->albumTemplate = config->readEntry("album_template", "%{albumartist} - %{albumtitle}"); - d->rsearch = config->readEntry("regexp_search"); - d->rreplace = config->readEntry("regexp_replace"); - // if the regular expressions are enclosed in qoutes. remove them - // otherwise it is not possible to search for a space " ", since an empty (only spaces) value is not - // supported by TDEConfig, so the space has to be qouted, but then here the regexp searches really for " " - // instead of just the space. Alex - TQRegExp qoutedString("^\".*\"$"); - if (qoutedString.exactMatch(d->rsearch)) - { - d->rsearch=d->rsearch.mid(1, d->rsearch.length()-2); - } - if (qoutedString.exactMatch(d->rreplace)) - { - d->rreplace=d->rreplace.mid(1, d->rreplace.length()-2); - } - - // Tell the encoders to load their settings - AudioCDEncoder *encoder = encoders.first(); - while ( encoder ) { - if ( encoder->init() ) { - kdDebug(7117) << "Encoder for " << encoder->type() << " is available." << endl; - encoder->loadSettings(); - encoder = encoders.next(); - } else { - kdDebug(7117) << "Encoder for " << encoder->type() << " is NOT available." << endl; - encoders.remove( encoder ); - encoder = encoders.current(); - } - } - - delete config; -} - -/** - * Generates the track titles from the template using the cddb information. - */ -void AudioCDProtocol::generateTemplateTitles() -{ - d->templateTitles.clear(); - if (d->cddbResult != KCDDB::CDDB::Success) - { - for (unsigned int i = 0; i < d->tracks; i++){ - TQString n; - d->templateTitles.append( i18n("Track %1").arg(n.sprintf("%02d", i + 1))); - } - return; - } - - KCDDB::CDInfo info = d->cddbBestChoice; - if(d->cddbUserChoice >= 0 && (((uint)d->cddbUserChoice) < d->cddbList.count())) - info = d->cddbList[d->cddbUserChoice]; - - // Then generate the templates - d->templateTitles.clear(); - for (uint i = 0; i < d->tracks; i++) { - TQMap macros; - macros["albumartist"] = info.artist; - macros["albumtitle"] = info.title; - macros["title"] = (info.trackInfoList[i].title); - TQString n; - macros["number"] = n.sprintf("%02d", i + 1); - //macros["number"] = TQString("%1").arg(i+1, 2, 10); - macros["genre"] = info.genre; - macros["year"] = TQString::number(info.year); - - TQString title = KMacroExpander::expandMacros(d->fileNameTemplate, macros, '%').replace('/', TQFL1("%2F")); - title.replace( TQRegExp(d->rsearch), d->rreplace ); - d->templateTitles.append(title); - } - - TQMap macros; - macros["albumartist"] = info.artist; - macros["albumtitle"] = info.title; - macros["genre"] = info.genre; - macros["year"] = TQString::number(info.year); - d->templateAlbumName = KMacroExpander::expandMacros(d->albumTemplate, macros, '%').replace('/', TQFL1("%2F")); - d->templateAlbumName.replace( TQRegExp(d->rsearch), d->rreplace ); -} - -/** - * Based upon the cdparinoia ripping application - * Only output BAD stuff - * The higher the paranoia_read_limited_error the worse the problem is - * FYI: PARANOIA_CB_READ & PARANOIA_CB_VERIFY happen continusly when ripping - */ -void paranoiaCallback(long, int function) -{ - switch(function){ - case PARANOIA_CB_VERIFY: - //kdDebug(7117) << "PARANOIA_CB_VERIFY" << endl; - break; - - case PARANOIA_CB_READ: - //kdDebug(7117) << "PARANOIA_CB_READ" << endl; - break; - - case PARANOIA_CB_FIXUP_EDGE: - //kdDebug(7117) << "PARANOIA_CB_FIXUP_EDGE" << endl; - paranoia_read_limited_error = 2; - break; - - case PARANOIA_CB_FIXUP_ATOM: - //kdDebug(7117) << "PARANOIA_CB_FIXUP_ATOM" << endl; - paranoia_read_limited_error = 6; - break; - - case PARANOIA_CB_READERR: - kdDebug(7117) << "PARANOIA_CB_READERR" << endl; - paranoia_read_limited_error = 6; - break; - - case PARANOIA_CB_SKIP: - kdDebug(7117) << "PARANOIA_CB_SKIP" << endl; - paranoia_read_limited_error = 8; - break; - - case PARANOIA_CB_OVERLAP: - //kdDebug(7117) << "PARANOIA_CB_OVERLAP" << endl; - break; - - case PARANOIA_CB_SCRATCH: - kdDebug(7117) << "PARANOIA_CB_SCRATCH" << endl; - paranoia_read_limited_error = 7; - break; - - case PARANOIA_CB_DRIFT: - //kdDebug(7117) << "PARANOIA_CB_DRIFT" << endl; - paranoia_read_limited_error = 4; - break; - - case PARANOIA_CB_FIXUP_DROPPED: - kdDebug(7117) << "PARANOIA_CB_FIXUP_DROPPED" << endl; - paranoia_read_limited_error = 5; - break; - - case PARANOIA_CB_FIXUP_DUPED: - kdDebug(7117) << "PARANOIA_CB_FIXUP_DUPED" << endl; - paranoia_read_limited_error = 5; - break; - } -} - diff --git a/kioslave/audiocd/audiocd.h b/kioslave/audiocd/audiocd.h deleted file mode 100644 index a96000fb..00000000 --- a/kioslave/audiocd/audiocd.h +++ /dev/null @@ -1,126 +0,0 @@ -/* - * Copyright (C) 2000 Rik Hemsley (rikkus) - * Copyright (C) 2000, 2001, 2002 Michael Matz - * Copyright (C) 2001 Carsten Duvenhorst - * Copyright (C) 2001 Adrian Schroeter - * Copyright (C) 2003 Richard Lärkäng - * Copyright (C) 2003 Scott Wheeler - * Copyright (C) 2004, 2005 Benjamin Meyer - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * ERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef AUDIO_CD_H -#define AUDIO_CD_H - -#include - -class AudioCDEncoder; - -struct cdrom_drive; - -namespace AudioCD { - -/** - * The core class of the audiocd:// ioslave. - * It has the iosalve login and the ripping logic. The actual encoding - * is done by encoders that are seperate objects. - */ -class AudioCDProtocol : public TDEIO::SlaveBase -{ - public: - - AudioCDProtocol(const TQCString & protocol, const TQCString & pool, const TQCString & app); - virtual ~AudioCDProtocol(); - - virtual void get(const KURL &); - virtual void stat(const KURL &); - virtual void listDir(const KURL &); - - protected: - AudioCDEncoder *encoderFromExtension(const TQString& extension); - AudioCDEncoder *determineEncoder(const TQString & filename); - - struct cdrom_drive *findDrive(bool &noPermission); - void parseURLArgs(const KURL &); - - void loadSettings(); - - /** - * From the request information (Private member "d"), - * get the first and last sector for the request. - * return false if the parameters are invalid (for instance, - * track number which does not exist on this CD) - */ - bool getSectorsForRequest(struct cdrom_drive * drive, - long & firstSector, long & lastSector) const; - - /** - * Give the size in bytes of the space between those two - * sectors, depending on the file type. - */ - long fileSize(long firstSector, long lastSector, AudioCDEncoder *encoder); - - /** - * The heart of this ioslave. - * Reads data off the cd and then passes it to an encoder to encode - */ - void paranoiaRead( - struct cdrom_drive * drive, - long firstSector, - long lastSector, - AudioCDEncoder* encoder, - const TQString& fileName, - unsigned long size - ); - - struct cdrom_drive *initRequest(const KURL &); - uint discid(struct cdrom_drive *); - - /** - * Add an entry in the KIO directory, using the title you give, - * it will set the extension itself depending on the fileType. - * You must also give the trackNumber for the size of the file - * to be calculated. - * NOTE: if you want to add a file which is the whole CD, give - * trackNo = -1 - * NOTE2: you can safely add MP3 or OGG files always. the function - * will check if kio_audiocd was compiled with support for those, - * so NO NEED to wrap your calls with #ifdef for lame or vorbis. - * this function will do the right thing. - */ - void addEntry(const TQString& trackTitle, AudioCDEncoder *encoder, - struct cdrom_drive * drive, int trackNo); - - class Private; - Private * d; - -private: - - void generateTemplateTitles(); - - TQPtrList encoders; - cdrom_drive * getDrive(); - - // These are the only garenteed encoders to be built, the rest - // are dynamic depending on other libraries on the system - AudioCDEncoder *encoderTypeCDA; - AudioCDEncoder *encoderTypeWAV; -}; - -} // end namespace AudioCD - -#endif // AUDIO_CD_H - diff --git a/kioslave/audiocd/audiocd.protocol b/kioslave/audiocd/audiocd.protocol deleted file mode 100644 index 7a3f497f..00000000 --- a/kioslave/audiocd/audiocd.protocol +++ /dev/null @@ -1,16 +0,0 @@ -[Protocol] -exec=kio_audiocd -protocol=audiocd -input=none -output=filesystem -listing=Name,Type,Size,Access -reading=true -writing=false -makedir=false -deleting=false -linking=false -moving=false -Icon=cdaudio_unmount -DocPath=kioslave/audiocd.html -Class=:local -ShowPreviews=false diff --git a/kioslave/audiocd/audiocd.upd b/kioslave/audiocd/audiocd.upd deleted file mode 100644 index f4818e5f..00000000 --- a/kioslave/audiocd/audiocd.upd +++ /dev/null @@ -1,4 +0,0 @@ -# Update for transport configuration -Id=1 -File=kcmaudiocdrc -Script=upgrade-metadata.sh,bash diff --git a/kioslave/audiocd/configure.in.bot b/kioslave/audiocd/configure.in.bot deleted file mode 100644 index e69de29b..00000000 diff --git a/kioslave/audiocd/configure.in.in b/kioslave/audiocd/configure.in.in deleted file mode 100644 index 99bacf59..00000000 --- a/kioslave/audiocd/configure.in.in +++ /dev/null @@ -1,46 +0,0 @@ -AC_DEFUN([AC_CHECK_LIBFLAC], -[ - AC_LANG_SAVE - AC_LANG_C - have_libFLAC=no - KDE_CHECK_HEADER(FLAC/metadata.h, - [ - KDE_CHECK_LIB(FLAC,FLAC__stream_decoder_process_single, - have_libFLAC=yes) - - ]) - if test "x$have_libFLAC" = "xyes"; then - LIBFLAC="-lFLAC" - AC_DEFINE(HAVE_LIBFLAC, 1, - [Define if you have libFLAC (required for loading FLAC files)]) - fi - AC_SUBST(LIBFLAC) - AC_LANG_RESTORE -]) - -AC_DEFUN([AC_CHECK_LIBOGGFLAC], -[ - AC_LANG_SAVE - AC_LANG_C - have_libOggFLAC=no - KDE_CHECK_HEADER(OggFLAC/seekable_stream_decoder.h, - [ - KDE_CHECK_LIB(OggFLAC,OggFLAC__seekable_stream_decoder_process_single, - have_libOggFLAC=yes,,[-lm -lOggFLAC -lFLAC]) - - ]) - if test "x$have_libOggFLAC" = "xyes"; then - LIBOGGFLAC="-lOggFLAC" - AC_DEFINE(HAVE_LIBOGGFLAC, 1, - [Define if you have libOggFLAC (required for loading OggFLAC files)]) - fi - AC_SUBST(LIBOGGFLAC) - AC_LANG_RESTORE -]) - -AC_ARG_WITH(flac,AC_HELP_STRING([--with-flac],[Enable FLAC support @<:@default=check@:>@]),[flac_test="$withval"],[flac_test="yes"]) - -if test "x$flac_test" = "xyes" ; then - AC_CHECK_LIBFLAC - AC_CHECK_LIBOGGFLAC -fi diff --git a/kioslave/audiocd/kcmaudiocd/Makefile.am b/kioslave/audiocd/kcmaudiocd/Makefile.am deleted file mode 100644 index 73d6be2d..00000000 --- a/kioslave/audiocd/kcmaudiocd/Makefile.am +++ /dev/null @@ -1,17 +0,0 @@ -kde_module_LTLIBRARIES = kcm_audiocd.la - -kcm_audiocd_la_SOURCES = audiocdconfig.ui kcmaudiocd.cpp - -kcm_audiocd_la_LDFLAGS = $(all_libraries) $(KDE_PLUGIN) -module -kcm_audiocd_la_LIBADD = ../plugins/libaudiocdplugins.la $(LIB_TDEUI) - -INCLUDES = -I$(srcdir)/../plugins -I$(top_srcdir)/libkcddb $(all_includes) - -kcm_audiocd_la_METASOURCES = AUTO - -messages: rc.cpp - $(XGETTEXT) *.cpp -o $(podir)/kcmaudiocd.pot - -xdg_apps_DATA = audiocd.desktop - -audiocdconfig.cpp: audiocdconfig.h diff --git a/kioslave/audiocd/kcmaudiocd/audiocd.desktop b/kioslave/audiocd/kcmaudiocd/audiocd.desktop deleted file mode 100644 index 7b3ada34..00000000 --- a/kioslave/audiocd/kcmaudiocd/audiocd.desktop +++ /dev/null @@ -1,182 +0,0 @@ -[Desktop Entry] -Exec=kcmshell audiocd -Icon=cdaudio_unmount -Type=Application - -X-TDE-ModuleType=Library -X-TDE-Library=audiocd - -Name=Audio CDs -Name[af]=Audio Cds -Name[ar]=أقراص مدمجة صوتية -Name[bg]=Аудио диск -Name[bn]=অডিও সিডি -Name[br]=CD klevet -Name[bs]=Audio CDi -Name[ca]=CD d'àudio -Name[cs]=Zvuková CD -Name[cy]=CDau Sain -Name[da]=Lyd-cd'er -Name[de]=Audio-CDs -Name[el]=CD μουσικής -Name[eo]=Son-KDoj -Name[es]=CDs audio -Name[et]=Audioplaadid -Name[eu]=Audio CD-ak -Name[fa]=دیسکهای فشردۀ صوتی -Name[fi]=Ääni-CD:t -Name[fr]=CD audio -Name[ga]=Dlúthdhioscaí Fuaime -Name[he]=תקליטורי שמע -Name[hi]=ऑडीयो सीडी -Name[hr]=Audio CD-i -Name[hu]=Hang-CD-böngésző -Name[is]=Tónlistardiskaflakkari -Name[it]=CD Audio -Name[ja]=オーディオ CD -Name[kk]=Аудио CD -Name[km]=ស៊ីឌី​អ៉ូឌីយ៉ូ -Name[ko]=오디오 CD -Name[lt]=Audio kompaktai -Name[mk]=Аудио ЦД-а -Name[nb]=Lyd-CD-er -Name[nds]=Klang-CDs -Name[ne]=अडियो सीडी -Name[nl]=Audio-cd's -Name[nn]=Lyd-CD-ar -Name[pa]=ਆਡੀਓ CD -Name[pl]=Przeglądarka audio CD -Name[pt]=CDs de Áudio -Name[pt_BR]=CDs de Áudio -Name[ro]=CD-uri audio -Name[ru]=Аудио CD -Name[se]=Jietna-CD:at -Name[sk]=Zvukové CD -Name[sl]=Avdio CD-ji -Name[sr]=Аудио CD-ови -Name[sr@Latn]=Audio CD-ovi -Name[sv]=Ljud-cd -Name[ta]=கேட்பொலி குறுந்தகடுகள் -Name[tg]=Дискҳои Фишурдаи Садо -Name[th]=ซีดีบันทึกเสียง -Name[tr]=Müzik CD -Name[uk]=Аудіо-КД -Name[uz]=Audio kompakt-disklar -Name[uz@cyrillic]=Аудио компакт-дисклар -Name[ven]=CD ino thetsheleswa -Name[xh]=CDs Zokuvakalayo -Name[zh_CN]=音频 CD -Name[zh_HK]=音樂 CD -Name[zh_TW]=音樂光碟 -Name[zu]=Ama-CD Okuzwakalayo -Comment=Audiocd IO Slave Configuration -Comment[af]=Klank cd Io Slaaf Opstelling -Comment[az]=Name=Audiosd IO Kölələri Quraşdırması -Comment[bg]=Настройване на аудио диска -Comment[bn]=অডিও-সিডি আই/ও স্লেভ কনফিগারেশন -Comment[br]=Kefluniadur Sklav IO Audiocd -Comment[bs]=Podešavanje Audiocd IO Slave -Comment[ca]=Configuració de l'E/S esclava dels CD àudio -Comment[cs]=Nastavení IO klienta pro zvuková CD -Comment[cy]=Gosodiad Gwas IO ar gyfer CDau Sain -Comment[da]=Lyd-cd IO-slave-indstilling -Comment[de]=Einrichtung des Ein-/Ausgabemoduls für Audio-CDs -Comment[el]=Ρύθμιση Audiocd IO Slave -Comment[eo]=Agordo por la muzikdiska sklavo -Comment[es]=Configuración del esclavo de E/S de audiocd -Comment[et]=Audio CD IO mooduli seadistamine -Comment[eu]=Audiocd IO mendekoaren konfigurazioa -Comment[fa]=پیکربندی پی‌رو IO دیسک فشردۀ صوتی -Comment[fi]=Audiocd-siirräntätyöskentelijän asetukset -Comment[fr]=Configuration du module pour CD audio -Comment[gl]=Configuración do escravo IO de audiocd -Comment[he]=שינוי הגדרות פרוטוקול תקליטורי השמע -Comment[hi]=ऑडियो-सीडी आई-ओ स्लेव कॉन्फ़िगरेशन -Comment[hr]=Postava Audiocd IO poslužnika -Comment[hu]=Az audiocd TDE-protokoll beállításai -Comment[is]=Stillingar Audiocd I/O þrælsins -Comment[it]=Configurazione dell'IO Slave per i CD Audio -Comment[ja]=オーディオ CD IO スレーブの設定 -Comment[kk]=AudioCD IO Slave баптауы -Comment[km]=ការ​កំណត់​រចនាសម្ព័ន្ធ IO Slave របស់​ស៊ីឌី​អូឌីយ៉ូ -Comment[ko]=오디오 CD IO 슬레이브 설정 -Comment[lt]=Audio kompakto IO vergo derinimas -Comment[ms]=Penyelarasan Hamba IO Audiocd -Comment[mt]=Konfigurazzjoni tal-iskjav IO AudioCD -Comment[nb]=Oppsett av lyd-CD IO-slave -Comment[nds]=Instellen för dat In-/Utgaavmoduul för Klang-CDs -Comment[ne]=Audiocd IO स्लेभ कन्फिगरेसन -Comment[nl]=AudioCD IO slave instellen -Comment[nn]=Oppsett av IU-slave for lyd-CD -Comment[pa]=ਆਡੀਓ ਸੀਡੀ IO ਸਲੇਵ ਸੰਰਚਨਾ -Comment[pl]=Konfiguracja procedury we/wy dla audio CD -Comment[pt]=Configuração do IO Slave de CDs-Áudio -Comment[pt_BR]=Configuração do Áudio CD Escravo -Comment[ro]=Configurează dispozitivul I/O pentru CD audio -Comment[ru]=Настройка протокола AudioCD -Comment[se]=Heivet SO-šláva jietna-CD:aid várás -Comment[sk]=Nastavenie IO klienta pre zvukové CD -Comment[sl]=Nastavitve Audiocd podrejeni V/I -Comment[sr]=Подешавање Audiocd IO Slave-а -Comment[sr@Latn]=Podešavanje Audiocd IO Slave-a -Comment[sv]=Anpassa I/O-slav för ljud-cd -Comment[ta]=ஒலிக் குறுந்தகடு உள்-வெளி அடிமை வடிவமைப்பு -Comment[tg]=Танзими Фармонбари Ворид/Хориҷи Дискҳои Фишурдаи Садо -Comment[th]=ปรับแต่ง Audiocd IO Slave -Comment[tr]=Müzik CD Yapılandırması -Comment[uk]=Налаштування підлеглого В/В "Audiocd" -Comment[ven]=Nzudzanyo Audiocd IO Slave -Comment[xh]=Video-DVD IO Slave Uqwalaselo -Comment[zh_CN]=音频 CD 输入输出从属模块配置 -Comment[zh_HK]=音樂 CD IO Slave 設定 -Comment[zh_TW]=音樂光碟 IO Slave 組態 -Comment[zu]=Inhlanganiselo ye-Audiocd IO Slave -Keywords=Audio CD,CD,Ogg,Vorbis,Encoding,CDDA,Bitrate -Keywords[bg]=аудио, диск, компактдиск, КД, кодек, музика, Audio CD, CD, Ogg, Vorbis, Encoding, CDDA, Bitrate -Keywords[br]=CD klevet,CD,Ogg,Vorbis,Kodadur,CDDA,Feur -Keywords[ca]=Àudio CD,CD,Ogg,Vorbis,Codificació,CDDA,Taxa de bits -Keywords[cs]=Zvukové CD,CD,Ogg,Vorbis,Kódování,CDDA,Bitrate,CDDB -Keywords[cy]=CD Sain,CD,crynoddisg,Ogg,Vorbis,Amgodio,CDDA,Cyfradd Ddidau -Keywords[da]=Lyd-cd,CD,Ogg,Vorbis,Indkodning,CDDA,Bitrate -Keywords[de]=Audio CD,CD,Ogg,Vorbis,Encoding,CDDA,Bitrate,MP3 -Keywords[el]=CD μουσικής,CD,Ogg,Vorbis,Κωδικοποίηση,CDDA,Ρυθμός bit -Keywords[es]=CD de audio,CD,Ogg,Vorbis,Codificación,CDDA,Ratio de bits -Keywords[et]=audio,CD,Ogg,Vorbis,kodeering,CDDA,bitikiirus -Keywords[eu]=Audio CD,CD,Ogg,Vorbis,Kdeketa,CDDA,bit-maiztasuna -Keywords[fa]=دیسک فشرده، دیسک فشرده، Ogg، Vorbis، کدبندی، CDDA، میزان ارسال بیت صوتی -Keywords[fi]=Ääni-CD,CD,Ogg,Vorbis,Koodaus,CDDA,Bittinopeus -Keywords[fr]=CD audio,CD,Ogg,Vorbis,Encodage,CDDA,débit -Keywords[ga]=CD Fuaime,CD,Ogg,Vorbis,Ionchódú,CDDA,Ráta Giotán -Keywords[gl]=Audio CD,CD,Ogg,Vorbis,Codificación,CDDA,Razón de Bits -Keywords[hi]=ऑडियो सीडी,सीडी,ऑग,वॉर्बिस,एनकोडिंग,सीडीडीए,बिटरेट -Keywords[hu]=hang-CD,CD,Ogg,Vorbis,kódolás,CDDA,bitráta -Keywords[it]=CD Audio,CD,Ogg,Vorbis,Codifica,CDDA,Bitrate -Keywords[ja]=オーディオ CD,CD,Ogg,Vorbis,エンコーディング,CDDA,ビットレート -Keywords[km]=ស៊ីឌី​អូឌីយ៉ូ,ស៊ីឌី,Ogg,Vorbis,អ៊ិនកូដ,CDDA,អត្រាប៊ីត -Keywords[ko]=오디오 CD,CD,Ogg,인코딩,CDDA -Keywords[lt]=Audio CD,CD,Ogg,Vorbis,Encoding,CDDA,Bitrate,įkodavimas -Keywords[mk]=Аудио CD,CD,Ogg,Vorbis,Кодирање,CDDA,Брзина во битови -Keywords[nb]=Audio CD,CD,Ogg,Vorbis,Koding,CDDA,Bitrate -Keywords[nds]=Audio-CD,Klang-CD,CD,Ogg,Vorbis,Koderen,CDDA,Bitrate -Keywords[ne]=अडियो सीडी,सीडी,अग,भर्बिस,सङ्केतन,सीडीडीए,बिटरेट -Keywords[nl]=Audio-cd,cd,Ogg,Vorbis,Encoding,CDDA,Bitrate -Keywords[nn]=lyd-CD,CD,Ogg,Vorbis,koding,CDDA,bitrate -Keywords[pa]=ਆਡੀਓ CD,CD,Ogg,Vorbis,ਇਕੋਡਿੰਗ,CDDA,ਬਿੱਟਰੇਟ -Keywords[pl]=Audio CD,CD,Ogg,Vorbis,Encoding,CDDA,Bitrate, Kodowanie -Keywords[pt]=CD de Áudio,CD,Ogg,Vorbis,Codificação,CDDA,Taxa de Bits -Keywords[pt_BR]=CD de Áudio,CD,Ogg,Vorbis,Codificação,CDDA,Bitrate -Keywords[ro]=CD audio,ogg,vorbis,codare,CDDA,rată de bit -Keywords[ru]=Audio CD,CD,Ogg,Vorbis,Encoding,CDDA,Bitrate,битрейт -Keywords[sk]=zvukové CD,CD,Ogg,Vorbis,kódovanie,CDDA,bitová frekvencia -Keywords[sl]=Avdio CD,CD,Ogg,Vorbis,kodiranje,CDDA,bitna hitrost -Keywords[sr]=Audio CD,CD,Ogg,Vorbis,Encoding,CDDA,Bitrate, Аудио CD, кодирање,битрата -Keywords[sr@Latn]=Audio CD,CD,Ogg,Vorbis,Encoding,CDDA,Bitrate, Audio CD, kodiranje,bitrata -Keywords[sv]=ljud-cd,cd,Ogg,Vorbis,kodning,CDDA,bithastighet -Keywords[ta]=கேட்பொலி குறுந்தகடு,குறுந்தகடு,ஓஜிஜி,வோர்பிஸ்,குறியிடுதல்,சிடிடேஏ,பிட் மதிப்பு -Keywords[tg]=Диски Фишурдаи Садо,Диски Фишурда,Ogg,Vorbis,Рамзигузор,CDDA,Bitrate -Keywords[th]=ซีดีบันทึกเสียง, ซีดี,Ogg,Vorbis,เข้ารหัส,CDDA,บิตเรต -Keywords[tr]=Ses CD,CD,Ogg,Vorbis,Kodlama,CDDA,Bitrate -Keywords[uk]=Аудіо-КД,КД,Ogg,Vorbis,кодування,CDDA,частота вибірки -Keywords[zh_CN]=音频 CD,CD,Ogg,Vorbis,编码,CDDA,Bitrate - -Categories=Qt;TDE;Settings;X-TDE-settings-sound; diff --git a/kioslave/audiocd/kcmaudiocd/audiocdconfig.ui b/kioslave/audiocd/kcmaudiocd/audiocdconfig.ui deleted file mode 100644 index a3b98507..00000000 --- a/kioslave/audiocd/kcmaudiocd/audiocdconfig.ui +++ /dev/null @@ -1,628 +0,0 @@ - -AudiocdConfig - - - AudiocdConfig - - - - 0 - 0 - 640 - 563 - - - - - - - - - unnamed - - - 0 - - - 0 - - - - tabWidget - - - - 5 - 5 - 0 - 0 - - - - - - - - - tab - - - &General - - - - unnamed - - - - Spacer5 - - - Vertical - - - Expanding - - - - 20 - 210 - - - - - - encoderPriority - - - Encoder Priority - - - - unnamed - - - - niceLevel - - - -19 - - - 19 - - - 5 - - - Horizontal - - - NoMarks - - - - - textLabel2 - - - Highest - - - - - textLabel3 - - - Lowest - - - AlignVCenter|AlignRight - - - - - textLabel4 - - - Normal - - - AlignCenter - - - - - - - cd_device_string - - - false - - - /dev/cdrom - - - Specify a location for the drive you want to use. Normally, this is a file inside the /dev folder representing your CD or DVD drive. - - - - - cd_specify_device - - - &Specify CD device: - - - Check this to specify a CD device different from the one which is detected automatically - - - - - ec_enable_check - - - Use &error correction when reading the CD - - - true - - - If you uncheck this option, the slave will not try to use error correction which can be useful for reading damaged CDs. However, this feature can be problematic in some cases, so you can switch it off here. - - - - - ec_skip_check - - - &Skip on errors - - - false - - - - - spacer4_2 - - - Horizontal - - - Fixed - - - - 20 - 20 - - - - - - - - tab - - - &Names - - - - unnamed - - - - fileNameGroupBox - - - File Name (without extension) - - - - unnamed - - - - textLabel1_2 - - - The following macros will be expanded: - - - - - layout7 - - - - unnamed - - - - textLabel13 - - - Genre - - - - - textLabel7 - - - Track Number - - - - - textLabel2_3 - - - %{title} - - - - - textLabel11 - - - Year - - - - - textLabel3_3 - - - Track Title - - - - - textLabel9 - - - Album Artist - - - - - textLabel10 - - - %{year} - - - - - textLabel6 - - - %{albumtitle} - - - - - textLabel5 - - - Album Title - - - - - textLabel12 - - - %{genre} - - - - - textLabel8 - - - %{albumartist} - - - - - textLabel4_2 - - - %{number} - - - - - - - fileNameLineEdit - - - - - - - groupBox2 - - - Name Regular Expression Replacement - - - - unnamed - - - - textLabel2_2 - - - Selection: - - - - - textLabel1 - - - Regular expression used on all file names. For example using selection " " and replace with "_" would replace all the spaces with underlines. - - - - WordBreak|AlignVCenter - - - - - inputlabel - - - Input: - - - - - outputLabel - - - Output: - - - - - exampleLabel - - - Example - - - - - exampleOutput - - - Cool artist - example audio file.wav - - - - - example - - - Cool artist - example audio file.wav - - - - - kcfg_replaceInput - - - - - kcfg_replaceOutput - - - - - textLabel3_2 - - - Replace with: - - - - - line1 - - - HLine - - - Sunken - - - Horizontal - - - - - - - spacer4 - - - Vertical - - - Expanding - - - - 21 - 16 - - - - - - fileNameGroupBox_2 - - - Album Name - - - - unnamed - - - - fileNameLabel_2 - - - The following macros will be expanded: - - - - - layout9 - - - - unnamed - - - - textLabel20 - - - Year - - - - - textLabel15 - - - %{albumartist} - - - - - textLabel16 - - - %{year} - - - - - textLabel21 - - - Genre - - - - - textLabel19 - - - Album Artist - - - - - textLabel18 - - - Album Title - - - - - textLabel17 - - - %{genre} - - - - - textLabel14 - - - %{albumtitle} - - - - - - - spacer3 - - - Vertical - - - Expanding - - - - 20 - 31 - - - - - - albumNameLineEdit - - - - - - - - - - - - ec_enable_check - toggled(bool) - ec_skip_check - setEnabled(bool) - - - cd_specify_device - toggled(bool) - cd_device_string - setEnabled(bool) - - - - tabWidget - cd_device_string - ec_enable_check - ec_skip_check - niceLevel - fileNameLineEdit - albumNameLineEdit - kcfg_replaceInput - kcfg_replaceOutput - example - - - tdecmodule.h - - - toggleLowpass() - - - - klineedit.h - - diff --git a/kioslave/audiocd/kcmaudiocd/kcmaudiocd.cpp b/kioslave/audiocd/kcmaudiocd/kcmaudiocd.cpp deleted file mode 100644 index adff68f3..00000000 --- a/kioslave/audiocd/kcmaudiocd/kcmaudiocd.cpp +++ /dev/null @@ -1,267 +0,0 @@ -/* - Copyright (C) 2001 Carsten Duvenhorst - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -*/ - -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include "kcmaudiocd.moc" -#include - -KAudiocdModule::KAudiocdModule(TQWidget *parent, const char *name) - : AudiocdConfig(parent, name), configChanged(false) -{ - TQString foo = i18n("Report errors found on the cd."); - - setButtons(Default|Apply); - - config = new TDEConfig("kcmaudiocdrc"); - - TQPtrList encoders; - AudioCDEncoder::findAllPlugins(0, encoders); - AudioCDEncoder *encoder; - for ( encoder = encoders.first(); encoder; encoder = encoders.next() ){ - if (encoder->init()) { - TDEConfigSkeleton *config = NULL; - TQWidget *widget = encoder->getConfigureWidget(&config); - if(widget && config){ - tabWidget->addTab(widget, i18n("%1 Encoder").arg(encoder->type())); - TDEConfigDialogManager *configManager = new TDEConfigDialogManager(widget, config, TQString(encoder->type()+" EncoderConfigManager").latin1()); - encoderSettings.append(configManager); - } - } - } - - load(); - - TDEConfigDialogManager *widget; - for ( widget = encoderSettings.first(); widget; widget = encoderSettings.next() ){ - connect(widget, TQT_SIGNAL(widgetModified()), this, TQT_SLOT(slotModuleChanged())); - } - - //CDDA Options - connect(cd_specify_device,TQT_SIGNAL(clicked()),this,TQT_SLOT(slotConfigChanged())); - connect(ec_enable_check,TQT_SIGNAL(clicked()),this,TQT_SLOT(slotEcEnable())); - connect(ec_skip_check,TQT_SIGNAL(clicked()),TQT_SLOT(slotConfigChanged())); - connect(cd_device_string,TQT_SIGNAL(textChanged(const TQString &)),TQT_SLOT(slotConfigChanged())); - connect(niceLevel,TQT_SIGNAL(valueChanged(int)),TQT_SLOT(slotConfigChanged())); - - // File Name - connect(fileNameLineEdit, TQT_SIGNAL(textChanged(const TQString &)), this, TQT_SLOT(slotConfigChanged())); - connect(albumNameLineEdit, TQT_SIGNAL(textChanged(const TQString &)), this, TQT_SLOT(slotConfigChanged())); - connect( kcfg_replaceInput, TQT_SIGNAL( textChanged(const TQString&) ), this, TQT_SLOT( updateExample() ) ); - connect( kcfg_replaceOutput, TQT_SIGNAL( textChanged(const TQString&) ), this, TQT_SLOT( updateExample() ) ); - connect( example, TQT_SIGNAL( textChanged(const TQString&) ), this, TQT_SLOT( updateExample() ) ); - connect( kcfg_replaceInput, TQT_SIGNAL( textChanged(const TQString&) ), this, TQT_SLOT( slotConfigChanged() ) ); - connect( kcfg_replaceOutput, TQT_SIGNAL( textChanged(const TQString&) ), this, TQT_SLOT( slotConfigChanged() ) ); - connect( example, TQT_SIGNAL( textChanged(const TQString&) ), this, TQT_SLOT( slotConfigChanged() ) ); - - TDEAboutData *about = - new TDEAboutData(I18N_NOOP("kcmaudiocd"), I18N_NOOP("TDE Audio CD IO Slave"), - 0, 0, TDEAboutData::License_GPL, - I18N_NOOP("(c) 2000 - 2005 Audio CD developers")); - - about->addAuthor("Benjamin C. Meyer", I18N_NOOP("Current Maintainer"), "ben@meyerhome.net"); - about->addAuthor("Carsten Duvenhorst", 0, "duvenhorst@duvnet.de"); - setAboutData(about); -} - -KAudiocdModule::~KAudiocdModule() -{ - delete config; -} - -TQString removeQoutes(const TQString& text) -{ - TQString deqoutedString=text; - TQRegExp qoutedStringRegExp("^\".*\"$"); - if (qoutedStringRegExp.exactMatch(text)) - { - deqoutedString=text.mid(1, text.length()-2); - } - return deqoutedString; -} - -bool needsQoutes(const TQString& text) -{ - TQRegExp spaceAtTheBeginning("^\\s+.*$"); - TQRegExp spaceAtTheEnd("^.*\\s+$"); - return (spaceAtTheBeginning.exactMatch(text) || spaceAtTheEnd.exactMatch(text)); - - -} - -void KAudiocdModule::updateExample() -{ - TQString text = example->text(); - TQString deqoutedReplaceInput=removeQoutes(kcfg_replaceInput->text()); - TQString deqoutedReplaceOutput=removeQoutes(kcfg_replaceOutput->text()); - - text.replace( TQRegExp(deqoutedReplaceInput), deqoutedReplaceOutput ); - exampleOutput->setText(text); -} - -void KAudiocdModule::defaults() { - load( false ); -} - -void KAudiocdModule::save() { - if (!configChanged ) return; - - { - TDEConfigGroupSaver saver(config, "CDDA"); - - // autosearch is the name of the config option, which has the - // reverse sense of the current text of the configuration option, - // which is specify the device. Therefore, invert the value on write. - // - config->writeEntry("autosearch", !(cd_specify_device->isChecked()) ); - config->writeEntry("device",cd_device_string->text()); - config->writeEntry("disable_paranoia",!(ec_enable_check->isChecked())); - config->writeEntry("never_skip",!(ec_skip_check->isChecked())); - config->writeEntry("niceLevel", niceLevel->value()); - } - - { - TDEConfigGroupSaver saver(config, "FileName"); - config->writeEntry("file_name_template", fileNameLineEdit->text()); - config->writeEntry("album_name_template", albumNameLineEdit->text()); - config->writeEntry("regexp_example", example->text()); - // save qouted if required - TQString replaceInput=kcfg_replaceInput->text(); - TQString replaceOutput=kcfg_replaceOutput->text(); - if (needsQoutes(replaceInput)) - { - replaceInput=TQString("\"")+replaceInput+TQString("\""); - } - if (needsQoutes(replaceOutput)) - { - replaceOutput=TQString("\"")+replaceOutput+TQString("\""); - } - config->writeEntry("regexp_search", replaceInput); - config->writeEntry("regexp_replace", replaceOutput); - } - - TDEConfigDialogManager *widget; - for ( widget = encoderSettings.first(); widget; widget = encoderSettings.next() ){ - widget->updateSettings(); - } - - config->sync(); - - configChanged = false; - -} - -void KAudiocdModule::load() { - load( false ); -} - -void KAudiocdModule::load(bool useDefaults) { - - config->setReadDefaults( useDefaults ); - - { - TDEConfigGroupSaver saver(config, "CDDA"); - - - // Specify <=> not autosearch, as explained above in ::save() - cd_specify_device->setChecked( !(config->readBoolEntry("autosearch",true)) ); - cd_device_string->setText(config->readEntry("device","/dev/cdrom")); - ec_enable_check->setChecked(!(config->readBoolEntry("disable_paranoia",false))); - ec_skip_check->setChecked(!(config->readBoolEntry("never_skip",true))); - niceLevel->setValue(config->readNumEntry("niceLevel", 0)); - } - - { - TDEConfigGroupSaver saver(config, "FileName"); - fileNameLineEdit->setText(config->readEntry("file_name_template", "%{albumartist} - %{number} - %{title}")); - albumNameLineEdit->setText(config->readEntry("album_name_template", "%{albumartist} - %{albumtitle}")); - kcfg_replaceInput->setText(config->readEntry("regexp_search")); - kcfg_replaceOutput->setText(config->readEntry("regexp_replace")); - example->setText(config->readEntry("example", i18n("Cool artist - example audio file.wav"))); - } - - TDEConfigDialogManager *widget; - for ( widget = encoderSettings.first(); widget; widget = encoderSettings.next() ){ - widget->updateWidgets(); - } - - emit changed( useDefaults ); -} - -void KAudiocdModule::slotModuleChanged() { - TDEConfigDialogManager *widget; - for ( widget = encoderSettings.first(); widget; widget = encoderSettings.next() ){ - if(widget->hasChanged()){ - slotConfigChanged(); - break; - } - } -} - -void KAudiocdModule::slotConfigChanged() { - configChanged = true; - emit changed(true); -} - -/* -# slot for the error correction settings -*/ -void KAudiocdModule::slotEcEnable() { - if (!(ec_skip_check->isChecked())) { - ec_skip_check->setChecked(true); - } else { - if (ec_skip_check->isEnabled()) { - ec_skip_check->setChecked(false); - } - } - - slotConfigChanged(); -} - -TQString KAudiocdModule::quickHelp() const -{ - return i18n("

Audio CDs

The Audio CD IO-Slave enables you to easily" - " create wav, MP3 or Ogg Vorbis files from your audio CD-ROMs or DVDs." - " The slave is invoked by typing \"audiocd:/\" in Konqueror's location" - " bar. In this module, you can configure" - " encoding, and device settings. Note that MP3 and Ogg" - " Vorbis encoding are only available if TDE was built with a recent" - " version of the LAME or Ogg Vorbis libraries."); -} - -extern "C" -{ - TDECModule *create_audiocd(TQWidget *parent, const char */*name*/) - { - return new KAudiocdModule(parent, "kcmaudiocd"); - } - -} diff --git a/kioslave/audiocd/kcmaudiocd/kcmaudiocd.h b/kioslave/audiocd/kcmaudiocd/kcmaudiocd.h deleted file mode 100644 index c9ec1bc7..00000000 --- a/kioslave/audiocd/kcmaudiocd/kcmaudiocd.h +++ /dev/null @@ -1,66 +0,0 @@ -/* - - Copyright (C) 2001 Carsten Duvenhorst - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - - Permission is also granted to link this program with the TQt - library, treating TQt like a library that normally accompanies the - operating system kernel, whether or not that is in fact the case. - -*/ - - -#ifndef KAUDIOCDCONFIG_H -#define KAUDIOCDCONFIG_H - -class TDEConfigDialogManager; - -#include "audiocdconfig.h" -class KAudiocdModule : public AudiocdConfig -{ - Q_OBJECT - - -public: - - KAudiocdModule(TQWidget *parent=0, const char *name=0); - ~KAudiocdModule(); - - TQString quickHelp() const; - -public slots: - void defaults(); - void save(); - void load(); - void load(bool useDefaults); - -private slots: - void updateExample(); - void slotConfigChanged(); - void slotEcEnable(); - void slotModuleChanged(); - -private: - TDEConfig *config; - bool configChanged; - - int getBitrateIndex(int value); - - TQPtrList encoderSettings; -}; - -#endif // KAUDIOCDCONFIG_H - diff --git a/kioslave/audiocd/plugins/Makefile.am b/kioslave/audiocd/plugins/Makefile.am deleted file mode 100644 index 4dca0d30..00000000 --- a/kioslave/audiocd/plugins/Makefile.am +++ /dev/null @@ -1,21 +0,0 @@ -#if HAVE_VORBIS -#AUDIOCD_PLUGINS_SUBDIR=vorbis -#endif - -SUBDIRS = . wav vorbis lame flac - -INCLUDES = -I$(top_srcdir)/libkcddb $(all_includes) - -lib_LTLIBRARIES = libaudiocdplugins.la - -libaudiocdplugins_la_LIBADD = $(LIB_TDECORE) $(top_builddir)/libkcddb/libkcddb.la - -libaudiocdplugins_la_LDFLAGS = $(all_libraries) -version-info 1:0:0 -no-undefined - -libaudiocdplugins_la_SOURCES = audiocdencoder.cpp - -include_HEADERS = audiocdencoder.h - -messages: - $(XGETTEXT) *.cpp -o $(podir)/kio_audiocd.pot - diff --git a/kioslave/audiocd/plugins/audiocdencoder.cpp b/kioslave/audiocd/plugins/audiocdencoder.cpp deleted file mode 100644 index 26c108b8..00000000 --- a/kioslave/audiocd/plugins/audiocdencoder.cpp +++ /dev/null @@ -1,95 +0,0 @@ -/* - Copyright (C) 2004, 2005 Benjamin Meyer - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -*/ - -#include -#include -#include -#include -#include -#include - -/** - * Attempt to load a plugin and see if it has the symbol create_audiocd_encoders. - * @param libFileName file to try to load. - * @returns pointer to the symbol or NULL - */ -void *loadPlugin(const TQString &libFileName) -{ -#ifdef DEBUG - kdDebug(7117) << "Trying to load library. File: \"" << libFileName.latin1() << "\"." << endl; -#endif - KLibLoader *loader = KLibLoader::self(); - if (!loader) - return NULL; -#ifdef DEBUG - kdDebug(7117) << "We have a loader. File: \"" << libFileName.latin1() << "\"." << endl; -#endif - KLibrary *lib = loader->library(libFileName.latin1()); - if (!lib) - return NULL; -#ifdef DEBUG - kdDebug(7117) << "We have a library. File: \"" << libFileName.latin1() << "\"." << endl; -#endif - void *cplugin = lib->symbol("create_audiocd_encoders"); - if (!cplugin) - return NULL; -#ifdef DEBUG - kdDebug(7117) << "We have a plugin. File: \"" << libFileName.latin1() << "\"." << endl; -#endif - return cplugin; -} - -/** - * There might be a "better" way of doing this, but I don't know it, - * but I do know that this does work. :) Feel free to improve the loading system, - * there isn't much code anyway. - */ -void AudioCDEncoder::findAllPlugins(TDEIO::SlaveBase *slave, TQPtrList &encoders){ - TQString foundEncoders; - - KStandardDirs standardDirs; - TQStringList dirs = standardDirs.findDirs("module", ""); - for (TQStringList::Iterator it = dirs.begin(); it != dirs.end(); ++it) { - TQDir dir(*it); - if (!dir.exists()) { - kdDebug(7117) << "Directory given by KStandardDirs: " << dir.path() << " doesn't exists!" << endl; - continue; - } - dir.setFilter(TQDir::Files | TQDir::Hidden); - - TQStringList list = dir.entryList( "libaudiocd_encoder_*.so"); - kdDebug() << "list " << list << endl; - for (TQStringList::ConstIterator it2 = list.begin(); it2 != list.end(); ++it2) - { - TQString fileName = *it2; - kdDebug() << fileName << endl; - if (foundEncoders.contains(fileName)) { - kdDebug(7117) << "Warning, encoder has been found twice!" << endl; - continue; - } - foundEncoders.append(fileName); - fileName = fileName.mid(0, fileName.find('.')); - void *function = loadPlugin(fileName); - if(function){ - void (*functionPointer)(TDEIO::SlaveBase *, TQPtrList &) = (void (*)(TDEIO::SlaveBase *slave, TQPtrList &encoders)) function; - functionPointer(slave, encoders); - } - } - } -} - diff --git a/kioslave/audiocd/plugins/audiocdencoder.h b/kioslave/audiocd/plugins/audiocdencoder.h deleted file mode 100644 index d582d548..00000000 --- a/kioslave/audiocd/plugins/audiocdencoder.h +++ /dev/null @@ -1,145 +0,0 @@ -/* - Copyright (C) 2004, 2005 Benjamin Meyer - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -*/ - -#ifndef AUDIOCD_ENCODER_H -#define AUDIOCD_ENCODER_H - -#include -#include -#include - -class TDEConfigSkeleton; -using namespace KCDDB; - -class AudioCDEncoder { - -public: - /** - * Constructor. - * @param slave parent that this classes can use to call data() with - * when finished encoding bits. - */ - explicit AudioCDEncoder(TDEIO::SlaveBase *slave) : ioslave(slave) {}; - - /** - * Deconstructor. - */ - virtual ~AudioCDEncoder(){}; - - /** - * Initiallizes the decoder, loading libraries, etc. Encoders - * that don't return true will will deleted and not used. - * @returns false if unable to initialize the encoder. - */ - virtual bool init() = 0; - - /** - * The encoder should read in its config data here. - */ - virtual void loadSettings() = 0; - - /** - * Helper function to determine the end size of a - * encoded file. - * @param time_secs the lengh of the audio track in seconds. - * @returns the size of a file if it is time_secs in length. - */ - virtual unsigned long size(long time_secs) const = 0; - - /** - * @returns the generic user string type/name of this encoder - * Examples: "MP3", "Ogg Vorbis", "Wav", "FID Level 2", etc - */ - virtual TQString type() const = 0; - - /** - * @returns the mime type for the files this encoder produces. - * Example: "audio/x-wav" - */ - virtual const char * mimeType() const = 0; - - /** - * @returns the file type for the files this encoder produces. - * Used in naming of the file for example foo.mp3 - * Examples: "mp3", "ogg", "wav" - */ - virtual const char * fileType() const = 0; - - /** - * Before the read functions are called this is - * called to allow the encoders to store the cddb - * information if they want to so it can be inserted - * where neccessary (start, middle, end, or combos etc). - */ - virtual void fillSongInfo( KCDDB::CDInfo info, int track, const TQString &comment ) = 0; - - /** - * Perform any initial file creation necessary for a new song (that - * has just been sent via fillSongInfo()) - * @param size - the total binary size of the end file (via size()). - * @return size of the data that was created by this function. - */ - virtual long readInit(long size) = 0; - - /** - * Passes a little bit of cd data to be encoded - * This function is most likly called many many times. - * @param buf pointer to the audio that has been read in so far - * @param frames the number of frames of audio that are in buf - * @return size of the data that was created by this function, -1 on error. - */ - virtual long read(int16_t * buf, int frames) = 0; - - /** - * Perform any final file creation/padding that is necessary - * @return size of the data that was created by this function. - */ - virtual long readCleanup() = 0; - - /** - * Returns a configure widget for the encoder - */ - virtual TQWidget* getConfigureWidget(TDEConfigSkeleton** manager) const - { Q_UNUSED(manager); return NULL; }; - - /** - * Returns the last error message; called when e.g. read() returns -1. - */ - virtual TQString lastErrorMessage() const { return TQString(); } - - /** - * Helper function to load all of the AudioCD Encoders from libraries. - * Uses KStandardDirs to find where libraries could be, opens all of the ones - * that we might own audiocd_encoder_* and then uses the symbol - * create_audiocd_encoders to obtain the encoders from that library. - * @param slave ioslave needed if the plugin is going to be used to encode something. - * @param encoders container for new encoders. - */ - static void findAllPlugins(TDEIO::SlaveBase *slave, TQPtrList &encoders); - -protected: - /** - * Pointer to the ioslave that is running this encoder. - * Used (only?) for the data() function to pass back encoded data. - */ - TDEIO::SlaveBase *ioslave; - -}; - -#endif // AUDIOCD_ENCODER_H - diff --git a/kioslave/audiocd/plugins/flac/Makefile.am b/kioslave/audiocd/plugins/flac/Makefile.am deleted file mode 100644 index 4e693c53..00000000 --- a/kioslave/audiocd/plugins/flac/Makefile.am +++ /dev/null @@ -1,13 +0,0 @@ -INCLUDES = -I$(top_srcdir)/libkcddb -I$(srcdir)/.. $(all_includes) - -kde_module_LTLIBRARIES = libaudiocd_encoder_flac.la - -libaudiocd_encoder_flac_la_SOURCES = encoderflac.cpp - -libaudiocd_encoder_flac_la_LIBADD = $(LIBFLAC) $(LIB_KIO) ../libaudiocdplugins.la - -libaudiocd_encoder_flac_la_LDFLAGS = -avoid-version -module -no-undefined $(all_libraries) - -pluginsdir = $(kde_datadir)/audiocd/plugins - -METASOURCES = AUTO diff --git a/kioslave/audiocd/plugins/flac/encoderflac.cpp b/kioslave/audiocd/plugins/flac/encoderflac.cpp deleted file mode 100644 index 4c1329cd..00000000 --- a/kioslave/audiocd/plugins/flac/encoderflac.cpp +++ /dev/null @@ -1,214 +0,0 @@ -/* - Copyright (C) 2004 Allan Sandfeld Jensen - Copyright (C) 2005 Benjamin Meyer - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "encoderflac.h" - -#ifdef HAVE_LIBFLAC - -#include -#include -#include - -#include -#include - -#if !defined FLAC_API_VERSION_CURRENT || FLAC_API_VERSION_CURRENT < 8 -#define LEGACY_FLAC -#else -#undef LEGACY_FLAC -#endif - -extern "C" -{ - KDE_EXPORT void create_audiocd_encoders(TDEIO::SlaveBase *slave, TQPtrList &encoders) - { - encoders.append(new EncoderFLAC(slave)); - } -} - -class EncoderFLAC::Private { - -public: - FLAC__StreamEncoder *encoder; - FLAC__StreamMetadata** metadata; - TDEIO::SlaveBase* ioslave; - unsigned long data; -}; - -#ifdef LEGACY_FLAC -static FLAC__StreamEncoderWriteStatus WriteCallback(const FLAC__StreamEncoder *encoder, const FLAC__byte buffer[], unsigned bytes, unsigned samples, unsigned current_frame, void *client_data) -#else -static FLAC__StreamEncoderWriteStatus WriteCallback(const FLAC__StreamEncoder *encoder, const FLAC__byte buffer[], size_t bytes, unsigned samples, unsigned current_frame, void *client_data) -#endif -{ - EncoderFLAC::Private *d = (EncoderFLAC::Private*)client_data; - - d->data += bytes; - - TQByteArray output; - - if (bytes) { - output.setRawData((const char*)buffer, bytes); - d->ioslave->data(output); - output.resetRawData((const char*)buffer, bytes); - } - - return FLAC__STREAM_ENCODER_WRITE_STATUS_OK; -} - -static void MetadataCallback (const FLAC__StreamEncoder *encoder, const FLAC__StreamMetadata *metadata, void *client_data) -{ - // We do not have seekable writeback so we just discard the updated metadata - -} - -/* -static FLAC__SeekableStreamEncoderSeekStatus SeekCallback(const FLAC__SeekableStreamEncoder *encoder, FLAC__uint64 absolute_byte_offset, void *client_data) -{} ; */ - - - - -EncoderFLAC::EncoderFLAC(TDEIO::SlaveBase *slave) : AudioCDEncoder(slave) { - d = new Private(); - d->ioslave = slave; - d->encoder = 0; -} - -EncoderFLAC::~EncoderFLAC() { - if (d->encoder) FLAC__stream_encoder_delete(d->encoder); - delete d; -} - -bool EncoderFLAC::init(){ - d->encoder = FLAC__stream_encoder_new(); - d->metadata = 0; - d->data = 0; - return true; -} - -void EncoderFLAC::loadSettings() { -// config->setGroup("FLAC"); - -} - -// Estimate size to be 5/8 of uncompresed size. -unsigned long EncoderFLAC::size(long time_secs) const { - long uncompressed = (time_secs * (44100*2*2)); - return (uncompressed/8)*5 + 1000; -} - -long EncoderFLAC::readInit(long size) { - kdDebug(7117) << "EncoderFLAC::readInit() called"<< endl; - d->data = 0; -#ifdef LEGACY_FLAC - FLAC__stream_encoder_set_write_callback(d->encoder, WriteCallback); - FLAC__stream_encoder_set_metadata_callback(d->encoder, MetadataCallback); - FLAC__stream_encoder_set_client_data(d->encoder, d); -#endif - - // The options match approximely those of flac compression-level-3 - FLAC__stream_encoder_set_do_mid_side_stereo(d->encoder, true); - FLAC__stream_encoder_set_loose_mid_side_stereo(d->encoder, true); // flac -M - FLAC__stream_encoder_set_max_lpc_order(d->encoder, 6); // flac -l6 - FLAC__stream_encoder_set_min_residual_partition_order(d->encoder, 3); - FLAC__stream_encoder_set_max_residual_partition_order(d->encoder, 3); // flac -r3,3 - FLAC__stream_encoder_set_blocksize(d->encoder, 4608); - FLAC__stream_encoder_set_streamable_subset(d->encoder, true); - if (size > 0) - FLAC__stream_encoder_set_total_samples_estimate(d->encoder, size/4); - -#ifdef LEGACY_FLAC - if(FLAC__stream_encoder_init(d->encoder) != FLAC__STREAM_ENCODER_OK) - ; // really should handle an init failure -#else - if(FLAC__stream_encoder_init_stream(d->encoder, WriteCallback, NULL, NULL, MetadataCallback, d) != FLAC__STREAM_ENCODER_INIT_STATUS_OK) - ; // really should handle an init failure -#endif - return d->data; -} - -long EncoderFLAC::read(int16_t * buf, int frames) -{ - unsigned long olddata = d->data; - FLAC__int32 *buffer = new FLAC__int32[frames*2]; - for(int i=0; iencoder, buffer, frames); - delete[] buffer; - return d->data - olddata; -} - -long EncoderFLAC::readCleanup() -{ - FLAC__stream_encoder_finish(d->encoder); -// FLAC__stream_encoder_delete(d->encoder); - if (d->metadata) { - FLAC__metadata_object_delete(d->metadata[0]); - delete[] d->metadata; - d->metadata = 0; - } - return 0; -} - -void EncoderFLAC::fillSongInfo( KCDDB::CDInfo info, int track, const TQString &comment ) -{ - d->metadata = new FLAC__StreamMetadata*[1]; - d->metadata[0] = FLAC__metadata_object_new(FLAC__METADATA_TYPE_VORBIS_COMMENT); -// d->metadata[1] = FLAC__metadata_object_new(FLAC__METADATA_TYPE_PADDING); -// d->metadata[2] = FLAC__metadata_object_new(FLAC__METADATA_TYPE_SEEKTABLE) - - typedef TQPair Comment; - Comment comments[7] = { Comment("Title", info.trackInfoList[track].get("title")), - Comment("Artist", info.get("artist")), - Comment("Album", info.get("title")), - Comment("Genre", info.get("genre")), - Comment("Tracknumber", TQString::number(track+1)), - Comment("Comment", comment), - Comment("Date", TQString() )}; - if (info.get("Year").toInt() > 0) { - TQDateTime dt(TQDate(info.get("Year").toInt(), 1, 1)); - comments[6] = Comment("Date", dt.toString(Qt::ISODate)); - } - - FLAC__StreamMetadata_VorbisComment_Entry entry; - TQString field; - TQCString cfield; - int num_comments = 0; - - for(int i=0; i<7; i++) { - if (!comments[i].second.toString().isEmpty()) { - field = comments[i].first+"="+comments[i].second.toString(); - cfield = field.utf8(); - entry.entry = (FLAC__byte*)tqstrdup(cfield); - entry.length = cfield.length(); - // Insert in vorbiscomment and assign ownership of pointers to FLAC - FLAC__metadata_object_vorbiscomment_insert_comment(d->metadata[0], num_comments, entry, false); - num_comments++; - } - } - - FLAC__stream_encoder_set_metadata(d->encoder, d->metadata, 1); -} - -#endif // HAVE_LIBFLAC - diff --git a/kioslave/audiocd/plugins/flac/encoderflac.h b/kioslave/audiocd/plugins/flac/encoderflac.h deleted file mode 100644 index e563e061..00000000 --- a/kioslave/audiocd/plugins/flac/encoderflac.h +++ /dev/null @@ -1,61 +0,0 @@ -/* - Copyright (C) 2004 Allan Sandfeld Jensen - Copyright (C) 2005 Benjamin Meyer - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#ifndef ENCODER_FLAC_H -#define ENCODER_FLAC_H - -#include - -#ifdef HAVE_LIBFLAC - -#include - -/** - * FLAC encoder. - * This encoder is only enabled when HAVE_LIBFLAC is set. - * Check out http://flac.sourceforge.net/ for more information. - */ -class EncoderFLAC : public AudioCDEncoder { - -public: - EncoderFLAC(TDEIO::SlaveBase *slave); - ~EncoderFLAC(); - - virtual TQString type() const { return "FLAC"; }; - virtual bool init(); - virtual void loadSettings(); - virtual unsigned long size(long time_secs) const; - virtual const char * fileType() const { return "flac"; }; - virtual const char * mimeType() const { return "audio/x-flac"; } - virtual void fillSongInfo( KCDDB::CDInfo info, int track, const TQString &comment ); - virtual long readInit(long size); - virtual long read(int16_t * buf, int frames); - virtual long readCleanup(); - - class Private; -private: - Private * d; - -}; - -#endif // HAVE_FLAC - -#endif // ENCODER_FLAC_H - diff --git a/kioslave/audiocd/plugins/lame/Makefile.am b/kioslave/audiocd/plugins/lame/Makefile.am deleted file mode 100644 index 49ddddd9..00000000 --- a/kioslave/audiocd/plugins/lame/Makefile.am +++ /dev/null @@ -1,18 +0,0 @@ -INCLUDES = -I$(top_srcdir)/libkcddb -I$(srcdir)/.. $(taglib_includes) $(all_includes) - -kde_kcfg_DATA = audiocd_lame_encoder.kcfg - -kde_module_LTLIBRARIES = libaudiocd_encoder_lame.la - -libaudiocd_encoder_lame_la_SOURCES = audiocd_lame_encoder.kcfgc encoderlame.cpp encoderlameconfig.ui collectingprocess.cpp - -libaudiocd_encoder_lame_la_LIBADD = $(LIB_KIO) ../libaudiocdplugins.la - -libaudiocd_encoder_lame_la_LDFLAGS = -avoid-version -module -no-undefined $(taglib_libs) $(all_libraries) - -pluginsdir = $(kde_datadir)/audiocd/plugins - -METASOURCES = AUTO - -messages: rc.cpp - $(XGETTEXT) *.cpp -o $(podir)/audiocd_encoder_lame.pot diff --git a/kioslave/audiocd/plugins/lame/audiocd_lame_encoder.kcfg b/kioslave/audiocd/plugins/lame/audiocd_lame_encoder.kcfg deleted file mode 100644 index c752fd81..00000000 --- a/kioslave/audiocd/plugins/lame/audiocd_lame_encoder.kcfg +++ /dev/null @@ -1,138 +0,0 @@ - - - - - - - - - false - - - - true - - - - - 0 - - - - -2 - - - - - - false - - - - true - - - - false - - - - false - - - - true - - - - - - 10 - 0 - 13 - - - - - - false - - - - false - - - - false - - - - false - - - - true - - - - - 40 - 0 - 13 - - - - 13 - 0 - 13 - - - - 10 - 0 - 13 - - - - - - - false - - - - 18000 - - - - - false - - - - 0 - - - - - false - - - - 900 - - - - - false - - - - 0 - - - - diff --git a/kioslave/audiocd/plugins/lame/audiocd_lame_encoder.kcfgc b/kioslave/audiocd/plugins/lame/audiocd_lame_encoder.kcfgc deleted file mode 100644 index b96ee704..00000000 --- a/kioslave/audiocd/plugins/lame/audiocd_lame_encoder.kcfgc +++ /dev/null @@ -1,4 +0,0 @@ -# Code generation options for kconfig_compiler -File=audiocd_lame_encoder.kcfg -ClassName=Settings -Singleton=true diff --git a/kioslave/audiocd/plugins/lame/collectingprocess.cpp b/kioslave/audiocd/plugins/lame/collectingprocess.cpp deleted file mode 100644 index 4eaf5304..00000000 --- a/kioslave/audiocd/plugins/lame/collectingprocess.cpp +++ /dev/null @@ -1,134 +0,0 @@ -/* - collectingprocess.cpp - - This file is part of libtdepim. - Copyright (c) 2004 Ingo Kloecker - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - - In addition, as a special exception, the copyright holders give - permission to link the code of this program with any edition of - the TQt library by Trolltech AS, Norway (or with modified versions - of TQt that use the same license as TQt), and distribute linked - combinations including the two. You must obey the GNU General - Public License in all respects for all of the code used other than - TQt. If you modify this file, you may extend this exception to - your version of the file, but you are not obligated to do so. If - you do not wish to do so, delete this exception statement from - your version. -*/ - -#include "collectingprocess.h" - -#include - -#include - -struct CollectingProcess::Private { - Private() : stdoutSize( 0 ), stderrSize( 0 ) - {} - - uint stdoutSize; - TQValueList stdoutBuffer; - uint stderrSize; - TQValueList stderrBuffer; -}; - - -CollectingProcess::CollectingProcess( TQObject * parent, const char * name ) - : TDEProcess( parent, name ) -{ - d = new Private(); -} - -CollectingProcess::~CollectingProcess() { - delete d; d = 0; -} - -bool CollectingProcess::start( RunMode runmode, Communication comm ) { - // prevent duplicate connection - disconnect( this, TQT_SIGNAL( receivedStdout( TDEProcess *, char *, int ) ), - this, TQT_SLOT( slotReceivedStdout( TDEProcess *, char *, int ) ) ); - if ( comm & Stdout ) { - connect( this, TQT_SIGNAL( receivedStdout( TDEProcess *, char *, int ) ), - this, TQT_SLOT( slotReceivedStdout( TDEProcess *, char *, int ) ) ); - } - // prevent duplicate connection - disconnect( this, TQT_SIGNAL( receivedStderr( TDEProcess *, char *, int ) ), - this, TQT_SLOT( slotReceivedStderr( TDEProcess *, char *, int ) ) ); - if ( comm & Stderr ) { - connect( this, TQT_SIGNAL( receivedStderr( TDEProcess *, char *, int ) ), - this, TQT_SLOT( slotReceivedStderr( TDEProcess *, char *, int ) ) ); - } - return TDEProcess::start( runmode, comm ); -} - -void CollectingProcess::slotReceivedStdout( TDEProcess *, char *buf, int len ) -{ - TQByteArray b; - b.duplicate( buf, len ); - d->stdoutBuffer.append( b ); - d->stdoutSize += len; -} - -void CollectingProcess::slotReceivedStderr( TDEProcess *, char *buf, int len ) -{ - TQByteArray b; - b.duplicate( buf, len ); - d->stderrBuffer.append( b ); - d->stderrSize += len; -} - -TQByteArray CollectingProcess::collectedStdout() -{ - if ( d->stdoutSize == 0 ) { - return TQByteArray(); - } - - uint offset = 0; - TQByteArray b( d->stdoutSize ); - for ( TQValueList::const_iterator it = d->stdoutBuffer.begin(); - it != d->stdoutBuffer.end(); - ++it ) { - memcpy( b.data() + offset, (*it).data(), (*it).size() ); - offset += (*it).size(); - } - d->stdoutBuffer.clear(); - d->stdoutSize = 0; - - return b; -} - -TQByteArray CollectingProcess::collectedStderr() -{ - if ( d->stderrSize == 0 ) { - return TQByteArray(); - } - - uint offset = 0; - TQByteArray b( d->stderrSize ); - for ( TQValueList::const_iterator it = d->stderrBuffer.begin(); - it != d->stderrBuffer.end(); - ++it ) { - memcpy( b.data() + offset, (*it).data(), (*it).size() ); - offset += (*it).size(); - } - d->stderrBuffer.clear(); - d->stderrSize = 0; - - return b; -} - -#include "collectingprocess.moc" diff --git a/kioslave/audiocd/plugins/lame/collectingprocess.h b/kioslave/audiocd/plugins/lame/collectingprocess.h deleted file mode 100644 index df5c180d..00000000 --- a/kioslave/audiocd/plugins/lame/collectingprocess.h +++ /dev/null @@ -1,73 +0,0 @@ -/* -*- mode: C++ -*- - collectingprocess.h - - This file is a copy of the collectingprocess.h which is part of tdepim/libtdepim. - Copyright (c) 2004 Ingo Kloecker - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - - In addition, as a special exception, the copyright holders give - permission to link the code of this program with any edition of - the TQt library by Trolltech AS, Norway (or with modified versions - of TQt that use the same license as TQt), and distribute linked - combinations including the two. You must obey the GNU General - Public License in all respects for all of the code used other than - TQt. If you modify this file, you may extend this exception to - your version of the file, but you are not obligated to do so. If - you do not wish to do so, delete this exception statement from - your version. -*/ - -#ifndef __COLLECTINGPROCESS_H__ -#define __COLLECTINGPROCESS_H__ - -#include - -/** - * @short An output collecting TDEProcess class. - * - * This class simplifies the usage of TDEProcess by collecting all output - * (stdout/stderr) of the process. - * - * @author Ingo Kloecker - */ -class CollectingProcess : public TDEProcess { - Q_OBJECT - -public: - CollectingProcess( TQObject * parent = 0, const char * name = 0 ); - ~CollectingProcess(); - - /** Starts the process in NotifyOnExit mode and writes in to stdin of - the process. - */ - bool start( RunMode runmode, Communication comm ); - - /** Returns the contents of the stdout buffer and clears it afterwards. */ - TQByteArray collectedStdout(); - /** Returns the contents of the stderr buffer and clears it afterwards. */ - TQByteArray collectedStderr(); - -private slots: - void slotReceivedStdout( TDEProcess *, char *, int ); - void slotReceivedStderr( TDEProcess *, char *, int ); - -private: - class Private; - Private * d; -protected: -}; - -#endif // __COLLECTINGPROCESS_H__ diff --git a/kioslave/audiocd/plugins/lame/encoderlame.cpp b/kioslave/audiocd/plugins/lame/encoderlame.cpp deleted file mode 100644 index 8984bb33..00000000 --- a/kioslave/audiocd/plugins/lame/encoderlame.cpp +++ /dev/null @@ -1,366 +0,0 @@ -/* - Copyright (C) 2005 Benjamin Meyer - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -*/ - -#include -#include -#include "encoderlame.h" -#include "encoderlameconfig.h" -#include "audiocd_lame_encoder.h" - -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include "collectingprocess.h" - -extern "C" -{ - KDE_EXPORT void create_audiocd_encoders(TDEIO::SlaveBase *slave, TQPtrList &encoders) { - encoders.append(new EncoderLame(slave)); - } -} - -static int bitrates[] = { 32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320 }; - -class EncoderLame::Private -{ -public: - int bitrate; - bool waitingForWrite; - bool processHasExited; - TQString lastErrorMessage; - TQStringList genreList; - uint lastSize; - TDEProcess *currentEncodeProcess; - KTempFile *tempFile; -}; - -EncoderLame::EncoderLame(TDEIO::SlaveBase *slave) : TQObject(), AudioCDEncoder(slave) { - d = new Private(); - d->waitingForWrite = false; - d->processHasExited = false; - d->lastSize = 0; - loadSettings(); -} - -EncoderLame::~EncoderLame(){ - delete d; -} - -TQWidget* EncoderLame::getConfigureWidget(TDEConfigSkeleton** manager) const { - (*manager) = Settings::self(); - TDEGlobal::locale()->insertCatalogue("audiocd_encoder_lame"); - EncoderLameConfig *config = new EncoderLameConfig(); - config->cbr_settings->hide(); - return config; -} - -bool EncoderLame::init(){ - // Determine if lame is installed on the system or not. - if ( KStandardDirs::findExe( "lame" ).isEmpty() ) - return false; - - // Ask lame for the list of genres it knows; otherwise it barfs when doing - // e.g. lame --tg 'Vocal Jazz' - CollectingProcess proc; - proc << "lame" << "--genre-list"; - proc.start(TDEProcess::Block, TDEProcess::Stdout); - - if(proc.exitStatus() != 0) - return false; - - const TQByteArray data = proc.collectedStdout(); - TQString str; - if ( !data.isEmpty() ) - str = TQString::fromLocal8Bit( data, data.size() ); - - d->genreList = TQStringList::split( '\n', str ); - // Remove the numbers in front of every genre - for( TQStringList::Iterator it = d->genreList.begin(); it != d->genreList.end(); ++it ) { - TQString& genre = *it; - uint i = 0; - while ( i < genre.length() && ( genre[i].isSpace() || genre[i].isDigit() ) ) - ++i; - genre = genre.mid( i ); - - } - //kdDebug(7117) << "Available genres:" << d->genreList << endl; - - return true; -} - -void EncoderLame::loadSettings(){ - // Generate the command line arguments for the current settings - args.clear(); - - Settings *settings = Settings::self(); - - int quality = settings->quality(); - if (quality < 0 ) quality = quality *-1; - if (quality > 9) quality = 9; - - int method = settings->bitrate_constant() ? 0 : 1 ; - - if (method == 0) { - // Constant Bitrate Encoding - args.append("-b"); - args.append(TQString("%1").arg(bitrates[settings->cbr_bitrate()])); - d->bitrate = bitrates[settings->cbr_bitrate()]; - args.append("-q"); - args.append(TQString("%1").arg(quality)); - } - else { - // Variable Bitrate Encoding - if (settings->vbr_average_br()) { - args.append("--abr"); - args.append(TQString("%1").arg(bitrates[settings->vbr_mean_brate()])); - d->bitrate = bitrates[settings->vbr_mean_brate()]; - if (settings->vbr_min_br()){ - args.append("-b"); - args.append(TQString("%1").arg(bitrates[settings->vbr_min_brate()])); - } - if (settings->vbr_min_hard()) - args.append("-F"); - if (settings->vbr_max_br()){ - args.append("-B"); - args.append(TQString("%1").arg(bitrates[settings->vbr_max_brate()])); - } - } else { - d->bitrate = 128; - args.append("-V"); - args.append(TQString("%1").arg(quality)); - } - if ( !settings->vbr_xing_tag() ) - args.append("-t"); - } - - args.append("-m"); - switch ( settings->stereo() ) { - case 0: - args.append("s"); - break; - case 1: - args.append("j"); - break; - case 2: - args.append("d"); - break; - case 3: - args.append("m"); - break; - default: - args.append("s"); - break; - } - - if(settings->copyright()) - args.append("-c"); - if(!settings->original()) - args.append("-o"); - if(settings->iso()) - args.append("--strictly-enforce-ISO"); - if(settings->crc()) - args.append("-p"); - - if ( settings->enable_lowpass() ) { - args.append("--lowpass"); - args.append(TQString("%1").arg(settings->lowfilterfreq())); - - if (settings->set_lpf_width()){ - args.append("--lowpass-width"); - args.append(TQString("%1").arg(settings->lowfilterwidth())); - } - } - - if ( settings->enable_highpass()) { - args.append("--hipass"); - args.append(TQString("%1").arg(settings->highfilterfreq())); - - if (settings->set_hpf_width()){ - args.append("--hipass-width"); - args.append(TQString("%1").arg(settings->highfilterwidth())); - } - } -} - -unsigned long EncoderLame::size(long time_secs) const { - return (time_secs * d->bitrate * 1000)/8; -} - -long EncoderLame::readInit(long /*size*/){ - // Create TDEProcess - d->currentEncodeProcess = new TDEProcess(0); - TQString prefix = locateLocal("tmp", ""); - d->tempFile = new KTempFile(prefix, ".mp3"); - d->tempFile->setAutoDelete(true); - d->lastErrorMessage = TQString(); - d->processHasExited = false; - - // -x bitswap - // -r raw/pcm - // -s 44.1 (because it is raw you have to specify this) -// #if __BYTE_ORDER == __LITTLE_ENDIAN -// *(d->currentEncodeProcess) << "lame" << "--verbose" << "-x" << "-r" << "-s" << "44.1"; -// #else - *(d->currentEncodeProcess) << "lame" << "--verbose" << "-r" << "-s" << "44.1"; -// #endif - - *(d->currentEncodeProcess) << args; - if(Settings::self()->id3_tag()) - *d->currentEncodeProcess << trackInfo; - - // Read in stdin, output to the temp file - *d->currentEncodeProcess << "-" << d->tempFile->name().latin1(); - - //kdDebug(7117) << d->currentEncodeProcess->args() << endl; - - - connect(d->currentEncodeProcess, TQT_SIGNAL(receivedStdout(TDEProcess *, char *, int)), - this, TQT_SLOT(receivedStdout(TDEProcess *, char *, int))); - connect(d->currentEncodeProcess, TQT_SIGNAL(receivedStderr(TDEProcess *, char *, int)), - this, TQT_SLOT(receivedStderr(TDEProcess *, char *, int))); - connect(d->currentEncodeProcess, TQT_SIGNAL(wroteStdin(TDEProcess *)), - this, TQT_SLOT(wroteStdin(TDEProcess *))); - - connect(d->currentEncodeProcess, TQT_SIGNAL(processExited(TDEProcess *)), - this, TQT_SLOT(processExited(TDEProcess *))); - - // Launch! - d->currentEncodeProcess->start(TDEProcess::NotifyOnExit, KShellProcess::All); - return 0; -} - -void EncoderLame::processExited ( TDEProcess *process ){ - kdDebug(7117) << "Lame Encoding process exited with: " << process->exitStatus() << endl; - d->processHasExited = true; -} - -void EncoderLame::receivedStderr( TDEProcess * /*process*/, char *buffer, int /*buflen*/ ){ - kdDebug(7117) << "Lame stderr: " << buffer << endl; - if ( !d->lastErrorMessage.isEmpty() ) - d->lastErrorMessage += '\t'; - d->lastErrorMessage += TQString::fromLocal8Bit( buffer ); -} - -void EncoderLame::receivedStdout( TDEProcess * /*process*/, char *buffer, int /*length*/ ){ - kdDebug(7117) << "Lame stdout: " << buffer << endl; -} - -void EncoderLame::wroteStdin( TDEProcess * /*procces*/ ){ - d->waitingForWrite = false; -} - -long EncoderLame::read(int16_t *buf, int frames){ - if(!d->currentEncodeProcess) - return 0; - if (d->processHasExited) - return -1; - - // Pipe the raw data to lame - char * cbuf = reinterpret_cast(buf); - d->currentEncodeProcess->writeStdin( cbuf, frames*4); - - // We can't return until the buffer has been written - d->waitingForWrite = true; - while(d->waitingForWrite && d->currentEncodeProcess->isRunning()){ - kapp->processEvents(); - usleep(1); - } - - // Determine the file size increase - TQFileInfo file(d->tempFile->name()); - uint change = file.size() - d->lastSize; - d->lastSize = file.size(); - return change; -} - -long EncoderLame::readCleanup(){ - if(!d->currentEncodeProcess) - return 0; - - // Let lame tag the first frame of the mp3 - d->currentEncodeProcess->closeStdin(); - while( d->currentEncodeProcess->isRunning()){ - kapp->processEvents(); - usleep(1); - } - - // Now copy the file out of the temp into kio - TQFile file( d->tempFile->name() ); - if ( file.open( IO_ReadOnly ) ) { - TQByteArray output; - char data[1024]; - while ( !file.atEnd() ) { - uint read = file.readBlock(data, 1024); - output.setRawData(data, read); - ioslave->data(output); - output.resetRawData(data, read); - } - file.close(); - } - - // cleanup the process and temp - delete d->currentEncodeProcess; - delete d->tempFile; - d->lastSize = 0; - - return 0; -} - -void EncoderLame::fillSongInfo( KCDDB::CDInfo info, int track, const TQString &comment ){ - trackInfo.clear(); - trackInfo.append("--tt"); - trackInfo.append(info.trackInfoList[track].get("title").toString()); - - trackInfo.append("--ta"); - trackInfo.append(info.get("artist").toString()); - - trackInfo.append("--tl"); - trackInfo.append(info.get("title").toString()); - - trackInfo.append("--ty"); - trackInfo.append(TQString("%1").arg(info.get("year").toString())); - - trackInfo.append("--tc"); - trackInfo.append(comment); - - trackInfo.append("--tn"); - trackInfo.append(TQString("%1").arg(track+1)); - - const TQString genre = info.get( "genre" ).toString(); - if ( d->genreList.find( genre ) != d->genreList.end() ) - { - trackInfo.append("--tg"); - trackInfo.append(genre); - } -} - - -TQString EncoderLame::lastErrorMessage() const -{ - return d->lastErrorMessage; -} - -#include "encoderlame.moc" diff --git a/kioslave/audiocd/plugins/lame/encoderlame.h b/kioslave/audiocd/plugins/lame/encoderlame.h deleted file mode 100644 index 09c323c3..00000000 --- a/kioslave/audiocd/plugins/lame/encoderlame.h +++ /dev/null @@ -1,68 +0,0 @@ -/* - Copyright (C) 2005 Benjamin Meyer - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -*/ - -#ifndef ENCODER_LAME_H -#define ENCODER_LAME_H - -#include "audiocdencoder.h" - -class TDEProcess; - -/** - * MP3 encoder using the LAME encoder. - * Go to http://lame.sourceforge.net/ for lots of information. - */ -class EncoderLame : public TQObject, public AudioCDEncoder { - -Q_OBJECT - - -public: - EncoderLame(TDEIO::SlaveBase *slave); - ~EncoderLame(); - - virtual TQString type() const { return "MP3"; }; - virtual bool init(); - virtual void loadSettings(); - virtual unsigned long size(long time_secs) const; - virtual const char * fileType() const { return "mp3"; }; - virtual const char * mimeType() const { return "audio/x-mp3"; }; - virtual void fillSongInfo( KCDDB::CDInfo info, int track, const TQString &comment ); - virtual long readInit(long size); - virtual long read(int16_t * buf, int frames); - virtual long readCleanup(); - virtual TQString lastErrorMessage() const; - - virtual TQWidget* getConfigureWidget(TDEConfigSkeleton** manager) const; - -protected slots: - void wroteStdin(TDEProcess *proc); - void receivedStdout(TDEProcess *, char *buffer, int length); - void receivedStderr(TDEProcess *proc, char *buffer, int buflen); - void processExited(TDEProcess *proc); - -private: - class Private; - Private * d; - - TQStringList args; - TQStringList trackInfo; -}; - -#endif // ENCODER_LAME_H - diff --git a/kioslave/audiocd/plugins/lame/encoderlameconfig.ui b/kioslave/audiocd/plugins/lame/encoderlameconfig.ui deleted file mode 100644 index f8149741..00000000 --- a/kioslave/audiocd/plugins/lame/encoderlameconfig.ui +++ /dev/null @@ -1,930 +0,0 @@ - -EncoderLameConfig - - - LameConfig - - - - 0 - 0 - 471 - 598 - - - - - unnamed - - - - GroupBox1_2 - - - Options - - - - unnamed - - - 11 - - - 6 - - - - kcfg_copyright - - - Cop&yrighted - - - Mark MP3 file as copyrighted - - - Mark MP3 file as copyrighted. - - - - - kcfg_original - - - Origi&nal - - - true - - - Mark MP3 file as an original - - - Mark MP3 file as an original. - - - - - kcfg_iso - - - &ISO encoding - - - Try to use strict ISO encoding - - - This selects the maximal bitrate used for encoding. - - - - - kcfg_crc - - - &Error protection - - - - - kcfg_id3_tag - - - &Write ID3 tag - - - true - - - If checked and if cddb support is available, an id3 tag will be appended - - - If checked and if cddb support is available, an id3 tag will be appended - - - - - - - buttonGroup1 - - - Encoding Method - - - - unnamed - - - - Layout21 - - - - unnamed - - - 0 - - - 6 - - - - TextLabel3_2 - - - Low - - - - - kcfg_quality - - - -9 - - - 0 - - - 1 - - - -7 - - - Horizontal - - - NoMarks - - - - - TextLabel2_2 - - - High - - - - - - - TextLabel1_2 - - - &Quality: - - - AlignLeft - - - kcfg_quality - - - - - - Stereo - - - - - Joint Stereo - - - - - Dual Channel - - - - - Mono - - - - kcfg_stereo - - - This option controls whether MP3 files are recorded with one or two channels. Note that choosing <i>"Mono"</i> reduces file size, but also kills the stereo signal. - - - - - kcfg_bitrate_constant - - - Constant bitrate - - - - - kcfg_bitrate_variable - - - Variable bitrate - - - true - - - - - - - spacer11 - - - Vertical - - - Expanding - - - - 20 - 16 - - - - - - vbr_settings - - - true - - - Variable Bitrate Settings - - - - unnamed - - - 11 - - - 6 - - - - kcfg_vbr_average_br - - - Specify avera&ge bitrate: - - - This selects the maximal bitrate used for encoding. - - - - - - 32 kbs - - - - - 40 kbs - - - - - 48 kbs - - - - - 56 kbs - - - - - 64 kbs - - - - - 80 kbs - - - - - 96 kbs - - - - - 112 kbs - - - - - 128 kbs - - - - - 160 kbs - - - - - 192 kbs - - - - - 224 kbs - - - - - 256 kbs - - - - - 320 kbs - - - - kcfg_vbr_max_brate - - - false - - - 13 - - - - - kcfg_vbr_max_br - - - false - - - Maximal bi&trate: - - - This selects the maximal bitrate used for encoding. - - - - - kcfg_vbr_xing_tag - - - Write &Xing VBR tag - - - true - - - This writes additional information related to VBR as introduced by Xing. - - - - - - 32 kbs - - - - - 40 kbs - - - - - 48 kbs - - - - - 56 kbs - - - - - 64 kbs - - - - - 80 kbs - - - - - 96 kbs - - - - - 112 kbs - - - - - 128 kbs - - - - - 160 kbs - - - - - 192 kbs - - - - - 224 kbs - - - - - 256 kbs - - - - - 320 kbs - - - - kcfg_vbr_mean_brate - - - false - - - 9 - - - - - kcfg_vbr_min_hard - - - false - - - Minimal &value is a hard limit - - - - - kcfg_vbr_min_br - - - false - - - Minimal &bitrate: - - - This selects the minimal bitrate used for encoding. - - - - - - 32 kbs - - - - - 40 kbs - - - - - 48 kbs - - - - - 56 kbs - - - - - 64 kbs - - - - - 80 kbs - - - - - 96 kbs - - - - - 112 kbs - - - - - 128 kbs - - - - - 160 kbs - - - - - 192 kbs - - - - - 224 kbs - - - - - 256 kbs - - - - - 320 kbs - - - - kcfg_vbr_min_brate - - - false - - - 1 - - - - - - - cbr_settings - - - Constant Bitrate Settings - - - - unnamed - - - 11 - - - 6 - - - - TextLabel4_2 - - - Bitrate: - - - kcfg_cbr_bitrate - - - - - - 32 kbs - - - - - 40 kbs - - - - - 48 kbs - - - - - 56 kbs - - - - - 64 kbs - - - - - 80 kbs - - - - - 96 kbs - - - - - 112 kbs - - - - - 128 kbs - - - - - 160 kbs - - - - - 192 kbs - - - - - 224 kbs - - - - - 256 kbs - - - - - 320 kbs - - - - kcfg_cbr_bitrate - - - 9 - - - The higher the bitrate, the better the quality and the larger the file. - - - - - - - GroupBox83_2 - - - Filter Settings - - - AlignVCenter|AlignLeft - - - - - - - - unnamed - - - 11 - - - 6 - - - - kcfg_enable_lowpass - - - &Lowpass filter cutoff above - - - - - kcfg_lowfilterfreq - - - false - - - Hz - - - 20000 - - - - - kcfg_enable_highpass - - - &Highpass filter cutoff below - - - - - kcfg_highfilterfreq - - - false - - - Hz - - - 200 - - - - - kcfg_set_lpf_width - - - false - - - Low&pass filter width - - - - - kcfg_lowfilterwidth - - - false - - - Hz - - - 5000 - - - - - kcfg_set_hpf_width - - - false - - - Highpa&ss filter width - - - - - kcfg_highfilterwidth - - - false - - - Hz - - - 50 - - - - - - - - - kcfg_bitrate_constant - toggled(bool) - cbr_settings - setShown(bool) - - - kcfg_enable_highpass - toggled(bool) - kcfg_highfilterfreq - setEnabled(bool) - - - kcfg_enable_highpass - toggled(bool) - kcfg_highfilterwidth - setEnabled(bool) - - - kcfg_enable_lowpass - toggled(bool) - kcfg_lowfilterfreq - setEnabled(bool) - - - kcfg_enable_lowpass - toggled(bool) - kcfg_lowfilterwidth - setEnabled(bool) - - - kcfg_enable_highpass - toggled(bool) - kcfg_set_hpf_width - setEnabled(bool) - - - kcfg_enable_lowpass - toggled(bool) - kcfg_set_lpf_width - setEnabled(bool) - - - kcfg_vbr_average_br - toggled(bool) - kcfg_vbr_max_br - setEnabled(bool) - - - kcfg_vbr_max_br - toggled(bool) - kcfg_vbr_max_brate - setEnabled(bool) - - - kcfg_vbr_average_br - toggled(bool) - kcfg_vbr_mean_brate - setEnabled(bool) - - - kcfg_vbr_average_br - toggled(bool) - kcfg_vbr_min_br - setEnabled(bool) - - - kcfg_vbr_min_br - toggled(bool) - kcfg_vbr_min_brate - setEnabled(bool) - - - kcfg_vbr_min_br - toggled(bool) - kcfg_vbr_min_hard - setEnabled(bool) - - - kcfg_bitrate_variable - toggled(bool) - vbr_settings - setShown(bool) - - - - kcfg_bitrate_variable - kcfg_stereo - kcfg_quality - kcfg_copyright - kcfg_original - kcfg_iso - kcfg_crc - kcfg_id3_tag - kcfg_cbr_bitrate - kcfg_vbr_min_br - kcfg_vbr_min_hard - kcfg_vbr_max_br - kcfg_vbr_average_br - kcfg_vbr_xing_tag - kcfg_vbr_min_brate - kcfg_vbr_max_brate - kcfg_vbr_mean_brate - kcfg_enable_lowpass - kcfg_lowfilterfreq - kcfg_enable_highpass - kcfg_highfilterfreq - kcfg_set_lpf_width - kcfg_lowfilterwidth - kcfg_set_hpf_width - kcfg_highfilterwidth - - - diff --git a/kioslave/audiocd/plugins/vorbis/Makefile.am b/kioslave/audiocd/plugins/vorbis/Makefile.am deleted file mode 100644 index e83240ff..00000000 --- a/kioslave/audiocd/plugins/vorbis/Makefile.am +++ /dev/null @@ -1,18 +0,0 @@ -INCLUDES = -I$(top_srcdir)/libkcddb -I$(srcdir)/.. $(all_includes) - -kde_kcfg_DATA = audiocd_vorbis_encoder.kcfg - -kde_module_LTLIBRARIES = libaudiocd_encoder_vorbis.la - -libaudiocd_encoder_vorbis_la_SOURCES = audiocd_vorbis_encoder.kcfgc encodervorbis.cpp encodervorbisconfig.ui - -libaudiocd_encoder_vorbis_la_LIBADD = $(VORBIS_LIBS) $(VORBISFILE_LIBS) $(VORBISENC_LIBS) $(LIB_KIO) ../libaudiocdplugins.la - -libaudiocd_encoder_vorbis_la_LDFLAGS = -avoid-version -module -no-undefined $(all_libraries) - -pluginsdir = $(kde_datadir)/audiocd/plugins - -METASOURCES = AUTO - -messages: rc.cpp - $(XGETTEXT) *.cpp -o $(podir)/audiocd_encoder_vorbis.pot diff --git a/kioslave/audiocd/plugins/vorbis/audiocd_vorbis_encoder.kcfg b/kioslave/audiocd/plugins/vorbis/audiocd_vorbis_encoder.kcfg deleted file mode 100644 index 53465f6c..00000000 --- a/kioslave/audiocd/plugins/vorbis/audiocd_vorbis_encoder.kcfg +++ /dev/null @@ -1,84 +0,0 @@ - - - - - - - - 0 - - - - - false - - - - false - - - - true - - - - - true - - - - 3 - -1 - 10 - - - - - 1 - 0 - 13 - - - - - 13 - 0 - 13 - - - - - 3 - 0 - 5 - - - - - - - - diff --git a/kioslave/audiocd/plugins/vorbis/audiocd_vorbis_encoder.kcfgc b/kioslave/audiocd/plugins/vorbis/audiocd_vorbis_encoder.kcfgc deleted file mode 100644 index e213ccbd..00000000 --- a/kioslave/audiocd/plugins/vorbis/audiocd_vorbis_encoder.kcfgc +++ /dev/null @@ -1,4 +0,0 @@ -# Code generation options for kconfig_compiler -File=audiocd_vorbis_encoder.kcfg -ClassName=Settings -Singleton=true diff --git a/kioslave/audiocd/plugins/vorbis/encodervorbis.cpp b/kioslave/audiocd/plugins/vorbis/encodervorbis.cpp deleted file mode 100644 index c5340434..00000000 --- a/kioslave/audiocd/plugins/vorbis/encodervorbis.cpp +++ /dev/null @@ -1,336 +0,0 @@ -/* - Copyright (C) 2000 Rik Hemsley (rikkus) - Copyright (C) 2000, 2001, 2002 Michael Matz - Copyright (C) 2001 Carsten Duvenhorst - Copyright (C) 2001 Adrian Schroeter - Copyright (C) 2003 Richard Lärkäng - Copyright (C) 2003 Scott Wheeler - Copyright (C) 2004, 2005 Benjamin Meyer - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -*/ - -#include "encodervorbis.h" -#include "audiocd_vorbis_encoder.h" -#include "encodervorbisconfig.h" - -#ifdef HAVE_VORBIS - -#include -#include -#include -#include -#include -#include - -#include -#include - -extern "C" -{ - KDE_EXPORT void create_audiocd_encoders(TDEIO::SlaveBase *slave, TQPtrList &encoders) - { - encoders.append(new EncoderVorbis(slave)); - } -} - -// these are the approx. bitrates for the current 5 Vorbis modes -static int vorbis_nominal_bitrates[] = { 128, 160, 192, 256, 350 }; -static int vorbis_bitrates[] = { 32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 350 }; - -class EncoderVorbis::Private { - -public: - ogg_stream_state os; /* take physical pages, weld into a logical stream of packets */ - ogg_page og; /* one Ogg bitstream page. Vorbis packets are inside */ - ogg_packet op; /* one raw packet of data for decode */ - - vorbis_info vi; /* struct that stores all the static vorbis bitstream settings */ - vorbis_comment vc; /* struct that stores all the user comments */ - - vorbis_dsp_state vd; /* central working state for the packet->PCM decoder */ - vorbis_block vb; /* local working space for packet->PCM decode */ - bool write_vorbis_comments; - long vorbis_bitrate_lower; - long vorbis_bitrate_upper; - long vorbis_bitrate_nominal; - int vorbis_encode_method; - double vorbis_quality; - int vorbis_bitrate; -}; - -EncoderVorbis::EncoderVorbis(TDEIO::SlaveBase *slave) : AudioCDEncoder(slave) { - d = new Private(); -} - -EncoderVorbis::~EncoderVorbis(){ - delete d; -} - -TQWidget* EncoderVorbis::getConfigureWidget(TDEConfigSkeleton** manager) const { - (*manager) = Settings::self(); - TDEGlobal::locale()->insertCatalogue("audiocd_encoder_vorbis"); - EncoderVorbisConfig *config = new EncoderVorbisConfig(); - config->kcfg_vorbis_quality->setRange(0.0, 10.0, 0.2, true); - config->vorbis_bitrate_settings->hide(); - return config; -} - -bool EncoderVorbis::init(){ - vorbis_info_init(&d->vi); - vorbis_comment_init(&d->vc); - - vorbis_comment_add_tag - ( - &d->vc, - const_cast("kde-encoder"), - const_cast("kio_audiocd") - ); - return true; -} - -void EncoderVorbis::loadSettings(){ - Settings *settings = Settings::self(); - - d->vorbis_encode_method = settings->vorbis_enc_method(); - d->vorbis_quality = settings->vorbis_quality(); - - if ( settings->set_vorbis_min_br()) { - d->vorbis_bitrate_lower = vorbis_bitrates[settings->vorbis_min_br()] * 1000; - } else { - d->vorbis_bitrate_lower = -1; - } - - if ( settings->set_vorbis_max_br() ) { - d->vorbis_bitrate_upper = vorbis_bitrates[settings->vorbis_max_br()] * 1000; - } else { - d->vorbis_bitrate_upper = -1; - } - - // this is such a hack! - if ( d->vorbis_bitrate_upper != -1 && d->vorbis_bitrate_lower != -1 ) { - d->vorbis_bitrate = 104000; // empirically determined ...?! - } else { - d->vorbis_bitrate = 160 * 1000; - } - - if ( settings->set_vorbis_nominal_br() ) { - d->vorbis_bitrate_nominal = vorbis_nominal_bitrates[settings->vorbis_nominal_br()] * 1000; - d->vorbis_bitrate = d->vorbis_bitrate_nominal; - } else { - d->vorbis_bitrate_nominal = -1; - } - - d->write_vorbis_comments = settings->vorbis_comments(); - - // Now that we have read in the settings apply them to the encoder lib - switch (d->vorbis_encode_method) { - case 0: -/* Support very old libvorbis by simply falling through. */ -#if HAVE_VORBIS >= 2 - vorbis_encode_init_vbr(&d->vi, 2, 44100, d->vorbis_quality/10.0); - break; -#endif - case 1: - vorbis_encode_init(&d->vi, 2, 44100, d->vorbis_bitrate_upper, d->vorbis_bitrate_nominal, d->vorbis_bitrate_lower); - break; - } - -} - -long EncoderVorbis::flush_vorbis(void) { - long processed(0); - - while(vorbis_analysis_blockout(&d->vd,&d->vb)==1) { - /* Support ancient libvorbis (< RC3). */ -#if HAVE_VORBIS >= 2 - vorbis_analysis(&d->vb,NULL); - /* Non-ancient case. */ - vorbis_bitrate_addblock(&d->vb); - - while(vorbis_bitrate_flushpacket(&d->vd, &d->op)) { -#else - vorbis_analysis(&d->vb,&d->op); - /* Make a lexical block to place the #ifdef's nearby. */ - if (1) { -#endif - ogg_stream_packetin(&d->os,&d->op); - while(int result=ogg_stream_pageout(&d->os,&d->og)) { - if (!result) break; - - TQByteArray output; - - char * oggheader = reinterpret_cast(d->og.header); - char * oggbody = reinterpret_cast(d->og.body); - - if (d->og.header_len) { - output.setRawData(oggheader, d->og.header_len); - ioslave->data(output); - output.resetRawData(oggheader, d->og.header_len); - } - - if (d->og.body_len) { - output.setRawData(oggbody, d->og.body_len); - ioslave->data(output); - output.resetRawData(oggbody, d->og.body_len); - } - processed += d->og.header_len + d->og.body_len; - } - } - } - return processed; -} - -unsigned long EncoderVorbis::size(long time_secs) const { - long vorbis_size; - switch (d->vorbis_encode_method) - { - case 0: // quality based encoding - -#if HAVE_VORBIS >= 2 // If really old Vorbis is being used, skip this nicely. - - { - // Estimated numbers based on the Vorbis FAQ: - // http://www.xiph.org/archives/vorbis-faq/200203/0030.html - - static long vorbis_q_bitrate[] = { 60, 74, 86, 106, 120, 152, - 183, 207, 239, 309, 440 }; - long quality = static_cast(d->vorbis_quality); - if (quality < 0 || quality > 10) - quality = 3; - vorbis_size = (time_secs * vorbis_q_bitrate[quality] * 1000) / 8; - - break; - } - -#endif // HAVE_VORBIS >= 2 - - default: // bitrate based encoding - vorbis_size = (time_secs * d->vorbis_bitrate/8); - break; - } - - return vorbis_size; -} - -const char * EncoderVorbis::mimeType() const{ - return "audio/vorbis"; -} - -long EncoderVorbis::readInit(long /*size*/){ - ogg_packet header; - ogg_packet header_comm; - ogg_packet header_code; - - vorbis_analysis_init(&d->vd,&d->vi); - vorbis_block_init(&d->vd,&d->vb); - - srand(time(NULL)); - ogg_stream_init(&d->os,rand()); - - vorbis_analysis_headerout(&d->vd,&d->vc,&header,&header_comm,&header_code); - - ogg_stream_packetin(&d->os,&header); - ogg_stream_packetin(&d->os,&header_comm); - ogg_stream_packetin(&d->os,&header_code); - - while (int result = ogg_stream_flush(&d->os,&d->og)) { - - if (!result) break; - - TQByteArray output; - - char * oggheader = reinterpret_cast(d->og.header); - char * oggbody = reinterpret_cast(d->og.body); - - if (d->og.header_len) { - output.setRawData(oggheader, d->og.header_len); - ioslave->data(output); - output.resetRawData(oggheader, d->og.header_len); - } - - if (d->og.body_len) { - output.setRawData(oggbody, d->og.body_len); - ioslave->data(output); - output.resetRawData(oggbody, d->og.body_len); - } - } - return 0; -} - -long EncoderVorbis::read(int16_t * buf, int frames){ - int i; - float **buffer=vorbis_analysis_buffer(&d->vd,frames); - - /* uninterleave samples */ - for(i=0;ivd,i); - return flush_vorbis(); -} - -long EncoderVorbis::readCleanup(){ - // send end-of-stream and flush the encoder - vorbis_analysis_wrote(&d->vd,0); - long processed = flush_vorbis(); - ogg_stream_clear(&d->os); - vorbis_block_clear(&d->vb); - vorbis_dsp_clear(&d->vd); - vorbis_info_clear(&d->vi); - return processed; -} - -void EncoderVorbis::fillSongInfo( KCDDB::CDInfo info, int track, const TQString &comment ) -{ - if( !d->write_vorbis_comments ) - return; - - typedef TQPair CommentField; - TQValueList commentFields; - - commentFields.append(CommentField("title", info.trackInfoList[track].get("title"))); - commentFields.append(CommentField("artist", info.get("artist"))); - commentFields.append(CommentField("album", info.get("title"))); - commentFields.append(CommentField("genre", info.get("genre"))); - commentFields.append(CommentField("tracknumber", TQString::number(track+1))); - commentFields.append(CommentField("comment", comment)); - - if (info.get("year").toInt() > 0) { - TQDateTime dt(TQDate(info.get("year").toInt(), 1, 1)); - commentFields.append(CommentField("date", dt.toString(Qt::ISODate).utf8().data())); - } - - for(TQValueListIterator it = commentFields.begin(); it != commentFields.end(); ++it) { - - // if the value is not empty - if(!(*it).second.toString().isEmpty()) { - - char *key = tqstrdup((*it).first); - char *value = tqstrdup((*it).second.toString().utf8().data()); - - vorbis_comment_add_tag(&d->vc, key, value); - - delete [] key; - delete [] value; - } - } -} - -#endif // HAVE_VORBIS - diff --git a/kioslave/audiocd/plugins/vorbis/encodervorbis.h b/kioslave/audiocd/plugins/vorbis/encodervorbis.h deleted file mode 100644 index ea6a0ac3..00000000 --- a/kioslave/audiocd/plugins/vorbis/encodervorbis.h +++ /dev/null @@ -1,68 +0,0 @@ -/* - Copyright (C) 2000 Rik Hemsley (rikkus) - Copyright (C) 2000, 2001, 2002 Michael Matz - Copyright (C) 2001 Carsten Duvenhorst - Copyright (C) 2001 Adrian Schroeter - Copyright (C) 2003 Richard Lärkäng - Copyright (C) 2003 Scott Wheeler - Copyright (C) 2004, 2005 Benjamin Meyer - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -*/ - -#ifndef ENCODER_VORBIS_H -#define ENCODER_VORBIS_H - -#include - -#ifdef HAVE_VORBIS - -#include - -/** - * Ogg Vorbis encoder. - * This encoder is only enabled when HAVE_VORBIS is set. - * Check out http://www.vorbis.com/ for lots of information. - */ -class EncoderVorbis : public AudioCDEncoder { - -public: - EncoderVorbis(TDEIO::SlaveBase *slave); - ~EncoderVorbis(); - - virtual TQString type() const { return "Ogg Vorbis"; }; - virtual bool init(); - virtual void loadSettings(); - virtual unsigned long size(long time_secs) const; - virtual const char * fileType() const { return "ogg"; }; - virtual const char * mimeType() const; - virtual void fillSongInfo( KCDDB::CDInfo info, int track, const TQString &comment ); - virtual long readInit(long size); - virtual long read(int16_t * buf, int frames); - virtual long readCleanup(); - virtual TQWidget* getConfigureWidget(TDEConfigSkeleton** manager) const; - -private: - long flush_vorbis(); - - class Private; - Private * d; - -}; - -#endif // HAVE_VORBIS - -#endif // ENCODER_VORBIS_H - diff --git a/kioslave/audiocd/plugins/vorbis/encodervorbisconfig.ui b/kioslave/audiocd/plugins/vorbis/encodervorbisconfig.ui deleted file mode 100644 index e442ade2..00000000 --- a/kioslave/audiocd/plugins/vorbis/encodervorbisconfig.ui +++ /dev/null @@ -1,425 +0,0 @@ - -EncoderVorbisConfig - - - VorbisConfig - - - - 0 - 0 - 375 - 408 - - - - - unnamed - - - - kcfg_vorbis_enc_method - - - &Encoding Method - - - - unnamed - - - - vorbis_enc_quality - - - Quality based - - - true - - - - - vorbis_enc_bitrate - - - Bitrate based - - - - - - - vorbis_bitrate_settings - - - true - - - Vorbis Bitrate Settings - - - - unnamed - - - 11 - - - 6 - - - - - 32 kbs - - - - - 40 kbs - - - - - 48 kbs - - - - - 56 kbs - - - - - 64 kbs - - - - - 80 kbs - - - - - 96 kbs - - - - - 112 kbs - - - - - 128 kbs - - - - - 160 kbs - - - - - 192 kbs - - - - - 224 kbs - - - - - 256 kbs - - - - - 350 kbs - - - - kcfg_vorbis_min_br - - - false - - - 1 - - - - - - 32 kbs - - - - - 40 kbs - - - - - 48 kbs - - - - - 56 kbs - - - - - 64 kbs - - - - - 80 kbs - - - - - 96 kbs - - - - - 112 kbs - - - - - 128 kbs - - - - - 160 kbs - - - - - 192 kbs - - - - - 224 kbs - - - - - 256 kbs - - - - - 350 kbs - - - - kcfg_vorbis_max_br - - - false - - - 13 - - - - - kcfg_set_vorbis_min_br - - - true - - - M&inimal bitrate: - - - - - kcfg_set_vorbis_max_br - - - true - - - Ma&ximal bitrate: - - - - - - 128 kbs - - - - - 160 kbs - - - - - 192 kbs - - - - - 256 kbs - - - - - 350 kbs - - - - kcfg_vorbis_nominal_br - - - 1 - - - - - kcfg_set_vorbis_nominal_br - - - A&verage bitrate: - - - true - - - - - - - vorbis_quality_settings - - - Vorbis &Quality Setting - - - You can set the quality of the encoded stream here. A higher value implies a higher quality but encodes slower. - - - - unnamed - - - 11 - - - 6 - - - - kcfg_vorbis_quality - - - 0 - - - 0 - - - 10000 - - - 1 - - - Higher is better but slower - - - - - - - GroupBox193 - - - Options - - - - unnamed - - - 11 - - - 6 - - - - kcfg_vorbis_comments - - - true - - - Add &track information - - - Add a description of the song to the file header. This makes it easy for the user to get advanced song information shown by his media player. You can get this information automatically via the Internet. Look at the <i>"CDDB Retrieval"</i> control module for details. - - - - - - - spacer9 - - - Vertical - - - Expanding - - - - 20 - 51 - - - - - - - - vorbis_enc_bitrate - toggled(bool) - vorbis_bitrate_settings - setShown(bool) - - - vorbis_enc_quality - toggled(bool) - vorbis_quality_settings - setShown(bool) - - - - vorbis_enc_quality - kcfg_set_vorbis_min_br - kcfg_set_vorbis_max_br - kcfg_set_vorbis_nominal_br - kcfg_vorbis_min_br - kcfg_vorbis_max_br - kcfg_vorbis_nominal_br - kcfg_vorbis_quality - kcfg_vorbis_comments - - - - knuminput.h - knuminput.h - - diff --git a/kioslave/audiocd/plugins/wav/Makefile.am b/kioslave/audiocd/plugins/wav/Makefile.am deleted file mode 100644 index 82e6ab28..00000000 --- a/kioslave/audiocd/plugins/wav/Makefile.am +++ /dev/null @@ -1,15 +0,0 @@ -AM_CPPFLAGS = -I$(srcdir)/.. $(all_includes) - -INCLUDES = -I$(top_srcdir)/libkcddb - -kde_module_LTLIBRARIES = libaudiocd_encoder_wav.la - -libaudiocd_encoder_wav_la_SOURCES = encoderwav.cpp encodercda.cpp - -libaudiocd_encoder_wav_la_LIBADD = $(LIB_KIO) ../libaudiocdplugins.la $(CDPARANOIA_LIBS) - -libaudiocd_encoder_wav_la_LDFLAGS = -avoid-version -module -no-undefined $(all_libraries) - -pluginsdir = $(kde_datadir)/audiocd/plugins - -METASOURCES = AUTO diff --git a/kioslave/audiocd/plugins/wav/encodercda.cpp b/kioslave/audiocd/plugins/wav/encodercda.cpp deleted file mode 100644 index ef8522d9..00000000 --- a/kioslave/audiocd/plugins/wav/encodercda.cpp +++ /dev/null @@ -1,67 +0,0 @@ -/* - Copyright (C) 2000 Rik Hemsley (rikkus) - Copyright (C) 2000, 2001, 2002 Michael Matz - Copyright (C) 2001 Carsten Duvenhorst - Copyright (C) 2001 Adrian Schroeter - Copyright (C) 2003 Richard Lärkäng - Copyright (C) 2003 Scott Wheeler - Copyright (C) 2004, 2005 Benjamin Meyer - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -*/ - -#include "encodercda.h" - -class EncoderCda::Private -{ - public: - -}; - -unsigned long EncoderCda::size(long time_secs) const { - //return (time_secs * (44100 * 2 * 16))/8; - return (time_secs) * 176400; -} - -const char * EncoderCda::mimeType() const { - return "audio/x-cda"; -} - -// Remove this by calculating CD_FRAMESIZE_RAW from the frames -extern "C" -{ - #include -} - -inline int16_t swap16 (int16_t i) -{ - return (((i >> 8) & 0xFF) | ((i << 8) & 0xFF00)); -} - -long EncoderCda::read(int16_t * buf, int frames){ - TQByteArray output; - int16_t i16 = 1; - /* WAV is defined to be little endian, so we need to swap it - on big endian platforms. */ - if (((char*)&i16)[0] == 0) - for (int i=0; i < 2 * frames; i++) - buf[i] = swap16 (buf[i]); - char * cbuf = reinterpret_cast(buf); - output.setRawData(cbuf, CD_FRAMESIZE_RAW); - ioslave->data(output); - output.resetRawData(cbuf, CD_FRAMESIZE_RAW); - return CD_FRAMESIZE_RAW; -} - diff --git a/kioslave/audiocd/plugins/wav/encodercda.h b/kioslave/audiocd/plugins/wav/encodercda.h deleted file mode 100644 index bb1297c7..00000000 --- a/kioslave/audiocd/plugins/wav/encodercda.h +++ /dev/null @@ -1,61 +0,0 @@ -/* - Copyright (C) 2000 Rik Hemsley (rikkus) - Copyright (C) 2000, 2001, 2002 Michael Matz - Copyright (C) 2001 Carsten Duvenhorst - Copyright (C) 2001 Adrian Schroeter - Copyright (C) 2003 Richard Lärkäng - Copyright (C) 2003 Scott Wheeler - Copyright (C) 2004, 2005 Benjamin Meyer - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -*/ - -#ifndef ENCODER_CDA_H -#define ENCODER_CDA_H - -#include -#include -#include -#include - -/** - * Raw cd "encoder" - * Does little more then copy the data and make sure it is in the right - * endian. - */ -class EncoderCda : public AudioCDEncoder { - -public: - EncoderCda(TDEIO::SlaveBase *slave) : AudioCDEncoder(slave) {}; - ~EncoderCda(){}; - virtual bool init(){ return true; }; - virtual void loadSettings(){}; - virtual unsigned long size(long time_secs) const; - virtual TQString type() const { return "CDA"; }; - virtual const char * mimeType() const; - virtual const char * fileType() const { return "cda"; }; - virtual void fillSongInfo( KCDDB::CDInfo, int, const TQString &){}; - virtual long readInit(long){ return 0; }; - virtual long read(int16_t * buf, int frames); - virtual long readCleanup(){ return 0; }; - -private: - class Private; - Private * d; - -}; - -#endif // ENCODER_CDA_H - diff --git a/kioslave/audiocd/plugins/wav/encoderwav.cpp b/kioslave/audiocd/plugins/wav/encoderwav.cpp deleted file mode 100644 index 84a8586b..00000000 --- a/kioslave/audiocd/plugins/wav/encoderwav.cpp +++ /dev/null @@ -1,85 +0,0 @@ -/* - Copyright (C) 2000 Rik Hemsley (rikkus) - Copyright (C) 2000, 2001, 2002 Michael Matz - Copyright (C) 2001 Carsten Duvenhorst - Copyright (C) 2001 Adrian Schroeter - Copyright (C) 2003 Richard Lärkäng - Copyright (C) 2003 Scott Wheeler - Copyright (C) 2004, 2005 Benjamin Meyer - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -*/ - -#include "encoderwav.h" - -extern "C" -{ - KDE_EXPORT void create_audiocd_encoders(TDEIO::SlaveBase *slave, TQPtrList &encoders) - { - encoders.append( new EncoderWav(slave)); - encoders.append( new EncoderCda(slave)); - } -} - -class EncoderWav::Private -{ - public: - -}; - -unsigned long EncoderWav::size(long time_secs) const { - return (EncoderCda::size(time_secs) + 44); -} - -const char * EncoderWav::mimeType() const { - return "audio/x-wav"; -} - -long EncoderWav::readInit(long byteCount){ - static char riffHeader[] = - { - 0x52, 0x49, 0x46, 0x46, // 0 "AIFF" - 0x00, 0x00, 0x00, 0x00, // 4 wavSize - 0x57, 0x41, 0x56, 0x45, // 8 "WAVE" - 0x66, 0x6d, 0x74, 0x20, // 12 "fmt " - 0x10, 0x00, 0x00, 0x00, // 16 - 0x01, 0x00, 0x02, 0x00, // 20 - 0x44, 0xac, 0x00, 0x00, // 24 - 0x10, 0xb1, 0x02, 0x00, // 28 - 0x04, 0x00, 0x10, 0x00, // 32 - 0x64, 0x61, 0x74, 0x61, // 36 "data" - 0x00, 0x00, 0x00, 0x00 // 40 byteCount - }; - - TQ_INT32 wavSize(byteCount + 44 - 8); - - - riffHeader[4] = (wavSize >> 0 ) & 0xff; - riffHeader[5] = (wavSize >> 8 ) & 0xff; - riffHeader[6] = (wavSize >> 16) & 0xff; - riffHeader[7] = (wavSize >> 24) & 0xff; - - riffHeader[40] = (byteCount >> 0 ) & 0xff; - riffHeader[41] = (byteCount >> 8 ) & 0xff; - riffHeader[42] = (byteCount >> 16) & 0xff; - riffHeader[43] = (byteCount >> 24) & 0xff; - - TQByteArray output; - output.setRawData(riffHeader, 44); - ioslave->data(output); - output.resetRawData(riffHeader, 44); - return 44; -} - diff --git a/kioslave/audiocd/plugins/wav/encoderwav.h b/kioslave/audiocd/plugins/wav/encoderwav.h deleted file mode 100644 index 154236f2..00000000 --- a/kioslave/audiocd/plugins/wav/encoderwav.h +++ /dev/null @@ -1,56 +0,0 @@ -/* - Copyright (C) 2000 Rik Hemsley (rikkus) - Copyright (C) 2000, 2001, 2002 Michael Matz - Copyright (C) 2001 Carsten Duvenhorst - Copyright (C) 2001 Adrian Schroeter - Copyright (C) 2003 Richard Lärkäng - Copyright (C) 2003 Scott Wheeler - Copyright (C) 2004, 2005 Benjamin Meyer - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -*/ - -#ifndef ENCODER_WAV_H -#define ENCODER_WAV_H - -#include "encodercda.h" -#include -#include -#include - -/** - * Wav audio "encoder" - * Takes the CDA take and adds the standard wav header. - */ -class EncoderWav : public EncoderCda { - -public: - EncoderWav(TDEIO::SlaveBase *slave) : EncoderCda(slave) {}; - ~EncoderWav(){}; - virtual bool init(){ return true; }; - virtual unsigned long size(long time_secs) const; - virtual TQString type() const { return "Wav"; }; - virtual const char * fileType() const { return "wav"; }; - virtual const char * mimeType() const; - virtual void fillSongInfo( KCDDB::CDInfo, int, const TQString &){}; - virtual long readInit(long size); - -private: - class Private; - Private * d; - -}; - -#endif // ENCODER_WAV_H diff --git a/kioslave/audiocd/upgrade-metadata.sh b/kioslave/audiocd/upgrade-metadata.sh deleted file mode 100755 index 000323b1..00000000 --- a/kioslave/audiocd/upgrade-metadata.sh +++ /dev/null @@ -1,28 +0,0 @@ -#! /usr/bin/env bash - -while read; do - if [ "${REPLY#\[}" != "$REPLY" ] ; then # group name - GROUP="${REPLY:1:${#REPLY}-2}" - continue; - fi - # normal key=value pair: - KEY="${REPLY%%=*}" - VALUE="${REPLY#*=}" - - case "$GROUP/$KEY" in - FileName/file_name_template) - # - # Swap - # - VALUE=`echo $VALUE | sed -e s/%a/%{albumtitle}/g`; - VALUE=`echo $VALUE | sed -e s/%t/%{title}/g`; - VALUE=`echo $VALUE | sed -e s/%n/%{number}/g`; - VALUE=`echo $VALUE | sed -e s/%g/%{genre}/g`; - VALUE=`echo $VALUE | sed -e s/%y/%{year}/g`; - VALUE=`echo $VALUE | sed -e s/%A/%{albumartist}/g`; - echo "[FileName]"; - echo "file_name_template=$VALUE" - echo "# DELETE [FileName]file_name_template" - ;; - esac -done diff --git a/kmix/kmix.cpp b/kmix/kmix.cpp index a9fb11d0..f583c352 100644 --- a/kmix/kmix.cpp +++ b/kmix/kmix.cpp @@ -35,7 +35,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/kmix/kmixapplet.cpp b/kmix/kmixapplet.cpp index 0af64588..c93f8ae9 100644 --- a/kmix/kmixapplet.cpp +++ b/kmix/kmixapplet.cpp @@ -41,7 +41,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/kmix/kmixctrl.cpp b/kmix/kmixctrl.cpp index 334dea71..ee7b8728 100644 --- a/kmix/kmixctrl.cpp +++ b/kmix/kmixctrl.cpp @@ -25,7 +25,7 @@ #include #include #include -#include +#include #include #include diff --git a/kmix/kmixerwidget.cpp b/kmix/kmixerwidget.cpp index 4d4ae7ee..fec74d5b 100644 --- a/kmix/kmixerwidget.cpp +++ b/kmix/kmixerwidget.cpp @@ -28,7 +28,7 @@ #include // for TQApplication::revsreseLayout() // KDE -#include +#include #include #include #include diff --git a/kmix/mdwenum.cpp b/kmix/mdwenum.cpp index e5504534..d4381b04 100644 --- a/kmix/mdwenum.cpp +++ b/kmix/mdwenum.cpp @@ -26,7 +26,7 @@ #include #include -#include +#include #include #include #include diff --git a/kmix/mdwslider.cpp b/kmix/mdwslider.cpp index f2ff1b1f..7664811d 100644 --- a/kmix/mdwslider.cpp +++ b/kmix/mdwslider.cpp @@ -22,7 +22,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/kmix/mdwswitch.cpp b/kmix/mdwswitch.cpp index 6fe1aeb4..5c931048 100644 --- a/kmix/mdwswitch.cpp +++ b/kmix/mdwswitch.cpp @@ -27,7 +27,7 @@ #include #include -#include +#include #include #include #include diff --git a/kmix/mixdevice.h b/kmix/mixdevice.h index 33ef0d1b..cc048a62 100644 --- a/kmix/mixdevice.h +++ b/kmix/mixdevice.h @@ -3,7 +3,7 @@ #include "volume.h" #include -#include +#include #include #include diff --git a/kmix/mixdevicewidget.cpp b/kmix/mixdevicewidget.cpp index 9096c2c0..19b20514 100644 --- a/kmix/mixdevicewidget.cpp +++ b/kmix/mixdevicewidget.cpp @@ -22,7 +22,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/kmix/mixer.cpp b/kmix/mixer.cpp index 99fd84b0..fc5a06f6 100644 --- a/kmix/mixer.cpp +++ b/kmix/mixer.cpp @@ -23,7 +23,7 @@ #include #include -#include +#include #include #include #include diff --git a/kmix/mixset.cpp b/kmix/mixset.cpp index 8f4ba438..18e7fe7c 100644 --- a/kmix/mixset.cpp +++ b/kmix/mixset.cpp @@ -23,7 +23,7 @@ #include #include -#include +#include #include "mixdevice.h" #include "mixset.h" diff --git a/krec/krecconfig_files.cpp b/krec/krecconfig_files.cpp index 469b269f..36f7d3b3 100644 --- a/krec/krecconfig_files.cpp +++ b/krec/krecconfig_files.cpp @@ -25,7 +25,7 @@ #include #include #include -#include +#include #include typedef KGenericFactory KRecConfigFilesFactory; diff --git a/krec/krecconfig_fileswidget.cpp b/krec/krecconfig_fileswidget.cpp index 206eda1b..96340ed3 100644 --- a/krec/krecconfig_fileswidget.cpp +++ b/krec/krecconfig_fileswidget.cpp @@ -22,7 +22,7 @@ #include #include #include -#include +#include #include #include diff --git a/krec/krecconfigure.cpp b/krec/krecconfigure.cpp index 633409f5..5db92218 100644 --- a/krec/krecconfigure.cpp +++ b/krec/krecconfigure.cpp @@ -26,7 +26,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/krec/krecfile.cpp b/krec/krecfile.cpp index 27975cdf..bee2f733 100644 --- a/krec/krecfile.cpp +++ b/krec/krecfile.cpp @@ -23,7 +23,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/krec/krecglobal.cpp b/krec/krecglobal.cpp index 984048d2..a1c9c44c 100644 --- a/krec/krecglobal.cpp +++ b/krec/krecglobal.cpp @@ -16,7 +16,7 @@ #include "krecexport_template.h" -#include +#include #include #include #include @@ -51,7 +51,7 @@ KRecGlobal* KRecGlobal::the() { void KRecGlobal::setMainWidget( TQWidget* n ) { _qwidget = n; } TQWidget* KRecGlobal::mainWidget() { return _qwidget; } -TDEConfig* KRecGlobal::kconfig() { return kapp->config(); } +TDEConfig* KRecGlobal::tdeconfig() { return kapp->config(); } void KRecGlobal::setStatusBar( KStatusBar *bar ) { _statusbar = bar; } void KRecGlobal::message( const TQString &text ) { if ( _statusbar ) _statusbar->message( text, 2000 ); } diff --git a/krec/krecglobal.h b/krec/krecglobal.h index 06615d8d..e0733022 100644 --- a/krec/krecglobal.h +++ b/krec/krecglobal.h @@ -51,7 +51,7 @@ public: TQWidget* mainWidget(); /// @return kapp->config() - static TDEConfig* kconfig(); + static TDEConfig* tdeconfig(); /// Sets the Statusbar. void setStatusBar( KStatusBar* ); diff --git a/krec/krecnewproperties.cpp b/krec/krecnewproperties.cpp index a5cdc07b..fc713a1a 100644 --- a/krec/krecnewproperties.cpp +++ b/krec/krecnewproperties.cpp @@ -17,7 +17,7 @@ #include "krecglobal.h" #include "krecconfig_fileswidget.h" -#include +#include #include #include #include @@ -39,7 +39,7 @@ KRecNewProperties::KRecNewProperties( TQWidget* p, const char* n ) , _samplerate( 44100 ), _channels( 2 ), _bits( 16 ) { kdDebug( 60005 ) << k_funcinfo << endl; - TDEConfig *config = KRecGlobal::kconfig(); + TDEConfig *config = KRecGlobal::tdeconfig(); config->setGroup( "FileDefaults" ); _samplerate = config->readNumEntry( "SamplingRate", 44100 ); _channels = config->readNumEntry( "Channels", 2 ); @@ -91,8 +91,8 @@ void KRecNewProperties::channelschanged( int channels ) { _channels = channels; void KRecNewProperties::bitschanged( int bits ) { _bits = bits; } void KRecNewProperties::usedefaultschanged( bool n ) { _usedefaults = n; - KRecGlobal::kconfig()->setGroup( "FileDefaults" ); - KRecGlobal::kconfig()->writeEntry( "UseDefaults", _usedefaults ); + KRecGlobal::tdeconfig()->setGroup( "FileDefaults" ); + KRecGlobal::tdeconfig()->writeEntry( "UseDefaults", _usedefaults ); } void KRecNewProperties::done( int r ) { diff --git a/krec/krecord.cpp b/krec/krecord.cpp index 538957c5..164a38df 100644 --- a/krec/krecord.cpp +++ b/krec/krecord.cpp @@ -25,13 +25,13 @@ #include #include -#include +#include #include #include #include #include #include -#include +#include #include #include #include @@ -359,7 +359,7 @@ KRecord::~KRecord(){ d->volumecontrol = Arts::StereoVolumeControl::null(); if( d->b_comp ) d->comp = Arts::StereoEffect::null(); - KRecGlobal::kconfig()->sync(); + KRecGlobal::tdeconfig()->sync(); delete d; kdDebug( 60005 ) << k_funcinfo << "done. Bye!" << endl; } diff --git a/krec/mp3_export/krecexport_mp3.cpp b/krec/mp3_export/krecexport_mp3.cpp index 7ec27e52..312a91e0 100644 --- a/krec/mp3_export/krecexport_mp3.cpp +++ b/krec/mp3_export/krecexport_mp3.cpp @@ -25,7 +25,7 @@ #include #include #include -#include +#include #include // Error code definitions from lame.h @@ -155,7 +155,7 @@ kdDebug( 60005 ) << k_funcinfo << endl; } else return false; } -// Derived from tdemultimedia/kioslave/audiocd/audiocd.cpp. +// Derived from tdemultimedia/tdeioslave/audiocd/audiocd.cpp. // We use the encoding settings from kcmaudiocd. void KRecExport_MP3::setLameParameters() { TDEConfig *config; diff --git a/krec/ogg_export/krecexport_ogg.cpp b/krec/ogg_export/krecexport_ogg.cpp index e7e9c4dc..f8bc9799 100644 --- a/krec/ogg_export/krecexport_ogg.cpp +++ b/krec/ogg_export/krecexport_ogg.cpp @@ -24,7 +24,7 @@ #include #include #include -#include +#include #include #include #include @@ -191,7 +191,7 @@ kdDebug( 60005 ) << k_funcinfo << endl; } -// Derived from tdemultimedia/kioslave/audiocd/audiocd.cpp. +// Derived from tdemultimedia/tdeioslave/audiocd/audiocd.cpp. // We use the encoding settings from kcmaudiocd. void KRecExport_OGG::setOggParameters() { kdDebug( 60005 ) << k_funcinfo << endl; diff --git a/kscd/kscd.cpp b/kscd/kscd.cpp index a0cc59c6..7781601f 100644 --- a/kscd/kscd.cpp +++ b/kscd/kscd.cpp @@ -39,7 +39,7 @@ #include #include #include -#include +#include #include #include #include @@ -61,7 +61,7 @@ #include #include #include -#include +#include #include "docking.h" #include "kscd.h" diff --git a/kscd/kscd.h b/kscd/kscd.h index 01c6e163..fc1ab6ef 100644 --- a/kscd/kscd.h +++ b/kscd/kscd.h @@ -53,7 +53,7 @@ class KCompactDisc; #include "prefs.h" #include "configWidget.h" #include -#include +#include #include #include #include diff --git a/kscd/prefs.kcfgc b/kscd/prefs.kcfgc index 89d94319..7cc1efb9 100644 --- a/kscd/prefs.kcfgc +++ b/kscd/prefs.kcfgc @@ -1,4 +1,4 @@ -# Code generation options for kconfig_compiler +# Code generation options for tdeconfig_compiler File=kscd.kcfg ClassName=Prefs Singleton=true diff --git a/libkcddb/asynchttplookup.cpp b/libkcddb/asynchttplookup.cpp index e46df657..5bcf1f76 100644 --- a/libkcddb/asynchttplookup.cpp +++ b/libkcddb/asynchttplookup.cpp @@ -22,7 +22,7 @@ #include #include -#include +#include #include "asynchttplookup.h" diff --git a/libkcddb/asynchttpsubmit.cpp b/libkcddb/asynchttpsubmit.cpp index 6caf2bf4..246e5804 100644 --- a/libkcddb/asynchttpsubmit.cpp +++ b/libkcddb/asynchttpsubmit.cpp @@ -18,7 +18,7 @@ */ #include "asynchttpsubmit.h" -#include +#include #include namespace KCDDB diff --git a/libkcddb/asyncsmtpsubmit.h b/libkcddb/asyncsmtpsubmit.h index aebf53a9..17351497 100644 --- a/libkcddb/asyncsmtpsubmit.h +++ b/libkcddb/asyncsmtpsubmit.h @@ -20,7 +20,7 @@ */ #include "smtpsubmit.h" -#include +#include namespace KCDDB { diff --git a/libkcddb/httplookup.cpp b/libkcddb/httplookup.cpp index 461a9334..af785854 100644 --- a/libkcddb/httplookup.cpp +++ b/libkcddb/httplookup.cpp @@ -19,7 +19,7 @@ Boston, MA 02110-1301, USA. */ -#include +#include #include #include "httplookup.h" diff --git a/libkcddb/httpsubmit.cpp b/libkcddb/httpsubmit.cpp index d42d5a3d..5acde285 100644 --- a/libkcddb/httpsubmit.cpp +++ b/libkcddb/httpsubmit.cpp @@ -19,7 +19,7 @@ */ #include "httpsubmit.h" #include -#include +#include namespace KCDDB { diff --git a/libkcddb/kcmcddb/Makefile.am b/libkcddb/kcmcddb/Makefile.am index 8233116d..3a93445f 100644 --- a/libkcddb/kcmcddb/Makefile.am +++ b/libkcddb/kcmcddb/Makefile.am @@ -19,5 +19,5 @@ xdg_apps_DATA = libkcddb.desktop messages: rc.cpp $(XGETTEXT) *.cpp -o $(podir)/kcmcddb.pot -updatedir = $(kde_datadir)/kconf_update +updatedir = $(kde_datadir)/tdeconf_update update_DATA = kcmcddb-emailsettings.upd diff --git a/libkcddb/kcmcddb/cddbconfigwidget.cpp b/libkcddb/kcmcddb/cddbconfigwidget.cpp index 442efd12..a693d22f 100644 --- a/libkcddb/kcmcddb/cddbconfigwidget.cpp +++ b/libkcddb/kcmcddb/cddbconfigwidget.cpp @@ -27,7 +27,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/libkcddb/kcmcddb/kcmcddb.cpp b/libkcddb/kcmcddb/kcmcddb.cpp index 75dd8501..8ce6a6dd 100644 --- a/libkcddb/kcmcddb/kcmcddb.cpp +++ b/libkcddb/kcmcddb/kcmcddb.cpp @@ -28,12 +28,12 @@ #include #include -#include +#include #include #include #include #include -#include +#include #include "cddbconfigwidget.h" diff --git a/libkcddb/kcmcddb/libkcddb.desktop b/libkcddb/kcmcddb/libkcddb.desktop index a2c2a5da..fb0163ad 100644 --- a/libkcddb/kcmcddb/libkcddb.desktop +++ b/libkcddb/kcmcddb/libkcddb.desktop @@ -1,5 +1,5 @@ [Desktop Entry] -Exec=kcmshell libkcddb +Exec=tdecmshell libkcddb Icon=cdaudio_unmount Type=Application X-TDE-ModuleType=Library diff --git a/libkcddb/sites.cpp b/libkcddb/sites.cpp index a031c949..56cc5eb6 100644 --- a/libkcddb/sites.cpp +++ b/libkcddb/sites.cpp @@ -19,7 +19,7 @@ #include "sites.h" #include -#include +#include #include #include #include diff --git a/libkcddb/smtpsubmit.cpp b/libkcddb/smtpsubmit.cpp index ed4e7357..2341f256 100644 --- a/libkcddb/smtpsubmit.cpp +++ b/libkcddb/smtpsubmit.cpp @@ -19,7 +19,7 @@ #include "smtpsubmit.h" #include -#include +#include namespace KCDDB { diff --git a/libkcddb/synchttplookup.cpp b/libkcddb/synchttplookup.cpp index c50618e1..42c45aba 100644 --- a/libkcddb/synchttplookup.cpp +++ b/libkcddb/synchttplookup.cpp @@ -22,8 +22,8 @@ #include #include -#include -#include +#include +#include #include "synchttplookup.h" diff --git a/libkcddb/synchttpsubmit.cpp b/libkcddb/synchttpsubmit.cpp index 7920fce2..271367da 100644 --- a/libkcddb/synchttpsubmit.cpp +++ b/libkcddb/synchttpsubmit.cpp @@ -18,8 +18,8 @@ */ #include "synchttpsubmit.h" -#include -#include +#include +#include namespace KCDDB { diff --git a/libkcddb/syncsmtpsubmit.cpp b/libkcddb/syncsmtpsubmit.cpp index 002c3304..f875e2ef 100644 --- a/libkcddb/syncsmtpsubmit.cpp +++ b/libkcddb/syncsmtpsubmit.cpp @@ -19,8 +19,8 @@ #include "syncsmtpsubmit.h" #include "cdinfo.h" -#include -#include +#include +#include namespace KCDDB { diff --git a/noatun/Makefile.am b/noatun/Makefile.am index 91b80b87..032bdf3d 100644 --- a/noatun/Makefile.am +++ b/noatun/Makefile.am @@ -1,4 +1,4 @@ -INCLUDES = -I$(kde_includes)/kio -I$(top_srcdir)/noatun/library -I$(kde_includes)/arts $(all_includes) +INCLUDES = -I$(kde_includes)/tdeio -I$(top_srcdir)/noatun/library -I$(kde_includes)/arts $(all_includes) SUBDIRS = pics library app . modules @@ -9,11 +9,11 @@ xdg_apps_DATA = noatun.desktop presetsdir = $(kde_datadir)/noatun/eq.preset presets_DATA = preset.dance preset.jazz preset.metal preset.trance preset.zero -updatedir = $(kde_datadir)/kconf_update +updatedir = $(kde_datadir)/tdeconf_update update_DATA = noatun.upd -kconfdir = $(libdir)/kconf_update_bin -kconf_PROGRAMS = noatun20update +tdeconfdir = $(libdir)/tdeconf_update_bin +tdeconf_PROGRAMS = noatun20update noatun20update_SOURCES = noatun20update.cpp noatun20update_LDFLAGS = $(all_libraries) $(KDE_RPATH) $(LIB_QT) -lDCOP $(LIB_TDECORE) $(LIB_TDEUI) -ltdefx $(LIB_KIO) -ltdetexteditor diff --git a/noatun/library/app.cpp b/noatun/library/app.cpp index 0e1ae639..29478e7b 100644 --- a/noatun/library/app.cpp +++ b/noatun/library/app.cpp @@ -20,9 +20,9 @@ #include #include #include -#include +#include #include -#include +#include #include #include #include diff --git a/noatun/library/cmodule.cpp b/noatun/library/cmodule.cpp index 27f4fa99..9c3d3232 100644 --- a/noatun/library/cmodule.cpp +++ b/noatun/library/cmodule.cpp @@ -15,7 +15,7 @@ #include #include #include -#include +#include #include #include diff --git a/noatun/library/downloader.cpp b/noatun/library/downloader.cpp index e1e210cb..75653940 100644 --- a/noatun/library/downloader.cpp +++ b/noatun/library/downloader.cpp @@ -3,7 +3,7 @@ #include #include #include -#include +#include #include DownloadItem::DownloadItem() diff --git a/noatun/library/engine.cpp b/noatun/library/engine.cpp index 86c10381..e7296191 100644 --- a/noatun/library/engine.cpp +++ b/noatun/library/engine.cpp @@ -12,7 +12,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/noatun/library/equalizer.cpp b/noatun/library/equalizer.cpp index ae86d00f..1c50370c 100644 --- a/noatun/library/equalizer.cpp +++ b/noatun/library/equalizer.cpp @@ -9,11 +9,11 @@ #include #include #include -#include +#include #include #include #include -#include +#include #include #include "ksaver.h" diff --git a/noatun/library/ksaver.cpp b/noatun/library/ksaver.cpp index f787c585..72b6218e 100644 --- a/noatun/library/ksaver.cpp +++ b/noatun/library/ksaver.cpp @@ -29,7 +29,7 @@ #include #include -#include +#include #include "ksaver.h" diff --git a/noatun/library/noatuntags/tags.cpp b/noatun/library/noatuntags/tags.cpp index add75782..9125ff45 100644 --- a/noatun/library/noatuntags/tags.cpp +++ b/noatun/library/noatuntags/tags.cpp @@ -3,7 +3,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/noatun/library/playlist.cpp b/noatun/library/playlist.cpp index 1bc031d9..8f81c3e8 100644 --- a/noatun/library/playlist.cpp +++ b/noatun/library/playlist.cpp @@ -5,7 +5,7 @@ #include #include -#include +#include #include #include #include diff --git a/noatun/library/playlistsaver.cpp b/noatun/library/playlistsaver.cpp index 49c6084b..a187b235 100644 --- a/noatun/library/playlistsaver.cpp +++ b/noatun/library/playlistsaver.cpp @@ -1,6 +1,6 @@ #include #include -#include +#include #include #include #include diff --git a/noatun/library/vequalizer.cpp b/noatun/library/vequalizer.cpp index 08895643..7b88848a 100644 --- a/noatun/library/vequalizer.cpp +++ b/noatun/library/vequalizer.cpp @@ -51,9 +51,9 @@ #include #include -#include +#include #include -#include +#include #include #include diff --git a/noatun/modules/excellent/userinterface.cpp b/noatun/modules/excellent/userinterface.cpp index 42eaf19c..f1f64a22 100644 --- a/noatun/modules/excellent/userinterface.cpp +++ b/noatun/modules/excellent/userinterface.cpp @@ -37,8 +37,8 @@ #include "userinterface.h" #include -#include -#include +#include +#include #include #include #include diff --git a/noatun/modules/htmlexport/htmlexport.h b/noatun/modules/htmlexport/htmlexport.h index 9e710547..304092fb 100644 --- a/noatun/modules/htmlexport/htmlexport.h +++ b/noatun/modules/htmlexport/htmlexport.h @@ -15,11 +15,11 @@ #include #include -#include +#include #include #include -#include -#include +#include +#include #include //#include diff --git a/noatun/modules/infrared/irprefs.cpp b/noatun/modules/infrared/irprefs.cpp index 77753cf4..36d6a8fb 100644 --- a/noatun/modules/infrared/irprefs.cpp +++ b/noatun/modules/infrared/irprefs.cpp @@ -6,7 +6,7 @@ #include #include -#include +#include #include #include #include diff --git a/noatun/modules/kaiman/pref.cpp b/noatun/modules/kaiman/pref.cpp index a53ed72f..249a74e4 100644 --- a/noatun/modules/kaiman/pref.cpp +++ b/noatun/modules/kaiman/pref.cpp @@ -25,7 +25,7 @@ #include #include #include -#include +#include #include "pref.h" #include "userinterface.h" diff --git a/noatun/modules/kaiman/userinterface.cpp b/noatun/modules/kaiman/userinterface.cpp index 462f5718..56eb389e 100644 --- a/noatun/modules/kaiman/userinterface.cpp +++ b/noatun/modules/kaiman/userinterface.cpp @@ -38,17 +38,17 @@ #include #include -#include +#include #include #include #include #include #include -#include +#include #include #include #include -#include +#include #include #include diff --git a/noatun/modules/kjofol-skin/Makefile.am b/noatun/modules/kjofol-skin/Makefile.am index 17ff1162..f3e9504a 100644 --- a/noatun/modules/kjofol-skin/Makefile.am +++ b/noatun/modules/kjofol-skin/Makefile.am @@ -7,7 +7,7 @@ INCLUDES = -I$(top_srcdir)/noatun/library \ -I$(top_builddir)/arts/modules/effects \ -I$(top_builddir)/arts/modules/mixers \ -I$(top_builddir)/arts/gui/common \ - -I$(kde_includes)/kio \ + -I$(kde_includes)/tdeio \ -I$(kde_includes)/arts \ $(all_includes) diff --git a/noatun/modules/kjofol-skin/kjbutton.cpp b/noatun/modules/kjofol-skin/kjbutton.cpp index 795dedfb..7cdfc0e2 100644 --- a/noatun/modules/kjofol-skin/kjbutton.cpp +++ b/noatun/modules/kjofol-skin/kjbutton.cpp @@ -22,7 +22,7 @@ #include #include #include -#include +#include #include #include diff --git a/noatun/modules/kjofol-skin/kjloader.cpp b/noatun/modules/kjofol-skin/kjloader.cpp index 4401ee01..ee8ca247 100644 --- a/noatun/modules/kjofol-skin/kjloader.cpp +++ b/noatun/modules/kjofol-skin/kjloader.cpp @@ -54,7 +54,7 @@ #include #include -#include +#include #include #include #include diff --git a/noatun/modules/kjofol-skin/kjprefs.cpp b/noatun/modules/kjofol-skin/kjprefs.cpp index b6d8e6eb..d93cc5dc 100644 --- a/noatun/modules/kjofol-skin/kjprefs.cpp +++ b/noatun/modules/kjofol-skin/kjprefs.cpp @@ -29,10 +29,10 @@ #include #include -#include +#include #include #include -#include +#include #include #include #include diff --git a/noatun/modules/kjofol-skin/kjprefs.h b/noatun/modules/kjofol-skin/kjprefs.h index 0bb4540d..e5181963 100644 --- a/noatun/modules/kjofol-skin/kjprefs.h +++ b/noatun/modules/kjofol-skin/kjprefs.h @@ -9,7 +9,7 @@ #include #include -#include +#include #include class TQVBoxLayout; diff --git a/noatun/modules/kjofol-skin/kjvis.cpp b/noatun/modules/kjofol-skin/kjvis.cpp index 7ae04d44..527fb673 100644 --- a/noatun/modules/kjofol-skin/kjvis.cpp +++ b/noatun/modules/kjofol-skin/kjvis.cpp @@ -19,7 +19,7 @@ //kde includes #include #include -#include +#include #include #include diff --git a/noatun/modules/marquis/marquis.cpp b/noatun/modules/marquis/marquis.cpp index 62c959ac..e3faf8b1 100644 --- a/noatun/modules/marquis/marquis.cpp +++ b/noatun/modules/marquis/marquis.cpp @@ -27,7 +27,7 @@ #include #endif -#include +#include #include #include #include diff --git a/noatun/modules/metatag/edit.cpp b/noatun/modules/metatag/edit.cpp index 6e37347c..6f16a4b3 100644 --- a/noatun/modules/metatag/edit.cpp +++ b/noatun/modules/metatag/edit.cpp @@ -17,7 +17,7 @@ #include #include #include -#include +#include #include #include "metatag.h" diff --git a/noatun/modules/metatag/metatag.cpp b/noatun/modules/metatag/metatag.cpp index 1ec54cbf..5ffa1e6a 100644 --- a/noatun/modules/metatag/metatag.cpp +++ b/noatun/modules/metatag/metatag.cpp @@ -16,11 +16,11 @@ #include #include #include -#include +#include #include #include #include -#include +#include extern "C" { diff --git a/noatun/modules/noatunui/userinterface.cpp b/noatun/modules/noatunui/userinterface.cpp index d3c6de0f..9173867e 100644 --- a/noatun/modules/noatunui/userinterface.cpp +++ b/noatun/modules/noatunui/userinterface.cpp @@ -25,8 +25,8 @@ #include #include #include -#include -#include +#include +#include MilkChocolate::MilkChocolate() : TQWidget(0,"NoatunUI"), UserInterface() { diff --git a/noatun/modules/simple/userinterface.cpp b/noatun/modules/simple/userinterface.cpp index d76f3b54..4cda6fe0 100644 --- a/noatun/modules/simple/userinterface.cpp +++ b/noatun/modules/simple/userinterface.cpp @@ -17,7 +17,7 @@ #include #include -#include +#include #include #include #include diff --git a/noatun/modules/splitplaylist/view.cpp b/noatun/modules/splitplaylist/view.cpp index 50245140..cce64897 100644 --- a/noatun/modules/splitplaylist/view.cpp +++ b/noatun/modules/splitplaylist/view.cpp @@ -20,10 +20,10 @@ #include #include -#include -#include -#include -#include +#include +#include +#include +#include #include #include #include diff --git a/noatun/modules/splitplaylist/view.h b/noatun/modules/splitplaylist/view.h index 48a30df5..48a0be67 100644 --- a/noatun/modules/splitplaylist/view.h +++ b/noatun/modules/splitplaylist/view.h @@ -7,7 +7,7 @@ #include #include #include -#include +#include #include class Finder; diff --git a/noatun/modules/systray/systray.cpp b/noatun/modules/systray/systray.cpp index 0788ceb3..27976429 100644 --- a/noatun/modules/systray/systray.cpp +++ b/noatun/modules/systray/systray.cpp @@ -39,7 +39,7 @@ #include #include -#include +#include #include #include #include @@ -56,7 +56,7 @@ #include #include -#include +#include #include #include diff --git a/noatun/modules/systray/yhconfig.kcfgc b/noatun/modules/systray/yhconfig.kcfgc index 5b4f99e4..8b35e4f7 100644 --- a/noatun/modules/systray/yhconfig.kcfgc +++ b/noatun/modules/systray/yhconfig.kcfgc @@ -1,4 +1,4 @@ -# Code generation options for kconfig_compiler +# Code generation options for tdeconfig_compiler File=yhconfig.kcfg ClassName=YHConfig Singleton=true diff --git a/noatun/modules/voiceprint/prefs.cpp b/noatun/modules/voiceprint/prefs.cpp index 882c05a4..e80de081 100644 --- a/noatun/modules/voiceprint/prefs.cpp +++ b/noatun/modules/voiceprint/prefs.cpp @@ -6,7 +6,7 @@ #include #include #include -#include +#include Prefs::Prefs(TQObject* parent) : CModule(i18n("Voiceprint"), i18n("Options for the Voiceprint Visualization"), "xapp", parent) diff --git a/noatun/modules/winskin/fileInfo.cpp b/noatun/modules/winskin/fileInfo.cpp index 6e721cd9..5cd2779f 100644 --- a/noatun/modules/winskin/fileInfo.cpp +++ b/noatun/modules/winskin/fileInfo.cpp @@ -2,7 +2,7 @@ #include #include -#include +#include #include "fileInfo.h" diff --git a/noatun/modules/winskin/guiSpectrumAnalyser.cpp b/noatun/modules/winskin/guiSpectrumAnalyser.cpp index d0447397..0d2978ee 100644 --- a/noatun/modules/winskin/guiSpectrumAnalyser.cpp +++ b/noatun/modules/winskin/guiSpectrumAnalyser.cpp @@ -15,7 +15,7 @@ #include #include #include -#include +#include #include "waColor.h" #include "waSkinModel.h" diff --git a/noatun/modules/winskin/waDigit.cpp b/noatun/modules/winskin/waDigit.cpp index d18d9ead..75a89b7e 100644 --- a/noatun/modules/winskin/waDigit.cpp +++ b/noatun/modules/winskin/waDigit.cpp @@ -15,7 +15,7 @@ #include "waDigit.h" #include "waSkinModel.h" -#include +#include #include WaDigit::WaDigit() : WaWidget(_WA_MAPPING_DIGITS) diff --git a/noatun/modules/winskin/waInfo.cpp b/noatun/modules/winskin/waInfo.cpp index 80375a90..b17c308d 100644 --- a/noatun/modules/winskin/waInfo.cpp +++ b/noatun/modules/winskin/waInfo.cpp @@ -17,7 +17,7 @@ #include -#include +#include #include #include "waInfo.h" diff --git a/noatun/modules/winskin/waSkin.cpp b/noatun/modules/winskin/waSkin.cpp index 4512d067..06b9c010 100644 --- a/noatun/modules/winskin/waSkin.cpp +++ b/noatun/modules/winskin/waSkin.cpp @@ -11,7 +11,7 @@ */ -#include +#include #include #include #include diff --git a/noatun/modules/winskin/waSkinManager.cpp b/noatun/modules/winskin/waSkinManager.cpp index f7d9b777..8230feba 100644 --- a/noatun/modules/winskin/waSkinManager.cpp +++ b/noatun/modules/winskin/waSkinManager.cpp @@ -5,9 +5,9 @@ #include #include #include -#include +#include #include -#include +#include #include #include "waSkinManager.h" diff --git a/noatun/modules/winskin/winSkinConfig.cpp b/noatun/modules/winskin/winSkinConfig.cpp index 7d2c866d..667cf81f 100644 --- a/noatun/modules/winskin/winSkinConfig.cpp +++ b/noatun/modules/winskin/winSkinConfig.cpp @@ -6,12 +6,12 @@ #include #include #include -#include +#include #include #include #include -#include -#include +#include +#include #include #include #include diff --git a/tdefile-plugins/Makefile.am b/tdefile-plugins/Makefile.am new file mode 100644 index 00000000..fc127f02 --- /dev/null +++ b/tdefile-plugins/Makefile.am @@ -0,0 +1,22 @@ +if include_ogg_SUBDIR +KFILE_OGG_SUBDIR=ogg +endif + +if include_flac_SUBDIR +KFILE_FLAC_SUBDIR=flac +endif + +if include_mp3_SUBDIR +KFILE_MP3_SUBDIR=mp3 +endif + +if include_mpc_SUBDIR +KFILE_MPC_SUBDIR=mpc +endif + +if include_theora_SUBDIR +KFILE_THEORA_SUBDIR=theora +endif + +SUBDIRS=m3u $(KFILE_MP3_SUBDIR) $(KFILE_MPC_SUBDIR) au avi mpeg wav sid $(KFILE_OGG_SUBDIR) \ + $(KFILE_FLAC_SUBDIR) $(KFILE_THEORA_SUBDIR) diff --git a/tdefile-plugins/RETURNED_ITEMS b/tdefile-plugins/RETURNED_ITEMS new file mode 100644 index 00000000..ffe878d3 --- /dev/null +++ b/tdefile-plugins/RETURNED_ITEMS @@ -0,0 +1,86 @@ +If you add a new plugin here, add the list of returned items to this file. + +The returned items are: + + +mp3 plugin: +=========== + +type key W/A details +------------------------------------------------------------------------ +String Title +/+ only if id3v1 tag exists / max. 30 characters +String Artist +/+ only if id3v1 tag exists / max. 30 characters +String Album +/+ only if id3v1 tag exists / max. 30 characters +String Comment +/+ only if id3v1 tag exists / max. 28 characters +String Date +/+ only if id3v1 tag exists / max. 4 characters +Int Tracknumber +/+ only if id3v1.1 tag exists / 0-255 +Bool CRC -/- +Bool Original -/- +Bool Copyright -/- +String Length -/- +Int Bitrate -/- in kbps +Int Frequency -/- in Hz +Double Version -/- mpeg version, 1, 2, or 2.5 +Int Layer -/- 1, 2 or 3 +Int Channels -/- number of audio channels, 1 for mono, 2 stereo + +type is the QVariant::type() of that key. +W/A is writable/addable, - means no, + means yes. If a key is addable, it's +also removable + +ogg plugin: +=========== + +type key W/A details +------------------------------------------------------------------------ +Int Version -/- +Int Channels -/- +Int Bitrate upper -/- might also be a string containing i18n("none") +Int Bitrate lower -/- might also be a string containing i18n("none") +Int Bitrate nominal -/- might also be a string containing i18n("none") +Int Bitrate -/- average bitrate +String Length -/- + +Other keys corresponding to the vorbis comment keys are returned as editable +String. If there are several equal vorbis comment keys, e.g. 3 Artists, the +first one is called "Artist", the second one (not yet) "Artist(2)" and so on. + +Common keys that are recommended in the vorbiscomment docs: +Title, Version, Album, Tracknumber, Artist, Organization, Description, Genre, +Date, Location, Copyright, Isirc + + + +au plugin: +=========== + +type key W/A details +------------------------------------------------------------------------ +Int Length -/- Length in seconds +Int Sample Rate -/- Sample rate of sample in Hz +Int Channels -/- No. of channels +String Encoding -/- Data encoding (e.g. 8-bit ISDN u-law) + + +avi plugin: +=========== + +type key W/A details +------------------------------------------------------------------------ +Int Length -/- Length in seconds/minutes/hours +Size Resolution -/- Resolution in pixels +Int Frame rate -/- Frame rate +String Video codec -/- The video codec symbol (e.g. mp42 or div3) + + +theora plugin: +=========== + +type key W/A details +------------------------------------------------------------------------ +Int Length -/- Length in seconds/minutes/hours +Size Resolution -/- Resolution in pixels +Int Frame rate -/- Frame rate +Int Quality -/- Quality of the encoding +Int Channels -/- Number of audio channels +Int Sample rate -/- Sample rate of sample in Hz diff --git a/tdefile-plugins/au/Makefile.am b/tdefile-plugins/au/Makefile.am new file mode 100644 index 00000000..054c6181 --- /dev/null +++ b/tdefile-plugins/au/Makefile.am @@ -0,0 +1,22 @@ +## Makefile.am for au file meta info plugin + +# set the include path for X, qt and KDE +INCLUDES = $(all_includes) + +# these are the headers for your project +noinst_HEADERS = tdefile_au.h + +kde_module_LTLIBRARIES = tdefile_au.la + +tdefile_au_la_SOURCES = tdefile_au.cpp +tdefile_au_la_LDFLAGS = $(all_libraries) $(KDE_RPATH) $(LIB_QT) -lDCOP $(LIB_TDECORE) $(LIB_TDEUI) -ltdefx $(LIB_KIO) -ltdetexteditor -module $(KDE_PLUGIN) +tdefile_au_la_LIBADD = $(LIB_KIO) + +# let automoc handle all of the meta source files (moc) +METASOURCES = AUTO + +messages: + $(XGETTEXT) tdefile_au.cpp -o $(podir)/tdefile_au.pot + +services_DATA = tdefile_au.desktop +servicesdir = $(kde_servicesdir) diff --git a/tdefile-plugins/au/tdefile_au.cpp b/tdefile-plugins/au/tdefile_au.cpp new file mode 100644 index 00000000..0b0b86f6 --- /dev/null +++ b/tdefile-plugins/au/tdefile_au.cpp @@ -0,0 +1,172 @@ +/* This file is part of the KDE project + * Copyright (C) 2002 Shane Wright + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation version 2. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + */ + +#include +#include "tdefile_au.h" + +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#if !defined(__osf__) +#include +#else +typedef unsigned long uint32_t; +typedef unsigned short uint16_t; +#endif + +typedef KGenericFactory AuFactory; + +K_EXPORT_COMPONENT_FACTORY(tdefile_au, AuFactory( "tdefile_au" )) + +KAuPlugin::KAuPlugin(TQObject *parent, const char *name, + const TQStringList &args) + + : KFilePlugin(parent, name, args) +{ + KFileMimeTypeInfo* info = addMimeTypeInfo( "audio/basic" ); + + KFileMimeTypeInfo::GroupInfo* group = 0L; + + group = addGroupInfo(info, "Technical", i18n("Technical Details")); + + KFileMimeTypeInfo::ItemInfo* item; + + item = addItemInfo(group, "Length", i18n("Length"), TQVariant::Int); + setSuffix(item, "s"); + + item = addItemInfo(group, "Sample Rate", i18n("Sample Rate"), TQVariant::Int); + setSuffix(item, "Hz"); + + item = addItemInfo(group, "Channels", i18n("Channels"), TQVariant::Int); + + item = addItemInfo(group, "Encoding", i18n("Encoding"), TQVariant::String); + +} + +bool KAuPlugin::readInfo( KFileMetaInfo& info, uint what) +{ + // the file signature, wants to be tidier... + const char fsig[] = { 0x2e, 0x73, 0x6e, 0x64 }; + + // a dword buffer for input + char inbuf[4]; + + // some vars for the file properties + uint32_t datasize; + uint32_t encoding; + uint32_t samplerate; + uint32_t channels; + uint16_t bytespersample; + + if ( info.path().isEmpty() ) // remote file + return false; + + TQFile file(info.path()); + + if (!file.open(IO_ReadOnly)) + { + kdDebug(7034) << "Couldn't open " << TQFile::encodeName(info.path()).data() << endl; + return false; + } + + TQDataStream dstream(&file); + + // AU files are big-endian + dstream.setByteOrder(TQDataStream::BigEndian); + + + // Read and verify the signature + dstream.readRawBytes(inbuf, 4); + if (memcmp(fsig, inbuf, 4)) + return false; + + // skip unwanted bits + file.at(8); + + // grab the bits we want + dstream >> datasize; + dstream >> encoding; + dstream >> samplerate; + dstream >> channels; + + // add the info + KFileMetaInfoGroup group = appendGroup(info, "Technical"); + appendItem(group, "Sample Rate", (uint) samplerate); + appendItem(group, "Channels", (uint) channels); + + // work out the encoding + switch (encoding) { + case 1 : + appendItem(group, "Encoding", i18n("8-bit ISDN u-law")); + bytespersample = 1; + break; + case 2 : + appendItem(group, "Encoding", i18n("8-bit linear PCM [REF-PCM]")); + bytespersample = 1; + break; + case 3 : + appendItem(group, "Encoding", i18n("16-bit linear PCM")); + bytespersample = 2; + break; + case 4 : + appendItem(group, "Encoding", i18n("24-bit linear PCM")); + bytespersample = 3; + break; + case 5 : + appendItem(group, "Encoding", i18n("32-bit linear PCM")); + bytespersample = 4; + break; + case 6 : + appendItem(group, "Encoding", i18n("32-bit IEEE floating point")); + bytespersample = 4; + break; + case 7 : + appendItem(group, "Encoding", i18n("64-bit IEEE floating point")); + bytespersample = 8; + break; + case 23 : + appendItem(group, "Encoding", i18n("8-bit ISDN u-law compressed")); + bytespersample = 1; + break; + default : + appendItem(group, "Encoding", i18n("Unknown")); + bytespersample = 0; + } + + // work out length from bytespersample + channels + size + if ((channels > 0) && (datasize > 0) && (datasize != 0xFFFFFFFF) && (bytespersample > 0) && (samplerate > 0)) { + uint32_t length = datasize / channels / bytespersample / samplerate; + appendItem(group, "Length", (uint) length); + } else { + appendItem(group, "Length", "???"); + } + + return true; +} + +#include "tdefile_au.moc" diff --git a/tdefile-plugins/au/tdefile_au.desktop b/tdefile-plugins/au/tdefile_au.desktop new file mode 100644 index 00000000..b3057140 --- /dev/null +++ b/tdefile-plugins/au/tdefile_au.desktop @@ -0,0 +1,67 @@ +[Desktop Entry] +Type=Service +Name=AU Info +Name[af]=Au Inligting +Name[bg]=Информация за AU +Name[br]=Titouroù AU +Name[bs]=AU informacije +Name[ca]=Informació AU +Name[cs]=AU info +Name[cy]=Gwybodaeth AU +Name[da]=AU-info +Name[de]=AU-Info +Name[el]=Πληροφορίες AU +Name[eo]=AU-informo +Name[es]=Info AU +Name[et]=AU info +Name[eu]=AU informazioa +Name[fa]=اطلاعات AU +Name[fi]=AU-tiedot +Name[fr]=Informations AU +Name[gl]=Información AU +Name[he]=מידע AU +Name[hi]=AU जानकारी +Name[hr]=AU Informacije +Name[hu]=AU-jellemzők +Name[is]=AU upplýsingar +Name[it]=Informazioni AU +Name[ja]=AU 情報 +Name[kk]=AU мәліметі +Name[km]=ព័ត៌មាន AU +Name[ko]=AU 정보 +Name[lt]=AU informacija +Name[mk]=AU информации +Name[nb]=AU informasjon +Name[nds]=AU-Info +Name[ne]=AU सूचना +Name[nl]=AU-informatie +Name[nn]=AU-info +Name[pa]=AU ਜਾਣਕਾਰੀ +Name[pl]=Informacja o pliku AU +Name[pt]=Informação do AU +Name[pt_BR]=Informação sobre AU +Name[ro]=Informaţii AU +Name[ru]=Сведения о AU +Name[se]=AU-dieđut +Name[sk]=AU info +Name[sl]=Podatki o AU +Name[sr]=Информације о AU-у +Name[sr@Latn]=Informacije o AU-u +Name[sv]=AU-information +Name[ta]=AU தகவல் +Name[tg]=AU Ахборот +Name[th]=ข้อมูล AU +Name[tr]=AU Bilgisi +Name[uk]=Інформація по AU +Name[uz]=XBM haqida maʼlumot +Name[uz@cyrillic]=XBM ҳақида маълумот +Name[xh]=Ulwazi lwe AU +Name[zh_CN]=AU 信息 +Name[zh_HK]=AU 資訊 +Name[zh_TW]=AU 資訊 +Name[zu]=Ulwazi lwe-AU +ServiceTypes=KFilePlugin +X-TDE-Library=tdefile_au +MimeType=audio/basic +PreferredGrous=Technical +PreferredItems=Length,Sample Rate,Channels,Encoding diff --git a/tdefile-plugins/au/tdefile_au.h b/tdefile-plugins/au/tdefile_au.h new file mode 100644 index 00000000..7ac18c9c --- /dev/null +++ b/tdefile-plugins/au/tdefile_au.h @@ -0,0 +1,38 @@ +/* This file is part of the KDE project + * Copyright (C) 2002 Shane Wright + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation version 2. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + */ + +#ifndef __KFILE_AU_H__ +#define __KFILE_AU_H__ + +#include + +class TQStringList; + +class KAuPlugin: public KFilePlugin +{ + Q_OBJECT + + +public: + KAuPlugin( TQObject *parent, const char *name, const TQStringList& args ); + + virtual bool readInfo( KFileMetaInfo& info, uint what); +}; + +#endif diff --git a/tdefile-plugins/avi/Makefile.am b/tdefile-plugins/avi/Makefile.am new file mode 100644 index 00000000..2ecbf411 --- /dev/null +++ b/tdefile-plugins/avi/Makefile.am @@ -0,0 +1,22 @@ +## Makefile.am for avi file meta info plugin + +# set the include path for X, qt and KDE +INCLUDES = $(all_includes) + +# these are the headers for your project +noinst_HEADERS = tdefile_avi.h + +kde_module_LTLIBRARIES = tdefile_avi.la + +tdefile_avi_la_SOURCES = tdefile_avi.cpp +tdefile_avi_la_LDFLAGS = $(all_libraries) $(KDE_RPATH) $(LIB_QT) -lDCOP $(LIB_TDECORE) $(LIB_TDEUI) -ltdefx $(LIB_KIO) -ltdetexteditor -module $(KDE_PLUGIN) +tdefile_avi_la_LIBADD = $(LIB_KIO) + +# let automoc handle all of the meta source files (moc) +METASOURCES = AUTO + +messages: rc.cpp + $(XGETTEXT) tdefile_avi.cpp -o $(podir)/tdefile_avi.pot + +services_DATA = tdefile_avi.desktop +servicesdir = $(kde_servicesdir) diff --git a/tdefile-plugins/avi/tdefile_avi.cpp b/tdefile-plugins/avi/tdefile_avi.cpp new file mode 100644 index 00000000..b1c832bd --- /dev/null +++ b/tdefile-plugins/avi/tdefile_avi.cpp @@ -0,0 +1,540 @@ +/* This file is part of the KDE project + * Copyright (C) 2002 Shane Wright + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation version 2. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + */ + + +#include +#include "tdefile_avi.h" + +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#if !defined(__osf__) +#include +#else +typedef unsigned short uint16_t; +typedef unsigned int uint32_t; +typedef unsigned long long uint64_t; +#endif + +typedef KGenericFactory AviFactory; + +K_EXPORT_COMPONENT_FACTORY(tdefile_avi, AviFactory( "tdefile_avi" )) + +KAviPlugin::KAviPlugin(TQObject *parent, const char *name, + const TQStringList &args) + + : KFilePlugin(parent, name, args) +{ + KFileMimeTypeInfo* info = addMimeTypeInfo( "video/x-msvideo" ); + + KFileMimeTypeInfo::GroupInfo* group = 0L; + + group = addGroupInfo(info, "Technical", i18n("Technical Details")); + + KFileMimeTypeInfo::ItemInfo* item; + + item = addItemInfo(group, "Length", i18n("Length"), TQVariant::Int); + setUnit(item, KFileMimeTypeInfo::Seconds); + + item = addItemInfo(group, "Resolution", i18n("Resolution"), TQVariant::Size); + + item = addItemInfo(group, "Frame rate", i18n("Frame Rate"), TQVariant::Int); + setSuffix(item, i18n("fps")); + + item = addItemInfo(group, "Video codec", i18n("Video Codec"), TQVariant::String); + item = addItemInfo(group, "Audio codec", i18n("Audio Codec"), TQVariant::String); + +} + +bool KAviPlugin::read_avi() +{ + static const char sig_riff[] = "RIFF"; + static const char sig_avi[] = "AVI "; + static const char sig_list[] = "LIST"; + static const char sig_junk[] = "JUNK"; + uint32_t dwbuf1; + + done_avih = false; + done_audio = false; + + // read AVI header + char charbuf1[5]; + charbuf1[4] = '\0'; + + // this must be RIFF + f.readBlock(charbuf1, 4); + if (memcmp(charbuf1, sig_riff, 4) != 0) + return false; + + dstream >> dwbuf1; + + // this must be AVI + f.readBlock(charbuf1, 4); + if (memcmp(charbuf1, sig_avi, 4) != 0) + return false; + + + // start reading AVI file + int counter = 0; + bool done = false; + do { + + // read header + f.readBlock(charbuf1, 4); + + kdDebug(7034) << "about to handle chunk with ID: " << charbuf1 << "\n"; + + if (memcmp(charbuf1, sig_list, 4) == 0) { + // if list + if (!read_list()) + return false; + + } else if (memcmp(charbuf1, sig_junk, 4) == 0) { + // if junk + + // read chunk size + dstream >> dwbuf1; + + kdDebug(7034) << "Skipping junk chunk length: " << dwbuf1 << "\n"; + + // skip junk + f.at( f.at() + dwbuf1 ); + + } else { + // something we dont understand yet + kdDebug(7034) << "Unknown chunk header found: " << charbuf1 << "\n"; + return false; + }; + + if ( + ((done_avih) && (strlen(handler_vids) > 0) && (done_audio)) || + f.atEnd()) { + kdDebug(7034) << "We're done!\n"; + done = true; + } + + // make sure we dont stay here forever + ++counter; + if (counter > 10) + done = true; + + } while (!done); + + return true; +} + + +bool KAviPlugin::read_list() +{ + const char sig_hdrl[] = "hdrl"; // header list + const char sig_strl[] = "strl"; // ...list + const char sig_movi[] = "movi"; // movie list + + uint32_t dwbuf1; + char charbuf1[5]; + charbuf1[4] = '\0'; + + kdDebug(7034) << "In read_list()\n"; + + // read size & list type + dstream >> dwbuf1; + f.readBlock(charbuf1, 4); + + // read the relevant bits of the list + if (memcmp(charbuf1, sig_hdrl, 4) == 0) { + // should be the main AVI header + if (!read_avih()) + return false; + + } else if (memcmp(charbuf1, sig_strl, 4) == 0) { + // should be some stream info + if (!read_strl()) + return false; + + } else if (memcmp(charbuf1, sig_movi, 4) == 0) { + // movie list + + kdDebug(7034) << "Skipping movi chunk length: " << dwbuf1 << "\n"; + + // skip past it + f.at( f.at() + dwbuf1 ); + + } else { + // unknown list type + kdDebug(7034) << "Unknown list type found: " << charbuf1 << "\n"; + } + + return true; +} + + +bool KAviPlugin::read_avih() +{ + static const char sig_avih[] = "avih"; // header list + + uint32_t dwbuf1; + char charbuf1[5]; + + // read header and length + f.readBlock(charbuf1, 4); + dstream >> dwbuf1; + + // not a valid avih? + if (memcmp(charbuf1, sig_avih, 4) != 0) { + kdDebug(7034) << "Chunk ID error, expected avih, got: " << charbuf1 << "\n"; + return false; + } + + // read all the avih fields + dstream >> avih_microsecperframe; + dstream >> avih_maxbytespersec; + dstream >> avih_reserved1; + dstream >> avih_flags; + dstream >> avih_totalframes; + dstream >> avih_initialframes; + dstream >> avih_streams; + dstream >> avih_buffersize; + dstream >> avih_width; + dstream >> avih_height; + dstream >> avih_scale; + dstream >> avih_rate; + dstream >> avih_start; + dstream >> avih_length; + + done_avih = true; + + return true; +} + + +bool KAviPlugin::read_strl() +{ + static const char sig_strh[] = "strh"; + static const char sig_strf[] = "strf"; + //static const char sig_strd[] = "strd"; + static const char sig_strn[] = "strn"; + static const char sig_list[] = "LIST"; + static const char sig_junk[] = "JUNK"; + + kdDebug(7034) << "in strl handler\n"; + + uint32_t dwbuf1; // buffer for block sizes + char charbuf1[5]; + + // loop through blocks + int counter = 0; + while (true) { + + // read type and size + f.readBlock(charbuf1, 4); // type + dstream >> dwbuf1; // size + + // detect type + if (memcmp(charbuf1, sig_strh, 4) == 0) { + // got strh - stream header + kdDebug(7034) << "Found strh, calling read_strh()\n"; + read_strh(dwbuf1); + + } else if (memcmp(charbuf1, sig_strf, 4) == 0) { + // got strf - stream format + kdDebug(7034) << "Found strf, calling read_strf()\n"; + read_strf(dwbuf1); + + } else if (memcmp(charbuf1, sig_strn, 4) == 0) { + // we ignore strn, but it can be recorded incorrectly so we have to cope especially + + // skip it + kdDebug(7034) << "Skipping strn chunk length: " << dwbuf1 << "\n"; + f.at( f.at() + dwbuf1 ); + + /* + this is a pretty annoying hack; many AVIs incorrectly report the + length of the strn field by 1 byte. Its possible that strn's + should be word aligned, but no mention in the specs... + + I'll clean/optimise this a touch soon + */ + + bool done = false; + unsigned char counter = 0; + while (!done) { + // read next marker + f.readBlock(charbuf1, 4); + + // does it look ok? + if ((memcmp(charbuf1, sig_list, 4) == 0) || + (memcmp(charbuf1, sig_junk, 4) == 0)) { + // yes, go back before it + f.at( f.at() - 4); + done = true; + } else { + // no, skip one space forward from where we were + f.at( f.at() - 3); + kdDebug(7034) << "Working around incorrectly marked strn length..." << "\n"; + } + + // make sure we don't stay here too long + ++counter; + if (counter>10) + done = true; + } + + } else if ((memcmp(charbuf1, sig_list, 4) == 0) || (memcmp(charbuf1, sig_junk, 4) == 0)) { + // we have come to the end of our stay here in strl, time to leave + + kdDebug(7034) << "Found LIST/JUNK, returning...\n"; + + // rollback before the id and size + f.at( f.at() - 8 ); + + // return back to the main avi parser + return true; + + } else { + // we have some other unrecognised block type + + kdDebug(7034) << "Sskipping unrecognised block\n"; + // just skip over it + f.at( f.at() + dwbuf1); + + } /* switch block type */ + + ++counter; + if (counter > 10) + return true; + + } /* while (true) */ + + // we should never get here +} + + +bool KAviPlugin::read_strh(uint32_t blocksize) +{ + static const char sig_vids[] = "vids"; // ...video + static const char sig_auds[] = "auds"; // ...audio + + uint32_t strh_flags; + uint32_t strh_reserved1; + uint32_t strh_initialframes; + uint32_t strh_scale; + uint32_t strh_rate; + uint32_t strh_start; + uint32_t strh_length; + uint32_t strh_buffersize; + uint32_t strh_quality; + uint32_t strh_samplesize; + + char charbuf1[5]; + char charbuf2[5]; + + + // get stream info type, and handler id + f.readBlock(charbuf1, 4); + f.readBlock(charbuf2, 4); + + // read the strh fields + dstream >> strh_flags; + dstream >> strh_reserved1; + dstream >> strh_initialframes; + dstream >> strh_scale; + dstream >> strh_rate; + dstream >> strh_start; + dstream >> strh_length; + dstream >> strh_buffersize; + dstream >> strh_quality; + dstream >> strh_samplesize; + + if (memcmp(&charbuf1, sig_vids, 4) == 0) { + // we are video! + + // save the handler + memcpy(handler_vids, charbuf2, 4); + kdDebug(7034) << "Video handler: " << handler_vids << "\n"; + + + } else if (memcmp(&charbuf1, sig_auds, 4) == 0) { + // we are audio! + + // save the handler + memcpy(handler_auds, charbuf2, 4); + kdDebug(7034) << "Audio handler: " << handler_auds << "\n"; + + // we want strf to get the audio codec + wantstrf = true; + + } else { + // we are something that we don't understand + + } + + // do we need to skip ahead any more? (usually yes , contrary to + // the AVI specs I've read...) + // note: 48 is 10 * uint32_t + 2*FOURCC; the 10 fields we read above, plus the two character fields + if (blocksize > 48) + f.at( f.at() + (blocksize - 48) ); + + return true; +} + + +bool KAviPlugin::read_strf(uint32_t blocksize) +{ + // do we want to do the strf? + if (wantstrf) { + // yes. we want the audio codec identifier out of it + + // get the 16bit audio codec ID + dstream >> handler_audio; + kdDebug(7034) << "Read audio codec ID: " << handler_audio << "\n"; + // skip past the rest of the stuff here for now + f.at( f.at() + blocksize - 2); + // we have audio + done_audio = true; + + } else { + // no, skip the strf + f.at( f.at() + blocksize ); + } + + return true; +} + + + +const char * KAviPlugin::resolve_audio(uint16_t id) +{ + /* + this really wants to use some sort of KDE global + list. To avoid bloat for the moment it only does + a few common codecs + */ + + static const char codec_unknown[] = I18N_NOOP("Unknown"); + static const char codec_01[] = "Microsoft PCM"; + static const char codec_02[] = "Microsoft ADPCM"; + static const char codec_50[] = "MPEG"; + static const char codec_55[] = "MP3"; + static const char codec_92[] = "AC3"; + static const char codec_160[] = "WMA1"; + static const char codec_161[] = "WMA2"; + static const char codec_162[] = "WMA3"; + static const char codec_2000[] = "DVM"; + switch (id) { + case 0x000 : return codec_unknown; break; + case 0x001 : return codec_01; break; + case 0x002 : return codec_02; break; + case 0x050 : return codec_50; break; + case 0x055 : return codec_55; break; + case 0x092 : return codec_92; break; + case 0x160 : return codec_160; break; + case 0x161 : return codec_161; break; + case 0x162 : return codec_162; break; + case 0x2000 : return codec_2000; break; + default : return codec_unknown; + } + + return NULL; +} + + +bool KAviPlugin::readInfo( KFileMetaInfo& info, uint /*what*/) +{ + /***************************************************/ + // prep + + memset(handler_vids, 0x00, 5); + memset(handler_auds, 0x00, 5); + + + /***************************************************/ + // sort out the file + + if (f.isOpen()) + f.close(); + + if ( info.path().isEmpty() ) // remote file + return false; + + f.setName(info.path()); + + // open file, set up stream and set endianness + if (!f.open(IO_ReadOnly)) + { + kdDebug(7034) << "Couldn't open " << TQFile::encodeName(info.path()).data() << endl; + return false; + } + //TQDataStream dstream(&file); + dstream.setDevice(&f); + + dstream.setByteOrder(TQDataStream::LittleEndian); + + + /***************************************************/ + // start reading stuff from it + + wantstrf = false; + + if (!read_avi()) { + kdDebug(7034) << "read_avi() failed!" << endl; + } + + /***************************************************/ + // set up our output + + if (done_avih) { + + KFileMetaInfoGroup group = appendGroup(info, "Technical"); + + if (0 != avih_microsecperframe) { + appendItem(group, "Frame rate", int(1000000 / avih_microsecperframe)); + } + appendItem(group, "Resolution", TQSize(avih_width, avih_height)); + + // work out and add length + uint64_t mylength = (uint64_t) ((float) avih_totalframes * (float) avih_microsecperframe / 1000000.0); + appendItem(group, "Length", int(mylength)); + + + if (strlen(handler_vids) > 0) + appendItem(group, "Video codec", handler_vids); + else + appendItem(group, "Video codec", i18n("Unknown")); + + if (done_audio) + appendItem(group, "Audio codec", i18n(resolve_audio(handler_audio))); + else + appendItem(group, "Audio codec", i18n("None")); + + } + + f.close(); + return true; +} + +#include "tdefile_avi.moc" diff --git a/tdefile-plugins/avi/tdefile_avi.desktop b/tdefile-plugins/avi/tdefile_avi.desktop new file mode 100644 index 00000000..3dea0d93 --- /dev/null +++ b/tdefile-plugins/avi/tdefile_avi.desktop @@ -0,0 +1,68 @@ +[Desktop Entry] +Type=Service +Name=AVI Info +Name[af]=Avi Inligting +Name[bg]=Информация за AVI +Name[bn]=এ-ভি-আই (AVI) তথ্য +Name[br]=Titouroù AVI +Name[bs]=AVI informacije +Name[ca]=Informació AVI +Name[cs]=AVI info +Name[cy]=Gwybodaeth AVI +Name[da]=AVI-info +Name[de]=AVI-Info +Name[el]=Πληροφορίες AVI +Name[eo]=AVI-informo +Name[es]=Info AVI +Name[et]=AVI info +Name[eu]=AVI informazioa +Name[fa]=اطلاعات AVI +Name[fi]=AVI-tiedot +Name[fr]=Informations AVI +Name[gl]=Información AVI +Name[he]=מידע AVI +Name[hi]=AVI जानकारी +Name[hr]=AVI Informacije +Name[hu]=AVI-jellemzők +Name[is]=AVI upplýsingar +Name[it]=Informazioni AVI +Name[ja]=AVI 情報 +Name[kk]=AVI мәліметі +Name[km]=ព័ត៌មាន AVI +Name[ko]=AVI 정보 +Name[lt]=AVI informacija +Name[mk]=AVI информации +Name[nb]=AVI informasjon +Name[nds]=AVI-Info +Name[ne]=AVI सूचना +Name[nl]=AVI-informatie +Name[nn]=AVI-info +Name[pa]=AVI ਜਾਣਕਾਰੀ +Name[pl]=Informacja o pliku AVI +Name[pt]=Informação do AVI +Name[pt_BR]=Informação sobre AVI +Name[ro]=Informaţii AVI +Name[ru]=Сведения о AVI +Name[se]=AVI-dieđut +Name[sk]=AVI info +Name[sl]=Podatki o AVI +Name[sr]=Информације о AVI-ју +Name[sr@Latn]=Informacije o AVI-ju +Name[sv]=Avi-information +Name[ta]=AVI தகவல் +Name[tg]=AVI Ахборот +Name[th]=ข้อมูล AVI +Name[tr]=AVI Bilgisi +Name[uk]=Інформація по AVI +Name[uz]=AVI haqida maʼlumot +Name[uz@cyrillic]=AVI ҳақида маълумот +Name[xh]=Ulwazi lwe AVI +Name[zh_CN]=AVI 信息 +Name[zh_HK]=AVI 資訊 +Name[zh_TW]=AVI 資訊 +Name[zu]=Ulwazi lwe-AVI +ServiceTypes=KFilePlugin +X-TDE-Library=tdefile_avi +MimeType=video/x-msvideo +PreferredGrous=Technical +PreferredItems=Length,Resolution,Frame rate,Video codec,Audio codec diff --git a/tdefile-plugins/avi/tdefile_avi.h b/tdefile-plugins/avi/tdefile_avi.h new file mode 100644 index 00000000..b73f324b --- /dev/null +++ b/tdefile-plugins/avi/tdefile_avi.h @@ -0,0 +1,91 @@ +/* This file is part of the KDE project + * Copyright (C) 2002 Shane Wright + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation version 2. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + */ + +#ifndef __KFILE_AVI_H__ +#define __KFILE_AVI_H__ + +#include +#include + +#if !defined(__osf__) +#include +#else +typedef unsigned short uint16_t; +typedef unsigned int uint32_t; +#endif + + + +class TQStringList; + +class KAviPlugin: public KFilePlugin +{ + Q_OBJECT + + +public: + KAviPlugin( TQObject *parent, const char *name, const TQStringList& args ); + + + + virtual bool readInfo( KFileMetaInfo& info, uint what); + +private: + + bool read_avi(); + bool read_list(); + bool read_avih(); + bool read_strl(); + + bool read_strf(uint32_t blocksize); + bool read_strh(uint32_t blocksize); + + // methods to sort out human readable names for the codecs + const char * resolve_audio(uint16_t id); + + TQFile f; + TQDataStream dstream; + + // AVI header information + bool done_avih; + uint32_t avih_microsecperframe; + uint32_t avih_maxbytespersec; + uint32_t avih_reserved1; + uint32_t avih_flags; + uint32_t avih_totalframes; + uint32_t avih_initialframes; + uint32_t avih_streams; + uint32_t avih_buffersize; + uint32_t avih_width; + uint32_t avih_height; + uint32_t avih_scale; + uint32_t avih_rate; + uint32_t avih_start; + uint32_t avih_length; + + char handler_vids[5]; // leave room for trailing \0 + char handler_auds[5]; + uint16_t handler_audio; // the ID of the audio codec + bool done_audio; + + bool wantstrf; + +}; + +#endif diff --git a/tdefile-plugins/flac/Makefile.am b/tdefile-plugins/flac/Makefile.am new file mode 100644 index 00000000..ddae9580 --- /dev/null +++ b/tdefile-plugins/flac/Makefile.am @@ -0,0 +1,22 @@ +## Makefile.am for FLAC file meta info plugin + +# set the include path for X, qt, KDE and TagLib +INCLUDES = $(all_includes) $(taglib_includes) + +# these are the headers for your project +noinst_HEADERS = tdefile_flac.h + +kde_module_LTLIBRARIES = tdefile_flac.la + +tdefile_flac_la_SOURCES = tdefile_flac.cpp +tdefile_flac_la_LDFLAGS = $(all_libraries) $(KDE_RPATH) $(LIB_QT) -lDCOP $(LIB_TDECORE) $(LIB_TDEUI) -ltdefx $(LIB_KIO) -ltdetexteditor $(taglib_libs) -module $(KDE_PLUGIN) +tdefile_flac_la_LIBADD = $(LIB_KIO) + +# let automoc handle all of the meta source files (moc) +METASOURCES = AUTO + +messages: rc.cpp + $(XGETTEXT) tdefile_flac.cpp -o $(podir)/tdefile_flac.pot + +services_DATA = tdefile_flac.desktop +servicesdir = $(kde_servicesdir) diff --git a/tdefile-plugins/flac/configure.in.in b/tdefile-plugins/flac/configure.in.in new file mode 100644 index 00000000..eeaeebf5 --- /dev/null +++ b/tdefile-plugins/flac/configure.in.in @@ -0,0 +1 @@ +AM_CONDITIONAL(include_flac_SUBDIR, test "x$have_taglib" = xyes) diff --git a/tdefile-plugins/flac/tdefile_flac.cpp b/tdefile-plugins/flac/tdefile_flac.cpp new file mode 100644 index 00000000..b7030998 --- /dev/null +++ b/tdefile-plugins/flac/tdefile_flac.cpp @@ -0,0 +1,282 @@ +/* This file is part of the KDE project + * Copyright (C) 2003-2004 Allan Sandfeld Jensen + * + * Originally based upon the tdefile_ogg plugin: + * Copyright (C) 2001, 2002 Rolf Magnus + * Interfacing to TagLib is copied from tdefile_mp3 plugin: + * Copyright (C) 2003 Scott Wheeler + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation version 2. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +#include "tdefile_flac.h" + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include +#if (TAGLIB_MAJOR_VERSION>1) || \ + ((TAGLIB_MAJOR_VERSION==1) && (TAGLIB_MINOR_VERSION>=2)) +#define TAGLIB_1_2 +#endif + +#include +#include +#include +#ifdef TAGLIB_1_2 +#include +#endif + +#include +#include +#include + +K_EXPORT_COMPONENT_FACTORY(tdefile_flac, KGenericFactory("tdefile_flac")) + +KFlacPlugin::KFlacPlugin( TQObject *parent, const char *name, + const TQStringList &args ) + : KFilePlugin( parent, name, args ) +{ + kdDebug(7034) << "flac plugin\n"; + + makeMimeTypeInfo( "audio/x-flac" ); +#ifdef TAGLIB_1_2 + makeMimeTypeInfo( "audio/x-oggflac" ); +#endif + +} + +void KFlacPlugin::makeMimeTypeInfo(const TQString& mimeType) +{ + KFileMimeTypeInfo* info = addMimeTypeInfo( mimeType ); + + KFileMimeTypeInfo::GroupInfo* group = 0; + + // comment group + group = addGroupInfo(info, "Comment", i18n("Comment")); + setAttributes(group, KFileMimeTypeInfo::Addable | + KFileMimeTypeInfo::Removable); + + KFileMimeTypeInfo::ItemInfo* item = 0; + + item = addItemInfo(group, "Artist", i18n("Artist"), TQVariant::String); + setHint(item, KFileMimeTypeInfo::Author); + setAttributes(item, KFileMimeTypeInfo::Modifiable); + + item = addItemInfo(group, "Title", i18n("Title"), TQVariant::String); + setHint(item, KFileMimeTypeInfo::Name); + setAttributes(item, KFileMimeTypeInfo::Modifiable); + + item = addItemInfo(group, "Album", i18n("Album"), TQVariant::String); + setAttributes(item, KFileMimeTypeInfo::Modifiable); + + item = addItemInfo(group, "Genre", i18n("Genre"), TQVariant::String); + setAttributes(item, KFileMimeTypeInfo::Modifiable); + + item = addItemInfo(group, "Tracknumber", i18n("Track Number"), TQVariant::String); + setAttributes(item, KFileMimeTypeInfo::Modifiable); + + item = addItemInfo(group, "Date", i18n("Date"), TQVariant::String); + setAttributes(item, KFileMimeTypeInfo::Modifiable); + + item = addItemInfo(group, "Description", i18n("Description"), TQVariant::String); + setAttributes(item, KFileMimeTypeInfo::Modifiable); + + item = addItemInfo(group, "Organization", i18n("Organization"), TQVariant::String); + setAttributes(item, KFileMimeTypeInfo::Modifiable); + + item = addItemInfo(group, "Location", i18n("Location"), TQVariant::String); + setAttributes(item, KFileMimeTypeInfo::Modifiable); + + item = addItemInfo(group, "Copyright", i18n("Copyright"), TQVariant::String); + setAttributes(item, KFileMimeTypeInfo::Modifiable); + + + addVariableInfo(group, TQVariant::String, KFileMimeTypeInfo::Addable | + KFileMimeTypeInfo::Removable | + KFileMimeTypeInfo::Modifiable); + + // technical group + group = addGroupInfo(info, "Technical", i18n("Technical Details")); + setAttributes(group, 0); + + addItemInfo(group, "Channels", i18n("Channels"), TQVariant::Int); + + item = addItemInfo(group, "Sample Rate", i18n("Sample Rate"), TQVariant::Int); + setSuffix(item, i18n(" Hz")); + + item = addItemInfo(group, "Sample Width", i18n("Sample Width"), TQVariant::Int); + setSuffix(item, i18n(" bits")); + + item = addItemInfo(group, "Bitrate", i18n("Average Bitrate"), + TQVariant::Int); + setAttributes(item, KFileMimeTypeInfo::Averaged); + setHint(item, KFileMimeTypeInfo::Bitrate); + setSuffix(item, i18n( " kbps")); + + item = addItemInfo(group, "Length", i18n("Length"), TQVariant::Int); + setAttributes(item, KFileMimeTypeInfo::Cummulative); + setHint(item, KFileMimeTypeInfo::Length); + setUnit(item, KFileMimeTypeInfo::Seconds); +} + +bool KFlacPlugin::readInfo( KFileMetaInfo& info, uint what ) +{ + if ( info.path().isEmpty() ) // remote file + return false; + + bool readComment = false; + bool readTech = false; + if (what & (KFileMetaInfo::Fastest | + KFileMetaInfo::DontCare | + KFileMetaInfo::ContentInfo)) readComment = true; + + if (what & (KFileMetaInfo::Fastest | + KFileMetaInfo::DontCare | + KFileMetaInfo::TechnicalInfo)) readTech = true; + + TagLib::File *file = 0; + + if (info.mimeType() == "audio/x-flac") + file = new TagLib::FLAC::File(TQFile::encodeName(info.path()).data(), readTech); +#ifdef TAGLIB_1_2 + else + file = new TagLib::Ogg::FLAC::File(TQFile::encodeName(info.path()).data(), readTech); +#endif + + if (!file || !file->isValid()) + { + kdDebug(7034) << "Couldn't open " << file->name() << endl; + delete file; + return false; + } + + if(readComment && file->tag()) + { + KFileMetaInfoGroup commentgroup = appendGroup(info, "Comment"); + + TQString date = file->tag()->year() > 0 ? TQString::number(file->tag()->year()) : TQString(); + TQString track = file->tag()->track() > 0 ? TQString::number(file->tag()->track()) : TQString(); + + appendItem(commentgroup, "Title", TQString(TStringToQString(file->tag()->title())).stripWhiteSpace()); + appendItem(commentgroup, "Artist", TQString(TStringToQString(file->tag()->artist())).stripWhiteSpace()); + appendItem(commentgroup, "Album", TQString(TStringToQString(file->tag()->album())).stripWhiteSpace()); + appendItem(commentgroup, "Date", date); + appendItem(commentgroup, "Comment", TQString(TStringToQString(file->tag()->comment())).stripWhiteSpace()); + appendItem(commentgroup, "Tracknumber", track); + appendItem(commentgroup, "Genre", TQString(TStringToQString(file->tag()->genre())).stripWhiteSpace()); + } + + if (readTech && file->audioProperties()) + { + KFileMetaInfoGroup techgroup = appendGroup(info, "Technical"); + TagLib::FLAC::Properties *properties = + (TagLib::FLAC::Properties*)(file->audioProperties()); + + appendItem(techgroup, "Bitrate", properties->bitrate()); + appendItem(techgroup, "Sample Rate", properties->sampleRate()); + appendItem(techgroup, "Sample Width", properties->sampleWidth()); + appendItem(techgroup, "Channels", properties->channels()); + appendItem(techgroup, "Length", properties->length()); + } + + delete file; + return true; + +} + +/** + * Do translation between KFileMetaInfo items and TagLib::String in a tidy way. + */ + +class Translator +{ +public: + Translator(const KFileMetaInfo &info) : m_info(info) {} + TagLib::String operator[](const char *key) const + { + return QStringToTString(m_info["Comment"][key].value().toString()); + } + int toInt(const char *key) const + { + return m_info["Comment"][key].value().toInt(); + } +private: + const KFileMetaInfo &m_info; +}; + +bool KFlacPlugin::writeInfo(const KFileMetaInfo& info) const +{ + TagLib::File *file; + + if (!TagLib::File::isWritable(TQFile::encodeName(info.path()).data())) { + kdDebug(7034) << "can't write to " << info.path() << endl; + return false; + } + + if (info.mimeType() == "audio/x-flac") + file = new TagLib::FLAC::File(TQFile::encodeName(info.path()).data(), false); +#ifdef TAGLIB_1_2 + else + file = new TagLib::Ogg::FLAC::File(TQFile::encodeName(info.path()).data(), false); +#endif + + if(!file->isOpen()) + { + kdDebug(7034) << "couldn't open " << info.path() << endl; + delete file; + return false; + } + + Translator t(info); + + file->tag()->setTitle(t["Title"]); + file->tag()->setArtist(t["Artist"]); + file->tag()->setAlbum(t["Album"]); + file->tag()->setYear(t.toInt("Date")); + file->tag()->setComment(t["Comment"]); + file->tag()->setTrack(t.toInt("Tracknumber")); + file->tag()->setGenre(t["Genre"]); + + file->save(); + + delete file; + return true; +} + +TQValidator* KFlacPlugin::createValidator( const TQString&, + const TQString &group, const TQString &key, + TQObject* parent, const char* name) const +{ + if(key == "Tracknumber" || key == "Date") + { + return new TQIntValidator(0, 9999, parent, name); + } + else + return new TQRegExpValidator(TQRegExp(".*"), parent, name); +} + +#include "tdefile_flac.moc" diff --git a/tdefile-plugins/flac/tdefile_flac.desktop b/tdefile-plugins/flac/tdefile_flac.desktop new file mode 100644 index 00000000..88e494c4 --- /dev/null +++ b/tdefile-plugins/flac/tdefile_flac.desktop @@ -0,0 +1,62 @@ +[Desktop Entry] +Type=Service +Name=FLAC Info +Name[bg]=Информация за FLAC +Name[bn]=ফ্ল্যাক (FLAC) তথ্য +Name[br]=Titouroù FLAC +Name[bs]=FLAC informacije +Name[ca]=Informació FLAC +Name[cs]=FLAC info +Name[cy]=Gwybodaeth FLAC +Name[da]=FLAC-Info +Name[de]=FLAC-Info +Name[el]=Πληροφορίες FLAC +Name[es]=Info FLAC +Name[et]=FLAC info +Name[eu]=FLAC Informazioa +Name[fa]=اطلاعات FLAC +Name[fi]=FLAC-tiedot +Name[fr]=Informations FLAC +Name[gl]=Información FLAC +Name[he]=מידע FLAC +Name[hi]=FLAC जानकारी +Name[hu]=FLAC-jellemzők +Name[is]=AU upplýsingar +Name[it]=Informazioni FLAC +Name[ja]=FLAC 情報 +Name[kk]=FLAC мәліметі +Name[km]=ព័ត៌មាន FLAC +Name[ko]=FLAC 정보 +Name[lt]=FLAC informacija +Name[mk]=FLAC информации +Name[nb]=FLAC informasjon +Name[nds]=FLAC-Info +Name[ne]=FLAC सूचना +Name[nl]=FLAC-informatie +Name[nn]=FLAC-info +Name[pa]=FLAC ਜਾਣਕਾਰੀ +Name[pl]=Informacja o pliku FLAC +Name[pt]=Informação do FLAC +Name[pt_BR]=Informação sobre FLAC +Name[ro]=Informaţii FLAC +Name[ru]=Сведения о FLAC +Name[sk]=FLAC info +Name[sl]=Podatki o FLAC +Name[sr]=Информације о FLAC-у +Name[sr@Latn]=Informacije o FLAC-u +Name[sv]=FLAC-information +Name[ta]=FLAC தகவல் +Name[tg]=FLAC Ахборот +Name[th]=ขอมูล FLAC +Name[tr]=FLAC Bilgisi +Name[uk]=Інформація по FLAC +Name[uz]=FLAC haqida maʼlumot +Name[uz@cyrillic]=FLAC ҳақида маълумот +Name[zh_CN]=FLAC 信息 +Name[zh_HK]=FLAC 資訊 +Name[zh_TW]=FLAC 資訊 +ServiceTypes=KFilePlugin +X-TDE-Library=tdefile_flac +MimeType=audio/x-flac;audio/x-oggflac +PreferredGroups=Comment,Technical +PreferredItems=Title,Artist,Album,Tracknumber,Genre,Bitrate,Length,Channels, Date,Description,Organization,Location,Copyright diff --git a/tdefile-plugins/flac/tdefile_flac.h b/tdefile-plugins/flac/tdefile_flac.h new file mode 100644 index 00000000..f4f3c96f --- /dev/null +++ b/tdefile-plugins/flac/tdefile_flac.h @@ -0,0 +1,51 @@ +/* This file is part of the KDE project + * Copyright (C) 2003 Allan Sandfeld Jensen + * + * Originally based upon the tdefile_ogg plugin: + * Copyright (C) 2001, 2002 Rolf Magnus + * Interfacing to TagLib is copied from tdefile_mp3 plugin: + * Copyright (C) 2003 Scott Wheeler + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation version 2. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +#ifndef __KFILE_FLAC_H__ +#define __KFILE_FLAC_H__ + +#include + +class TQString; +class TQStringList; + +class KFlacPlugin: public KFilePlugin +{ + Q_OBJECT + + +public: + KFlacPlugin( TQObject *parent, const char *name, const TQStringList& args ); + + virtual bool readInfo( KFileMetaInfo& info, uint what); + virtual bool writeInfo( const KFileMetaInfo& info ) const; + virtual TQValidator* createValidator( const TQString& mimetype, + const TQString &group, + const TQString &key, + TQObject* parent, const char* name) const; +protected: + virtual void makeMimeTypeInfo(const TQString& mimeType); +}; + + +#endif diff --git a/tdefile-plugins/m3u/Makefile.am b/tdefile-plugins/m3u/Makefile.am new file mode 100644 index 00000000..11259cad --- /dev/null +++ b/tdefile-plugins/m3u/Makefile.am @@ -0,0 +1,22 @@ +## Makefile.am for m3u file meta info plugin + +# set the include path for X, qt and KDE +INCLUDES = $(all_includes) + +# these are the headers for your project +noinst_HEADERS = tdefile_m3u.h + +kde_module_LTLIBRARIES = tdefile_m3u.la + +tdefile_m3u_la_SOURCES = tdefile_m3u.cpp +tdefile_m3u_la_LDFLAGS = $(all_libraries) $(KDE_RPATH) $(LIB_QT) -lDCOP $(LIB_TDECORE) $(LIB_TDEUI) -ltdefx $(LIB_KIO) -ltdetexteditor -module $(KDE_PLUGIN) +tdefile_m3u_la_LIBADD = $(LIB_KSYCOCA) + +# let automoc handle all of the meta source files (moc) +METASOURCES = AUTO + +messages: rc.cpp + $(XGETTEXT) tdefile_m3u.cpp -o $(podir)/tdefile_m3u.pot + +services_DATA = tdefile_m3u.desktop +servicesdir = $(kde_servicesdir) diff --git a/tdefile-plugins/m3u/tdefile_m3u.cpp b/tdefile-plugins/m3u/tdefile_m3u.cpp new file mode 100644 index 00000000..a25234e8 --- /dev/null +++ b/tdefile-plugins/m3u/tdefile_m3u.cpp @@ -0,0 +1,87 @@ +/* This file is part of the KDE project + * Copyright (C) 2001, 2002 Rolf Magnus + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation version 2. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + * $Id$ + */ + +#include "tdefile_m3u.h" + +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +typedef KGenericFactory M3uFactory; + +K_EXPORT_COMPONENT_FACTORY( tdefile_m3u, M3uFactory( "tdefile_m3u" ) ) + +KM3uPlugin::KM3uPlugin( TQObject *parent, const char *name, + const TQStringList &preferredItems ) + : KFilePlugin( parent, name, preferredItems ) +{ + kdDebug(7034) << "m3u plugin\n"; + + KFileMimeTypeInfo* info = addMimeTypeInfo( "audio/x-mpegurl" ); + + KFileMimeTypeInfo::GroupInfo* group; + + // tracks group + group = addGroupInfo(info, "Tracks", i18n("Tracks")); + addVariableInfo(group, TQVariant::String, 0); +} + +bool KM3uPlugin::readInfo( KFileMetaInfo& info, uint ) +{ + if ( info.path().isEmpty() ) // remote file + return false; + + TQFile f(info.path()); + if (!f.open(IO_ReadOnly)) return false; + TQTextStream str(&f); + str.setEncoding(TQTextStream::Locale); + + + KFileMetaInfoGroup group = appendGroup(info, "Tracks"); + + // for now treat all lines that don't start with # like entries + int num = 1; + while (!str.atEnd()) + { + TQString s = str.readLine(); + if (!s.startsWith("#")) + { + if (s.endsWith("\n")) s.truncate(s.length()-1); + + if (!s.stripWhiteSpace().isEmpty()) { + appendItem(group, i18n("Track %1").arg(num, 3), s); + num++; + } + } + } + + return true; +} + +#include "tdefile_m3u.moc" diff --git a/tdefile-plugins/m3u/tdefile_m3u.desktop b/tdefile-plugins/m3u/tdefile_m3u.desktop new file mode 100644 index 00000000..388a6e71 --- /dev/null +++ b/tdefile-plugins/m3u/tdefile_m3u.desktop @@ -0,0 +1,71 @@ +[Desktop Entry] +Type=Service +Name=M3U Playlist Info +Name[af]=M3u Liedjielys Inligting +Name[ar]=معلومات قوائم M3U +Name[az]=MP3 Mahnı Siyahısı İnfosu +Name[bg]=Информация за списък M3U +Name[bn]=এম-৩-ইউ (M3U) সঙ্গীত-তালিকা তথ্য +Name[br]=Titouroù Rollc'hoari MP3 +Name[bs]=M3U Playlist informacije +Name[ca]=Informació de selecció de peces M3U +Name[cs]=Informace o seznamu skladeb M3U +Name[cy]=Gwybodaeth Rhestr Chwarae M3U +Name[da]=M3U-spillelisteinfo +Name[de]=M3U-Wiedergabelisten-Info +Name[el]=Πληροφορίες λίστας αναπαραγωγής M3U +Name[eo]=M3U-ludlistinformo +Name[es]=Información de lista de reproducción M3U +Name[et]=M3U esitusnimekirja info +Name[eu]=M3U erreprodukzio-zerrenda informazioa +Name[fa]=اطلاعات فهرست پخش M3U +Name[fi]=M3U-soittolistan tiedot +Name[fr]=Informations sur une liste de lecture M3U +Name[ga]=Eolas Seinmliosta M3U +Name[gl]=Información de Lista M3U +Name[he]=מידע על רשימות ניגון של M3U +Name[hi]=M3U गीत-सूची जानकारी +Name[hr]=Informacije o M3U listi pjesama +Name[hu]=Az M3U lejátszási lista jellemzői +Name[is]=M3U lagalistaupplýsingar +Name[it]=Informazioni playlist M3U +Name[ja]=M3U プレイリスト情報 +Name[kk]=M3U орындау тізім мәліметі +Name[km]=ព័ត៌មាន​បញ្ជី​ចាក់ M3U +Name[ko]=M3U 재생목록 정보 +Name[lt]=M3U gaidaraščio informacija +Name[lv]=M3U Plejlistu Info +Name[mk]=Информации за M3U листа со нумери +Name[nb]=M3U spilleliste informasjon +Name[nds]=M3U-Weddergaavlist-Info +Name[ne]=M3U बजाउने सूची सूचना +Name[nl]=M3U Speellijst-informatie +Name[nn]=M3U-spelelisteinfo +Name[pa]=M3U ਸੰਗੀਤ-ਸੂਚੀ ਜਾਣਕਾਰੀ +Name[pl]=Informacja o liście nagrań w M3U +Name[pt]=Informação da Lista de Músicas M3U +Name[pt_BR]=Informações de listas de reprodução M3U +Name[ro]=Informaţii listă M3U +Name[ru]=Сведения о списке песен M3U +Name[se]=M3U-čuojahanlistodieđut +Name[sk]=Informácie o playliste M3U +Name[sl]=Podatki o predvajalnem seznamu M3U +Name[sr]=Информације о M3U листи нумера +Name[sr@Latn]=Informacije o M3U listi numera +Name[sv]=Information om M3U-spellista +Name[ta]=M3U பாடல்பட்டியல் தகவல் +Name[tg]=M3U Ахбороти Рӯйхати бозикуниҳо +Name[th]=ข้อมูลรายการเพลง M3U +Name[tr]=M3U Çalma Listesi Bilgisi +Name[uk]=Інформація списку композицій M3U +Name[ven]=Mavhungo a mutevhe wa tshitambi tsha M3U +Name[xh]=M3U Ulwazi Loluhlu Lokudlala +Name[zh_CN]=M3U 播放列表信息 +Name[zh_HK]=M3U 播放清單資訊 +Name[zh_TW]=M3U 播放清單資訊 +Name[zu]=Ulwazi Lohlu lokudlala lwe-M3U +ServiceTypes=KFilePlugin +X-TDE-Library=tdefile_m3u +MimeType=audio/x-mpegurl +PreferredGroups=Tracks +PreferredItems= diff --git a/tdefile-plugins/m3u/tdefile_m3u.h b/tdefile-plugins/m3u/tdefile_m3u.h new file mode 100644 index 00000000..afc46847 --- /dev/null +++ b/tdefile-plugins/m3u/tdefile_m3u.h @@ -0,0 +1,40 @@ +/* This file is part of the KDE project + * Copyright (C) 2001, 2002 Rolf Magnus + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation version 2. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + * $Id$ + */ + +#ifndef __KMIME_M3U_H__ +#define __KMIME_M3U_H__ + +#include +#include + +class TQStringList; + +class KM3uPlugin: public KFilePlugin +{ + Q_OBJECT + + +public: + KM3uPlugin( TQObject *parent, const char *name, const TQStringList& args ); + + virtual bool readInfo( KFileMetaInfo& info, uint what ); +}; + +#endif diff --git a/tdefile-plugins/mp3/Makefile.am b/tdefile-plugins/mp3/Makefile.am new file mode 100644 index 00000000..97fbe73d --- /dev/null +++ b/tdefile-plugins/mp3/Makefile.am @@ -0,0 +1,22 @@ +## Makefile.am for mp3 file meta info plugin + +# set the include path for X, qt and KDE +INCLUDES = $(all_includes) $(taglib_includes) + +# these are the headers for your project +noinst_HEADERS = tdefile_mp3.h + +kde_module_LTLIBRARIES = tdefile_mp3.la + +tdefile_mp3_la_SOURCES = tdefile_mp3.cpp +tdefile_mp3_la_LDFLAGS = $(all_libraries) $(KDE_RPATH) $(LIB_QT) -lDCOP $(LIB_TDECORE) $(LIB_TDEUI) -ltdefx $(LIB_KIO) -ltdetexteditor $(taglib_libs) -module $(KDE_PLUGIN) +tdefile_mp3_la_LIBADD = $(LIB_KIO) + +# let automoc handle all of the meta source files (moc) +METASOURCES = AUTO + +messages: rc.cpp + $(XGETTEXT) tdefile_mp3.cpp -o $(podir)/tdefile_mp3.pot + +services_DATA = tdefile_mp3.desktop +servicesdir = $(kde_servicesdir) diff --git a/tdefile-plugins/mp3/configure.in.in b/tdefile-plugins/mp3/configure.in.in new file mode 100644 index 00000000..d04bc223 --- /dev/null +++ b/tdefile-plugins/mp3/configure.in.in @@ -0,0 +1 @@ +AM_CONDITIONAL(include_mp3_SUBDIR, test "x$have_taglib" = xyes) diff --git a/tdefile-plugins/mp3/tdefile_mp3.cpp b/tdefile-plugins/mp3/tdefile_mp3.cpp new file mode 100644 index 00000000..ccabd079 --- /dev/null +++ b/tdefile-plugins/mp3/tdefile_mp3.cpp @@ -0,0 +1,307 @@ +/* This file is part of the KDE project + * Copyright (C) 2001, 2002 Rolf Magnus + * Copyright (C) 2002 Ryan Cumming + * Copyright (C) 2003 Scott Wheeler + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation version 2. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +#include "config.h" + +#include "tdefile_mp3.h" + +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +typedef KGenericFactory Mp3Factory; + +K_EXPORT_COMPONENT_FACTORY(tdefile_mp3, Mp3Factory( "tdefile_mp3" )) + +KMp3Plugin::KMp3Plugin(TQObject *parent, const char *name, const TQStringList &args) + : KFilePlugin(parent, name, args) +{ + kdDebug(7034) << "mp3 plugin\n"; + + KFileMimeTypeInfo *info = addMimeTypeInfo("audio/x-mp3"); + + // id3 group + + KFileMimeTypeInfo::GroupInfo *group = addGroupInfo(info, "id3", i18n("ID3 Tag")); + + setAttributes(group, KFileMimeTypeInfo::Addable | + KFileMimeTypeInfo::Removable); + + KFileMimeTypeInfo::ItemInfo *item; + + item = addItemInfo(group, "Title", i18n("Title"), TQVariant::String); + setAttributes(item, KFileMimeTypeInfo::Modifiable); + setHint(item, KFileMimeTypeInfo::Name); + + item = addItemInfo(group, "Artist", i18n("Artist"), TQVariant::String); + setAttributes(item, KFileMimeTypeInfo::Modifiable); + setHint(item, KFileMimeTypeInfo::Author); + + item = addItemInfo(group, "Album", i18n("Album"), TQVariant::String); + setAttributes(item, KFileMimeTypeInfo::Modifiable); + + item = addItemInfo(group, "Date", i18n("Year"), TQVariant::String); + setAttributes(item, KFileMimeTypeInfo::Modifiable); + + item = addItemInfo(group, "Comment", i18n("Comment"), TQVariant::String); + setAttributes(item, KFileMimeTypeInfo::Modifiable); + setHint(item, KFileMimeTypeInfo::Description); + + item = addItemInfo(group, "Tracknumber", i18n("Track"), TQVariant::Int); + setAttributes(item, KFileMimeTypeInfo::Modifiable); + + item = addItemInfo(group, "Genre", i18n("Genre"), TQVariant::String); + setAttributes(item, KFileMimeTypeInfo::Modifiable); + + // technical group + + group = addGroupInfo(info, "Technical", i18n("Technical Details")); + + item = addItemInfo(group, "Version", i18n("Version"), TQVariant::Int); + setPrefix(item, i18n("MPEG ")); + + item = addItemInfo(group, "Layer", i18n("Layer"), TQVariant::Int); + item = addItemInfo(group, "CRC", i18n("CRC"), TQVariant::Bool); + item = addItemInfo(group, "Bitrate", i18n("Bitrate"), TQVariant::Int); + setAttributes(item, KFileMimeTypeInfo::Averaged); + setHint(item, KFileMimeTypeInfo::Bitrate); + setSuffix(item, i18n(" kbps")); + + item = addItemInfo(group, "Sample Rate", i18n("Sample Rate"), TQVariant::Int); + setSuffix(item, i18n("Hz")); + + item = addItemInfo(group, "Channels", i18n("Channels"), TQVariant::Int); + item = addItemInfo(group, "Copyright", i18n("Copyright"), TQVariant::Bool); + item = addItemInfo(group, "Original", i18n("Original"), TQVariant::Bool); + item = addItemInfo(group, "Length", i18n("Length"), TQVariant::Int); + setAttributes(item, KFileMimeTypeInfo::Cummulative); + setUnit(item, KFileMimeTypeInfo::Seconds); + item = addItemInfo(group, "Emphasis", i18n("Emphasis"), TQVariant::String); +} + +bool KMp3Plugin::readInfo(KFileMetaInfo &info, uint what) +{ + kdDebug(7034) << "mp3 plugin readInfo\n"; + + bool readId3 = false; + bool readTech = false; + + typedef enum KFileMetaInfo::What What; + + if(what & (KFileMetaInfo::Fastest | + KFileMetaInfo::DontCare | + KFileMetaInfo::ContentInfo)) + { + readId3 = true; + } + + if(what & (KFileMetaInfo::Fastest | + KFileMetaInfo::DontCare | + KFileMetaInfo::TechnicalInfo)) + { + readTech = true; + } + + if(!readId3 && !readTech) + return true; + + if ( info.path().isEmpty() ) // remote file + return false; + + TagLib::MPEG::File file(TQFile::encodeName(info.path()).data(), readTech); + + if(!file.isOpen()) + { + kdDebug(7034) << "Couldn't open " << file.name() << endl; + return false; + } + + if(readId3) + { + KFileMetaInfoGroup id3group = appendGroup(info, "id3"); + + TQString date = file.tag()->year() > 0 ? TQString::number(file.tag()->year()) : TQString(); + TQString track = file.tag()->track() > 0 ? TQString::number(file.tag()->track()) : TQString(); + + TQString title = TQString(TStringToQString(file.tag()->title())).stripWhiteSpace(); + if (!title.isEmpty()) + appendItem(id3group, "Title", title); + TQString artist = TQString(TStringToQString(file.tag()->artist())).stripWhiteSpace(); + if (!artist.isEmpty()) + appendItem(id3group, "Artist", artist); + TQString album = TQString(TStringToQString(file.tag()->album())).stripWhiteSpace(); + if (!album.isEmpty()) + appendItem(id3group, "Album", album); + appendItem(id3group, "Date", date); + TQString comment = TQString(TStringToQString(file.tag()->comment())).stripWhiteSpace(); + if (!comment.isEmpty()) + appendItem(id3group, "Comment", comment); + appendItem(id3group, "Tracknumber", track); + TQString genre = TQString(TStringToQString(file.tag()->genre())).stripWhiteSpace(); + if (!genre.isEmpty()) + appendItem(id3group, "Genre", genre); + } + + if(readTech) + { + KFileMetaInfoGroup techgroup = appendGroup(info, "Technical"); + + TQString version; + switch(file.audioProperties()->version()) + { + case TagLib::MPEG::Header::Version1: + version = "1.0"; + break; + case TagLib::MPEG::Header::Version2: + version = "2.0"; + break; + case TagLib::MPEG::Header::Version2_5: + version = "2.5"; + break; + } + + static const int dummy = 0; // TQVariant's bool constructor requires a dummy int value. + + // CRC and Emphasis aren't yet implemented in TagLib (not that I think anyone cares) + + appendItem(techgroup, "Version", version); + appendItem(techgroup, "Layer", file.audioProperties()->layer()); + // appendItem(techgroup, "CRC", file.audioProperties()->crc()); + appendItem(techgroup, "Bitrate", file.audioProperties()->bitrate()); + appendItem(techgroup, "Sample Rate", file.audioProperties()->sampleRate()); + appendItem(techgroup, "Channels", file.audioProperties()->channels()); + appendItem(techgroup, "Copyright", TQVariant(file.audioProperties()->isCopyrighted(), dummy)); + appendItem(techgroup, "Original", TQVariant(file.audioProperties()->isOriginal(), dummy)); + appendItem(techgroup, "Length", file.audioProperties()->length()); + // appendItem(techgroup, "Emphasis", file.audioProperties()->empahsis()); + } + + kdDebug(7034) << "reading finished\n"; + + return true; +} + +/** + * Do translation between KFileMetaInfo items and TagLib::String in a tidy way. + */ + +class Translator +{ +public: + Translator(const KFileMetaInfo &info) : m_info(info) {} + TagLib::String operator[](const char *key) const + { + return QStringToTString(m_info["id3"][key].value().toString()); + } + int toInt(const char *key) const + { + return m_info["id3"][key].value().toInt(); + } +private: + const KFileMetaInfo &m_info; +}; + +bool KMp3Plugin::writeInfo(const KFileMetaInfo &info) const +{ + TagLib::ID3v2::FrameFactory::instance()->setDefaultTextEncoding(TagLib::String::UTF8); + TagLib::MPEG::File file(TQFile::encodeName(info.path()).data(), false); + + if(!file.isOpen() || !TagLib::File::isWritable(file.name())) + { + kdDebug(7034) << "couldn't open " << info.path() << endl; + return false; + } + + Translator t(info); + + file.tag()->setTitle(t["Title"]); + file.tag()->setArtist(t["Artist"]); + file.tag()->setAlbum(t["Album"]); + file.tag()->setYear(t.toInt("Date")); + file.tag()->setComment(t["Comment"]); + file.tag()->setTrack(t.toInt("Tracknumber")); + file.tag()->setGenre(t["Genre"]); + + file.save(); + + return true; +} + +/** + * A validator that will suggest a list of strings, but allow for free form + * strings as well. + */ + +class ComboValidator : public KStringListValidator +{ +public: + ComboValidator(const TQStringList &list, bool rejecting, + bool fixupEnabled, TQObject *parent, const char *name) : + KStringListValidator(list, rejecting, fixupEnabled, parent, name) + { + + } + + virtual TQValidator::State validate(TQString &, int &) const + { + return TQValidator::Acceptable; + } +}; + +TQValidator *KMp3Plugin::createValidator(const TQString & /* mimetype */, + const TQString &group, const TQString &key, + TQObject *parent, const char *name) const +{ + kdDebug(7034) << "making a validator for " << group << "/" << key << endl; + + if(key == "Tracknumber" || key == "Date") + { + return new TQIntValidator(0, 9999, parent, name); + } + + if(key == "Genre") + { + TQStringList l; + TagLib::StringList genres = TagLib::ID3v1::genreList(); + for(TagLib::StringList::ConstIterator it = genres.begin(); it != genres.end(); ++it) + { + l.append(TStringToQString((*it))); + } + return new ComboValidator(l, false, true, parent, name); + } + + return 0; +} + +#include "tdefile_mp3.moc" diff --git a/tdefile-plugins/mp3/tdefile_mp3.desktop b/tdefile-plugins/mp3/tdefile_mp3.desktop new file mode 100644 index 00000000..2f83b875 --- /dev/null +++ b/tdefile-plugins/mp3/tdefile_mp3.desktop @@ -0,0 +1,70 @@ +[Desktop Entry] +Type=Service +Name=MP3 Info +Name[af]=Mp3 Inligting +Name[ar]=معلومات MP3 +Name[bg]=Информация за MP3 +Name[bn]=এম-পি-৩ (MP3) তথ্য +Name[br]=Titouroù MP3 +Name[bs]=MP3 informacije +Name[ca]=Informació MP3 +Name[cs]=MP3 info +Name[cy]=Gwybodaeth MP3 +Name[da]=MP3-info +Name[de]=MP3-Info +Name[el]=Πληροφορίες MP3 +Name[eo]=MP3-informo +Name[es]=Info MP3 +Name[et]=MP3 info +Name[eu]=MP3 informazioa +Name[fa]=اطلاعات MP3 +Name[fi]=MP3-tiedot +Name[fr]=Informations Mpeg3 +Name[gl]=Información MP3 +Name[he]=מידע MP3 +Name[hi]=MP3 जानकारी +Name[hr]=Informacije o MP3 datoteci +Name[hu]=MP3-jellemzők +Name[is]=MP3 upplýsingar +Name[it]=Informazioni MP3 +Name[ja]=MP3 情報 +Name[kk]=MP3 мәліметі +Name[km]=ព័ត៌មាន MP3 +Name[ko]=MP3 정보 +Name[lt]=MP3 informacija +Name[mk]=MP3 информации +Name[nb]=MP3 informasjon +Name[nds]=MP3-Info +Name[ne]=MP3 सूचना +Name[nl]=MP3-informatie +Name[nn]=MP3-info +Name[pa]=MP3 ਜਾਣਕਾਰੀ +Name[pl]=Informacja o pliku MP3 +Name[pt]=Informação do MP3 +Name[pt_BR]=Informações sobre MP3 +Name[ro]=Informaţii MP3 +Name[ru]=Сведения о MP3 +Name[rw]=Amakuru MP3 +Name[se]=MP3-dieđut +Name[sl]=Podatki o MP3 +Name[sr]=Информације о MP3-ју +Name[sr@Latn]=Informacije o MP3-ju +Name[sv]=MP3-information +Name[ta]=MP3 தகவல் +Name[tg]=MP3 Ахборот +Name[th]=ข้อมูล MP3 +Name[tr]=MP3 Bilgisi +Name[uk]=Інформація по MP3 +Name[uz]=MP3 haqida maʼlumot +Name[uz@cyrillic]=MP3 ҳақида маълумот +Name[wa]=Infôrmåcion MP3 +Name[xh]=MP3 ulwazi +Name[zh_CN]=MP3 信息 +Name[zh_HK]=MP3 資訊 +Name[zh_TW]=MP3 資訊 +Name[zu]=Ulwazi lwe-MP3 +ServiceTypes=KFilePlugin +X-TDE-Library=tdefile_mp3 +MimeType=audio/x-mp3 +PreferredGroups=id3,Technical +PreferredItems=Title,Artist,Album,Tracknumber,Genre,Bitrate,Length,Date,Comment,Sample Rate,Channels,Version,Layer,Copyright,Original,CRC diff --git a/tdefile-plugins/mp3/tdefile_mp3.h b/tdefile-plugins/mp3/tdefile_mp3.h new file mode 100644 index 00000000..209c81a6 --- /dev/null +++ b/tdefile-plugins/mp3/tdefile_mp3.h @@ -0,0 +1,42 @@ +/* This file is part of the KDE project + * Copyright (C) 2001, 2002 Rolf Magnus + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation version 2. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +#ifndef __KFILE_MP3_H__ +#define __KFILE_MP3_H__ + +#include + +class TQStringList; + +class KMp3Plugin: public KFilePlugin +{ + Q_OBJECT + + +public: + KMp3Plugin(TQObject *parent, const char *name, const TQStringList &args); + + virtual bool readInfo( KFileMetaInfo& info, uint what ); + virtual bool writeInfo( const KFileMetaInfo& info) const; + virtual TQValidator *createValidator(const TQString &mimetype, + const TQString &group, + const TQString &key, + TQObject *parent, const char *name) const; +}; + +#endif diff --git a/tdefile-plugins/mpc/Makefile.am b/tdefile-plugins/mpc/Makefile.am new file mode 100644 index 00000000..6c1cc840 --- /dev/null +++ b/tdefile-plugins/mpc/Makefile.am @@ -0,0 +1,22 @@ +## Makefile.am for MPC file meta info plugin + +# set the include path for X, qt, KDE and TagLib +INCLUDES = $(all_includes) $(taglib_includes) + +# these are the headers for your project +noinst_HEADERS = tdefile_mpc.h + +kde_module_LTLIBRARIES = tdefile_mpc.la + +tdefile_mpc_la_SOURCES = tdefile_mpc.cpp +tdefile_mpc_la_LDFLAGS = $(all_libraries) $(KDE_RPATH) $(LIB_QT) -lDCOP $(LIB_TDECORE) $(LIB_TDEUI) -ltdefx $(LIB_KIO) -ltdetexteditor $(taglib_libs) -module $(KDE_PLUGIN) +tdefile_mpc_la_LIBADD = $(LIB_KIO) + +# let automoc handle all of the meta source files (moc) +METASOURCES = AUTO + +messages: rc.cpp + $(XGETTEXT) tdefile_mpc.cpp -o $(podir)/tdefile_mpc.pot + +services_DATA = tdefile_mpc.desktop +servicesdir = $(kde_servicesdir) diff --git a/tdefile-plugins/mpc/configure.in.in b/tdefile-plugins/mpc/configure.in.in new file mode 100644 index 00000000..6590e6c5 --- /dev/null +++ b/tdefile-plugins/mpc/configure.in.in @@ -0,0 +1 @@ +AM_CONDITIONAL(include_mpc_SUBDIR, test "x$have_taglib_mpc" = xyes) diff --git a/tdefile-plugins/mpc/tdefile_mpc.cpp b/tdefile-plugins/mpc/tdefile_mpc.cpp new file mode 100644 index 00000000..bc4828fd --- /dev/null +++ b/tdefile-plugins/mpc/tdefile_mpc.cpp @@ -0,0 +1,253 @@ +/* This file is part of the KDE project + * Copyright (C) 2003-2004 Allan Sandfeld Jensen + * + * Originally based upon the tdefile_ogg plugin: + * Copyright (C) 2001, 2002 Rolf Magnus + * Interfacing to TagLib is copied from tdefile_mp3 plugin: + * Copyright (C) 2003 Scott Wheeler + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation version 2. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +#include "tdefile_mpc.h" + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include +#include +#include + +K_EXPORT_COMPONENT_FACTORY(tdefile_mpc, KGenericFactory("tdefile_mpc")) + +KMpcPlugin::KMpcPlugin( TQObject *parent, const char *name, + const TQStringList &args ) + : KFilePlugin( parent, name, args ) +{ + kdDebug(7034) << "mpc plugin\n"; + + KFileMimeTypeInfo* info = addMimeTypeInfo( "audio/x-musepack" ); + + KFileMimeTypeInfo::GroupInfo* group = 0; + + // comment group + group = addGroupInfo(info, "Comment", i18n("Comment")); + setAttributes(group, KFileMimeTypeInfo::Addable | + KFileMimeTypeInfo::Removable); + + KFileMimeTypeInfo::ItemInfo* item = 0; + + item = addItemInfo(group, "Artist", i18n("Artist"), TQVariant::String); + setHint(item, KFileMimeTypeInfo::Author); + setAttributes(item, KFileMimeTypeInfo::Modifiable); + + item = addItemInfo(group, "Title", i18n("Title"), TQVariant::String); + setHint(item, KFileMimeTypeInfo::Name); + setAttributes(item, KFileMimeTypeInfo::Modifiable); + + item = addItemInfo(group, "Album", i18n("Album"), TQVariant::String); + setAttributes(item, KFileMimeTypeInfo::Modifiable); + + item = addItemInfo(group, "Genre", i18n("Genre"), TQVariant::String); + setAttributes(item, KFileMimeTypeInfo::Modifiable); + + item = addItemInfo(group, "Tracknumber", i18n("Track Number"), TQVariant::String); + setAttributes(item, KFileMimeTypeInfo::Modifiable); + + item = addItemInfo(group, "Date", i18n("Date"), TQVariant::String); + setAttributes(item, KFileMimeTypeInfo::Modifiable); + + item = addItemInfo(group, "Description", i18n("Description"), TQVariant::String); + setAttributes(item, KFileMimeTypeInfo::Modifiable); + + item = addItemInfo(group, "Organization", i18n("Organization"), TQVariant::String); + setAttributes(item, KFileMimeTypeInfo::Modifiable); + + item = addItemInfo(group, "Location", i18n("Location"), TQVariant::String); + setAttributes(item, KFileMimeTypeInfo::Modifiable); + + item = addItemInfo(group, "Copyright", i18n("Copyright"), TQVariant::String); + setAttributes(item, KFileMimeTypeInfo::Modifiable); + + + addVariableInfo(group, TQVariant::String, KFileMimeTypeInfo::Addable | + KFileMimeTypeInfo::Removable | + KFileMimeTypeInfo::Modifiable); + + // technical group + group = addGroupInfo(info, "Technical", i18n("Technical Details")); + setAttributes(group, 0); + + addItemInfo(group, "Channels", i18n("Channels"), TQVariant::Int); + + addItemInfo(group, "Version", i18n("Version"), TQVariant::Int); + + item = addItemInfo(group, "Sample Rate", i18n("Sample Rate"), TQVariant::Int); + setSuffix(item, i18n(" Hz")); + + item = addItemInfo(group, "Bitrate", i18n("Average Bitrate"), + TQVariant::Int); + setAttributes(item, KFileMimeTypeInfo::Averaged); + setHint(item, KFileMimeTypeInfo::Bitrate); + setSuffix(item, i18n( " kbps")); + + item = addItemInfo(group, "Length", i18n("Length"), TQVariant::Int); + setAttributes(item, KFileMimeTypeInfo::Cummulative); + setHint(item, KFileMimeTypeInfo::Length); + setUnit(item, KFileMimeTypeInfo::Seconds); +} + +bool KMpcPlugin::readInfo( KFileMetaInfo& info, uint what ) +{ + + bool readComment = false; + bool readTech = false; + if (what & (KFileMetaInfo::Fastest | + KFileMetaInfo::DontCare | + KFileMetaInfo::ContentInfo)) readComment = true; + + if (what & (KFileMetaInfo::Fastest | + KFileMetaInfo::DontCare | + KFileMetaInfo::TechnicalInfo)) readTech = true; + + if ( info.path().isEmpty() ) // remote file + return false; + + TagLib::File *file = new TagLib::MPC::File(TQFile::encodeName(info.path()).data(), readTech); + + if (!file->isOpen()) + { + kdDebug(7034) << "Couldn't open " << file->name() << endl; + delete file; + return false; + } + + if(readComment) + { + KFileMetaInfoGroup commentgroup = appendGroup(info, "Comment"); + + TQString date = file->tag()->year() > 0 ? TQString::number(file->tag()->year()) : TQString(); + TQString track = file->tag()->track() > 0 ? TQString::number(file->tag()->track()) : TQString(); + + appendItem(commentgroup, "Title", TQString(TStringToQString(file->tag()->title())).stripWhiteSpace()); + appendItem(commentgroup, "Artist", TQString(TStringToQString(file->tag()->artist())).stripWhiteSpace()); + appendItem(commentgroup, "Album", TQString(TStringToQString(file->tag()->album())).stripWhiteSpace()); + appendItem(commentgroup, "Date", date); + appendItem(commentgroup, "Comment", TQString(TStringToQString(file->tag()->comment())).stripWhiteSpace()); + appendItem(commentgroup, "Tracknumber", track); + appendItem(commentgroup, "Genre", TQString(TStringToQString(file->tag()->genre())).stripWhiteSpace()); + } + + if (readTech) + { + KFileMetaInfoGroup techgroup = appendGroup(info, "Technical"); + TagLib::MPC::Properties *properties = + (TagLib::MPC::Properties*)(file->audioProperties()); + + appendItem(techgroup, "Bitrate", properties->bitrate()); + appendItem(techgroup, "Sample Rate", properties->sampleRate()); + appendItem(techgroup, "Channels", properties->channels()); + appendItem(techgroup, "Length", properties->length()); + appendItem(techgroup, "Version", properties->mpcVersion()); + } + + delete file; + return true; + +} + +/** + * Do translation between KFileMetaInfo items and TagLib::String in a tidy way. + */ + +class Translator +{ +public: + Translator(const KFileMetaInfo &info) : m_info(info) {} + TagLib::String operator[](const char *key) const + { + return QStringToTString(m_info["Comment"][key].value().toString()); + } + int toInt(const char *key) const + { + return m_info["Comment"][key].value().toInt(); + } +private: + const KFileMetaInfo &m_info; +}; + +bool KMpcPlugin::writeInfo(const KFileMetaInfo& info) const +{ + TagLib::File *file; + + if (!TagLib::File::isWritable(TQFile::encodeName(info.path()).data())) { + kdDebug(7034) << "can't write to " << info.path() << endl; + return false; + } + + file = new TagLib::MPC::File(TQFile::encodeName(info.path()).data(), false); + + if(!file->isOpen()) + { + kdDebug(7034) << "couldn't open " << info.path() << endl; + delete file; + return false; + } + + Translator t(info); + + file->tag()->setTitle(t["Title"]); + file->tag()->setArtist(t["Artist"]); + file->tag()->setAlbum(t["Album"]); + file->tag()->setYear(t.toInt("Date")); + file->tag()->setComment(t["Comment"]); + file->tag()->setTrack(t.toInt("Tracknumber")); + file->tag()->setGenre(t["Genre"]); + + file->save(); + + delete file; + return true; +} + +TQValidator* KMpcPlugin::createValidator( const TQString&, + const TQString &group, const TQString &key, + TQObject* parent, const char* name) const +{ + if(key == "Tracknumber" || key == "Date") + { + return new TQIntValidator(0, 9999, parent, name); + } + else + return new TQRegExpValidator(TQRegExp(".*"), parent, name); +} + +#include "tdefile_mpc.moc" diff --git a/tdefile-plugins/mpc/tdefile_mpc.desktop b/tdefile-plugins/mpc/tdefile_mpc.desktop new file mode 100644 index 00000000..d850fb60 --- /dev/null +++ b/tdefile-plugins/mpc/tdefile_mpc.desktop @@ -0,0 +1,56 @@ +[Desktop Entry] +Type=Service +Name=Musepack Info +Name[bg]=Информация за Musepack +Name[br]=Titouroù Musepack +Name[bs]=Musepack informacije +Name[ca]=Informació Musepack +Name[cs]=Musepack info +Name[de]=Musepack-Info +Name[el]=Πληροφορίες Musepack +Name[eo]=epack-informo +Name[es]=Info Musepack +Name[et]=Musepacki info +Name[eu]=Musepack informazioa +Name[fa]=اطلاعات Musepack +Name[fi]=Musepack-tiedot +Name[fr]=Informations Musepack +Name[ga]=Eolas faoi Musepack +Name[gl]=Información Musepack +Name[he]=מידע Musepack +Name[hu]=Musepack-jellemzők +Name[is]=Musepack upplýsingar +Name[it]=Informazioni Musepack +Name[ja]=Musepack 情報 +Name[kk]=Musepack мәліметі +Name[km]=ព័ត៌មាន Musepack +Name[ko]=Musepack 정보 +Name[lt]=Musepack informacija +Name[mk]=Musepack информации +Name[nb]=Musepack-info +Name[nds]=Musepack-Info +Name[ne]=म्युजप्याक सूचना +Name[nl]=Musepack-informatie +Name[nn]=Musepack-info +Name[pa]=Musepack ਜਾਣਕਾਰੀ +Name[pl]=Informacja Musepack +Name[pt]=Informação do Musepack +Name[pt_BR]=Informações sobre Musepack +Name[ro]=Informaţii Musepack +Name[ru]=Сведения о Musepack +Name[sl]=Podatki o Musepack +Name[sr]=Информације о Musepack-у +Name[sr@Latn]=Informacije o Musepack-u +Name[sv]=Musepack-information +Name[ta]=MP3 தகவல் +Name[th]=ข้อมูล Musepack +Name[tr]=MusePack Bilgisi +Name[uk]=Інформація по Musepack +Name[zh_CN]=Musepack 信息 +Name[zh_HK]=Musepack 資訊 +Name[zh_TW]=Musepack 資訊 +ServiceTypes=KFilePlugin +X-TDE-Library=tdefile_mpc +MimeType=audio/x-musepack +PreferredGroups=Comment,Technical +PreferredItems=Title,Artist,Album,Tracknumber,Genre,Bitrate,Length,Channels, Date,Description,Organization,Location,Copyright diff --git a/tdefile-plugins/mpc/tdefile_mpc.h b/tdefile-plugins/mpc/tdefile_mpc.h new file mode 100644 index 00000000..8b3345ed --- /dev/null +++ b/tdefile-plugins/mpc/tdefile_mpc.h @@ -0,0 +1,49 @@ +/* This file is part of the KDE project + * Copyright (C) 2004 Allan Sandfeld Jensen + * + * Originally based upon the tdefile_ogg plugin: + * Copyright (C) 2001, 2002 Rolf Magnus + * Interfacing to TagLib is copied from tdefile_mp3 plugin: + * Copyright (C) 2003 Scott Wheeler + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation version 2. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +#ifndef __KFILE_MPC_H__ +#define __KFILE_MPC_H__ + +#include + +class TQString; +class TQStringList; + +class KMpcPlugin: public KFilePlugin +{ + Q_OBJECT + + +public: + KMpcPlugin( TQObject *parent, const char *name, const TQStringList& args ); + + virtual bool readInfo( KFileMetaInfo& info, uint what); + virtual bool writeInfo( const KFileMetaInfo& info ) const; + virtual TQValidator* createValidator( const TQString& mimetype, + const TQString &group, + const TQString &key, + TQObject* parent, const char* name) const; +}; + + +#endif diff --git a/tdefile-plugins/mpeg/Makefile.am b/tdefile-plugins/mpeg/Makefile.am new file mode 100644 index 00000000..63fd9460 --- /dev/null +++ b/tdefile-plugins/mpeg/Makefile.am @@ -0,0 +1,22 @@ +## Makefile.am for mpeg file meta info plugin + +# set the include path for X, qt and KDE +INCLUDES = $(all_includes) + +# these are the headers for your project +noinst_HEADERS = tdefile_mpeg.h + +kde_module_LTLIBRARIES = tdefile_mpeg.la + +tdefile_mpeg_la_SOURCES = tdefile_mpeg.cpp +tdefile_mpeg_la_LDFLAGS = $(all_libraries) $(KDE_RPATH) $(LIB_QT) -lDCOP $(LIB_TDECORE) $(LIB_TDEUI) -ltdefx $(LIB_KIO) -ltdetexteditor -module $(KDE_PLUGIN) +tdefile_mpeg_la_LIBADD = $(LIB_KIO) + +# let automoc handle all of the meta source files (moc) +METASOURCES = AUTO + +messages: rc.cpp + $(XGETTEXT) tdefile_mpeg.cpp -o $(podir)/tdefile_mpeg.pot + +services_DATA = tdefile_mpeg.desktop +servicesdir = $(kde_servicesdir) diff --git a/tdefile-plugins/mpeg/tdefile_mpeg.cpp b/tdefile-plugins/mpeg/tdefile_mpeg.cpp new file mode 100644 index 00000000..fd015422 --- /dev/null +++ b/tdefile-plugins/mpeg/tdefile_mpeg.cpp @@ -0,0 +1,582 @@ +/* This file is part of the KDE project + * Copyright (C) 2005 Allan Sandfeld Jensen + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation version 2. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + */ + +// MPEG KFile plugin +// Based on reading sourcecode of mpeglib, xinelib and libmpeg3 +// and studying MPEG dumps. + +#include +#include "tdefile_mpeg.h" + +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +// #include + +typedef unsigned char uint8_t; +typedef unsigned short uint16_t; +typedef unsigned int uint32_t; + +typedef KGenericFactory MpegFactory; + +K_EXPORT_COMPONENT_FACTORY(tdefile_mpeg, MpegFactory( "tdefile_mpeg" )) + +KMpegPlugin::KMpegPlugin(TQObject *parent, const char *name, + const TQStringList &args) + + : KFilePlugin(parent, name, args) +{ + KFileMimeTypeInfo* info = addMimeTypeInfo( "video/mpeg" ); + + KFileMimeTypeInfo::GroupInfo* group = 0L; + + group = addGroupInfo(info, "Technical", i18n("Technical Details")); + + KFileMimeTypeInfo::ItemInfo* item; + + item = addItemInfo(group, "Length", i18n("Length"), TQVariant::Int); + setUnit(item, KFileMimeTypeInfo::Seconds); + + item = addItemInfo(group, "Resolution", i18n("Resolution"), TQVariant::Size); + + item = addItemInfo(group, "Frame rate", i18n("Frame Rate"), TQVariant::Double); + setSuffix(item, i18n("fps")); + + item = addItemInfo(group, "Video codec", i18n("Video Codec"), TQVariant::String); + item = addItemInfo(group, "Audio codec", i18n("Audio Codec"), TQVariant::String); + + item = addItemInfo(group, "Aspect ratio", i18n("Aspect ratio"), TQVariant::String); +} + +// Frame-rate table from libmpeg3 +float frame_rate_table[16] = +{ + 0.0, /* Pad */ + (float)24000.0/1001.0, /* Official frame rates */ + (float)24.0, + (float)25.0, + (float)30000.0/1001.0, + (float)30.0, + (float)50.0, + (float)60000.0/1001.0, + (float)60.0, + + 1, /* Unofficial economy rates */ + 5, + 10, + 12, + 15, + 0, + 0, +}; + +/* Bitrate indexes */ +int bitrate_123[3][16] = + { {0,32,64,96,128,160,192,224,256,288,320,352,384,416,448,}, + {0,32,48,56, 64, 80, 96,112,128,160,192,224,256,320,384,}, + {0,32,40,48, 56, 64, 80, 96,112,128,160,192,224,256,320,} }; + +static const uint16_t sequence_start = 0x01b3; +static const uint16_t ext_sequence_start = 0x01b5; +static const uint16_t gop_start = 0x01b8; +static const uint16_t audio1_packet = 0x01c0; +static const uint16_t audio2_packet = 0x01d0; +static const uint16_t private1_packet = 0x01bd; +static const uint16_t private2_packet = 0x01bf; + +int KMpegPlugin::parse_seq() { + uint32_t buf; + dstream >> buf; + + horizontal_size = (buf >> 20); + vertical_size = (buf >> 8) & ((1<<12)-1); + aspect_ratio = (buf >> 4) & ((1<<4)-1); + int framerate_code = buf & ((1<<4)-1); + frame_rate = frame_rate_table[framerate_code]; + + dstream >> buf; + + bitrate = (buf >> 14); +// kdDebug(7034) << "bitrate: " << bitrate << endl; + bool has_intra_matrix = buf & 2; + bool has_non_intra_matrix = buf & 1; + + int matrix = 0; + if (has_intra_matrix) matrix +=64; + if (has_non_intra_matrix) matrix +=64; + + mpeg = 1; + return matrix; +} + +void KMpegPlugin::parse_seq_ext() { + uint32_t buf; + dstream >> buf; + + uint8_t type = buf >> 28; + if (type == 1) + mpeg = 2; + + /* + else + if (type == 2) { + dstream >> buf; + // These are display-sizes. I let them override physical sizes. + horizontal_size = (buf >> 18); + vertical_size = (buf >> 1) & ((1<<14)-1); +} */ +} + +long KMpegPlugin::parse_gop() { + uint32_t buf; + dstream >> buf; + dstream >> buf; + + int gop_hour = (buf>>26) & ((1<<5)-1); + kdDebug(7034) << "gop_hour: " << gop_hour << endl; + int gop_minute = (buf>>20) & ((1<<6)-1); + kdDebug(7034) << "gop_minute: " << gop_minute << endl; + int gop_second = (buf>>13) & ((1<<6)-1); + kdDebug(7034) << "gop_second: " << gop_second << endl; + int gop_frame = (buf>>7) & ((1<<6)-1); + kdDebug(7034) << "gop_frame: " << gop_frame << endl; + + long seconds = gop_hour*60*60 + gop_minute*60 + gop_second; + return (long)seconds; +} + +int KMpegPlugin::parse_audio() { + uint16_t len; + dstream >> len; +// kdDebug(7034) << "Length of audio packet: " << len << endl; + + uint8_t buf; + int i = 0; + for(i=0; i<20; i++) { + dstream >> buf; + if (buf == 0xff) { + dstream >> buf; + if ((buf & 0xe0) == 0xe0) + goto found_sync; + } + } + kdDebug(7034) << "MPEG audio sync not found" << endl; + return len-i; + +found_sync: + + int layer = ((buf >> 1) & 0x3); + if (layer == 1) + audio_type = 3; + else if (layer == 2) + audio_type = 2; + else if (layer == 3) + audio_type = 1; + else + kdDebug(7034) << "Invalid MPEG audio layer" << endl; + + dstream >> buf; + int bitrate_index = (buf & 0xf0) >> 4; + audio_rate = bitrate_123[3-layer][bitrate_index]; + + return len-3-i; +} + +int KMpegPlugin::skip_packet() { + uint16_t len; + dstream >> len; +// kdDebug(7034) << "Length of skipped packet: " << len << endl; + + return len; +} + +int KMpegPlugin::skip_riff_chunk() { + dstream.setByteOrder(TQDataStream::LittleEndian); + uint32_t len; + dstream >> len; +// std::cerr << "Length of skipped chunk: " << len << std::endl; + + dstream.setByteOrder(TQDataStream::BigEndian); + return len; +} + +int KMpegPlugin::parse_private() { + uint16_t len; + dstream >> len; +// kdDebug(7034) << "Length of private packet: " << len << endl; + + // Match AC3 packets + uint8_t subtype; + dstream >> subtype; + subtype = subtype >> 4; + if (subtype == 8) // AC3 + audio_type = 5; + else + if (subtype == 10) // LPCM + audio_type = 7; + + return len-1; +} + +bool KMpegPlugin::find_mpeg_in_cdxa() +{ + int skip_len = 0; + uint32_t magic; + uint32_t data_len; + // search for data chunk + while (true) { + dstream >> magic; + if (magic != 0x64617461) { // "fmt " + skip_len = skip_riff_chunk(); + if (!file.at(file.at()+skip_len)) return false; + continue; + } else { + // size of chunk + dstream >> data_len; + int block = 0; + // search for mpeg part + while(block < 32) { + // check for CDXA sync thingy + dstream >> magic; + // 00 ff ff ff ff ff ff ff ff ff ff ff 00 + if (magic == 0x00ffffff) { +// std::cerr << "Found CD sync" << std::endl; + // skip 20 bytes + if (!file.at(file.at()+20)) return false; + dstream >> magic; + if (magic == 0x000001ba) { +// std::cerr << "Found CDXA mpeg" << std::endl; + return true; + } + else { +// std::cerr << "CDXA block: #" <> magic; + if (magic == 0x52494646) // == "RIFF" + { + dstream >> magic; + dstream >> magic; + if (magic != 0x43445841) { // 0x43445841 == "CDXA" + kdDebug(7034) << "Unknown RIFF file" << endl; + return false; + } else { + if (!find_mpeg_in_cdxa()) return false; + } + } + else + if (magic != 0x000001ba) { + kdDebug(7034) << "Not a MPEG-PS file" << endl; + return false; + } +// file.at(0); + + uint8_t byte; + int skip_len = 0; + int state = 0; + int skimmed = 0; + int video_len = 0; + int searched = 0; + bool video_found = false, audio_found = false, gop_found = false; + // Search for MPEG packets + for(int i=0; i < 2048; i++) { + dstream >> byte; + skimmed++; + searched++; + if (video_len > 0) video_len--; + // Use a fast state machine to find 00 00 01 sync code + switch (state) { + case 0: + if (byte == 0) + state = 1; + else + state = 0; + break; + case 1: + if (byte == 0) + state = 2; + else + state = 0; + break; + case 2: + if (byte == 0) + state = 2; + else + if (byte == 1) + state = 3; + else + state = 0; + break; + case 3: { + skimmed -= 4; + if (skimmed) { +// kdDebug(7034) << "Bytes skimmed:" << skimmed << endl; + skimmed = 0; + } +// kdDebug(7034) << "Packet of type:" << TQString::number(byte,16) << endl; + switch (byte) { + case 0xb3: + if (video_found) break; + skip_len = parse_seq(); + video_found = true; + video_len -= 8; + video_len -= skip_len; + break; + case 0xb5: + parse_seq_ext(); + video_len -= 4; + break; + case 0xb8: + /* + if (!gop_found) { + start_time = parse_gop(); + gop_found = true; + kdDebug(7034) << "start_time: " << start_time << endl; + } + */ + /* nobreak */ + case 0x00: + case 0x01: + // skip the rest of the video data + if (video_len > 0 && video_found) + skip_len = video_len; + break; + /* + case 0xb2: + skip_len = parse_user(); + break; + */ + case 0xba: + skip_len = 8; + break; + case 0xbe: + // padding + skip_len = skip_packet(); + break; + case 0xe0: + // video data + if (video_found) + skip_len = skip_packet(); + else + video_len = skip_packet(); + break; + case 0xbd: + case 0xbf: + skip_len = parse_private(); + break; + case 0xc0: + case 0xd0: + skip_len = parse_audio(); + audio_found = true; + break; + default: +// kdDebug(7034) << "Unhandled packet of type:" << TQString::number(byte,16) << endl; + break; + } + state = 0; + break; + } + } + + if (video_found && audio_found /*&& gop_found*/) break; + if (skip_len) { + if (!file.at(file.at()+skip_len)) + return false; + searched += skip_len; + skip_len = 0; + } + } + /* + if (skimmed) + kdDebug(7034) << "Bytes skimmed:" << skimmed << endl; + kdDebug(7034) << "Bytes searched:" << searched << endl; + */ + + if (mpeg == 0) { + kdDebug(7034) << "No sequence-start found" << endl; + return false; + } + return true; +} + +// Search for the last GOP packet and read the time field +void KMpegPlugin::read_length() +{ + end_time = 0; + uint8_t byte; + int state = 0; + // Search for the last gop + file.at(file.size()-1024); + for(int j=1; j<64; j++) { +// dstream.setDevice(&file); +// dstream.setByteOrder(TQDataStream::BigEndian); + for(int i=0; i<1024; i++) { + dstream >> byte; + switch (state) { + case 0: + if (byte == 0) + state = 1; + else + state = 0; + break; + case 1: + if (byte == 0) + state = 2; + else + state = 0; + case 2: + if (byte == 0) + state = 2; + else + if (byte == 1) + state = 3; + else + state = 0; + case 3: + if (byte == 0xb8) { + end_time = parse_gop(); + kdDebug(7034) << "end_time: " << end_time << endl; + return; + } + state = 0; + } + } + state = 0; + file.at(file.size()-j*1024); + } + kdDebug(7034) << "No end GOP found" << endl; +} + +bool KMpegPlugin::readInfo( KFileMetaInfo& info, uint /*what*/) +{ + if ( info.path().isEmpty() ) // remote file + return false; + + file.setName(info.path()); + + // open file, set up stream and set endianness + if (!file.open(IO_ReadOnly)) + { + kdDebug(7034) << "Couldn't open " << TQFile::encodeName(info.path()).data() << endl; + return false; + } + + dstream.setDevice(&file); + dstream.setByteOrder(TQDataStream::BigEndian); + + start_time = end_time = 0L; + + if (!read_mpeg()) { + kdDebug(7034) << "read_mpeg() failed!" << endl; + } + else { + KFileMetaInfoGroup group = appendGroup(info, "Technical"); + + appendItem(group, "Frame rate", double(frame_rate)); + + appendItem(group, "Resolution", TQSize(horizontal_size, vertical_size)); + /* The GOP timings are completely bogus + read_length(); + if (end_time != 0) { + //long total_frames = end_time-start_time + 1; + long total_time = end_time; + appendItem(group, "Length", int(total_time)); + } + // and so is bitrate + long total_time = file.size()/((bitrate+audio_rate)*50); + appendItem(group, "Length", int(total_time)); + */ + if (mpeg == 1) + appendItem(group, "Video codec", "MPEG-1"); + else + appendItem(group, "Video codec", "MPEG-2"); + + switch (audio_type) { + case 1: + appendItem(group, "Audio codec", "MP1"); + break; + case 2: + appendItem(group, "Audio codec", "MP2"); + break; + case 3: + appendItem(group, "Audio codec", "MP3"); + break; + case 5: + appendItem(group, "Audio codec", "AC3"); + break; + case 7: + appendItem(group, "Audio codec", "PCM"); + break; + default: + appendItem(group, "Audio codec", i18n("Unknown")); + } + // MPEG 1 also has an aspect ratio setting, but it works differently, + // and I am not sure if it is used. + if (mpeg == 2) { + switch (aspect_ratio) { + case 1: + appendItem(group, "Aspect ratio", i18n("default")); + break; + case 2: + appendItem(group, "Aspect ratio", "4/3"); + break; + case 3: + appendItem(group, "Aspect ratio", "16/9"); + break; + case 4: + appendItem(group, "Aspect ratio", "2.11/1"); + break; + } + } + } + + file.close(); + return true; +} + +#include "tdefile_mpeg.moc" diff --git a/tdefile-plugins/mpeg/tdefile_mpeg.desktop b/tdefile-plugins/mpeg/tdefile_mpeg.desktop new file mode 100644 index 00000000..20dfe243 --- /dev/null +++ b/tdefile-plugins/mpeg/tdefile_mpeg.desktop @@ -0,0 +1,55 @@ +[Desktop Entry] +Type=Service +Name=MPEG Info +Name[bg]=Информация за MPEG +Name[bn]=এম-পেগ তথ্য +Name[br]=Titouroù MPEG +Name[bs]=MPEG informacije +Name[ca]=Informació MPEG +Name[cs]=MPEG info +Name[da]=MPEG-info +Name[de]=MPEG-Info +Name[el]=Πληροφορίες MPEG +Name[eo]=MPEG-informo +Name[es]=Info MPEG +Name[et]=MPEG info +Name[eu]=MPEG informazioa +Name[fa]=اطلاعات MPEG +Name[fi]=MPEG-tiedot +Name[fr]=Informations MPEG +Name[ga]=Eolas MPEG +Name[gl]=Información MPEG +Name[he]=מידע MPEG +Name[hu]=MPEG-jellemzők +Name[is]=MPEG upplýsingar +Name[it]=Informazioni MPEG +Name[ja]=MPEG 情報 +Name[kk]=MPEG мәліметі +Name[km]=ព័ត៌មាន MPEG +Name[ko]=MPEG 정보 +Name[lt]=MPEG informacija +Name[nb]=MPEG informasjon +Name[nds]=MPEG-Info +Name[ne]=एमपीईजी सूचना +Name[nl]=MPEG-info +Name[nn]=MPEG-info +Name[pa]=MPEG ਜਾਣਕਾਰੀ +Name[pl]=Informacja o pliku MPEG +Name[pt]=Informação do MPEG +Name[pt_BR]=Informações sobre MPEG +Name[ru]=Сведения о MPEG +Name[sl]=Podatki o MPEG +Name[sr]=Информације о MPEG-у +Name[sr@Latn]=Informacije o MPEG-u +Name[sv]=MPEG-information +Name[th]=ข้อมูล MPEG +Name[tr]=MP3 Bilgisi +Name[uk]=Інформація про MPEG +Name[zh_CN]=MPEG 信息 +Name[zh_HK]=MPEG 資訊 +Name[zh_TW]=MPEG 資訊 +ServiceTypes=KFilePlugin +X-TDE-Library=tdefile_mpeg +MimeType=video/mpeg +PreferredGrous=Technical +PreferredItems=Length,Resolution,Frame rate,Video codec,Audio codec diff --git a/tdefile-plugins/mpeg/tdefile_mpeg.h b/tdefile-plugins/mpeg/tdefile_mpeg.h new file mode 100644 index 00000000..13035837 --- /dev/null +++ b/tdefile-plugins/mpeg/tdefile_mpeg.h @@ -0,0 +1,71 @@ +/* This file is part of the KDE project + * Copyright (C) 2005 Allan Sandfeld Jensen + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation version 2. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + */ + +#ifndef __KFILE_MPEG_H__ +#define __KFILE_MPEG_H__ + +#include +#include + +class TQStringList; + +class KMpegPlugin: public KFilePlugin +{ + Q_OBJECT + + +public: + KMpegPlugin( TQObject *parent, const char *name, const TQStringList& args ); + + virtual bool readInfo( KFileMetaInfo& info, uint what); + +private: + int parse_seq(); + void parse_seq_ext(); + long parse_gop(); + int parse_audio(); + int parse_private(); + int skip_packet(); + int skip_riff_chunk(); + bool find_mpeg_in_cdxa(); + + bool read_mpeg(); + void read_length(); + + TQFile file; + TQDataStream dstream; + + // MPEG information + int horizontal_size; + int vertical_size; + int aspect_ratio; + int bitrate; + float frame_rate; + + int mpeg; + int audio_type; + int audio_rate; + + long start_time; + long end_time; + + +}; + +#endif diff --git a/tdefile-plugins/ogg/Makefile.am b/tdefile-plugins/ogg/Makefile.am new file mode 100644 index 00000000..a6590beb --- /dev/null +++ b/tdefile-plugins/ogg/Makefile.am @@ -0,0 +1,22 @@ +## Makefile.am for ogg/vorbis file meta info plugin + +# set the include path for X, qt and KDE +INCLUDES = $(all_includes) + +# these are the headers for your project +noinst_HEADERS = tdefile_ogg.h + +kde_module_LTLIBRARIES = tdefile_ogg.la + +tdefile_ogg_la_SOURCES = tdefile_ogg.cpp vcedit.c +tdefile_ogg_la_LDFLAGS = $(all_libraries) $(KDE_RPATH) $(LIB_QT) -lDCOP $(LIB_TDECORE) $(LIB_TDEUI) -ltdefx $(LIB_KIO) -ltdetexteditor -module $(KDE_PLUGIN) +tdefile_ogg_la_LIBADD = $(LIB_KIO) -logg -lvorbis -lvorbisfile + +# let automoc handle all of the meta source files (moc) +METASOURCES = AUTO + +messages: rc.cpp + $(XGETTEXT) tdefile_ogg.cpp -o $(podir)/tdefile_ogg.pot + +services_DATA = tdefile_ogg.desktop +servicesdir = $(kde_servicesdir) diff --git a/tdefile-plugins/ogg/configure.in.in b/tdefile-plugins/ogg/configure.in.in new file mode 100644 index 00000000..35218d34 --- /dev/null +++ b/tdefile-plugins/ogg/configure.in.in @@ -0,0 +1 @@ +AM_CONDITIONAL(include_ogg_SUBDIR, test "x$have_oggvorbis" = xyes) diff --git a/tdefile-plugins/ogg/tdefile_ogg.cpp b/tdefile-plugins/ogg/tdefile_ogg.cpp new file mode 100644 index 00000000..b141acb1 --- /dev/null +++ b/tdefile-plugins/ogg/tdefile_ogg.cpp @@ -0,0 +1,357 @@ +/* This file is part of the KDE project + * Copyright (C) 2001, 2002 Rolf Magnus + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation version 2. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + * $Id$ + */ + +#include "tdefile_ogg.h" +#include "vcedit.h" + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include +#include + +// known translations for common ogg/vorbis keys +// from http://www.ogg.org/ogg/vorbis/doc/v-comment.html +static const char* const knownTranslations[] = { + I18N_NOOP("Title"), + I18N_NOOP("Version"), + I18N_NOOP("Album"), + I18N_NOOP("Tracknumber"), + I18N_NOOP("Artist"), + I18N_NOOP("Organization"), + I18N_NOOP("Description"), + I18N_NOOP("Genre"), + I18N_NOOP("Date"), + I18N_NOOP("Location"), + I18N_NOOP("Copyright") +// I18N_NOOP("Isrc") // dunno what an Isrc number is, the link is broken +}; + +K_EXPORT_COMPONENT_FACTORY(tdefile_ogg, KGenericFactory("tdefile_ogg")) + +KOggPlugin::KOggPlugin( TQObject *parent, const char *name, + const TQStringList &args ) + : KFilePlugin( parent, name, args ) +{ + kdDebug(7034) << "ogg plugin\n"; + + KFileMimeTypeInfo* info = addMimeTypeInfo( "audio/vorbis" ); + + KFileMimeTypeInfo::GroupInfo* group = 0; + + // comment group + group = addGroupInfo(info, "Comment", i18n("Comment")); + setAttributes(group, KFileMimeTypeInfo::Addable | + KFileMimeTypeInfo::Removable); + + KFileMimeTypeInfo::ItemInfo* item = 0; + + item = addItemInfo(group, "Artist", i18n("Artist"), TQVariant::String); + setHint(item, KFileMimeTypeInfo::Author); + setAttributes(item, KFileMimeTypeInfo::Modifiable); + + item = addItemInfo(group, "Title", i18n("Title"), TQVariant::String); + setHint(item, KFileMimeTypeInfo::Name); + setAttributes(item, KFileMimeTypeInfo::Modifiable); + + item = addItemInfo(group, "Album", i18n("Album"), TQVariant::String); + setAttributes(item, KFileMimeTypeInfo::Modifiable); + + item = addItemInfo(group, "Genre", i18n("Genre"), TQVariant::String); + setAttributes(item, KFileMimeTypeInfo::Modifiable); + + item = addItemInfo(group, "Tracknumber", i18n("Track Number"), TQVariant::String); + setAttributes(item, KFileMimeTypeInfo::Modifiable); + + item = addItemInfo(group, "Date", i18n("Date"), TQVariant::String); + setAttributes(item, KFileMimeTypeInfo::Modifiable); + + item = addItemInfo(group, "Description", i18n("Description"), TQVariant::String); + setAttributes(item, KFileMimeTypeInfo::Modifiable); + + item = addItemInfo(group, "Organization", i18n("Organization"), TQVariant::String); + setAttributes(item, KFileMimeTypeInfo::Modifiable); + + item = addItemInfo(group, "Location", i18n("Location"), TQVariant::String); + setAttributes(item, KFileMimeTypeInfo::Modifiable); + + item = addItemInfo(group, "Copyright", i18n("Copyright"), TQVariant::String); + setAttributes(item, KFileMimeTypeInfo::Modifiable); + + + addVariableInfo(group, TQVariant::String, KFileMimeTypeInfo::Addable | + KFileMimeTypeInfo::Removable | + KFileMimeTypeInfo::Modifiable); + + // technical group + + group = addGroupInfo(info, "Technical", i18n("Technical Details")); + setAttributes(group, 0); + + addItemInfo(group, "Version", i18n("Version"), TQVariant::Int); + addItemInfo(group, "Channels", i18n("Channels"), TQVariant::Int); + + item = addItemInfo(group, "Sample Rate", i18n("Sample Rate"), TQVariant::Int); + setSuffix(item, i18n(" Hz")); + + item = addItemInfo(group, "UpperBitrate", i18n("Upper Bitrate"), + TQVariant::Int); + setSuffix(item, i18n(" kbps")); + + item = addItemInfo(group, "LowerBitrate", i18n("Lower Bitrate"), + TQVariant::Int); + setSuffix(item, i18n(" kbps")); + + item = addItemInfo(group, "NominalBitrate", i18n("Nominal Bitrate"), + TQVariant::Int); + setSuffix(item, i18n(" kbps")); + + item = addItemInfo(group, "Bitrate", i18n("Average Bitrate"), + TQVariant::Int); + setAttributes(item, KFileMimeTypeInfo::Averaged); + setHint(item, KFileMimeTypeInfo::Bitrate); + setSuffix(item, i18n( " kbps")); + + item = addItemInfo(group, "Length", i18n("Length"), TQVariant::Int); + setAttributes(item, KFileMimeTypeInfo::Cummulative); + setUnit(item, KFileMimeTypeInfo::Seconds); +} + +bool KOggPlugin::readInfo( KFileMetaInfo& info, uint what ) +{ + // parts of this code taken from ogginfo.c of the vorbis-tools v1.0rc2 + FILE *fp; + OggVorbis_File vf; + int rc,i; + vorbis_comment *vc; + vorbis_info *vi; + + bool readComment = false; + bool readTech = false; + if (what & (KFileMetaInfo::Fastest | + KFileMetaInfo::DontCare | + KFileMetaInfo::ContentInfo)) readComment = true; + + if (what & (KFileMetaInfo::Fastest | + KFileMetaInfo::DontCare | + KFileMetaInfo::TechnicalInfo)) readTech = true; + + memset(&vf, 0, sizeof(OggVorbis_File)); + + if ( info.path().isEmpty() ) // remote file + return false; + + fp = fopen(TQFile::encodeName(info.path()),"rb"); + if (!fp) + { + kdDebug(7034) << "Unable to open " << TQFile::encodeName(info.path()).data() << endl; + return false; + } + + rc = ov_open(fp,&vf,NULL,0); + + if (rc < 0) + { + kdDebug(7034) << "Unable to understand " << TQFile::encodeName(info.path()).data() + << ", errorcode=" << rc << endl; + return false; + } + +// info.insert(KFileMetaInfoItem("Vendor", i18n("Vendor"), +// TQVariant(TQString(vi->vendor)))); + + // get the vorbis comments + if (readComment) + { + vc = ov_comment(&vf,-1); + + KFileMetaInfoGroup commentGroup = appendGroup(info, "Comment"); + + for (i=0; i < vc->comments; i++) + { + kdDebug(7034) << vc->user_comments[i] << endl; + TQStringList split = TQStringList::split("=", TQString::fromUtf8(vc->user_comments[i])); + split[0] = split[0].lower(); + split[0][0] = split[0][0].upper(); + + // we have to be sure that the i18n() string always has the same + // case. Oh, and is UTF8 ok here? + appendItem(commentGroup, split[0], split[1]); + } + } + + if (readTech) + { + KFileMetaInfoGroup techgroup = appendGroup(info, "Technical"); + // get other information about the file + vi = ov_info(&vf,-1); + if (vi) + { + + appendItem(techgroup, "Version", int(vi->version)); + appendItem(techgroup, "Channels", int(vi->channels)); + appendItem(techgroup, "Sample Rate", int(vi->rate)); + + if (vi->bitrate_upper > 0) + appendItem(techgroup, "UpperBitrate", + int(vi->bitrate_upper+500)/1000); + if (vi->bitrate_lower > 0) + appendItem(techgroup, "LowerBitrate", + int(vi->bitrate_lower+500)/1000); + if (vi->bitrate_nominal > 0) + appendItem(techgroup, "NominalBitrate", + int(vi->bitrate_nominal+500)/1000); + + if (ov_bitrate(&vf,-1) > 0) + appendItem(techgroup, "Bitrate", int(ov_bitrate(&vf,-1)+500)/1000); + + } + + appendItem(techgroup, "Length", int(ov_time_total(&vf,-1))); + } + + ov_clear(&vf); + + return true; +} + +bool KOggPlugin::writeInfo(const KFileMetaInfo& info) const +{ + // todo: add writing support + FILE* infile; + + infile = fopen(TQFile::encodeName(info.path()), "r"); + + if (!infile) + { + kdDebug(7034) << "couldn't open " << info.path() << endl; + return false; + } + + vcedit_state *state=vcedit_new_state(); + + if ( vcedit_open(state, infile)==-1 ) + { + kdDebug(7034) << "error in vcedit_open for " << info.path() << endl; + return false; + } + + struct vorbis_comment* oc = vcedit_comments(state); + struct vorbis_comment* vc = state->vc; + + if(vc) vorbis_comment_clear(vc); + + if (oc && oc->vendor) + { + vc->vendor = strdup(oc->vendor); + } + else + { + vc->vendor = strdup(""); + } + + KFileMetaInfoGroup group = info["Comment"]; + + TQStringList keys = group.keys(); + TQStringList::Iterator it; + for (it = keys.begin(); it!=keys.end(); ++it) + { + KFileMetaInfoItem item = group[*it]; + + if (!item.isEditable() || !(item.type()==TQVariant::String) ) + continue; + + TQCString key = item.key().upper().utf8(); + if (item.value().canCast(TQVariant::String)) + { + TQCString value = item.value().toString().utf8(); + + kdDebug(7034) << " writing tag " << key << "=" << value << endl; + + vorbis_comment_add_tag(vc, + const_cast(static_cast(key)), + const_cast(static_cast(value))); + } + else + kdWarning(7034) << "ignoring " << key << endl; + + } + + TQString filename; + + TQFileInfo fileinfo(info.path()); + + // follow symlinks + if (fileinfo.isSymLink()) + filename = fileinfo.readLink(); + else + filename = info.path(); + + // nothing in TQt or KDE to get the mode as an int? + struct stat s; + stat(TQFile::encodeName(filename), &s); + + KSaveFile sf(filename, s.st_mode); + FILE* outfile = sf.fstream(); + + if ( sf.status() || !outfile) + { + kdDebug(7034) << "couldn't create temp file\n"; + vcedit_clear(state); // frees comment entries and vendor + sf.abort(); + if (vc->vendor) free(vc->vendor); + vc->vendor = 0; + return false; + } + + + vcedit_write(state,outfile); // calls vcedit_clear() itself so we don't free anything + + if (vc->vendor) free(vc->vendor); + vc->vendor = 0; + + fclose(infile); + sf.close(); + + return true; +} + +TQValidator* KOggPlugin::createValidator( const TQString&, + const TQString &, const TQString &, + TQObject* parent, const char* name) const { + return new TQRegExpValidator(TQRegExp(".*"), parent, name); +} + +#include "tdefile_ogg.moc" diff --git a/tdefile-plugins/ogg/tdefile_ogg.desktop b/tdefile-plugins/ogg/tdefile_ogg.desktop new file mode 100644 index 00000000..9cc7fe6e --- /dev/null +++ b/tdefile-plugins/ogg/tdefile_ogg.desktop @@ -0,0 +1,68 @@ +[Desktop Entry] +Type=Service +Name=OGG Info +Name[af]=Ogg Inligting +Name[ar]=معلومات OGG +Name[bg]=Информация за OGG +Name[bn]=অগ তথ্য +Name[br]=Titouroù OGG +Name[bs]=OGG informacije +Name[ca]=Informació OGG +Name[cs]=OGG info +Name[cy]=Gwybodaeth OGG +Name[da]=OGG-info +Name[de]=OGG-Info +Name[el]=Πληροφορίες OGG +Name[eo]=OGG-informo +Name[es]=Info OGG +Name[et]=OGG info +Name[eu]=OGG informazioa +Name[fa]=اطلاعات OGG +Name[fi]=OGG-tiedot +Name[fr]=Informations Ogg Vorbis +Name[gl]=Información OGG +Name[he]=מידע OGG +Name[hi]=OGG जानकारी +Name[hr]=Informacije o OGG datoteci +Name[hu]=OGG-jellemzők +Name[is]=OGG upplýsingar +Name[it]=Informazioni OGG +Name[ja]=OGG 情報 +Name[kk]=OGG мәліметі +Name[km]=ព័ត៌មាន OGG +Name[ko]=OGG 정보 +Name[lt]=OGG informacija +Name[mk]=OGG информации +Name[nb]=OGG informasjon +Name[nds]=Ogg-Info +Name[ne]=अग सूचना +Name[nl]=OGG-informatie +Name[nn]=OGG-info +Name[pa]=OGG ਜਾਣਕਾਰੀ +Name[pl]=Informacja o pliku OGG +Name[pt]=Informação do OGG +Name[pt_BR]=Informação sobre OGG +Name[ro]=Informaţii OGG +Name[ru]=Сведения о OGG +Name[se]=OGG-dieđut +Name[sl]=Podatki o OGG +Name[sr]=Информације о OGG-у +Name[sr@Latn]=Informacije o OGG-u +Name[sv]=Ogg-information +Name[ta]=OGG தகவல் +Name[tg]=OGG Ахборот +Name[th]=ข้อมูล OGG +Name[tr]=OGG Bilgisi +Name[uk]=Інформація по OGG +Name[uz]=OGG haqida maʼlumot +Name[uz@cyrillic]=OGG ҳақида маълумот +Name[xh]=OGG Ulwazi +Name[zh_CN]=OGG 信息 +Name[zh_HK]=OGG 資訊 +Name[zh_TW]=OGG 資訊 +Name[zu]=Ulwazi lwe OGG +ServiceTypes=KFilePlugin +X-TDE-Library=tdefile_ogg +MimeType=audio/vorbis +PreferredGroups=Comment,Technical +PreferredItems=Title,Artist,Album,Tracknumber,Genre,Bitrate,Length,Date,Description,Organization,Channels,UpperBitrate,LowerBitrate,NominalBitrate,Location,Copyright,Version diff --git a/tdefile-plugins/ogg/tdefile_ogg.h b/tdefile-plugins/ogg/tdefile_ogg.h new file mode 100644 index 00000000..0737dff7 --- /dev/null +++ b/tdefile-plugins/ogg/tdefile_ogg.h @@ -0,0 +1,46 @@ +/* This file is part of the KDE project + * Copyright (C) 2001, 2002 Rolf Magnus + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation version 2. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + * $Id$ + */ + +#ifndef __KFILE_OGG_H__ +#define __KFILE_OGG_H__ + +#include + +class TQString; +class TQStringList; + +class KOggPlugin: public KFilePlugin +{ + Q_OBJECT + + +public: + KOggPlugin( TQObject *parent, const char *name, const TQStringList& args ); + + virtual bool readInfo( KFileMetaInfo& info, uint what); + virtual bool writeInfo( const KFileMetaInfo& info ) const; + virtual TQValidator* createValidator( const TQString& mimetype, + const TQString &group, + const TQString &key, + TQObject* parent, const char* name) const; +}; + + +#endif diff --git a/tdefile-plugins/ogg/vcedit.c b/tdefile-plugins/ogg/vcedit.c new file mode 100644 index 00000000..76e31f6c --- /dev/null +++ b/tdefile-plugins/ogg/vcedit.c @@ -0,0 +1,331 @@ +/* This program is licensed under the GNU Library General Public License, version 2 + * + * (c) 2000-2001 Michael Smith + * + * Modified by Warren Spits + * - Handles vorbis files that are truncated or missing an eos flag. + * + * Comment editing backend, suitable for use by nice frontend interfaces. + * + * last modified: $Id$ + */ + +#include +#include +#include +#include +#include + +#include "vcedit.h" + +#define CHUNKSIZE 4096 + +vcedit_state *vcedit_new_state(void) +{ + vcedit_state *state = malloc(sizeof(vcedit_state)); + memset(state, 0, sizeof(vcedit_state)); + + return state; +} + +char *vcedit_error(vcedit_state *state) +{ + return state->lasterror; +} + +vorbis_comment *vcedit_comments(vcedit_state *state) +{ + return state->vc; +} + +static void vcedit_clear_internals(vcedit_state *state) +{ + if(state->vc) + { + vorbis_comment_clear(state->vc); + free(state->vc); + state->vc=NULL; + } + if(state->os) + { + ogg_stream_clear(state->os); + free(state->os); + state->os=NULL; + } + if(state->oy) + { + ogg_sync_clear(state->oy); + free(state->oy); + state->oy=NULL; + } +} + +void vcedit_clear(vcedit_state *state) +{ + if(state) + { + vcedit_clear_internals(state); + free(state); + } +} + +int vcedit_open(vcedit_state *state, FILE *in) +{ + return vcedit_open_callbacks(state, (void *)in, + (vcedit_read_func)fread, (vcedit_write_func)fwrite); +} + +int vcedit_open_callbacks(vcedit_state *state, void *in, + vcedit_read_func read_func, vcedit_write_func write_func) +{ + + char *buffer; + int bytes,i; + ogg_packet *header; + ogg_packet header_main; + ogg_packet header_comments; + ogg_packet header_codebooks; + ogg_page og; + vorbis_info vi; + + + state->in = in; + state->read = read_func; + state->write = write_func; + state->lasterror = 0; + + state->oy = malloc(sizeof(ogg_sync_state)); + ogg_sync_init(state->oy); + + buffer = ogg_sync_buffer(state->oy, CHUNKSIZE); + bytes = state->read(buffer, 1, CHUNKSIZE, state->in); + + ogg_sync_wrote(state->oy, bytes); + + if(ogg_sync_pageout(state->oy, &og) != 1) + { + if(byteslasterror = "Input truncated or empty."; + else + state->lasterror = "Input is not an Ogg bitstream."; + goto err; + } + + state->serial = ogg_page_serialno(&og); + + state->os = malloc(sizeof(ogg_stream_state)); + ogg_stream_init(state->os, state->serial); + + vorbis_info_init(&vi); + + state->vc = malloc(sizeof(vorbis_comment)); + vorbis_comment_init(state->vc); + + if(ogg_stream_pagein(state->os, &og) < 0) + { + state->lasterror = "Error reading first page of Ogg bitstream."; + goto err; + } + + if(ogg_stream_packetout(state->os, &header_main) != 1) + { + state->lasterror = "Error reading initial header packet."; + goto err; + } + + if(vorbis_synthesis_headerin(&vi, state->vc, &header_main) < 0) + { + state->lasterror = "Ogg bitstream does not contain vorbis data."; + goto err; + } + + state->mainlen = header_main.bytes; + state->mainbuf = malloc(state->mainlen); + memcpy(state->mainbuf, header_main.packet, header_main.bytes); + + i = 0; + header = &header_comments; + while(i<2) { + while(i<2) { + int result = ogg_sync_pageout(state->oy, &og); + if(result == 0) break; /* Too little data so far */ + else if(result == 1) + { + ogg_stream_pagein(state->os, &og); + while(i<2) + { + result = ogg_stream_packetout(state->os, header); + if(result == 0) break; + if(result == -1) + { + state->lasterror = "Corrupt secondary header."; + goto err; + } + vorbis_synthesis_headerin(&vi, state->vc, header); + if(i==1) + { + state->booklen = header->bytes; + state->bookbuf = malloc(state->booklen); + memcpy(state->bookbuf, header->packet, + header->bytes); + } + i++; + header = &header_codebooks; + } + } + } + + buffer = ogg_sync_buffer(state->oy, CHUNKSIZE); + bytes = state->read(buffer, 1, CHUNKSIZE, state->in); + if(bytes == 0 && i < 2) + { + state->lasterror = "EOF before end of vorbis headers."; + goto err; + } + ogg_sync_wrote(state->oy, bytes); + } + + /* Headers are done! */ + vorbis_info_clear(&vi); + return 0; + +err: + vcedit_clear_internals(state); + return -1; +} + +int vcedit_write(vcedit_state *state, void *out) +{ + ogg_stream_state streamout; + ogg_packet header_main; + ogg_packet header_comments; + ogg_packet header_codebooks; + + ogg_page ogout, ogin; + ogg_packet op; + int result, outresult; + char *buffer; + int bytes, eosin=0, eosout=0; + + state->lasterror = 0; + + header_main.bytes = state->mainlen; + header_main.packet = state->mainbuf; + header_main.b_o_s = 1; + header_main.e_o_s = 0; + header_main.granulepos = 0; + + header_codebooks.bytes = state->booklen; + header_codebooks.packet = state->bookbuf; + header_codebooks.b_o_s = 0; + header_codebooks.e_o_s = 0; + header_codebooks.granulepos = 0; + + ogg_stream_init(&streamout, state->serial); + + vorbis_commentheader_out(state->vc, &header_comments); + + ogg_stream_packetin(&streamout, &header_main); + ogg_stream_packetin(&streamout, &header_comments); + ogg_stream_packetin(&streamout, &header_codebooks); + + while((result = ogg_stream_flush(&streamout, &ogout))) + { + if(state->write(ogout.header,1,ogout.header_len, out) != + (size_t) ogout.header_len) + goto cleanup; + if(state->write(ogout.body,1,ogout.body_len, out) != + (size_t) ogout.body_len) + goto cleanup; + } + + /* We copy the first logical stream + * through, rewriting the stream. */ + while (1) + { + outresult = eosin ? ogg_stream_flush(&streamout, &ogout) : + ogg_stream_pageout(&streamout, &ogout); + if (outresult > 0) + { + if (state->write(ogout.header,1,ogout.header_len, + out) != (size_t) ogout.header_len) + goto cleanup; + if (state->write(ogout.body,1,ogout.body_len, + out) != (size_t) ogout.body_len) + goto cleanup; + if (ogg_page_eos(&ogout)) eosout = 1; + } + if (outresult != 0) continue; + if (eosout || (eosin && (result == 0))) break; + + while (1) + { + result = ogg_stream_packetout(state->os, &op); + if (result < 0) continue; + if (result > 0) ogg_stream_packetin(&streamout, &op); + if (eosin || (result > 0)) break; + + while (1) + { + result = ogg_sync_pageout(state->oy, &ogin); + + if (result < 0) continue; + if (result > 0) + { + ogg_stream_pagein(state->os, &ogin); + if (ogg_page_eos(&ogin)) eosin = 1; + } + if (eosin || (result > 0)) break; + + buffer = ogg_sync_buffer(state->oy, CHUNKSIZE); + bytes = state->read(buffer,1, CHUNKSIZE, state->in); + ogg_sync_wrote(state->oy, bytes); + if (bytes < CHUNKSIZE) eosin = 1; + } + } + } + + eosin=0; /* clear it, because not all paths to here do */ + eosout=1; /* handle input files that are truncated or without an eos flag */ + + /* We copy the rest of the stream (other logical streams) + * through, a page at a time. */ + while (1) + { + result = ogg_sync_pageout(state->oy, &ogout); + if (result > 0) + { + if (state->write(ogout.header,1,ogout.header_len, + out) != (size_t) ogout.header_len) + goto cleanup; + if (state->write(ogout.body,1,ogout.body_len, out) != + (size_t) ogout.body_len) + goto cleanup; + } + if (result != 0) continue; + if (eosin) break; + + buffer = ogg_sync_buffer(state->oy, CHUNKSIZE); + bytes = state->read(buffer,1, CHUNKSIZE, state->in); + ogg_sync_wrote(state->oy, bytes); + eosin = (bytes < CHUNKSIZE); + } + +cleanup: + ogg_stream_clear(&streamout); + ogg_packet_clear(&header_comments); + + free(state->mainbuf); + free(state->bookbuf); + + vcedit_clear_internals(state); + if(!(eosin && eosout)) + { + state->lasterror = + "Error writing stream to output. " + "Output stream may be corrupted or truncated."; + return -1; + } + + return 0; +} diff --git a/tdefile-plugins/ogg/vcedit.h b/tdefile-plugins/ogg/vcedit.h new file mode 100644 index 00000000..6be136ba --- /dev/null +++ b/tdefile-plugins/ogg/vcedit.h @@ -0,0 +1,56 @@ +/* This program is licensed under the GNU General Public License, version 2, + * a copy of which is included with this program. + * + * (c) 2000-2001 Michael Smith + * + * VCEdit header. + * + * last modified: $ID:$ + */ + +#ifndef __VCEDIT_H +#define __VCEDIT_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include + +typedef size_t (*vcedit_read_func)(void *, size_t, size_t, void *); +typedef size_t (*vcedit_write_func)(const void *, size_t, size_t, void *); + +typedef struct { + ogg_sync_state *oy; + ogg_stream_state *os; + + vorbis_comment *vc; + + vcedit_read_func read; + vcedit_write_func write; + + void *in; + long serial; + unsigned char *mainbuf; + unsigned char *bookbuf; + int mainlen; + int booklen; + char *lasterror; +} vcedit_state; + +extern vcedit_state * vcedit_new_state(void); +extern void vcedit_clear(vcedit_state *state); +extern vorbis_comment * vcedit_comments(vcedit_state *state); +extern int vcedit_open(vcedit_state *state, FILE *in); +extern int vcedit_open_callbacks(vcedit_state *state, void *in, + vcedit_read_func read_func, vcedit_write_func write_func); +extern int vcedit_write(vcedit_state *state, void *out); +extern char * vcedit_error(vcedit_state *state); + +#ifdef __cplusplus +} +#endif + +#endif /* __VCEDIT_H */ diff --git a/tdefile-plugins/sid/Makefile.am b/tdefile-plugins/sid/Makefile.am new file mode 100644 index 00000000..56bfa54f --- /dev/null +++ b/tdefile-plugins/sid/Makefile.am @@ -0,0 +1,22 @@ +## Makefile.am for sid file meta info plugin + +# set the include path for X, qt and KDE +INCLUDES = $(all_includes) $(taglib_includes) + +# these are the headers for your project +noinst_HEADERS = tdefile_sid.h + +kde_module_LTLIBRARIES = tdefile_sid.la + +tdefile_sid_la_SOURCES = tdefile_sid.cpp +tdefile_sid_la_LDFLAGS = $(all_libraries) $(KDE_RPATH) $(LIB_QT) -lDCOP $(LIB_TDECORE) $(LIB_TDEUI) -ltdefx $(LIB_KIO) -ltdetexteditor -module $(KDE_PLUGIN) +tdefile_sid_la_LIBADD = $(LIB_KIO) + +# let automoc handle all of the meta source files (moc) +METASOURCES = AUTO + +messages: rc.cpp + $(XGETTEXT) tdefile_sid.cpp -o $(podir)/tdefile_sid.pot + +services_DATA = tdefile_sid.desktop +servicesdir = $(kde_servicesdir) diff --git a/tdefile-plugins/sid/tdefile_sid.cpp b/tdefile-plugins/sid/tdefile_sid.cpp new file mode 100644 index 00000000..543d5b87 --- /dev/null +++ b/tdefile-plugins/sid/tdefile_sid.cpp @@ -0,0 +1,227 @@ +/* This file is part of the KDE project + * Copyright (C) 2003 Rolf Magnus + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation version 2. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +#include "tdefile_sid.h" + +#include +#include +#include +#include + +#include +#include +#include + +#include +#include +#include +#include + +typedef KGenericFactory SidFactory; + +K_EXPORT_COMPONENT_FACTORY(tdefile_sid, SidFactory("tdefile_sid")) + +KSidPlugin::KSidPlugin(TQObject *parent, const char *name, + const TQStringList &args) + + : KFilePlugin(parent, name, args) +{ + kdDebug(7034) << "sid plugin\n"; + + KFileMimeTypeInfo* info = addMimeTypeInfo("audio/prs.sid"); + + KFileMimeTypeInfo::GroupInfo* group = 0L; + + // General group + group = addGroupInfo(info, "General", i18n("General")); + + KFileMimeTypeInfo::ItemInfo* item; + + item = addItemInfo(group, "Title", i18n("Title"), TQVariant::String); + setAttributes(item, KFileMimeTypeInfo::Modifiable); + setHint(item, KFileMimeTypeInfo::Name); + + item = addItemInfo(group, "Artist", i18n("Artist"), TQVariant::String); + setAttributes(item, KFileMimeTypeInfo::Modifiable); + setHint(item, KFileMimeTypeInfo::Author); + + item = addItemInfo(group, "Copyright", i18n("Copyright"), TQVariant::String); + setAttributes(item, KFileMimeTypeInfo::Modifiable); + setHint(item, KFileMimeTypeInfo::Description); + + // technical group + group = addGroupInfo(info, "Technical", i18n("Technical Details")); + + item = addItemInfo(group, "Version", i18n("Version"), TQVariant::Int); + setPrefix(item, i18n("PSID v")); + + addItemInfo(group, "Number of Songs", i18n("Number of Songs"), TQVariant::Int); + item = addItemInfo(group, "Start Song", i18n("Start Song"), TQVariant::Int); +} + +bool KSidPlugin::readInfo(KFileMetaInfo& info, uint /*what*/) +{ + if ( info.path().isEmpty() ) // remote file + return false; + TQFile file(info.path()); + if ( !file.open(IO_ReadOnly) ) + return false; + + int version; + int num_songs; + int start_song; + TQString name; + TQString artist; + TQString copyright; + + char buf[64] = { 0 }; + + if (4 != file.readBlock(buf, 4)) + return false; + if (strncmp(buf, "PSID", 4)) + return false; + + //read version + int ch; + if (0 > (ch = file.getch())) + return false; + version = ch << 8; + if (0 > (ch = file.getch())) + return false; + version+= ch; + + //read number of songs + file.at(0xE); + if (0 > (ch = file.getch())) + return false; + num_songs = ch << 8; + if (0 > (ch = file.getch())) + return false; + num_songs += ch; + + //start song + if (0 > (ch = file.getch())) + return false; + start_song = ch << 8; + if (0 > (ch = file.getch())) + return false; + start_song += ch; + + //name + file.at(0x16); + if (32 != file.readBlock(buf, 32)) + return false; + name = buf; + + //artist + if (32 != file.readBlock(buf, 32)) + return false; + artist = buf; + + //copyright + if (32 != file.readBlock(buf, 32)) + return false; + copyright = buf; + + TQString TODO("TODO"); + kdDebug(7034) << "sid plugin readInfo\n"; + + KFileMetaInfoGroup general = appendGroup(info, "General"); + + appendItem(general, "Title", name); + appendItem(general, "Artist", artist); + appendItem(general, "Copyright", copyright); + + KFileMetaInfoGroup tech = appendGroup(info, "Technical"); + + appendItem(tech, "Version", version); + appendItem(tech, "Number of Songs", num_songs); + appendItem(tech, "Start Song", start_song); + + kdDebug(7034) << "reading finished\n"; + return true; +} + +bool KSidPlugin::writeInfo(const KFileMetaInfo& info) const +{ + kdDebug(7034) << k_funcinfo << endl; + + char name[32] = {0}; + char artist[32] = {0}; + char copyright[32] = {0}; + + int file = 0; + TQString s; + + KFileMetaInfoGroup group = info.group("General"); + if (!group.isValid()) + goto failure; + + s = group.item("Title").value().toString(); + if (s.isNull()) goto failure; + strncpy(name, s.local8Bit(), 31); + + s = group.item("Artist").value().toString(); + if (s.isNull()) goto failure; + strncpy(artist, s.local8Bit(), 31); + + s = group.item("Copyright").value().toString(); + if (s.isNull()) goto failure; + strncpy(copyright, s.local8Bit(), 31); + + kdDebug(7034) << "Opening sid file " << info.path() << endl; + file = ::open(TQFile::encodeName(info.path()), O_WRONLY); + //name + if (-1 == ::lseek(file, 0x16, SEEK_SET)) + goto failure; + if (32 != ::write(file, name, 32)) + goto failure; + + //artist + if (32 != ::write(file, artist, 32)) + goto failure; + + //copyright + if (32 != write(file, copyright, 32)) + goto failure; + + close(file); + return true; + +failure: + if (file) close(file); + kdDebug(7034) << "something went wrong writing to sid file\n"; + return false; +} + +TQValidator* +KSidPlugin::createValidator(const TQString& /*mimetype*/, const TQString& group, + const TQString& /*key*/, TQObject* parent, + const char* name) const +{ + kdDebug(7034) << k_funcinfo << endl; + // all items in "General" group are strings of max length 31 + if (group == "General") + return new TQRegExpValidator(TQRegExp(".{,31}"), parent, name); + // all others are read-only + return 0; +} + + + +#include "tdefile_sid.moc" diff --git a/tdefile-plugins/sid/tdefile_sid.desktop b/tdefile-plugins/sid/tdefile_sid.desktop new file mode 100644 index 00000000..117f2905 --- /dev/null +++ b/tdefile-plugins/sid/tdefile_sid.desktop @@ -0,0 +1,60 @@ +[Desktop Entry] +Type=Service +Name=SID Info +Name[bg]=Информация за SID +Name[br]=Titouroù SID +Name[bs]=SID informacije +Name[ca]=Informació SID +Name[cs]=SID info +Name[cy]=Gwybodaeth SID +Name[da]=SID-info +Name[de]=SID-Info +Name[el]=Πληροφορίες SID +Name[eo]=SID-informo +Name[es]=Info SID +Name[et]=SID info +Name[eu]=SID informazioa +Name[fa]=اطلاعات SID +Name[fi]=SID-tiedot +Name[fr]=Informations SID +Name[ga]=Eolas faoi SID +Name[gl]=Información SID +Name[he]=מידע SID +Name[hu]=SID-jellemzők +Name[is]=SID upplýsingar +Name[it]=Informazioni SID +Name[ja]=SID 情報 +Name[kk]=SID мәліметі +Name[km]=ព័ត៌មាន SID +Name[ko]=SID 정보 +Name[lt]=SID Informacija +Name[mk]=SID информации +Name[nb]=SID-info +Name[nds]=SID-Info +Name[ne]=एसआईडी सूचना +Name[nl]=SID-informatie +Name[nn]=SID-info +Name[pa]=SID ਜਾਣਕਾਰੀ +Name[pl]=Informacja CD +Name[pt]=Informação do SID +Name[pt_BR]=Informação sobre SID +Name[ro]=Informaţii SID +Name[ru]=Сведения о SID +Name[sk]=SID info +Name[sl]=Podatki o SID +Name[sr]=Информације о SID-у +Name[sr@Latn]=Informacije o SID-u +Name[sv]=SID-information +Name[ta]=SID தகவல் +Name[tg]=SID Ахборот +Name[th]=ข้อมูล SID +Name[tr]=SID Bilgisi +Name[uk]=Інформація по SID +Name[zh_CN]=SID 信息 +Name[zh_HK]=SID 資訊 +Name[zh_TW]=SID 資訊 +ServiceTypes=KFilePlugin +X-TDE-Library=tdefile_sid +MimeType=audio/prs.sid +PreferredGroups=General,Technical +PreferredItems=Title,Artist,Copyright,Number of Songs,Start Song,Version diff --git a/tdefile-plugins/sid/tdefile_sid.h b/tdefile-plugins/sid/tdefile_sid.h new file mode 100644 index 00000000..ba9931f7 --- /dev/null +++ b/tdefile-plugins/sid/tdefile_sid.h @@ -0,0 +1,43 @@ +/* This file is part of the KDE project + * Copyright (C) 2003 Rolf Magnus + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation version 2. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + * $Id$ + */ + +#ifndef KFILE_SID_H +#define KFILE_SID_H + +#include + +class TQStringList; + +class KSidPlugin: public KFilePlugin +{ + Q_OBJECT + + +public: + KSidPlugin(TQObject *parent, const char *name, const TQStringList& args); + + virtual bool readInfo(KFileMetaInfo& info, uint what); + virtual bool writeInfo(const KFileMetaInfo& info) const; + TQValidator* createValidator(const TQString& mimetype, const TQString& group, + const TQString& key, TQObject* parent, + const char* name) const; +}; + +#endif diff --git a/tdefile-plugins/theora/Makefile.am b/tdefile-plugins/theora/Makefile.am new file mode 100644 index 00000000..c44a102d --- /dev/null +++ b/tdefile-plugins/theora/Makefile.am @@ -0,0 +1,22 @@ +## Makefile.am for ogg/vorbis file meta info plugin + +# set the include path for X, qt and KDE +INCLUDES = $(all_includes) + +# these are the headers for your project +noinst_HEADERS = tdefile_theora.h + +kde_module_LTLIBRARIES = tdefile_theora.la + +tdefile_theora_la_SOURCES = tdefile_theora.cpp +tdefile_theora_la_LDFLAGS = $(all_libraries) $(KDE_RPATH) $(LIB_QT) -lDCOP $(LIB_TDECORE) $(LIB_TDEUI) -ltdefx $(LIB_KIO) -ltdetexteditor -module $(KDE_PLUGIN) +tdefile_theora_la_LIBADD = $(LIB_KIO) -logg -lvorbis -ltheora + +# let automoc handle all of the meta source files (moc) +METASOURCES = AUTO + +messages: rc.cpp + $(XGETTEXT) tdefile_theora.cpp -o $(podir)/tdefile_theora.pot + +services_DATA = tdefile_theora.desktop +servicesdir = $(kde_servicesdir) diff --git a/tdefile-plugins/theora/configure.in.bot b/tdefile-plugins/theora/configure.in.bot new file mode 100644 index 00000000..926a39e9 --- /dev/null +++ b/tdefile-plugins/theora/configure.in.bot @@ -0,0 +1,7 @@ +if test "x$with_theora" = xcheck && test "x$have_theora" = xno; then + echo "" + echo "Ogg Theora support was not found." + echo "a KFile-plugin for displaying Ogg Theora Information" + echo "has been disabled from compilation." + all_tests=bad +fi diff --git a/tdefile-plugins/theora/configure.in.in b/tdefile-plugins/theora/configure.in.in new file mode 100644 index 00000000..b9d8836d --- /dev/null +++ b/tdefile-plugins/theora/configure.in.in @@ -0,0 +1,26 @@ +AC_DEFUN([KDE_CHECK_THEORA], +[ +have_theora=yes + +KDE_CHECK_HEADER(theora/theora.h, + [], [have_theora=no]) + +KDE_CHECK_LIB(theora, theora_info_init, + [], [have_theora=no], [-lvorbis -logg]) +]) + +AC_ARG_WITH(theora, + [AC_HELP_STRING(--with-theora, + [enable support for Ogg Theora @<:@default=check@:>@])], + [], with_theora=check) + +have_theora=no +if test "x$with_theora" != xno; then + KDE_CHECK_THEORA + + if test "x$with_theora" != xcheck && test "x$have_theora" != xyes; then + AC_MSG_ERROR([--with-theora was given, but test for Theora failed]) + fi +fi + +AM_CONDITIONAL(include_theora_SUBDIR, test "x$have_theora" = xyes) diff --git a/tdefile-plugins/theora/tdefile_theora.cpp b/tdefile-plugins/theora/tdefile_theora.cpp new file mode 100644 index 00000000..20e4e337 --- /dev/null +++ b/tdefile-plugins/theora/tdefile_theora.cpp @@ -0,0 +1,322 @@ +/*************************************************************************** + * Copyright (C) 2004 by Jean-Baptiste Mardelle * + * bj@altern.org * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * + ***************************************************************************/ + +#include +#include +#include "tdefile_theora.h" + +#include +#include +#include + +#include "theora/theora.h" +#include "vorbis/codec.h" + +ogg_stream_state t_stream_state; +ogg_stream_state v_stream_state; + +int theora_p=0; +int vorbis_p=0; + +static int queue_page(ogg_page *page) +{ + if(theora_p) + ogg_stream_pagein(&t_stream_state,page); + if(vorbis_p) + ogg_stream_pagein(&v_stream_state,page); + return 0; +} + +static int buffer_data(FILE *in,ogg_sync_state *oy) +{ + char *buffer=ogg_sync_buffer(oy,4096); + int bytes=fread(buffer,1,4096,in); + ogg_sync_wrote(oy,bytes); + return(bytes); +} + +typedef KGenericFactory theoraFactory; + +K_EXPORT_COMPONENT_FACTORY(tdefile_theora, theoraFactory( "tdefile_theora" )) + +theoraPlugin::theoraPlugin(TQObject *parent, const char *name, + const TQStringList &args) + : KFilePlugin(parent, name, args) +{ +// kdDebug(7034) << "theora plugin\n"; + + KFileMimeTypeInfo* info = addMimeTypeInfo( "video/x-theora" ); + + KFileMimeTypeInfo::GroupInfo* group = 0; + KFileMimeTypeInfo::ItemInfo* item; + + // video group + + group = addGroupInfo(info, "Video", i18n("Video Details")); + setAttributes(group, 0); + item = addItemInfo(group, "Length", i18n("Length"), TQVariant::Int); + setUnit(item, KFileMimeTypeInfo::Seconds); + setHint(item, KFileMimeTypeInfo::Length); + item = addItemInfo(group, "Resolution", i18n("Resolution"), TQVariant::Size); + setHint(item, KFileMimeTypeInfo::Size); + setUnit(item, KFileMimeTypeInfo::Pixels); + item = addItemInfo(group, "FrameRate", i18n("Frame Rate"), TQVariant::Int); + setUnit(item, KFileMimeTypeInfo::FramesPerSecond); + item = addItemInfo(group, "TargetBitrate", i18n("Target Bitrate"), TQVariant::Int); + setUnit(item, KFileMimeTypeInfo::Bitrate); + item = addItemInfo(group, "Quality", i18n("Quality"), TQVariant::Int); + + // audio group + + group = addGroupInfo(info, "Audio", i18n("Audio Details")); + setAttributes(group, 0); + addItemInfo(group, "Channels", i18n("Channels"), TQVariant::Int); + + item = addItemInfo(group, "SampleRate", i18n("Sample Rate"), TQVariant::Int); + setUnit(item, KFileMimeTypeInfo::Hertz); +} + +bool theoraPlugin::readInfo( KFileMetaInfo& info, uint what) +{ + // most of the ogg stuff was borrowed from libtheora/examples/player_example.c + FILE *fp; + + ogg_sync_state o_sync_state; + ogg_packet o_packet; + ogg_page o_page; + + theora_info t_info; + theora_comment t_comment; + theora_state t_state; + vorbis_info v_info; + vorbis_comment v_comment; + + theora_p=0; + vorbis_p=0; + int theora_serial=0; + int stateflag=0; + + ogg_int64_t duration=0; + + // libtheora is still a bit unstable and sadly the init_ functions don't + // take care of things the way one would expect. So, let's do some explicit + // clearing of these fields. + + memset(&t_info, 0, sizeof(theora_info)); + memset(&t_comment, 0, sizeof(theora_comment)); + memset(&t_state, 0, sizeof(theora_state)); + + bool readTech = false; + + if (what & (KFileMetaInfo::Fastest | + KFileMetaInfo::DontCare | + KFileMetaInfo::TechnicalInfo)) + readTech = true; + + if ( info.path().isEmpty() ) // remote file + return false; + + fp = fopen(TQFile::encodeName(info.path()),"rb"); + if (!fp) + { + kdDebug(7034) << "Unable to open " << TQFile::encodeName(info.path()).data() << endl; + return false; + } + + ogg_sync_init(&o_sync_state); + + /* init supporting Vorbis structures needed in header parsing */ + vorbis_info_init(&v_info); + vorbis_comment_init(&v_comment); + + /* init supporting Theora structures needed in header parsing */ + theora_comment_init(&t_comment); + theora_info_init(&t_info); + + while(!stateflag && buffer_data(fp,&o_sync_state)!=0) + { + while (ogg_sync_pageout(&o_sync_state,&o_page)>0) + { + ogg_stream_state stream_test; + /* is this a mandated initial header? If not, stop parsing */ + if(!ogg_page_bos(&o_page)) + { + queue_page(&o_page); + stateflag=1; + break; + } + + ogg_stream_init(&stream_test,ogg_page_serialno(&o_page)); + ogg_stream_pagein(&stream_test,&o_page); + ogg_stream_packetout(&stream_test,&o_packet); + + /* identify the codec: try theora */ + if(!theora_p && theora_decode_header(&t_info,&t_comment,&o_packet)>=0) + { + /* it is theora */ + memcpy(&t_stream_state,&stream_test,sizeof(stream_test)); + theora_serial=ogg_page_serialno(&o_page); + theora_p=1; + } + else if(!vorbis_p && vorbis_synthesis_headerin(&v_info,&v_comment,&o_packet)>=0) + { + /* it is vorbis */ + memcpy(&v_stream_state,&stream_test,sizeof(stream_test)); + vorbis_p=1; + } + else + { + /* whatever it is, we don't care about it */ + ogg_stream_clear(&stream_test); + } + } + } + + /* we're expecting more header packets. */ + bool corruptedHeaders=false; + + while((theora_p && theora_p<3) || (vorbis_p && vorbis_p<3)) + { + int ret; + /* look for further theora headers */ + while(theora_p && (theora_p<3) && (ret=ogg_stream_packetout(&t_stream_state,&o_packet))) + { + if(ret<0) + { + kdDebug(7034)<<"Error parsing Theora stream headers; corrupt stream?\n"<0) + { + queue_page(&o_page); + /* demux into the appropriate stream */ + } + else + { + int ret=buffer_data(fp,&o_sync_state); /* someone needs more data */ + if(ret==0) + { + kdDebug(7034)<<"End of file while searching for codec headers."<0) + { + // The following line was commented out by Scott Wheeler + // We don't actually need to store all of the pages / packets in memory since + // (a) libtheora doesn't use them anyway in the one call that we make after this + // that usese t_state and (b) it basically buffers the entire file to memory if + // we queue them up like this and that sucks where a typical file size is a few + // hundred megs. + + // queue_page(&o_page); + } + if (theora_serial==ogg_page_serialno(&o_page)) + duration=(ogg_int64_t) theora_granule_time(&t_state,ogg_page_granulepos(&o_page)); + } + + if (readTech) + { + int stream_fps=0; + if (t_info.fps_denominator!=0) + stream_fps=t_info.fps_numerator/t_info.fps_denominator; + KFileMetaInfoGroup videogroup = appendGroup(info, "Video"); + appendItem(videogroup, "Length", int (duration)); + appendItem(videogroup, "Resolution", TQSize(t_info.frame_width,t_info.frame_height)); + appendItem(videogroup, "FrameRate", stream_fps); + appendItem(videogroup, "Quality", (int) t_info.quality); + + KFileMetaInfoGroup audiogroup = appendGroup(info, "Audio"); + appendItem(audiogroup, "Channels", v_info.channels); + appendItem(audiogroup, "SampleRate", int(v_info.rate)); + } + fclose(fp); + + if (vorbis_p) + { + ogg_stream_clear(&v_stream_state); + vorbis_comment_clear(&v_comment); + vorbis_info_clear(&v_info); + } + + ogg_stream_clear(&t_stream_state); + theora_clear(&t_state); + theora_comment_clear(&t_comment); + theora_info_clear(&t_info); + ogg_sync_clear(&o_sync_state); + + return true; +} + +#include "tdefile_theora.moc" + diff --git a/tdefile-plugins/theora/tdefile_theora.desktop b/tdefile-plugins/theora/tdefile_theora.desktop new file mode 100644 index 00000000..e3adfa26 --- /dev/null +++ b/tdefile-plugins/theora/tdefile_theora.desktop @@ -0,0 +1,60 @@ +[Desktop Entry] +Type=Service +Name=theora Info +Name[bg]=Информация за theora +Name[bn]=থিওরা তথ্য +Name[br]=Titouroù diwar-benn theora +Name[bs]=theora informacije +Name[ca]=Informació theora +Name[cs]=theora info +Name[de]=Theora-Info +Name[el]=Πληροφορίες theora +Name[eo]=theora-informo +Name[es]=Info Theora +Name[et]=Theora info +Name[eu]=theora informazioa +Name[fa]=اطلاعات theora +Name[fi]=Theoran tiedot +Name[fr]=Informations theora +Name[ga]=Eolas faoi theora +Name[gl]=Información theora +Name[he]=מידע theora +Name[hu]=Theora-jellemzők +Name[is]=theora upplýsingar +Name[it]=Informazioni su theora +Name[ja]=theora 情報 +Name[kk]=theora мәліметі +Name[km]=ព័ត៌មាន theora +Name[ko]=theora 정보 +Name[lt]=theora Informacija +Name[mk]=theora информации +Name[nb]=theora-info +Name[nds]=Theora-Info +Name[ne]=थिवरा सूचना +Name[nl]=theora-informatie +Name[nn]=theora-info +Name[pa]=theora (ਥੋਰਾ) ਜਾਣਕਾਰੀ +Name[pl]=Informacja o pliku theora +Name[pt]=Informação do theora +Name[pt_BR]=Informação sobre theora +Name[ru]=Сведения о theora +Name[sk]=theora info +Name[sl]=Podatki o Theora +Name[sr]=Информације о theora-и +Name[sr@Latn]=Informacije o theora-i +Name[sv]=Theora-information +Name[ta]= தியோரா தகவல் +Name[th]=ข้อมูล theora +Name[tr]=theora Bilgisi +Name[uk]=Інформація по theora +Name[zh_CN]=theora 信息 +Name[zh_HK]=theora 資訊 +Name[zh_TW]=theora 資訊 +ServiceTypes=KFilePlugin +X-TDE-Library=tdefile_theora +# change MimeType here! (example: inode/directory) +MimeType=video/x-theora +# change PreferredGroups here! (example: FolderInfo) +PreferredGroups= +# change PreferredItems here! (example: Items;Size) +PreferredItems=Size,Length diff --git a/tdefile-plugins/theora/tdefile_theora.h b/tdefile-plugins/theora/tdefile_theora.h new file mode 100644 index 00000000..88e465c2 --- /dev/null +++ b/tdefile-plugins/theora/tdefile_theora.h @@ -0,0 +1,43 @@ +/*************************************************************************** + * Copyright (C) 2004 by Jean-Baptiste Mardelle * + * bj@altern.org * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * + ***************************************************************************/ + +#ifndef __KFILE_THEORA_H__ +#define __KFILE_THEORA_H__ + +/** + * Note: For further information look into <$TDEDIR/include/tdefilemetainfo.h> + */ +#include + +class TQStringList; + +class theoraPlugin: public KFilePlugin +{ + Q_OBJECT + + +public: + theoraPlugin( TQObject *parent, const char *name, const TQStringList& args ); + + virtual bool readInfo( KFileMetaInfo& info, uint what); +}; + +#endif // __KFILE_THEORA_H__ + diff --git a/tdefile-plugins/wav/Makefile.am b/tdefile-plugins/wav/Makefile.am new file mode 100644 index 00000000..f755f395 --- /dev/null +++ b/tdefile-plugins/wav/Makefile.am @@ -0,0 +1,22 @@ +## Makefile.am for wav file meta info plugin + +# set the include path for X, qt and KDE +INCLUDES = $(all_includes) + +# these are the headers for your project +noinst_HEADERS = tdefile_wav.h + +kde_module_LTLIBRARIES = tdefile_wav.la + +tdefile_wav_la_SOURCES = tdefile_wav.cpp +tdefile_wav_la_LDFLAGS = $(all_libraries) $(KDE_RPATH) $(LIB_QT) -lDCOP $(LIB_TDECORE) $(LIB_TDEUI) -ltdefx $(LIB_KIO) -ltdetexteditor -module $(KDE_PLUGIN) +tdefile_wav_la_LIBADD = $(LIB_KIO) + +# let automoc handle all of the meta source files (moc) +METASOURCES = AUTO + +messages: rc.cpp + $(XGETTEXT) tdefile_wav.cpp -o $(podir)/tdefile_wav.pot + +services_DATA = tdefile_wav.desktop +servicesdir = $(kde_servicesdir) diff --git a/tdefile-plugins/wav/tdefile_wav.cpp b/tdefile-plugins/wav/tdefile_wav.cpp new file mode 100644 index 00000000..1c1f61ad --- /dev/null +++ b/tdefile-plugins/wav/tdefile_wav.cpp @@ -0,0 +1,173 @@ +/* This file is part of the KDE project + * Copyright (C) 2002 Ryan Cumming + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation version 2. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + */ + +#include +#include "tdefile_wav.h" + +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#if !defined(__osf__) +#include +#else +typedef unsigned short uint16_t; +typedef unsigned int uint32_t; +#endif + +typedef KGenericFactory WavFactory; + +K_EXPORT_COMPONENT_FACTORY(tdefile_wav, WavFactory( "tdefile_wav" )) + +KWavPlugin::KWavPlugin(TQObject *parent, const char *name, + const TQStringList &args) + + : KFilePlugin(parent, name, args) +{ + KFileMimeTypeInfo* info = addMimeTypeInfo( "audio/x-wav" ); + + KFileMimeTypeInfo::GroupInfo* group = 0L; + + // "the" group + group = addGroupInfo(info, "Technical", i18n("Technical Details")); + + KFileMimeTypeInfo::ItemInfo* item; + + item = addItemInfo(group, "Sample Size", i18n("Sample Size"), TQVariant::Int); + setSuffix(item, i18n(" bits")); + + item = addItemInfo(group, "Sample Rate", i18n("Sample Rate"), TQVariant::Int); + setSuffix(item, i18n(" Hz")); + + item = addItemInfo(group, "Channels", i18n("Channels"), TQVariant::Int); + + item = addItemInfo(group, "Length", i18n("Length"), TQVariant::Int); + setAttributes(item, KFileMimeTypeInfo::Cummulative); + setUnit(item, KFileMimeTypeInfo::Seconds); +} + +bool KWavPlugin::readInfo( KFileMetaInfo& info, uint /*what*/) +{ + if ( info.path().isEmpty() ) // remote file + return false; + + TQFile file(info.path()); + + uint32_t format_size; + uint16_t format_tag; + uint16_t channel_count; + uint32_t sample_rate; + uint32_t bytes_per_second; + uint16_t bytes_per_sample; + uint16_t sample_size; + uint32_t data_size; + uint32_t unknown_chunk_size; + uint16_t unknown_chunk16; + bool have_fmt = false; + bool have_data = false; + TQIODevice::Offset file_length; + + const char *riff_signature = "RIFF"; + const char *wav_signature = "WAVE"; + const char *fmt_signature = "fmt "; + const char *data_signature = "data"; + char signature_buffer[4]; + + if (!file.open(IO_ReadOnly)) + { + kdDebug(7034) << "Couldn't open " << TQFile::encodeName(info.path()).data() << endl; + return false; + } + + file_length = file.size() - 100; // a bit of insurance + TQDataStream dstream(&file); + + // WAV files are little-endian + dstream.setByteOrder(TQDataStream::LittleEndian); + + // Read and verify the RIFF signature + dstream.readRawBytes(signature_buffer, 4); + if (memcmp(signature_buffer, riff_signature, 4)) + return false; + + // Skip the next bit (total file size, pretty useless) + file.at(8); + + // Read and verify the WAVE signature + dstream.readRawBytes(signature_buffer, 4); + if (memcmp(signature_buffer, wav_signature, 4)) + return false; + + // pretty dumb scanner, but better than what we had! + do + { + dstream.readRawBytes(signature_buffer, 4); + if (!memcmp(signature_buffer, fmt_signature, 4)) { + dstream >> format_size; + dstream >> format_tag; + dstream >> channel_count; + dstream >> sample_rate; + dstream >> bytes_per_second; + dstream >> bytes_per_sample; + dstream >> sample_size; + have_fmt = true; + if ( format_size > 16 ) { + for (unsigned int i = 0; i < (format_size-16+1)/2; i++) + dstream >> unknown_chunk16; + } + } else if (!memcmp(signature_buffer, data_signature, 4)) { + dstream >> data_size; + have_data = true; + } else { + dstream >> unknown_chunk_size; + for (unsigned int i = 0; i < (unknown_chunk_size+1)/2; i++) + dstream >> unknown_chunk16; + } + if (have_data && have_fmt) + break; + } while (file.at() < file_length); + + if ( (!have_data) || (!have_fmt) ) + return false; + + // These values are downright illegal + if ((!channel_count) || (!bytes_per_second)) + return false; + + KFileMetaInfoGroup group = appendGroup(info, "Technical"); + + + appendItem(group, "Sample Size", int(sample_size)); + appendItem(group, "Sample Rate", int(sample_rate)); + appendItem(group, "Channels", int(channel_count)); + unsigned int wav_seconds = data_size / bytes_per_second; + appendItem(group, "Length", int(wav_seconds)); + + return true; +} + +#include "tdefile_wav.moc" diff --git a/tdefile-plugins/wav/tdefile_wav.desktop b/tdefile-plugins/wav/tdefile_wav.desktop new file mode 100644 index 00000000..613a3772 --- /dev/null +++ b/tdefile-plugins/wav/tdefile_wav.desktop @@ -0,0 +1,67 @@ +[Desktop Entry] +Type=Service +Name=WAV Info +Name[af]=Wav Inligting +Name[ar]=معلومات WAV +Name[bg]=Информация за WAV +Name[br]=Titouroù WAV +Name[bs]=WAV informacije +Name[ca]=Informació WAV +Name[cs]=WAV info +Name[cy]=Gwybodaeth WAV +Name[da]=WAV-info +Name[de]=WAV-Info +Name[el]=Πληροφορίες WAV +Name[eo]=WAV-informo +Name[es]=Info WAV +Name[et]=WAV info +Name[eu]=WAV informazioa +Name[fa]=اطلاعات WAV +Name[fi]=WAV-tiedot +Name[fr]=Informations Wave +Name[gl]=Información WAV +Name[he]=מידע WAV +Name[hi]=WAV जानकारी +Name[hr]=Informacije o WAV datoteci +Name[hu]=WAV-jellemzők +Name[is]=WAV upplýsingar +Name[it]=Informazioni WAV +Name[ja]=WAV 情報 +Name[kk]=WAV мәліметі +Name[km]=ព័ត៌មាន WAV +Name[ko]=WAV 정보 +Name[lt]=WAV informacija +Name[mk]=WAV информации +Name[nb]=WAV informasjon +Name[nds]=WAV-Info +Name[ne]=वाभ सूचना +Name[nl]=WAV-informatie +Name[nn]=WAV-info +Name[pa]=WAV ਜਾਣਕਾਰੀ +Name[pl]=Informacja o pliku WAV +Name[pt]=Informação do WAV +Name[pt_BR]=Informação sobre WAV +Name[ro]=Informaţii WAV +Name[ru]=Сведения о WAV +Name[se]=WAV-dieđut +Name[sl]=Podatki o WAV +Name[sr]=Информације о WAV-у +Name[sr@Latn]=Informacije o WAV-u +Name[sv]=Wav-information +Name[ta]=WAV தகவல் +Name[tg]=WAV Ахборот +Name[th]=ข้อมูล WAV +Name[tr]=WAV Bilgisi +Name[uk]=Інформація по WAV +Name[uz]=WAV haqida maʼlumot +Name[uz@cyrillic]=WAV ҳақида маълумот +Name[xh]=MAV Ulwazi +Name[zh_CN]=WAV 信息 +Name[zh_HK]=WAV 資訊 +Name[zh_TW]=WAV 資訊 +Name[zu]=Ulwazi lwe WAV +ServiceTypes=KFilePlugin +X-TDE-Library=tdefile_wav +MimeType=audio/x-wav +PreferredGrous=Technical +PreferredItems=Length,Sample Rate,Sample Size,Channels diff --git a/tdefile-plugins/wav/tdefile_wav.h b/tdefile-plugins/wav/tdefile_wav.h new file mode 100644 index 00000000..c3a5b2ba --- /dev/null +++ b/tdefile-plugins/wav/tdefile_wav.h @@ -0,0 +1,38 @@ +/* This file is part of the KDE project + * Copyright (C) 2002 Ryan Cumming + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation version 2. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + */ + +#ifndef __KFILE_WAV_H__ +#define __KFILE_WAV_H__ + +#include + +class TQStringList; + +class KWavPlugin: public KFilePlugin +{ + Q_OBJECT + + +public: + KWavPlugin( TQObject *parent, const char *name, const TQStringList& args ); + + virtual bool readInfo( KFileMetaInfo& info, uint what); +}; + +#endif diff --git a/tdeioslave/Makefile.am b/tdeioslave/Makefile.am new file mode 100644 index 00000000..606a0a59 --- /dev/null +++ b/tdeioslave/Makefile.am @@ -0,0 +1,5 @@ +if include_tdeioslave_audiocd +AUDIOCD_SUBDIR=audiocd +endif + +SUBDIRS = $(AUDIOCD_SUBDIR) diff --git a/tdeioslave/audiocd/HACKING b/tdeioslave/audiocd/HACKING new file mode 100644 index 00000000..dde6efc1 --- /dev/null +++ b/tdeioslave/audiocd/HACKING @@ -0,0 +1,25 @@ +// CODE LAYOUT + +audiocd.[h,cpp] - The main ioslave code. It contains the logic to rip audio from cd's. It loads all of the plugins that it can find. When it needs to encode, generate directories (and names of directories) it goes through it's list. audiocd uses libkcddb to retrieve its cddb entries and cdparinoia to retrieve the audio from the CD. + +plugins/audiocdencoder.[h,cpp] - The base class for all of the encoder plugins + +plugins/wav/* - The cda and wav "encoders" +plugins/flac/* - the flac encoder +plugins/lame/* - The mp3 encoder +plugins/vorbis/* - The ogg encoder + +kcmaudiocd/ - kcm configure dialog for the audiocd ioslave. It also loads the plugins and gets their configure dialogs and puts them into the tab dialog. + +// USERS + +Audiocd's "interface" is presented first to the users, It should be simple. The number of files/directories should be kept to a minimum. + +// APP SKIMMING + +Audiocd also has the ability to be "skimmed" by other tools. For example an outside application could retrieve the second track with: + +audiocd:/Wav/Track 02.wav?device=/dev/hd2&fileNameTemplate=Track %{number}&cddbChoice=1 + +This way apps can just query audiocd:/ for CDDB, present them to the users, and rip the tracks all without having to impliment it themselves. + diff --git a/tdeioslave/audiocd/Makefile.am b/tdeioslave/audiocd/Makefile.am new file mode 100644 index 00000000..8e190d4e --- /dev/null +++ b/tdeioslave/audiocd/Makefile.am @@ -0,0 +1,33 @@ +if include_kcm_audiocd +AUDIO_CD_SUBDIRS = kcmaudiocd +endif +SUBDIRS = plugins $(AUDIO_CD_SUBDIRS) + +INCLUDES = -I$(top_srcdir)/libkcddb \ + -I$(top_builddir)/libkcddb $(all_includes) \ + -I$(top_srcdir)/kscd $(all_includes) \ + -I$(srcdir)/plugins $(all_includes) + +KDE_CXXFLAGS=$(ENABLE_PERMISSIVE_FLAG) + +kde_module_LTLIBRARIES = kio_audiocd.la + +kio_audiocd_la_SOURCES = audiocd.cpp + +kio_audiocd_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN) + +kio_audiocd_la_LIBADD = ./plugins/libaudiocdplugins.la $(LIB_KIO) $(CDPARANOIA_LIBS) $(top_builddir)/libkcddb/libkcddb.la $(top_builddir)/kscd/libkcompactdisc.la + +noinst_HEADERS = audiocd.h + +protocoldir = $(kde_servicesdir) +protocol_DATA = audiocd.protocol + +messages: + $(XGETTEXT) *.cpp -o $(podir)/tdeio_audiocd.pot + +updatedir = $(kde_datadir)/tdeconf_update +update_DATA = audiocd.upd +update_SCRIPTS = upgrade-metadata.sh + +audiocd.lo: ../../libkcddb/configbase.h diff --git a/tdeioslave/audiocd/audiocd.cpp b/tdeioslave/audiocd/audiocd.cpp new file mode 100644 index 00000000..7898be5a --- /dev/null +++ b/tdeioslave/audiocd/audiocd.cpp @@ -0,0 +1,1159 @@ +/* + * Copyright (C) 2000 Rik Hemsley (rikkus) + * Copyright (C) 2000, 2001, 2002 Michael Matz + * Copyright (C) 2001 Carsten Duvenhorst + * Copyright (C) 2001 Adrian Schroeter + * Copyright (C) 2003 Richard Lärkäng + * Copyright (C) 2003 Scott Wheeler + * Copyright (C) 2004, 2005 Benjamin Meyer + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * ERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#include + +extern "C" +{ + #include + #include + void paranoiaCallback(long, int); + + #include + KDE_EXPORT int kdemain(int argc, char ** argv); +} + +#include "audiocd.h" +#include "plugins/audiocdencoder.h" + +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +// CDDB +#include +#include "kcompactdisc.h" + +using namespace TDEIO; +using namespace KCDDB; + +#define TQFL1(x) TQString::fromLatin1(x) +#define DEFAULT_CD_DEVICE "/dev/cdrom" +#define CDDB_INFORMATION "CDDB Information" + +using namespace AudioCD; + +static const KCmdLineOptions options[] = +{ + { "+protocol", I18N_NOOP("Protocol name"), 0 }, + { "+pool", I18N_NOOP("Socket name"), 0 }, + { "+app", I18N_NOOP("Socket name"), 0 }, + KCmdLineLastOption +}; + +int kdemain(int argc, char ** argv) +{ + // TDEApplication uses libkcddb which needs a valid kapp pointer + // GUIenabled must be true as libkcddb sometimes wants to communicate + // with the user + putenv(strdup("SESSION_MANAGER=")); + TDEApplication::disableAutoDcopRegistration(); + TDECmdLineArgs::init(argc, argv, "kio_audiocd", 0, 0, 0, 0); + TDECmdLineArgs::addCmdLineOptions(options); + TDEApplication app(false, true); + + kdDebug(7117) << "Starting " << getpid() << endl; + + TDECmdLineArgs* args = TDECmdLineArgs::parsedArgs(); + AudioCDProtocol slave(args->arg(0), args->arg(1), args->arg(2)); + slave.dispatchLoop(); + + kdDebug(7117) << "Done" << endl; + return 0; +} + +enum Which_dir { + Unknown = 0, // Error + Info, // CDDB info + Root, // The root directory, shows all these :) + FullCD, // Show a single file containing all of the data + EncoderDir // A directory created by an encoder +}; + +class AudioCDProtocol::Private { +public: + Private() : cd(KCompactDisc::Asynchronous) { + clearURLargs(); + s_info = i18n("Information"); + s_fullCD = i18n("Full CD"); + } + + void clearURLargs() { + req_allTracks = false; + which_dir = Unknown; + req_track = -1; + cddbUserChoice = -1; + } + + // The type/which of request + bool req_allTracks; + Which_dir which_dir; + int req_track; + TQString fname; + AudioCDEncoder *encoder_dir_type; + + // Misc settings + TQString device; // URL settable + int paranoiaLevel; // URL settable + bool reportErrors; + + // Directory strings, never change after init + TQString s_info; + TQString s_fullCD; + + // Current CD + unsigned discid; + unsigned tracks; + bool trackIsAudio[100]; + KCompactDisc cd; // keep it around so that we don't assume the disk changed between every stat() + + // CDDB items + KCDDB::CDDB::Result cddbResult; + CDInfoList cddbList; + int cddbUserChoice; // URL settable + KCDDB::CDInfo cddbBestChoice; + + // Template for .. + TQString fileNameTemplate; // URL settable + TQString albumTemplate; // URL settable + TQString rsearch; + TQString rreplace; + + // Current strings for this CD and or cddb selection + TQStringList templateTitles; + TQString templateAlbumName; +}; + +int paranoia_read_limited_error; + +AudioCDProtocol::AudioCDProtocol(const TQCString & protocol, const TQCString & pool, const TQCString & app) + : SlaveBase(protocol, pool, app) +{ + d = new Private; + + // Add encoders + AudioCDEncoder::findAllPlugins(this, encoders); + encoderTypeCDA = encoderFromExtension(".cda"); + encoderTypeWAV = encoderFromExtension(".wav"); + encoders.setAutoDelete(true); +} + +AudioCDProtocol::~AudioCDProtocol() +{ + delete d; +} + +AudioCDEncoder *AudioCDProtocol::encoderFromExtension(const TQString& extension) +{ + AudioCDEncoder *encoder; + for ( encoder = encoders.first(); encoder; encoder = encoders.next() ){ + if(TQString(".")+encoder->fileType() == extension) + return encoder; + } + Q_ASSERT(false); + return NULL; +} + +AudioCDEncoder *AudioCDProtocol::determineEncoder(const TQString & filename) +{ + int len = filename.length(); + int pos = filename.findRev('.'); + return encoderFromExtension(filename.right(len - pos)); +} + +struct cdrom_drive * AudioCDProtocol::initRequest(const KURL & url) +{ + if (url.hasHost()) + { + error(TDEIO::ERR_UNSUPPORTED_ACTION, + i18n("You cannot specify a host with this protocol. " + "Please use the audiocd:/ format instead.")); + return 0; + } + + // Load OUR Settings. + loadSettings(); + // Then url parameters can overrule our settings. + parseURLArgs(url); + + struct cdrom_drive * drive = getDrive(); + if (0 == drive) + return 0; + + // Update our knowledge of the disc + +#if defined(__linux__) + if(drive->ioctl_device_name && drive->ioctl_device_name[0]) + d->cd.setDevice(drive->ioctl_device_name, 50, false); + else + d->cd.setDevice(drive->cdda_device_name, 50, false); +#else + d->cd.setDevice(drive->cdda_device_name, 50, false); +#endif + +#if 0 + // FreeBSD's cdparanoia as of january 5th 2006 has rather broken + // support for non-SCSI devices. Although it finds ATA cdroms just + // fine, there is no straightforward way to discover the device + // name associated with the device, which throws the rest of audiocd + // for a loop. + // + if ( !(drive->dev) || (COOKED_IOCTL == drive->interface) ) + { + // For ATAPI devices, we have no real choice. Use the + // user selected value, even if there is none. + // + kdWarning(7117) << "Found an ATAPI device, assuming it is the one specified by the user." << endl; + d->cd.setDevice( d->device ); + } + else + { + kdDebug(7117) << "Found a SCSI or ATAPICAM device." << endl; + if ( strlen(drive->dev->device_path) > 0 ) + { + d->cd.setDevice( drive->dev->device_path ); + } + else + { + // But the device_path can be empty under some + // circumstances, so build a representation from + // the unit number and SCSI device name. + // + TQString devname = TQString::fromLatin1( "/dev/%1%2" ) + .arg( drive->dev->given_dev_name ) + .arg( drive->dev->given_unit_number ) ; + kdDebug(7117) << " Using derived name " << devname << endl; + d->cd.setDevice( devname ); + } + } +#endif + + if (d->cd.discId() != d->discid && d->cd.discId() != d->cd.missingDisc){ + d->discid = d->cd.discId(); + d->tracks = d->cd.tracks(); + for(uint i=0; i< d->cd.tracks(); i++) + d->trackIsAudio[i] = d->cd.isAudio(i+1); + + KCDDB::Client c; + d->cddbResult = c.lookup(d->cd.discSignature()); + d->cddbList = c.lookupResponse(); + d->cddbBestChoice = c.bestLookupResponse(); + generateTemplateTitles(); + } + + // Determine what file or folder that is wanted. + d->fname = url.fileName(false); + TQString dname = url.directory(true, false); + if (!dname.isEmpty() && dname[0] == '/') + dname = dname.mid(1); + + // Kong issue where they send dirs as files, double check + /* A hack, for when konqi wants to list the directory audiocd:/Bla + it really submits this URL, instead of audiocd:/Bla/ to us. We could + send (in listDir) the UDS_NAME as "Bla/" for directories, but then + konqi shows them as "Bla//" in the status line. */ + // See if it is an encoder directory + AudioCDEncoder *encoder; + for ( encoder = encoders.first(); encoder; encoder = encoders.next() ){ + if(encoder->type() == d->fname){ + dname = d->fname; + d->fname = ""; + break; + } + } + // Other Hard coded directories + if (dname.isEmpty() && (d->fname == d->s_info || d->fname == d->s_fullCD )) + { + dname = d->fname; + d->fname = ""; + } + // end hack + + + // See which directory they want + d->which_dir = Unknown; + for ( encoder = encoders.first(); encoder; encoder = encoders.next() ){ + if(encoder->type() == dname){ + d->which_dir = EncoderDir; + d->encoder_dir_type = encoder; + break; + } + } + if ( Unknown == d->which_dir ){ + if (dname.isEmpty()) + d->which_dir = Root; + else if (dname == d->s_info) + d->which_dir = Info; + else if (dname == d->s_fullCD) + d->which_dir = FullCD; + } + + // See if the url is a track + d->req_track = -1; + if (!d->fname.isEmpty()){ + TQString name(d->fname); + + // Remove extension + int dot = name.findRev('.'); + if (dot >= 0) + name.truncate(dot); + + // See if it matches a cddb title + uint trackNumber; + for (trackNumber = 0; trackNumber < d->tracks; trackNumber++){ + if (d->templateTitles[trackNumber] == name) + break; + } + if (trackNumber < d->tracks) + d->req_track = trackNumber; + else { + /* Not found in title list. Try hard to find a number in the + string. */ + unsigned int start = 0; + unsigned int end = 0; + // Find where the numbers start + while (start < name.length()){ + if (name[start++].isDigit()) + break; + } + // Find where the numbers end + for (end = start; end < name.length(); end++) + if (!name[end].isDigit()) + break; + if (start < name.length()){ + bool ok; + // The external representation counts from 1 so subtrac 1. + d->req_track = name.mid(start-1, end - start+2).toInt(&ok) - 1; + if (!ok) + d->req_track = -1; + } + } + } + if (d->req_track >= (int)d->tracks) + d->req_track = -1; + + // Are we in the directory that lists "full CD" files? + d->req_allTracks = (dname.contains(d->s_fullCD)); + + kdDebug(7117) << "dir=" << dname << " file=" << d->fname + << " req_track=" << d->req_track << " which_dir=" << d->which_dir << " full CD?=" << d->req_allTracks << endl; + return drive; +} + +bool AudioCDProtocol::getSectorsForRequest(struct cdrom_drive * drive, long & firstSector, long & lastSector) const +{ + if (d->req_allTracks) + { // we rip all the tracks of the CD + firstSector = cdda_track_firstsector(drive, 1); + lastSector = cdda_track_lastsector(drive, cdda_tracks(drive)); + } + else + { // we only rip the selected track + int trackNumber = d->req_track + 1; + + if (trackNumber <= 0 || trackNumber > cdda_tracks(drive)) + return false; + firstSector = cdda_track_firstsector(drive, trackNumber); + lastSector = cdda_track_lastsector(drive, trackNumber); + } + return true; +} + +void AudioCDProtocol::get(const KURL & url) +{ + struct cdrom_drive * drive = initRequest(url); + if (!drive) + return; + + if( d->fname.contains(i18n(CDDB_INFORMATION))){ + uint choice = 1; + if(d->fname != TQString("%1.txt").arg(i18n(CDDB_INFORMATION))){ + choice= d->fname.section('_',1,1).section('.',0,0).toInt(); + } + uint count = 1; + CDInfoList::iterator it; + bool found = false; + for ( it = d->cddbList.begin(); it != d->cddbList.end(); ++it ){ + if(count == choice){ + mimeType("text/html"); + data(TQCString( (*it).toString().latin1() )); + // send an empty TQByteArray to signal end of data. + data(TQByteArray()); + finished(); + found = true; + break; + } + count++; + } + if(!found && d->fname.contains(i18n(CDDB_INFORMATION)+":")){ + mimeType("text/html"); + //data(TQCString( d->fname.latin1() )); + // send an empty TQByteArray to signal end of data. + data(TQByteArray()); + finished(); + found = true; + } + if( !found ) + error(TDEIO::ERR_DOES_NOT_EXIST, url.path()); + cdda_close(drive); + return; + } + + long firstSector, lastSector; + if (!getSectorsForRequest(drive, firstSector, lastSector)) + { + error(TDEIO::ERR_DOES_NOT_EXIST, url.path()); + cdda_close(drive); + return; + } + + AudioCDEncoder *encoder = determineEncoder(d->fname); + if(!encoder){ + cdda_close(drive); + return; + } + + KCDDB::CDInfo info; + if(d->cddbResult == KCDDB::CDDB::Success){ + info = d->cddbBestChoice; + + int track = d->req_track; + + // hack + // do we rip the whole CD? + if (d->req_allTracks){ + track = 0; + // YES => the title of the file is the title of the CD + info.trackInfoList[track].title = info.title.utf8().data(); + } + encoder->fillSongInfo(info, track, ""); + } + long totalByteCount = CD_FRAMESIZE_RAW * (lastSector - firstSector + 1); + long time_secs = (8 * totalByteCount) / (44100 * 2 * 16); + + unsigned long size = encoder->size(time_secs); + totalSize(size); + emit mimeType(TQFL1(encoder->mimeType())); + + // Read data (track/disk) from the cd + paranoiaRead(drive, firstSector, lastSector, encoder, url.fileName(), size); + + // send an empty TQByteArray to signal end of data. + data(TQByteArray()); + + cdda_close(drive); + + finished(); +} + +void AudioCDProtocol::stat(const KURL & url) +{ + struct cdrom_drive * drive = initRequest(url); + if (!drive) + return; + + bool isFile = !d->fname.isEmpty(); + + // the track number. 0 if ripping + // the whole CD. + uint trackNumber = d->req_track + 1; + + if (!d->req_allTracks) + { // we only want to rip one track. + // does this track exist? + if (isFile && (trackNumber < 1 || trackNumber > d->tracks)) + { + error(TDEIO::ERR_DOES_NOT_EXIST, url.path()); + return; + } + } + + UDSEntry entry; + + UDSAtom atom; + atom.m_uds = TDEIO::UDS_NAME; + atom.m_str = url.fileName().replace('/', TQFL1("%2F")); + kdDebug(7117) << k_funcinfo << atom.m_str << endl; + entry.append(atom); + + atom.m_uds = TDEIO::UDS_FILE_TYPE; + atom.m_long = isFile ? S_IFREG : S_IFDIR; + entry.append(atom); + + const mode_t _umask = ::umask(0); + ::umask(_umask); + + atom.m_uds = TDEIO::UDS_ACCESS; + atom.m_long = 0666 & (~_umask); + entry.append(atom); + + atom.m_uds = TDEIO::UDS_SIZE; + if (!isFile) + { + atom.m_long = cdda_tracks(drive); + } + else + { + AudioCDEncoder *encoder = determineEncoder(d->fname); + long firstSector, lastSector; + getSectorsForRequest(drive, firstSector, lastSector); + atom.m_long = fileSize(firstSector, lastSector, encoder); + } + + entry.append(atom); + + statEntry(entry); + + cdda_close(drive); + + finished(); +} + +static void app_entry(UDSEntry& e, unsigned int uds, const TQString& str) +{ + UDSAtom a; + a.m_uds = uds; + a.m_str = str; + e.append(a); +} + +static void app_entry(UDSEntry& e, unsigned int uds, long l) +{ + UDSAtom a; + a.m_uds = uds; + a.m_long = l; + e.append(a); +} + +static void app_dir(UDSEntry& e, const TQString & n, size_t s) +{ + e.clear(); + app_entry(e, TDEIO::UDS_NAME, TQFile::decodeName(n.local8Bit())); + app_entry(e, TDEIO::UDS_FILE_TYPE, S_IFDIR); + app_entry(e, TDEIO::UDS_ACCESS, 0400); + app_entry(e, TDEIO::UDS_SIZE, s); + app_entry(e, TDEIO::UDS_MIME_TYPE, "inode/directory"); +} + +static void app_file(UDSEntry& e, const TQString & n, size_t s) +{ + e.clear(); + app_entry(e, TDEIO::UDS_NAME, TQFile::decodeName(n.local8Bit())); + app_entry(e, TDEIO::UDS_FILE_TYPE, S_IFREG); + app_entry(e, TDEIO::UDS_ACCESS, 0400); + app_entry(e, TDEIO::UDS_SIZE, s); +} + +void AudioCDProtocol::listDir(const KURL & url) +{ + struct cdrom_drive * drive = initRequest(url); + + // Some error checking before proceeding + if (!drive) + return; + + if (d->which_dir == Unknown){ + error(TDEIO::ERR_DOES_NOT_EXIST, url.path()); + cdda_close(drive); + return; + } + + if ( !d->fname.isEmpty() ){ + error(TDEIO::ERR_IS_FILE, url.path()); + cdda_close(drive); + return; + } + + // Generate templated names every time + // because the template might have changed. + generateTemplateTitles(); + + UDSEntry entry; + // If the tracks should be listed in this directory + bool list_tracks = true; + + if (d->which_dir == Info){ + CDInfoList::iterator it; + uint count = 1; + for ( it = d->cddbList.begin(); it != d->cddbList.end(); ++it ){ + (*it).toString(); + if(count == 1) + app_file(entry, TQString("%1.txt").arg(i18n(CDDB_INFORMATION)), ((*it).toString().length())+1); + else + app_file(entry, TQString("%1_%2.txt").arg(i18n(CDDB_INFORMATION)).arg(count), ((*it).toString().length())+1); + count++; + listEntry(entry, false); + } + // Error + if( count == 1 ) { + app_file(entry, TQString("%1: %2.txt").arg(i18n(CDDB_INFORMATION)).arg(CDDB::resultToString(d->cddbResult)), ((*it).toString().length())+1); + count++; + listEntry(entry, false); + } + + list_tracks = false; + } + + if (d->which_dir == Root){ + // List virtual directories. + app_dir(entry, d->s_fullCD, encoders.count()); + listEntry(entry, false); + + // Either >0 cddb results or cddb error file + app_dir(entry, d->s_info, d->cddbList.count()); + listEntry(entry, false); + + // List the encoders + AudioCDEncoder *encoder; + for ( encoder = encoders.first(); encoder; encoder = encoders.next() ){ + // Skip the directory that is in the root (you can still go in it, just don't show it) + if( encoder == encoderTypeWAV ) + continue; + app_dir(entry, encoder->type(), d->tracks); + listEntry(entry, false); + } + } + + // Now fill in the tracks for the current directory + if (list_tracks && d->which_dir == FullCD) { + // if we're listing the "full CD" subdirectory : + if ( (d->which_dir == FullCD) ) { + AudioCDEncoder *encoder; + for ( encoder = encoders.first(); encoder; encoder = encoders.next() ){ + if (d->cddbResult != KCDDB::CDDB::Success) + addEntry(d->s_fullCD, encoder, drive, -1); + else + addEntry(d->templateAlbumName, encoder, drive, -1); + } + } + } + + if (list_tracks && d->which_dir != FullCD) { + // listing another dir than the "FullCD" one. + for (uint trackNumber = 1; trackNumber <= d->tracks; trackNumber++) + { + // Skip data tracks + if (!d->trackIsAudio[trackNumber-1]) + continue; + + switch (d->which_dir) { + case Root:{ + addEntry(d->templateTitles[trackNumber - 1], + encoderTypeWAV, drive, trackNumber); + break; + } + case EncoderDir: + addEntry(d->templateTitles[trackNumber - 1], + d->encoder_dir_type, drive, trackNumber); + break; + case Info: + case Unknown: + default: + error(TDEIO::ERR_INTERNAL, url.path()); + cdda_close(drive); + return; + } + } + } + + totalSize(entry.count()); + listEntry(entry, true); + cdda_close(drive); + finished(); +} + +void AudioCDProtocol::addEntry(const TQString& trackTitle, AudioCDEncoder *encoder, struct cdrom_drive * drive, int trackNo) +{ + if(!encoder || !drive) + return; + + long theFileSize = 0; + if (trackNo == -1) + { // adding entry for the full CD + theFileSize = fileSize(cdda_track_firstsector(drive, 1), + cdda_track_lastsector(drive, cdda_tracks(drive)), + encoder); + } + else + { // adding one regular track + long firstSector = cdda_track_firstsector(drive, trackNo); + long lastSector = cdda_track_lastsector(drive, trackNo); + theFileSize = fileSize(firstSector, lastSector, encoder); + } + UDSEntry entry; + app_file(entry, trackTitle + TQString(".")+encoder->fileType(), theFileSize); + listEntry(entry, false); +} + +long AudioCDProtocol::fileSize(long firstSector, long lastSector, AudioCDEncoder *encoder) +{ + if(!encoder) + return 0; + + long filesize = CD_FRAMESIZE_RAW * ( lastSector - firstSector + 1 ); + long length_seconds = (filesize) / 176400; + + return encoder->size(length_seconds); +} + +struct cdrom_drive *AudioCDProtocol::getDrive() +{ + TQCString device(TQFile::encodeName(d->device)); + + struct cdrom_drive * drive = 0; + + if (!device.isEmpty() && device != "/") + drive = cdda_identify(device, CDDA_MESSAGE_PRINTIT, 0); + else + { + drive = cdda_find_a_cdrom(CDDA_MESSAGE_PRINTIT, 0); + + if (0 == drive) + { + if (TQFile(TQFile::decodeName(DEFAULT_CD_DEVICE)).exists()) + drive = cdda_identify(DEFAULT_CD_DEVICE, CDDA_MESSAGE_PRINTIT, 0); + } + } + + if (0 == drive) { + kdDebug(7117) << "Can't find an audio CD on: \"" << d->device << "\"" << endl; + + TQFileInfo fi(d->device); + if(!fi.isReadable()) + error(TDEIO::ERR_SLAVE_DEFINED, i18n("Device doesn't have read permissions for this account. Check the read permissions on the device.")); + else if(!fi.isWritable()) + error(TDEIO::ERR_SLAVE_DEFINED, i18n("Device doesn't have write permissions for this account. Check the write permissions on the device.")); + else if(!fi.exists()) + error(TDEIO::ERR_DOES_NOT_EXIST, d->device); + else error(TDEIO::ERR_SLAVE_DEFINED, +i18n("Unknown error. If you have a cd in the drive try running cdparanoia -vsQ as yourself (not root). Do you see a track list? If not, make sure you have permission to access the CD device. If you are using SCSI emulation (possible if you have an IDE CD writer) then make sure you check that you have read and write permissions on the generic SCSI device, which is probably /dev/sg0, /dev/sg1, etc.. If it still does not work, try typing audiocd:/?device=/dev/sg0 (or similar) to tell kio_audiocd which device your CD-ROM is.")); + return 0; + } + + if (0 != cdda_open(drive)) + { + kdDebug(7117) << "cdda_open failed" << endl; + error(TDEIO::ERR_CANNOT_OPEN_FOR_READING, d->device); + cdda_close(drive); + return 0; + } + + return drive; +} + +void AudioCDProtocol::paranoiaRead( + struct cdrom_drive * drive, + long firstSector, + long lastSector, + AudioCDEncoder* encoder, + const TQString& fileName, + unsigned long size + ) +{ + if(!encoder || !drive) + return; + + cdrom_paranoia * paranoia = paranoia_init(drive); + if (0 == paranoia) { + kdDebug(7117) << "paranoia_init failed" << endl; + return; + } + + int paranoiaLevel = PARANOIA_MODE_FULL ^ PARANOIA_MODE_NEVERSKIP; + switch (d->paranoiaLevel) + { + case 0: + paranoiaLevel = PARANOIA_MODE_DISABLE; + break; + + case 1: + paranoiaLevel |= PARANOIA_MODE_OVERLAP; + paranoiaLevel &= ~PARANOIA_MODE_VERIFY; + break; + + case 2: + paranoiaLevel |= PARANOIA_MODE_NEVERSKIP; + default: + break; + } + + paranoia_modeset(paranoia, paranoiaLevel); + + cdda_verbose_set(drive, CDDA_MESSAGE_PRINTIT, CDDA_MESSAGE_PRINTIT); + + paranoia_seek(paranoia, firstSector, SEEK_SET); + + long currentSector(firstSector); + + unsigned long processed = encoder->readInit(CD_FRAMESIZE_RAW * (lastSector - firstSector + 1)); + // TODO test for errors (processed<0)? + processedSize(processed); + bool ok = true; + + unsigned long lastSize = size; + unsigned long diff = 0; + + paranoia_read_limited_error = 0; + int warned = 0; + while (currentSector <= lastSector) + { + // TODO make the 5 configurable? The default in the lib is 20 fyi + int16_t * buf = paranoia_read_limited(paranoia, paranoiaCallback, 5); + if( warned == 0 && paranoia_read_limited_error >= 5 && d->reportErrors ){ + warning(i18n("AudioCD: Disk damage detected on this track, risk of data corruption.")); + warned = 1; + } + if (0 == buf) { + kdDebug(7117) << "Unrecoverable error in paranoia_read" << endl; + ok = false; + error( ERR_SLAVE_DEFINED, i18n( "Error reading audio data for %1 from the CD" ).arg( fileName ) ); + break; + } + + ++currentSector; + + int encoderProcessed = encoder->read(buf, CD_FRAMESAMPLES); + if(encoderProcessed == -1){ + kdDebug(7117) << "Encoder processing error, stopping." << endl; + ok = false; + TQString errMsg = i18n( "Couldn't read %1: encoding failed" ).arg( fileName ); + TQString details = encoder->lastErrorMessage(); + if ( !details.isEmpty() ) + errMsg += "\n" + details; + error( ERR_SLAVE_DEFINED, errMsg ); + break; + } + processed += encoderProcessed; + + /** + * Because compression size is so 'unknown' use some guesswork + * + * 1) First assume that the reported size is correct and + * only change the totalSize if the guess it outside a range of %5. + * 2) Only increase in size unless the decrease is %5 of last estimate. + * This prevents continues small changes which is just annoying. + */ + unsigned long end = lastSector - firstSector; + unsigned long cur = currentSector - firstSector; + unsigned long estSize = (processed / cur ) * end; + + // If our guess is within 5% of reported + // size then use the reported size. + unsigned long guess = (long)((100/(float)size)*estSize); + if((guess > 97 && guess < 103) || estSize == 0){ + if(processed > lastSize){ + totalSize(processed+1); + lastSize = processed; + } + } + else{ + float percentDone = ((float)cur/(float)end); + // Calculate estimated amount that will be wrong + diff = estSize - lastSize; + diff = (diff*(unsigned long)((100/(float)end)*(end-cur)))/2; + // Need 1% of data calculated as initial buffer, use %2 to be safe + if( percentDone < .02 ){ + //tqDebug("val: %f, diff: %ld", ((float)cur/(float)end), diff); + diff = 0; + } + + // We are growing larger, increase total. + if(lastSize < estSize){ + //tqDebug("lastGuess: %ld, guess: %ld diff: %ld", lastSize, estSize, diff); + totalSize(estSize+diff); + lastSize = estSize+diff; + } + else{ + int margin = (int)((percentDone)*75); + // Don't bother really trying until almost half way done. + if( percentDone <= .40 ) + margin = 7; + unsigned long low = lastSize - lastSize/margin; + if(estSize < low){ + //tqDebug("low: %ld, estSize: %ld, num: %i", low, estSize, margin); + totalSize( estSize ); + lastSize = estSize; + } + } + } + /** + * End estimation. + */ + //tqDebug("processed: %ld, totalSize: %ld", processed, estSize); + processedSize(processed); + } + + if(processed > size) + totalSize(processed); + + long encoderProcessed = encoder->readCleanup(); + if ( encoderProcessed >= 0 ) { + processed += encoderProcessed; + if(processed > size) + totalSize(processed); + processedSize(processed); + } + else if ( ok ) // i.e. no error message already emitted + error( ERR_SLAVE_DEFINED, i18n( "Couldn't read %1: encoding failed" ).arg( fileName ) ); + + paranoia_free(paranoia); + paranoia = 0; +} + +/** + * Read the settings from the URL + * @see loadSettings() + */ +void AudioCDProtocol::parseURLArgs(const KURL & url) +{ + d->clearURLargs(); + + TQString query(KURL::decode_string(url.query())); + + if (query.isEmpty() || query[0] != '?') + return; + + query = query.mid(1); // Strip leading '?'. + + TQStringList tokens(TQStringList::split('&', query)); + + for (TQStringList::ConstIterator it(tokens.begin()); it != tokens.end(); ++it) + { + TQString token(*it); + + int equalsPos(token.find('=')); + if (-1 == equalsPos) + continue; + + TQString attribute(token.left(equalsPos)); + TQString value(token.mid(equalsPos + 1)); + + if (attribute == TQFL1("device")) + d->device = value; + else if (attribute == TQFL1("paranoia_level")) + d->paranoiaLevel = value.toInt(); + else if (attribute == TQFL1("fileNameTemplate")) + d->fileNameTemplate = value; + else if (attribute == TQFL1("albumNameTemplate")) + d->albumTemplate = value; + else if (attribute == TQFL1("cddbChoice")) + d->cddbUserChoice = value.toInt(); + else if (attribute == TQFL1("niceLevel")){ + int niceLevel = value.toInt(); + if(setpriority(PRIO_PROCESS, getpid(), niceLevel) != 0) + kdDebug(7117) << "Setting nice level to (" << niceLevel << ") failed." << endl; + } + } +} + +/** + * Read the settings set by the kcm modules + * @see parseURLArgs() + */ +void AudioCDProtocol::loadSettings() +{ + TDEConfig *config = new TDEConfig(TQFL1("kcmaudiocdrc"), true /*readonly*/, false /*no kdeglobals*/); + + config->setGroup(TQFL1("CDDA")); + + if (!config->readBoolEntry(TQFL1("autosearch"),true)) { + d->device = config->readEntry(TQFL1("device"),TQFL1(DEFAULT_CD_DEVICE)); + } + + d->paranoiaLevel = 1; // enable paranoia error correction, but allow skipping + + if (config->readBoolEntry("disable_paranoia",false)) { + d->paranoiaLevel = 0; // disable all paranoia error correction + } + + if (config->readBoolEntry("never_skip",true)) { + d->paranoiaLevel = 2; + // never skip on errors of the medium, should be default for high quality + } + + d->reportErrors = config->readBoolEntry( "report_errors", false ); + + if(config->hasKey("niceLevel")) { + int niceLevel = config->readNumEntry("niceLevel", 0); + if(setpriority(PRIO_PROCESS, getpid(), niceLevel) != 0) + kdDebug(7117) << "Setting nice level to (" << niceLevel << ") failed." << endl; + } + + // The default track filename template + config->setGroup("FileName"); + d->fileNameTemplate = config->readEntry("file_name_template", "%{albumartist} - %{number} - %{title}"); + d->albumTemplate = config->readEntry("album_template", "%{albumartist} - %{albumtitle}"); + d->rsearch = config->readEntry("regexp_search"); + d->rreplace = config->readEntry("regexp_replace"); + // if the regular expressions are enclosed in qoutes. remove them + // otherwise it is not possible to search for a space " ", since an empty (only spaces) value is not + // supported by TDEConfig, so the space has to be qouted, but then here the regexp searches really for " " + // instead of just the space. Alex + TQRegExp qoutedString("^\".*\"$"); + if (qoutedString.exactMatch(d->rsearch)) + { + d->rsearch=d->rsearch.mid(1, d->rsearch.length()-2); + } + if (qoutedString.exactMatch(d->rreplace)) + { + d->rreplace=d->rreplace.mid(1, d->rreplace.length()-2); + } + + // Tell the encoders to load their settings + AudioCDEncoder *encoder = encoders.first(); + while ( encoder ) { + if ( encoder->init() ) { + kdDebug(7117) << "Encoder for " << encoder->type() << " is available." << endl; + encoder->loadSettings(); + encoder = encoders.next(); + } else { + kdDebug(7117) << "Encoder for " << encoder->type() << " is NOT available." << endl; + encoders.remove( encoder ); + encoder = encoders.current(); + } + } + + delete config; +} + +/** + * Generates the track titles from the template using the cddb information. + */ +void AudioCDProtocol::generateTemplateTitles() +{ + d->templateTitles.clear(); + if (d->cddbResult != KCDDB::CDDB::Success) + { + for (unsigned int i = 0; i < d->tracks; i++){ + TQString n; + d->templateTitles.append( i18n("Track %1").arg(n.sprintf("%02d", i + 1))); + } + return; + } + + KCDDB::CDInfo info = d->cddbBestChoice; + if(d->cddbUserChoice >= 0 && (((uint)d->cddbUserChoice) < d->cddbList.count())) + info = d->cddbList[d->cddbUserChoice]; + + // Then generate the templates + d->templateTitles.clear(); + for (uint i = 0; i < d->tracks; i++) { + TQMap macros; + macros["albumartist"] = info.artist; + macros["albumtitle"] = info.title; + macros["title"] = (info.trackInfoList[i].title); + TQString n; + macros["number"] = n.sprintf("%02d", i + 1); + //macros["number"] = TQString("%1").arg(i+1, 2, 10); + macros["genre"] = info.genre; + macros["year"] = TQString::number(info.year); + + TQString title = KMacroExpander::expandMacros(d->fileNameTemplate, macros, '%').replace('/', TQFL1("%2F")); + title.replace( TQRegExp(d->rsearch), d->rreplace ); + d->templateTitles.append(title); + } + + TQMap macros; + macros["albumartist"] = info.artist; + macros["albumtitle"] = info.title; + macros["genre"] = info.genre; + macros["year"] = TQString::number(info.year); + d->templateAlbumName = KMacroExpander::expandMacros(d->albumTemplate, macros, '%').replace('/', TQFL1("%2F")); + d->templateAlbumName.replace( TQRegExp(d->rsearch), d->rreplace ); +} + +/** + * Based upon the cdparinoia ripping application + * Only output BAD stuff + * The higher the paranoia_read_limited_error the worse the problem is + * FYI: PARANOIA_CB_READ & PARANOIA_CB_VERIFY happen continusly when ripping + */ +void paranoiaCallback(long, int function) +{ + switch(function){ + case PARANOIA_CB_VERIFY: + //kdDebug(7117) << "PARANOIA_CB_VERIFY" << endl; + break; + + case PARANOIA_CB_READ: + //kdDebug(7117) << "PARANOIA_CB_READ" << endl; + break; + + case PARANOIA_CB_FIXUP_EDGE: + //kdDebug(7117) << "PARANOIA_CB_FIXUP_EDGE" << endl; + paranoia_read_limited_error = 2; + break; + + case PARANOIA_CB_FIXUP_ATOM: + //kdDebug(7117) << "PARANOIA_CB_FIXUP_ATOM" << endl; + paranoia_read_limited_error = 6; + break; + + case PARANOIA_CB_READERR: + kdDebug(7117) << "PARANOIA_CB_READERR" << endl; + paranoia_read_limited_error = 6; + break; + + case PARANOIA_CB_SKIP: + kdDebug(7117) << "PARANOIA_CB_SKIP" << endl; + paranoia_read_limited_error = 8; + break; + + case PARANOIA_CB_OVERLAP: + //kdDebug(7117) << "PARANOIA_CB_OVERLAP" << endl; + break; + + case PARANOIA_CB_SCRATCH: + kdDebug(7117) << "PARANOIA_CB_SCRATCH" << endl; + paranoia_read_limited_error = 7; + break; + + case PARANOIA_CB_DRIFT: + //kdDebug(7117) << "PARANOIA_CB_DRIFT" << endl; + paranoia_read_limited_error = 4; + break; + + case PARANOIA_CB_FIXUP_DROPPED: + kdDebug(7117) << "PARANOIA_CB_FIXUP_DROPPED" << endl; + paranoia_read_limited_error = 5; + break; + + case PARANOIA_CB_FIXUP_DUPED: + kdDebug(7117) << "PARANOIA_CB_FIXUP_DUPED" << endl; + paranoia_read_limited_error = 5; + break; + } +} + diff --git a/tdeioslave/audiocd/audiocd.h b/tdeioslave/audiocd/audiocd.h new file mode 100644 index 00000000..75b9bfd2 --- /dev/null +++ b/tdeioslave/audiocd/audiocd.h @@ -0,0 +1,126 @@ +/* + * Copyright (C) 2000 Rik Hemsley (rikkus) + * Copyright (C) 2000, 2001, 2002 Michael Matz + * Copyright (C) 2001 Carsten Duvenhorst + * Copyright (C) 2001 Adrian Schroeter + * Copyright (C) 2003 Richard Lärkäng + * Copyright (C) 2003 Scott Wheeler + * Copyright (C) 2004, 2005 Benjamin Meyer + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * ERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef AUDIO_CD_H +#define AUDIO_CD_H + +#include + +class AudioCDEncoder; + +struct cdrom_drive; + +namespace AudioCD { + +/** + * The core class of the audiocd:// ioslave. + * It has the iosalve login and the ripping logic. The actual encoding + * is done by encoders that are seperate objects. + */ +class AudioCDProtocol : public TDEIO::SlaveBase +{ + public: + + AudioCDProtocol(const TQCString & protocol, const TQCString & pool, const TQCString & app); + virtual ~AudioCDProtocol(); + + virtual void get(const KURL &); + virtual void stat(const KURL &); + virtual void listDir(const KURL &); + + protected: + AudioCDEncoder *encoderFromExtension(const TQString& extension); + AudioCDEncoder *determineEncoder(const TQString & filename); + + struct cdrom_drive *findDrive(bool &noPermission); + void parseURLArgs(const KURL &); + + void loadSettings(); + + /** + * From the request information (Private member "d"), + * get the first and last sector for the request. + * return false if the parameters are invalid (for instance, + * track number which does not exist on this CD) + */ + bool getSectorsForRequest(struct cdrom_drive * drive, + long & firstSector, long & lastSector) const; + + /** + * Give the size in bytes of the space between those two + * sectors, depending on the file type. + */ + long fileSize(long firstSector, long lastSector, AudioCDEncoder *encoder); + + /** + * The heart of this ioslave. + * Reads data off the cd and then passes it to an encoder to encode + */ + void paranoiaRead( + struct cdrom_drive * drive, + long firstSector, + long lastSector, + AudioCDEncoder* encoder, + const TQString& fileName, + unsigned long size + ); + + struct cdrom_drive *initRequest(const KURL &); + uint discid(struct cdrom_drive *); + + /** + * Add an entry in the KIO directory, using the title you give, + * it will set the extension itself depending on the fileType. + * You must also give the trackNumber for the size of the file + * to be calculated. + * NOTE: if you want to add a file which is the whole CD, give + * trackNo = -1 + * NOTE2: you can safely add MP3 or OGG files always. the function + * will check if kio_audiocd was compiled with support for those, + * so NO NEED to wrap your calls with #ifdef for lame or vorbis. + * this function will do the right thing. + */ + void addEntry(const TQString& trackTitle, AudioCDEncoder *encoder, + struct cdrom_drive * drive, int trackNo); + + class Private; + Private * d; + +private: + + void generateTemplateTitles(); + + TQPtrList encoders; + cdrom_drive * getDrive(); + + // These are the only garenteed encoders to be built, the rest + // are dynamic depending on other libraries on the system + AudioCDEncoder *encoderTypeCDA; + AudioCDEncoder *encoderTypeWAV; +}; + +} // end namespace AudioCD + +#endif // AUDIO_CD_H + diff --git a/tdeioslave/audiocd/audiocd.protocol b/tdeioslave/audiocd/audiocd.protocol new file mode 100644 index 00000000..eb462539 --- /dev/null +++ b/tdeioslave/audiocd/audiocd.protocol @@ -0,0 +1,16 @@ +[Protocol] +exec=kio_audiocd +protocol=audiocd +input=none +output=filesystem +listing=Name,Type,Size,Access +reading=true +writing=false +makedir=false +deleting=false +linking=false +moving=false +Icon=cdaudio_unmount +DocPath=tdeioslave/audiocd.html +Class=:local +ShowPreviews=false diff --git a/tdeioslave/audiocd/audiocd.upd b/tdeioslave/audiocd/audiocd.upd new file mode 100644 index 00000000..f4818e5f --- /dev/null +++ b/tdeioslave/audiocd/audiocd.upd @@ -0,0 +1,4 @@ +# Update for transport configuration +Id=1 +File=kcmaudiocdrc +Script=upgrade-metadata.sh,bash diff --git a/tdeioslave/audiocd/configure.in.bot b/tdeioslave/audiocd/configure.in.bot new file mode 100644 index 00000000..e69de29b diff --git a/tdeioslave/audiocd/configure.in.in b/tdeioslave/audiocd/configure.in.in new file mode 100644 index 00000000..99bacf59 --- /dev/null +++ b/tdeioslave/audiocd/configure.in.in @@ -0,0 +1,46 @@ +AC_DEFUN([AC_CHECK_LIBFLAC], +[ + AC_LANG_SAVE + AC_LANG_C + have_libFLAC=no + KDE_CHECK_HEADER(FLAC/metadata.h, + [ + KDE_CHECK_LIB(FLAC,FLAC__stream_decoder_process_single, + have_libFLAC=yes) + + ]) + if test "x$have_libFLAC" = "xyes"; then + LIBFLAC="-lFLAC" + AC_DEFINE(HAVE_LIBFLAC, 1, + [Define if you have libFLAC (required for loading FLAC files)]) + fi + AC_SUBST(LIBFLAC) + AC_LANG_RESTORE +]) + +AC_DEFUN([AC_CHECK_LIBOGGFLAC], +[ + AC_LANG_SAVE + AC_LANG_C + have_libOggFLAC=no + KDE_CHECK_HEADER(OggFLAC/seekable_stream_decoder.h, + [ + KDE_CHECK_LIB(OggFLAC,OggFLAC__seekable_stream_decoder_process_single, + have_libOggFLAC=yes,,[-lm -lOggFLAC -lFLAC]) + + ]) + if test "x$have_libOggFLAC" = "xyes"; then + LIBOGGFLAC="-lOggFLAC" + AC_DEFINE(HAVE_LIBOGGFLAC, 1, + [Define if you have libOggFLAC (required for loading OggFLAC files)]) + fi + AC_SUBST(LIBOGGFLAC) + AC_LANG_RESTORE +]) + +AC_ARG_WITH(flac,AC_HELP_STRING([--with-flac],[Enable FLAC support @<:@default=check@:>@]),[flac_test="$withval"],[flac_test="yes"]) + +if test "x$flac_test" = "xyes" ; then + AC_CHECK_LIBFLAC + AC_CHECK_LIBOGGFLAC +fi diff --git a/tdeioslave/audiocd/kcmaudiocd/Makefile.am b/tdeioslave/audiocd/kcmaudiocd/Makefile.am new file mode 100644 index 00000000..73d6be2d --- /dev/null +++ b/tdeioslave/audiocd/kcmaudiocd/Makefile.am @@ -0,0 +1,17 @@ +kde_module_LTLIBRARIES = kcm_audiocd.la + +kcm_audiocd_la_SOURCES = audiocdconfig.ui kcmaudiocd.cpp + +kcm_audiocd_la_LDFLAGS = $(all_libraries) $(KDE_PLUGIN) -module +kcm_audiocd_la_LIBADD = ../plugins/libaudiocdplugins.la $(LIB_TDEUI) + +INCLUDES = -I$(srcdir)/../plugins -I$(top_srcdir)/libkcddb $(all_includes) + +kcm_audiocd_la_METASOURCES = AUTO + +messages: rc.cpp + $(XGETTEXT) *.cpp -o $(podir)/kcmaudiocd.pot + +xdg_apps_DATA = audiocd.desktop + +audiocdconfig.cpp: audiocdconfig.h diff --git a/tdeioslave/audiocd/kcmaudiocd/audiocd.desktop b/tdeioslave/audiocd/kcmaudiocd/audiocd.desktop new file mode 100644 index 00000000..88bfedde --- /dev/null +++ b/tdeioslave/audiocd/kcmaudiocd/audiocd.desktop @@ -0,0 +1,182 @@ +[Desktop Entry] +Exec=tdecmshell audiocd +Icon=cdaudio_unmount +Type=Application + +X-TDE-ModuleType=Library +X-TDE-Library=audiocd + +Name=Audio CDs +Name[af]=Audio Cds +Name[ar]=أقراص مدمجة صوتية +Name[bg]=Аудио диск +Name[bn]=অডিও সিডি +Name[br]=CD klevet +Name[bs]=Audio CDi +Name[ca]=CD d'àudio +Name[cs]=Zvuková CD +Name[cy]=CDau Sain +Name[da]=Lyd-cd'er +Name[de]=Audio-CDs +Name[el]=CD μουσικής +Name[eo]=Son-KDoj +Name[es]=CDs audio +Name[et]=Audioplaadid +Name[eu]=Audio CD-ak +Name[fa]=دیسکهای فشردۀ صوتی +Name[fi]=Ääni-CD:t +Name[fr]=CD audio +Name[ga]=Dlúthdhioscaí Fuaime +Name[he]=תקליטורי שמע +Name[hi]=ऑडीयो सीडी +Name[hr]=Audio CD-i +Name[hu]=Hang-CD-böngésző +Name[is]=Tónlistardiskaflakkari +Name[it]=CD Audio +Name[ja]=オーディオ CD +Name[kk]=Аудио CD +Name[km]=ស៊ីឌី​អ៉ូឌីយ៉ូ +Name[ko]=오디오 CD +Name[lt]=Audio kompaktai +Name[mk]=Аудио ЦД-а +Name[nb]=Lyd-CD-er +Name[nds]=Klang-CDs +Name[ne]=अडियो सीडी +Name[nl]=Audio-cd's +Name[nn]=Lyd-CD-ar +Name[pa]=ਆਡੀਓ CD +Name[pl]=Przeglądarka audio CD +Name[pt]=CDs de Áudio +Name[pt_BR]=CDs de Áudio +Name[ro]=CD-uri audio +Name[ru]=Аудио CD +Name[se]=Jietna-CD:at +Name[sk]=Zvukové CD +Name[sl]=Avdio CD-ji +Name[sr]=Аудио CD-ови +Name[sr@Latn]=Audio CD-ovi +Name[sv]=Ljud-cd +Name[ta]=கேட்பொலி குறுந்தகடுகள் +Name[tg]=Дискҳои Фишурдаи Садо +Name[th]=ซีดีบันทึกเสียง +Name[tr]=Müzik CD +Name[uk]=Аудіо-КД +Name[uz]=Audio kompakt-disklar +Name[uz@cyrillic]=Аудио компакт-дисклар +Name[ven]=CD ino thetsheleswa +Name[xh]=CDs Zokuvakalayo +Name[zh_CN]=音频 CD +Name[zh_HK]=音樂 CD +Name[zh_TW]=音樂光碟 +Name[zu]=Ama-CD Okuzwakalayo +Comment=Audiocd IO Slave Configuration +Comment[af]=Klank cd Io Slaaf Opstelling +Comment[az]=Name=Audiosd IO Kölələri Quraşdırması +Comment[bg]=Настройване на аудио диска +Comment[bn]=অডিও-সিডি আই/ও স্লেভ কনফিগারেশন +Comment[br]=Kefluniadur Sklav IO Audiocd +Comment[bs]=Podešavanje Audiocd IO Slave +Comment[ca]=Configuració de l'E/S esclava dels CD àudio +Comment[cs]=Nastavení IO klienta pro zvuková CD +Comment[cy]=Gosodiad Gwas IO ar gyfer CDau Sain +Comment[da]=Lyd-cd IO-slave-indstilling +Comment[de]=Einrichtung des Ein-/Ausgabemoduls für Audio-CDs +Comment[el]=Ρύθμιση Audiocd IO Slave +Comment[eo]=Agordo por la muzikdiska sklavo +Comment[es]=Configuración del esclavo de E/S de audiocd +Comment[et]=Audio CD IO mooduli seadistamine +Comment[eu]=Audiocd IO mendekoaren konfigurazioa +Comment[fa]=پیکربندی پی‌رو IO دیسک فشردۀ صوتی +Comment[fi]=Audiocd-siirräntätyöskentelijän asetukset +Comment[fr]=Configuration du module pour CD audio +Comment[gl]=Configuración do escravo IO de audiocd +Comment[he]=שינוי הגדרות פרוטוקול תקליטורי השמע +Comment[hi]=ऑडियो-सीडी आई-ओ स्लेव कॉन्फ़िगरेशन +Comment[hr]=Postava Audiocd IO poslužnika +Comment[hu]=Az audiocd TDE-protokoll beállításai +Comment[is]=Stillingar Audiocd I/O þrælsins +Comment[it]=Configurazione dell'IO Slave per i CD Audio +Comment[ja]=オーディオ CD IO スレーブの設定 +Comment[kk]=AudioCD IO Slave баптауы +Comment[km]=ការ​កំណត់​រចនាសម្ព័ន្ធ IO Slave របស់​ស៊ីឌី​អូឌីយ៉ូ +Comment[ko]=오디오 CD IO 슬레이브 설정 +Comment[lt]=Audio kompakto IO vergo derinimas +Comment[ms]=Penyelarasan Hamba IO Audiocd +Comment[mt]=Konfigurazzjoni tal-iskjav IO AudioCD +Comment[nb]=Oppsett av lyd-CD IO-slave +Comment[nds]=Instellen för dat In-/Utgaavmoduul för Klang-CDs +Comment[ne]=Audiocd IO स्लेभ कन्फिगरेसन +Comment[nl]=AudioCD IO slave instellen +Comment[nn]=Oppsett av IU-slave for lyd-CD +Comment[pa]=ਆਡੀਓ ਸੀਡੀ IO ਸਲੇਵ ਸੰਰਚਨਾ +Comment[pl]=Konfiguracja procedury we/wy dla audio CD +Comment[pt]=Configuração do IO Slave de CDs-Áudio +Comment[pt_BR]=Configuração do Áudio CD Escravo +Comment[ro]=Configurează dispozitivul I/O pentru CD audio +Comment[ru]=Настройка протокола AudioCD +Comment[se]=Heivet SO-šláva jietna-CD:aid várás +Comment[sk]=Nastavenie IO klienta pre zvukové CD +Comment[sl]=Nastavitve Audiocd podrejeni V/I +Comment[sr]=Подешавање Audiocd IO Slave-а +Comment[sr@Latn]=Podešavanje Audiocd IO Slave-a +Comment[sv]=Anpassa I/O-slav för ljud-cd +Comment[ta]=ஒலிக் குறுந்தகடு உள்-வெளி அடிமை வடிவமைப்பு +Comment[tg]=Танзими Фармонбари Ворид/Хориҷи Дискҳои Фишурдаи Садо +Comment[th]=ปรับแต่ง Audiocd IO Slave +Comment[tr]=Müzik CD Yapılandırması +Comment[uk]=Налаштування підлеглого В/В "Audiocd" +Comment[ven]=Nzudzanyo Audiocd IO Slave +Comment[xh]=Video-DVD IO Slave Uqwalaselo +Comment[zh_CN]=音频 CD 输入输出从属模块配置 +Comment[zh_HK]=音樂 CD IO Slave 設定 +Comment[zh_TW]=音樂光碟 IO Slave 組態 +Comment[zu]=Inhlanganiselo ye-Audiocd IO Slave +Keywords=Audio CD,CD,Ogg,Vorbis,Encoding,CDDA,Bitrate +Keywords[bg]=аудио, диск, компактдиск, КД, кодек, музика, Audio CD, CD, Ogg, Vorbis, Encoding, CDDA, Bitrate +Keywords[br]=CD klevet,CD,Ogg,Vorbis,Kodadur,CDDA,Feur +Keywords[ca]=Àudio CD,CD,Ogg,Vorbis,Codificació,CDDA,Taxa de bits +Keywords[cs]=Zvukové CD,CD,Ogg,Vorbis,Kódování,CDDA,Bitrate,CDDB +Keywords[cy]=CD Sain,CD,crynoddisg,Ogg,Vorbis,Amgodio,CDDA,Cyfradd Ddidau +Keywords[da]=Lyd-cd,CD,Ogg,Vorbis,Indkodning,CDDA,Bitrate +Keywords[de]=Audio CD,CD,Ogg,Vorbis,Encoding,CDDA,Bitrate,MP3 +Keywords[el]=CD μουσικής,CD,Ogg,Vorbis,Κωδικοποίηση,CDDA,Ρυθμός bit +Keywords[es]=CD de audio,CD,Ogg,Vorbis,Codificación,CDDA,Ratio de bits +Keywords[et]=audio,CD,Ogg,Vorbis,kodeering,CDDA,bitikiirus +Keywords[eu]=Audio CD,CD,Ogg,Vorbis,Kdeketa,CDDA,bit-maiztasuna +Keywords[fa]=دیسک فشرده، دیسک فشرده، Ogg، Vorbis، کدبندی، CDDA، میزان ارسال بیت صوتی +Keywords[fi]=Ääni-CD,CD,Ogg,Vorbis,Koodaus,CDDA,Bittinopeus +Keywords[fr]=CD audio,CD,Ogg,Vorbis,Encodage,CDDA,débit +Keywords[ga]=CD Fuaime,CD,Ogg,Vorbis,Ionchódú,CDDA,Ráta Giotán +Keywords[gl]=Audio CD,CD,Ogg,Vorbis,Codificación,CDDA,Razón de Bits +Keywords[hi]=ऑडियो सीडी,सीडी,ऑग,वॉर्बिस,एनकोडिंग,सीडीडीए,बिटरेट +Keywords[hu]=hang-CD,CD,Ogg,Vorbis,kódolás,CDDA,bitráta +Keywords[it]=CD Audio,CD,Ogg,Vorbis,Codifica,CDDA,Bitrate +Keywords[ja]=オーディオ CD,CD,Ogg,Vorbis,エンコーディング,CDDA,ビットレート +Keywords[km]=ស៊ីឌី​អូឌីយ៉ូ,ស៊ីឌី,Ogg,Vorbis,អ៊ិនកូដ,CDDA,អត្រាប៊ីត +Keywords[ko]=오디오 CD,CD,Ogg,인코딩,CDDA +Keywords[lt]=Audio CD,CD,Ogg,Vorbis,Encoding,CDDA,Bitrate,įkodavimas +Keywords[mk]=Аудио CD,CD,Ogg,Vorbis,Кодирање,CDDA,Брзина во битови +Keywords[nb]=Audio CD,CD,Ogg,Vorbis,Koding,CDDA,Bitrate +Keywords[nds]=Audio-CD,Klang-CD,CD,Ogg,Vorbis,Koderen,CDDA,Bitrate +Keywords[ne]=अडियो सीडी,सीडी,अग,भर्बिस,सङ्केतन,सीडीडीए,बिटरेट +Keywords[nl]=Audio-cd,cd,Ogg,Vorbis,Encoding,CDDA,Bitrate +Keywords[nn]=lyd-CD,CD,Ogg,Vorbis,koding,CDDA,bitrate +Keywords[pa]=ਆਡੀਓ CD,CD,Ogg,Vorbis,ਇਕੋਡਿੰਗ,CDDA,ਬਿੱਟਰੇਟ +Keywords[pl]=Audio CD,CD,Ogg,Vorbis,Encoding,CDDA,Bitrate, Kodowanie +Keywords[pt]=CD de Áudio,CD,Ogg,Vorbis,Codificação,CDDA,Taxa de Bits +Keywords[pt_BR]=CD de Áudio,CD,Ogg,Vorbis,Codificação,CDDA,Bitrate +Keywords[ro]=CD audio,ogg,vorbis,codare,CDDA,rată de bit +Keywords[ru]=Audio CD,CD,Ogg,Vorbis,Encoding,CDDA,Bitrate,битрейт +Keywords[sk]=zvukové CD,CD,Ogg,Vorbis,kódovanie,CDDA,bitová frekvencia +Keywords[sl]=Avdio CD,CD,Ogg,Vorbis,kodiranje,CDDA,bitna hitrost +Keywords[sr]=Audio CD,CD,Ogg,Vorbis,Encoding,CDDA,Bitrate, Аудио CD, кодирање,битрата +Keywords[sr@Latn]=Audio CD,CD,Ogg,Vorbis,Encoding,CDDA,Bitrate, Audio CD, kodiranje,bitrata +Keywords[sv]=ljud-cd,cd,Ogg,Vorbis,kodning,CDDA,bithastighet +Keywords[ta]=கேட்பொலி குறுந்தகடு,குறுந்தகடு,ஓஜிஜி,வோர்பிஸ்,குறியிடுதல்,சிடிடேஏ,பிட் மதிப்பு +Keywords[tg]=Диски Фишурдаи Садо,Диски Фишурда,Ogg,Vorbis,Рамзигузор,CDDA,Bitrate +Keywords[th]=ซีดีบันทึกเสียง, ซีดี,Ogg,Vorbis,เข้ารหัส,CDDA,บิตเรต +Keywords[tr]=Ses CD,CD,Ogg,Vorbis,Kodlama,CDDA,Bitrate +Keywords[uk]=Аудіо-КД,КД,Ogg,Vorbis,кодування,CDDA,частота вибірки +Keywords[zh_CN]=音频 CD,CD,Ogg,Vorbis,编码,CDDA,Bitrate + +Categories=Qt;TDE;Settings;X-TDE-settings-sound; diff --git a/tdeioslave/audiocd/kcmaudiocd/audiocdconfig.ui b/tdeioslave/audiocd/kcmaudiocd/audiocdconfig.ui new file mode 100644 index 00000000..a3b98507 --- /dev/null +++ b/tdeioslave/audiocd/kcmaudiocd/audiocdconfig.ui @@ -0,0 +1,628 @@ + +AudiocdConfig + + + AudiocdConfig + + + + 0 + 0 + 640 + 563 + + + + + + + + + unnamed + + + 0 + + + 0 + + + + tabWidget + + + + 5 + 5 + 0 + 0 + + + + + + + + + tab + + + &General + + + + unnamed + + + + Spacer5 + + + Vertical + + + Expanding + + + + 20 + 210 + + + + + + encoderPriority + + + Encoder Priority + + + + unnamed + + + + niceLevel + + + -19 + + + 19 + + + 5 + + + Horizontal + + + NoMarks + + + + + textLabel2 + + + Highest + + + + + textLabel3 + + + Lowest + + + AlignVCenter|AlignRight + + + + + textLabel4 + + + Normal + + + AlignCenter + + + + + + + cd_device_string + + + false + + + /dev/cdrom + + + Specify a location for the drive you want to use. Normally, this is a file inside the /dev folder representing your CD or DVD drive. + + + + + cd_specify_device + + + &Specify CD device: + + + Check this to specify a CD device different from the one which is detected automatically + + + + + ec_enable_check + + + Use &error correction when reading the CD + + + true + + + If you uncheck this option, the slave will not try to use error correction which can be useful for reading damaged CDs. However, this feature can be problematic in some cases, so you can switch it off here. + + + + + ec_skip_check + + + &Skip on errors + + + false + + + + + spacer4_2 + + + Horizontal + + + Fixed + + + + 20 + 20 + + + + + + + + tab + + + &Names + + + + unnamed + + + + fileNameGroupBox + + + File Name (without extension) + + + + unnamed + + + + textLabel1_2 + + + The following macros will be expanded: + + + + + layout7 + + + + unnamed + + + + textLabel13 + + + Genre + + + + + textLabel7 + + + Track Number + + + + + textLabel2_3 + + + %{title} + + + + + textLabel11 + + + Year + + + + + textLabel3_3 + + + Track Title + + + + + textLabel9 + + + Album Artist + + + + + textLabel10 + + + %{year} + + + + + textLabel6 + + + %{albumtitle} + + + + + textLabel5 + + + Album Title + + + + + textLabel12 + + + %{genre} + + + + + textLabel8 + + + %{albumartist} + + + + + textLabel4_2 + + + %{number} + + + + + + + fileNameLineEdit + + + + + + + groupBox2 + + + Name Regular Expression Replacement + + + + unnamed + + + + textLabel2_2 + + + Selection: + + + + + textLabel1 + + + Regular expression used on all file names. For example using selection " " and replace with "_" would replace all the spaces with underlines. + + + + WordBreak|AlignVCenter + + + + + inputlabel + + + Input: + + + + + outputLabel + + + Output: + + + + + exampleLabel + + + Example + + + + + exampleOutput + + + Cool artist - example audio file.wav + + + + + example + + + Cool artist - example audio file.wav + + + + + kcfg_replaceInput + + + + + kcfg_replaceOutput + + + + + textLabel3_2 + + + Replace with: + + + + + line1 + + + HLine + + + Sunken + + + Horizontal + + + + + + + spacer4 + + + Vertical + + + Expanding + + + + 21 + 16 + + + + + + fileNameGroupBox_2 + + + Album Name + + + + unnamed + + + + fileNameLabel_2 + + + The following macros will be expanded: + + + + + layout9 + + + + unnamed + + + + textLabel20 + + + Year + + + + + textLabel15 + + + %{albumartist} + + + + + textLabel16 + + + %{year} + + + + + textLabel21 + + + Genre + + + + + textLabel19 + + + Album Artist + + + + + textLabel18 + + + Album Title + + + + + textLabel17 + + + %{genre} + + + + + textLabel14 + + + %{albumtitle} + + + + + + + spacer3 + + + Vertical + + + Expanding + + + + 20 + 31 + + + + + + albumNameLineEdit + + + + + + + + + + + + ec_enable_check + toggled(bool) + ec_skip_check + setEnabled(bool) + + + cd_specify_device + toggled(bool) + cd_device_string + setEnabled(bool) + + + + tabWidget + cd_device_string + ec_enable_check + ec_skip_check + niceLevel + fileNameLineEdit + albumNameLineEdit + kcfg_replaceInput + kcfg_replaceOutput + example + + + tdecmodule.h + + + toggleLowpass() + + + + klineedit.h + + diff --git a/tdeioslave/audiocd/kcmaudiocd/kcmaudiocd.cpp b/tdeioslave/audiocd/kcmaudiocd/kcmaudiocd.cpp new file mode 100644 index 00000000..f3190d43 --- /dev/null +++ b/tdeioslave/audiocd/kcmaudiocd/kcmaudiocd.cpp @@ -0,0 +1,267 @@ +/* + Copyright (C) 2001 Carsten Duvenhorst + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +*/ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include "kcmaudiocd.moc" +#include + +KAudiocdModule::KAudiocdModule(TQWidget *parent, const char *name) + : AudiocdConfig(parent, name), configChanged(false) +{ + TQString foo = i18n("Report errors found on the cd."); + + setButtons(Default|Apply); + + config = new TDEConfig("kcmaudiocdrc"); + + TQPtrList encoders; + AudioCDEncoder::findAllPlugins(0, encoders); + AudioCDEncoder *encoder; + for ( encoder = encoders.first(); encoder; encoder = encoders.next() ){ + if (encoder->init()) { + TDEConfigSkeleton *config = NULL; + TQWidget *widget = encoder->getConfigureWidget(&config); + if(widget && config){ + tabWidget->addTab(widget, i18n("%1 Encoder").arg(encoder->type())); + TDEConfigDialogManager *configManager = new TDEConfigDialogManager(widget, config, TQString(encoder->type()+" EncoderConfigManager").latin1()); + encoderSettings.append(configManager); + } + } + } + + load(); + + TDEConfigDialogManager *widget; + for ( widget = encoderSettings.first(); widget; widget = encoderSettings.next() ){ + connect(widget, TQT_SIGNAL(widgetModified()), this, TQT_SLOT(slotModuleChanged())); + } + + //CDDA Options + connect(cd_specify_device,TQT_SIGNAL(clicked()),this,TQT_SLOT(slotConfigChanged())); + connect(ec_enable_check,TQT_SIGNAL(clicked()),this,TQT_SLOT(slotEcEnable())); + connect(ec_skip_check,TQT_SIGNAL(clicked()),TQT_SLOT(slotConfigChanged())); + connect(cd_device_string,TQT_SIGNAL(textChanged(const TQString &)),TQT_SLOT(slotConfigChanged())); + connect(niceLevel,TQT_SIGNAL(valueChanged(int)),TQT_SLOT(slotConfigChanged())); + + // File Name + connect(fileNameLineEdit, TQT_SIGNAL(textChanged(const TQString &)), this, TQT_SLOT(slotConfigChanged())); + connect(albumNameLineEdit, TQT_SIGNAL(textChanged(const TQString &)), this, TQT_SLOT(slotConfigChanged())); + connect( kcfg_replaceInput, TQT_SIGNAL( textChanged(const TQString&) ), this, TQT_SLOT( updateExample() ) ); + connect( kcfg_replaceOutput, TQT_SIGNAL( textChanged(const TQString&) ), this, TQT_SLOT( updateExample() ) ); + connect( example, TQT_SIGNAL( textChanged(const TQString&) ), this, TQT_SLOT( updateExample() ) ); + connect( kcfg_replaceInput, TQT_SIGNAL( textChanged(const TQString&) ), this, TQT_SLOT( slotConfigChanged() ) ); + connect( kcfg_replaceOutput, TQT_SIGNAL( textChanged(const TQString&) ), this, TQT_SLOT( slotConfigChanged() ) ); + connect( example, TQT_SIGNAL( textChanged(const TQString&) ), this, TQT_SLOT( slotConfigChanged() ) ); + + TDEAboutData *about = + new TDEAboutData(I18N_NOOP("kcmaudiocd"), I18N_NOOP("TDE Audio CD IO Slave"), + 0, 0, TDEAboutData::License_GPL, + I18N_NOOP("(c) 2000 - 2005 Audio CD developers")); + + about->addAuthor("Benjamin C. Meyer", I18N_NOOP("Current Maintainer"), "ben@meyerhome.net"); + about->addAuthor("Carsten Duvenhorst", 0, "duvenhorst@duvnet.de"); + setAboutData(about); +} + +KAudiocdModule::~KAudiocdModule() +{ + delete config; +} + +TQString removeQoutes(const TQString& text) +{ + TQString deqoutedString=text; + TQRegExp qoutedStringRegExp("^\".*\"$"); + if (qoutedStringRegExp.exactMatch(text)) + { + deqoutedString=text.mid(1, text.length()-2); + } + return deqoutedString; +} + +bool needsQoutes(const TQString& text) +{ + TQRegExp spaceAtTheBeginning("^\\s+.*$"); + TQRegExp spaceAtTheEnd("^.*\\s+$"); + return (spaceAtTheBeginning.exactMatch(text) || spaceAtTheEnd.exactMatch(text)); + + +} + +void KAudiocdModule::updateExample() +{ + TQString text = example->text(); + TQString deqoutedReplaceInput=removeQoutes(kcfg_replaceInput->text()); + TQString deqoutedReplaceOutput=removeQoutes(kcfg_replaceOutput->text()); + + text.replace( TQRegExp(deqoutedReplaceInput), deqoutedReplaceOutput ); + exampleOutput->setText(text); +} + +void KAudiocdModule::defaults() { + load( false ); +} + +void KAudiocdModule::save() { + if (!configChanged ) return; + + { + TDEConfigGroupSaver saver(config, "CDDA"); + + // autosearch is the name of the config option, which has the + // reverse sense of the current text of the configuration option, + // which is specify the device. Therefore, invert the value on write. + // + config->writeEntry("autosearch", !(cd_specify_device->isChecked()) ); + config->writeEntry("device",cd_device_string->text()); + config->writeEntry("disable_paranoia",!(ec_enable_check->isChecked())); + config->writeEntry("never_skip",!(ec_skip_check->isChecked())); + config->writeEntry("niceLevel", niceLevel->value()); + } + + { + TDEConfigGroupSaver saver(config, "FileName"); + config->writeEntry("file_name_template", fileNameLineEdit->text()); + config->writeEntry("album_name_template", albumNameLineEdit->text()); + config->writeEntry("regexp_example", example->text()); + // save qouted if required + TQString replaceInput=kcfg_replaceInput->text(); + TQString replaceOutput=kcfg_replaceOutput->text(); + if (needsQoutes(replaceInput)) + { + replaceInput=TQString("\"")+replaceInput+TQString("\""); + } + if (needsQoutes(replaceOutput)) + { + replaceOutput=TQString("\"")+replaceOutput+TQString("\""); + } + config->writeEntry("regexp_search", replaceInput); + config->writeEntry("regexp_replace", replaceOutput); + } + + TDEConfigDialogManager *widget; + for ( widget = encoderSettings.first(); widget; widget = encoderSettings.next() ){ + widget->updateSettings(); + } + + config->sync(); + + configChanged = false; + +} + +void KAudiocdModule::load() { + load( false ); +} + +void KAudiocdModule::load(bool useDefaults) { + + config->setReadDefaults( useDefaults ); + + { + TDEConfigGroupSaver saver(config, "CDDA"); + + + // Specify <=> not autosearch, as explained above in ::save() + cd_specify_device->setChecked( !(config->readBoolEntry("autosearch",true)) ); + cd_device_string->setText(config->readEntry("device","/dev/cdrom")); + ec_enable_check->setChecked(!(config->readBoolEntry("disable_paranoia",false))); + ec_skip_check->setChecked(!(config->readBoolEntry("never_skip",true))); + niceLevel->setValue(config->readNumEntry("niceLevel", 0)); + } + + { + TDEConfigGroupSaver saver(config, "FileName"); + fileNameLineEdit->setText(config->readEntry("file_name_template", "%{albumartist} - %{number} - %{title}")); + albumNameLineEdit->setText(config->readEntry("album_name_template", "%{albumartist} - %{albumtitle}")); + kcfg_replaceInput->setText(config->readEntry("regexp_search")); + kcfg_replaceOutput->setText(config->readEntry("regexp_replace")); + example->setText(config->readEntry("example", i18n("Cool artist - example audio file.wav"))); + } + + TDEConfigDialogManager *widget; + for ( widget = encoderSettings.first(); widget; widget = encoderSettings.next() ){ + widget->updateWidgets(); + } + + emit changed( useDefaults ); +} + +void KAudiocdModule::slotModuleChanged() { + TDEConfigDialogManager *widget; + for ( widget = encoderSettings.first(); widget; widget = encoderSettings.next() ){ + if(widget->hasChanged()){ + slotConfigChanged(); + break; + } + } +} + +void KAudiocdModule::slotConfigChanged() { + configChanged = true; + emit changed(true); +} + +/* +# slot for the error correction settings +*/ +void KAudiocdModule::slotEcEnable() { + if (!(ec_skip_check->isChecked())) { + ec_skip_check->setChecked(true); + } else { + if (ec_skip_check->isEnabled()) { + ec_skip_check->setChecked(false); + } + } + + slotConfigChanged(); +} + +TQString KAudiocdModule::quickHelp() const +{ + return i18n("

Audio CDs

The Audio CD IO-Slave enables you to easily" + " create wav, MP3 or Ogg Vorbis files from your audio CD-ROMs or DVDs." + " The slave is invoked by typing \"audiocd:/\" in Konqueror's location" + " bar. In this module, you can configure" + " encoding, and device settings. Note that MP3 and Ogg" + " Vorbis encoding are only available if TDE was built with a recent" + " version of the LAME or Ogg Vorbis libraries."); +} + +extern "C" +{ + TDECModule *create_audiocd(TQWidget *parent, const char */*name*/) + { + return new KAudiocdModule(parent, "kcmaudiocd"); + } + +} diff --git a/tdeioslave/audiocd/kcmaudiocd/kcmaudiocd.h b/tdeioslave/audiocd/kcmaudiocd/kcmaudiocd.h new file mode 100644 index 00000000..c9ec1bc7 --- /dev/null +++ b/tdeioslave/audiocd/kcmaudiocd/kcmaudiocd.h @@ -0,0 +1,66 @@ +/* + + Copyright (C) 2001 Carsten Duvenhorst + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + + Permission is also granted to link this program with the TQt + library, treating TQt like a library that normally accompanies the + operating system kernel, whether or not that is in fact the case. + +*/ + + +#ifndef KAUDIOCDCONFIG_H +#define KAUDIOCDCONFIG_H + +class TDEConfigDialogManager; + +#include "audiocdconfig.h" +class KAudiocdModule : public AudiocdConfig +{ + Q_OBJECT + + +public: + + KAudiocdModule(TQWidget *parent=0, const char *name=0); + ~KAudiocdModule(); + + TQString quickHelp() const; + +public slots: + void defaults(); + void save(); + void load(); + void load(bool useDefaults); + +private slots: + void updateExample(); + void slotConfigChanged(); + void slotEcEnable(); + void slotModuleChanged(); + +private: + TDEConfig *config; + bool configChanged; + + int getBitrateIndex(int value); + + TQPtrList encoderSettings; +}; + +#endif // KAUDIOCDCONFIG_H + diff --git a/tdeioslave/audiocd/plugins/Makefile.am b/tdeioslave/audiocd/plugins/Makefile.am new file mode 100644 index 00000000..fcee4e68 --- /dev/null +++ b/tdeioslave/audiocd/plugins/Makefile.am @@ -0,0 +1,21 @@ +#if HAVE_VORBIS +#AUDIOCD_PLUGINS_SUBDIR=vorbis +#endif + +SUBDIRS = . wav vorbis lame flac + +INCLUDES = -I$(top_srcdir)/libkcddb $(all_includes) + +lib_LTLIBRARIES = libaudiocdplugins.la + +libaudiocdplugins_la_LIBADD = $(LIB_TDECORE) $(top_builddir)/libkcddb/libkcddb.la + +libaudiocdplugins_la_LDFLAGS = $(all_libraries) -version-info 1:0:0 -no-undefined + +libaudiocdplugins_la_SOURCES = audiocdencoder.cpp + +include_HEADERS = audiocdencoder.h + +messages: + $(XGETTEXT) *.cpp -o $(podir)/tdeio_audiocd.pot + diff --git a/tdeioslave/audiocd/plugins/audiocdencoder.cpp b/tdeioslave/audiocd/plugins/audiocdencoder.cpp new file mode 100644 index 00000000..26c108b8 --- /dev/null +++ b/tdeioslave/audiocd/plugins/audiocdencoder.cpp @@ -0,0 +1,95 @@ +/* + Copyright (C) 2004, 2005 Benjamin Meyer + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +*/ + +#include +#include +#include +#include +#include +#include + +/** + * Attempt to load a plugin and see if it has the symbol create_audiocd_encoders. + * @param libFileName file to try to load. + * @returns pointer to the symbol or NULL + */ +void *loadPlugin(const TQString &libFileName) +{ +#ifdef DEBUG + kdDebug(7117) << "Trying to load library. File: \"" << libFileName.latin1() << "\"." << endl; +#endif + KLibLoader *loader = KLibLoader::self(); + if (!loader) + return NULL; +#ifdef DEBUG + kdDebug(7117) << "We have a loader. File: \"" << libFileName.latin1() << "\"." << endl; +#endif + KLibrary *lib = loader->library(libFileName.latin1()); + if (!lib) + return NULL; +#ifdef DEBUG + kdDebug(7117) << "We have a library. File: \"" << libFileName.latin1() << "\"." << endl; +#endif + void *cplugin = lib->symbol("create_audiocd_encoders"); + if (!cplugin) + return NULL; +#ifdef DEBUG + kdDebug(7117) << "We have a plugin. File: \"" << libFileName.latin1() << "\"." << endl; +#endif + return cplugin; +} + +/** + * There might be a "better" way of doing this, but I don't know it, + * but I do know that this does work. :) Feel free to improve the loading system, + * there isn't much code anyway. + */ +void AudioCDEncoder::findAllPlugins(TDEIO::SlaveBase *slave, TQPtrList &encoders){ + TQString foundEncoders; + + KStandardDirs standardDirs; + TQStringList dirs = standardDirs.findDirs("module", ""); + for (TQStringList::Iterator it = dirs.begin(); it != dirs.end(); ++it) { + TQDir dir(*it); + if (!dir.exists()) { + kdDebug(7117) << "Directory given by KStandardDirs: " << dir.path() << " doesn't exists!" << endl; + continue; + } + dir.setFilter(TQDir::Files | TQDir::Hidden); + + TQStringList list = dir.entryList( "libaudiocd_encoder_*.so"); + kdDebug() << "list " << list << endl; + for (TQStringList::ConstIterator it2 = list.begin(); it2 != list.end(); ++it2) + { + TQString fileName = *it2; + kdDebug() << fileName << endl; + if (foundEncoders.contains(fileName)) { + kdDebug(7117) << "Warning, encoder has been found twice!" << endl; + continue; + } + foundEncoders.append(fileName); + fileName = fileName.mid(0, fileName.find('.')); + void *function = loadPlugin(fileName); + if(function){ + void (*functionPointer)(TDEIO::SlaveBase *, TQPtrList &) = (void (*)(TDEIO::SlaveBase *slave, TQPtrList &encoders)) function; + functionPointer(slave, encoders); + } + } + } +} + diff --git a/tdeioslave/audiocd/plugins/audiocdencoder.h b/tdeioslave/audiocd/plugins/audiocdencoder.h new file mode 100644 index 00000000..56fe7aa5 --- /dev/null +++ b/tdeioslave/audiocd/plugins/audiocdencoder.h @@ -0,0 +1,145 @@ +/* + Copyright (C) 2004, 2005 Benjamin Meyer + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +*/ + +#ifndef AUDIOCD_ENCODER_H +#define AUDIOCD_ENCODER_H + +#include +#include +#include + +class TDEConfigSkeleton; +using namespace KCDDB; + +class AudioCDEncoder { + +public: + /** + * Constructor. + * @param slave parent that this classes can use to call data() with + * when finished encoding bits. + */ + explicit AudioCDEncoder(TDEIO::SlaveBase *slave) : ioslave(slave) {}; + + /** + * Deconstructor. + */ + virtual ~AudioCDEncoder(){}; + + /** + * Initiallizes the decoder, loading libraries, etc. Encoders + * that don't return true will will deleted and not used. + * @returns false if unable to initialize the encoder. + */ + virtual bool init() = 0; + + /** + * The encoder should read in its config data here. + */ + virtual void loadSettings() = 0; + + /** + * Helper function to determine the end size of a + * encoded file. + * @param time_secs the lengh of the audio track in seconds. + * @returns the size of a file if it is time_secs in length. + */ + virtual unsigned long size(long time_secs) const = 0; + + /** + * @returns the generic user string type/name of this encoder + * Examples: "MP3", "Ogg Vorbis", "Wav", "FID Level 2", etc + */ + virtual TQString type() const = 0; + + /** + * @returns the mime type for the files this encoder produces. + * Example: "audio/x-wav" + */ + virtual const char * mimeType() const = 0; + + /** + * @returns the file type for the files this encoder produces. + * Used in naming of the file for example foo.mp3 + * Examples: "mp3", "ogg", "wav" + */ + virtual const char * fileType() const = 0; + + /** + * Before the read functions are called this is + * called to allow the encoders to store the cddb + * information if they want to so it can be inserted + * where neccessary (start, middle, end, or combos etc). + */ + virtual void fillSongInfo( KCDDB::CDInfo info, int track, const TQString &comment ) = 0; + + /** + * Perform any initial file creation necessary for a new song (that + * has just been sent via fillSongInfo()) + * @param size - the total binary size of the end file (via size()). + * @return size of the data that was created by this function. + */ + virtual long readInit(long size) = 0; + + /** + * Passes a little bit of cd data to be encoded + * This function is most likly called many many times. + * @param buf pointer to the audio that has been read in so far + * @param frames the number of frames of audio that are in buf + * @return size of the data that was created by this function, -1 on error. + */ + virtual long read(int16_t * buf, int frames) = 0; + + /** + * Perform any final file creation/padding that is necessary + * @return size of the data that was created by this function. + */ + virtual long readCleanup() = 0; + + /** + * Returns a configure widget for the encoder + */ + virtual TQWidget* getConfigureWidget(TDEConfigSkeleton** manager) const + { Q_UNUSED(manager); return NULL; }; + + /** + * Returns the last error message; called when e.g. read() returns -1. + */ + virtual TQString lastErrorMessage() const { return TQString(); } + + /** + * Helper function to load all of the AudioCD Encoders from libraries. + * Uses KStandardDirs to find where libraries could be, opens all of the ones + * that we might own audiocd_encoder_* and then uses the symbol + * create_audiocd_encoders to obtain the encoders from that library. + * @param slave ioslave needed if the plugin is going to be used to encode something. + * @param encoders container for new encoders. + */ + static void findAllPlugins(TDEIO::SlaveBase *slave, TQPtrList &encoders); + +protected: + /** + * Pointer to the ioslave that is running this encoder. + * Used (only?) for the data() function to pass back encoded data. + */ + TDEIO::SlaveBase *ioslave; + +}; + +#endif // AUDIOCD_ENCODER_H + diff --git a/tdeioslave/audiocd/plugins/flac/Makefile.am b/tdeioslave/audiocd/plugins/flac/Makefile.am new file mode 100644 index 00000000..4e693c53 --- /dev/null +++ b/tdeioslave/audiocd/plugins/flac/Makefile.am @@ -0,0 +1,13 @@ +INCLUDES = -I$(top_srcdir)/libkcddb -I$(srcdir)/.. $(all_includes) + +kde_module_LTLIBRARIES = libaudiocd_encoder_flac.la + +libaudiocd_encoder_flac_la_SOURCES = encoderflac.cpp + +libaudiocd_encoder_flac_la_LIBADD = $(LIBFLAC) $(LIB_KIO) ../libaudiocdplugins.la + +libaudiocd_encoder_flac_la_LDFLAGS = -avoid-version -module -no-undefined $(all_libraries) + +pluginsdir = $(kde_datadir)/audiocd/plugins + +METASOURCES = AUTO diff --git a/tdeioslave/audiocd/plugins/flac/encoderflac.cpp b/tdeioslave/audiocd/plugins/flac/encoderflac.cpp new file mode 100644 index 00000000..ed1c5dde --- /dev/null +++ b/tdeioslave/audiocd/plugins/flac/encoderflac.cpp @@ -0,0 +1,214 @@ +/* + Copyright (C) 2004 Allan Sandfeld Jensen + Copyright (C) 2005 Benjamin Meyer + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "encoderflac.h" + +#ifdef HAVE_LIBFLAC + +#include +#include +#include + +#include +#include + +#if !defined FLAC_API_VERSION_CURRENT || FLAC_API_VERSION_CURRENT < 8 +#define LEGACY_FLAC +#else +#undef LEGACY_FLAC +#endif + +extern "C" +{ + KDE_EXPORT void create_audiocd_encoders(TDEIO::SlaveBase *slave, TQPtrList &encoders) + { + encoders.append(new EncoderFLAC(slave)); + } +} + +class EncoderFLAC::Private { + +public: + FLAC__StreamEncoder *encoder; + FLAC__StreamMetadata** metadata; + TDEIO::SlaveBase* ioslave; + unsigned long data; +}; + +#ifdef LEGACY_FLAC +static FLAC__StreamEncoderWriteStatus WriteCallback(const FLAC__StreamEncoder *encoder, const FLAC__byte buffer[], unsigned bytes, unsigned samples, unsigned current_frame, void *client_data) +#else +static FLAC__StreamEncoderWriteStatus WriteCallback(const FLAC__StreamEncoder *encoder, const FLAC__byte buffer[], size_t bytes, unsigned samples, unsigned current_frame, void *client_data) +#endif +{ + EncoderFLAC::Private *d = (EncoderFLAC::Private*)client_data; + + d->data += bytes; + + TQByteArray output; + + if (bytes) { + output.setRawData((const char*)buffer, bytes); + d->ioslave->data(output); + output.resetRawData((const char*)buffer, bytes); + } + + return FLAC__STREAM_ENCODER_WRITE_STATUS_OK; +} + +static void MetadataCallback (const FLAC__StreamEncoder *encoder, const FLAC__StreamMetadata *metadata, void *client_data) +{ + // We do not have seekable writeback so we just discard the updated metadata + +} + +/* +static FLAC__SeekableStreamEncoderSeekStatus SeekCallback(const FLAC__SeekableStreamEncoder *encoder, FLAC__uint64 absolute_byte_offset, void *client_data) +{} ; */ + + + + +EncoderFLAC::EncoderFLAC(TDEIO::SlaveBase *slave) : AudioCDEncoder(slave) { + d = new Private(); + d->ioslave = slave; + d->encoder = 0; +} + +EncoderFLAC::~EncoderFLAC() { + if (d->encoder) FLAC__stream_encoder_delete(d->encoder); + delete d; +} + +bool EncoderFLAC::init(){ + d->encoder = FLAC__stream_encoder_new(); + d->metadata = 0; + d->data = 0; + return true; +} + +void EncoderFLAC::loadSettings() { +// config->setGroup("FLAC"); + +} + +// Estimate size to be 5/8 of uncompresed size. +unsigned long EncoderFLAC::size(long time_secs) const { + long uncompressed = (time_secs * (44100*2*2)); + return (uncompressed/8)*5 + 1000; +} + +long EncoderFLAC::readInit(long size) { + kdDebug(7117) << "EncoderFLAC::readInit() called"<< endl; + d->data = 0; +#ifdef LEGACY_FLAC + FLAC__stream_encoder_set_write_callback(d->encoder, WriteCallback); + FLAC__stream_encoder_set_metadata_callback(d->encoder, MetadataCallback); + FLAC__stream_encoder_set_client_data(d->encoder, d); +#endif + + // The options match approximely those of flac compression-level-3 + FLAC__stream_encoder_set_do_mid_side_stereo(d->encoder, true); + FLAC__stream_encoder_set_loose_mid_side_stereo(d->encoder, true); // flac -M + FLAC__stream_encoder_set_max_lpc_order(d->encoder, 6); // flac -l6 + FLAC__stream_encoder_set_min_residual_partition_order(d->encoder, 3); + FLAC__stream_encoder_set_max_residual_partition_order(d->encoder, 3); // flac -r3,3 + FLAC__stream_encoder_set_blocksize(d->encoder, 4608); + FLAC__stream_encoder_set_streamable_subset(d->encoder, true); + if (size > 0) + FLAC__stream_encoder_set_total_samples_estimate(d->encoder, size/4); + +#ifdef LEGACY_FLAC + if(FLAC__stream_encoder_init(d->encoder) != FLAC__STREAM_ENCODER_OK) + ; // really should handle an init failure +#else + if(FLAC__stream_encoder_init_stream(d->encoder, WriteCallback, NULL, NULL, MetadataCallback, d) != FLAC__STREAM_ENCODER_INIT_STATUS_OK) + ; // really should handle an init failure +#endif + return d->data; +} + +long EncoderFLAC::read(int16_t * buf, int frames) +{ + unsigned long olddata = d->data; + FLAC__int32 *buffer = new FLAC__int32[frames*2]; + for(int i=0; iencoder, buffer, frames); + delete[] buffer; + return d->data - olddata; +} + +long EncoderFLAC::readCleanup() +{ + FLAC__stream_encoder_finish(d->encoder); +// FLAC__stream_encoder_delete(d->encoder); + if (d->metadata) { + FLAC__metadata_object_delete(d->metadata[0]); + delete[] d->metadata; + d->metadata = 0; + } + return 0; +} + +void EncoderFLAC::fillSongInfo( KCDDB::CDInfo info, int track, const TQString &comment ) +{ + d->metadata = new FLAC__StreamMetadata*[1]; + d->metadata[0] = FLAC__metadata_object_new(FLAC__METADATA_TYPE_VORBIS_COMMENT); +// d->metadata[1] = FLAC__metadata_object_new(FLAC__METADATA_TYPE_PADDING); +// d->metadata[2] = FLAC__metadata_object_new(FLAC__METADATA_TYPE_SEEKTABLE) + + typedef TQPair Comment; + Comment comments[7] = { Comment("Title", info.trackInfoList[track].get("title")), + Comment("Artist", info.get("artist")), + Comment("Album", info.get("title")), + Comment("Genre", info.get("genre")), + Comment("Tracknumber", TQString::number(track+1)), + Comment("Comment", comment), + Comment("Date", TQString() )}; + if (info.get("Year").toInt() > 0) { + TQDateTime dt(TQDate(info.get("Year").toInt(), 1, 1)); + comments[6] = Comment("Date", dt.toString(Qt::ISODate)); + } + + FLAC__StreamMetadata_VorbisComment_Entry entry; + TQString field; + TQCString cfield; + int num_comments = 0; + + for(int i=0; i<7; i++) { + if (!comments[i].second.toString().isEmpty()) { + field = comments[i].first+"="+comments[i].second.toString(); + cfield = field.utf8(); + entry.entry = (FLAC__byte*)tqstrdup(cfield); + entry.length = cfield.length(); + // Insert in vorbiscomment and assign ownership of pointers to FLAC + FLAC__metadata_object_vorbiscomment_insert_comment(d->metadata[0], num_comments, entry, false); + num_comments++; + } + } + + FLAC__stream_encoder_set_metadata(d->encoder, d->metadata, 1); +} + +#endif // HAVE_LIBFLAC + diff --git a/tdeioslave/audiocd/plugins/flac/encoderflac.h b/tdeioslave/audiocd/plugins/flac/encoderflac.h new file mode 100644 index 00000000..e563e061 --- /dev/null +++ b/tdeioslave/audiocd/plugins/flac/encoderflac.h @@ -0,0 +1,61 @@ +/* + Copyright (C) 2004 Allan Sandfeld Jensen + Copyright (C) 2005 Benjamin Meyer + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#ifndef ENCODER_FLAC_H +#define ENCODER_FLAC_H + +#include + +#ifdef HAVE_LIBFLAC + +#include + +/** + * FLAC encoder. + * This encoder is only enabled when HAVE_LIBFLAC is set. + * Check out http://flac.sourceforge.net/ for more information. + */ +class EncoderFLAC : public AudioCDEncoder { + +public: + EncoderFLAC(TDEIO::SlaveBase *slave); + ~EncoderFLAC(); + + virtual TQString type() const { return "FLAC"; }; + virtual bool init(); + virtual void loadSettings(); + virtual unsigned long size(long time_secs) const; + virtual const char * fileType() const { return "flac"; }; + virtual const char * mimeType() const { return "audio/x-flac"; } + virtual void fillSongInfo( KCDDB::CDInfo info, int track, const TQString &comment ); + virtual long readInit(long size); + virtual long read(int16_t * buf, int frames); + virtual long readCleanup(); + + class Private; +private: + Private * d; + +}; + +#endif // HAVE_FLAC + +#endif // ENCODER_FLAC_H + diff --git a/tdeioslave/audiocd/plugins/lame/Makefile.am b/tdeioslave/audiocd/plugins/lame/Makefile.am new file mode 100644 index 00000000..49ddddd9 --- /dev/null +++ b/tdeioslave/audiocd/plugins/lame/Makefile.am @@ -0,0 +1,18 @@ +INCLUDES = -I$(top_srcdir)/libkcddb -I$(srcdir)/.. $(taglib_includes) $(all_includes) + +kde_kcfg_DATA = audiocd_lame_encoder.kcfg + +kde_module_LTLIBRARIES = libaudiocd_encoder_lame.la + +libaudiocd_encoder_lame_la_SOURCES = audiocd_lame_encoder.kcfgc encoderlame.cpp encoderlameconfig.ui collectingprocess.cpp + +libaudiocd_encoder_lame_la_LIBADD = $(LIB_KIO) ../libaudiocdplugins.la + +libaudiocd_encoder_lame_la_LDFLAGS = -avoid-version -module -no-undefined $(taglib_libs) $(all_libraries) + +pluginsdir = $(kde_datadir)/audiocd/plugins + +METASOURCES = AUTO + +messages: rc.cpp + $(XGETTEXT) *.cpp -o $(podir)/audiocd_encoder_lame.pot diff --git a/tdeioslave/audiocd/plugins/lame/audiocd_lame_encoder.kcfg b/tdeioslave/audiocd/plugins/lame/audiocd_lame_encoder.kcfg new file mode 100644 index 00000000..c752fd81 --- /dev/null +++ b/tdeioslave/audiocd/plugins/lame/audiocd_lame_encoder.kcfg @@ -0,0 +1,138 @@ + + + + + + + + + false + + + + true + + + + + 0 + + + + -2 + + + + + + false + + + + true + + + + false + + + + false + + + + true + + + + + + 10 + 0 + 13 + + + + + + false + + + + false + + + + false + + + + false + + + + true + + + + + 40 + 0 + 13 + + + + 13 + 0 + 13 + + + + 10 + 0 + 13 + + + + + + + false + + + + 18000 + + + + + false + + + + 0 + + + + + false + + + + 900 + + + + + false + + + + 0 + + + + diff --git a/tdeioslave/audiocd/plugins/lame/audiocd_lame_encoder.kcfgc b/tdeioslave/audiocd/plugins/lame/audiocd_lame_encoder.kcfgc new file mode 100644 index 00000000..b62f454d --- /dev/null +++ b/tdeioslave/audiocd/plugins/lame/audiocd_lame_encoder.kcfgc @@ -0,0 +1,4 @@ +# Code generation options for tdeconfig_compiler +File=audiocd_lame_encoder.kcfg +ClassName=Settings +Singleton=true diff --git a/tdeioslave/audiocd/plugins/lame/collectingprocess.cpp b/tdeioslave/audiocd/plugins/lame/collectingprocess.cpp new file mode 100644 index 00000000..4eaf5304 --- /dev/null +++ b/tdeioslave/audiocd/plugins/lame/collectingprocess.cpp @@ -0,0 +1,134 @@ +/* + collectingprocess.cpp + + This file is part of libtdepim. + Copyright (c) 2004 Ingo Kloecker + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + + In addition, as a special exception, the copyright holders give + permission to link the code of this program with any edition of + the TQt library by Trolltech AS, Norway (or with modified versions + of TQt that use the same license as TQt), and distribute linked + combinations including the two. You must obey the GNU General + Public License in all respects for all of the code used other than + TQt. If you modify this file, you may extend this exception to + your version of the file, but you are not obligated to do so. If + you do not wish to do so, delete this exception statement from + your version. +*/ + +#include "collectingprocess.h" + +#include + +#include + +struct CollectingProcess::Private { + Private() : stdoutSize( 0 ), stderrSize( 0 ) + {} + + uint stdoutSize; + TQValueList stdoutBuffer; + uint stderrSize; + TQValueList stderrBuffer; +}; + + +CollectingProcess::CollectingProcess( TQObject * parent, const char * name ) + : TDEProcess( parent, name ) +{ + d = new Private(); +} + +CollectingProcess::~CollectingProcess() { + delete d; d = 0; +} + +bool CollectingProcess::start( RunMode runmode, Communication comm ) { + // prevent duplicate connection + disconnect( this, TQT_SIGNAL( receivedStdout( TDEProcess *, char *, int ) ), + this, TQT_SLOT( slotReceivedStdout( TDEProcess *, char *, int ) ) ); + if ( comm & Stdout ) { + connect( this, TQT_SIGNAL( receivedStdout( TDEProcess *, char *, int ) ), + this, TQT_SLOT( slotReceivedStdout( TDEProcess *, char *, int ) ) ); + } + // prevent duplicate connection + disconnect( this, TQT_SIGNAL( receivedStderr( TDEProcess *, char *, int ) ), + this, TQT_SLOT( slotReceivedStderr( TDEProcess *, char *, int ) ) ); + if ( comm & Stderr ) { + connect( this, TQT_SIGNAL( receivedStderr( TDEProcess *, char *, int ) ), + this, TQT_SLOT( slotReceivedStderr( TDEProcess *, char *, int ) ) ); + } + return TDEProcess::start( runmode, comm ); +} + +void CollectingProcess::slotReceivedStdout( TDEProcess *, char *buf, int len ) +{ + TQByteArray b; + b.duplicate( buf, len ); + d->stdoutBuffer.append( b ); + d->stdoutSize += len; +} + +void CollectingProcess::slotReceivedStderr( TDEProcess *, char *buf, int len ) +{ + TQByteArray b; + b.duplicate( buf, len ); + d->stderrBuffer.append( b ); + d->stderrSize += len; +} + +TQByteArray CollectingProcess::collectedStdout() +{ + if ( d->stdoutSize == 0 ) { + return TQByteArray(); + } + + uint offset = 0; + TQByteArray b( d->stdoutSize ); + for ( TQValueList::const_iterator it = d->stdoutBuffer.begin(); + it != d->stdoutBuffer.end(); + ++it ) { + memcpy( b.data() + offset, (*it).data(), (*it).size() ); + offset += (*it).size(); + } + d->stdoutBuffer.clear(); + d->stdoutSize = 0; + + return b; +} + +TQByteArray CollectingProcess::collectedStderr() +{ + if ( d->stderrSize == 0 ) { + return TQByteArray(); + } + + uint offset = 0; + TQByteArray b( d->stderrSize ); + for ( TQValueList::const_iterator it = d->stderrBuffer.begin(); + it != d->stderrBuffer.end(); + ++it ) { + memcpy( b.data() + offset, (*it).data(), (*it).size() ); + offset += (*it).size(); + } + d->stderrBuffer.clear(); + d->stderrSize = 0; + + return b; +} + +#include "collectingprocess.moc" diff --git a/tdeioslave/audiocd/plugins/lame/collectingprocess.h b/tdeioslave/audiocd/plugins/lame/collectingprocess.h new file mode 100644 index 00000000..df5c180d --- /dev/null +++ b/tdeioslave/audiocd/plugins/lame/collectingprocess.h @@ -0,0 +1,73 @@ +/* -*- mode: C++ -*- + collectingprocess.h + + This file is a copy of the collectingprocess.h which is part of tdepim/libtdepim. + Copyright (c) 2004 Ingo Kloecker + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + + In addition, as a special exception, the copyright holders give + permission to link the code of this program with any edition of + the TQt library by Trolltech AS, Norway (or with modified versions + of TQt that use the same license as TQt), and distribute linked + combinations including the two. You must obey the GNU General + Public License in all respects for all of the code used other than + TQt. If you modify this file, you may extend this exception to + your version of the file, but you are not obligated to do so. If + you do not wish to do so, delete this exception statement from + your version. +*/ + +#ifndef __COLLECTINGPROCESS_H__ +#define __COLLECTINGPROCESS_H__ + +#include + +/** + * @short An output collecting TDEProcess class. + * + * This class simplifies the usage of TDEProcess by collecting all output + * (stdout/stderr) of the process. + * + * @author Ingo Kloecker + */ +class CollectingProcess : public TDEProcess { + Q_OBJECT + +public: + CollectingProcess( TQObject * parent = 0, const char * name = 0 ); + ~CollectingProcess(); + + /** Starts the process in NotifyOnExit mode and writes in to stdin of + the process. + */ + bool start( RunMode runmode, Communication comm ); + + /** Returns the contents of the stdout buffer and clears it afterwards. */ + TQByteArray collectedStdout(); + /** Returns the contents of the stderr buffer and clears it afterwards. */ + TQByteArray collectedStderr(); + +private slots: + void slotReceivedStdout( TDEProcess *, char *, int ); + void slotReceivedStderr( TDEProcess *, char *, int ); + +private: + class Private; + Private * d; +protected: +}; + +#endif // __COLLECTINGPROCESS_H__ diff --git a/tdeioslave/audiocd/plugins/lame/encoderlame.cpp b/tdeioslave/audiocd/plugins/lame/encoderlame.cpp new file mode 100644 index 00000000..8984bb33 --- /dev/null +++ b/tdeioslave/audiocd/plugins/lame/encoderlame.cpp @@ -0,0 +1,366 @@ +/* + Copyright (C) 2005 Benjamin Meyer + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +*/ + +#include +#include +#include "encoderlame.h" +#include "encoderlameconfig.h" +#include "audiocd_lame_encoder.h" + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include "collectingprocess.h" + +extern "C" +{ + KDE_EXPORT void create_audiocd_encoders(TDEIO::SlaveBase *slave, TQPtrList &encoders) { + encoders.append(new EncoderLame(slave)); + } +} + +static int bitrates[] = { 32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320 }; + +class EncoderLame::Private +{ +public: + int bitrate; + bool waitingForWrite; + bool processHasExited; + TQString lastErrorMessage; + TQStringList genreList; + uint lastSize; + TDEProcess *currentEncodeProcess; + KTempFile *tempFile; +}; + +EncoderLame::EncoderLame(TDEIO::SlaveBase *slave) : TQObject(), AudioCDEncoder(slave) { + d = new Private(); + d->waitingForWrite = false; + d->processHasExited = false; + d->lastSize = 0; + loadSettings(); +} + +EncoderLame::~EncoderLame(){ + delete d; +} + +TQWidget* EncoderLame::getConfigureWidget(TDEConfigSkeleton** manager) const { + (*manager) = Settings::self(); + TDEGlobal::locale()->insertCatalogue("audiocd_encoder_lame"); + EncoderLameConfig *config = new EncoderLameConfig(); + config->cbr_settings->hide(); + return config; +} + +bool EncoderLame::init(){ + // Determine if lame is installed on the system or not. + if ( KStandardDirs::findExe( "lame" ).isEmpty() ) + return false; + + // Ask lame for the list of genres it knows; otherwise it barfs when doing + // e.g. lame --tg 'Vocal Jazz' + CollectingProcess proc; + proc << "lame" << "--genre-list"; + proc.start(TDEProcess::Block, TDEProcess::Stdout); + + if(proc.exitStatus() != 0) + return false; + + const TQByteArray data = proc.collectedStdout(); + TQString str; + if ( !data.isEmpty() ) + str = TQString::fromLocal8Bit( data, data.size() ); + + d->genreList = TQStringList::split( '\n', str ); + // Remove the numbers in front of every genre + for( TQStringList::Iterator it = d->genreList.begin(); it != d->genreList.end(); ++it ) { + TQString& genre = *it; + uint i = 0; + while ( i < genre.length() && ( genre[i].isSpace() || genre[i].isDigit() ) ) + ++i; + genre = genre.mid( i ); + + } + //kdDebug(7117) << "Available genres:" << d->genreList << endl; + + return true; +} + +void EncoderLame::loadSettings(){ + // Generate the command line arguments for the current settings + args.clear(); + + Settings *settings = Settings::self(); + + int quality = settings->quality(); + if (quality < 0 ) quality = quality *-1; + if (quality > 9) quality = 9; + + int method = settings->bitrate_constant() ? 0 : 1 ; + + if (method == 0) { + // Constant Bitrate Encoding + args.append("-b"); + args.append(TQString("%1").arg(bitrates[settings->cbr_bitrate()])); + d->bitrate = bitrates[settings->cbr_bitrate()]; + args.append("-q"); + args.append(TQString("%1").arg(quality)); + } + else { + // Variable Bitrate Encoding + if (settings->vbr_average_br()) { + args.append("--abr"); + args.append(TQString("%1").arg(bitrates[settings->vbr_mean_brate()])); + d->bitrate = bitrates[settings->vbr_mean_brate()]; + if (settings->vbr_min_br()){ + args.append("-b"); + args.append(TQString("%1").arg(bitrates[settings->vbr_min_brate()])); + } + if (settings->vbr_min_hard()) + args.append("-F"); + if (settings->vbr_max_br()){ + args.append("-B"); + args.append(TQString("%1").arg(bitrates[settings->vbr_max_brate()])); + } + } else { + d->bitrate = 128; + args.append("-V"); + args.append(TQString("%1").arg(quality)); + } + if ( !settings->vbr_xing_tag() ) + args.append("-t"); + } + + args.append("-m"); + switch ( settings->stereo() ) { + case 0: + args.append("s"); + break; + case 1: + args.append("j"); + break; + case 2: + args.append("d"); + break; + case 3: + args.append("m"); + break; + default: + args.append("s"); + break; + } + + if(settings->copyright()) + args.append("-c"); + if(!settings->original()) + args.append("-o"); + if(settings->iso()) + args.append("--strictly-enforce-ISO"); + if(settings->crc()) + args.append("-p"); + + if ( settings->enable_lowpass() ) { + args.append("--lowpass"); + args.append(TQString("%1").arg(settings->lowfilterfreq())); + + if (settings->set_lpf_width()){ + args.append("--lowpass-width"); + args.append(TQString("%1").arg(settings->lowfilterwidth())); + } + } + + if ( settings->enable_highpass()) { + args.append("--hipass"); + args.append(TQString("%1").arg(settings->highfilterfreq())); + + if (settings->set_hpf_width()){ + args.append("--hipass-width"); + args.append(TQString("%1").arg(settings->highfilterwidth())); + } + } +} + +unsigned long EncoderLame::size(long time_secs) const { + return (time_secs * d->bitrate * 1000)/8; +} + +long EncoderLame::readInit(long /*size*/){ + // Create TDEProcess + d->currentEncodeProcess = new TDEProcess(0); + TQString prefix = locateLocal("tmp", ""); + d->tempFile = new KTempFile(prefix, ".mp3"); + d->tempFile->setAutoDelete(true); + d->lastErrorMessage = TQString(); + d->processHasExited = false; + + // -x bitswap + // -r raw/pcm + // -s 44.1 (because it is raw you have to specify this) +// #if __BYTE_ORDER == __LITTLE_ENDIAN +// *(d->currentEncodeProcess) << "lame" << "--verbose" << "-x" << "-r" << "-s" << "44.1"; +// #else + *(d->currentEncodeProcess) << "lame" << "--verbose" << "-r" << "-s" << "44.1"; +// #endif + + *(d->currentEncodeProcess) << args; + if(Settings::self()->id3_tag()) + *d->currentEncodeProcess << trackInfo; + + // Read in stdin, output to the temp file + *d->currentEncodeProcess << "-" << d->tempFile->name().latin1(); + + //kdDebug(7117) << d->currentEncodeProcess->args() << endl; + + + connect(d->currentEncodeProcess, TQT_SIGNAL(receivedStdout(TDEProcess *, char *, int)), + this, TQT_SLOT(receivedStdout(TDEProcess *, char *, int))); + connect(d->currentEncodeProcess, TQT_SIGNAL(receivedStderr(TDEProcess *, char *, int)), + this, TQT_SLOT(receivedStderr(TDEProcess *, char *, int))); + connect(d->currentEncodeProcess, TQT_SIGNAL(wroteStdin(TDEProcess *)), + this, TQT_SLOT(wroteStdin(TDEProcess *))); + + connect(d->currentEncodeProcess, TQT_SIGNAL(processExited(TDEProcess *)), + this, TQT_SLOT(processExited(TDEProcess *))); + + // Launch! + d->currentEncodeProcess->start(TDEProcess::NotifyOnExit, KShellProcess::All); + return 0; +} + +void EncoderLame::processExited ( TDEProcess *process ){ + kdDebug(7117) << "Lame Encoding process exited with: " << process->exitStatus() << endl; + d->processHasExited = true; +} + +void EncoderLame::receivedStderr( TDEProcess * /*process*/, char *buffer, int /*buflen*/ ){ + kdDebug(7117) << "Lame stderr: " << buffer << endl; + if ( !d->lastErrorMessage.isEmpty() ) + d->lastErrorMessage += '\t'; + d->lastErrorMessage += TQString::fromLocal8Bit( buffer ); +} + +void EncoderLame::receivedStdout( TDEProcess * /*process*/, char *buffer, int /*length*/ ){ + kdDebug(7117) << "Lame stdout: " << buffer << endl; +} + +void EncoderLame::wroteStdin( TDEProcess * /*procces*/ ){ + d->waitingForWrite = false; +} + +long EncoderLame::read(int16_t *buf, int frames){ + if(!d->currentEncodeProcess) + return 0; + if (d->processHasExited) + return -1; + + // Pipe the raw data to lame + char * cbuf = reinterpret_cast(buf); + d->currentEncodeProcess->writeStdin( cbuf, frames*4); + + // We can't return until the buffer has been written + d->waitingForWrite = true; + while(d->waitingForWrite && d->currentEncodeProcess->isRunning()){ + kapp->processEvents(); + usleep(1); + } + + // Determine the file size increase + TQFileInfo file(d->tempFile->name()); + uint change = file.size() - d->lastSize; + d->lastSize = file.size(); + return change; +} + +long EncoderLame::readCleanup(){ + if(!d->currentEncodeProcess) + return 0; + + // Let lame tag the first frame of the mp3 + d->currentEncodeProcess->closeStdin(); + while( d->currentEncodeProcess->isRunning()){ + kapp->processEvents(); + usleep(1); + } + + // Now copy the file out of the temp into kio + TQFile file( d->tempFile->name() ); + if ( file.open( IO_ReadOnly ) ) { + TQByteArray output; + char data[1024]; + while ( !file.atEnd() ) { + uint read = file.readBlock(data, 1024); + output.setRawData(data, read); + ioslave->data(output); + output.resetRawData(data, read); + } + file.close(); + } + + // cleanup the process and temp + delete d->currentEncodeProcess; + delete d->tempFile; + d->lastSize = 0; + + return 0; +} + +void EncoderLame::fillSongInfo( KCDDB::CDInfo info, int track, const TQString &comment ){ + trackInfo.clear(); + trackInfo.append("--tt"); + trackInfo.append(info.trackInfoList[track].get("title").toString()); + + trackInfo.append("--ta"); + trackInfo.append(info.get("artist").toString()); + + trackInfo.append("--tl"); + trackInfo.append(info.get("title").toString()); + + trackInfo.append("--ty"); + trackInfo.append(TQString("%1").arg(info.get("year").toString())); + + trackInfo.append("--tc"); + trackInfo.append(comment); + + trackInfo.append("--tn"); + trackInfo.append(TQString("%1").arg(track+1)); + + const TQString genre = info.get( "genre" ).toString(); + if ( d->genreList.find( genre ) != d->genreList.end() ) + { + trackInfo.append("--tg"); + trackInfo.append(genre); + } +} + + +TQString EncoderLame::lastErrorMessage() const +{ + return d->lastErrorMessage; +} + +#include "encoderlame.moc" diff --git a/tdeioslave/audiocd/plugins/lame/encoderlame.h b/tdeioslave/audiocd/plugins/lame/encoderlame.h new file mode 100644 index 00000000..09c323c3 --- /dev/null +++ b/tdeioslave/audiocd/plugins/lame/encoderlame.h @@ -0,0 +1,68 @@ +/* + Copyright (C) 2005 Benjamin Meyer + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +*/ + +#ifndef ENCODER_LAME_H +#define ENCODER_LAME_H + +#include "audiocdencoder.h" + +class TDEProcess; + +/** + * MP3 encoder using the LAME encoder. + * Go to http://lame.sourceforge.net/ for lots of information. + */ +class EncoderLame : public TQObject, public AudioCDEncoder { + +Q_OBJECT + + +public: + EncoderLame(TDEIO::SlaveBase *slave); + ~EncoderLame(); + + virtual TQString type() const { return "MP3"; }; + virtual bool init(); + virtual void loadSettings(); + virtual unsigned long size(long time_secs) const; + virtual const char * fileType() const { return "mp3"; }; + virtual const char * mimeType() const { return "audio/x-mp3"; }; + virtual void fillSongInfo( KCDDB::CDInfo info, int track, const TQString &comment ); + virtual long readInit(long size); + virtual long read(int16_t * buf, int frames); + virtual long readCleanup(); + virtual TQString lastErrorMessage() const; + + virtual TQWidget* getConfigureWidget(TDEConfigSkeleton** manager) const; + +protected slots: + void wroteStdin(TDEProcess *proc); + void receivedStdout(TDEProcess *, char *buffer, int length); + void receivedStderr(TDEProcess *proc, char *buffer, int buflen); + void processExited(TDEProcess *proc); + +private: + class Private; + Private * d; + + TQStringList args; + TQStringList trackInfo; +}; + +#endif // ENCODER_LAME_H + diff --git a/tdeioslave/audiocd/plugins/lame/encoderlameconfig.ui b/tdeioslave/audiocd/plugins/lame/encoderlameconfig.ui new file mode 100644 index 00000000..f8149741 --- /dev/null +++ b/tdeioslave/audiocd/plugins/lame/encoderlameconfig.ui @@ -0,0 +1,930 @@ + +EncoderLameConfig + + + LameConfig + + + + 0 + 0 + 471 + 598 + + + + + unnamed + + + + GroupBox1_2 + + + Options + + + + unnamed + + + 11 + + + 6 + + + + kcfg_copyright + + + Cop&yrighted + + + Mark MP3 file as copyrighted + + + Mark MP3 file as copyrighted. + + + + + kcfg_original + + + Origi&nal + + + true + + + Mark MP3 file as an original + + + Mark MP3 file as an original. + + + + + kcfg_iso + + + &ISO encoding + + + Try to use strict ISO encoding + + + This selects the maximal bitrate used for encoding. + + + + + kcfg_crc + + + &Error protection + + + + + kcfg_id3_tag + + + &Write ID3 tag + + + true + + + If checked and if cddb support is available, an id3 tag will be appended + + + If checked and if cddb support is available, an id3 tag will be appended + + + + + + + buttonGroup1 + + + Encoding Method + + + + unnamed + + + + Layout21 + + + + unnamed + + + 0 + + + 6 + + + + TextLabel3_2 + + + Low + + + + + kcfg_quality + + + -9 + + + 0 + + + 1 + + + -7 + + + Horizontal + + + NoMarks + + + + + TextLabel2_2 + + + High + + + + + + + TextLabel1_2 + + + &Quality: + + + AlignLeft + + + kcfg_quality + + + + + + Stereo + + + + + Joint Stereo + + + + + Dual Channel + + + + + Mono + + + + kcfg_stereo + + + This option controls whether MP3 files are recorded with one or two channels. Note that choosing <i>"Mono"</i> reduces file size, but also kills the stereo signal. + + + + + kcfg_bitrate_constant + + + Constant bitrate + + + + + kcfg_bitrate_variable + + + Variable bitrate + + + true + + + + + + + spacer11 + + + Vertical + + + Expanding + + + + 20 + 16 + + + + + + vbr_settings + + + true + + + Variable Bitrate Settings + + + + unnamed + + + 11 + + + 6 + + + + kcfg_vbr_average_br + + + Specify avera&ge bitrate: + + + This selects the maximal bitrate used for encoding. + + + + + + 32 kbs + + + + + 40 kbs + + + + + 48 kbs + + + + + 56 kbs + + + + + 64 kbs + + + + + 80 kbs + + + + + 96 kbs + + + + + 112 kbs + + + + + 128 kbs + + + + + 160 kbs + + + + + 192 kbs + + + + + 224 kbs + + + + + 256 kbs + + + + + 320 kbs + + + + kcfg_vbr_max_brate + + + false + + + 13 + + + + + kcfg_vbr_max_br + + + false + + + Maximal bi&trate: + + + This selects the maximal bitrate used for encoding. + + + + + kcfg_vbr_xing_tag + + + Write &Xing VBR tag + + + true + + + This writes additional information related to VBR as introduced by Xing. + + + + + + 32 kbs + + + + + 40 kbs + + + + + 48 kbs + + + + + 56 kbs + + + + + 64 kbs + + + + + 80 kbs + + + + + 96 kbs + + + + + 112 kbs + + + + + 128 kbs + + + + + 160 kbs + + + + + 192 kbs + + + + + 224 kbs + + + + + 256 kbs + + + + + 320 kbs + + + + kcfg_vbr_mean_brate + + + false + + + 9 + + + + + kcfg_vbr_min_hard + + + false + + + Minimal &value is a hard limit + + + + + kcfg_vbr_min_br + + + false + + + Minimal &bitrate: + + + This selects the minimal bitrate used for encoding. + + + + + + 32 kbs + + + + + 40 kbs + + + + + 48 kbs + + + + + 56 kbs + + + + + 64 kbs + + + + + 80 kbs + + + + + 96 kbs + + + + + 112 kbs + + + + + 128 kbs + + + + + 160 kbs + + + + + 192 kbs + + + + + 224 kbs + + + + + 256 kbs + + + + + 320 kbs + + + + kcfg_vbr_min_brate + + + false + + + 1 + + + + + + + cbr_settings + + + Constant Bitrate Settings + + + + unnamed + + + 11 + + + 6 + + + + TextLabel4_2 + + + Bitrate: + + + kcfg_cbr_bitrate + + + + + + 32 kbs + + + + + 40 kbs + + + + + 48 kbs + + + + + 56 kbs + + + + + 64 kbs + + + + + 80 kbs + + + + + 96 kbs + + + + + 112 kbs + + + + + 128 kbs + + + + + 160 kbs + + + + + 192 kbs + + + + + 224 kbs + + + + + 256 kbs + + + + + 320 kbs + + + + kcfg_cbr_bitrate + + + 9 + + + The higher the bitrate, the better the quality and the larger the file. + + + + + + + GroupBox83_2 + + + Filter Settings + + + AlignVCenter|AlignLeft + + + + + + + + unnamed + + + 11 + + + 6 + + + + kcfg_enable_lowpass + + + &Lowpass filter cutoff above + + + + + kcfg_lowfilterfreq + + + false + + + Hz + + + 20000 + + + + + kcfg_enable_highpass + + + &Highpass filter cutoff below + + + + + kcfg_highfilterfreq + + + false + + + Hz + + + 200 + + + + + kcfg_set_lpf_width + + + false + + + Low&pass filter width + + + + + kcfg_lowfilterwidth + + + false + + + Hz + + + 5000 + + + + + kcfg_set_hpf_width + + + false + + + Highpa&ss filter width + + + + + kcfg_highfilterwidth + + + false + + + Hz + + + 50 + + + + + + + + + kcfg_bitrate_constant + toggled(bool) + cbr_settings + setShown(bool) + + + kcfg_enable_highpass + toggled(bool) + kcfg_highfilterfreq + setEnabled(bool) + + + kcfg_enable_highpass + toggled(bool) + kcfg_highfilterwidth + setEnabled(bool) + + + kcfg_enable_lowpass + toggled(bool) + kcfg_lowfilterfreq + setEnabled(bool) + + + kcfg_enable_lowpass + toggled(bool) + kcfg_lowfilterwidth + setEnabled(bool) + + + kcfg_enable_highpass + toggled(bool) + kcfg_set_hpf_width + setEnabled(bool) + + + kcfg_enable_lowpass + toggled(bool) + kcfg_set_lpf_width + setEnabled(bool) + + + kcfg_vbr_average_br + toggled(bool) + kcfg_vbr_max_br + setEnabled(bool) + + + kcfg_vbr_max_br + toggled(bool) + kcfg_vbr_max_brate + setEnabled(bool) + + + kcfg_vbr_average_br + toggled(bool) + kcfg_vbr_mean_brate + setEnabled(bool) + + + kcfg_vbr_average_br + toggled(bool) + kcfg_vbr_min_br + setEnabled(bool) + + + kcfg_vbr_min_br + toggled(bool) + kcfg_vbr_min_brate + setEnabled(bool) + + + kcfg_vbr_min_br + toggled(bool) + kcfg_vbr_min_hard + setEnabled(bool) + + + kcfg_bitrate_variable + toggled(bool) + vbr_settings + setShown(bool) + + + + kcfg_bitrate_variable + kcfg_stereo + kcfg_quality + kcfg_copyright + kcfg_original + kcfg_iso + kcfg_crc + kcfg_id3_tag + kcfg_cbr_bitrate + kcfg_vbr_min_br + kcfg_vbr_min_hard + kcfg_vbr_max_br + kcfg_vbr_average_br + kcfg_vbr_xing_tag + kcfg_vbr_min_brate + kcfg_vbr_max_brate + kcfg_vbr_mean_brate + kcfg_enable_lowpass + kcfg_lowfilterfreq + kcfg_enable_highpass + kcfg_highfilterfreq + kcfg_set_lpf_width + kcfg_lowfilterwidth + kcfg_set_hpf_width + kcfg_highfilterwidth + + + diff --git a/tdeioslave/audiocd/plugins/vorbis/Makefile.am b/tdeioslave/audiocd/plugins/vorbis/Makefile.am new file mode 100644 index 00000000..e83240ff --- /dev/null +++ b/tdeioslave/audiocd/plugins/vorbis/Makefile.am @@ -0,0 +1,18 @@ +INCLUDES = -I$(top_srcdir)/libkcddb -I$(srcdir)/.. $(all_includes) + +kde_kcfg_DATA = audiocd_vorbis_encoder.kcfg + +kde_module_LTLIBRARIES = libaudiocd_encoder_vorbis.la + +libaudiocd_encoder_vorbis_la_SOURCES = audiocd_vorbis_encoder.kcfgc encodervorbis.cpp encodervorbisconfig.ui + +libaudiocd_encoder_vorbis_la_LIBADD = $(VORBIS_LIBS) $(VORBISFILE_LIBS) $(VORBISENC_LIBS) $(LIB_KIO) ../libaudiocdplugins.la + +libaudiocd_encoder_vorbis_la_LDFLAGS = -avoid-version -module -no-undefined $(all_libraries) + +pluginsdir = $(kde_datadir)/audiocd/plugins + +METASOURCES = AUTO + +messages: rc.cpp + $(XGETTEXT) *.cpp -o $(podir)/audiocd_encoder_vorbis.pot diff --git a/tdeioslave/audiocd/plugins/vorbis/audiocd_vorbis_encoder.kcfg b/tdeioslave/audiocd/plugins/vorbis/audiocd_vorbis_encoder.kcfg new file mode 100644 index 00000000..53465f6c --- /dev/null +++ b/tdeioslave/audiocd/plugins/vorbis/audiocd_vorbis_encoder.kcfg @@ -0,0 +1,84 @@ + + + + + + + + 0 + + + + + false + + + + false + + + + true + + + + + true + + + + 3 + -1 + 10 + + + + + 1 + 0 + 13 + + + + + 13 + 0 + 13 + + + + + 3 + 0 + 5 + + + + + + + + diff --git a/tdeioslave/audiocd/plugins/vorbis/audiocd_vorbis_encoder.kcfgc b/tdeioslave/audiocd/plugins/vorbis/audiocd_vorbis_encoder.kcfgc new file mode 100644 index 00000000..da857139 --- /dev/null +++ b/tdeioslave/audiocd/plugins/vorbis/audiocd_vorbis_encoder.kcfgc @@ -0,0 +1,4 @@ +# Code generation options for tdeconfig_compiler +File=audiocd_vorbis_encoder.kcfg +ClassName=Settings +Singleton=true diff --git a/tdeioslave/audiocd/plugins/vorbis/encodervorbis.cpp b/tdeioslave/audiocd/plugins/vorbis/encodervorbis.cpp new file mode 100644 index 00000000..048a46e0 --- /dev/null +++ b/tdeioslave/audiocd/plugins/vorbis/encodervorbis.cpp @@ -0,0 +1,336 @@ +/* + Copyright (C) 2000 Rik Hemsley (rikkus) + Copyright (C) 2000, 2001, 2002 Michael Matz + Copyright (C) 2001 Carsten Duvenhorst + Copyright (C) 2001 Adrian Schroeter + Copyright (C) 2003 Richard Lärkäng + Copyright (C) 2003 Scott Wheeler + Copyright (C) 2004, 2005 Benjamin Meyer + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +*/ + +#include "encodervorbis.h" +#include "audiocd_vorbis_encoder.h" +#include "encodervorbisconfig.h" + +#ifdef HAVE_VORBIS + +#include +#include +#include +#include +#include +#include + +#include +#include + +extern "C" +{ + KDE_EXPORT void create_audiocd_encoders(TDEIO::SlaveBase *slave, TQPtrList &encoders) + { + encoders.append(new EncoderVorbis(slave)); + } +} + +// these are the approx. bitrates for the current 5 Vorbis modes +static int vorbis_nominal_bitrates[] = { 128, 160, 192, 256, 350 }; +static int vorbis_bitrates[] = { 32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 350 }; + +class EncoderVorbis::Private { + +public: + ogg_stream_state os; /* take physical pages, weld into a logical stream of packets */ + ogg_page og; /* one Ogg bitstream page. Vorbis packets are inside */ + ogg_packet op; /* one raw packet of data for decode */ + + vorbis_info vi; /* struct that stores all the static vorbis bitstream settings */ + vorbis_comment vc; /* struct that stores all the user comments */ + + vorbis_dsp_state vd; /* central working state for the packet->PCM decoder */ + vorbis_block vb; /* local working space for packet->PCM decode */ + bool write_vorbis_comments; + long vorbis_bitrate_lower; + long vorbis_bitrate_upper; + long vorbis_bitrate_nominal; + int vorbis_encode_method; + double vorbis_quality; + int vorbis_bitrate; +}; + +EncoderVorbis::EncoderVorbis(TDEIO::SlaveBase *slave) : AudioCDEncoder(slave) { + d = new Private(); +} + +EncoderVorbis::~EncoderVorbis(){ + delete d; +} + +TQWidget* EncoderVorbis::getConfigureWidget(TDEConfigSkeleton** manager) const { + (*manager) = Settings::self(); + TDEGlobal::locale()->insertCatalogue("audiocd_encoder_vorbis"); + EncoderVorbisConfig *config = new EncoderVorbisConfig(); + config->kcfg_vorbis_quality->setRange(0.0, 10.0, 0.2, true); + config->vorbis_bitrate_settings->hide(); + return config; +} + +bool EncoderVorbis::init(){ + vorbis_info_init(&d->vi); + vorbis_comment_init(&d->vc); + + vorbis_comment_add_tag + ( + &d->vc, + const_cast("kde-encoder"), + const_cast("kio_audiocd") + ); + return true; +} + +void EncoderVorbis::loadSettings(){ + Settings *settings = Settings::self(); + + d->vorbis_encode_method = settings->vorbis_enc_method(); + d->vorbis_quality = settings->vorbis_quality(); + + if ( settings->set_vorbis_min_br()) { + d->vorbis_bitrate_lower = vorbis_bitrates[settings->vorbis_min_br()] * 1000; + } else { + d->vorbis_bitrate_lower = -1; + } + + if ( settings->set_vorbis_max_br() ) { + d->vorbis_bitrate_upper = vorbis_bitrates[settings->vorbis_max_br()] * 1000; + } else { + d->vorbis_bitrate_upper = -1; + } + + // this is such a hack! + if ( d->vorbis_bitrate_upper != -1 && d->vorbis_bitrate_lower != -1 ) { + d->vorbis_bitrate = 104000; // empirically determined ...?! + } else { + d->vorbis_bitrate = 160 * 1000; + } + + if ( settings->set_vorbis_nominal_br() ) { + d->vorbis_bitrate_nominal = vorbis_nominal_bitrates[settings->vorbis_nominal_br()] * 1000; + d->vorbis_bitrate = d->vorbis_bitrate_nominal; + } else { + d->vorbis_bitrate_nominal = -1; + } + + d->write_vorbis_comments = settings->vorbis_comments(); + + // Now that we have read in the settings apply them to the encoder lib + switch (d->vorbis_encode_method) { + case 0: +/* Support very old libvorbis by simply falling through. */ +#if HAVE_VORBIS >= 2 + vorbis_encode_init_vbr(&d->vi, 2, 44100, d->vorbis_quality/10.0); + break; +#endif + case 1: + vorbis_encode_init(&d->vi, 2, 44100, d->vorbis_bitrate_upper, d->vorbis_bitrate_nominal, d->vorbis_bitrate_lower); + break; + } + +} + +long EncoderVorbis::flush_vorbis(void) { + long processed(0); + + while(vorbis_analysis_blockout(&d->vd,&d->vb)==1) { + /* Support ancient libvorbis (< RC3). */ +#if HAVE_VORBIS >= 2 + vorbis_analysis(&d->vb,NULL); + /* Non-ancient case. */ + vorbis_bitrate_addblock(&d->vb); + + while(vorbis_bitrate_flushpacket(&d->vd, &d->op)) { +#else + vorbis_analysis(&d->vb,&d->op); + /* Make a lexical block to place the #ifdef's nearby. */ + if (1) { +#endif + ogg_stream_packetin(&d->os,&d->op); + while(int result=ogg_stream_pageout(&d->os,&d->og)) { + if (!result) break; + + TQByteArray output; + + char * oggheader = reinterpret_cast(d->og.header); + char * oggbody = reinterpret_cast(d->og.body); + + if (d->og.header_len) { + output.setRawData(oggheader, d->og.header_len); + ioslave->data(output); + output.resetRawData(oggheader, d->og.header_len); + } + + if (d->og.body_len) { + output.setRawData(oggbody, d->og.body_len); + ioslave->data(output); + output.resetRawData(oggbody, d->og.body_len); + } + processed += d->og.header_len + d->og.body_len; + } + } + } + return processed; +} + +unsigned long EncoderVorbis::size(long time_secs) const { + long vorbis_size; + switch (d->vorbis_encode_method) + { + case 0: // quality based encoding + +#if HAVE_VORBIS >= 2 // If really old Vorbis is being used, skip this nicely. + + { + // Estimated numbers based on the Vorbis FAQ: + // http://www.xiph.org/archives/vorbis-faq/200203/0030.html + + static long vorbis_q_bitrate[] = { 60, 74, 86, 106, 120, 152, + 183, 207, 239, 309, 440 }; + long quality = static_cast(d->vorbis_quality); + if (quality < 0 || quality > 10) + quality = 3; + vorbis_size = (time_secs * vorbis_q_bitrate[quality] * 1000) / 8; + + break; + } + +#endif // HAVE_VORBIS >= 2 + + default: // bitrate based encoding + vorbis_size = (time_secs * d->vorbis_bitrate/8); + break; + } + + return vorbis_size; +} + +const char * EncoderVorbis::mimeType() const{ + return "audio/vorbis"; +} + +long EncoderVorbis::readInit(long /*size*/){ + ogg_packet header; + ogg_packet header_comm; + ogg_packet header_code; + + vorbis_analysis_init(&d->vd,&d->vi); + vorbis_block_init(&d->vd,&d->vb); + + srand(time(NULL)); + ogg_stream_init(&d->os,rand()); + + vorbis_analysis_headerout(&d->vd,&d->vc,&header,&header_comm,&header_code); + + ogg_stream_packetin(&d->os,&header); + ogg_stream_packetin(&d->os,&header_comm); + ogg_stream_packetin(&d->os,&header_code); + + while (int result = ogg_stream_flush(&d->os,&d->og)) { + + if (!result) break; + + TQByteArray output; + + char * oggheader = reinterpret_cast(d->og.header); + char * oggbody = reinterpret_cast(d->og.body); + + if (d->og.header_len) { + output.setRawData(oggheader, d->og.header_len); + ioslave->data(output); + output.resetRawData(oggheader, d->og.header_len); + } + + if (d->og.body_len) { + output.setRawData(oggbody, d->og.body_len); + ioslave->data(output); + output.resetRawData(oggbody, d->og.body_len); + } + } + return 0; +} + +long EncoderVorbis::read(int16_t * buf, int frames){ + int i; + float **buffer=vorbis_analysis_buffer(&d->vd,frames); + + /* uninterleave samples */ + for(i=0;ivd,i); + return flush_vorbis(); +} + +long EncoderVorbis::readCleanup(){ + // send end-of-stream and flush the encoder + vorbis_analysis_wrote(&d->vd,0); + long processed = flush_vorbis(); + ogg_stream_clear(&d->os); + vorbis_block_clear(&d->vb); + vorbis_dsp_clear(&d->vd); + vorbis_info_clear(&d->vi); + return processed; +} + +void EncoderVorbis::fillSongInfo( KCDDB::CDInfo info, int track, const TQString &comment ) +{ + if( !d->write_vorbis_comments ) + return; + + typedef TQPair CommentField; + TQValueList commentFields; + + commentFields.append(CommentField("title", info.trackInfoList[track].get("title"))); + commentFields.append(CommentField("artist", info.get("artist"))); + commentFields.append(CommentField("album", info.get("title"))); + commentFields.append(CommentField("genre", info.get("genre"))); + commentFields.append(CommentField("tracknumber", TQString::number(track+1))); + commentFields.append(CommentField("comment", comment)); + + if (info.get("year").toInt() > 0) { + TQDateTime dt(TQDate(info.get("year").toInt(), 1, 1)); + commentFields.append(CommentField("date", dt.toString(Qt::ISODate).utf8().data())); + } + + for(TQValueListIterator it = commentFields.begin(); it != commentFields.end(); ++it) { + + // if the value is not empty + if(!(*it).second.toString().isEmpty()) { + + char *key = tqstrdup((*it).first); + char *value = tqstrdup((*it).second.toString().utf8().data()); + + vorbis_comment_add_tag(&d->vc, key, value); + + delete [] key; + delete [] value; + } + } +} + +#endif // HAVE_VORBIS + diff --git a/tdeioslave/audiocd/plugins/vorbis/encodervorbis.h b/tdeioslave/audiocd/plugins/vorbis/encodervorbis.h new file mode 100644 index 00000000..ea6a0ac3 --- /dev/null +++ b/tdeioslave/audiocd/plugins/vorbis/encodervorbis.h @@ -0,0 +1,68 @@ +/* + Copyright (C) 2000 Rik Hemsley (rikkus) + Copyright (C) 2000, 2001, 2002 Michael Matz + Copyright (C) 2001 Carsten Duvenhorst + Copyright (C) 2001 Adrian Schroeter + Copyright (C) 2003 Richard Lärkäng + Copyright (C) 2003 Scott Wheeler + Copyright (C) 2004, 2005 Benjamin Meyer + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +*/ + +#ifndef ENCODER_VORBIS_H +#define ENCODER_VORBIS_H + +#include + +#ifdef HAVE_VORBIS + +#include + +/** + * Ogg Vorbis encoder. + * This encoder is only enabled when HAVE_VORBIS is set. + * Check out http://www.vorbis.com/ for lots of information. + */ +class EncoderVorbis : public AudioCDEncoder { + +public: + EncoderVorbis(TDEIO::SlaveBase *slave); + ~EncoderVorbis(); + + virtual TQString type() const { return "Ogg Vorbis"; }; + virtual bool init(); + virtual void loadSettings(); + virtual unsigned long size(long time_secs) const; + virtual const char * fileType() const { return "ogg"; }; + virtual const char * mimeType() const; + virtual void fillSongInfo( KCDDB::CDInfo info, int track, const TQString &comment ); + virtual long readInit(long size); + virtual long read(int16_t * buf, int frames); + virtual long readCleanup(); + virtual TQWidget* getConfigureWidget(TDEConfigSkeleton** manager) const; + +private: + long flush_vorbis(); + + class Private; + Private * d; + +}; + +#endif // HAVE_VORBIS + +#endif // ENCODER_VORBIS_H + diff --git a/tdeioslave/audiocd/plugins/vorbis/encodervorbisconfig.ui b/tdeioslave/audiocd/plugins/vorbis/encodervorbisconfig.ui new file mode 100644 index 00000000..e442ade2 --- /dev/null +++ b/tdeioslave/audiocd/plugins/vorbis/encodervorbisconfig.ui @@ -0,0 +1,425 @@ + +EncoderVorbisConfig + + + VorbisConfig + + + + 0 + 0 + 375 + 408 + + + + + unnamed + + + + kcfg_vorbis_enc_method + + + &Encoding Method + + + + unnamed + + + + vorbis_enc_quality + + + Quality based + + + true + + + + + vorbis_enc_bitrate + + + Bitrate based + + + + + + + vorbis_bitrate_settings + + + true + + + Vorbis Bitrate Settings + + + + unnamed + + + 11 + + + 6 + + + + + 32 kbs + + + + + 40 kbs + + + + + 48 kbs + + + + + 56 kbs + + + + + 64 kbs + + + + + 80 kbs + + + + + 96 kbs + + + + + 112 kbs + + + + + 128 kbs + + + + + 160 kbs + + + + + 192 kbs + + + + + 224 kbs + + + + + 256 kbs + + + + + 350 kbs + + + + kcfg_vorbis_min_br + + + false + + + 1 + + + + + + 32 kbs + + + + + 40 kbs + + + + + 48 kbs + + + + + 56 kbs + + + + + 64 kbs + + + + + 80 kbs + + + + + 96 kbs + + + + + 112 kbs + + + + + 128 kbs + + + + + 160 kbs + + + + + 192 kbs + + + + + 224 kbs + + + + + 256 kbs + + + + + 350 kbs + + + + kcfg_vorbis_max_br + + + false + + + 13 + + + + + kcfg_set_vorbis_min_br + + + true + + + M&inimal bitrate: + + + + + kcfg_set_vorbis_max_br + + + true + + + Ma&ximal bitrate: + + + + + + 128 kbs + + + + + 160 kbs + + + + + 192 kbs + + + + + 256 kbs + + + + + 350 kbs + + + + kcfg_vorbis_nominal_br + + + 1 + + + + + kcfg_set_vorbis_nominal_br + + + A&verage bitrate: + + + true + + + + + + + vorbis_quality_settings + + + Vorbis &Quality Setting + + + You can set the quality of the encoded stream here. A higher value implies a higher quality but encodes slower. + + + + unnamed + + + 11 + + + 6 + + + + kcfg_vorbis_quality + + + 0 + + + 0 + + + 10000 + + + 1 + + + Higher is better but slower + + + + + + + GroupBox193 + + + Options + + + + unnamed + + + 11 + + + 6 + + + + kcfg_vorbis_comments + + + true + + + Add &track information + + + Add a description of the song to the file header. This makes it easy for the user to get advanced song information shown by his media player. You can get this information automatically via the Internet. Look at the <i>"CDDB Retrieval"</i> control module for details. + + + + + + + spacer9 + + + Vertical + + + Expanding + + + + 20 + 51 + + + + + + + + vorbis_enc_bitrate + toggled(bool) + vorbis_bitrate_settings + setShown(bool) + + + vorbis_enc_quality + toggled(bool) + vorbis_quality_settings + setShown(bool) + + + + vorbis_enc_quality + kcfg_set_vorbis_min_br + kcfg_set_vorbis_max_br + kcfg_set_vorbis_nominal_br + kcfg_vorbis_min_br + kcfg_vorbis_max_br + kcfg_vorbis_nominal_br + kcfg_vorbis_quality + kcfg_vorbis_comments + + + + knuminput.h + knuminput.h + + diff --git a/tdeioslave/audiocd/plugins/wav/Makefile.am b/tdeioslave/audiocd/plugins/wav/Makefile.am new file mode 100644 index 00000000..82e6ab28 --- /dev/null +++ b/tdeioslave/audiocd/plugins/wav/Makefile.am @@ -0,0 +1,15 @@ +AM_CPPFLAGS = -I$(srcdir)/.. $(all_includes) + +INCLUDES = -I$(top_srcdir)/libkcddb + +kde_module_LTLIBRARIES = libaudiocd_encoder_wav.la + +libaudiocd_encoder_wav_la_SOURCES = encoderwav.cpp encodercda.cpp + +libaudiocd_encoder_wav_la_LIBADD = $(LIB_KIO) ../libaudiocdplugins.la $(CDPARANOIA_LIBS) + +libaudiocd_encoder_wav_la_LDFLAGS = -avoid-version -module -no-undefined $(all_libraries) + +pluginsdir = $(kde_datadir)/audiocd/plugins + +METASOURCES = AUTO diff --git a/tdeioslave/audiocd/plugins/wav/encodercda.cpp b/tdeioslave/audiocd/plugins/wav/encodercda.cpp new file mode 100644 index 00000000..ef8522d9 --- /dev/null +++ b/tdeioslave/audiocd/plugins/wav/encodercda.cpp @@ -0,0 +1,67 @@ +/* + Copyright (C) 2000 Rik Hemsley (rikkus) + Copyright (C) 2000, 2001, 2002 Michael Matz + Copyright (C) 2001 Carsten Duvenhorst + Copyright (C) 2001 Adrian Schroeter + Copyright (C) 2003 Richard Lärkäng + Copyright (C) 2003 Scott Wheeler + Copyright (C) 2004, 2005 Benjamin Meyer + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +*/ + +#include "encodercda.h" + +class EncoderCda::Private +{ + public: + +}; + +unsigned long EncoderCda::size(long time_secs) const { + //return (time_secs * (44100 * 2 * 16))/8; + return (time_secs) * 176400; +} + +const char * EncoderCda::mimeType() const { + return "audio/x-cda"; +} + +// Remove this by calculating CD_FRAMESIZE_RAW from the frames +extern "C" +{ + #include +} + +inline int16_t swap16 (int16_t i) +{ + return (((i >> 8) & 0xFF) | ((i << 8) & 0xFF00)); +} + +long EncoderCda::read(int16_t * buf, int frames){ + TQByteArray output; + int16_t i16 = 1; + /* WAV is defined to be little endian, so we need to swap it + on big endian platforms. */ + if (((char*)&i16)[0] == 0) + for (int i=0; i < 2 * frames; i++) + buf[i] = swap16 (buf[i]); + char * cbuf = reinterpret_cast(buf); + output.setRawData(cbuf, CD_FRAMESIZE_RAW); + ioslave->data(output); + output.resetRawData(cbuf, CD_FRAMESIZE_RAW); + return CD_FRAMESIZE_RAW; +} + diff --git a/tdeioslave/audiocd/plugins/wav/encodercda.h b/tdeioslave/audiocd/plugins/wav/encodercda.h new file mode 100644 index 00000000..bb1297c7 --- /dev/null +++ b/tdeioslave/audiocd/plugins/wav/encodercda.h @@ -0,0 +1,61 @@ +/* + Copyright (C) 2000 Rik Hemsley (rikkus) + Copyright (C) 2000, 2001, 2002 Michael Matz + Copyright (C) 2001 Carsten Duvenhorst + Copyright (C) 2001 Adrian Schroeter + Copyright (C) 2003 Richard Lärkäng + Copyright (C) 2003 Scott Wheeler + Copyright (C) 2004, 2005 Benjamin Meyer + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +*/ + +#ifndef ENCODER_CDA_H +#define ENCODER_CDA_H + +#include +#include +#include +#include + +/** + * Raw cd "encoder" + * Does little more then copy the data and make sure it is in the right + * endian. + */ +class EncoderCda : public AudioCDEncoder { + +public: + EncoderCda(TDEIO::SlaveBase *slave) : AudioCDEncoder(slave) {}; + ~EncoderCda(){}; + virtual bool init(){ return true; }; + virtual void loadSettings(){}; + virtual unsigned long size(long time_secs) const; + virtual TQString type() const { return "CDA"; }; + virtual const char * mimeType() const; + virtual const char * fileType() const { return "cda"; }; + virtual void fillSongInfo( KCDDB::CDInfo, int, const TQString &){}; + virtual long readInit(long){ return 0; }; + virtual long read(int16_t * buf, int frames); + virtual long readCleanup(){ return 0; }; + +private: + class Private; + Private * d; + +}; + +#endif // ENCODER_CDA_H + diff --git a/tdeioslave/audiocd/plugins/wav/encoderwav.cpp b/tdeioslave/audiocd/plugins/wav/encoderwav.cpp new file mode 100644 index 00000000..84a8586b --- /dev/null +++ b/tdeioslave/audiocd/plugins/wav/encoderwav.cpp @@ -0,0 +1,85 @@ +/* + Copyright (C) 2000 Rik Hemsley (rikkus) + Copyright (C) 2000, 2001, 2002 Michael Matz + Copyright (C) 2001 Carsten Duvenhorst + Copyright (C) 2001 Adrian Schroeter + Copyright (C) 2003 Richard Lärkäng + Copyright (C) 2003 Scott Wheeler + Copyright (C) 2004, 2005 Benjamin Meyer + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +*/ + +#include "encoderwav.h" + +extern "C" +{ + KDE_EXPORT void create_audiocd_encoders(TDEIO::SlaveBase *slave, TQPtrList &encoders) + { + encoders.append( new EncoderWav(slave)); + encoders.append( new EncoderCda(slave)); + } +} + +class EncoderWav::Private +{ + public: + +}; + +unsigned long EncoderWav::size(long time_secs) const { + return (EncoderCda::size(time_secs) + 44); +} + +const char * EncoderWav::mimeType() const { + return "audio/x-wav"; +} + +long EncoderWav::readInit(long byteCount){ + static char riffHeader[] = + { + 0x52, 0x49, 0x46, 0x46, // 0 "AIFF" + 0x00, 0x00, 0x00, 0x00, // 4 wavSize + 0x57, 0x41, 0x56, 0x45, // 8 "WAVE" + 0x66, 0x6d, 0x74, 0x20, // 12 "fmt " + 0x10, 0x00, 0x00, 0x00, // 16 + 0x01, 0x00, 0x02, 0x00, // 20 + 0x44, 0xac, 0x00, 0x00, // 24 + 0x10, 0xb1, 0x02, 0x00, // 28 + 0x04, 0x00, 0x10, 0x00, // 32 + 0x64, 0x61, 0x74, 0x61, // 36 "data" + 0x00, 0x00, 0x00, 0x00 // 40 byteCount + }; + + TQ_INT32 wavSize(byteCount + 44 - 8); + + + riffHeader[4] = (wavSize >> 0 ) & 0xff; + riffHeader[5] = (wavSize >> 8 ) & 0xff; + riffHeader[6] = (wavSize >> 16) & 0xff; + riffHeader[7] = (wavSize >> 24) & 0xff; + + riffHeader[40] = (byteCount >> 0 ) & 0xff; + riffHeader[41] = (byteCount >> 8 ) & 0xff; + riffHeader[42] = (byteCount >> 16) & 0xff; + riffHeader[43] = (byteCount >> 24) & 0xff; + + TQByteArray output; + output.setRawData(riffHeader, 44); + ioslave->data(output); + output.resetRawData(riffHeader, 44); + return 44; +} + diff --git a/tdeioslave/audiocd/plugins/wav/encoderwav.h b/tdeioslave/audiocd/plugins/wav/encoderwav.h new file mode 100644 index 00000000..154236f2 --- /dev/null +++ b/tdeioslave/audiocd/plugins/wav/encoderwav.h @@ -0,0 +1,56 @@ +/* + Copyright (C) 2000 Rik Hemsley (rikkus) + Copyright (C) 2000, 2001, 2002 Michael Matz + Copyright (C) 2001 Carsten Duvenhorst + Copyright (C) 2001 Adrian Schroeter + Copyright (C) 2003 Richard Lärkäng + Copyright (C) 2003 Scott Wheeler + Copyright (C) 2004, 2005 Benjamin Meyer + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +*/ + +#ifndef ENCODER_WAV_H +#define ENCODER_WAV_H + +#include "encodercda.h" +#include +#include +#include + +/** + * Wav audio "encoder" + * Takes the CDA take and adds the standard wav header. + */ +class EncoderWav : public EncoderCda { + +public: + EncoderWav(TDEIO::SlaveBase *slave) : EncoderCda(slave) {}; + ~EncoderWav(){}; + virtual bool init(){ return true; }; + virtual unsigned long size(long time_secs) const; + virtual TQString type() const { return "Wav"; }; + virtual const char * fileType() const { return "wav"; }; + virtual const char * mimeType() const; + virtual void fillSongInfo( KCDDB::CDInfo, int, const TQString &){}; + virtual long readInit(long size); + +private: + class Private; + Private * d; + +}; + +#endif // ENCODER_WAV_H diff --git a/tdeioslave/audiocd/upgrade-metadata.sh b/tdeioslave/audiocd/upgrade-metadata.sh new file mode 100755 index 00000000..000323b1 --- /dev/null +++ b/tdeioslave/audiocd/upgrade-metadata.sh @@ -0,0 +1,28 @@ +#! /usr/bin/env bash + +while read; do + if [ "${REPLY#\[}" != "$REPLY" ] ; then # group name + GROUP="${REPLY:1:${#REPLY}-2}" + continue; + fi + # normal key=value pair: + KEY="${REPLY%%=*}" + VALUE="${REPLY#*=}" + + case "$GROUP/$KEY" in + FileName/file_name_template) + # + # Swap + # + VALUE=`echo $VALUE | sed -e s/%a/%{albumtitle}/g`; + VALUE=`echo $VALUE | sed -e s/%t/%{title}/g`; + VALUE=`echo $VALUE | sed -e s/%n/%{number}/g`; + VALUE=`echo $VALUE | sed -e s/%g/%{genre}/g`; + VALUE=`echo $VALUE | sed -e s/%y/%{year}/g`; + VALUE=`echo $VALUE | sed -e s/%A/%{albumartist}/g`; + echo "[FileName]"; + echo "file_name_template=$VALUE" + echo "# DELETE [FileName]file_name_template" + ;; + esac +done diff --git a/tdemid/channel.cpp b/tdemid/channel.cpp index 97fc5133..c97ea5c9 100644 --- a/tdemid/channel.cpp +++ b/tdemid/channel.cpp @@ -30,7 +30,7 @@ #include #include -#include +#include #include #include #include "tdemidbutton.h" diff --git a/tdemid/channelview.cpp b/tdemid/channelview.cpp index bf1ebf55..d97fdee9 100644 --- a/tdemid/channelview.cpp +++ b/tdemid/channelview.cpp @@ -28,7 +28,7 @@ #include "channelview.h" #include "channel3d.h" #include "channel4d.h" -#include +#include ChannelView::ChannelView(void) : KMainWindow(0, "ChannelView") diff --git a/tdemid/collectdlg.cpp b/tdemid/collectdlg.cpp index 20ac8def..0e4a84fe 100644 --- a/tdemid/collectdlg.cpp +++ b/tdemid/collectdlg.cpp @@ -26,7 +26,7 @@ #include #include -#include +#include #include #include #include diff --git a/tdemid/kdisptext.cpp b/tdemid/kdisptext.cpp index edaede4a..3152a277 100644 --- a/tdemid/kdisptext.cpp +++ b/tdemid/kdisptext.cpp @@ -28,7 +28,7 @@ #include #include -#include +#include #include #include #include diff --git a/tdemid/main.cpp b/tdemid/main.cpp index a35647e0..77a09e73 100644 --- a/tdemid/main.cpp +++ b/tdemid/main.cpp @@ -30,7 +30,7 @@ #include #include -#include +#include #include #include diff --git a/tdemid/midicfgdlg.cpp b/tdemid/midicfgdlg.cpp index 46577c28..3724abcf 100644 --- a/tdemid/midicfgdlg.cpp +++ b/tdemid/midicfgdlg.cpp @@ -27,7 +27,7 @@ #include #include -#include +#include #include #include #include diff --git a/tdemid/tdemidclient.cpp b/tdemid/tdemidclient.cpp index ba85e438..07edf700 100644 --- a/tdemid/tdemidclient.cpp +++ b/tdemid/tdemidclient.cpp @@ -39,7 +39,7 @@ #include #include -#include +#include #include #include #include @@ -79,11 +79,11 @@ tdemidClient::tdemidClient(TQWidget *parent, KActionCollection *ac, const char * noteArray=0L; shuttingdown=false; - TDEConfig *kconf=TDEGlobal::instance()->config(); + TDEConfig *tdeconf=TDEGlobal::instance()->config(); - kconf->setGroup("KMid"); + tdeconf->setGroup("KMid"); TQString tmp2 = locateLocal("appdata", "collections"); - collectionsfile=kconf->readPathEntry("CollectionsFile",tmp2); + collectionsfile=tdeconf->readPathEntry("CollectionsFile",tmp2); slman=new SLManager(); slman->loadConfig(TQFile::encodeName(collectionsfile)); currentsl=NULL; @@ -174,16 +174,16 @@ tdemidClient::tdemidClient(TQWidget *parent, KActionCollection *ac, const char * } - kconf->setGroup("KMid"); - int mididev=kconf->readNumEntry("MidiPortNumber",-1); + tdeconf->setGroup("KMid"); + int mididev=tdeconf->readNumEntry("MidiPortNumber",-1); midi = new DeviceManager(mididev); midi->initManager(); m_kMid.midi=midi; player= new MidiPlayer(midi,m_kMid.pctl); - kconf->setGroup("Midimapper"); - TQCString qs=TQFile::encodeName(kconf->readPathEntry("Loadfile","gm.map")); + tdeconf->setGroup("Midimapper"); + TQCString qs=TQFile::encodeName(tdeconf->readPathEntry("Loadfile","gm.map")); #ifdef KMidDEBUG printf("Read Config file: %s\n",qs.data()); @@ -191,8 +191,8 @@ tdemidClient::tdemidClient(TQWidget *parent, KActionCollection *ac, const char * setMidiMapFilename(qs.data()); initializing_songs=1; - kconf->setGroup("KMid"); - setActiveCollection(kconf->readNumEntry("ActiveCollection",0)); + tdeconf->setGroup("KMid"); + setActiveCollection(tdeconf->readNumEntry("ActiveCollection",0)); initializing_songs=0; TQVBoxLayout *lv=new TQVBoxLayout( this ); @@ -1208,10 +1208,10 @@ void tdemidClient::setSLManager(SLManager *slm) void tdemidClient::setActiveCollection(int i) { activecollection=i; - TDEConfig *kconf=TDEGlobal::instance()->config(); + TDEConfig *tdeconf=TDEGlobal::instance()->config(); - kconf->setGroup("KMid"); - kconf->writeEntry("ActiveCollection",activecollection); + tdeconf->setGroup("KMid"); + tdeconf->writeEntry("ActiveCollection",activecollection); currentsl=slman->getCollection(activecollection); generateCPL(); initializing_songs=1; diff --git a/tdemid/tdemidclient.h b/tdemid/tdemidclient.h index 526b0656..5a6ee79b 100644 --- a/tdemid/tdemidclient.h +++ b/tdemid/tdemidclient.h @@ -38,7 +38,7 @@ #include "version.h" #include "tdemidIface.h" -#include +#include class DeviceManager; diff --git a/tdemid/tdemidframe.cpp b/tdemid/tdemidframe.cpp index cbadbc73..edcfbfe0 100644 --- a/tdemid/tdemidframe.cpp +++ b/tdemid/tdemidframe.cpp @@ -33,9 +33,9 @@ #include #include -#include +#include #include -#include +#include #include #include #include diff --git a/xine_artsplugin/tools/thumbnail/videocreator.h b/xine_artsplugin/tools/thumbnail/videocreator.h index 2f2236bc..439b9cf4 100644 --- a/xine_artsplugin/tools/thumbnail/videocreator.h +++ b/xine_artsplugin/tools/thumbnail/videocreator.h @@ -20,7 +20,7 @@ #ifndef _VIDEOCREATOR_H_ #define _VIDEOCREATOR_H_ "$Id$" -#include +#include class VideoCreator : public TQObject, public ThumbCreator { -- cgit v1.2.3