Skip to content

Commit

Permalink
Merge pull request timvideos#26 from hyades/master
Browse files Browse the repository at this point in the history
Updated Readme, fixes
  • Loading branch information
mithro committed Nov 5, 2014
2 parents 9a135ae + 574955a commit 1fce46d
Show file tree
Hide file tree
Showing 13 changed files with 307 additions and 95 deletions.
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ imgurbash.sh.*
/configure
/depcomp
/docs/_build
/gstreamer
/gst-plugins-base
/gst-plugins-good
/gst-plugins-bad
/gst-plugins-base
/libvpx
/html
/htmlcov
/install-sh
Expand Down
3 changes: 1 addition & 2 deletions .travis-run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,7 @@ case $TEST in
printf "Tests failed!\n"
exit -1
}
cd ../tools
coveralls -r .
coveralls -n -r $HOME/gst-switch-coverage
esac
esac || {
printf "Failed!\n!\n"
Expand Down
12 changes: 7 additions & 5 deletions .travis-setup.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#! /bin/bash -ex

sudo apt-get update
sudo apt-get -y upgrade
sudo pip install mock
sudo pip install pytest-cov
sudo pip install pytest-pep8
Expand All @@ -12,6 +11,8 @@ sudo apt-get -y install python-scipy ffmpeg
sudo apt-get -y install autoconf automake autopoint libbz2-dev libdv4-dev libfaac-dev libfaad-dev libgtk-3-dev libmjpegtools-dev libtag1-dev libasound2-dev libtool libvpx-dev libxv-dev libx11-dev libogg-dev libvorbis-dev libopencv-dev libcv-dev libhighgui-dev libv4l-dev pkg-config zlib1g-dev gtk-doc-tools yasm bison flex
export PKG_CONFIG_PATH=/usr/lib/pkgconfig/
export LD_LIBRARY_PATH=/usr/lib/
export GCOV_PREFIX=$HOME/gst-switch-coverage
cd ..
git clone http://git.chromium.org/webm/libvpx.git
cd libvpx
git checkout v1.2.0
Expand All @@ -28,7 +29,7 @@ sudo make install || {
cd ..
git clone git://anongit.freedesktop.org/gstreamer/gstreamer
cd gstreamer
# git checkout 6c11da1
git checkout 6c11da1
./autogen.sh --prefix=/usr || {
printf "Failed to do autogen!!!\n"
exit -1
Expand All @@ -49,7 +50,7 @@ sudo make install || {
cd ..
git clone git://anongit.freedesktop.org/gstreamer/gst-plugins-base
cd gst-plugins-base
# git checkout a8df760
git checkout a8df760
./autogen.sh --prefix=/usr || {
printf "Failed to do autogen!!!\n"
exit -1
Expand All @@ -70,7 +71,7 @@ sudo make install || {
cd ..
git clone git://anongit.freedesktop.org/gstreamer/gst-plugins-good
cd gst-plugins-good
# git checkout d14d4c4
git checkout d14d4c4
./autogen.sh --enable-experimental --prefix=/usr || {
printf "Failed to do autogen!!!\n"
exit -1
Expand All @@ -91,7 +92,7 @@ sudo make install || {
cd ..
git clone git://anongit.freedesktop.org/gstreamer/gst-plugins-ugly
cd gst-plugins-ugly
# git checkout 68985ba
git checkout 68985ba
./autogen.sh --prefix=/usr || {
printf "Failed to do autogen!!!\n"
exit -1
Expand Down Expand Up @@ -130,6 +131,7 @@ sudo make install || {
exit -1
}
cd ..
cd gst-switch
./autogen.sh --prefix=/usr || {
printf "Failed to do autogen!!!\n"
exit -1
Expand Down
6 changes: 3 additions & 3 deletions docs/FORKING.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
##Forking Gst-Switch

To fork this project, click the "Fork" button at [Gst-Switch Github Page](https://github.com/hyades/gst-switch "").
To fork this project, click the "Fork" button at [Gst-Switch Github Page](https://github.com/timvideos/gst-switch "").
![forking](https://github-images.s3.amazonaws.com/help/Bootcamp-Fork.png "forking")

Refer to the [Github Documentation](https://help.github.com/articles/fork-a-repo "") for further details.

##Running Tests

* Install gst-switch using instructions at [README.md](https://github.com/hyades/gst-switch/blob/master/README.md "").
* Install gst-switch using instructions at [README.md](https://github.com/timvideos/gst-switch/blob/master/README.md "").
* `cd python-api`
* make test
* For specific tests refer to [Python-API Readme](https://github.com/hyades/gst-switch/blob/master/python-api/README.md "").
* For specific tests refer to [Python-API Readme](https://github.com/timvideos/gst-switch/blob/master/python-api/README.md "").

##Sending Pull Requests for Changes

Expand Down
2 changes: 1 addition & 1 deletion python-api/.pylintrc_gstswitch
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ load-plugins=
# can either give multiple identifier separated by comma (,) or put this option
# multiple time (only on the command line, not in the configuration file where
# it should appear only once).
disable=E0611,E0202,R0801,E1101,E1002
disable=E0611,E0202,R0801,E1101,E1002,R0904


[REPORTS]
Expand Down
2 changes: 1 addition & 1 deletion python-api/.pylintrc_integrationtests
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ load-plugins=
# can either give multiple identifier separated by comma (,) or put this option
# multiple time (only on the command line, not in the configuration file where
# it should appear only once).
disable=E0611,E0202,R0801,E1101,E1002,R0201,F0401,W0141
disable=E0611,E0202,R0801,E1101,E1002,R0201,F0401,W0141,R0904


[REPORTS]
Expand Down
2 changes: 1 addition & 1 deletion python-api/.pylintrc_unittests
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ load-plugins=
# can either give multiple identifier separated by comma (,) or put this option
# multiple time (only on the command line, not in the configuration file where
# it should appear only once).
disable=E0611,E0202,R0801,E1101,E1002,R0201,W0613,W0212,R0923
disable=E0611,E0202,R0801,E1101,E1002,R0201,W0613,W0212,R0923,R0904


[REPORTS]
Expand Down
103 changes: 103 additions & 0 deletions python-api/scripts/switch_infinite_test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
#!/usr/bin/env python

import sys
import os
sys.path.insert(0, os.path.abspath(os.path.join(__file__, "../..")))
# should be in PYTHONPATH
from gstswitch.server import Server
from gstswitch.testsource import BasePipeline
from gstswitch.helpers import *
from gstswitch.controller import Controller
import gi
import subprocess
import time
import psutil
gi.require_version('Gst', '1.0')
from gi.repository import GObject, Gst
GObject.threads_init()
Gst.init(None)





PATH = '/usr/bin/'
INTERVAL = 1.0




s = Server(path=PATH)
v_port = s.video_port
a_port = s.audio_port
try:
s.run()

cmd_vid1 = PATH
cmd_vid2 = PATH
cmd_vid1 += """gst-launch-1.0 videotestsrc pattern=1 ! \
video/x-raw, width=300, height=200 !\
gdppay !
tcpclientsink port={0}
""".format(v_port)
print cmd_vid1

cmd_vid2 += """gst-launch-1.0 videotestsrc ! \
video/x-raw, width=300, height=200 !\
gdppay !
tcpclientsink port={0}
""".format(v_port)
print cmd_vid2

vid1 = subprocess.Popen(
cmd_vid1.split(),
bufsize=-1,
shell=False)
vid2 = subprocess.Popen(
cmd_vid2.split(),
bufsize=-1,
shell=False)
time.sleep(1)
sources = TestSources(audio_port=a_port)
sources.new_test_audio()
sources.new_test_audio()

controller = Controller()
controller.establish_connection()

cmd = PATH
cmd += """gst-switch-ui"""
cmd = " ".join(cmd.split())
with open('ui.log', 'w') as tempf:
ui_process = subprocess.Popen(
cmd.split(),
stdout=tempf,
stderr=tempf,
bufsize=-1,
shell=False)

params = [(65,3004), (65, 3003)]
i = 0
p = psutil.Process(s.pid)
cpu_usage_file = open("cpu.log", "w")
while 1:
# print i
cpu = p.get_cpu_percent(interval=INTERVAL)
mem = p.get_memory_percent()
print cpu
print mem
cpu_usage_file.write(str(cpu) + '\n' + str(mem) + '\n')
controller.switch(params[i][0], params[i][1])
# time.sleep(1)
i+=1
i%=2

#end all
sources.terminate_audio()
vid1.terminate()
vid2.terminate()
s.terminate()
finally:
if s.proc:
s.kill()

4 changes: 2 additions & 2 deletions python-api/tests/unittests/test_testsource_unit.py
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@ def test_blank(self):

def test_range(self):
"""Test when frequency is not in range (negative)"""
tests = [-100, -1]
tests = [-100, -1]
port = 4000
for test in tests:
with pytest.raises(RangeError):
Expand Down Expand Up @@ -423,7 +423,7 @@ class TestAudioSrcWave(object):

def test_range(self):
"""Test when wave is not in range"""
tests = [-100, -1, 13, 1e2, '1e10']
tests = [-100, -1, 13, 1e2, '1e10']
port = 4000
for test in tests:
with pytest.raises(RangeError):
Expand Down
2 changes: 1 addition & 1 deletion scripts/apps/app_stage.sh
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ function clone-project()

function clone-duzy-project()
{
clone-project https://github.com/hyades $1 .git
clone-project https://github.com/timvideos $1 .git
}

function clone-gst-project()
Expand Down
4 changes: 2 additions & 2 deletions scripts/install2.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
mkdir build
cd build
sudo apt-get install git python-pip
git clone https://github.com/hyades/gst-switch.git
git clone https://github.com/timvideos/gst-switch.git
cd gst-switch
chmod +x .travis-setup.sh
./.travis-setup.sh
./.travis-setup.sh
17 changes: 16 additions & 1 deletion tools/gstswitchcapture.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ G_DEFINE_TYPE (GstSwitchCaptureWorker, gst_switch_capture_worker,
gboolean verbose = FALSE;
const char *device = "/dev/ttyUSB0";
const char *protocol = "visca";
const char **srcsegments = NULL;
int srcsegmentc = 0;

static GOptionEntry options[] = {
{"verbose", 'v', 0, G_OPTION_ARG_NONE, &verbose, "Be verbose", NULL},
Expand Down Expand Up @@ -119,7 +121,15 @@ gst_switch_capture_pipeline (GstWorker * worker, GstSwitchCapture * capture)
"filesrc location=\"/home/duzy/Downloads/locked-mode-7010.dv\" ");
g_string_append_printf (desc, "! dvdemux ! dvdec ");
} else {
g_string_append_printf (desc, "v4l2src ! tee name=video ");
if (0 < srcsegmentc && srcsegments) {
int n = 0;
for (; n < srcsegmentc; ++n) {
g_string_append_printf (desc, "%s ", srcsegments[n]);
}
} else {
g_string_append_printf (desc, "v4l2src ");
}
g_string_append_printf (desc, "! tee name=video ");
}

g_string_append_printf (desc, "video. ! queue2 ");
Expand Down Expand Up @@ -459,6 +469,11 @@ main (int argc, char **argv)
gst_switch_capture_parse_args (&argc, &argv);
gst_init (&argc, &argv);

if (1 < argc) {
srcsegments = (const char **) (argv + 1);
srcsegmentc = argc - 1;
}

capture = GST_SWITCH_CAPTURE (g_object_new (GST_TYPE_SWITCH_CAPTURE, NULL));

gst_switch_capture_run (capture);
Expand Down
Loading

0 comments on commit 1fce46d

Please sign in to comment.