better problem checking

Original commit message from CVS:
better problem checking
This commit is contained in:
Thomas Vander Stichele 2002-07-11 15:13:09 +00:00
parent 72722208b8
commit e0a398036b
2 changed files with 18 additions and 8 deletions

View file

@ -123,7 +123,8 @@ int main (int argc, char *argv[])
NULL);
/* create an audio src */
audiosrc = gst_element_factory_make ("osssrc", "audio_src");
if (!(audiosrc = gst_element_factory_make ("osssrc", "audio_src")))
g_error ("Could not create 'osssrc' element !\n");
/* set params */
@ -131,8 +132,11 @@ int main (int argc, char *argv[])
"channels", 1,
"format", 16, NULL);
encoder = gst_element_factory_make ("passthrough", "encoder");
disksink = gst_element_factory_make ("afsink", "disk_sink");
if (!(encoder = gst_element_factory_make ("passthrough", "encoder")))
g_error ("Could not create 'passthrough' element !\n");
if (!(disksink = gst_element_factory_make ("afsink", "disk_sink")))
g_error ("Could not create 'afsink' element !\n");
g_object_set (G_OBJECT (disksink), "location", "/dev/null", NULL);
@ -144,6 +148,7 @@ int main (int argc, char *argv[])
g_assert (main_bin != NULL);
queue = gst_element_factory_make ("queue", "queue");
g_assert (queue);
/* add elements to bin */
gst_bin_add (GST_BIN (main_bin), audiosrc);

View file

@ -123,7 +123,8 @@ int main (int argc, char *argv[])
NULL);
/* create an audio src */
audiosrc = gst_element_factory_make ("osssrc", "audio_src");
if (!(audiosrc = gst_element_factory_make ("osssrc", "audio_src")))
g_error ("Could not create 'osssrc' element !\n");
/* set params */
@ -131,8 +132,11 @@ int main (int argc, char *argv[])
"channels", 1,
"format", 16, NULL);
encoder = gst_element_factory_make ("passthrough", "encoder");
disksink = gst_element_factory_make ("afsink", "disk_sink");
if (!(encoder = gst_element_factory_make ("passthrough", "encoder")))
g_error ("Could not create 'passthrough' element !\n");
if (!(disksink = gst_element_factory_make ("afsink", "disk_sink")))
g_error ("Could not create 'afsink' element !\n");
g_object_set (G_OBJECT (disksink), "location", "/dev/null", NULL);
@ -144,6 +148,7 @@ int main (int argc, char *argv[])
g_assert (main_bin != NULL);
queue = gst_element_factory_make ("queue", "queue");
g_assert (queue);
/* add elements to bin */
gst_bin_add (GST_BIN (main_bin), audiosrc);