mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 12:11:13 +00:00
08eaa11259
Original commit message from CVS: - added playondemand plugin by Leif Morgan Johnson <lmjohns3@eos.ncsu.edu> - some fixes to int2float - aplied a patch from wrobell <wrobell@ite.pl> that is a first attempt at making automake 1.5 happy (gst now requires automake1.5). It's still not perfect but it builds. - Made the schedulers plugable. The default scheduler now lives inside a plugin. - Added a new mpeg1/2 parser/demuxer. - Fixed some compiler warnings in the core libs. - substantial work to GstThread (hopefully less race conditions). simplified the code in GstThread a bit. A state change can now also happen in the thread context. - reworked the state semantics of a bin. it'll now automatically get the highest state of its children. - the autoplugger now nests the threads so that a state change failure of one thread doesn't make its upstream thread lock. - GstQueue refuses to go to PLAYING if the sinkpad is not connected. This way the queue will not wedge in the _get lock. - GstQueue unlocks its mutexes when going to PAUSED. - make sure that when all elements in a bin/thread go to PAUSED, the bin is set to PAUSED too. - make a parent bin wait for its children to PAUSE before ending the iteration with FALSE (EOS) - Some changes to GstPlay to deal with EOS. - aplied the latest patch from Zeenix to gstrtp. end result: GstPlay doesn't crash on EOS and the pipeline is now shut down properly.
86 lines
2.8 KiB
C
86 lines
2.8 KiB
C
#include <gtk/gtk.h>
|
|
#include <gst/gst.h>
|
|
|
|
void play (GtkButton *button, gpointer data)
|
|
{
|
|
gtk_signal_emit_by_name(GTK_OBJECT(data), "play");
|
|
}
|
|
|
|
void reset (GtkButton *button, gpointer data)
|
|
{
|
|
gtk_signal_emit_by_name(GTK_OBJECT(data), "reset");
|
|
}
|
|
|
|
int main(int argc, char **argv)
|
|
{
|
|
guint channels;
|
|
GtkWidget *window, *vbox, *play_button, *reset_button, *quit_button;
|
|
GstElement *disksrc, *mad, *stereo2mono, *pod, *osssink, *pipeline;
|
|
|
|
gst_init (&argc, &argv);
|
|
gtk_init (&argc, &argv);
|
|
|
|
if (argc!=2) {
|
|
g_print("usage: %s <mp3-filename>\n", argv[0]);
|
|
exit(-1);
|
|
}
|
|
|
|
disksrc = gst_elementfactory_make("disksrc", "disksrc");
|
|
mad = gst_elementfactory_make("mad", "mad");
|
|
pod = gst_elementfactory_make("playondemand", "playondemand");
|
|
osssink = gst_elementfactory_make("osssink", "osssink");
|
|
|
|
gtk_object_set(GTK_OBJECT(disksrc), "location", argv[1], NULL);
|
|
gtk_object_set(GTK_OBJECT(osssink), "fragment", 0x00180008, NULL);
|
|
gtk_object_get(GTK_OBJECT(disksrc), "channels", &channels, NULL);
|
|
|
|
pipeline = gst_pipeline_new("app");
|
|
|
|
gst_bin_add(GST_BIN(pipeline), disksrc);
|
|
gst_bin_add(GST_BIN(pipeline), mad);
|
|
gst_bin_add(GST_BIN(pipeline), pod);
|
|
gst_bin_add(GST_BIN(pipeline), osssink);
|
|
|
|
gst_element_connect(disksrc, "src", mad, "sink");
|
|
gst_element_connect(pod, "src", osssink, "sink");
|
|
|
|
if (channels != 2) {
|
|
gst_element_connect(mad, "src", pod, "sink");
|
|
} else {
|
|
stereo2mono = gst_elementfactory_make("stereo2mono", "stereo2mono");
|
|
gst_bin_add(GST_BIN(pipeline), stereo2mono);
|
|
gst_element_connect(mad, "src", stereo2mono, "sink");
|
|
gst_element_connect(stereo2mono, "src", pod, "sink");
|
|
}
|
|
|
|
gst_element_set_state(pipeline, GST_STATE_PLAYING);
|
|
|
|
/* initialize gui elements ... */
|
|
window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
|
|
vbox = gtk_vbox_new(FALSE, 0);
|
|
play_button = gtk_button_new_with_label("play");
|
|
reset_button = gtk_button_new_with_label("reset");
|
|
quit_button = gtk_button_new_with_label("quit");
|
|
|
|
/* do the packing stuff ... */
|
|
gtk_window_set_default_size(GTK_WINDOW(window), 96, 96);
|
|
gtk_container_add(GTK_CONTAINER(window), vbox);
|
|
gtk_box_pack_start(GTK_BOX(vbox), play_button, FALSE, FALSE, 2);
|
|
gtk_box_pack_start(GTK_BOX(vbox), reset_button, FALSE, FALSE, 2);
|
|
gtk_box_pack_start(GTK_BOX(vbox), quit_button, FALSE, FALSE, 2);
|
|
|
|
/* connect things ... */
|
|
gtk_signal_connect(GTK_OBJECT(play_button), "clicked", play, pod);
|
|
gtk_signal_connect(GTK_OBJECT(reset_button), "clicked", reset, pod);
|
|
gtk_signal_connect(GTK_OBJECT(quit_button), "clicked", gtk_main_quit, NULL);
|
|
|
|
/* show the gui. */
|
|
gtk_widget_show(play_button);
|
|
gtk_widget_show(reset_button);
|
|
gtk_widget_show(quit_button);
|
|
gtk_widget_show(vbox);
|
|
gtk_widget_show(window);
|
|
gtk_idle_add((GtkFunction)gst_bin_iterate, pipeline);
|
|
|
|
gtk_main();
|
|
}
|