[vlma-devel] commit: Fix DVB channels streaming with VLC. (Adrien Maglo )
git version control
git at videolan.org
Tue Dec 22 18:20:20 CET 2009
vlma | branch: master | Adrien Maglo <magsoft at videolan.org> | Tue Dec 22 18:22:47 2009 +0100| [65c3e921285bead5014581ae6f3adb8e90130b6e] | committer: Adrien Maglo
Fix DVB channels streaming with VLC.
> http://git.videolan.org/gitweb.cgi/vlma.git/?a=commit;h=65c3e921285bead5014581ae6f3adb8e90130b6e
---
vlma-watchdog/src/streamer/vlc.py | 36 +++++++++++++++++++++++++++---------
1 files changed, 27 insertions(+), 9 deletions(-)
diff --git a/vlma-watchdog/src/streamer/vlc.py b/vlma-watchdog/src/streamer/vlc.py
index c67f7df..715330b 100644
--- a/vlma-watchdog/src/streamer/vlc.py
+++ b/vlma-watchdog/src/streamer/vlc.py
@@ -32,7 +32,7 @@ class VLC(Streamer):
if version.find(" 0.8.") >= 0:
args = ["-vvv", "--rtsp-host", "0.0.0.0:5554", "--intf", "telnet", "--telnet-port", "%d" %self.options[VLCOption.TELNET_PORT]]
else:
- args = ["-q", "--ignore-config", "--rtsp-host", "0.0.0.0:5554", "--intf", "lua", "--lua-intf", "telnet", "--lua-config", "telnet={hosts={'*:%d'}}" %self.options[VLCOption.TELNET_PORT]]
+ args = ["-vvv", "-q", "--ignore-config", "--rtsp-host", "0.0.0.0:5554", "--intf", "lua", "--lua-intf", "telnet", "--lua-config", "telnet={hosts={'*:%d'}}" %self.options[VLCOption.TELNET_PORT]]
self.start(args)
def _get_version(self):
@@ -75,10 +75,15 @@ class VLC(Streamer):
self._waitForPrompt(myS)
def _destToSoutStr(self, dest):
- return "dst=standard{mux=%s,access=%s,dst=%s:%d}" \
- % (dest.streaming.mux, dest.streaming.protocol, dest.ip, dest.port)
-
- def start_streaming(self, order):
+ if dest.streaming.protocol == "udp":
+ ret = "dst=standard{mux=%s,access=%s,dst=%s:%d}" \
+ % (dest.streaming.mux, dest.streaming.protocol, dest.ip, dest.port)
+ elif dest.streaming.protocol == "rtp":
+ ret = "dst=rtp{mux=%s,dst=%s,port=%d}" \
+ % (dest.streaming.mux, dest.ip, dest.port)
+ return ret
+
+ def _connectToVLC(self):
# Connect to the VLC telnet interface
myS = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
myS.connect(("localhost", self.options[VLCOption.TELNET_PORT]))
@@ -86,11 +91,19 @@ class VLC(Streamer):
self._waitForPrompt(myS)
# Give the password
self._sendCmd(myS, "admin")
- # Stop the previous order with the same nane if one exists.
+ return myS
+
+ def _removeOrder(self, order, myS):
self._sendCmd(myS, "setup %s disabled" % order.id)
self._sendCmd(myS, "control %s stop" % order.id)
self._sendCmd(myS, "del %s" % order.id)
+ def start_streaming(self, order):
+ # Connect to VLC
+ myS = self._connectToVLC()
+ # Stop the previous order with the same nane if one exists.
+ self._removeOrder(order, myS)
+
# Handle DVB orders.
if isinstance(order, DVBOrder):
# TODO handle schedule and VoD ?
@@ -122,9 +135,14 @@ class VLC(Streamer):
# Start the new order.
self._sendCmd(myS, "control %s play" % order.id)
- # Close the socket connection
- myS.close()
+ # Close the telnet connection
+ myS.send("quit\n")
def stop_streaming(self, order):
- pass
+ # Connect to VLC
+ myS = self._connectToVLC()
+ # Stop and remove the order
+ self._removeOrder(order, myS)
+ # Close the telnet connection
+ myS.send("quit\n")
More information about the vlma-devel
mailing list