diff --git a/src/mmg/mmg.cpp b/src/mmg/mmg.cpp index 39dd751e9..9e966031e 100644 --- a/src/mmg/mmg.cpp +++ b/src/mmg/mmg.cpp @@ -131,6 +131,8 @@ mmg_dialog::mmg_dialog(): wxFrame(NULL, -1, "mkvmerge GUI v" VERSION, wxSize(520, 718), #endif wxCAPTION | wxMINIMIZE_BOX | wxSYSTEM_MENU) { + mdlg = this; + file_menu = new wxMenu(); file_menu->Append(ID_M_FILE_LOAD, _T("&Load settings\tCtrl-L"), _T("Load muxing settings from a file")); @@ -220,31 +222,49 @@ mmg_dialog::mmg_dialog(): wxFrame(NULL, -1, "mkvmerge GUI v" VERSION, notebook->AddPage(settings_page, _("Settings")); notebook->AddPage(chapter_editor_page, _("Chapter Editor")); - bs_main->Add(notebook, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5); + bs_main->Add(notebook, 0, wxALIGN_CENTER_HORIZONTAL | wxLEFT | wxRIGHT, 5); wxStaticBox *sb_low = new wxStaticBox(panel, -1, _("Output filename")); wxStaticBoxSizer *sbs_low = new wxStaticBoxSizer(sb_low, wxHORIZONTAL); - bs_main->Add(sbs_low, 0, wxALIGN_CENTER_HORIZONTAL | wxALL, 5); + bs_main->Add(sbs_low, 0, wxALIGN_CENTER_HORIZONTAL | wxLEFT | wxRIGHT, 5); tc_output = new wxTextCtrl(panel, ID_TC_OUTPUT, _(""), wxDefaultPosition, wxSize(400, -1), 0); - sbs_low->Add(tc_output, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5); + sbs_low->Add(tc_output, 0, wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT, 5); b_browse_output = new wxButton(panel, ID_B_BROWSEOUTPUT, _("Browse"), wxDefaultPosition, wxDefaultSize, 0); - sbs_low->Add(b_browse_output, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5); + sbs_low->Add(b_browse_output, 0, wxALIGN_CENTER_VERTICAL | wxALL, 3); - wxStaticBox *sb_low2 = new wxStaticBox(panel, -1, _("Command line")); - wxStaticBoxSizer *sbs_low2 = new wxStaticBoxSizer(sb_low2, wxHORIZONTAL); - bs_main->Add(sbs_low2, 0, wxALIGN_CENTER_HORIZONTAL | wxALL, 5); + sb_commandline = + new wxStaticBox(panel, -1, _("Command line")); + wxStaticBoxSizer *sbs_low2 = + new wxStaticBoxSizer(sb_commandline, wxHORIZONTAL); + bs_main->Add(sbs_low2, 0, wxALIGN_CENTER_HORIZONTAL | wxLEFT | wxRIGHT, 5); tc_cmdline = new wxTextCtrl(panel, ID_TC_CMDLINE, _(""), wxDefaultPosition, wxSize(490, 50), wxTE_READONLY | wxTE_LINEWRAP | wxTE_MULTILINE); - sbs_low2->Add(tc_cmdline, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5); + sbs_low2->Add(tc_cmdline, 0, wxALIGN_CENTER_VERTICAL | wxALL, 3); + + wxBoxSizer *bs_buttons = new wxBoxSizer(wxHORIZONTAL); + + b_start_muxing = + new wxButton(panel, ID_B_STARTMUXING, _("Sta&rt muxing"), + wxDefaultPosition, wxSize(130, -1)); + bs_buttons->Add(b_start_muxing, 0, wxALIGN_CENTER_HORIZONTAL | wxALL, 8); + + b_copy_to_clipboard = + new wxButton(panel, ID_B_COPYTOCLIPBOARD, _("&Copy to clipboard"), + wxDefaultPosition, wxSize(130, -1)); + bs_buttons->Add(10, 0); + bs_buttons->Add(b_copy_to_clipboard, 0, wxALIGN_CENTER_HORIZONTAL | wxALL, + 8); + + bs_main->Add(bs_buttons, 0, wxALIGN_CENTER_HORIZONTAL); last_open_dir = ""; cmdline = "\"" + mkvmerge_path + "\" -o \"" + tc_output->GetValue() + "\" "; @@ -661,6 +681,10 @@ void mmg_dialog::update_command_line() { cmdline += "--no-attachments "; clargs.Add("--no-attachments"); } + if (f->no_tags) { + cmdline += "--no-tags "; + clargs.Add("--no-tags"); + } if (no_video) { cmdline += "-D "; clargs.Add("-D"); @@ -790,9 +814,19 @@ void mmg_dialog::update_command_line() { clargs.Add("--no-clusters-in-meta-seek"); } - if (global_page->cb_enable_lacing->IsChecked()) { - cmdline += "--enable-lacing "; - clargs.Add("--enable-lacing"); + if (global_page->cb_disable_lacing->IsChecked()) { + cmdline += "--disable-lacing "; + clargs.Add("--disable-lacing"); + } + + if (global_page->cb_enable_durations->IsChecked()) { + cmdline += "--enable-durations "; + clargs.Add("--enable-durations"); + } + + if (global_page->cb_enable_timeslices->IsChecked()) { + cmdline += "--enable-timeslices "; + clargs.Add("--enable-timeslices"); } if (old_cmdline != cmdline) @@ -896,6 +930,8 @@ void mmg_dialog::on_window_selected(wxCommandEvent &evt) { IMPLEMENT_CLASS(mmg_dialog, wxFrame); BEGIN_EVENT_TABLE(mmg_dialog, wxFrame) EVT_BUTTON(ID_B_BROWSEOUTPUT, mmg_dialog::on_browse_output) + EVT_BUTTON(ID_B_STARTMUXING, mmg_dialog::on_run) + EVT_BUTTON(ID_B_COPYTOCLIPBOARD, mmg_dialog::on_copy_to_clipboard) EVT_TIMER(ID_T_UPDATECMDLINE, mmg_dialog::on_update_command_line) EVT_TIMER(ID_T_STATUSBAR, mmg_dialog::on_clear_status_bar) EVT_MENU(ID_M_FILE_EXIT, mmg_dialog::on_quit) diff --git a/src/mmg/mmg.h b/src/mmg/mmg.h index 07886ccaa..123e6f827 100644 --- a/src/mmg/mmg.h +++ b/src/mmg/mmg.h @@ -98,7 +98,7 @@ using namespace libmatroska; #define ID_TC_SEGMENTTITLE 10051 #define ID_CB_NOCUES 10052 #define ID_CB_NOCLUSTERSINMETASEEK 10053 -#define ID_CB_ENABLELACING 10054 +#define ID_CB_DISABLELACING 10054 #define ID_B_MUX_OK 10055 #define ID_B_MUX_SAVELOG 10056 #define ID_B_MUX_ABORT 10057 @@ -117,6 +117,11 @@ using namespace libmatroska; #define ID_CB_CHAPTERSELECTCOUNTRYCODE 10070 #define ID_B_ADDSUBCHAPTER 10071 #define ID_CB_NOATTACHMENTS 10072 +#define ID_CB_NOTAGS 10073 +#define ID_B_STARTMUXING 10074 +#define ID_B_COPYTOCLIPBOARD 10075 +#define ID_CB_ENABLEDURATIONS 10076 +#define ID_CB_ENABLETIMESLICES 10077 #define ID_M_FILE_LOAD 20000 #define ID_M_FILE_SAVE 20001 @@ -164,8 +169,9 @@ typedef struct { typedef struct { wxString *file_name; + int container; vector *tracks; - bool no_chapters, no_attachments; + bool no_chapters, no_attachments, no_tags; } mmg_file_t; typedef struct { @@ -192,7 +198,8 @@ class tab_input: public wxPanel { protected: wxListBox *lb_input_files; wxButton *b_add_file, *b_remove_file, *b_browse_tags; - wxCheckBox *cb_no_chapters, *cb_no_attachments, *cb_default, *cb_aac_is_sbr; + wxCheckBox *cb_no_chapters, *cb_no_attachments, *cb_no_tags; + wxCheckBox *cb_default, *cb_aac_is_sbr; wxCheckListBox *clb_tracks; wxComboBox *cob_language, *cob_cues, *cob_sub_charset; wxComboBox *cob_aspect_ratio, *cob_fourcc; @@ -212,6 +219,7 @@ public: void on_track_enabled(wxCommandEvent &evt); void on_nochapters_clicked(wxCommandEvent &evt); void on_noattachments_clicked(wxCommandEvent &evt); + void on_notags_clicked(wxCommandEvent &evt); void on_default_track_clicked(wxCommandEvent &evt); void on_aac_is_sbr_clicked(wxCommandEvent &evt); void on_language_selected(wxCommandEvent &evt); @@ -270,6 +278,7 @@ class tab_settings: public wxPanel { DECLARE_EVENT_TABLE(); protected: wxTextCtrl *tc_mkvmerge; + wxCheckBox *cb_show_commandline; public: tab_settings(wxWindow *parent); @@ -296,7 +305,8 @@ public: wxRadioButton *rb_split_by_size, *rb_split_by_time; wxComboBox *cob_split_by_size, *cob_split_by_time; wxComboBox *cob_chap_language, *cob_chap_charset; - wxCheckBox *cb_no_cues, *cb_no_clusters, *cb_enable_lacing; + wxCheckBox *cb_no_cues, *cb_no_clusters, *cb_disable_lacing; + wxCheckBox *cb_enable_durations, *cb_enable_timeslices; public: tab_global(wxWindow *parent); @@ -401,6 +411,7 @@ class mmg_dialog: public wxFrame { DECLARE_EVENT_TABLE(); protected: wxButton *b_browse_output; + wxStaticBox *sb_commandline; wxTextCtrl *tc_output, *tc_cmdline; wxString cmdline; @@ -421,6 +432,8 @@ protected: tab_settings *settings_page; tab_chapters *chapter_editor_page; + wxButton *b_start_muxing, *b_copy_to_clipboard; + public: mmg_dialog(); diff --git a/src/mmg/tab_global.cpp b/src/mmg/tab_global.cpp index 384f0fd49..05641fcc1 100644 --- a/src/mmg/tab_global.cpp +++ b/src/mmg/tab_global.cpp @@ -208,26 +208,41 @@ tab_global::tab_global(wxWindow *parent): "on the 'input' tab.")); new wxStaticBox(this, -1, _("Advanced options (DO NOT CHANGE!)"), - wxPoint(10, 415), wxSize(475, 50)); + wxPoint(10, 390), wxSize(475, 70)); cb_no_cues = - new wxCheckBox(this, ID_CB_NOCUES, _("No cues"), wxPoint(15, 435), + new wxCheckBox(this, ID_CB_NOCUES, _("No cues"), wxPoint(15, 405), wxDefaultSize, 0); cb_no_cues->SetToolTip(_T("Do not write the cues (the index). DO NOT " "ENABLE this option unless you REALLY know " "what you're doing!")); cb_no_clusters = new wxCheckBox(this, ID_CB_NOCLUSTERSINMETASEEK, - _("No clusters in meta seek"), wxPoint(110, 435), + _("No clusters in meta seek"), wxPoint(145, 405), wxDefaultSize, 0); cb_no_clusters->SetToolTip(_T("Do not put all the clusters into the cues " "(the index). DO NOT ENABLE this option " "unless you REALLY know what you're doing!")); - cb_enable_lacing = - new wxCheckBox(this, ID_CB_ENABLELACING, _("Enable lacing"), - wxPoint(300, 435), wxDefaultSize, 0); - cb_enable_lacing->SetToolTip(_T("Enable lacing for audio tracks. DO NOT " - "ENABLE this option unless you REALLY know " - "what you're doing!")); + cb_disable_lacing = + new wxCheckBox(this, ID_CB_DISABLELACING, _("Disable lacing"), + wxPoint(325, 405), wxDefaultSize, 0); + cb_disable_lacing->SetToolTip(_T("Disable lacing for audio tracks. DO NOT " + "ENSABLE this option unless you REALLY " + "know what you're doing!")); + cb_enable_durations = + new wxCheckBox(this, ID_CB_ENABLEDURATIONS, _("Enable durations"), + wxPoint(15, 430), wxDefaultSize, 0); + cb_enable_durations->SetToolTip(_T("Enable durations for all blocks and not " + "only for blocks that definitely need " + "them (subtitles). DO NOT " + "ENABLE this option unless you REALLY " + "know what you're doing!")); + cb_enable_timeslices = + new wxCheckBox(this, ID_CB_ENABLETIMESLICES, _("Enable timeslices"), + wxPoint(145, 430), wxDefaultSize, 0); + cb_enable_durations->SetToolTip(_T("Enable timeslices for laced blocks. " + "DO NOT " + "ENSABLE this option unless you REALLY " + "know what you're doing!")); } void tab_global::on_browse_global_tags(wxCommandEvent &evt) { @@ -320,8 +335,12 @@ void tab_global::load(wxConfigBase *cfg) { cb_no_cues->SetValue(b); cfg->Read("no_clusters", &b); cb_no_clusters->SetValue(b); - cfg->Read("enable_lacing", &b); - cb_enable_lacing->SetValue(b); + cfg->Read("disable_lacing", &b); + cb_disable_lacing->SetValue(b); + cfg->Read("enable_durations", &b); + cb_enable_durations->SetValue(b); + cfg->Read("enable_timeslices", &b); + cb_enable_timeslices->SetValue(b); } void tab_global::save(wxConfigBase *cfg) { @@ -346,7 +365,9 @@ void tab_global::save(wxConfigBase *cfg) { cfg->Write("no_cues", cb_no_cues->IsChecked()); cfg->Write("no_clusters", cb_no_clusters->IsChecked()); - cfg->Write("enable_lacing", cb_enable_lacing->IsChecked()); + cfg->Write("disable_lacing", cb_disable_lacing->IsChecked()); + cfg->Write("enable_durations", cb_enable_durations->IsChecked()); + cfg->Write("enable_timeslices", cb_enable_timeslices->IsChecked()); } bool tab_global::validate_settings() { diff --git a/src/mmg/tab_input.cpp b/src/mmg/tab_input.cpp index f39e6261c..b81d7822f 100644 --- a/src/mmg/tab_input.cpp +++ b/src/mmg/tab_input.cpp @@ -73,6 +73,14 @@ tab_input::tab_input(wxWindow *parent): cb_no_attachments->SetToolTip(_("Do not copy attachments from this file. " "Only applies to Matroska files.")); cb_no_attachments->Enable(false); + cb_no_tags = + new wxCheckBox(this, ID_CB_NOTAGS, _("No tags"), wxPoint(230, 110), + wxDefaultSize, 0); + cb_no_tags->SetValue(false); + cb_no_tags->SetToolTip(_("Do not copy tags from this file. Only " + "applies to Matroska files.")); + cb_no_tags->Enable(false); + new wxStaticText(this, wxID_STATIC, _("Tracks:"), wxPoint(5, 140), wxDefaultSize, 0); clb_tracks = @@ -379,6 +387,39 @@ void tab_input::on_add_file(wxCommandEvent &evt) { track.fourcc = new wxString(""); file.tracks->push_back(track); + + } else if (output[i].Find("container:") > 0) { + wxString container; + + container = output[i].AfterLast(' '); + if (container == "AAC") + file.container = TYPEAAC; + else if (container == "AC3") + file.container = TYPEAC3; + else if (container == "AVI") + file.container = TYPEAVI; + else if (container == "DTS") + file.container = TYPEDTS; + else if (container == "Matroska") + file.container = TYPEMATROSKA; + else if (container == "MP2/MP3") + file.container = TYPEMP3; + else if (container == "Ogg/OGM") + file.container = TYPEOGM; + else if (container == "Quicktime/MP4") + file.container = TYPEQTMP4; + else if (container == "RealMedia") + file.container = TYPEREAL; + else if (container == "SRT") + file.container = TYPESRT; + else if (container == "SSA/ASS") + file.container = TYPESSA; + else if (container == "VobSub") + file.container = TYPEVOBSUB; + else if (container == "WAV") + file.container = TYPEWAV; + else + file.container = TYPEUNKNOWN; } } @@ -432,6 +473,7 @@ void tab_input::on_remove_file(wxCommandEvent &evt) { selected_file = -1; cb_no_chapters->Enable(false); cb_no_attachments->Enable(false); + cb_no_tags->Enable(false); b_remove_file->Enable(false); clb_tracks->Enable(false); no_track_mode(); @@ -445,13 +487,24 @@ void tab_input::on_file_selected(wxCommandEvent &evt) { wxString label; b_remove_file->Enable(true); - cb_no_chapters->Enable(true); - cb_no_attachments->Enable(true); selected_file = -1; new_sel = lb_input_files->GetSelection(); f = &files[new_sel]; - cb_no_chapters->SetValue(f->no_chapters); - cb_no_attachments->SetValue(f->no_attachments); + if (f->container == TYPEMATROSKA) { + cb_no_chapters->Enable(true); + cb_no_attachments->Enable(true); + cb_no_tags->Enable(true); + cb_no_chapters->SetValue(f->no_chapters); + cb_no_attachments->SetValue(f->no_attachments); + cb_no_tags->SetValue(f->no_tags); + } else { + cb_no_chapters->Enable(false); + cb_no_attachments->Enable(false); + cb_no_tags->Enable(false); + cb_no_chapters->SetValue(false); + cb_no_attachments->SetValue(false); + cb_no_tags->SetValue(false); + } clb_tracks->Clear(); for (i = 0; i < f->tracks->size(); i++) { @@ -474,15 +527,20 @@ void tab_input::on_file_selected(wxCommandEvent &evt) { } void tab_input::on_nochapters_clicked(wxCommandEvent &evt) { - if (selected_file -1) + if (selected_file != -1) files[selected_file].no_chapters = cb_no_chapters->GetValue(); } void tab_input::on_noattachments_clicked(wxCommandEvent &evt) { - if (selected_file -1) + if (selected_file != -1) files[selected_file].no_attachments = cb_no_attachments->GetValue(); } +void tab_input::on_notags_clicked(wxCommandEvent &evt) { + if (selected_file != -1) + files[selected_file].no_tags = cb_no_tags->GetValue(); +} + void tab_input::on_track_selected(wxCommandEvent &evt) { mmg_file_t *f; mmg_track_t *t; @@ -646,8 +704,10 @@ void tab_input::save(wxConfigBase *cfg) { s.Printf("file %u", fidx); cfg->SetPath(s); cfg->Write("file_name", *f->file_name); + cfg->Write("container", f->container); cfg->Write("no_chapters", f->no_chapters); cfg->Write("no_attachments", f->no_attachments); + cfg->Write("no_tags", f->no_tags); cfg->Write("number_of_tracks", (int)f->tracks->size()); for (tidx = 0; tidx < f->tracks->size(); tidx++) { @@ -734,8 +794,10 @@ void tab_input::load(wxConfigBase *cfg) { continue; } fi.file_name = new wxString(s); + cfg->Read("container", &fi.container); cfg->Read("no_chapters", &fi.no_chapters); cfg->Read("no_attachments", &fi.no_attachments); + cfg->Read("no_tags", &fi.no_tags); fi.tracks = new vector; for (tidx = 0; tidx < (uint32_t)num_tracks; tidx++) { @@ -924,6 +986,7 @@ BEGIN_EVENT_TABLE(tab_input, wxPanel) EVT_CHECKBOX(ID_CB_NOCHAPTERS, tab_input::on_nochapters_clicked) EVT_CHECKBOX(ID_CB_NOATTACHMENTS, tab_input::on_noattachments_clicked) + EVT_CHECKBOX(ID_CB_NOTAGS, tab_input::on_notags_clicked) EVT_CHECKBOX(ID_CB_MAKEDEFAULT, tab_input::on_default_track_clicked) EVT_CHECKBOX(ID_CB_AACISSBR, tab_input::on_aac_is_sbr_clicked)