[svn r820] Added gmyth_scheduler_add_exception() function to remove only one schedule when all occurrences options has been used.
9 import lib.utils as utils
10 import lib.server as server
12 __all__ = ("TranscoderGMencoder",)
14 class TranscoderGMencoder(server.Transcoder):
15 gmencoder_path = utils.which("gmencoder")
20 def __init__(self, params):
21 server.Transcoder.__init__(self, params)
25 def _insert_param (self, name, value):
27 self.opts.append(name)
28 self.opts.append(value)
30 def _parser_params (self):
31 self._insert_param("-i", \
32 "%s://%s" % (self.params_first("type", "file"), self.params_first("uri", "")))
33 self._insert_param("--video-encode", self.params_first("ve", ""))
34 self._insert_param("--video-opts", "bitrate=200,pass=2,quantizer=5")
35 self._insert_param("--video-fps", self.params_first("fps", ""))
36 self._insert_param("--video-width", self.params_first("width", ""))
37 self._insert_param("--video-height", self.params_first("height", ""))
38 self._insert_param("--audio-rate", "32000")
39 self._insert_param("--audio-encode", self.params_first("ae", ""))
42 def start(self, outfd):
43 self.opts.append (self.gmencoder_path)
44 self._parser_params ()
45 self._insert_param ("-o", "fd://%d" % outfd.fileno())
47 cmd = " ".join(self.opts)
48 self.log.info ("GMencoder: %s", cmd)
51 self.proc = subprocess.Popen(self.opts, stdin=subprocess.PIPE, stdout=subprocess.PIPE)
53 self.log.error("Error executing GMencoder: %s" % e)
57 while (self.proc and self.proc.poll() == None):
58 r, w, x = select.select([self.proc.stdout], [], [], 0)
59 if self.proc.stdout in r:
60 progress = self.proc.stdout.readline()
61 self.log.info ("stdout %s" % progress)
62 if (progress.find ("PROGRESS") >= 0):
63 self.status = progress.split (":")[1]
64 #if (progress.find ("DONE") >= 0):
66 self.log.info ("Process exit")
68 self.log.error("Problems handling data: %s" % e)
77 self.log.info ("STOPED GMencoder plugin")
79 self.proc.stdin.write ("QUIT\n")