# HG changeset patch # User morphbr # Date 1180532623 -3600 # Node ID 668ecfca17897e103dcc31c00287aed027a48dd9 # Parent 3fbcd3d9b2d12139dd57ae2b6ddc3d1fd01a0caf [svn r725] * GMyth-Streamer - GMencoder plugin bug fixes diff -r 3fbcd3d9b2d1 -r 668ecfca1789 gmyth-stream/server/0.3/plugins/transcoders/gmencoder.py --- a/gmyth-stream/server/0.3/plugins/transcoders/gmencoder.py Tue May 29 21:24:48 2007 +0100 +++ b/gmyth-stream/server/0.3/plugins/transcoders/gmencoder.py Wed May 30 14:43:43 2007 +0100 @@ -37,12 +37,13 @@ def _parser_params (self): self._insert_param("-i", \ - "%s://%s" % (self.params_first("type", "file"), self.params_first("uri", ""))) + "%s://%s" % (self.params_first("type", "file"), + self.params_first("uri", ""))) self._insert_param("--video-encode", self.params_first("ve", "")) self._insert_param("--video-opts", "bitrate=200,pass=2,quantizer=5") self._insert_param("--video-fps", self.params_first("fps", "")) - self._insert_param("--video-width", self.params_first("width", "")) - self._insert_param("--video-height", self.params_first("height", "")) + self._insert_param("--video-width", self.params_first("width", "320")) + self._insert_param("--video-height", self.params_first("height", "240")) self._insert_param("--audio-rate", "32000") self._insert_param("--audio-encode", self.params_first("ae", "")) # _parse_params @@ -53,10 +54,11 @@ self._insert_param ("-o", "fd://%d" % outfd.fileno()) cmd = " ".join(self.opts) - self.log.info ("GMencoder: %s", cmd) + self.log.info(self.tid, "GMencoder: %s" % cmd) try: - self.proc = subprocess.Popen(self.opts, stdin=subprocess.PIPE, stdout=subprocess.PIPE) + self.proc = subprocess.Popen(self.opts, stdin=subprocess.PIPE, + stdout=subprocess.PIPE) except Exception, e: self.log.error(self.tid, "Error executing GMencoder: %s" % e) return False @@ -66,12 +68,11 @@ r, w, x = select.select([self.proc.stdout], [], [], 0) if self.proc.stdout in r: progress = self.proc.stdout.readline() - self.log.info ("stdout %s" % progress) + self.log.debug(self.tid, "stdout %s" % progress) if (progress.find ("PROGRESS") >= 0): self.status = progress.split (":")[1] - #if (progress.find ("DONE") >= 0): - # break - self.log.info ("Process exit") + else: + self.log.info(self.tid, "Process exit") except Exception, e: self.log.error(self.tid, "Problems handling data: %s" % e) return False @@ -82,13 +83,10 @@ def stop(self): if self.proc: - self.log.info ("STOPED GMencoder plugin") + self.log.info(self.tid, "Stopped GMencoder plugin") try: - self.proc.stdin.write ("QUIT\n") - except Exception, e: - pass - - try: + self.proc.stdin.write("QUIT\n") + os.kill(self.proc.pid, signal.SIGKILL) self.proc.wait() except Exception, e: pass