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: 901b3cb0ccf1
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: f753aea5aecb
Choose a head ref
  • 7 commits
  • 4 files changed
  • 2 contributors

Commits on Jan 9, 2015

  1. Refactor/simplify gstreamer pipeline string generation

    Add tests for gst_pipeline_string (in GstCase)
    @todo: right now these don't actually test anything, but do output the resulting strings.
    David Nugent committed Jan 9, 2015
    Copy the full SHA
    d07b60b View commit details

Commits on Jan 10, 2015

  1. Compatibility fixes discovered by output comparisons.

    David Nugent committed Jan 10, 2015
    Copy the full SHA
    440d763 View commit details
  2. Add wildcard to cover numeric suffix on test data.

    David Nugent committed Jan 10, 2015

    Unverified

    This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
    Copy the full SHA
    4b53836 View commit details
  3. Fix BRANCH_PREVIEW

    David Nugent committed Jan 10, 2015
    Copy the full SHA
    5cdcf42 View commit details
  4. Include changes to branch/audio

    David Nugent committed Jan 10, 2015
    Copy the full SHA
    65c1938 View commit details
  5. Merge remote-tracking branch 'upstream/master' into refactor-gst-pipe…

    …line-string-simple
    
    Conflicts:
    	tools/gstcase.c
    David Nugent committed Jan 10, 2015
    Copy the full SHA
    8e46d5a View commit details
  6. Merge pull request #104 from deeprave/refactor-gst-pipeline-string-si…

    …mple
    
    Refactor gst pipeline string simple
    mithro committed Jan 10, 2015
    Copy the full SHA
    f753aea View commit details
Showing with 299 additions and 141 deletions.
  1. +1 −1 tests/.gitignore
  2. +7 −0 tests/unit/Makefile.am
  3. +240 −0 tests/unit/test_gst_pipeline_string.c
  4. +51 −140 tools/gstcase.c
2 changes: 1 addition & 1 deletion tests/.gitignore
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@
/Makefile.in
/.deps
/tools
/test-recording*.data
/test-recording*.data*
/test-server-*.log
/test-fd-leaks
/tests
7 changes: 7 additions & 0 deletions tests/unit/Makefile.am
Original file line number Diff line number Diff line change
@@ -13,13 +13,20 @@ test_gstcomposite_CFLAGS = $(GST_CFLAGS) $(GST_BASE_CFLAGS) \
$(GCOV_CFLAGS) $(GST_PLUGINS_BASE_CFLAGS) -DLOG_PREFIX="\"./tests\""
test_gstcomposite_LDFLAGS = $(GCOV_LFLAGS)

test_gst_pipeline_string_SOURCES = test_gst_pipeline_string.c ../../tools/gstworker.c
test_gst_pipeline_string_CFLAGS = $(GST_CFLAGS) $(GST_BASE_CFLAGS) \
$(GCOV_CFLAGS) $(GST_PLUGINS_BASE_CFLAGS) -DLOG_PREFIX="\"./tests\""
test_gst_pipeline_string_LDFLAGS = $(GCOV_LFLAGS)


dist_test_data = \
$(NULL)

test_programs = \
test_gstswitchopts \
test_gstrecorder_filename \
test_gstcomposite \
test_gst_pipeline_string \
$(NULL)

if GCOV_ENABLED
240 changes: 240 additions & 0 deletions tests/unit/test_gst_pipeline_string.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,240 @@

#include "tools/gstcase.c"
#include <stdio.h>

gboolean verbose = FALSE;

static gchar *results[GST_CASE__LAST_TYPE + 1] = {
// GST_CASE_UNKNOWN
NULL,
// GST_CASE_COMPOSITE_VIDEO_A
NULL,
// GST_CASE_COMPOSITE_VIDEO_B
NULL,
// GST_CASE_COMPOSITE_AUDIO
NULL,
// GST_CASE_PREVIEW
NULL,
// GST_CASE_INPUT_AUDIO
NULL,
// GST_CASE_INPUT_VIDEO
NULL,
// GST_CASE_BRANCH_VIDEO_A
NULL,
// GST_CASE_BRANCH_VIDEO_B
NULL,
// GST_CASE_BRANCH_AUDIO
NULL,
// GST_CASE_BRANCH_PREVIEW
NULL
};

static gchar *
expected_string (int case_type, int serve_type)
{
switch (case_type) {
case GST_CASE_PREVIEW: // special case
if (serve_type == GST_SERVE_VIDEO_STREAM)
return "";
return "";
case GST_CASE_COMPOSITE_VIDEO_A:
case GST_CASE_COMPOSITE_VIDEO_B:
case GST_CASE_COMPOSITE_AUDIO:
case GST_CASE_INPUT_AUDIO:
case GST_CASE_INPUT_VIDEO:
case GST_CASE_BRANCH_VIDEO_A:
case GST_CASE_BRANCH_VIDEO_B:
case GST_CASE_BRANCH_AUDIO:
case GST_CASE_BRANCH_PREVIEW:
return results[case_type];
}
return NULL;
}


static GstCase *
new_case (int case_type, int serve_type)
{
switch (serve_type) {
case GST_SERVE_AUDIO_STREAM:
return GST_CASE (g_object_new (GST_TYPE_CASE,
"name", "audio", "type", case_type, "serve", serve_type,
"port", 1234, NULL));
case GST_SERVE_VIDEO_STREAM:
return GST_CASE (g_object_new (GST_TYPE_CASE,
"name", "video", "type", case_type, "serve", serve_type,
"width", 640, "height", 480, "port", 1234, NULL));
}
return NULL;
}

static void
test_get_pipeline_string_input_audio (void)
{
GstCase *cas = new_case (GST_CASE_INPUT_AUDIO, GST_SERVE_AUDIO_STREAM);
GString *desc = gst_case_get_pipeline_string (cas);
g_assert (desc != NULL && strlen (desc->str) > 0);
//g_assert_cmpstr(expected_string(GST_CASE_INPUT_AUDIO, GST_SERVE_AUDIO_STREAM), ==, desc->str);
printf ("\nGST_CASE_INPUT_AUDIO: %s\n", desc->str);
g_string_free (desc, TRUE);
g_object_unref (cas);
}

static void
test_get_pipeline_string_input_video (void)
{
GstCase *cas = new_case (GST_CASE_INPUT_VIDEO, GST_SERVE_VIDEO_STREAM);
GString *desc = gst_case_get_pipeline_string (cas);
g_assert (desc != NULL && strlen (desc->str) > 0);
//g_assert_cmpstr(expected_string(GST_CASE_INPUT_VIDEO, GST_SERVE_VIDEO_STREAM), ==, desc->str);
printf ("\nGST_CASE_INPUT_VIDEO: %s\n", desc->str);
g_string_free (desc, TRUE);
g_object_unref (cas);
}

static void
test_get_pipeline_string_preview_video (void)
{
GstCase *cas = new_case (GST_CASE_PREVIEW, GST_SERVE_VIDEO_STREAM);
GString *desc = gst_case_get_pipeline_string (cas);
g_assert (desc != NULL && strlen (desc->str) > 0);
//g_assert_cmpstr(expected_string(GST_CASE_PREVIEW, GST_SERVE_VIDEO_STREAM), ==, desc->str);
printf ("\nGST_CASE_PREVIEW/V: %s\n", desc->str);
g_string_free (desc, TRUE);
g_object_unref (cas);
}

static void
test_get_pipeline_string_preview_audio (void)
{
GstCase *cas = new_case (GST_CASE_PREVIEW, GST_SERVE_AUDIO_STREAM);
GString *desc = gst_case_get_pipeline_string (cas);
g_assert (desc != NULL && strlen (desc->str) > 0);
//g_assert_cmpstr(expected_string(GST_CASE_PREVIEW, GST_SERVE_AUDIO_STREAM), ==, desc->str);
printf ("\nGST_CASE_PREVIEW/A: %s\n", desc->str);
g_string_free (desc, TRUE);
g_object_unref (cas);
}

static void
test_get_pipeline_string_composite_audio (void)
{
GstCase *cas = new_case (GST_CASE_COMPOSITE_AUDIO, GST_SERVE_AUDIO_STREAM);
GString *desc = gst_case_get_pipeline_string (cas);
g_assert (desc != NULL && strlen (desc->str) > 0);
//g_assert_cmpstr(expected_string(GST_CASE_COMPOSITE_AUDIO, GST_SERVE_AUDIO_STREAM), ==, desc->str);
printf ("\nGST_CASE_COMPOSITE_AUDIO: %s\n", desc->str);
g_string_free (desc, TRUE);
g_object_unref (cas);
}

static void
test_get_pipeline_string_composite_video_a (void)
{
GstCase *cas = new_case (GST_CASE_COMPOSITE_VIDEO_A, GST_SERVE_VIDEO_STREAM);
GString *desc = gst_case_get_pipeline_string (cas);
g_assert (desc != NULL && strlen (desc->str) > 0);
//g_assert_cmpstr(expected_string(GST_CASE_COMPOSITE_VIDEO_A, GST_SERVE_VIDEO_STREAM), ==, desc->str);
printf ("\nGST_CASE_COMPOSITE_VIDEO_A: %s\n", desc->str);
g_string_free (desc, TRUE);
g_object_unref (cas);
}

static void
test_get_pipeline_string_composite_video_b (void)
{
GstCase *cas = new_case (GST_CASE_COMPOSITE_VIDEO_B, GST_SERVE_VIDEO_STREAM);
GString *desc = gst_case_get_pipeline_string (cas);
g_assert (desc != NULL && strlen (desc->str) > 0);
//g_assert_cmpstr(expected_string(GST_CASE_COMPOSITE_VIDEO_B, GST_SERVE_VIDEO_STREAM), ==, desc->str);
printf ("\nGST_CASE_COMPOSITE_VIDEO_B: %s\n", desc->str);
g_string_free (desc, TRUE);
g_object_unref (cas);
}

static void
test_get_pipeline_string_branch_video_a (void)
{
GstCase *cas = new_case (GST_CASE_BRANCH_VIDEO_A, GST_SERVE_VIDEO_STREAM);
GString *desc = gst_case_get_pipeline_string (cas);
g_assert (desc != NULL && strlen (desc->str) > 0);
//g_assert_cmpstr(expected_string(GST_CASE_BRANCH_VIDEO_A, GST_SERVE_VIDEO_STREAM), ==, desc->str);
printf ("\nGST_CASE_BRANCH_VIDEO_A: %s\n", desc->str);
g_string_free (desc, TRUE);
g_object_unref (cas);
}

static void
test_get_pipeline_string_branch_video_b (void)
{
GstCase *cas = new_case (GST_CASE_BRANCH_VIDEO_B, GST_SERVE_VIDEO_STREAM);
GString *desc = gst_case_get_pipeline_string (cas);
g_assert (desc != NULL && strlen (desc->str) > 0);
//g_assert_cmpstr(expected_string(GST_CASE_BRANCH_VIDEO_B, GST_SERVE_VIDEO_STREAM), ==, desc->str);
printf ("\nGST_CASE_BRANCH_VIDEO_B: %s\n", desc->str);
g_string_free (desc, TRUE);
g_object_unref (cas);
}

static void
test_get_pipeline_string_branch_preview (void)
{
GstCase *cas = new_case (GST_CASE_BRANCH_PREVIEW, GST_SERVE_VIDEO_STREAM);
GString *desc = gst_case_get_pipeline_string (cas);
g_assert (desc != NULL && strlen (desc->str) > 0);
//g_assert_cmpstr(expected_string(GST_CASE_BRANCH_PREVIEW, GST_SERVE_VIDEO_STREAM), ==, desc->str);
printf ("\nGST_CASE_BRANCH_PREVIEW: %s\n", desc->str);
g_string_free (desc, TRUE);
g_object_unref (cas);
}

static void
test_get_pipeline_string_branch_audio (void)
{
GstCase *cas = new_case (GST_CASE_BRANCH_AUDIO, GST_SERVE_AUDIO_STREAM);
GString *desc = gst_case_get_pipeline_string (cas);
g_assert (desc != NULL && strlen (desc->str) > 0);
//g_assert_cmpstr(expected_string(GST_CASE_BRANCH_AUDIO, GST_SERVE_AUDIO_STREAM), ==, desc->str);
printf ("\nGST_CASE_BRANCH_AUDIO: %s\n", desc->str);
g_string_free (desc, TRUE);
g_object_unref (cas);
}

int
main (int argc, char **argv)
{
g_test_init (&argc, &argv, NULL);
gst_init (&argc, &argv);
g_test_set_nonfatal_assertions ();
g_test_add_func ("/gstswitch/server/gstcase/get_pipeline_string/INPUT/AUDIO",
test_get_pipeline_string_input_audio);
g_test_add_func ("/gstswitch/server/gstcase/get_pipeline_string/INPUT/VIDEO",
test_get_pipeline_string_input_video);
g_test_add_func
("/gstswitch/server/gstcase/get_pipeline_string/BRANCH/PREVIEW/AUDIO",
test_get_pipeline_string_preview_audio);
g_test_add_func
("/gstswitch/server/gstcase/get_pipeline_string/BRANCH/PREVIEW/VIDEO",
test_get_pipeline_string_preview_video);
g_test_add_func
("/gstswitch/server/gstcase/get_pipeline_string/COMPOSITE/AUDIO",
test_get_pipeline_string_composite_audio);
g_test_add_func
("/gstswitch/server/gstcase/get_pipeline_string/COMPOSITE/VIDEO_A",
test_get_pipeline_string_composite_video_a);
g_test_add_func
("/gstswitch/server/gstcase/get_pipeline_string/COMPOSITE/VIDEO_B",
test_get_pipeline_string_composite_video_b);
g_test_add_func
("/gstswitch/server/gstcase/get_pipeline_string/BRANCH/VIDEO_A",
test_get_pipeline_string_branch_video_a);
g_test_add_func
("/gstswitch/server/gstcase/get_pipeline_string/BRANCH/VIDEO_B",
test_get_pipeline_string_branch_video_b);
g_test_add_func ("/gstswitch/server/gstcase/get_pipeline_string/BRANCH/AUDIO",
test_get_pipeline_string_branch_audio);
g_test_add_func
("/gstswitch/server/gstcase/get_pipeline_string/BRANCH/PREVIEW",
test_get_pipeline_string_branch_preview);
return g_test_run ();
}
Loading