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: e2101ffc0a7d
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: 8c2d19140ca6
Choose a head ref
  • 2 commits
  • 3 files changed
  • 2 contributors

Commits on Jan 12, 2015

  1. Save and use the video caps string for gstreamer pipelines

     * Fix VGA => VGA@60 for default low resolution support
     * Save (and display) the caps string
     * Add function to return the caps string, use this from
       gst_case_get_pipeline_string () where required
    David Nugent committed Jan 12, 2015

    Verified

    This commit was signed with the committer’s verified signature.
    eramongodb Ezra Chung
    Copy the full SHA
    aa5e3f5 View commit details
  2. Merge pull request #120 from deeprave/caps-string-fix

    Save and use the video caps string for gstreamer pipelines
    mithro committed Jan 12, 2015
    Copy the full SHA
    8c2d191 View commit details
Showing with 25 additions and 16 deletions.
  1. +10 −12 tools/gstcase.c
  2. +13 −4 tools/gstswitchserver.c
  3. +2 −0 tools/gstswitchserver.h
22 changes: 10 additions & 12 deletions tools/gstcase.c
Original file line number Diff line number Diff line change
@@ -283,11 +283,8 @@ gst_case_get_pipeline_string (GstCase * cas)
{
gboolean is_audiostream = cas->serve_type == GST_SERVE_AUDIO_STREAM;
GString *desc = g_string_new ("");
GString *caps = g_string_new ("");

if (!is_audiostream)
g_string_append_printf (caps, "video/x-raw,width=%d,height=%d", cas->width,
cas->height);
const gchar *caps =
is_audiostream ? "" : gst_switch_server_get_video_caps_str ();

switch (cas->type) {
case GST_CASE_INPUT_AUDIO:
@@ -310,7 +307,7 @@ gst_case_get_pipeline_string (GstCase * cas)
} else {
g_string_append_printf (desc,
"intervideosrc name=source channel=input_%d ! %s ! intervideosink name=sink channel=branch_%d",
cas->sink_port, caps->str, cas->sink_port);
cas->sink_port, caps, cas->sink_port);
}
break;

@@ -330,7 +327,7 @@ gst_case_get_pipeline_string (GstCase * cas)
"intervideosrc name=source channel=input_%d ! %s ! tee name=s "
"s. ! queue2 ! intervideosink name=sink1 channel=branch_%d "
"s. ! queue2 ! intervideosink name=sink2 channel=composite_%s",
cas->sink_port, caps->str, cas->sink_port, channel);
cas->sink_port, caps, cas->sink_port, channel);
break;
}

@@ -343,21 +340,22 @@ gst_case_get_pipeline_string (GstCase * cas)
case GST_CASE_BRANCH_VIDEO_A:
case GST_CASE_BRANCH_VIDEO_B:
g_string_append_printf (desc,
"intervideosrc name=source channel=branch_%d ! %s ! gdppay ! tcpserversink name=sink port=%d\n",
cas->sink_port, caps->str, cas->sink_port);
"intervideosrc name=source channel=branch_%d ! %s ! gdppay ! tcpserversink name=sink port=%d",
cas->sink_port, caps, cas->sink_port);
break;

case GST_CASE_BRANCH_PREVIEW:
g_string_append_printf (desc,
"intervideosrc name=source channel=branch_%d ! %s ! gdppay ! tcpserversink name=sink port=%d\n",
cas->sink_port, caps->str, cas->sink_port);
"intervideosrc name=source channel=branch_%d ! %s ! gdppay ! tcpserversink name=sink port=%d",
cas->sink_port, caps, cas->sink_port);
break;

default:
ERROR ("unknown case (%d)", cas->type);
break;
}

g_string_free (caps, TRUE);
INFO ("pipeline(%p): %s\n", cas, desc->str);
return desc;
}

17 changes: 13 additions & 4 deletions tools/gstswitchserver.c
Original file line number Diff line number Diff line change
@@ -162,17 +162,26 @@ gst_switch_server_getcaps (void)
{
if (opts.video_caps == NULL) {
// use a sane default we know will parse correctly
parse_format (opts.low_res ? "VGA" : "720p60", &opts.video_caps, NULL);
parse_format (opts.low_res ? "VGA@60" : "720p60", &opts.video_caps, NULL);
}
if (!caps_dumped) {
gchar *caps_str = gst_caps_to_string (opts.video_caps);
g_print ("caps: %s\n", caps_str);
g_free (caps_str);
opts.video_caps_str = gst_caps_to_string (opts.video_caps);
g_print ("caps: %s\n", opts.video_caps_str);
caps_dumped = TRUE;
}
return opts.video_caps;
}

/* gst_switch_server_get_video_aps_str
* return video caps as a string
*/
const gchar *
gst_switch_server_get_video_caps_str (void)
{
(void) gst_switch_server_getcaps ();
return opts.video_caps_str;
}

/* gst_switch_server_get_record_filename:
* @return record file template name, if one was set
*/
2 changes: 2 additions & 0 deletions tools/gstswitchserver.h
Original file line number Diff line number Diff line change
@@ -66,6 +66,7 @@ struct _GstSwitchServerOpts
//gboolean verbose;
gboolean low_res;
GstCaps *video_caps;
gchar *video_caps_str;
};

/**
@@ -184,6 +185,7 @@ guint gst_switch_server_adjust_pip (GstSwitchServer * srv, gint dx, gint dy,
gboolean gst_switch_server_new_record (GstSwitchServer * srv);

GstCaps *gst_switch_server_getcaps (void);
const gchar *gst_switch_server_get_video_caps_str (void);
const gchar *gst_switch_server_get_record_filename (void);

extern GstSwitchServerOpts opts;