]> git.parisson.com Git - telecaster-client.git/commitdiff
add test video scripts, cleanup
authoryomguy <yomguy@parisson.com>
Wed, 7 Mar 2012 08:49:59 +0000 (09:49 +0100)
committeryomguy <yomguy@parisson.com>
Wed, 7 Mar 2012 08:49:59 +0000 (09:49 +0100)
12 files changed:
conf/home/fluxbox/telecaster/rtpx264.sh [new file with mode: 0755]
conf/home/fluxbox/telecaster/rtpx264_pl.sh [new file with mode: 0755]
conf/home/fluxbox/telecaster/tc_video_alsa_webm_stream.sh [new file with mode: 0755]
conf/home/fluxbox/telecaster/tc_video_only_simple_webm.sh [new file with mode: 0755]
conf/home/fluxbox/telecaster/tcp2x.sh [new file with mode: 0755]
conf/home/fluxbox/telecaster/x264_2.sh [new file with mode: 0755]
conf/home/fluxbox/telecaster/x264_pl2.sh [new file with mode: 0755]
conf/home/fluxbox/telecaster/x264_relay.sh [new file with mode: 0755]
conf/home/fluxbox/telecaster/x264_relay_x.sh [new file with mode: 0755]
telecaster/tools/__init__.py
telecaster/tools/tools.py
telecaster/views.py

diff --git a/conf/home/fluxbox/telecaster/rtpx264.sh b/conf/home/fluxbox/telecaster/rtpx264.sh
new file mode 100755 (executable)
index 0000000..e3ca8cf
--- /dev/null
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+gst-launch -v  gstrtpbin name=rtpbin \
+ v4l2src ! video/x-raw-yuv,width=640,height=480 \
+ ! queue ! x264enc byte-stream=true bitrate=500 bframes=4 ref=4 me=hex subme=4 weightb=true threads=4 ! rtph264pay \
+ ! rtpbin.send_rtp_sink_0 \
+ rtpbin.send_rtp_src_0 ! udpsink port=5000 host=127.0.0.1 \
+ rtpbin.send_rtcp_src_0 ! udpsink port=5001 host=127.0.0.1 sync=false async=false  \
+ udpsrc port=5002 ! rtpbin.recv_rtcp_sink_0 
\ No newline at end of file
diff --git a/conf/home/fluxbox/telecaster/rtpx264_pl.sh b/conf/home/fluxbox/telecaster/rtpx264_pl.sh
new file mode 100755 (executable)
index 0000000..c4445cd
--- /dev/null
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+gst-launch -v gstrtpbin name=rtpbin latency=200 \
+ udpsrc caps="application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)H264, payload=(int)96" port=5000 \
+ ! rtpbin.recv_rtp_sink_0 \
+ rtpbin. ! rtph264depay ! queue ! tee name=t ! ffdec_h264 ! xvimagesink \
+ t. ! queue ! filesink location=/tmp/video.mp4 \
+ udpsrc port=5001 ! rtpbin.recv_rtcp_sink_0 \
+ rtpbin.send_rtcp_src_0 ! udpsink port=5002 host=127.0.0.1 sync=false async=false \
diff --git a/conf/home/fluxbox/telecaster/tc_video_alsa_webm_stream.sh b/conf/home/fluxbox/telecaster/tc_video_alsa_webm_stream.sh
new file mode 100755 (executable)
index 0000000..7754217
--- /dev/null
@@ -0,0 +1,18 @@
+#!/bin/sh
+
+# Start TeleCaster video channel
+
+WIDTH=320
+HEIGHT=240
+#WIDTH=1024
+#HEIGHT=576
+
+gst-launch v4l2src device=/dev/video0 ! video/x-raw-yuv, width=$WIDTH, height=$HEIGHT  \
+       ! queue ! ffmpegcolorspace \
+       ! queue ! vp8enc speed=2 threads=2 quality=9.0 ! queue ! muxout. \
+       alsasrc device=hw:0 \
+       ! queue ! audioconvert ! queue ! vorbisenc quality=0.3 ! queue ! muxout.  \
+       webmmux streamable=true name=muxout \
+       ! queue ! tcpserversink host=127.0.0.1 port=9000 protocol=none \
+       > /dev/null 
+
diff --git a/conf/home/fluxbox/telecaster/tc_video_only_simple_webm.sh b/conf/home/fluxbox/telecaster/tc_video_only_simple_webm.sh
new file mode 100755 (executable)
index 0000000..7c92b88
--- /dev/null
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+# Start TeleCaster video channel
+
+WIDTH=640
+HEIGHT=480
+#WIDTH=1024
+#HEIGHT=576
+
+gst-launch v4l2src device=/dev/video0 ! video/x-raw-yuv, width=$WIDTH, height=$HEIGHT  \
+       ! queue ! ffmpegcolorspace \
+       ! queue ! vp8enc speed=2 threads=4 quality=5.0 ! queue ! muxout. \
+       webmmux streamable=true name=muxout \
+       ! queue ! tcpserversink host=127.0.0.1 port=9000 protocol=none 
+
diff --git a/conf/home/fluxbox/telecaster/tcp2x.sh b/conf/home/fluxbox/telecaster/tcp2x.sh
new file mode 100755 (executable)
index 0000000..8e61926
--- /dev/null
@@ -0,0 +1,8 @@
+#!/bin/sh
+
+gst-launch tcpclientsrc host=192.168.0.18 port=9000 \
+    ! matroskademux \
+    ! vp8dec ! ffmpegcolorspace \
+    ! ximagesink
+
+# tcpclientsrc host=192.168.0.18 port=9000 protocol=none \
\ No newline at end of file
diff --git a/conf/home/fluxbox/telecaster/x264_2.sh b/conf/home/fluxbox/telecaster/x264_2.sh
new file mode 100755 (executable)
index 0000000..ae35e7c
--- /dev/null
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+gst-launch v4l2src ! video/x-raw-yuv,width=640,height=480 \
+ ! queue ! x264enc byte-stream=true bitrate=500 bframes=4 ref=4 me=hex subme=4 weightb=true threads=4 \
+ ! tcpserversink host=127.0.0.1 port=9000 protocol=none
diff --git a/conf/home/fluxbox/telecaster/x264_pl2.sh b/conf/home/fluxbox/telecaster/x264_pl2.sh
new file mode 100755 (executable)
index 0000000..8595bed
--- /dev/null
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+gst-launch tcpclientsrc host=127.0.0.1 port=9000 \
+  ! ffdec_h264 ! xvimagesink 
diff --git a/conf/home/fluxbox/telecaster/x264_relay.sh b/conf/home/fluxbox/telecaster/x264_relay.sh
new file mode 100755 (executable)
index 0000000..8d1a65b
--- /dev/null
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+gst-launch tcpclientsrc host=192.168.0.18 port=9000 \
+    ! matroskademux \
+    ! queue ! vp8dec \
+    ! queue ! ffmpegcolorspace \
+    ! queue ! x264enc bitrate=200 bframes=4 ref=4 me=hex subme=4 weightb=true threads=0 ! muxout. \
+       mp4mux name=muxout \
+       ! queue ! filesink location=/tmp/video.mp4
+
+# tcpclientsrc host=192.168.0.18 port=9000 protocol=none \
diff --git a/conf/home/fluxbox/telecaster/x264_relay_x.sh b/conf/home/fluxbox/telecaster/x264_relay_x.sh
new file mode 100755 (executable)
index 0000000..3a30d1b
--- /dev/null
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+gst-launch tcpclientsrc host=192.168.0.18 port=9000 \
+    ! matroskademux \
+    ! vp8dec ! ffmpegcolorspace \
+    ! queue ! x264enc \
+    ! queue ! vdpauh264dec ! ffmpegcolorspace ! ximagesink
+
+# tcpclientsrc host=192.168.0.18 port=9000 protocol=none \
\ No newline at end of file
index 40a61991e6e19a102b4e5b1d44d58e08b09f8ca6..6459fc4d186d89099465266f53ac526ab019bb1b 100644 (file)
@@ -1,6 +1,8 @@
 # -*- coding: utf-8 -*-
+
 from xmltodict import *
 from tools import *
 from acpi import *
 from PyRSS2Gen import *
 from logger import Logger
+from status import *
index 09504cdefe7c87d04dfcd8319fd3345fb45d1e93..0765a0fb863396cc17177e999689a87e2a9ff02c 100644 (file)
@@ -2,9 +2,9 @@
 # -*- coding: utf-8 -*-
 # *-* coding: utf-8 *-*
 """
-   teleoddcast
+   TeleCaster
 
-   Copyright (c) 2006-2007 Guillaume Pellerin <yomguy@altern.org>
+   Copyright (c) 2006-2012 Guillaume Pellerin <yomguy@altern.org>
 
 # This software is governed by the CeCILL  license under French law and
 # abiding by the rules of distribution of free software.  You can  use,
@@ -165,64 +165,3 @@ def norm_string(string):
     pass
 
 
-class Status(object):
-
-    interfaces = ['eth0', 'eth1', 'eth2', 'eth0-eth2', 'eth3', 'wlan0', 'wlan1']
-    acpi_states = {0: 'battery', 1: 'battery', 2: 'AC'}
-
-    def __init__(self):
-        self.acpi = acpi.Acpi()
-        self.uid = os.getuid()
-        self.user = pwd.getpwuid(os.getuid())[0]
-        self.user_dir = '/home' + os.sep + self.user + os.sep + '.telecaster'
-
-    def update(self):
-        self.acpi.update()
-        try:
-            self.temperature = self.acpi.temperature(0)
-        except:
-            self.temperature = 'N/A'
-        self.get_ids()
-        self.get_hosts()
-
-    def to_dict(self):
-        status = [
-          {'id': 'name', 'class': 'default', 'value': self.name, 'label': 'Name'},
-          {'id': 'ip', 'class': 'default', 'value': self.ip, 'label': 'IP address'},
-          {'id': 'acpi_state','class': 'default', 'value': self.acpi_states[self.acpi.charging_state()], 'label': 'Power'},
-          {'id': 'acpi_percent', 'class': 'default', 'value': str(self.acpi.percent()), 'label': 'Charge (%)'},
-          {'id': 'temperature', 'class': 'default', 'value': self.temperature, 'label': 'Temperature'},
-          {'id': 'jack_state', 'class': 'default', 'value': self.jacking, 'label': 'Jack server'},
-          {'id': 'encoder_state','class': 'default', 'value': self.writing, 'label': 'Encoder'},
-          {'id': 'casting', 'class': 'default', 'value': self.casting, 'label': 'Broadcaster'},
-          {'id': 'writing', 'class': 'default', 'value': self.writing, 'label': 'Recorder'},
-          ]
-
-        for stat in status:
-            if stat['value'] == False or stat['value'] == 'localhost' or stat['value'] == 'battery':
-                stat['class'] = 'warning'
-
-        return status
-
-    def get_hosts(self):
-        ip = ''
-        for interface in self.interfaces:
-            try:
-                ip = get_ip_address(interface)
-                if ip:
-                    self.ip = ip
-                break
-            except:
-                self.ip = '127.0.0.1'
-        self.url = 'http://' + self.ip
-        self.name = get_hostname()
-
-    def get_ids(self):
-        edcast_pid = get_pid('edcast_jack', self.uid)
-        deefuzzer_pid = get_pid('/usr/bin/deefuzzer '+self.user_dir+os.sep+'deefuzzer.xml', self.uid)
-        jackd_pid = get_pid('jackd', self.uid)
-        if jackd_pid == []:
-            jackd_pid = get_pid('jackdbus', self.uid)
-        self.writing = edcast_pid != []
-        self.casting = deefuzzer_pid != []
-        self.jacking = jackd_pid != []
index 6aa4d2870214315b26278dffad106e1758c9bdcb..6de23a9fa15284d95ebee9103d67baa869eb3ace 100644 (file)
@@ -100,7 +100,7 @@ class WebView(object):
         return host
 
     @jsonrpc_method('telecaster.get_server_status')
-    def get_server_status_json(request):
+    def get_server_status(request):
         status = Status()
         status.update()
         return status.to_dict()
@@ -110,12 +110,10 @@ class WebView(object):
         return self.status
 
     @jsonrpc_method('telecaster.get_station_status')
-    def get_station_status_json(request):
+    def get_station_status(request):
         stations = Station.objects.filter(started=True)
         if stations:
             station = stations[0].to_dict()
         else:
             station = {}
         return station
-
-