gstreamer/test/mcut.c
Wim Taymans 0837e1e495 Modified a lot of plugins to use the caps system.
Original commit message from CVS:
Modified a lot of plugins to use the caps system.
Modified the caps of audio/raw to our agreed properties.
Added the multidisksrc plugin of Dominic Ludlam
Renamed audiosink/src to osssink/src and updated all the examples using
the old name. Moved oss specific plugins in an oss directory. removed
the old audiosink from the elements/ dir.
removed audioraw.h metadata header files since we now use the properties.
There are still a few plugins that won't build because they include the
old audioraw.h header file. This will be fixed soon.
Make sure the caps are set in the plugins as described by their
padtemplates (this should solve problems with gstmediaplay with various
media files).

*please don't panic when some plugins won't build, just cd manually into
the plugin dirs* This will be fixed soon.
2001-03-24 17:22:03 +00:00

77 lines
1.9 KiB
C

#include <gst/gst.h>
void eof(GstSrc *src) {
g_print("have eof, quitting\n");
exit(0);
}
int main(int argc,char *argv[]) {
GstType *type;
GList *factories;
GstElementFactory *parsefactory;
GstElement *bin, *src, *parse, *sink;
GList *padlist;
guchar *filename;
glong length = 0, size = 4180, skip = 8360, offset = 0;
if (argc == 2)
filename = argv[1];
else {
g_print("sorry, need a filename now\n");
exit(1);
}
gst_init(&argc,&argv);
gst_plugin_load_all();
bin = gst_bin_new("bin");
src = gst_asyncdisksrc_new("src");
g_print("created disksrc\n");
gtk_object_set(GTK_OBJECT(src),"location",filename,NULL);
length = gst_util_get_long_arg(GST_OBJECT(src),"length");
g_print("file is %d bytes long\n",length);
/* now it's time to get the parser */
type = gst_type_get_by_mime("audio/mp3");
factories = gst_type_get_sinks(type);
if (factories != NULL)
parsefactory = GST_ELEMENTFACTORY(factories->data);
else {
g_print("sorry, can't find anyone registered to sink 'mp3'\n");
return 1;
}
parse = gst_elementfactory_create(parsefactory,"parser");
if (parse == NULL) {
g_print("sorry, couldn't create parser\n");
return 1;
}
sink = gst_osssink_new("osssink");
gtk_signal_connect(GTK_OBJECT(src),"eof",
GTK_SIGNAL_FUNC(eof),NULL);
/* add objects to the main pipeline */
gst_bin_add(GST_BIN(bin),src);
gst_bin_add(GST_BIN(bin),parse);
gst_bin_add(GST_BIN(bin),sink);
/* connect src to sink */
gst_pad_connect(gst_element_get_pad(src,"src"),
gst_element_get_pad(parse,"sink"));
gst_pad_connect(gst_element_get_pad(parse,"src"),
gst_element_get_pad(sink,"sink"));
while(offset < length) {
gst_src_push_region(GST_SRC(src),offset,size);
offset += skip;
}
gst_object_destroy(GST_OBJECT(sink));
gst_object_destroy(GST_OBJECT(parse));
gst_object_destroy(GST_OBJECT(src));
gst_object_destroy(GST_OBJECT(bin));
}