Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Drake <dsd@laptop.org>2008-08-11 17:53:47 (GMT)
committer Daniel Drake <dsd@laptop.org>2008-08-29 20:18:16 (GMT)
commit0d9bd9f868b70fadb30dc761e22002b0f5c28b36 (patch)
tree0fc2b9f78431b94f47c53b035eec97622383efe8
parentaa7d58383545b390c164c45359619338dca68b8f (diff)
Wait for EOS before ending video recording
This avoids the last few frames being chopped off and is one step needed to fix the recording of multiple videos.
-rw-r--r--glive.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/glive.py b/glive.py
index bb584fe..ae7480c 100644
--- a/glive.py
+++ b/glive.py
@@ -43,6 +43,7 @@ class Glive:
def __init__(self, pca):
self.window = None
self.ca = pca
+ self._eos_cb = None
self.playing = False
self.picExposureOpen = False
@@ -366,6 +367,11 @@ class Glive:
# while we are adjusting the pipeline to stop recording. If we do
# it on-the-fly, the following video live feed to the screen becomes
# several seconds delayed. Weird!
+ self._eos_cb = self.stopRecordingVideoEOS
+ self.pipeline.get_by_name('camsrc').send_event(gst.event_new_eos())
+ self.audiobin.get_by_name('absrc').send_event(gst.event_new_eos())
+
+ def stopRecordingVideoEOS(self):
self.pipeline.set_state(gst.STATE_NULL)
self.pipeline.get_by_name("tee").unlink(self.videobin)
self.pipeline.remove(self.videobin)
@@ -492,8 +498,10 @@ class Glive:
def _onMessageCb(self, bus, message):
t = message.type
if t == gst.MESSAGE_EOS:
- #print("MESSAGE_EOS")
- pass
+ if self._eos_cb:
+ cb = self._eos_cb
+ self._eos_cb = None
+ cb()
elif t == gst.MESSAGE_ERROR:
#todo: if we come out of suspend/resume with errors, then get us back up and running...
#todo: handle "No space left on the resource.gstfilesink.c"