Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: timvideos/gst-switch
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 47600c7db2ea
Choose a base ref
...
head repository: timvideos/gst-switch
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 67317e77206a
Choose a head ref
  • 16 commits
  • 8 files changed
  • 1 contributor

Commits on Jan 30, 2015

  1. Copy the full SHA
    8d4ed1a View commit details
  2. Ignore .cache directories too.

    mithro committed Jan 30, 2015
    Copy the full SHA
    3213b05 View commit details
  3. Copy the full SHA
    1895100 View commit details
  4. Copy the full SHA
    ea7e8dd View commit details
  5. Copy the full SHA
    4f13529 View commit details
  6. Copy the full SHA
    6f3bbdf View commit details
  7. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    4cca19a View commit details
  8. Copy the full SHA
    abd13c7 View commit details
  9. Copy the full SHA
    4fe4292 View commit details
  10. Copy the full SHA
    5675215 View commit details
  11. Copy the full SHA
    d141a38 View commit details
  12. Don't remove imgurbash.sh

    mithro committed Jan 30, 2015
    Copy the full SHA
    79e6e72 View commit details
  13. PEP8 fixes.

    mithro committed Jan 30, 2015
    Copy the full SHA
    a2ce493 View commit details
  14. Copy the full SHA
    5394f67 View commit details
  15. Copy the full SHA
    0e2da98 View commit details
  16. Merge pull request #168 from mithro/int-tests-fix

    Fixing the `python-api/tests/integrationtests`
    mithro committed Jan 30, 2015
    Copy the full SHA
    67317e7 View commit details
Showing with 83 additions and 36 deletions.
  1. +1 −0 .gitignore
  2. +2 −0 .travis-run.sh
  3. +5 −0 .travis-setup.sh
  4. +8 −6 python-api/Makefile
  5. +8 −2 python-api/gstswitch/server.py
  6. +34 −10 python-api/gstswitch/testsource.py
  7. +24 −17 python-api/tests/integrationtests/test_controller.py
  8. +1 −1 tools/Makefile.am
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -72,3 +72,4 @@ test-driver
*.avi
*.mkv
*.log
.cache
2 changes: 2 additions & 0 deletions .travis-run.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#! /bin/bash -ex

export DISPLAY=:99.0

./autogen.sh --prefix=/usr || {
printf "Failed to do autogen!!!\n"
exit -1
5 changes: 5 additions & 0 deletions .travis-setup.sh
Original file line number Diff line number Diff line change
@@ -26,3 +26,8 @@ if [ $TYPE == 'c' ]; then
else
sudo pip install python-coveralls
fi

# Start an X server so the GUI works
sudo apt-get -y install xvfb xclip
export DISPLAY=:99.0
/sbin/start-stop-daemon --start --quiet --pidfile /tmp/custom_xvfb_99.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :99 -ac -screen 0 1024x768x16
14 changes: 8 additions & 6 deletions python-api/Makefile
Original file line number Diff line number Diff line change
@@ -17,6 +17,7 @@ unittests:
@rm -rf reports
@mkdir -p reports/coverage/unittests
py.test --cov gstswitch tests/unittests/ --pep8 -v -s
#-@mv htmlcov/*.* reports/coverage/unittests

pep8:
pep8 gstswitch
@@ -26,16 +27,17 @@ pep8:
pep8 tests/integrationtests
@echo "integration tests are pep8 clean!!"

integration:
@rm -f ../tools/*.c.gcov
@rm -f ../tools/*.gcda
imgurbash.sh:
-wget http://imgur.com/tools/imgurbash.sh -O imgurbash.sh
-chmod +x imgurbash.sh

integration: imgurbash.sh
@rm -f ../tools/*.c.gcov
@rm -f ../tools/*.gcda
@rm -rf reports
@mkdir -p reports/coverage/integration
py.test --cov gstswitch tests/integrationtests/ --pep8 -s -v
-@mv htmlcov/*.* reports/coverage/integration
-rm imgurbash.sh*
#-@mv htmlcov/*.* reports/coverage/integration

performance:
py.test tests/performancetests/*.py -v -s
@@ -52,4 +54,4 @@ clean:
rm -rf .cache
rm -rf reports

test: lint unittests integration clean
test: pep8 lint unittests integration clean
10 changes: 8 additions & 2 deletions python-api/gstswitch/server.py
Original file line number Diff line number Diff line change
@@ -31,6 +31,7 @@ class Server(object):
:param controller_address: The DBus-Address for remote control -
default = tcp:host=0.0.0.0,port=5000
:param record_file: The record file format
:param video_format: The video format to use on the server.
:returns: nothing
"""
SLEEP_TIME = 0.5
@@ -41,7 +42,8 @@ def __init__(
video_port=3000,
audio_port=4000,
controller_address='tcp:host=0.0.0.0,port=5000',
record_file=False):
record_file=False,
video_format=None):

super(Server, self).__init__()

@@ -57,6 +59,7 @@ def __init__(
self.audio_port = audio_port
self.controller_address = controller_address
self.record_file = record_file
self.video_format = video_format

self.proc = None
self.pid = -1
@@ -150,7 +153,7 @@ def controller_address(self, controller_address):
self._controller_address = controller_address
except ValueError:
raise ValueError("Control Address must contain at least "
" one Colon. It is '{0}'" \
" one Colon. It is '{0}'"
.format(controller_address))

@property
@@ -226,6 +229,9 @@ def _run_process(self):
if self.record_file is not False:
cmd.append("--record={0}".format(self.record_file))

if self.video_format is not None:
cmd.append("--video-format={0}".format(self.video_format))

proc = self._start_process(cmd)
return proc

44 changes: 34 additions & 10 deletions python-api/gstswitch/testsource.py
Original file line number Diff line number Diff line change
@@ -56,7 +56,6 @@ def make(cls, elem, description=''):


class VideoPipeline(BasePipeline):

"""A Video Pipeline which can be used by a Video Test Source
:param port: The port of where the TCP stream will be sent
Should be same as video port of gst-switch-src
@@ -67,10 +66,17 @@ class VideoPipeline(BasePipeline):
:param clockoverlay: True to enable current clock time over video
"""

VIDEO_CAPS = """
video/x-raw,
format=(string)I420, pixel-aspect-ratio=(fraction)1/1,
width=(int){0}, height=(int){1},
framerate=(fraction)25/1
"""

def __init__(
self,
port,
host='localhost',
host='127.0.0.1',
width=300,
height=200,
pattern=None,
@@ -130,8 +136,7 @@ def make_capsfilter(self, width, height):
element = self.make("capsfilter", "vfilter")
width = str(width)
height = str(height)
capsstring = "video/x-raw, format=(string)I420, width={0},\
height={1}".format(width, height)
capsstring = self.VIDEO_CAPS.format(width, height)
print capsstring
caps = Gst.Caps.from_string(capsstring)
element.set_property('caps', caps)
@@ -172,13 +177,18 @@ def make_tcpclientsink(self, port):


class AudioPipeline(BasePipeline):

"""docstring for AudioPipeline"""

AUDIO_CAPS = """
audio/x-raw,
rate=48000, channels=2,
format=S16LE, layout=interleaved
"""

def __init__(
self,
port,
host='localhost',
host='127.0.0.1',
freq=110,
wave=None):
super(AudioPipeline, self).__init__()
@@ -187,13 +197,27 @@ def __init__(

src = self.make_audiotestsrc(freq, wave)
self.add(src)
afilter = self.make_capsfilter()
self.add(afilter)
src.link(afilter)
gdppay = self.make_gdppay()
self.add(gdppay)
src.link(gdppay)
afilter.link(gdppay)
sink = self.make_tcpclientsink(port)
self.add(sink)
gdppay.link(sink)

def make_capsfilter(self):
"""Return a caps filter
:returns: A caps filter element
"""
element = self.make("capsfilter", "afilter")
capsstring = self.AUDIO_CAPS
print capsstring
caps = Gst.Caps.from_string(capsstring)
element.set_property('caps', caps)
return element

def make_audiotestsrc(self, freq, wave=None):
"""Return a Audio Source Element
:freq: The Frequency
@@ -230,7 +254,7 @@ class PreviewPipeline(BasePipeline):

def __init__(self, port):
super(PreviewPipeline, self).__init__()
self.host = 'localhost'
self.host = '127.0.0.1'
self.preview_port = port
src = self.make_tcpclientsrc()
self.add(src)
@@ -305,7 +329,7 @@ class VideoSrc(object):
:param timeoverlay: True to enable a running time over video
:param clockoverlay: True to enable current clock time over video
"""
HOST = 'localhost'
HOST = '127.0.0.1'

def __init__(
self,
@@ -497,7 +521,7 @@ class AudioSrc(object):

"""docstring for AudioSrc"""

HOST = 'localhost'
HOST = '127.0.0.1'

def __init__(
self,
41 changes: 24 additions & 17 deletions python-api/tests/integrationtests/test_controller.py
Original file line number Diff line number Diff line change
@@ -4,6 +4,7 @@

import sys
import os
import pytest
sys.path.insert(0, os.path.abspath(os.path.join(__file__, "../../../")))

from gstswitch.server import Server
@@ -35,7 +36,7 @@ def establish_connection(self):

def test_establish(self):
"""Test for establish_connection"""
serv = Server(path=PATH)
serv = Server(path=PATH, video_format="debug")
try:
serv.run()
for i in range(self.NUM):
@@ -219,7 +220,7 @@ def test_get_preview_ports(self):
"""Test get_preview_ports"""

for _ in range(self.NUM):
serv = Server(path=PATH)
serv = Server(path=PATH, video_format="debug")
try:
serv.run()
sources = TestSources(video_port=3000, audio_port=4000)
@@ -280,7 +281,7 @@ def set_composite_mode(self, mode, generate_frames=False):
"""Create Controller object and call set_composite_mode method"""
for _ in range(self.NUM):

serv = Server(path=PATH)
serv = Server(path=PATH, video_format="debug")
try:
serv.run()

@@ -331,14 +332,18 @@ def verify_output(self, mode, video):
cmpr = CompareVideo(test, video)
res1, res2 = cmpr.compare()
print "RESULTS", res1, res2
folder = cmpr.test_frame_dir
cmd = "./imgurbash.sh {0}/*.*".format(folder)
print cmd
proc = subprocess.Popen(
cmd,
bufsize=-1,
shell=True)
print proc.wait()

# In the CI environment, upload to imgur the results.
if os.environ.get('CI', "False") == "true":
folder = cmpr.test_frame_dir
cmd = "./imgurbash.sh {0}/*.*".format(folder)
print cmd
proc = subprocess.Popen(
cmd,
bufsize=-1,
shell=True)
print proc.wait()

# Experimental Value
if res1 <= 0.04 and res2 <= 0.04:
return True
@@ -378,7 +383,8 @@ def new_record(self):
def test_new_record(self):
"""Test new_record"""
for _ in range(self.NUM):
serv = Server(path=PATH, record_file="test-%Y.data")
serv = Server(path=PATH, record_file="test-%Y.data",
video_format="debug")
try:
serv.run()

@@ -422,7 +428,7 @@ def adjust_pip(self,
generate_frames=False):
"""Create Controller object and call adjust_pip"""
for _ in range(self.NUM):
serv = Server(path=PATH)
serv = Server(path=PATH, video_format="debug")
try:
serv.run()
sources = TestSources(video_port=3000)
@@ -467,6 +473,7 @@ def verify_output(self, index, video):
return True
return False

@pytest.mark.xfail
def test_adjust_pip(self):
"""Test adjust_pip"""
dic = [
@@ -490,7 +497,7 @@ class TestSwitch(object):
def switch(self, channel, port, index):
"""Create Controller object and call switch method"""
for _ in range(self.NUM):
serv = Server(path=PATH)
serv = Server(path=PATH, video_format="debug")
try:
serv.run()

@@ -547,7 +554,7 @@ def click_video(self,
generate_frames=False):
"""Create Controller object and call click_video method"""
for _ in range(self.NUM):
serv = Server(path=PATH)
serv = Server(path=PATH, video_format="debug")
try:
serv.run()
sources = TestSources(video_port=3000)
@@ -616,7 +623,7 @@ class TestMarkFace(object):
def mark_face(self, faces, index, generate_frames=False):
"""Create the Controller object and call mark_face method"""
for _ in range(self.NUM):
serv = Server(path=PATH)
serv = Server(path=PATH, video_format="debug")
try:
serv.run()
sources = TestSources(video_port=3000)
@@ -679,7 +686,7 @@ class TestMarkTracking(object):
def mark_tracking(self, faces, index, generate_frames=False):
"""Create Controller object and call mark_tracking method"""
for _ in range(self.NUM):
serv = Server(path=PATH)
serv = Server(path=PATH, video_format="debug")
try:
serv.run()
sources = TestSources(video_port=3000)
2 changes: 1 addition & 1 deletion tools/Makefile.am
Original file line number Diff line number Diff line change
@@ -61,5 +61,5 @@ gst_switch_ptz_LDADD = $(GST_LIBS) $(X_LIBS) $(LIBM) $(GTK_LIBS) \

if GCOV_ENABLED
coverage:
gcov gst_switch_srv-*.o
gcov -d gst_switch_srv-*.o
endif