Changeset 320
- Timestamp:
- Jul 19, 2011, 8:05:20 PM (13 years ago)
- Location:
- py-tcpmultiplexer
- Files:
-
- 1 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
py-tcpmultiplexer/TCPMultiplexer.py
r318 r320 113 113 datatype = 'wav' 114 114 elif urltype == 'multipart/x-mixed-replace': 115 datatype = 'mj eg'115 datatype = 'mjpeg' 116 116 else: 117 117 logger.warning("Cannot find file type of '%s'", url) … … 123 123 # WAV header 124 124 dataheader[urlid] = f.read(44) 125 elif datatype == 'mjeg': 126 # Get rid of Content-Length as not all pictures suits this setup 127 headers = f.read(100).splitlines()[0:3] 125 elif datatype == 'mjpeg': 126 data = f.read(1024 * 1024) 127 128 # Get the required headers 129 headers = [] 130 for header in data.splitlines(): 131 if not header.strip(): break 132 headers.append(header) 133 boundry = headers[0] 134 logger.info("Boundry line: %s", boundry) 128 135 logger.info("Image headers %s", headers) 129 valid_image = headers[0] + f.read(100000).split(headers[0])[1] 130 dataheader[urlid] = valid_image + '\n'.join([h for h in headers if not h.startswith('Content-length:')]) + '\n' 136 137 valid_image = boundry + data.split(boundry)[1] 138 dataheader[urlid] = valid_image + '\n'.join(headers) + '\n' 131 139 else: 132 140 dataheader[urlid] = '' -
py-tcpmultiplexer/htdocs/browser.html
r319 r320 32 32 33 33 <input type="button" onclick="changeVideo('/cam1/video')" value="Click to display Cam1" /> 34 <input type="button" onclick="changeVideo('/cam2/video')" value="Click to display Cam2" /><br /> 34 <input type="button" onclick="changeVideo('/cam2/video')" value="Click to display Cam2" /> 35 <input type="button" onclick="changeVideo('/cam3/video')" value="Click to display Cam3" /> 36 <br /> 35 37 <img id="player" src="img/logo.png" alt="Video feeds"/><br/> 36 38
Note:
See TracChangeset
for help on using the changeset viewer.