Merge lp:~e7appew/ubuntu/vivid/bombono-dvd/mux-files-with-spaces into lp:ubuntu/vivid/bombono-dvd

Proposed by Carlos Maddela
Status: Work in progress
Proposed branch: lp:~e7appew/ubuntu/vivid/bombono-dvd/mux-files-with-spaces
Merge into: lp:ubuntu/vivid/bombono-dvd
Diff against target: 345 lines (+293/-2)
6 files modified
.pc/0002-Allow-muxing-of-files-with-spaces.patch/src/mgui/mux.cpp (+242/-0)
.pc/applied-patches (+1/-0)
debian/changelog (+7/-0)
debian/patches/0002-Allow-muxing-of-files-with-spaces.patch (+40/-0)
debian/patches/series (+1/-0)
src/mgui/mux.cpp (+2/-2)
To merge this branch: bzr merge lp:~e7appew/ubuntu/vivid/bombono-dvd/mux-files-with-spaces
Reviewer Review Type Date Requested Status
Ubuntu branches Pending
Review via email: mp+267939@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Sebastien Bacher (seb128) wrote :

Thanks, could you maybe send your patch upstream for review as well?

Revision history for this message
Iain Lane (laney) wrote :

Would you please reset the "Status" of this merge proposal to "Needs review" (and, ideally but optionally update the reference in the patch header) once you've forwarded upstream as per the previous request?

Thanks for your contribution. :)

Revision history for this message
Carlos Maddela (e7appew) wrote :

I've been having trouble trying to file the bug upstream. The links to
the bug tracking system are no longer valid, and neither is its VCS. I
have sent the bug report and patch to Ilya Murav'jov by sourceforge
message for now. I don't know how to update the patch header without the
required URLs. I'll probably just remove the Forwarded
line.<https://sourceforge.net/u/muravjov/>

On 07/12/15 23:00, Iain Lane wrote:
> Would you please reset the "Status" of this merge proposal to "Needs review" (and, ideally but optionally update the reference in the patch header) once you've forwarded upstream as per the previous request?
>
> Thanks for your contribution. :)

Unmerged revisions

24. By Carlos Maddela

Updated changelog.

23. By Carlos Maddela

Allow muxing of files whose name or path contains spaces

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added directory '.pc/0002-Allow-muxing-of-files-with-spaces.patch'
2=== added directory '.pc/0002-Allow-muxing-of-files-with-spaces.patch/src'
3=== added directory '.pc/0002-Allow-muxing-of-files-with-spaces.patch/src/mgui'
4=== added file '.pc/0002-Allow-muxing-of-files-with-spaces.patch/src/mgui/mux.cpp'
5--- .pc/0002-Allow-muxing-of-files-with-spaces.patch/src/mgui/mux.cpp 1970-01-01 00:00:00 +0000
6+++ .pc/0002-Allow-muxing-of-files-with-spaces.patch/src/mgui/mux.cpp 2015-08-13 11:13:06 +0000
7@@ -0,0 +1,242 @@
8+//
9+// mgui/mux.cpp
10+// This file is part of Bombono DVD project.
11+//
12+// Copyright (c) 2010 Ilya Murav'jov
13+//
14+// This program is free software; you can redistribute it and/or modify
15+// it under the terms of the GNU General Public License as published by
16+// the Free Software Foundation; either version 2 of the License, or
17+// (at your option) any later version.
18+//
19+// This program is distributed in the hope that it will be useful,
20+// but WITHOUT ANY WARRANTY; without even the implied warranty of
21+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22+// GNU General Public License for more details.
23+//
24+// You should have received a copy of the GNU General Public License
25+// along with this program; if not, write to the Free Software
26+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
27+//
28+
29+#include <mgui/_pc_.h>
30+
31+#include "mux.h"
32+#include "execution.h" // ExecuteAsync()
33+
34+#include <mgui/sdk/textview.h>
35+#include <mgui/sdk/packing.h>
36+#include <mgui/sdk/widget.h>
37+
38+#include <mgui/execution.h>
39+#include <mgui/gettext.h>
40+#include <mgui/dialog.h>
41+
42+#include <mlib/filesystem.h>
43+
44+#include <gtk/gtkwindow.h> // gtk_window_set_geometry_hints()
45+
46+static void OnNewText(Gtk::TextView& txt_view, const char* dat, int sz, bool is_out,
47+ const ReadReadyFnr& add_fnr, const std::string& prefix)
48+{
49+ AppendNewText(txt_view, prefix + std::string(dat, sz), is_out);
50+ if( add_fnr )
51+ add_fnr(dat, sz, is_out);
52+}
53+
54+ReadReadyFnr TextViewAppender(Gtk::TextView& txt_view, const ReadReadyFnr& add_fnr,
55+ const std::string& prefix)
56+{
57+ return bb::bind(&OnNewText, boost::ref(txt_view), _1, _2, _3, add_fnr, prefix);
58+}
59+
60+static void OnResponse(Execution::Data& edat, int resp)
61+{
62+ if( resp == Gtk::RESPONSE_CANCEL)
63+ {
64+ // повтороне нажатие - закрытие диалога
65+ if( !edat.userAbort )
66+ edat.StopExecution(_("muxing"));
67+ }
68+}
69+
70+void SetDialogStrict(Gtk::Dialog& dlg, int min_wdh, int min_hgt, bool set_resizable)
71+{
72+ dlg.set_resizable(set_resizable); // чтоб при закрытии экспандера диалог уменьшался
73+ // размер окна пошире
74+ GdkGeometry geom;
75+ geom.min_width = min_wdh;
76+ geom.min_height = min_hgt;
77+ gtk_window_set_geometry_hints(static_cast<Gtk::Window&>(dlg).gobj(), 0, &geom, GDK_HINT_MIN_SIZE);
78+}
79+
80+static bool RunMuxing(const std::string& dest_path, const std::string& args)
81+{
82+ Gtk::Dialog dlg(BF_("Muxing \"%1%\"") % fs::name_str(dest_path) % bf::stop);
83+ SetDialogStrict(dlg, 400, -1);
84+
85+ Gtk::TextView& txt_view = NewManaged<Gtk::TextView>();
86+ Execution::Data edat;
87+ Gtk::ProgressBar& prg_bar = NewManaged<Gtk::ProgressBar>();
88+
89+ {
90+ Gtk::VBox& box = *dlg.get_vbox();
91+ PackStart(box, prg_bar);
92+
93+ Gtk::Expander& expdr = PackStart(box, NewManaged<Gtk::Expander>(_("Show/_hide Details"), true));
94+ txt_view.set_editable(false);
95+ txt_view.set_size_request(0, 200);
96+ expdr.add(PackDetails(txt_view));
97+
98+ dlg.get_action_area()->set_layout(Gtk::BUTTONBOX_CENTER);
99+ dlg.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
100+ dlg.signal_response().connect(bb::bind(&OnResponse, boost::ref(edat), _1));
101+
102+ dlg.show_all();
103+ }
104+
105+ //dlg.run();
106+ ExitData ed;
107+ {
108+ Execution::Pulse pls(prg_bar);
109+ std::string cmd = boost::format("mplex -f 8 -o %1% %2%") % dest_path % args % bf::stop;
110+ AppendCommandText(txt_view, cmd);
111+ ed = ExecuteAsync(0, cmd.c_str(), TextViewAppender(txt_view), &edat.pid);
112+ }
113+
114+ if( !ed.IsGood() && !edat.userAbort )
115+ {
116+ MessageBox(_("Muxing error"), Gtk::MESSAGE_ERROR, Gtk::BUTTONS_OK,
117+ BF_("The reason is \"%1%\" (see Details)") % ExitDescription(ed) % bf::stop);
118+ dlg.run();
119+ }
120+ return ed.IsGood();
121+}
122+
123+struct SaveChooser: public Gtk::Table
124+{
125+ Gtk::Entry& ent;
126+ Gtk::FileChooserButton& fcb;
127+
128+ SaveChooser(const char* type);
129+};
130+
131+SaveChooser::SaveChooser(const char* type):
132+ ent(NewManaged<Gtk::Entry>()),
133+ fcb(NewManaged<Gtk::FileChooserButton>(_("Select a folder"), Gtk::FILE_CHOOSER_ACTION_SELECT_FOLDER))
134+{
135+ // вариант с виджетом - слишком большой, хоть и более функциональный
136+ //Gtk::FileChooserWidget& fcw = NewManaged<Gtk::FileChooserWidget>(Gtk::FILE_CHOOSER_ACTION_SAVE);
137+ //Gtk::Frame& frm = PackStart(vbox, NewManagedFrame(Gtk::SHADOW_ETCHED_IN, " Output: "), Gtk::PACK_EXPAND_WIDGET);
138+ //Add(Add(frm, NewPaddingAlg(0, 5, 5, 5)), fcw);
139+
140+ set_col_spacings(5);
141+ Gtk::Label& o_lbl = NewManaged<Gtk::Label>(type);
142+ SetAlign(o_lbl, true);
143+ attach(o_lbl, 0, 1, 0, 1, Gtk::SHRINK|Gtk::FILL);
144+ attach(ent, 1, 2, 0, 1);
145+ Gtk::Label& i_lbl = NewManaged<Gtk::Label>(_("in"));
146+ SetAlign(i_lbl, false);
147+ attach(i_lbl, 0, 1, 1, 2, Gtk::SHRINK|Gtk::FILL);
148+ attach(fcb, 1, 2, 1, 2);
149+}
150+
151+fs::path GetFilename(Gtk::FileChooser& fc)
152+{
153+ // fs::path v3 не понимает ustring
154+ // однако в gtkmm >= будет возвращать std::string, и это не понадобится
155+ return fs::path(fc.get_filename().raw());
156+}
157+
158+std::string GetFilename(SaveChooser& sc)
159+{
160+ std::string fname = sc.ent.get_text();
161+ if( !fname.empty() )
162+ fname = (GetFilename(sc.fcb)/fname).string();
163+
164+ return fname;
165+}
166+
167+static void OnVideoSelected(Gtk::FileChooserButton& v_btn, Gtk::FileChooserButton& a_btn, SaveChooser& sc)
168+{
169+ fs::path pth = GetFilename(v_btn);
170+ if( pth.empty() )
171+ return;
172+ std::string folder = pth.branch_path().string();
173+
174+ if( a_btn.get_filename().empty() )
175+ a_btn.set_current_folder(folder);
176+
177+ if( GetFilename(sc).empty() )
178+ {
179+ sc.fcb.set_current_folder(folder);
180+ sc.ent.set_text(get_basename(pth) + ".mpg");
181+ }
182+}
183+
184+bool MuxStreams(std::string& dest_fname, const std::string& src_fname)
185+{
186+ Gtk::Dialog dlg(_("Mux streams"));
187+ SetDialogStrict(dlg, 400, -1);
188+ SaveChooser& sc = NewManaged<SaveChooser>(SMCLN_("Output"));
189+ Gtk::FileChooserButton& v_btn = NewManaged<Gtk::FileChooserButton>(_("Select elementary video"), Gtk::FILE_CHOOSER_ACTION_OPEN);
190+ Gtk::FileChooserButton& a_btn = NewManaged<Gtk::FileChooserButton>(_("Select audio"), Gtk::FILE_CHOOSER_ACTION_OPEN);
191+ {
192+ DialogVBox& vbox = AddHIGedVBox(dlg);
193+
194+ AppendWithLabel(vbox, v_btn, SMCLN_("Video"));
195+ {
196+ Gtk::FileFilter f;
197+ f.set_name(_("MPEG2 elementary video (m2v)"));
198+ f.add_pattern("*.m2v");
199+ v_btn.add_filter(f);
200+ }
201+
202+ AppendWithLabel(vbox, a_btn, SMCLN_("Audio"));
203+ {
204+ Gtk::FileFilter f;
205+ f.set_name(_("Audio for DVD") + std::string(" (mp2/mpa, ac3, dts or 16bit lpcm)"));
206+ FillSoundFilter(f);
207+ a_btn.add_filter(f);
208+ }
209+
210+ PackStart(vbox, sc);
211+
212+ CompleteDialog(dlg);
213+ }
214+
215+ v_btn.signal_selection_changed().connect(bb::bind(&OnVideoSelected, boost::ref(v_btn), boost::ref(a_btn), boost::ref(sc)));
216+ if( !src_fname.empty() )
217+ {
218+ if( get_extension(src_fname) == "m2v" )
219+ v_btn.set_filename(src_fname);
220+ else
221+ a_btn.set_filename(src_fname);
222+ }
223+
224+ bool res = false;
225+ for( ; res = Gtk::RESPONSE_OK == dlg.run(), res; )
226+ {
227+ dest_fname = GetFilename(sc);
228+
229+ if( v_btn.get_filename().empty() )
230+ ErrorBox(_("Elementary video file is not selected."));
231+ else if( a_btn.get_filename().empty() )
232+ ErrorBox(_("Audio file is not selected."));
233+ else if( dest_fname.empty() )
234+ ErrorBox(_("Output file name is empty."));
235+ else if( CheckKeepOrigin(dest_fname) )
236+ ;
237+ else
238+ break;
239+ }
240+
241+ if( res )
242+ {
243+ dlg.hide();
244+ res = RunMuxing(dest_fname, boost::format("%1% %2%") % v_btn.get_filename() % a_btn.get_filename() % bf::stop );
245+ }
246+
247+ return res;
248+}
249+
250
251=== modified file '.pc/applied-patches'
252--- .pc/applied-patches 2014-05-30 23:11:31 +0000
253+++ .pc/applied-patches 2015-08-13 11:13:06 +0000
254@@ -1,1 +1,2 @@
255 0001-ffmpeg-has-renamed-CodecID-AVCodecID.patch
256+0002-Allow-muxing-of-files-with-spaces.patch
257
258=== modified file 'debian/changelog'
259--- debian/changelog 2014-09-04 20:00:22 +0000
260+++ debian/changelog 2015-08-13 11:13:06 +0000
261@@ -1,3 +1,10 @@
262+bombono-dvd (1.2.2-0ubuntu5) UNRELEASED; urgency=medium
263+
264+ * Allow muxing of files whose name or path contains spaces
265+ (LP: #1484397).
266+
267+ -- Carlos Maddela <maddela@labyrinth.net.au> Thu, 13 Aug 2015 18:10:55 +1000
268+
269 bombono-dvd (1.2.2-0ubuntu4) utopic; urgency=medium
270
271 * Rebuild against libav11.
272
273=== added file 'debian/patches/0002-Allow-muxing-of-files-with-spaces.patch'
274--- debian/patches/0002-Allow-muxing-of-files-with-spaces.patch 1970-01-01 00:00:00 +0000
275+++ debian/patches/0002-Allow-muxing-of-files-with-spaces.patch 2015-08-13 11:13:06 +0000
276@@ -0,0 +1,40 @@
277+From: Carlos Maddela <maddela@labyrinth.net.au>
278+Date: Thu, 13 Aug 2015 15:05:04 +1000
279+Subject: Allow muxing of files whose name or path contains spaces
280+
281+Description: Allow muxing of files whose name or path contains spaces.
282+ Arguments to mplex command should be quoted in case the files to be
283+ muxed have names or paths containing spaces.
284+Author: Carlos Maddela <maddela@labyrinth.net.au>
285+Origin: vendor
286+Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/bombono-dvd/+bug/1484397
287+Forwarded: no
288+Last-Update: 2015-08-13
289+---
290+This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
291+---
292+ src/mgui/mux.cpp | 4 ++--
293+ 1 file changed, 2 insertions(+), 2 deletions(-)
294+
295+diff --git a/src/mgui/mux.cpp b/src/mgui/mux.cpp
296+index 427058e..cc4922b 100644
297+--- a/src/mgui/mux.cpp
298++++ b/src/mgui/mux.cpp
299+@@ -99,7 +99,7 @@ static bool RunMuxing(const std::string& dest_path, const std::string& args)
300+ ExitData ed;
301+ {
302+ Execution::Pulse pls(prg_bar);
303+- std::string cmd = boost::format("mplex -f 8 -o %1% %2%") % dest_path % args % bf::stop;
304++ std::string cmd = boost::format("mplex -f 8 -o \"%1%\" %2%") % dest_path % args % bf::stop;
305+ AppendCommandText(txt_view, cmd);
306+ ed = ExecuteAsync(0, cmd.c_str(), TextViewAppender(txt_view), &edat.pid);
307+ }
308+@@ -234,7 +234,7 @@ bool MuxStreams(std::string& dest_fname, const std::string& src_fname)
309+ if( res )
310+ {
311+ dlg.hide();
312+- res = RunMuxing(dest_fname, boost::format("%1% %2%") % v_btn.get_filename() % a_btn.get_filename() % bf::stop );
313++ res = RunMuxing(dest_fname, boost::format("\"%1%\" \"%2%\"") % v_btn.get_filename() % a_btn.get_filename() % bf::stop );
314+ }
315+
316+ return res;
317
318=== modified file 'debian/patches/series'
319--- debian/patches/series 2014-05-30 23:11:31 +0000
320+++ debian/patches/series 2015-08-13 11:13:06 +0000
321@@ -1,1 +1,2 @@
322 0001-ffmpeg-has-renamed-CodecID-AVCodecID.patch
323+0002-Allow-muxing-of-files-with-spaces.patch
324
325=== modified file 'src/mgui/mux.cpp'
326--- src/mgui/mux.cpp 2013-11-07 19:03:05 +0000
327+++ src/mgui/mux.cpp 2015-08-13 11:13:06 +0000
328@@ -99,7 +99,7 @@
329 ExitData ed;
330 {
331 Execution::Pulse pls(prg_bar);
332- std::string cmd = boost::format("mplex -f 8 -o %1% %2%") % dest_path % args % bf::stop;
333+ std::string cmd = boost::format("mplex -f 8 -o \"%1%\" %2%") % dest_path % args % bf::stop;
334 AppendCommandText(txt_view, cmd);
335 ed = ExecuteAsync(0, cmd.c_str(), TextViewAppender(txt_view), &edat.pid);
336 }
337@@ -234,7 +234,7 @@
338 if( res )
339 {
340 dlg.hide();
341- res = RunMuxing(dest_fname, boost::format("%1% %2%") % v_btn.get_filename() % a_btn.get_filename() % bf::stop );
342+ res = RunMuxing(dest_fname, boost::format("\"%1%\" \"%2%\"") % v_btn.get_filename() % a_btn.get_filename() % bf::stop );
343 }
344
345 return res;

Subscribers

People subscribed via source and target branches