# HG changeset patch # User morphbr # Date 1183212350 -3600 # Node ID 57f3de326cd8c29096e4596bec04ba9b1e244280 # Parent 823dad73a2c2bee8c7b2561b87b65387dc5058be [svn r771] * Mencoder doesnt work well with "Transfer-Encoding: chunked". * Put this method just for gmencoder diff -r 823dad73a2c2 -r 57f3de326cd8 gmyth-stream/server/0.3/lib/request_handler.py --- a/gmyth-stream/server/0.3/lib/request_handler.py Sat Jun 30 14:16:59 2007 +0100 +++ b/gmyth-stream/server/0.3/lib/request_handler.py Sat Jun 30 15:05:50 2007 +0100 @@ -336,8 +336,10 @@ self.send_response(200) self.send_header("Content-Type", obj.get_mimetype()) - self.send_header("Transfer-Encoding", "chunked") - self.send_header("Cache-Control", "no-cache") + + if (obj.name == "gmencoder"): + self.send_header("Transfer-Encoding", "chunked") + self.send_header("Connection", "close") self.end_headers() diff -r 823dad73a2c2 -r 57f3de326cd8 gmyth-stream/server/0.3/plugins/transcoders/mencoder.py --- a/gmyth-stream/server/0.3/plugins/transcoders/mencoder.py Sat Jun 30 14:16:59 2007 +0100 +++ b/gmyth-stream/server/0.3/plugins/transcoders/mencoder.py Sat Jun 30 15:05:50 2007 +0100 @@ -23,8 +23,6 @@ __all__ = ("TranscoderMencoder",) -buffer_size = 1024 * 64 - class TranscoderMencoder(transcoder.Transcoder): """Transcoder class that implements a transcoder using Mencoder""" mencoder_path = utils.which("mencoder") @@ -120,6 +118,8 @@ self._arg_append(args, "-slang %s" % self.args["subtitle"]) self._arg_append(args, "-subfps %s" % self.args["fps"]) + self._arg_append(args, "-idx") + self._arg_append(args, "-cache 1024") self._arg_append(args, self._setup_audio()) self._arg_append(args, self._setup_video()) @@ -198,7 +198,7 @@ try: return open(self.args["outfile"]) except: - os.write(stdw, _stdin.read(buffer_size)) + os.write(stdw, _stdin.read(1024)) # _check_opened_file @@ -262,7 +262,7 @@ try: while self.proc and self.proc.poll() == None: - d = self.proc.stdout.read(buffer_size) + d = self.proc.stdout.read(1024) outfd.write(d) except Exception, e: self.log.error(self.tid, "Error: %s" % e) diff -r 823dad73a2c2 -r 57f3de326cd8 gmyth-stream/server/0.3/plugins/transcoders/mencoder_lib/mythtv.py --- a/gmyth-stream/server/0.3/plugins/transcoders/mencoder_lib/mythtv.py Sat Jun 30 14:16:59 2007 +0100 +++ b/gmyth-stream/server/0.3/plugins/transcoders/mencoder_lib/mythtv.py Sat Jun 30 15:05:50 2007 +0100 @@ -7,8 +7,6 @@ from select import select -buffer_size = 1024 * 64 - def _setup_mythfilename(self): # mythtv:mythtv@192.168.3.110:6543/1002_20070426230000.nuv try: @@ -91,10 +89,8 @@ r, w, x = select([self.gmyth.stderr, self.proc.stdout], [], [], 0) if self.proc.stdout in r: - d = self.proc.stdout.read(buffer_size) - outfd.write("%x\r\n", len(d)) + d = self.proc.stdout.read(4096) outfd.write(d) - outfd.write("\r\n") if self.gmyth.stderr in r: partial = self.gmyth.stderr.readline() @@ -102,8 +98,6 @@ self.status = utils.progress_bar(int(partial), int(size), 50) - outfd.write("0\r\n\r\n") - except IndexError, e: pass except Exception, e: