- Cleanups

Original commit message from CVS:
- Cleanups
- remove old tracing API calls
This commit is contained in:
Wim Taymans 2003-02-02 19:25:58 +00:00
parent 0a1d9ddd6a
commit 3b184849b1
12 changed files with 118 additions and 90 deletions

View file

@ -215,8 +215,5 @@ main (int argc, char **argv)
/* shutdown everything again */ /* shutdown everything again */
gst_element_set_state (pipeline, GST_STATE_NULL); gst_element_set_state (pipeline, GST_STATE_NULL);
gst_buffer_print_stats();
gst_event_print_stats();
return 0; return 0;
} }

View file

@ -296,8 +296,5 @@ main (int argc, char **argv)
gst_element_set_state (pipeline, GST_STATE_NULL); gst_element_set_state (pipeline, GST_STATE_NULL);
gst_buffer_print_stats();
gst_event_print_stats();
return 0; return 0;
} }

View file

@ -264,7 +264,7 @@ make_vorbis_pipeline (const gchar *location)
src = gst_element_factory_make_or_warn (SOURCE, "src"); src = gst_element_factory_make_or_warn (SOURCE, "src");
decoder = gst_element_factory_make_or_warn ("vorbisfile", "decoder"); decoder = gst_element_factory_make_or_warn ("vorbisfile", "decoder");
audiosink = gst_element_factory_make_or_warn ("osssink", "sink"); 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", TRUE, NULL);
g_object_set (G_OBJECT (src), "location", location, NULL); g_object_set (G_OBJECT (src), "location", location, NULL);
@ -366,7 +366,7 @@ make_avi_pipeline (const gchar *location)
video_bin = gst_bin_new ("v_decoder_bin"); 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 ("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"); v_decoder = gst_element_factory_make_or_warn ("ffmpegdecall", "v_dec");
video_thread = gst_thread_new ("v_decoder_thread"); 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 ("xvideosink", "v_sink");
//videosink = gst_element_factory_make_or_warn ("fakesink", "v_sink"); //videosink = gst_element_factory_make_or_warn ("fakesink", "v_sink");
@ -407,7 +407,7 @@ make_mpeg_pipeline (const gchar *location)
g_object_set (G_OBJECT (src), "location", location, NULL); g_object_set (G_OBJECT (src), "location", location, NULL);
demux = gst_element_factory_make_or_warn ("mpegdemux", "demux"); demux = gst_element_factory_make_or_warn ("mpegdemux", "demux");
g_object_set (G_OBJECT (demux), "sync", TRUE, NULL); g_object_set (G_OBJECT (demux), "sync", FALSE, NULL);
seekable_elements = g_list_prepend (seekable_elements, demux); seekable_elements = g_list_prepend (seekable_elements, demux);
@ -520,6 +520,12 @@ make_mpegnt_pipeline (const gchar *location)
return pipeline; return pipeline;
} }
static GstElement*
make_playerbin_pipeline (const gchar *location)
{
return NULL;
}
static gchar* static gchar*
format_value (GtkScale *scale, format_value (GtkScale *scale,
gdouble value) gdouble value)
@ -774,6 +780,43 @@ stop_cb (GtkButton * button, gpointer data)
} }
} }
typedef struct
{
gchar *name;
GstElement* (*func) (const gchar *location);
} Pipeline;
static Pipeline pipelines[] = {
{ "mp3", make_mp3_pipeline },
{ "avi", make_avi_pipeline },
{ "mpeg1", make_mpeg_pipeline },
{ "mpegparse", make_parse_pipeline },
{ "vorbis", make_vorbis_pipeline },
{ "sid", make_sid_pipeline },
{ "flac", make_flac_pipeline },
{ "wav", make_wav_pipeline },
{ "mod", make_mod_pipeline },
{ "dv", make_dv_pipeline },
{ "mpeg1nothreads", make_mpegnt_pipeline },
{ "playerbin", make_playerbin_pipeline },
{ NULL, NULL},
};
#define NUM_TYPES ((sizeof (pipelines) / sizeof (Pipeline)) - 1)
static void
print_usage (int argc, char **argv)
{
gint i;
g_print ("usage: %s <type> <filename>\n", argv[0]);
g_print (" possible types:\n");
for (i = 0; i < NUM_TYPES; i++) {
g_print (" %d = %s\n", i, pipelines[i].name);
}
}
int int
main (int argc, char **argv) main (int argc, char **argv)
{ {
@ -781,41 +824,29 @@ main (int argc, char **argv)
*play_button, *pause_button, *stop_button, *play_button, *pause_button, *stop_button,
*hscale; *hscale;
struct poptOption options[] = { struct poptOption options[] = {
{"stats", 's', POPT_ARG_NONE|POPT_ARGFLAG_STRIP, &stats, 0, { "stats", 's', POPT_ARG_NONE|POPT_ARGFLAG_STRIP, &stats, 0,
"Show pad stats", NULL}, "Show pad stats", NULL },
POPT_TABLEEND POPT_TABLEEND
}; };
gint type;
gst_init_with_popt_table (&argc, &argv, options); gst_init_with_popt_table (&argc, &argv, options);
gtk_init (&argc, &argv); gtk_init (&argc, &argv);
if (argc != 3) { if (argc != 3) {
g_print ("usage: %s <type 0=mp3 1=avi 2=mpeg1 3=mpegparse 4=vorbis 5=sid 6=flac 7=wav 8=mod 9=dv 10=mpeg1nothreads> <filename>\n", argv[0]); print_usage (argc, argv);
exit (-1); exit (-1);
} }
if (atoi (argv[1]) == 0) type = atoi (argv[1]);
pipeline = make_mp3_pipeline (argv[2]);
else if (atoi (argv[1]) == 1) if (type < 0 || type >= NUM_TYPES) {
pipeline = make_avi_pipeline (argv[2]); print_usage (argc, argv);
else if (atoi (argv[1]) == 2) exit (-1);
pipeline = make_mpeg_pipeline (argv[2]); }
else if (atoi (argv[1]) == 3)
pipeline = make_parse_pipeline (argv[2]); pipeline = pipelines[type].func (argv[2]);
else if (atoi (argv[1]) == 4) g_assert (pipeline);
pipeline = make_vorbis_pipeline (argv[2]);
else if (atoi (argv[1]) == 5)
pipeline = make_sid_pipeline (argv[2]);
else if (atoi (argv[1]) == 6)
pipeline = make_flac_pipeline (argv[2]);
else if (atoi (argv[1]) == 7)
pipeline = make_wav_pipeline (argv[2]);
else if (atoi (argv[1]) == 8)
pipeline = make_mod_pipeline (argv[2]);
else if (atoi (argv[1]) == 9)
pipeline = make_dv_pipeline (argv[2]);
else if (atoi (argv[1]) == 10)
pipeline = make_mpegnt_pipeline (argv[2]);
/* initialize gui elements ... */ /* initialize gui elements ... */
window = gtk_window_new (GTK_WINDOW_TOPLEVEL); window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
@ -863,8 +894,6 @@ main (int argc, char **argv)
gst_element_set_state (pipeline, GST_STATE_NULL); gst_element_set_state (pipeline, GST_STATE_NULL);
//gst_object_unref (GST_OBJECT (pipeline)); //gst_object_unref (GST_OBJECT (pipeline));
gst_buffer_print_stats();
gst_event_print_stats();
//g_mem_chunk_info(); //g_mem_chunk_info();

View file

@ -371,8 +371,5 @@ main (int argc, char **argv)
gtk_main (); gtk_main ();
gst_buffer_print_stats();
gst_event_print_stats();
return 0; return 0;
} }

View file

@ -316,8 +316,5 @@ main (int argc, char **argv)
/* stop probe */ /* stop probe */
gst_element_set_state (pipeline, GST_STATE_NULL); gst_element_set_state (pipeline, GST_STATE_NULL);
gst_buffer_print_stats();
gst_event_print_stats();
return 0; return 0;
} }

View file

@ -264,7 +264,7 @@ make_vorbis_pipeline (const gchar *location)
src = gst_element_factory_make_or_warn (SOURCE, "src"); src = gst_element_factory_make_or_warn (SOURCE, "src");
decoder = gst_element_factory_make_or_warn ("vorbisfile", "decoder"); decoder = gst_element_factory_make_or_warn ("vorbisfile", "decoder");
audiosink = gst_element_factory_make_or_warn ("osssink", "sink"); 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", TRUE, NULL);
g_object_set (G_OBJECT (src), "location", location, NULL); g_object_set (G_OBJECT (src), "location", location, NULL);
@ -366,7 +366,7 @@ make_avi_pipeline (const gchar *location)
video_bin = gst_bin_new ("v_decoder_bin"); 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 ("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"); v_decoder = gst_element_factory_make_or_warn ("ffmpegdecall", "v_dec");
video_thread = gst_thread_new ("v_decoder_thread"); 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 ("xvideosink", "v_sink");
//videosink = gst_element_factory_make_or_warn ("fakesink", "v_sink"); //videosink = gst_element_factory_make_or_warn ("fakesink", "v_sink");
@ -407,7 +407,7 @@ make_mpeg_pipeline (const gchar *location)
g_object_set (G_OBJECT (src), "location", location, NULL); g_object_set (G_OBJECT (src), "location", location, NULL);
demux = gst_element_factory_make_or_warn ("mpegdemux", "demux"); demux = gst_element_factory_make_or_warn ("mpegdemux", "demux");
g_object_set (G_OBJECT (demux), "sync", TRUE, NULL); g_object_set (G_OBJECT (demux), "sync", FALSE, NULL);
seekable_elements = g_list_prepend (seekable_elements, demux); seekable_elements = g_list_prepend (seekable_elements, demux);
@ -520,6 +520,12 @@ make_mpegnt_pipeline (const gchar *location)
return pipeline; return pipeline;
} }
static GstElement*
make_playerbin_pipeline (const gchar *location)
{
return NULL;
}
static gchar* static gchar*
format_value (GtkScale *scale, format_value (GtkScale *scale,
gdouble value) gdouble value)
@ -774,6 +780,43 @@ stop_cb (GtkButton * button, gpointer data)
} }
} }
typedef struct
{
gchar *name;
GstElement* (*func) (const gchar *location);
} Pipeline;
static Pipeline pipelines[] = {
{ "mp3", make_mp3_pipeline },
{ "avi", make_avi_pipeline },
{ "mpeg1", make_mpeg_pipeline },
{ "mpegparse", make_parse_pipeline },
{ "vorbis", make_vorbis_pipeline },
{ "sid", make_sid_pipeline },
{ "flac", make_flac_pipeline },
{ "wav", make_wav_pipeline },
{ "mod", make_mod_pipeline },
{ "dv", make_dv_pipeline },
{ "mpeg1nothreads", make_mpegnt_pipeline },
{ "playerbin", make_playerbin_pipeline },
{ NULL, NULL},
};
#define NUM_TYPES ((sizeof (pipelines) / sizeof (Pipeline)) - 1)
static void
print_usage (int argc, char **argv)
{
gint i;
g_print ("usage: %s <type> <filename>\n", argv[0]);
g_print (" possible types:\n");
for (i = 0; i < NUM_TYPES; i++) {
g_print (" %d = %s\n", i, pipelines[i].name);
}
}
int int
main (int argc, char **argv) main (int argc, char **argv)
{ {
@ -781,41 +824,29 @@ main (int argc, char **argv)
*play_button, *pause_button, *stop_button, *play_button, *pause_button, *stop_button,
*hscale; *hscale;
struct poptOption options[] = { struct poptOption options[] = {
{"stats", 's', POPT_ARG_NONE|POPT_ARGFLAG_STRIP, &stats, 0, { "stats", 's', POPT_ARG_NONE|POPT_ARGFLAG_STRIP, &stats, 0,
"Show pad stats", NULL}, "Show pad stats", NULL },
POPT_TABLEEND POPT_TABLEEND
}; };
gint type;
gst_init_with_popt_table (&argc, &argv, options); gst_init_with_popt_table (&argc, &argv, options);
gtk_init (&argc, &argv); gtk_init (&argc, &argv);
if (argc != 3) { if (argc != 3) {
g_print ("usage: %s <type 0=mp3 1=avi 2=mpeg1 3=mpegparse 4=vorbis 5=sid 6=flac 7=wav 8=mod 9=dv 10=mpeg1nothreads> <filename>\n", argv[0]); print_usage (argc, argv);
exit (-1); exit (-1);
} }
if (atoi (argv[1]) == 0) type = atoi (argv[1]);
pipeline = make_mp3_pipeline (argv[2]);
else if (atoi (argv[1]) == 1) if (type < 0 || type >= NUM_TYPES) {
pipeline = make_avi_pipeline (argv[2]); print_usage (argc, argv);
else if (atoi (argv[1]) == 2) exit (-1);
pipeline = make_mpeg_pipeline (argv[2]); }
else if (atoi (argv[1]) == 3)
pipeline = make_parse_pipeline (argv[2]); pipeline = pipelines[type].func (argv[2]);
else if (atoi (argv[1]) == 4) g_assert (pipeline);
pipeline = make_vorbis_pipeline (argv[2]);
else if (atoi (argv[1]) == 5)
pipeline = make_sid_pipeline (argv[2]);
else if (atoi (argv[1]) == 6)
pipeline = make_flac_pipeline (argv[2]);
else if (atoi (argv[1]) == 7)
pipeline = make_wav_pipeline (argv[2]);
else if (atoi (argv[1]) == 8)
pipeline = make_mod_pipeline (argv[2]);
else if (atoi (argv[1]) == 9)
pipeline = make_dv_pipeline (argv[2]);
else if (atoi (argv[1]) == 10)
pipeline = make_mpegnt_pipeline (argv[2]);
/* initialize gui elements ... */ /* initialize gui elements ... */
window = gtk_window_new (GTK_WINDOW_TOPLEVEL); window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
@ -863,8 +894,6 @@ main (int argc, char **argv)
gst_element_set_state (pipeline, GST_STATE_NULL); gst_element_set_state (pipeline, GST_STATE_NULL);
//gst_object_unref (GST_OBJECT (pipeline)); //gst_object_unref (GST_OBJECT (pipeline));
gst_buffer_print_stats();
gst_event_print_stats();
//g_mem_chunk_info(); //g_mem_chunk_info();

View file

@ -371,8 +371,5 @@ main (int argc, char **argv)
gtk_main (); gtk_main ();
gst_buffer_print_stats();
gst_event_print_stats();
return 0; return 0;
} }

View file

@ -316,8 +316,5 @@ main (int argc, char **argv)
/* stop probe */ /* stop probe */
gst_element_set_state (pipeline, GST_STATE_NULL); gst_element_set_state (pipeline, GST_STATE_NULL);
gst_buffer_print_stats();
gst_event_print_stats();
return 0; return 0;
} }

View file

@ -215,8 +215,5 @@ main (int argc, char **argv)
/* shutdown everything again */ /* shutdown everything again */
gst_element_set_state (pipeline, GST_STATE_NULL); gst_element_set_state (pipeline, GST_STATE_NULL);
gst_buffer_print_stats();
gst_event_print_stats();
return 0; return 0;
} }

View file

@ -296,8 +296,5 @@ main (int argc, char **argv)
gst_element_set_state (pipeline, GST_STATE_NULL); gst_element_set_state (pipeline, GST_STATE_NULL);
gst_buffer_print_stats();
gst_event_print_stats();
return 0; return 0;
} }

View file

@ -371,8 +371,5 @@ main (int argc, char **argv)
gtk_main (); gtk_main ();
gst_buffer_print_stats();
gst_event_print_stats();
return 0; return 0;
} }

View file

@ -316,8 +316,5 @@ main (int argc, char **argv)
/* stop probe */ /* stop probe */
gst_element_set_state (pipeline, GST_STATE_NULL); gst_element_set_state (pipeline, GST_STATE_NULL);
gst_buffer_print_stats();
gst_event_print_stats();
return 0; return 0;
} }