[svn r771] * Mencoder doesnt work well with "Transfer-Encoding: chunked". trunk
authormorphbr
Sat Jun 30 15:05:50 2007 +0100 (2007-06-30)
branchtrunk
changeset 76557f3de326cd8
parent 764 823dad73a2c2
child 766 f1da4fbe667e
[svn r771] * Mencoder doesnt work well with "Transfer-Encoding: chunked".
* Put this method just for gmencoder
gmyth-stream/server/0.3/lib/request_handler.py
gmyth-stream/server/0.3/plugins/transcoders/mencoder.py
gmyth-stream/server/0.3/plugins/transcoders/mencoder_lib/mythtv.py
     1.1 --- a/gmyth-stream/server/0.3/lib/request_handler.py	Sat Jun 30 14:16:59 2007 +0100
     1.2 +++ b/gmyth-stream/server/0.3/lib/request_handler.py	Sat Jun 30 15:05:50 2007 +0100
     1.3 @@ -336,8 +336,10 @@
     1.4  
     1.5          self.send_response(200)
     1.6          self.send_header("Content-Type", obj.get_mimetype())
     1.7 -        self.send_header("Transfer-Encoding", "chunked")
     1.8 -	self.send_header("Cache-Control", "no-cache")
     1.9 +
    1.10 +        if (obj.name == "gmencoder"):
    1.11 +            self.send_header("Transfer-Encoding", "chunked")
    1.12 +
    1.13          self.send_header("Connection", "close")
    1.14          self.end_headers()
    1.15  
     2.1 --- a/gmyth-stream/server/0.3/plugins/transcoders/mencoder.py	Sat Jun 30 14:16:59 2007 +0100
     2.2 +++ b/gmyth-stream/server/0.3/plugins/transcoders/mencoder.py	Sat Jun 30 15:05:50 2007 +0100
     2.3 @@ -23,8 +23,6 @@
     2.4  
     2.5  __all__ = ("TranscoderMencoder",)
     2.6  
     2.7 -buffer_size = 1024 * 64
     2.8 -
     2.9  class TranscoderMencoder(transcoder.Transcoder):
    2.10      """Transcoder class that implements a transcoder using Mencoder"""
    2.11      mencoder_path = utils.which("mencoder")
    2.12 @@ -120,6 +118,8 @@
    2.13              self._arg_append(args, "-slang %s" % self.args["subtitle"])
    2.14              self._arg_append(args, "-subfps %s" % self.args["fps"])
    2.15  
    2.16 +        self._arg_append(args, "-idx")
    2.17 +        self._arg_append(args, "-cache 1024")
    2.18          self._arg_append(args, self._setup_audio())
    2.19          self._arg_append(args, self._setup_video())
    2.20  
    2.21 @@ -198,7 +198,7 @@
    2.22              try:
    2.23                  return open(self.args["outfile"])
    2.24              except:
    2.25 -                os.write(stdw, _stdin.read(buffer_size))
    2.26 +                os.write(stdw, _stdin.read(1024))
    2.27      # _check_opened_file
    2.28  
    2.29  
    2.30 @@ -262,7 +262,7 @@
    2.31  
    2.32          try:
    2.33              while self.proc and self.proc.poll() == None:
    2.34 -                d = self.proc.stdout.read(buffer_size)
    2.35 +                d = self.proc.stdout.read(1024)
    2.36                  outfd.write(d)
    2.37          except Exception, e:
    2.38              self.log.error(self.tid, "Error: %s" % e)
     3.1 --- a/gmyth-stream/server/0.3/plugins/transcoders/mencoder_lib/mythtv.py	Sat Jun 30 14:16:59 2007 +0100
     3.2 +++ b/gmyth-stream/server/0.3/plugins/transcoders/mencoder_lib/mythtv.py	Sat Jun 30 15:05:50 2007 +0100
     3.3 @@ -7,8 +7,6 @@
     3.4  
     3.5  from select import select
     3.6  
     3.7 -buffer_size = 1024 * 64
     3.8 -
     3.9  def _setup_mythfilename(self):
    3.10      # mythtv:mythtv@192.168.3.110:6543/1002_20070426230000.nuv
    3.11      try:
    3.12 @@ -91,10 +89,8 @@
    3.13              r, w, x = select([self.gmyth.stderr, self.proc.stdout],
    3.14                               [], [], 0)
    3.15              if self.proc.stdout in r:
    3.16 -                d = self.proc.stdout.read(buffer_size)
    3.17 -                outfd.write("%x\r\n", len(d))
    3.18 +                d = self.proc.stdout.read(4096)
    3.19                  outfd.write(d)
    3.20 -                outfd.write("\r\n")
    3.21  
    3.22              if self.gmyth.stderr in r:
    3.23                  partial = self.gmyth.stderr.readline()
    3.24 @@ -102,8 +98,6 @@
    3.25                      self.status = utils.progress_bar(int(partial),
    3.26                                                       int(size), 50)
    3.27  
    3.28 -        outfd.write("0\r\n\r\n")
    3.29 -
    3.30      except IndexError, e:
    3.31          pass
    3.32      except Exception, e: