[pitivi] Encode: complete re-write of available_muxers
- From: Edward Hervey <edwardrv src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pitivi] Encode: complete re-write of available_muxers
- Date: Fri, 10 Dec 2010 17:50:11 +0000 (UTC)
commit 2ca267106beb36ff154a48af16ceedfbdec12f47
Author: Brandon Lewis <brandon_lewis alum berkeley edu>
Date: Fri Nov 19 19:17:40 2010 +0000
Encode: complete re-write of available_muxers
pitivi/encode.py | 37 ++++++++++++++++++++++++++++---------
pitivi/settings.py | 14 +++++---------
2 files changed, 33 insertions(+), 18 deletions(-)
---
diff --git a/pitivi/encode.py b/pitivi/encode.py
index 8d476b9..6bff7ac 100644
--- a/pitivi/encode.py
+++ b/pitivi/encode.py
@@ -395,12 +395,31 @@ def muxer_can_sink_raw_video(muxer):
""" Returns True if given muxer can accept raw video """
return my_can_sink_caps(muxer, raw_video_caps)
-def available_combinations(muxers, vencoders, aencoders):
- res = []
- for mux in muxers:
- muxsinkcaps = [x.get_caps() for x in mux.get_static_pad_templates() if x.direction == gst.PAD_SINK]
- noaudio = (encoders_muxer_compatible(aencoders, mux, muxsinkcaps) == []) and not my_can_sink_caps(mux, raw_audio_caps, muxsinkcaps)
- novideo = (encoders_muxer_compatible(vencoders, mux, muxsinkcaps) == []) and not my_can_sink_caps(mux, raw_video_caps, muxsinkcaps)
- if (noaudio == False) and (novideo == False):
- res.append(mux)
- return res
+
+def available_combinations():
+
+ """Return a 3-tuple of (muxers, audio, video), where:
+ - muxers is a list of muxer factories
+ - audio is a dictionary from muxer names to compatible audio encoders
+ - video is a dictionary from muxer names to compatible video encoders
+ """
+
+ aencoders = available_audio_encoders()
+ vencoders = available_video_encoders()
+ muxers = available_muxers()
+
+ audio = {}
+ video = {}
+ containers = []
+ for muxer in muxers:
+ mux = muxer.get_name()
+ aencs = encoders_muxer_compatible(aencoders, muxer)
+ vencs = encoders_muxer_compatible(vencoders, muxer)
+ # only include muxers with audio and video
+
+ if aencs and vencs:
+ audio[mux] = aencs
+ video[mux] = vencs
+ containers.append(muxer)
+
+ return containers, audio, video
diff --git a/pitivi/settings.py b/pitivi/settings.py
index 8ffc19f..b6b5bfa 100644
--- a/pitivi/settings.py
+++ b/pitivi/settings.py
@@ -33,8 +33,7 @@ import xdg.BaseDirectory as xdg_dirs # Freedesktop directories spec
from gettext import gettext as _
from pitivi.signalinterface import Signallable
-from pitivi.encode import available_muxers, available_video_encoders, \
- available_audio_encoders, available_combinations, \
+from pitivi.encode import available_combinations, \
get_compatible_sink_caps
from pitivi.stream import get_stream_for_caps
from pitivi.log.loggable import Loggable
@@ -469,13 +468,10 @@ class ExportSettings(Signallable, Loggable):
self.vencoder = "theoraenc"
self.aencoder = "vorbisenc"
self.muxer = "oggmux"
- self.containersettings = {}
- self.acodecsettings = {}
- self.vcodecsettings = {}
- self.muxers = available_muxers()
- self.vencoders = available_video_encoders()
- self.aencoders = available_audio_encoders()
- self.muxers = available_combinations(self.muxers, self.vencoders, self.aencoders)
+ self.containersettings = self.factory_settings_cache.get(self.muxer, {})
+ self.acodecsettings = self.factory_settings_cache.get(self.aencoder, {})
+ self.vcodecsettings = self.factory_settings_cache.get(self.vencoder, {})
+ self.muxers, self.aencoders, self.vencoders = available_combinations()
def copy(self):
ret = ExportSettings()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]