Merge lp:~rakete/eidete/no-duration-fix into lp:eidete

Proposed by Andreas Raster
Status: Merged
Merge reported by: Tom Beckmann
Merged at revision: not available
Proposed branch: lp:~rakete/eidete/no-duration-fix
Merge into: lp:eidete
Diff against target: 78 lines (+23/-14)
1 file modified
src/eidete.vala (+23/-14)
To merge this branch: bzr merge lp:~rakete/eidete/no-duration-fix
Reviewer Review Type Date Requested Status
Tom Beckmann (community) Approve
Review via email: mp+102996@code.launchpad.net

Description of the change

Someone in #gstreamer helped me figure it out. We need to manually send an EOS to the pipeline and wait for it to finish writing everything to disk before setting it to NULL. That fixes the duration problem, and it is even the correct way and not some ugly hack.

Still, please test before merging, changed when the main_window gets deleted.

To post a comment you must log in.
Revision history for this message
Tom Beckmann (tombeckmann) wrote :

Thanks a lot, in my tests the main_window was never delted, so I added the call after the enddialog is shown, besides this everything works perfectly. Great work!
We may want to consider a little progress dialog, but it doesn't seem to be that urgent, I will report it as low priority bug.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/eidete.vala'
2--- src/eidete.vala 2012-04-18 17:15:36 +0000
3+++ src/eidete.vala 2012-04-22 01:22:18 +0000
4@@ -391,10 +391,11 @@
5 return false;
6 });
7 */
8-
9+
10 this.main_window.destroy.connect ( () => {
11- if (pipeline != null)
12- pipeline.set_state (State.NULL);
13+ if ( recording ) {
14+ finish_recording ();
15+ }
16 });
17
18 Granite.Services.Logger.initialize ("Eidete");
19@@ -408,11 +409,7 @@
20 if (pause_rec)
21 this.main_window.present ();
22 else if (finish_rec) {
23- this.recording = false;
24- this.pipeline.set_state (State.NULL);
25- var end = new Eidete.Widgets.EndDialog (this);
26- end.show_all ();
27- this.main_window.hide ();
28+ finish_recording ();
29 }
30 }
31 }
32@@ -457,9 +454,7 @@
33 });
34
35 stop_bt.clicked.connect ( () => {
36- var end = new Eidete.Widgets.EndDialog (this);
37- end.show_all ();
38- this.main_window.destroy ();
39+ finish_recording ();
40 });
41
42 continue_bt.clicked.connect ( () => {
43@@ -553,18 +548,32 @@
44 pipeline.set_state (State.PLAYING);
45 this.recording = true;
46 }
47-
48+
49+ public void finish_recording () {
50+ if ( ! this.recording ) {
51+ debug ("resuming recording\n");
52+ this.pipeline.set_state(State.PLAYING);
53+ this.recording = true;
54+ }
55+ pipeline.send_event (new Event.eos());
56+ }
57+
58 private bool bus_message_cb (Gst.Bus bus, Message msg){
59 switch (msg.type){
60 case Gst.MessageType.ERROR:
61 GLib.Error err; string debug;
62 msg.parse_error (out err, out debug);
63- print ("Error: %s\n", err.message);
64+ stderr.printf ("Error: %s\n", err.message);
65 pipeline.set_state (State.NULL);
66 break;
67 case Gst.MessageType.EOS:
68- print ("Finished, why??\n");
69+ debug ("received EOS\n");
70 pipeline.set_state (State.NULL);
71+ this.recording = false;
72+
73+ var end = new Eidete.Widgets.EndDialog (this);
74+ end.show_all ();
75+
76 break;
77 default:
78 break;

Subscribers

People subscribed via source and target branches