summaryrefslogtreecommitdiffstats
path: root/libk9copy/k9audiocodecs.cpp
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-02-17 00:32:19 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-02-17 00:32:19 +0000
commit0d382a262c0638d0f572fc37193ccc5ed3dc895f (patch)
tree8578dcddfce4191f3f7a142a37769df7add48475 /libk9copy/k9audiocodecs.cpp
downloadk9copy-0d382a262c0638d0f572fc37193ccc5ed3dc895f.tar.gz
k9copy-0d382a262c0638d0f572fc37193ccc5ed3dc895f.zip
Added old abandoned version of k9copy
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/k9copy@1091546 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'libk9copy/k9audiocodecs.cpp')
-rw-r--r--libk9copy/k9audiocodecs.cpp118
1 files changed, 118 insertions, 0 deletions
diff --git a/libk9copy/k9audiocodecs.cpp b/libk9copy/k9audiocodecs.cpp
new file mode 100644
index 0000000..361fbf0
--- /dev/null
+++ b/libk9copy/k9audiocodecs.cpp
@@ -0,0 +1,118 @@
+//
+// C++ Implementation: k9audiocodecs
+//
+// Description:
+//
+//
+// Author: Jean-Michel PETIT <[email protected]>, (C) 2007
+//
+// Copyright: See COPYING file that comes with this distribution
+//
+//
+#include "k9audiocodecs.h"
+
+#include <qstringlist.h>
+
+class _k9AudioCodec
+{
+public:
+ _k9AudioCodec():name(""),options(""){};
+ _k9AudioCodec(QString _name,QString _options) {
+ name=_name;
+ options=_options;
+ }
+ QString name;
+ QString options;
+};
+
+
+k9AudioCodecs::k9AudioCodecs(QObject *parent, const char *name)
+ : QObject(parent, name)
+{
+ m_config=new k9Config();
+ QStringList slLabels=m_config->getCodecLabelsAudio();
+ QStringList slCodecs=m_config->getCodecAudio();
+ //adds default codecs
+ if (slLabels.count()==0) {
+ reset();
+ m_config=new k9Config();
+ slLabels=m_config->getCodecLabelsAudio();
+ slCodecs=m_config->getCodecAudio();
+ }
+ QStringList::iterator c=slCodecs.begin();
+ int cpt=0;
+ for (QStringList::iterator i=slLabels.begin();i!=slLabels.end() ;++i) {
+ QString o1=(*c);
+ c++;
+ m_codecs[cpt++]=_k9AudioCodec((*i),o1);
+ }
+ delete m_config;
+
+}
+
+void k9AudioCodecs::reset() {
+ m_codecs[0]=_k9AudioCodec("copy","-oac copy");
+ m_codecs[1]=_k9AudioCodec("mp3","-oac lavc -lavcopts acodec=mp3:abitrate=$AUDBR");
+ m_codecs[2]=_k9AudioCodec("mp2","-oac lavc -lavcopts acodec=mp2:abitrate=$AUDBR");
+ m_codecs[3]=_k9AudioCodec("ac3","-oac lavc -lavcopts acodec=ac3:abitrate=$AUDBR");
+ m_codecs[4]=_k9AudioCodec("IMA Adaptive PCM","-oac lavc -lavcopts acodec=adpcm_ima_wav:abitrate=$AUDBR");
+ m_codecs[5]=_k9AudioCodec("sonic","-oac lavc -lavcopts acodec=sonic:abitrate=$AUDBR");
+ m_codecs[6]=_k9AudioCodec("aac","-oac faac -faacopts br=$AUDBR");
+ m_codecs[7]=_k9AudioCodec("mp3 (lame)","-oac mp3lame -lameopts abr:br=$AUDBR");
+ save();
+}
+
+void k9AudioCodecs::save() {
+ m_config=new k9Config();
+
+ QStringList labels;
+ QStringList options;
+ for (QMap<int,_k9AudioCodec>::iterator i=m_codecs.begin();i!=m_codecs.end();++i) {
+ labels << i.data().name;
+ options << i.data().options;
+ }
+ m_config->setCodecLabelsAudio(labels);
+ m_config->setCodecAudio(options);
+ m_config->save();
+ delete m_config;
+}
+
+
+
+
+int k9AudioCodecs::count() {
+ return m_codecs.count();
+}
+
+void k9AudioCodecs::setOptions(int _num,QString _value) {
+ m_codecs[_num].options=_value;
+}
+
+void k9AudioCodecs::setCodecName(int _num,QString _value) {
+ m_codecs[_num].name=_value;
+}
+
+QString k9AudioCodecs::getOptions(int _num) {
+ return m_codecs[_num].options;
+}
+
+QString k9AudioCodecs::getCodecName(int _num) {
+ return m_codecs[_num].name;
+}
+
+void k9AudioCodecs::remove(int _num) {
+ int nb=count();
+ if (nb>0) {
+ for(int i=_num;i<nb-1;i++) {
+ m_codecs[i]=m_codecs[i+1];
+ }
+ m_codecs.remove(nb-1);
+ }
+}
+
+k9AudioCodecs::~k9AudioCodecs()
+{
+}
+
+
+#include "k9audiocodecs.moc"