[matroska] r1283 - in trunk/DvdMenuXtractor: . dmxconsole
[email protected] Sun, 11 Mar 2007 00:17:23 +0300 (MSK)
| Newsgroups | gmane.comp.multimedia.matroska.cvs |
|---|---|
| Message-ID | <[email protected]> |
Author: smssms
Date: 2007-03-11 00:17:10 +0300 (Sun, 11 Mar 2007)
New Revision: 1283
Added:
trunk/DvdMenuXtractor/dmxconsole/
trunk/DvdMenuXtractor/dmxconsole/dmxconsole.cpp
trunk/DvdMenuXtractor/dmxconsole/dmxconsole.h
trunk/DvdMenuXtractor/dmxconsole/dmxconsole.proj
trunk/DvdMenuXtractor/dmxconsole/main.cpp
Log:
Separate projects for CLI and GUI modes
Added: trunk/DvdMenuXtractor/dmxconsole/dmxconsole.cpp
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/DvdMenuXtractor/dmxconsole/dmxconsole.cpp 2007-03-10 21:15:45 U=
TC (rev 1282)
+++ trunk/DvdMenuXtractor/dmxconsole/dmxconsole.cpp 2007-03-10 21:17:10 U=
TC (rev 1283)
@@ -0,0 +1,121 @@
+#include <iostream>
+
+#include "utilities.h"
+#include "dmxconsole.h"
+
+DMXConsole::~DMXConsole()
+{
+}
+
+DMXConsole::DMXConsole(char *arguments[], int argumentCount)
+{
+ ready_ =3D true;
+
+ if ((argumentCount !=3D 7) && (argumentCount !=3D 9))
+ {
+ ShowUsage();
+ ready_ =3D false;
+ return;
+ }
+
+ QString argument;
+=09
+ for (int i =3D 1; i < argumentCount; ++i)
+ {
+ argument =3D arguments[i];
+
+ if (argument =3D=3D "-h")
+ {
+ ShowUsage();
+ ready_ =3D false;
+ return;
+ }
+ else if (argument =3D=3D "-i")
+ sourcePath_ =3D arguments[++i];
+ else if (argument =3D=3D "-o")
+ destinationPath_ =3D arguments[++i];
+ else if (argument =3D=3D "-t")
+ toolsPath_ =3D arguments[++i];
+ else if (argument =3D=3D "-s")
+ selectionItems_ =3D generateSelectionItems(QString(arguments[++i]));
+ else
+ {
+ std::cout << "ERROR: Unknown option was specified" << std::endl;
+ DMXConsole::ShowUsage();
+ ready_ =3D false;
+ return;
+ }
+ }
+}
+
+DMX::SelectionType DMXConsole::generateSelectionItems(const QString& sel=
ectionString)
+{
+ QString item;
+ QStringList subItems;
+ DMX::SelectionType selectionItems;
+
+ // split string using ";" as delimeter into selection item string
+ QStringList items =3D selectionString.split(";");
+
+ // procfess each substring
+ for (int index =3D 0; index < items.size(); ++index)
+ {
+ item =3D items.at(index);
+
+ // split subitems into smaller parts using "," as delimeter
+ subItems =3D item.split(",");
+
+ // now check if we have all the components
+ if (subItems.size() =3D=3D ITEM_COUNT)
+ {
+ DMXSelectionItem item(subItems.at(TITLE_INDEX).toInt(),=20
+ subItems.at(MENU_INDEX).toInt(),
+ subItems.at(VIDEO_INDEX).toInt());
+
+ // add audio tracks
+ int index =3D 0;
+ QStringList trackList =3D extractTrackNumbers(subItems.at(1));
+ for (index =3D 0; index < trackList.size(); ++index)
+ item.addAudioTrack(trackList.at(index).toUInt());
+
+ // add subtitle tracks
+ trackList =3D extractTrackNumbers(subItems.at(2));
+ for (index =3D 0; index < trackList.size(); ++index)
+ item.addSubtitleTrack(trackList.at(index).toUInt());
+
+ selectionItems.push_back(item);
+ }
+ else
+ fprintf(stderr, "WARNING: Incorrect selection item at index %d was fo=
und\n", index);
+ }
+
+ return selectionItems;
+}
+
+QStringList DMXConsole::extractTrackNumbers(const QString& trackNumberSt=
ring)
+{
+ if ( trackNumberString.size() <=3D 2 )
+ return QStringList();
+
+ return trackNumberString.mid(1, trackNumberString.size() - 1).split(","=
);
+}
+
+void DMXConsole::extract()
+{
+ if (ready_)
+ {
+ DMX extractor (true);
+ extractor.setExtractionParameters(sourcePath_, destinationPath_, tools=
Path_, selectionItems_);
+ extractor.start();
+ extractor.wait();
+ }
+}
+
+void DMXConsole::ShowUsage()
+{
+ std::cout << "USAGE: DvdMenuExtractor [<options>]\n\n"
+ << " Show usage: -h\n"
+ << " Specify folders: -i <dir> -o <dir> -t <dir>\n"
+ << " Specify selection: -s title, extractMenu, extractVideo, {audi=
oTracks}, {subTracks};..."
+ << std::endl;
+}
Added: trunk/DvdMenuXtractor/dmxconsole/dmxconsole.h
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/DvdMenuXtractor/dmxconsole/dmxconsole.h 2007-03-10 21:15:45 UTC=
(rev 1282)
+++ trunk/DvdMenuXtractor/dmxconsole/dmxconsole.h 2007-03-10 21:17:10 UTC=
(rev 1283)
@@ -0,0 +1,30 @@
+#ifndef DMXCONSOLE_H
+#define DMXCONSOLE_H
+
+#include "dmx.h"
+
+class DMXConsole
+{
+public:
+ DMXConsole(char *arguments[], int argumentCount);
+ ~DMXConsole();
+
+ void extract();
+
+ static void ShowUsage();
+
+private:
+ bool ready_;
+ QString toolsPath_;
+ QString sourcePath_;
+ QString destinationPath_;
+ DMX::SelectionType selectionItems_;
+
+ enum {TITLE_INDEX =3D 0, MENU_INDEX, VIDEO_INDEX,
+ AUDIO_TRACKS_INDEX, SUBTITLE_TRACKS_INDEX, ITEM_COUNT};
+=09
+ QStringList extractTrackNumbers(const QString& trackNumberString);
+ DMX::SelectionType generateSelectionItems(const QString& selectionStrin=
g);
+};
+
+#endif // DMXCONSOLE_H
Added: trunk/DvdMenuXtractor/dmxconsole/dmxconsole.proj
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/DvdMenuXtractor/dmxconsole/dmxconsole.proj 2007-03-10 21:15:45 =
UTC (rev 1282)
+++ trunk/DvdMenuXtractor/dmxconsole/dmxconsole.proj 2007-03-10 21:17:10 =
UTC (rev 1283)
@@ -0,0 +1,46 @@
+CON dmxconsole
+{
+ USE dmx
+ =20
+ DEFINE __STDC_LIMIT_MACROS
+ DEFINE(QT_NO_DEBUG) QT_NO_DEBUG_STREAM
+ =20
+ INCLUDE(COMPILER_MSVC) ../dmx/libdvdread/win32
+ INCLUDE(COMPILER_MSVC) "$(QTDIR)/include"
+ INCLUDE(COMPILER_MSVC) "$(QTDIR)/include/QtCore"
+ =20
+ INCLUDE(COMPILER_GCC) "$(QTDIR)/include/qt4"
+ INCLUDE(COMPILER_GCC) "$(QTDIR)/include/qt4/QtCore"
+ =20
+ INCLUDE ../dmx
+ INCLUDE ../dmx/vobparser
+ INCLUDE ../dmx/libdvdread
+ =20
+ LIBS_RELEASE(COMPILER_MSVC) qtmain.lib
+ LIBS_RELEASE(COMPILER_MSVC && CONFIG_STATIC) QtXml.lib
+ LIBS_RELEASE(COMPILER_MSVC && CONFIG_STATIC) QtCore.lib
+ LIBS_RELEASE(COMPILER_MSVC && !CONFIG_STATIC) QtXml4.lib
+ LIBS_RELEASE(COMPILER_MSVC && !CONFIG_STATIC) QtCore4.lib
+ =20
+ LIBS_DEBUG(COMPILER_MSVC) qtmaind.lib
+ LIBS_DEBUG(COMPILER_MSVC && CONFIG_STATIC) QtXmld.lib
+ LIBS_DEBUG(COMPILER_MSVC && CONFIG_STATIC) QtCored.lib
+ LIBS_DEBUG(COMPILER_MSVC && !CONFIG_STATIC) QtXmld4.lib
+ LIBS_DEBUG(COMPILER_MSVC && !CONFIG_STATIC) QtCored4.lib
+ =20
+ LIBS(COMPILER_GCC && CONFIG_STATIC) QtXml
+ LIBS(COMPILER_GCC && CONFIG_STATIC) QtCore
+ LIBS(COMPILER_GCC && !CONFIG_STATIC) QtXml4
+ LIBS(COMPILER_GCC && !CONFIG_STATIC) QtCore4
+
+ LIBS(TARGET_WIN) imm32.lib
+ LIBS(TARGET_WIN) winmm.lib
+ LIBS(TARGET_WIN) ws2_32.lib
+
+ LIBINCLUDE "$(QTDIR)/lib"
+ =20
+ SOURCE main.cpp
+ SOURCE dmxconsole.cpp
+
+ HEADER dmxconsole.h
+}
Added: trunk/DvdMenuXtractor/dmxconsole/main.cpp
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/DvdMenuXtractor/dmxconsole/main.cpp 2007-03-10 21:15:45 UTC (re=
v 1282)
+++ trunk/DvdMenuXtractor/dmxconsole/main.cpp 2007-03-10 21:17:10 UTC (re=
v 1283)
@@ -0,0 +1,9 @@
+#include "dmxconsole.h"
+
+int main(int argc, char *argv[])
+{=09
+ DMXConsole console(argv, argc);
+ console.extract();
+
+ return 0;
+}