[pitivi/ges] Fix the import dialog's media file previewer
- From: Jean-FranÃois Fortin Tam <jfft src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pitivi/ges] Fix the import dialog's media file previewer
- Date: Tue, 1 May 2012 17:07:30 +0000 (UTC)
commit eb3d20a7b8b6e1584db5cb0a7b52eb8f2d9f4c56
Author: Thiago Santos <thiago sousa santos collabora com>
Date: Mon Apr 30 22:23:22 2012 -0300
Fix the import dialog's media file previewer
Properly show the videos of previews in the file selection dialog.
It would raise an exception when trying to set properties that
didn't exist in playsink and fail to set the xwindow id to the
sink.
Fixes bug #675202
pitivi/mediafilespreviewer.py | 29 +++++++++++++++++++++++------
1 files changed, 23 insertions(+), 6 deletions(-)
---
diff --git a/pitivi/mediafilespreviewer.py b/pitivi/mediafilespreviewer.py
index ddabffd..c81d33a 100644
--- a/pitivi/mediafilespreviewer.py
+++ b/pitivi/mediafilespreviewer.py
@@ -370,12 +370,29 @@ class PreviewWidget(gtk.VBox, Loggable):
if mess.type == gst.MESSAGE_ELEMENT:
if mess.structure.get_name() == 'prepare-xwindow-id':
sink = mess.src
- sink.set_property('force-aspect-ratio', True)
- sink.set_property("handle-expose", True)
- gtk.gdk.threads_enter()
- sink.set_xwindow_id(self.preview_video.window_xid)
- sink.expose()
- gtk.gdk.threads_leave()
+
+ # We need to set force-aspect-ratio and handle-expose properties
+ # to the real videosink. Depending on how the pipeline was
+ # configured and the version of gstreamer, the source of this
+ # message could be the videosink itself or playsink. If it's
+ # playsink, we need to get the videosink that is inside it.
+ # Even better, the sink inside playsink could be autovideosink,
+ # which isn't a real sink, therefore we get the sink inside it.
+ try:
+ if sink.get_factory().get_name() == 'playsink':
+ realsink = sink.get_property('video-sink')
+ else:
+ realsink = sink
+ if realsink.get_factory().get_name() == 'autovideosink':
+ realsink = realsink.sinks().next()
+
+ realsink.set_property('force-aspect-ratio', True)
+ realsink.set_property("handle-expose", True)
+ finally:
+ gtk.gdk.threads_enter()
+ sink.set_xwindow_id(self.preview_video.window_xid)
+ sink.expose()
+ gtk.gdk.threads_leave()
return gst.BUS_PASS
def _tag_found_cb(self, abus, mess):
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]