[svn r600] Added clean-up code to the GMyth test cases.
6 import lib.utils as utils
7 import lib.server as server
9 __all__ = ("TranscoderGMencoder",)
11 class TranscoderGMencoder(server.Transcoder):
12 gmencoder_path = utils.which("gmencoder")
18 def __init__(self, params):
19 server.Transcoder.__init__(self, params)
23 def _insert_param (self, name, value):
25 self.opts.append(name)
26 self.opts.append(value)
28 def _parser_params (self):
29 self._insert_param("-i", \
30 "%s://%s" % (self.params_first("uri_prefix", "file"), self.params_first("uri_path", "")))
31 self._insert_param("--video-encode", self.params_first("ve", ""))
32 self._insert_param("--video-opts", "bitrate=200,pass=2,quantizer=5")
33 self._insert_param("--video-fps", self.params_first("fps", ""))
34 self._insert_param("--video-width", self.params_first("width", ""))
35 self._insert_param("--video-height", self.params_first("height", ""))
36 self._insert_param("--audio-encode", self.params_first("ae", ""))
37 self._insert_param("--output-element", "fdsink")
40 def start(self, outfd):
41 self.opts.append (self.gmencoder_path)
42 self._parser_params ()
43 self.opts.append ("--output-opts")
44 self.opts.append ("fd=%d" % outfd.fileno())
46 cmd = " ".join(self.opts)
47 self.log.info ("Gmemconder: %s", cmd)
50 self.proc = subprocess.Popen(self.opts, stdin=subprocess.PIPE)
52 self.log.error("Error executing gmencoder: %s" % e)
59 self.log.error("Problems handling data: %s" % e)
68 self.log.info ("STOP")
70 self.proc.stdin.write ("QUIT\n")