mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 12:11:13 +00:00
tool: Add the option to set audiosink
And use gst_parse_bin_from_description to create the sinks letting more control to users.
This commit is contained in:
parent
6b61c29907
commit
9184c7ed7e
1 changed files with 24 additions and 7 deletions
|
@ -252,7 +252,8 @@ str_to_time (char *time)
|
||||||
}
|
}
|
||||||
|
|
||||||
static GESTimeline *
|
static GESTimeline *
|
||||||
create_timeline (int nbargs, gchar ** argv, const gchar * proj_uri, const gchar *scenario)
|
create_timeline (int nbargs, gchar ** argv, const gchar * proj_uri,
|
||||||
|
const gchar * scenario)
|
||||||
{
|
{
|
||||||
GESLayer *layer = NULL;
|
GESLayer *layer = NULL;
|
||||||
GESTrack *tracka = NULL, *trackv = NULL;
|
GESTrack *tracka = NULL, *trackv = NULL;
|
||||||
|
@ -406,7 +407,8 @@ create_timeline (int nbargs, gchar ** argv, const gchar * proj_uri, const gchar
|
||||||
}
|
}
|
||||||
|
|
||||||
activate_validate:
|
activate_validate:
|
||||||
if (ges_validate_activate (GST_PIPELINE (pipeline), scenario, activate_before_paused) == FALSE) {
|
if (ges_validate_activate (GST_PIPELINE (pipeline), scenario,
|
||||||
|
activate_before_paused) == FALSE) {
|
||||||
g_error ("Could not activate scenario %s", scenario);
|
g_error ("Could not activate scenario %s", scenario);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -421,7 +423,7 @@ build_failure:
|
||||||
|
|
||||||
static GESPipeline *
|
static GESPipeline *
|
||||||
create_pipeline (GESTimeline ** ret_timeline, gchar * load_path,
|
create_pipeline (GESTimeline ** ret_timeline, gchar * load_path,
|
||||||
int argc, char **argv, const gchar *scenario)
|
int argc, char **argv, const gchar * scenario)
|
||||||
{
|
{
|
||||||
gchar *uri = NULL;
|
gchar *uri = NULL;
|
||||||
GESTimeline *timeline = NULL;
|
GESTimeline *timeline = NULL;
|
||||||
|
@ -720,7 +722,7 @@ main (int argc, gchar ** argv)
|
||||||
static gdouble thumbinterval = 0;
|
static gdouble thumbinterval = 0;
|
||||||
static gboolean verbose = FALSE;
|
static gboolean verbose = FALSE;
|
||||||
gchar *load_path = NULL;
|
gchar *load_path = NULL;
|
||||||
gchar *videosink = NULL;
|
gchar *videosink = NULL, *audiosink = NULL;
|
||||||
const gchar *scenario = NULL;
|
const gchar *scenario = NULL;
|
||||||
|
|
||||||
GOptionEntry options[] = {
|
GOptionEntry options[] = {
|
||||||
|
@ -766,6 +768,8 @@ main (int argc, gchar ** argv)
|
||||||
"Do not use mixing element in the tracks"},
|
"Do not use mixing element in the tracks"},
|
||||||
{"videosink", 'v', 0, G_OPTION_ARG_STRING, &videosink,
|
{"videosink", 'v', 0, G_OPTION_ARG_STRING, &videosink,
|
||||||
"The video sink used for playing back", "<videosink>"},
|
"The video sink used for playing back", "<videosink>"},
|
||||||
|
{"audiosink", 'a', 0, G_OPTION_ARG_STRING, &audiosink,
|
||||||
|
"The audio sink used for playing back", "<audiosink>"},
|
||||||
#ifdef HAVE_GST_VALIDATE
|
#ifdef HAVE_GST_VALIDATE
|
||||||
{"set-scenario", 0, 0, G_OPTION_ARG_STRING, &scenario,
|
{"set-scenario", 0, 0, G_OPTION_ARG_STRING, &scenario,
|
||||||
"Specify a GstValidate scenario to run, 'none' means load gst-validate"
|
"Specify a GstValidate scenario to run, 'none' means load gst-validate"
|
||||||
|
@ -838,14 +842,27 @@ main (int argc, gchar ** argv)
|
||||||
exit (1);
|
exit (1);
|
||||||
|
|
||||||
if (videosink != NULL) {
|
if (videosink != NULL) {
|
||||||
GstElement *sink = gst_element_factory_make (videosink, "custom-videosink");
|
GError *err = NULL;
|
||||||
|
GstElement *sink = gst_parse_bin_from_description (videosink, TRUE, &err);
|
||||||
if (sink == NULL) {
|
if (sink == NULL) {
|
||||||
GST_ERROR ("could not create the requested videosink %s, exiting", videosink);
|
GST_ERROR ("could not create the requested videosink %s (err: %s), "
|
||||||
|
"exiting", err ? err->message : "", videosink);
|
||||||
exit (1);
|
exit (1);
|
||||||
}
|
}
|
||||||
ges_pipeline_preview_set_video_sink (pipeline, sink);
|
ges_pipeline_preview_set_video_sink (pipeline, sink);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (audiosink != NULL) {
|
||||||
|
GError *err = NULL;
|
||||||
|
GstElement *sink = gst_parse_bin_from_description (audiosink, TRUE, &err);
|
||||||
|
if (sink == NULL) {
|
||||||
|
GST_ERROR ("could not create the requested audiosink %s (err: %s), "
|
||||||
|
"exiting", err ? err->message : "", audiosink);
|
||||||
|
exit (1);
|
||||||
|
}
|
||||||
|
ges_pipeline_preview_set_audio_sink (pipeline, sink);
|
||||||
|
}
|
||||||
|
|
||||||
/* Setup profile/encoding if needed */
|
/* Setup profile/encoding if needed */
|
||||||
if (smartrender || outputuri) {
|
if (smartrender || outputuri) {
|
||||||
GstEncodingProfile *prof = NULL;
|
GstEncodingProfile *prof = NULL;
|
||||||
|
|
Loading…
Reference in a new issue