mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-26 11:41:09 +00:00
Fixed the typefind function
Original commit message from CVS: Fixed the typefind function
This commit is contained in:
parent
b02211c06d
commit
37ef20dd0f
2 changed files with 16 additions and 16 deletions
|
@ -18,7 +18,7 @@ type_found (GstElement *typefind, GstCaps* caps)
|
||||||
int
|
int
|
||||||
main(int argc, char *argv[])
|
main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
GstElement *bin, *disksrc, *typefind;
|
GstElement *bin, *filesrc, *typefind;
|
||||||
|
|
||||||
gst_init(&argc,&argv);
|
gst_init(&argc,&argv);
|
||||||
|
|
||||||
|
@ -28,25 +28,25 @@ main(int argc, char *argv[])
|
||||||
}
|
}
|
||||||
|
|
||||||
/* create a new bin to hold the elements */
|
/* create a new bin to hold the elements */
|
||||||
bin = gst_bin_new("bin");
|
bin = gst_pipeline_new("bin");
|
||||||
g_assert(bin != NULL);
|
g_assert(bin != NULL);
|
||||||
|
|
||||||
/* create a disk reader */
|
/* create a file reader */
|
||||||
disksrc = gst_elementfactory_make("disksrc", "disk_source");
|
filesrc = gst_elementfactory_make("filesrc", "file_source");
|
||||||
g_assert(disksrc != NULL);
|
g_assert(filesrc != NULL);
|
||||||
g_object_set(G_OBJECT(disksrc),"location", argv[1],NULL);
|
g_object_set(G_OBJECT(filesrc),"location", argv[1],NULL);
|
||||||
|
|
||||||
typefind = gst_elementfactory_make("typefind", "typefind");
|
typefind = gst_elementfactory_make("typefind", "typefind");
|
||||||
g_assert(typefind != NULL);
|
g_assert(typefind != NULL);
|
||||||
|
|
||||||
/* add objects to the main pipeline */
|
/* add objects to the main pipeline */
|
||||||
gst_bin_add(GST_BIN(bin), disksrc);
|
gst_bin_add(GST_BIN(bin), filesrc);
|
||||||
gst_bin_add(GST_BIN(bin), typefind);
|
gst_bin_add(GST_BIN(bin), typefind);
|
||||||
|
|
||||||
g_signal_connect (G_OBJECT (typefind), "have_type",
|
g_signal_connect (G_OBJECT (typefind), "have_type",
|
||||||
G_CALLBACK (type_found), NULL);
|
G_CALLBACK (type_found), NULL);
|
||||||
|
|
||||||
gst_pad_connect(gst_element_get_pad(disksrc,"src"),
|
gst_pad_connect(gst_element_get_pad(filesrc,"src"),
|
||||||
gst_element_get_pad(typefind,"sink"));
|
gst_element_get_pad(typefind,"sink"));
|
||||||
|
|
||||||
/* start playing */
|
/* start playing */
|
||||||
|
|
|
@ -18,7 +18,7 @@ type_found (GstElement *typefind, GstCaps* caps)
|
||||||
int
|
int
|
||||||
main(int argc, char *argv[])
|
main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
GstElement *bin, *disksrc, *typefind;
|
GstElement *bin, *filesrc, *typefind;
|
||||||
|
|
||||||
gst_init(&argc,&argv);
|
gst_init(&argc,&argv);
|
||||||
|
|
||||||
|
@ -28,25 +28,25 @@ main(int argc, char *argv[])
|
||||||
}
|
}
|
||||||
|
|
||||||
/* create a new bin to hold the elements */
|
/* create a new bin to hold the elements */
|
||||||
bin = gst_bin_new("bin");
|
bin = gst_pipeline_new("bin");
|
||||||
g_assert(bin != NULL);
|
g_assert(bin != NULL);
|
||||||
|
|
||||||
/* create a disk reader */
|
/* create a file reader */
|
||||||
disksrc = gst_elementfactory_make("disksrc", "disk_source");
|
filesrc = gst_elementfactory_make("filesrc", "file_source");
|
||||||
g_assert(disksrc != NULL);
|
g_assert(filesrc != NULL);
|
||||||
g_object_set(G_OBJECT(disksrc),"location", argv[1],NULL);
|
g_object_set(G_OBJECT(filesrc),"location", argv[1],NULL);
|
||||||
|
|
||||||
typefind = gst_elementfactory_make("typefind", "typefind");
|
typefind = gst_elementfactory_make("typefind", "typefind");
|
||||||
g_assert(typefind != NULL);
|
g_assert(typefind != NULL);
|
||||||
|
|
||||||
/* add objects to the main pipeline */
|
/* add objects to the main pipeline */
|
||||||
gst_bin_add(GST_BIN(bin), disksrc);
|
gst_bin_add(GST_BIN(bin), filesrc);
|
||||||
gst_bin_add(GST_BIN(bin), typefind);
|
gst_bin_add(GST_BIN(bin), typefind);
|
||||||
|
|
||||||
g_signal_connect (G_OBJECT (typefind), "have_type",
|
g_signal_connect (G_OBJECT (typefind), "have_type",
|
||||||
G_CALLBACK (type_found), NULL);
|
G_CALLBACK (type_found), NULL);
|
||||||
|
|
||||||
gst_pad_connect(gst_element_get_pad(disksrc,"src"),
|
gst_pad_connect(gst_element_get_pad(filesrc,"src"),
|
||||||
gst_element_get_pad(typefind,"sink"));
|
gst_element_get_pad(typefind,"sink"));
|
||||||
|
|
||||||
/* start playing */
|
/* start playing */
|
||||||
|
|
Loading…
Reference in a new issue