Fixed a nasty bug in mp3parse (partial buffer state remained)

Original commit message from CVS:
Fixed a nasty bug in mp3parse (partial buffer state remained)
Added eos check for the test programs to stop them from allocating all
of your memory (had to use alt-sysreq-k a few times :-( ).
MPEG layer 1 plays fine now with mp3play.
This commit is contained in:
Wim Taymans 2000-02-05 01:20:11 +00:00
parent 5d5807c0d5
commit 3cb7f2a649
3 changed files with 18 additions and 2 deletions

View file

@ -44,7 +44,7 @@ int main(int argc,char *argv[]) {
audiosink = gst_audiosink_new("audiosink"); audiosink = gst_audiosink_new("audiosink");
gtk_signal_connect(GTK_OBJECT(disksrc),"eof", gtk_signal_connect(GTK_OBJECT(disksrc),"eos",
GTK_SIGNAL_FUNC(eof),NULL); GTK_SIGNAL_FUNC(eof),NULL);
/* add objects to the main pipeline */ /* add objects to the main pipeline */

View file

@ -2,8 +2,13 @@
extern gboolean _gst_plugin_spew; extern gboolean _gst_plugin_spew;
void eof(GstSrc *src) {
g_print("have eof, quitting\n");
exit(0);
}
void mp3parse_info_chain(GstPad *pad,GstBuffer *buf) { void mp3parse_info_chain(GstPad *pad,GstBuffer *buf) {
g_print("got buffer of size %d\n",GST_BUFFER_SIZE(buf)); g_print("sink : got buffer of size %d\n",GST_BUFFER_SIZE(buf));
gst_buffer_unref(buf); gst_buffer_unref(buf);
} }
@ -41,6 +46,9 @@ int main(int argc,char *argv[]) {
gst_bin_add(GST_BIN(pipeline),GST_ELEMENT(src)); gst_bin_add(GST_BIN(pipeline),GST_ELEMENT(src));
gst_bin_add(GST_BIN(pipeline),GST_ELEMENT(parse)); gst_bin_add(GST_BIN(pipeline),GST_ELEMENT(parse));
gtk_signal_connect(GTK_OBJECT(src),"eos",
GTK_SIGNAL_FUNC(eof),NULL);
gst_pad_connect(gst_element_get_pad(src,"src"), gst_pad_connect(gst_element_get_pad(src,"src"),
gst_element_get_pad(parse,"sink")); gst_element_get_pad(parse,"sink"));
gst_pad_connect(gst_element_get_pad(parse,"src"), gst_pad_connect(gst_element_get_pad(parse,"src"),

View file

@ -2,6 +2,11 @@
extern gboolean _gst_plugin_spew; extern gboolean _gst_plugin_spew;
void eof(GstSrc *src) {
g_print("have eof, quitting\n");
exit(0);
}
int main(int argc,char *argv[]) { int main(int argc,char *argv[]) {
GstPipeline *pipeline; GstPipeline *pipeline;
GstElementFactory *srcfactory, *parsefactory, *decodefactory, *playfactory; GstElementFactory *srcfactory, *parsefactory, *decodefactory, *playfactory;
@ -38,6 +43,9 @@ int main(int argc,char *argv[]) {
play = gst_elementfactory_create(playfactory,"play"); play = gst_elementfactory_create(playfactory,"play");
g_return_if_fail(play != NULL); g_return_if_fail(play != NULL);
gtk_signal_connect(GTK_OBJECT(src),"eos",
GTK_SIGNAL_FUNC(eof),NULL);
gst_bin_add(GST_BIN(pipeline),GST_ELEMENT(src)); gst_bin_add(GST_BIN(pipeline),GST_ELEMENT(src));
gst_bin_add(GST_BIN(pipeline),GST_ELEMENT(parse)); gst_bin_add(GST_BIN(pipeline),GST_ELEMENT(parse));
gst_bin_add(GST_BIN(pipeline),GST_ELEMENT(decode)); gst_bin_add(GST_BIN(pipeline),GST_ELEMENT(decode));