From: yomguy Date: Wed, 7 Mar 2012 08:49:59 +0000 (+0100) Subject: add test video scripts, cleanup X-Git-Tag: 0.9~81 X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=a9883786c46e918457b47671ce2dc1caef2bb1bf;p=telecaster-client.git add test video scripts, cleanup --- diff --git a/conf/home/fluxbox/telecaster/rtpx264.sh b/conf/home/fluxbox/telecaster/rtpx264.sh new file mode 100755 index 0000000..e3ca8cf --- /dev/null +++ b/conf/home/fluxbox/telecaster/rtpx264.sh @@ -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 index 0000000..c4445cd --- /dev/null +++ b/conf/home/fluxbox/telecaster/rtpx264_pl.sh @@ -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 index 0000000..7754217 --- /dev/null +++ b/conf/home/fluxbox/telecaster/tc_video_alsa_webm_stream.sh @@ -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 index 0000000..7c92b88 --- /dev/null +++ b/conf/home/fluxbox/telecaster/tc_video_only_simple_webm.sh @@ -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 index 0000000..8e61926 --- /dev/null +++ b/conf/home/fluxbox/telecaster/tcp2x.sh @@ -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 index 0000000..ae35e7c --- /dev/null +++ b/conf/home/fluxbox/telecaster/x264_2.sh @@ -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 index 0000000..8595bed --- /dev/null +++ b/conf/home/fluxbox/telecaster/x264_pl2.sh @@ -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 index 0000000..8d1a65b --- /dev/null +++ b/conf/home/fluxbox/telecaster/x264_relay.sh @@ -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 index 0000000..3a30d1b --- /dev/null +++ b/conf/home/fluxbox/telecaster/x264_relay_x.sh @@ -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 diff --git a/telecaster/tools/__init__.py b/telecaster/tools/__init__.py index 40a6199..6459fc4 100644 --- a/telecaster/tools/__init__.py +++ b/telecaster/tools/__init__.py @@ -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 * diff --git a/telecaster/tools/tools.py b/telecaster/tools/tools.py index 09504cd..0765a0f 100644 --- a/telecaster/tools/tools.py +++ b/telecaster/tools/tools.py @@ -2,9 +2,9 @@ # -*- coding: utf-8 -*- # *-* coding: utf-8 *-* """ - teleoddcast + TeleCaster - Copyright (c) 2006-2007 Guillaume Pellerin + Copyright (c) 2006-2012 Guillaume Pellerin # 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 != [] diff --git a/telecaster/views.py b/telecaster/views.py index 6aa4d28..6de23a9 100644 --- a/telecaster/views.py +++ b/telecaster/views.py @@ -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 - -