diff options
author | Jesús Eduardo <heckyel@hyperbola.info> | 2017-09-11 17:47:17 -0500 |
---|---|---|
committer | Jesús Eduardo <heckyel@hyperbola.info> | 2017-09-11 17:47:17 -0500 |
commit | 14738704ede6dfa6ac79f362a9c1f7f40f470cdc (patch) | |
tree | 31c83bdd188ae7b64d7169974d6f066ccfe95367 /mvc/settings.py | |
parent | eb1896583afbbb622cadcde1a24e17173f61904f (diff) | |
download | librevideoconverter-14738704ede6dfa6ac79f362a9c1f7f40f470cdc.tar.lz librevideoconverter-14738704ede6dfa6ac79f362a9c1f7f40f470cdc.tar.xz librevideoconverter-14738704ede6dfa6ac79f362a9c1f7f40f470cdc.zip |
rename mvc at lvc
Diffstat (limited to 'mvc/settings.py')
-rw-r--r-- | mvc/settings.py | 88 |
1 files changed, 0 insertions, 88 deletions
diff --git a/mvc/settings.py b/mvc/settings.py deleted file mode 100644 index 4d7255c..0000000 --- a/mvc/settings.py +++ /dev/null @@ -1,88 +0,0 @@ -import logging -import os -import sys - -from mvc import execute - -ffmpeg_version = None - -_search_path_extra = [] -def add_to_search_path(directory): - """Add a path to the list of paths that which() searches.""" - _search_path_extra.append(directory) - -def which(name): - if sys.platform == 'win32': - name = name + '.exe' # we're looking for ffmpeg.exe in this case - if sys.platform == 'darwin' and 'Contents/Resources' in __file__: - # look for a bundled version - path = os.path.join(os.path.dirname(__file__), - '..', '..', '..', '..', 'Helpers', name) - if os.path.exists(path): - return path - dirs_to_search = os.environ['PATH'].split(os.pathsep) - dirs_to_search += _search_path_extra - for dirname in dirs_to_search: - fullpath = os.path.join(dirname, name) - # XXX check for +x bit - if os.path.exists(fullpath): - return fullpath - logging.warn("Can't find path to %s (searched in %s)", name, - dirs_to_search) - -def memoize(func): - cache = [] - def wrapper(): - if not cache: - cache.append(func()) - return cache[0] - return wrapper - -@memoize -def get_ffmpeg_executable_path(): - return which("ffmpeg") - avconv = which('avconv') - if avconv is not None: - return avconv - return which("ffmpeg") - -def get_ffmpeg_version(): - global ffmpeg_version - if ffmpeg_version is None: - commandline = [get_ffmpeg_executable_path(), '-version'] - p = execute.Popen(commandline, stderr=open(os.devnull, "wb")) - stdout, _ = p.communicate() - lines = stdout.split('\n') - version = lines[0].rsplit(' ', 1)[1].split('.') - def maybe_int(v): - try: - return int(v) - except ValueError: - return v - ffmpeg_version = tuple(maybe_int(v) for v in version) - return ffmpeg_version - -def customize_ffmpeg_parameters(params): - """Takes a list of parameters and modifies it based on - platform-specific issues. Returns the newly modified list of - parameters. - - :param params: list of parameters to modify - - :returns: list of modified parameters that will get passed to - ffmpeg - """ - if get_ffmpeg_version() < (0, 8): - # Fallback for older versions of FFmpeg (Ubuntu Natty, in particular). - # see also #18969 - params = ['-vpre' if i == '-preset' else i for i in params] - try: - profile_index = params.index('-profile:v') - except ValueError: - pass - else: - if params[profile_index + 1] == 'baseline': - params[profile_index:profile_index+2] = [ - '-coder', '0', '-bf', '0', '-refs', '1', - '-flags2', '-wpred-dct8x8'] - return params |