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: 00190ecf4645
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: e7ea10faff55
Choose a head ref
  • 3 commits
  • 4 files changed
  • 2 contributors

Commits on Jan 14, 2015

  1. Copy the full SHA
    cde4f3e View commit details
  2. Copy the full SHA
    8c33ce9 View commit details
  3. Merge pull request #126 from mithro/caps-everywhere

    Adding audio caps and making sure caps is part of input.
    deeprave committed Jan 14, 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
    e7ea10f View commit details
Showing with 36 additions and 12 deletions.
  1. +7 −4 run-demo.sh
  2. +7 −5 tools/gstcase.c
  3. +20 −3 tools/gstswitchserver.c
  4. +2 −0 tools/gstswitchserver.h
11 changes: 7 additions & 4 deletions run-demo.sh
Original file line number Diff line number Diff line change
@@ -2,30 +2,33 @@

# FIXME: Rewrite using the Python API so this is reliable.

VIDEO_CAPS="video/x-raw, format=(string)I420, pixel-aspect-ratio=(fraction)1/1, width=(int)300, height=(int)200, framerate=(fraction)25/1"
AUDIO_CAPS="audio/x-raw, rate=48000, channels=2, format=S16LE, layout=interleaved"

killall gst-switch-srv || true
sleep 2
./tools/gst-switch-srv -f debug -r &
./tools/gst-switch-srv -f "$VIDEO_CAPS" -r &
sleep 2
./tools/gst-switch-ui &
sleep 2

gst-launch-1.0 audiotestsrc is-live=true \
! audioconvert \
! audio/x-raw,rate=48000,channels=2,format=S16LE,layout=interleaved \
! $AUDIO_CAPS \
! gdppay \
! tcpclientsink port=4000 \
&

gst-launch-1.0 videotestsrc pattern=1 is-live=1 \
! timeoverlay \
! video/x-raw, width=300, height=200 \
! $VIDEO_CAPS \
! gdppay \
! tcpclientsink port=3000 \
&

gst-launch-1.0 videotestsrc pattern=18 is-live=1 \
! timeoverlay \
! video/x-raw, width=300, height=200 \
! $VIDEO_CAPS \
! gdppay \
! tcpclientsink port=3000 \
&
12 changes: 7 additions & 5 deletions tools/gstcase.c
Original file line number Diff line number Diff line change
@@ -284,19 +284,21 @@ gst_case_get_pipeline_string (GstCase * cas)
gboolean is_audiostream = cas->serve_type == GST_SERVE_AUDIO_STREAM;
GString *desc = g_string_new ("");
const gchar *caps =
is_audiostream ? "" : gst_switch_server_get_video_caps_str ();
is_audiostream ?
gst_switch_server_get_audio_caps_str () :
gst_switch_server_get_video_caps_str ();

switch (cas->type) {
case GST_CASE_INPUT_AUDIO:
g_string_append_printf (desc,
"giostreamsrc name=source ! gdpdepay ! interaudiosink name=sink channel=input_%d",
cas->sink_port);
"giostreamsrc name=source ! gdpdepay ! %s ! interaudiosink name=sink channel=input_%d",
caps, cas->sink_port);
break;

case GST_CASE_INPUT_VIDEO:
g_string_append_printf (desc,
"giostreamsrc name=source ! gdpdepay ! intervideosink name=sink channel=input_%d",
cas->sink_port);
"giostreamsrc name=source ! gdpdepay ! %s ! intervideosink name=sink channel=input_%d",
caps, cas->sink_port);
break;

case GST_CASE_PREVIEW:
23 changes: 20 additions & 3 deletions tools/gstswitchserver.c
Original file line number Diff line number Diff line change
@@ -84,7 +84,7 @@ GstSwitchServerOpts opts = {
GST_SWITCH_SERVER_DEFAULT_CONTROLLER_PORT,
//FALSE,
FALSE,
NULL
NULL, NULL
};

gboolean verbose = FALSE;
@@ -160,19 +160,26 @@ static gboolean caps_dumped = FALSE;
GstCaps *
gst_switch_server_getcaps (void)
{
static const gchar *audio_caps_str =
"audio/x-raw, rate=48000, channels=2, format=S16LE, layout=interleaved";

if (opts.video_caps == NULL) {
// use a sane default we know will parse correctly
parse_format (opts.low_res ? "VGA@60" : "720p60", &opts.video_caps, NULL);
}
if (!caps_dumped) {
opts.video_caps_str = gst_caps_to_string (opts.video_caps);
g_print ("caps: %s\n", opts.video_caps_str);
g_print ("video-caps: %s\n", opts.video_caps_str);

opts.audio_caps_str = g_strdup (audio_caps_str);
g_print ("audio-caps: %s\n", opts.audio_caps_str);

caps_dumped = TRUE;
}
return opts.video_caps;
}

/* gst_switch_server_get_video_aps_str
/* gst_switch_server_get_video_caps_str
* return video caps as a string
*/
const gchar *
@@ -182,6 +189,16 @@ gst_switch_server_get_video_caps_str (void)
return opts.video_caps_str;
}

/* gst_switch_server_get_audio_caps_str
* return audio caps as a string
*/
const gchar *
gst_switch_server_get_audio_caps_str (void)
{
(void) gst_switch_server_getcaps ();
return opts.audio_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
@@ -67,6 +67,7 @@ struct _GstSwitchServerOpts
gboolean low_res;
GstCaps *video_caps;
gchar *video_caps_str;
gchar *audio_caps_str;
};

/**
@@ -185,6 +186,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_audio_caps_str (void);
const gchar *gst_switch_server_get_video_caps_str (void);
const gchar *gst_switch_server_get_record_filename (void);