Added an test program for the mad mp3 decoder.

Original commit message from CVS:
Added an test program for the mad mp3 decoder.
This commit is contained in:
Wim Taymans 2001-04-16 21:33:55 +00:00
parent 5050318744
commit c1d51abd16
2 changed files with 49 additions and 1 deletions

View file

@ -3,7 +3,8 @@
noinst_PROGRAMS = qtest spectrum record wave mp3 teardown buffer mp3parse \
mpeg2parse mp1parse mp3play ac3parse ac3play dvdcat fake cobin videotest \
aviparse vidcapture avi2mpg mp2tomp1 mp1tomp1 pipetest \
vidcapture2 mp2toavi mp3tovorbis mpeg2parse2 xmmstest videotest2
vidcapture2 mp2toavi mp3tovorbis mpeg2parse2 xmmstest videotest2 \
mp3mad
SUBDIRS = xml bindings

47
test/mp3mad.c Normal file
View file

@ -0,0 +1,47 @@
#include <gst/gst.h>
int main(int argc,char *argv[]) {
GstElementFactory *srcfactory, *parsefactory, *decodefactory, *playfactory;
GstElement *pipeline, *src, *decode, *play;
GstPad *infopad;
g_print("have %d args\n",argc);
gst_init(&argc,&argv);
pipeline = gst_pipeline_new("pipeline");
g_return_if_fail(pipeline != NULL);
srcfactory = gst_elementfactory_find("disksrc");
g_return_if_fail(srcfactory != NULL);
decodefactory = gst_elementfactory_find("mad");
g_return_if_fail(decodefactory != NULL);
playfactory = gst_elementfactory_find("osssink");
g_return_if_fail(playfactory != NULL);
src = gst_elementfactory_create(srcfactory,"src");
g_return_if_fail(src != NULL);
gtk_object_set(GTK_OBJECT(src),"location",argv[1],NULL);
g_print("should be using file '%s'\n",argv[1]);
decode = gst_elementfactory_create(decodefactory,"decode");
g_return_if_fail(decode != NULL);
play = gst_elementfactory_create(playfactory,"play");
g_return_if_fail(play != NULL);
gst_bin_add(GST_BIN(pipeline),GST_ELEMENT(src));
gst_bin_add(GST_BIN(pipeline),GST_ELEMENT(decode));
gst_bin_add(GST_BIN(pipeline),GST_ELEMENT(play));
gst_pad_connect(gst_element_get_pad(src,"src"),
gst_element_get_pad(decode,"sink"));
gst_pad_connect(gst_element_get_pad(decode,"src"),
gst_element_get_pad(play,"sink"));
g_print("setting to READY state\n");
gst_element_set_state(GST_ELEMENT(pipeline),GST_STATE_READY);
gst_element_set_state(GST_ELEMENT(pipeline),GST_STATE_PLAYING);
g_print("about to enter loop\n");
while (gst_bin_iterate(GST_BIN(pipeline)));
}