Skip to content

Commit

Permalink
Fix run-demo for video resolutions.
Browse files Browse the repository at this point in the history
 * Add call to gst_init() so handling before parsing commandline
   args so working with GstCaps does not crash
 * dump caps to stdout so we can replicate this elsewhere if need be
  • Loading branch information
David Nugent committed Jan 11, 2015
1 parent 5cb1843 commit 1775caf
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion run-demo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

killall gst-switch-srv || true
sleep 2
./tools/gst-switch-srv -r &
./tools/gst-switch-srv -f debug -r &
sleep 2
./tools/gst-switch-ui &
sleep 2
Expand Down
9 changes: 9 additions & 0 deletions tools/gstswitchserver.c
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,8 @@ gparse_video_format (gchar * name, gchar * value, gpointer data,
return TRUE;
}

static gboolean caps_dumped = FALSE;

/* gst_switch_server_getcaps:
* @return current video caps
*/
Expand All @@ -162,6 +164,12 @@ gst_switch_server_getcaps (void)
// use a sane default we know will parse correctly
parse_format (opts.low_res ? "VGA" : "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);
caps_dumped = TRUE;
}
return opts.video_caps;
}

Expand Down Expand Up @@ -207,6 +215,7 @@ gst_switch_server_parse_args (int *argc, char **argv[])
GError *error = NULL;
GOptionContext *context;

gst_init (NULL, NULL);
context = g_option_context_new ("");
g_option_context_add_main_entries (context, entries, "gst-switch");
g_option_context_add_group (context, gst_init_get_option_group ());
Expand Down

0 comments on commit 1775caf

Please sign in to comment.