move old example to tests/examples/volume/volune.c
Original commit message from CVS: * configure.ac: * gst/volume/Makefile.am: * gst/volume/demo.c: move old example to tests/examples/volume/volune.c * tests/examples/Makefile.am: * tests/examples/seek/seek.c: (main): change window-close event from "delete-event" to "destroy" * tests/examples/volume/Makefile.am: * tests/examples/volume/volume.c: (value_changed_callback), (setup_gui), (message_received), (eos_message_received), (main): fix event handling and bus usage
This commit is contained in:
parent
0d85e2cc15
commit
f2092fc757
15
ChangeLog
15
ChangeLog
@ -1,3 +1,18 @@
|
|||||||
|
2005-12-30 Stefan Kost <ensonic@users.sf.net>
|
||||||
|
|
||||||
|
* configure.ac:
|
||||||
|
* gst/volume/Makefile.am:
|
||||||
|
* gst/volume/demo.c:
|
||||||
|
move old example to tests/examples/volume/volune.c
|
||||||
|
* tests/examples/Makefile.am:
|
||||||
|
* tests/examples/seek/seek.c: (main):
|
||||||
|
change window-close event from "delete-event" to "destroy"
|
||||||
|
* tests/examples/volume/Makefile.am:
|
||||||
|
* tests/examples/volume/volume.c: (value_changed_callback),
|
||||||
|
(setup_gui), (message_received), (eos_message_received), (main):
|
||||||
|
fix event handling and bus usage
|
||||||
|
|
||||||
|
|
||||||
2005-12-29 Stefan Kost <ensonic@users.sf.net>
|
2005-12-29 Stefan Kost <ensonic@users.sf.net>
|
||||||
|
|
||||||
* gst/audiotestsrc/gstaudiotestsrc.c:
|
* gst/audiotestsrc/gstaudiotestsrc.c:
|
||||||
|
@ -640,6 +640,7 @@ tests/Makefile
|
|||||||
tests/check/Makefile
|
tests/check/Makefile
|
||||||
tests/examples/Makefile
|
tests/examples/Makefile
|
||||||
tests/examples/seek/Makefile
|
tests/examples/seek/Makefile
|
||||||
|
tests/examples/volume/Makefile
|
||||||
tests/icles/Makefile
|
tests/icles/Makefile
|
||||||
docs/Makefile
|
docs/Makefile
|
||||||
docs/libs/Makefile
|
docs/libs/Makefile
|
||||||
|
@ -11,9 +11,3 @@ libgstvolume_la_LIBADD = \
|
|||||||
|
|
||||||
noinst_HEADERS = gstvolume.h
|
noinst_HEADERS = gstvolume.h
|
||||||
|
|
||||||
if HAVE_GTK
|
|
||||||
noinst_PROGRAMS = demo
|
|
||||||
demo_SOURCES = demo.c
|
|
||||||
demo_CFLAGS = $(GTK_CFLAGS) $(GST_CFLAGS) -D_GNU_SOURCE
|
|
||||||
demo_LDFLAGS = $(GTK_LIBS) $(GST_LIBS) -lm
|
|
||||||
endif
|
|
||||||
|
@ -4,6 +4,6 @@ else
|
|||||||
FT2_SUBDIRS =
|
FT2_SUBDIRS =
|
||||||
endif
|
endif
|
||||||
|
|
||||||
SUBDIRS = $(FT2_SUBDIRS)
|
SUBDIRS = $(FT2_SUBDIRS) volume
|
||||||
|
|
||||||
DIST_SUBDIRS = seek
|
DIST_SUBDIRS = seek volume
|
||||||
|
@ -1440,7 +1440,7 @@ main (int argc, char **argv)
|
|||||||
g_signal_connect (G_OBJECT (flush_checkbox), "toggled",
|
g_signal_connect (G_OBJECT (flush_checkbox), "toggled",
|
||||||
G_CALLBACK (flush_toggle_cb), pipeline);
|
G_CALLBACK (flush_toggle_cb), pipeline);
|
||||||
|
|
||||||
g_signal_connect (G_OBJECT (window), "delete_event", gtk_main_quit, NULL);
|
g_signal_connect (G_OBJECT (window), "destroy", gtk_main_quit, NULL);
|
||||||
|
|
||||||
/* show the gui. */
|
/* show the gui. */
|
||||||
gtk_widget_show_all (window);
|
gtk_widget_show_all (window);
|
||||||
|
6
tests/examples/volume/Makefile.am
Normal file
6
tests/examples/volume/Makefile.am
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
if HAVE_GTK
|
||||||
|
noinst_PROGRAMS = volume
|
||||||
|
volume_SOURCES = volume.c
|
||||||
|
volume_CFLAGS = $(GTK_CFLAGS) $(GST_CFLAGS) -D_GNU_SOURCE
|
||||||
|
volume_LDFLAGS = $(GTK_LIBS) $(GST_LIBS) -lm
|
||||||
|
endif
|
@ -1,6 +1,6 @@
|
|||||||
/* GStreamer
|
/* GStreamer
|
||||||
*
|
*
|
||||||
* demo.c: sample application to change the volume of a pipeline
|
* volume.c: sample application to change the volume of a pipeline
|
||||||
*
|
*
|
||||||
* Copyright (C) <2004> Thomas Vander Stichele <thomas at apestaart dot org>
|
* Copyright (C) <2004> Thomas Vander Stichele <thomas at apestaart dot org>
|
||||||
*
|
*
|
||||||
@ -85,6 +85,34 @@ setup_gui (GstElement * volume)
|
|||||||
gtk_widget_show_all (GTK_WIDGET (window));
|
gtk_widget_show_all (GTK_WIDGET (window));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
message_received (GstBus * bus, GstMessage * message, GstPipeline * pipeline)
|
||||||
|
{
|
||||||
|
const GstStructure *s;
|
||||||
|
|
||||||
|
s = gst_message_get_structure (message);
|
||||||
|
g_print ("message from \"%s\" (%s): ",
|
||||||
|
GST_STR_NULL (GST_ELEMENT_NAME (GST_MESSAGE_SRC (message))),
|
||||||
|
gst_message_type_get_name (GST_MESSAGE_TYPE (message)));
|
||||||
|
if (s) {
|
||||||
|
gchar *sstr;
|
||||||
|
|
||||||
|
sstr = gst_structure_to_string (s);
|
||||||
|
g_print ("%s\n", sstr);
|
||||||
|
g_free (sstr);
|
||||||
|
} else {
|
||||||
|
g_print ("no message details\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
eos_message_received (GstBus * bus, GstMessage * message,
|
||||||
|
GstPipeline * pipeline)
|
||||||
|
{
|
||||||
|
message_received (bus, message, pipeline);
|
||||||
|
gtk_main_quit ();
|
||||||
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
main (int argc, char *argv[])
|
main (int argc, char *argv[])
|
||||||
{
|
{
|
||||||
@ -92,6 +120,7 @@ main (int argc, char *argv[])
|
|||||||
GstElement *pipeline = NULL;
|
GstElement *pipeline = NULL;
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
GstElement *volume;
|
GstElement *volume;
|
||||||
|
GstBus *bus;
|
||||||
|
|
||||||
gst_init (&argc, &argv);
|
gst_init (&argc, &argv);
|
||||||
gtk_init (&argc, &argv);
|
gtk_init (&argc, &argv);
|
||||||
@ -111,14 +140,24 @@ main (int argc, char *argv[])
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* setup message handling */
|
||||||
|
bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline));
|
||||||
|
gst_bus_add_signal_watch_full (bus, G_PRIORITY_HIGH);
|
||||||
|
g_signal_connect (bus, "message::error", (GCallback) message_received,
|
||||||
|
pipeline);
|
||||||
|
g_signal_connect (bus, "message::warning", (GCallback) message_received,
|
||||||
|
pipeline);
|
||||||
|
g_signal_connect (bus, "message::eos", (GCallback) eos_message_received,
|
||||||
|
pipeline);
|
||||||
|
|
||||||
/* setup GUI */
|
/* setup GUI */
|
||||||
setup_gui (volume);
|
setup_gui (volume);
|
||||||
|
|
||||||
/* go to main loop */
|
/* go to main loop */
|
||||||
gst_element_set_state (pipeline, GST_STATE_PLAYING);
|
gst_element_set_state (pipeline, GST_STATE_PLAYING);
|
||||||
gst_bus_poll (gst_element_get_bus (pipeline),
|
gtk_main ();
|
||||||
GST_MESSAGE_EOS | GST_MESSAGE_ERROR, -1);
|
|
||||||
gst_element_set_state (pipeline, GST_STATE_NULL);
|
gst_element_set_state (pipeline, GST_STATE_NULL);
|
||||||
|
gst_object_unref (pipeline);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user