--- /dev/null
+#!/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
--- /dev/null
+#!/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 \
+
--- /dev/null
+#!/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
+
--- /dev/null
+#!/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
+
--- /dev/null
+#!/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
--- /dev/null
+#!/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
--- /dev/null
+#!/bin/sh
+
+gst-launch tcpclientsrc host=127.0.0.1 port=9000 \
+ ! ffdec_h264 ! xvimagesink
+
--- /dev/null
+#!/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 \
--- /dev/null
+#!/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
# -*- coding: utf-8 -*-
+
from xmltodict import *
from tools import *
from acpi import *
from PyRSS2Gen import *
from logger import Logger
+from status import *
# -*- 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,
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 != []
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()
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
-
-