[pitivi] ExportSettings: remember element settings on a per-factory basis
- From: Edward Hervey <edwardrv src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pitivi] ExportSettings: remember element settings on a per-factory basis
- Date: Fri, 10 Dec 2010 17:50:21 +0000 (UTC)
commit 65d97deb27445bfc130f199f05620b446f8bb7f8
Author: Brandon Lewis <brandon_lewis alum berkeley edu>
Date: Fri Nov 19 19:19:10 2010 +0000
ExportSettings: remember element settings on a per-factory basis
pitivi/settings.py | 11 +++++++++++
1 files changed, 11 insertions(+), 0 deletions(-)
---
diff --git a/pitivi/settings.py b/pitivi/settings.py
index 250832a..f1731ad 100644
--- a/pitivi/settings.py
+++ b/pitivi/settings.py
@@ -456,6 +456,10 @@ class ExportSettings(Signallable, Loggable):
# TODO : Add PAR/DAR for video
# TODO : switch to using GstFraction internally where appliable
+
+ # TODO: initialize this cache from the project file?
+ factory_settings_cache = {}
+
def __init__(self, **unused_kw):
Loggable.__init__(self)
self.videowidth = 720
@@ -585,17 +589,24 @@ class ExportSettings(Signallable, Loggable):
""" Set the video/audio encoder and muxer """
changed = False
if not muxer == "" and not muxer == self.muxer:
+ self._updateSettingsCache(self.muxer, muxer, 'containersettings')
self.muxer = muxer
changed = True
if not vencoder == "" and not vencoder == self.vencoder:
+ self._updateSettingsCache(self.vencoder, vencoder, 'vcodecsettings')
self.vencoder = vencoder
changed = True
if not aencoder == "" and not aencoder == self.aencoder:
+ self._updateSettingsCache(self.aencoder, aencoder, 'acodecsettings')
self.aencoder = aencoder
changed = True
if changed:
self.emit("encoders-changed")
+ def _updateSettingsCache(self, current, new, attr):
+ self.factory_settings_cache[current] = getattr(self, attr)
+ setattr(self, attr, self.factory_settings_cache.get(new, {}))
+
def getAudioEncoders(self):
""" Returns the list of audio encoders compatible with the current
muxer """
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]