[matroska] r989 - trunk/DvdMenuXtractor
[email protected] Wed, 29 Dec 2004 19:11:02 +0300 (MSK)
Newsgroups
gmane.comp.multimedia.matroska.cvs
Message-ID
<[email protected] >
Author: robux4
Date: 2004-12-29 19:11:02 +0300 (Wed, 29 Dec 2004)
New Revision: 989
Modified:
trunk/DvdMenuXtractor/DvdMenuXtractor.cpp
Log:
DMX: store the mkvtoolnix location to generate the proper command-line
Modified: trunk/DvdMenuXtractor/DvdMenuXtractor.cpp
===================================================================
--- trunk/DvdMenuXtractor/DvdMenuXtractor.cpp 2004-12-28 18:08:28 UTC (rev 988)
+++ trunk/DvdMenuXtractor/DvdMenuXtractor.cpp 2004-12-29 16:11:02 UTC (rev 989)
@@ -48,6 +48,12 @@
// ----------------------------------------------------------------------------
+const char OutputDirSaved[] = "OutputDirectory";
+const char InputDirSaved[] = "InputDirectory";
+const char MtxDirSaved[] = "MtxDirectory";
+
+// ----------------------------------------------------------------------------
+
extern "C" void myfprintf(FILE * f, const char * format, ...)
{
va_list va;
@@ -65,8 +71,9 @@
IFOFile* IfoFile = NULL;
wxLogWindow* wxLogWin;
wxString outputDirectory;
+wxString mtxDirectory;
const wxString APPLICATION_NAME = "DVDMenuXtractor: DMX - a fair-use tool";
-const wxString APPLICATION_VERSION = "0.6.0";
+const wxString APPLICATION_VERSION = "0.6.1";
// ----------------------------------------------------------------------------
@@ -79,10 +86,11 @@
// ids for button
enum
{
- wxID_P1_BROWSE_IN_DIR = 100,
- wxID_P1_BROWSE_OUT_DIR,
-
- wxID_P2_CELL_LIST
+ wxID_P1_BROWSE_IN_DIR = 100,
+ wxID_P1_BROWSE_OUT_DIR,
+ wxID_P1_BROWSE_MTX_DIR,
+
+ wxID_P2_CELL_LIST
};
class wxMyWizardPage1 : public wxMyWizardPageSimple
@@ -104,7 +112,7 @@
m_lbInDir = new wxStaticText(this,-1,"Input directory :",
wxDefaultPosition,wxDefaultSize, DEFAULT_COMMON_STYLE);
m_edInDir = new wxTextCtrl(this,-1,
- pConfig->Read("InDirectory",""), wxDefaultPosition,
+ pConfig->Read(InputDirSaved,""), wxDefaultPosition,
wxDefaultSize, DEFAULT_COMMON_STYLE);
m_bttBrowseInDir = new wxButton(this, wxID_P1_BROWSE_IN_DIR, "...",
wxDefaultPosition, wxSize(24,24),DEFAULT_COMMON_STYLE);
@@ -116,15 +124,26 @@
m_lbOutDir = new wxStaticText(this,-1,"Output directory :",
wxDefaultPosition,wxDefaultSize, DEFAULT_COMMON_STYLE);
m_edOutDir = new wxTextCtrl(this,-1,
- pConfig->Read("OutputDirectory",""), wxDefaultPosition,
+ pConfig->Read(OutputDirSaved,""), wxDefaultPosition,
wxDefaultSize, DEFAULT_COMMON_STYLE);
m_bttBrowseOutDir = new wxButton(this, wxID_P1_BROWSE_OUT_DIR, "...",
wxDefaultPosition, wxSize(24,24),DEFAULT_COMMON_STYLE);
-
fgs->Add(m_lbOutDir,0,wxALL|wxALIGN_CENTRE_VERTICAL,5);
fgs->Add(m_edOutDir,0,wxALL|wxEXPAND,5);
fgs->Add(m_bttBrowseOutDir,0,wxALL,5);
+ // Mtx directory
+ m_lbMtxDir = new wxStaticText(this,-1,"Mkvmerge directory :",
+ wxDefaultPosition,wxDefaultSize, DEFAULT_COMMON_STYLE);
+ m_edMtxDir = new wxTextCtrl(this,-1,
+ pConfig->Read(MtxDirSaved,""), wxDefaultPosition,
+ wxDefaultSize, DEFAULT_COMMON_STYLE);
+ m_bttBrowseMtxDir = new wxButton(this, wxID_P1_BROWSE_MTX_DIR, "...",
+ wxDefaultPosition, wxSize(24,24),DEFAULT_COMMON_STYLE);
+ fgs->Add(m_lbMtxDir,0,wxALL|wxALIGN_CENTRE_VERTICAL,5);
+ fgs->Add(m_edMtxDir,0,wxALL|wxEXPAND,5);
+ fgs->Add(m_bttBrowseMtxDir,0,wxALL,5);
+
this->SetAutoLayout(TRUE);
this->SetSizer(fgs);
fgs->Fit(this);
@@ -180,6 +199,29 @@
}
}
+ void OnBrowseMtxDirectory(wxCommandEvent& WXUNUSED(event))
+ {
+ wxString defaultDir = m_edOutDir->GetValue();
+ if (defaultDir.IsEmpty())
+ {
+ defaultDir = m_edInDir->GetValue();
+ }
+ wxDirDialog dialog(this, "Select the mkvmerge directory :", defaultDir,
+ wxDD_NEW_DIR_BUTTON);
+ if (dialog.ShowModal() == wxID_OK)
+ {
+ if(wxEndsWithPathSeparator(dialog.GetPath()))
+ {
+ m_edMtxDir->SetValue(dialog.GetPath());
+ }
+ else
+ {
+ m_edMtxDir->SetValue(dialog.GetPath()+wxFILE_SEP_PATH);
+ }
+ pageHasChanged = TRUE;
+ }
+ }
+
virtual bool PageChanging(bool goingForward)
{
// Disable check for easier dev
@@ -249,16 +291,20 @@
wxFileConfig *pConfig = (wxFileConfig *)wxConfigBase::Get();
pConfig->SetPath("/Input");
- pConfig->Write("InDirectory", m_edInDir->GetValue());
- pConfig->Write("OutputDirectory",m_edOutDir->GetValue());
+ pConfig->Write(InputDirSaved, m_edInDir->GetValue());
+ pConfig->Write(OutputDirSaved, m_edOutDir->GetValue());
+ pConfig->Write(MtxDirSaved, m_edMtxDir->GetValue());
}
private:
wxStaticText* m_lbInDir;
wxStaticText* m_lbOutDir;
+ wxStaticText* m_lbMtxDir;
wxButton* m_bttBrowseInDir;
wxButton* m_bttBrowseOutDir;
+ wxButton* m_bttBrowseMtxDir;
wxTextCtrl* m_edInDir;
wxTextCtrl* m_edOutDir;
+ wxTextCtrl* m_edMtxDir;
DECLARE_EVENT_TABLE()
};
@@ -266,6 +312,7 @@
BEGIN_EVENT_TABLE(wxMyWizardPage1, wxMyWizardPageSimple)
EVT_BUTTON(wxID_P1_BROWSE_IN_DIR, wxMyWizardPage1::OnBrowseInputDirectory)
EVT_BUTTON(wxID_P1_BROWSE_OUT_DIR, wxMyWizardPage1::OnBrowseOutputDirectory)
+EVT_BUTTON(wxID_P1_BROWSE_MTX_DIR, wxMyWizardPage1::OnBrowseMtxDirectory)
END_EVENT_TABLE()
// ----------------------------------------------------------------------------
@@ -523,10 +570,10 @@
VobParser * _VobParser = NULL;
try {
- _VobParser = new VobParser(pConfig->Read("InDirectory","").c_str(), title, language);
+ _VobParser = new VobParser(pConfig->Read(InputDirSaved,"").c_str(), title, language);
} catch (...)
{
- m_txtDemuxLog->AppendText(wxString::Format("no VOB files found in %s for Title %02d\n",pConfig->Read("InDirectory","").c_str(),title));
+ m_txtDemuxLog->AppendText(wxString::Format("no VOB files found in %s for Title %02d\n",pConfig->Read(InputDirSaved,"").c_str(),title));
}
return _VobParser;
}
@@ -577,7 +624,11 @@
wxString ShellString = "#!/bin/sh\n\n";
MtxCommandFile.Write(ShellString.c_str(), ShellString.Length());
#endif
- wxString MtxCommandString = "mkvmerge -o " + outputDirectory+newFilename + ".mkv --command-line-charset UTF-8 ";
+#if defined(WIN32)
+ wxString MtxCommandString = "\"" + mtxDirectory + "\"mkvmerge -o " + outputDirectory+newFilename + ".mkv ";
+#else
+ wxString MtxCommandString = mtxDirectory + "mkvmerge -o " + outputDirectory+newFilename + ".mkv ";
+#endif
MtxCommandString += "--track-name 0:\"video\" --timecodes 0:" + outputDirectory+newFilename + "_m2v.tmc " + outputDirectory+newFilename + ".m2v";
Demuxer * _muxer = new VideoDemuxWriter(outputDirectory + newFilename, _fps);
@@ -1172,7 +1223,7 @@
wxString line, editionUID = CreateUID();
wxFileConfig *pConfig = (wxFileConfig *)wxConfigBase::Get();
// Get sub directory
- wxString Filename = pConfig->Read("OutputDirectory","") + "VMG_menu.xml";
+ wxString Filename = pConfig->Read(OutputDirSaved,"") + "VMG_menu.xml";
wxTextFile XmlFile(Filename);
XmlFile.Create();
XmlFile.AddLine("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>");
@@ -1245,7 +1296,7 @@
// VTS Menu
if (IfoFile->LanguageUnits(title) && IfoFile->LanguageUnits(title)->nr_of_lus)
{
- wxString Filename = pConfig->Read("OutputDirectory","") + wxString::Format("VTSM%02d_menu.xml", title);
+ wxString Filename = pConfig->Read(OutputDirSaved,"") + wxString::Format("VTSM%02d_menu.xml", title);
wxTextFile XmlFile(Filename);
XmlFile.Create();
XmlFile.AddLine("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>");
@@ -1284,7 +1335,7 @@
timecode_startA = timecode_endA;
// VTS content
- wxString Filename = pConfig->Read("OutputDirectory","") + wxString::Format("VTS%02d_menu.xml", title);
+ wxString Filename = pConfig->Read(OutputDirSaved,"") + wxString::Format("VTS%02d_menu.xml", title);
wxTextFile XmlFile(Filename);
XmlFile.Create();
XmlFile.AddLine("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>");
@@ -1363,7 +1414,8 @@
m_txtDemuxLog->AppendText("Creating output directories\n");
- outputDirectory = wxConfigBase::Get()->Read("OutputDirectory","");
+ outputDirectory = wxConfigBase::Get()->Read(OutputDirSaved,"");
+ mtxDirectory = wxConfigBase::Get()->Read(MtxDirSaved,"");
bool language = true;
for (int16_t title = 0; title <= IfoFile->NumberOfTitles(); title++)