[svn r579] - Updated debug messages for GMyth-Streamer (0.2) trunk
authormorphbr
Thu Apr 19 16:30:17 2007 +0100 (2007-04-19)
branchtrunk
changeset 5742dfea125c76c
parent 573 f4927ca53da7
child 575 f7351f2fd6d8
[svn r579] - Updated debug messages for GMyth-Streamer (0.2)
gmyth-stream/server/0.2/lib/server.py
gmyth-stream/server/0.2/plugins/transcoders/gstreamer.py
     1.1 --- a/gmyth-stream/server/0.2/lib/server.py	Thu Apr 19 16:14:41 2007 +0100
     1.2 +++ b/gmyth-stream/server/0.2/lib/server.py	Thu Apr 19 16:30:17 2007 +0100
     1.3 @@ -19,7 +19,7 @@
     1.4             "load_plugins_transcoders")
     1.5  
     1.6  class Transcoder(object):
     1.7 -    log = log.getLogger("gmyth-stream.transcoder")
     1.8 +    log = log.getLogger("gmyth-streamer.transcoder")
     1.9      priority = 0   # negative values have higher priorities
    1.10      name = None # to be used in requests
    1.11  
    1.12 @@ -73,7 +73,7 @@
    1.13  
    1.14  
    1.15  class RequestHandler(BaseHTTPServer.BaseHTTPRequestHandler):
    1.16 -    log = log.getLogger("gmyth-stream.request")
    1.17 +    log = log.getLogger("gmyth-streamer.request")
    1.18      def_transcoder = None
    1.19      transcoders = utils.PluginSet(Transcoder)
    1.20  
     2.1 --- a/gmyth-stream/server/0.2/plugins/transcoders/gstreamer.py	Thu Apr 19 16:14:41 2007 +0100
     2.2 +++ b/gmyth-stream/server/0.2/plugins/transcoders/gstreamer.py	Thu Apr 19 16:30:17 2007 +0100
     2.3 @@ -30,11 +30,7 @@
     2.4              self.Vbin = vbin
     2.5              self.Sink = sink
     2.6              self.Loop = gobject.MainLoop()
     2.7 -            self.ACaps = ""
     2.8 -            self.VCaps = ""
     2.9              self.Ready = False
    2.10 -            self.Connection = None
    2.11 -            self.Addr = None
    2.12          # __init__()
    2.13  
    2.14      # StreamData()
    2.15 @@ -47,13 +43,12 @@
    2.16          self.connection = None
    2.17          self.addr = None
    2.18          self.ready = False
    2.19 -
    2.20 -        self.log.info("Params for Gstreamer: %s" % self.params)
    2.21 +        self.log.debug("Params for Gstreamer: %s" % self.params)
    2.22      # __init__()
    2.23  
    2.24  
    2.25      def _create_start_elements(self, uri):
    2.26 -        self.log.info("Opening Uri:" + uri)
    2.27 +        self.log.debug("Opening Uri:" + uri)
    2.28          src = gst.element_make_from_uri(gst.URI_SRC, uri, "src")
    2.29          decode = gst.element_factory_make("decodebin", "decode")
    2.30          mux = gst.element_factory_make("ffmux_mpeg", "mux")
    2.31 @@ -76,18 +71,18 @@
    2.32          vencode.set_property ("quantizer", 5)
    2.33  
    2.34          if None in [vbin, vqueue, vrate, vencode, vqueue_src]:
    2.35 -            self.log.info("Fail to create video encode elements.")
    2.36 +            self.log.error("Fail to create video encode elements.")
    2.37              return False
    2.38  
    2.39          vbin.add(vqueue)
    2.40          if int(width) > 0 and int(height) > 0:
    2.41 -            self.log.info(("Formating output to %d / %d" %(int(width), int(height))))
    2.42 +            self.log.debug("Formating output to %d / %d" % ( int(width), int(height)))
    2.43  
    2.44              vscale = gst.element_factory_make("ffvideoscale", "vscale")
    2.45  
    2.46              vbin.add(vscale);
    2.47              if not vqueue.link(vscale):
    2.48 -                self.log.info("Fail to link video elements")
    2.49 +                self.log.error("Fail to link video elements")
    2.50                  return False
    2.51  
    2.52              vbin.add(colorspace)
    2.53 @@ -95,7 +90,7 @@
    2.54              if not vscale.link(colorspace, \
    2.55                  gst.caps_from_string("video/x-raw-yuv,width=(int)%d,height=(int)%d" %(\
    2.56                  int(width), int(height)))):
    2.57 -                self.log.info("Fail to link video elements")
    2.58 +                self.log.error("Fail to link video elements")
    2.59                  return False
    2.60          else:
    2.61              vbin.add(colorspace)
    2.62 @@ -103,16 +98,16 @@
    2.63  
    2.64          vbin.add(vrate, vencode, vqueue_src)
    2.65          if not colorspace.link(vrate):
    2.66 -            self.log.info("Fail to colorspace with vrate")
    2.67 +            self.log.error("Fail to colorspace with vrate")
    2.68              return False
    2.69  
    2.70          if not vrate.link(vencode, \
    2.71              gst.caps_from_string("video/x-raw-yuv,framerate=(fraction)10/1")):
    2.72 -            self.log.info("Fail to link vrate element")
    2.73 +            self.log.error("Fail to link vrate element")
    2.74              return False
    2.75  
    2.76          if not vencode.link(vqueue_src):
    2.77 -            self.log.info("Fail to link video encode with queue")
    2.78 +            self.log.error("Fail to link video encode with queue")
    2.79              return False
    2.80  
    2.81          vbin.add_pad(gst.GhostPad("sink", vqueue.get_pad("sink")))
    2.82 @@ -129,32 +124,32 @@
    2.83          #aencode = gst.element_factory_make("ffenc_mp2", "aencode")
    2.84          aencode = gst.element_factory_make("lame", "aencode")
    2.85          aqueue_src = gst.element_factory_make("queue", "aqueue_src")
    2.86 -       
    2.87 +
    2.88          if None in [abin, aqueue, aencode, aqueue_src]:
    2.89 -            self.log.info("Fail to create video encode elements.")
    2.90 +            self.log.error("Fail to create video encode elements.")
    2.91              return False
    2.92  
    2.93 -        #aencode.set_property ("bitrate", 32)            
    2.94 +        #aencode.set_property ("bitrate", 32)
    2.95          #aencode.set_property ("vbr-quality", 2)
    2.96  
    2.97          abin.add(aqueue, aconvert, aencode, aqueue_src)
    2.98  
    2.99 -        self.log.info ("Link queue -> aconvert")
   2.100 +        self.log.debug("Link queue -> aconvert")
   2.101          if not aqueue.link (aconvert):
   2.102 -            self.log.info("Fail to link queue video")
   2.103 +            self.log.error("Fail to link queue video")
   2.104              return False
   2.105  
   2.106 -        self.log.info ("Link aconvert -> aencode")
   2.107 +        self.log.debug("Link aconvert -> aencode")
   2.108          if not aconvert.link (aencode):
   2.109 -            self.log.info("Fail to link video elements")
   2.110 +            self.log.error("Fail to link video elements")
   2.111              return False
   2.112  
   2.113 -        self.log.info ("Link aencode -> aqueue_src")
   2.114 +        self.log.debug("Link aencode -> aqueue_src")
   2.115          if not aencode.link (aqueue_src):
   2.116 -            self.log.info("Fail to link aencode -> aqueue_src")
   2.117 +            self.log.error("Fail to link aencode -> aqueue_src")
   2.118              return False
   2.119  
   2.120 -        self.log.info ("Link:OK")
   2.121 +        self.log.debug("Link:OK")
   2.122  
   2.123          ghost_sink = gst.GhostPad("sink", aqueue.get_pad("sink"))
   2.124          ghost_src = gst.GhostPad("src", aqueue_src.get_pad("src"))
   2.125 @@ -207,11 +202,11 @@
   2.126          video_pad = vbin.get_pad("src")
   2.127  
   2.128          if audio_pad.link(mux_audio) != gst.PAD_LINK_OK:
   2.129 -            self.log.info("Fail to link audio with mux")
   2.130 +            self.log.error("Fail to link audio with mux")
   2.131              return False
   2.132  
   2.133          if video_pad.link(mux_video) != gst.PAD_LINK_OK:
   2.134 -            self.log.info("Fail to link audio with mux")
   2.135 +            self.log.error("Fail to link audio with mux")
   2.136              return False
   2.137  
   2.138          self.stream_data = self.StreamData(self.log, pipe, abin, vbin, sink)
   2.139 @@ -231,7 +226,7 @@
   2.140      def __on_bus_message(self, bus, message, stream_data):
   2.141  
   2.142          t = message.type
   2.143 -        self.log.info ("__on_bus_message")
   2.144 +        self.log.debug("__on_bus_message")
   2.145  
   2.146          if t == gst.MESSAGE_STATE_CHANGED:
   2.147              oldstate = -1
   2.148 @@ -278,20 +273,20 @@
   2.149      def __on_decode_new_pad(self, decode, pad, arg1, stream_data):
   2.150  
   2.151          caps = pad.get_caps().to_string()
   2.152 -        self.log.info("New pad " + caps)
   2.153 +        self.log.debug("New pad " + caps)
   2.154          if caps.rfind("audio") != -1:
   2.155              apad = stream_data.Abin.get_pad("sink")
   2.156              if pad.link(apad) != gst.PAD_LINK_OK:
   2.157 -                self.log.info("Error on link audio pad")
   2.158 +                self.log.error("Error on link audio pad")
   2.159                  return None
   2.160          elif caps.rfind("video") != -1:
   2.161              vpad = stream_data.Vbin.get_pad("sink")
   2.162              if pad.link(vpad) != gst.PAD_LINK_OK:
   2.163 -                self.log.info("Error on link video pad")
   2.164 +                self.log.error("Error on link video pad")
   2.165                  return None
   2.166          else:
   2.167 -            self.log.info("Invalid caps")
   2.168 -        self.log.info("Linked")
   2.169 +            self.log.error("Invalid caps")
   2.170 +        self.log.debug("Linked")
   2.171      # __on_decode_new_pad
   2.172  
   2.173  
   2.174 @@ -305,15 +300,13 @@
   2.175                     params_first("abitrate", 192000),  params_first("width", 320),
   2.176                     params_first("height", 240), params_first("options", ""))
   2.177  
   2.178 -        self.log.info("Play %s", outfd.fileno())
   2.179 +        self.log.debug("Play %s", outfd.fileno())
   2.180          self.stream_data.Sink.set_property("fd", outfd.fileno())
   2.181          self.log.info("Setting Pipeline state to PLAYING")
   2.182          self.stream_data.Pipe.set_state(gst.STATE_PLAYING)
   2.183  
   2.184          # keep playing until EOS
   2.185          self.stream_data.Loop.run()
   2.186 -        self.log.info("quit loop")
   2.187 -
   2.188          return True
   2.189      # start()
   2.190