Commit f19745e5 authored by Wim Taymans's avatar Wim Taymans

Updated test app

Original commit message from CVS:
Updated test app
parent 62e05fd9
......@@ -40,7 +40,7 @@ entry_added (GstIndex *index, GstIndexEntry *entry)
{
gint i;
g_print ("%d: %08x ", entry->id, GST_INDEX_ASSOC_FLAGS (entry));
g_print ("%p, %d: %08x ", entry, entry->id, GST_INDEX_ASSOC_FLAGS (entry));
for (i = 0; i < GST_INDEX_NASSOCS (entry); i++) {
g_print ("%d %lld ", GST_INDEX_ASSOC_FORMAT (entry, i),
GST_INDEX_ASSOC_VALUE (entry, i));
......@@ -202,7 +202,7 @@ main (gint argc, gchar *argv[])
gint count = 0;
GstEvent *event;
gboolean res;
gint i;
GstElement *sink;
struct poptOption options[] = {
{ "verbose", 'v', POPT_ARG_NONE|POPT_ARGFLAG_STRIP, &verbose, 0,
"Print index entries", NULL},
......@@ -222,7 +222,8 @@ main (gint argc, gchar *argv[])
/* create index that elements can fill */
index = gst_index_factory_make ("memindex");
if (verbose)
index = NULL;
if (verbose && index)
g_signal_connect (G_OBJECT (index), "entry_added", G_CALLBACK (entry_added), NULL);
/* construct pipeline */
......@@ -265,15 +266,19 @@ main (gint argc, gchar *argv[])
gst_element_set_state (pipeline, GST_STATE_READY);
gst_element_set_state (pipeline, GST_STATE_PAUSED);
GST_FLAG_UNSET (index, GST_INDEX_WRITABLE);
if (index)
GST_FLAG_UNSET (index, GST_INDEX_WRITABLE);
src = gst_bin_get_by_name (GST_BIN (pipeline), "video_decoder");
pad = gst_element_get_pad (src, "src");
sink = gst_element_factory_make ("fakesink", "sink");
gst_element_connect_pads (src, "src", sink, "sink");
gst_bin_add (GST_BIN (pipeline), sink);
g_print ("seeking %s...\n", argv [2]);
event = gst_event_new_seek (GST_FORMAT_TIME |
GST_SEEK_METHOD_SET |
GST_SEEK_FLAG_FLUSH, 1 * GST_SECOND);
GST_SEEK_FLAG_FLUSH, 5 * GST_SECOND);
res = gst_pad_send_event (pad, event);
if (!res) {
......@@ -281,8 +286,12 @@ main (gint argc, gchar *argv[])
}
gst_element_set_state (pipeline, GST_STATE_PLAYING);
for (i = 0; i < 100; i++) {
gst_bin_iterate (GST_BIN (pipeline));
count = 0;
while (gst_bin_iterate (GST_BIN (pipeline))) {
if (!quiet && (count % 1000 == 0)) {
print_progress (pad);
}
count++;
}
gst_element_set_state (pipeline, GST_STATE_NULL);
......
......@@ -232,7 +232,8 @@ make_parse_pipeline (const gchar *location)
src = gst_element_factory_make_or_warn (SOURCE, "src");
parser = gst_element_factory_make_or_warn ("mpegparse", "parse");
fakesink = gst_element_factory_make_or_warn ("fakesink", "sink");
g_object_set (G_OBJECT (fakesink), "sync", FALSE, NULL);
g_object_set (G_OBJECT (fakesink), "silent", TRUE, NULL);
g_object_set (G_OBJECT (fakesink), "sync", TRUE, NULL);
g_object_set (G_OBJECT (src), "location", location, NULL);
......@@ -263,7 +264,7 @@ make_vorbis_pipeline (const gchar *location)
src = gst_element_factory_make_or_warn (SOURCE, "src");
decoder = gst_element_factory_make_or_warn ("vorbisfile", "decoder");
audiosink = gst_element_factory_make_or_warn ("osssink", "sink");
//g_object_set (G_OBJECT (audiosink), "sync", FALSE, NULL);
g_object_set (G_OBJECT (audiosink), "sync", FALSE, NULL);
g_object_set (G_OBJECT (src), "location", location, NULL);
......@@ -364,13 +365,14 @@ make_avi_pipeline (const gchar *location)
video_bin = gst_bin_new ("v_decoder_bin");
//v_decoder = gst_element_factory_make_or_warn ("identity", "v_dec");
v_decoder = gst_element_factory_make_or_warn ("windec", "v_dec");
//v_decoder = gst_element_factory_make_or_warn ("windec", "v_dec");
v_decoder = gst_element_factory_make_or_warn ("ffdec_msmpeg4", "v_dec");
video_thread = gst_thread_new ("v_decoder_thread");
videosink = gst_element_factory_make_or_warn ("xvideosink", "v_sink");
//videosink = gst_element_factory_make_or_warn ("fakesink", "v_sink");
//g_object_set (G_OBJECT (videosink), "sync", TRUE, NULL);
v_queue = gst_element_factory_make_or_warn ("queue", "v_queue");
g_object_set (G_OBJECT (v_queue), "max_level", 10, NULL);
//g_object_set (G_OBJECT (v_queue), "max_level", 10, NULL);
gst_element_connect (v_decoder, v_queue);
gst_element_connect (v_queue, videosink);
gst_bin_add (GST_BIN (video_bin), v_decoder);
......@@ -405,8 +407,7 @@ make_mpeg_pipeline (const gchar *location)
g_object_set (G_OBJECT (src), "location", location, NULL);
demux = gst_element_factory_make_or_warn ("mpegdemux", "demux");
//g_object_set (G_OBJECT (demux), "sync", FALSE, NULL);
g_object_set (G_OBJECT (demux), "sync", TRUE, NULL);
//g_object_set (G_OBJECT (demux), "sync", TRUE, NULL);
seekable_elements = g_list_prepend (seekable_elements, demux);
......@@ -437,7 +438,7 @@ make_mpeg_pipeline (const gchar *location)
video_bin = gst_bin_new ("v_decoder_bin");
v_decoder = gst_element_factory_make_or_warn ("mpeg2dec", "v_dec");
video_thread = gst_thread_new ("v_decoder_thread");
g_object_set (G_OBJECT (video_thread), "schedpolicy", 2, NULL);
//g_object_set (G_OBJECT (video_thread), "priority", 2, NULL);
v_queue = gst_element_factory_make_or_warn ("queue", "v_queue");
v_filter = gst_element_factory_make_or_warn ("colorspace", "v_filter");
videosink = gst_element_factory_make_or_warn ("xvideosink", "v_sink");
......@@ -472,7 +473,6 @@ make_mpegnt_pipeline (const gchar *location)
g_object_set (G_OBJECT (src), "location", location, NULL);
demux = gst_element_factory_make_or_warn ("mpegdemux", "demux");
//g_object_set (G_OBJECT (demux), "sync", FALSE, NULL);
//g_object_set (G_OBJECT (demux), "sync", TRUE, NULL);
seekable_elements = g_list_prepend (seekable_elements, demux);
......@@ -856,8 +856,13 @@ main (int argc, char **argv)
/* show the gui. */
gtk_widget_show_all (window);
g_signal_connect (pipeline, "deep_notify", G_CALLBACK (gst_element_default_deep_notify), NULL);
g_signal_connect (pipeline, "error", G_CALLBACK (gst_element_default_error), NULL);
gtk_main ();
gst_element_set_state (pipeline, GST_STATE_NULL);
//gst_object_unref (GST_OBJECT (pipeline));
gst_buffer_print_stats();
gst_event_print_stats();
......
......@@ -232,7 +232,8 @@ make_parse_pipeline (const gchar *location)
src = gst_element_factory_make_or_warn (SOURCE, "src");
parser = gst_element_factory_make_or_warn ("mpegparse", "parse");
fakesink = gst_element_factory_make_or_warn ("fakesink", "sink");
g_object_set (G_OBJECT (fakesink), "sync", FALSE, NULL);
g_object_set (G_OBJECT (fakesink), "silent", TRUE, NULL);
g_object_set (G_OBJECT (fakesink), "sync", TRUE, NULL);
g_object_set (G_OBJECT (src), "location", location, NULL);
......@@ -263,7 +264,7 @@ make_vorbis_pipeline (const gchar *location)
src = gst_element_factory_make_or_warn (SOURCE, "src");
decoder = gst_element_factory_make_or_warn ("vorbisfile", "decoder");
audiosink = gst_element_factory_make_or_warn ("osssink", "sink");
//g_object_set (G_OBJECT (audiosink), "sync", FALSE, NULL);
g_object_set (G_OBJECT (audiosink), "sync", FALSE, NULL);
g_object_set (G_OBJECT (src), "location", location, NULL);
......@@ -364,13 +365,14 @@ make_avi_pipeline (const gchar *location)
video_bin = gst_bin_new ("v_decoder_bin");
//v_decoder = gst_element_factory_make_or_warn ("identity", "v_dec");
v_decoder = gst_element_factory_make_or_warn ("windec", "v_dec");
//v_decoder = gst_element_factory_make_or_warn ("windec", "v_dec");
v_decoder = gst_element_factory_make_or_warn ("ffdec_msmpeg4", "v_dec");
video_thread = gst_thread_new ("v_decoder_thread");
videosink = gst_element_factory_make_or_warn ("xvideosink", "v_sink");
//videosink = gst_element_factory_make_or_warn ("fakesink", "v_sink");
//g_object_set (G_OBJECT (videosink), "sync", TRUE, NULL);
v_queue = gst_element_factory_make_or_warn ("queue", "v_queue");
g_object_set (G_OBJECT (v_queue), "max_level", 10, NULL);
//g_object_set (G_OBJECT (v_queue), "max_level", 10, NULL);
gst_element_connect (v_decoder, v_queue);
gst_element_connect (v_queue, videosink);
gst_bin_add (GST_BIN (video_bin), v_decoder);
......@@ -405,8 +407,7 @@ make_mpeg_pipeline (const gchar *location)
g_object_set (G_OBJECT (src), "location", location, NULL);
demux = gst_element_factory_make_or_warn ("mpegdemux", "demux");
//g_object_set (G_OBJECT (demux), "sync", FALSE, NULL);
g_object_set (G_OBJECT (demux), "sync", TRUE, NULL);
//g_object_set (G_OBJECT (demux), "sync", TRUE, NULL);
seekable_elements = g_list_prepend (seekable_elements, demux);
......@@ -437,7 +438,7 @@ make_mpeg_pipeline (const gchar *location)
video_bin = gst_bin_new ("v_decoder_bin");
v_decoder = gst_element_factory_make_or_warn ("mpeg2dec", "v_dec");
video_thread = gst_thread_new ("v_decoder_thread");
g_object_set (G_OBJECT (video_thread), "schedpolicy", 2, NULL);
//g_object_set (G_OBJECT (video_thread), "priority", 2, NULL);
v_queue = gst_element_factory_make_or_warn ("queue", "v_queue");
v_filter = gst_element_factory_make_or_warn ("colorspace", "v_filter");
videosink = gst_element_factory_make_or_warn ("xvideosink", "v_sink");
......@@ -472,7 +473,6 @@ make_mpegnt_pipeline (const gchar *location)
g_object_set (G_OBJECT (src), "location", location, NULL);
demux = gst_element_factory_make_or_warn ("mpegdemux", "demux");
//g_object_set (G_OBJECT (demux), "sync", FALSE, NULL);
//g_object_set (G_OBJECT (demux), "sync", TRUE, NULL);
seekable_elements = g_list_prepend (seekable_elements, demux);
......@@ -856,8 +856,13 @@ main (int argc, char **argv)
/* show the gui. */
gtk_widget_show_all (window);
g_signal_connect (pipeline, "deep_notify", G_CALLBACK (gst_element_default_deep_notify), NULL);
g_signal_connect (pipeline, "error", G_CALLBACK (gst_element_default_error), NULL);
gtk_main ();
gst_element_set_state (pipeline, GST_STATE_NULL);
//gst_object_unref (GST_OBJECT (pipeline));
gst_buffer_print_stats();
gst_event_print_stats();
......
......@@ -40,7 +40,7 @@ entry_added (GstIndex *index, GstIndexEntry *entry)
{
gint i;
g_print ("%d: %08x ", entry->id, GST_INDEX_ASSOC_FLAGS (entry));
g_print ("%p, %d: %08x ", entry, entry->id, GST_INDEX_ASSOC_FLAGS (entry));
for (i = 0; i < GST_INDEX_NASSOCS (entry); i++) {
g_print ("%d %lld ", GST_INDEX_ASSOC_FORMAT (entry, i),
GST_INDEX_ASSOC_VALUE (entry, i));
......@@ -202,7 +202,7 @@ main (gint argc, gchar *argv[])
gint count = 0;
GstEvent *event;
gboolean res;
gint i;
GstElement *sink;
struct poptOption options[] = {
{ "verbose", 'v', POPT_ARG_NONE|POPT_ARGFLAG_STRIP, &verbose, 0,
"Print index entries", NULL},
......@@ -222,7 +222,8 @@ main (gint argc, gchar *argv[])
/* create index that elements can fill */
index = gst_index_factory_make ("memindex");
if (verbose)
index = NULL;
if (verbose && index)
g_signal_connect (G_OBJECT (index), "entry_added", G_CALLBACK (entry_added), NULL);
/* construct pipeline */
......@@ -265,15 +266,19 @@ main (gint argc, gchar *argv[])
gst_element_set_state (pipeline, GST_STATE_READY);
gst_element_set_state (pipeline, GST_STATE_PAUSED);
GST_FLAG_UNSET (index, GST_INDEX_WRITABLE);
if (index)
GST_FLAG_UNSET (index, GST_INDEX_WRITABLE);
src = gst_bin_get_by_name (GST_BIN (pipeline), "video_decoder");
pad = gst_element_get_pad (src, "src");
sink = gst_element_factory_make ("fakesink", "sink");
gst_element_connect_pads (src, "src", sink, "sink");
gst_bin_add (GST_BIN (pipeline), sink);
g_print ("seeking %s...\n", argv [2]);
event = gst_event_new_seek (GST_FORMAT_TIME |
GST_SEEK_METHOD_SET |
GST_SEEK_FLAG_FLUSH, 1 * GST_SECOND);
GST_SEEK_FLAG_FLUSH, 5 * GST_SECOND);
res = gst_pad_send_event (pad, event);
if (!res) {
......@@ -281,8 +286,12 @@ main (gint argc, gchar *argv[])
}
gst_element_set_state (pipeline, GST_STATE_PLAYING);
for (i = 0; i < 100; i++) {
gst_bin_iterate (GST_BIN (pipeline));
count = 0;
while (gst_bin_iterate (GST_BIN (pipeline))) {
if (!quiet && (count % 1000 == 0)) {
print_progress (pad);
}
count++;
}
gst_element_set_state (pipeline, GST_STATE_NULL);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment