configure.ac: Put DEFAULT_AUDIOSINK in config.h and use whereever possible. (Fixes #165997)
Original commit message from CVS:
* configure.ac: Put DEFAULT_AUDIOSINK in config.h and use
whereever possible. (Fixes #165997)
* examples/capsfilter/capsfilter1.c: (main):
* examples/dynparams/filter.c: (create_ui):
* examples/seeking/cdparanoia.c: (get_track_info), (main):
* examples/seeking/chained.c: (main):
* examples/seeking/seek.c: (make_mod_pipeline), (make_dv_pipeline),
(make_wav_pipeline), (make_flac_pipeline), (make_sid_pipeline),
(make_vorbis_pipeline), (make_mp3_pipeline), (make_avi_pipeline),
(make_mpeg_pipeline), (make_mpegnt_pipeline):
* examples/seeking/spider_seek.c: (make_spider_pipeline):
* examples/switch/switcher.c: (main):
* ext/dv/demo-play.c: (main):
* ext/faad/gstfaad.c: (gst_faad_change_state):
* ext/mad/gstmad.c: (gst_mad_chain):
* ext/smoothwave/demo-osssrc.c: (main):
* gst-libs/gst/gconf/gconf.c: (gst_gconf_set_string),
(gst_gconf_render_bin_from_description),
(gst_gconf_get_default_audio_sink),
(gst_gconf_get_default_video_sink),
(gst_gconf_get_default_audio_src),
(gst_gconf_get_default_video_src),
(gst_gconf_get_default_visualization_element):
* gst/level/demo.c: (main):
* gst/level/plot.c: (main):
* gst/playback/gstplaybin.c: (gen_video_element),
(gen_audio_element):
* gst/playback/test.c: (gen_video_element), (gen_audio_element):
* gst/playondemand/demo-mp3.c: (setup_pipeline):
* gst/sine/demo-dparams.c: (main):
* gst/spectrum/demo-osssrc.c: (main):
* gst/speed/demo-mp3.c: (main):
* gst/volume/demo.c: (main):
* testsuite/embed/embed.c: (main):
2005-02-02 08:14:01 +00:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include "config.h"
|
|
|
|
#endif
|
2002-08-11 11:45:07 +00:00
|
|
|
#include <stdlib.h>
|
2002-06-08 14:57:15 +00:00
|
|
|
#include <glib.h>
|
|
|
|
#include <gtk/gtk.h>
|
|
|
|
#include <gst/gst.h>
|
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
static GList *rate_pads = NULL;
|
|
|
|
static GList *seekable_elements = NULL;
|
|
|
|
|
|
|
|
static GstElement *pipeline;
|
|
|
|
static GtkAdjustment *adjustment;
|
2002-06-11 19:20:52 +00:00
|
|
|
static gboolean stats = FALSE;
|
|
|
|
static guint64 duration;
|
2002-06-08 14:57:15 +00:00
|
|
|
|
|
|
|
static guint update_id;
|
|
|
|
|
2002-06-11 19:20:52 +00:00
|
|
|
//#define SOURCE "gnomevfssrc"
|
|
|
|
#define SOURCE "filesrc"
|
2002-06-08 14:57:15 +00:00
|
|
|
|
|
|
|
#define UPDATE_INTERVAL 500
|
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
static GstElement *
|
|
|
|
make_spider_pipeline (const gchar * location, gboolean thread)
|
2002-06-08 14:57:15 +00:00
|
|
|
{
|
|
|
|
GstElement *pipeline;
|
2004-03-14 22:34:33 +00:00
|
|
|
GstElement *src, *decoder, *audiosink, *videosink, *a_thread, *v_thread,
|
|
|
|
*a_queue, *v_queue;
|
|
|
|
|
2002-06-09 10:58:37 +00:00
|
|
|
if (thread) {
|
|
|
|
pipeline = gst_thread_new ("app");
|
2004-03-14 22:34:33 +00:00
|
|
|
} else {
|
2002-06-09 10:58:37 +00:00
|
|
|
pipeline = gst_pipeline_new ("app");
|
|
|
|
}
|
2004-03-14 22:34:33 +00:00
|
|
|
|
2002-06-08 14:57:15 +00:00
|
|
|
|
|
|
|
src = gst_element_factory_make (SOURCE, "src");
|
|
|
|
decoder = gst_element_factory_make ("spider", "decoder");
|
2002-06-09 00:26:26 +00:00
|
|
|
a_thread = gst_thread_new ("a_thread");
|
|
|
|
a_queue = gst_element_factory_make ("queue", "a_queue");
|
configure.ac: Put DEFAULT_AUDIOSINK in config.h and use whereever possible. (Fixes #165997)
Original commit message from CVS:
* configure.ac: Put DEFAULT_AUDIOSINK in config.h and use
whereever possible. (Fixes #165997)
* examples/capsfilter/capsfilter1.c: (main):
* examples/dynparams/filter.c: (create_ui):
* examples/seeking/cdparanoia.c: (get_track_info), (main):
* examples/seeking/chained.c: (main):
* examples/seeking/seek.c: (make_mod_pipeline), (make_dv_pipeline),
(make_wav_pipeline), (make_flac_pipeline), (make_sid_pipeline),
(make_vorbis_pipeline), (make_mp3_pipeline), (make_avi_pipeline),
(make_mpeg_pipeline), (make_mpegnt_pipeline):
* examples/seeking/spider_seek.c: (make_spider_pipeline):
* examples/switch/switcher.c: (main):
* ext/dv/demo-play.c: (main):
* ext/faad/gstfaad.c: (gst_faad_change_state):
* ext/mad/gstmad.c: (gst_mad_chain):
* ext/smoothwave/demo-osssrc.c: (main):
* gst-libs/gst/gconf/gconf.c: (gst_gconf_set_string),
(gst_gconf_render_bin_from_description),
(gst_gconf_get_default_audio_sink),
(gst_gconf_get_default_video_sink),
(gst_gconf_get_default_audio_src),
(gst_gconf_get_default_video_src),
(gst_gconf_get_default_visualization_element):
* gst/level/demo.c: (main):
* gst/level/plot.c: (main):
* gst/playback/gstplaybin.c: (gen_video_element),
(gen_audio_element):
* gst/playback/test.c: (gen_video_element), (gen_audio_element):
* gst/playondemand/demo-mp3.c: (setup_pipeline):
* gst/sine/demo-dparams.c: (main):
* gst/spectrum/demo-osssrc.c: (main):
* gst/speed/demo-mp3.c: (main):
* gst/volume/demo.c: (main):
* testsuite/embed/embed.c: (main):
2005-02-02 08:14:01 +00:00
|
|
|
audiosink = gst_element_factory_make (DEFAULT_AUDIOSINK, "a_sink");
|
2002-06-11 19:20:52 +00:00
|
|
|
//g_object_set (G_OBJECT (audiosink), "fragment", 0x00180008, NULL);
|
|
|
|
|
2002-06-09 00:26:26 +00:00
|
|
|
v_thread = gst_thread_new ("v_thread");
|
|
|
|
v_queue = gst_element_factory_make ("queue", "v_queue");
|
configure.ac: Put DEFAULT_AUDIOSINK in config.h and use whereever possible. (Fixes #165997)
Original commit message from CVS:
* configure.ac: Put DEFAULT_AUDIOSINK in config.h and use
whereever possible. (Fixes #165997)
* examples/capsfilter/capsfilter1.c: (main):
* examples/dynparams/filter.c: (create_ui):
* examples/seeking/cdparanoia.c: (get_track_info), (main):
* examples/seeking/chained.c: (main):
* examples/seeking/seek.c: (make_mod_pipeline), (make_dv_pipeline),
(make_wav_pipeline), (make_flac_pipeline), (make_sid_pipeline),
(make_vorbis_pipeline), (make_mp3_pipeline), (make_avi_pipeline),
(make_mpeg_pipeline), (make_mpegnt_pipeline):
* examples/seeking/spider_seek.c: (make_spider_pipeline):
* examples/switch/switcher.c: (main):
* ext/dv/demo-play.c: (main):
* ext/faad/gstfaad.c: (gst_faad_change_state):
* ext/mad/gstmad.c: (gst_mad_chain):
* ext/smoothwave/demo-osssrc.c: (main):
* gst-libs/gst/gconf/gconf.c: (gst_gconf_set_string),
(gst_gconf_render_bin_from_description),
(gst_gconf_get_default_audio_sink),
(gst_gconf_get_default_video_sink),
(gst_gconf_get_default_audio_src),
(gst_gconf_get_default_video_src),
(gst_gconf_get_default_visualization_element):
* gst/level/demo.c: (main):
* gst/level/plot.c: (main):
* gst/playback/gstplaybin.c: (gen_video_element),
(gen_audio_element):
* gst/playback/test.c: (gen_video_element), (gen_audio_element):
* gst/playondemand/demo-mp3.c: (setup_pipeline):
* gst/sine/demo-dparams.c: (main):
* gst/spectrum/demo-osssrc.c: (main):
* gst/speed/demo-mp3.c: (main):
* gst/volume/demo.c: (main):
* testsuite/embed/embed.c: (main):
2005-02-02 08:14:01 +00:00
|
|
|
videosink = gst_element_factory_make (DEFAULT_VIDEOSINK, "v_sink");
|
2002-06-08 14:57:15 +00:00
|
|
|
//g_object_set (G_OBJECT (audiosink), "sync", FALSE, NULL);
|
|
|
|
|
|
|
|
g_object_set (G_OBJECT (src), "location", location, NULL);
|
|
|
|
|
|
|
|
gst_bin_add (GST_BIN (pipeline), src);
|
|
|
|
gst_bin_add (GST_BIN (pipeline), decoder);
|
2002-06-09 00:26:26 +00:00
|
|
|
gst_bin_add (GST_BIN (a_thread), a_queue);
|
|
|
|
gst_bin_add (GST_BIN (a_thread), audiosink);
|
|
|
|
gst_bin_add (GST_BIN (v_thread), v_queue);
|
|
|
|
gst_bin_add (GST_BIN (v_thread), videosink);
|
|
|
|
gst_bin_add (GST_BIN (pipeline), a_thread);
|
|
|
|
gst_bin_add (GST_BIN (pipeline), v_thread);
|
2002-06-08 14:57:15 +00:00
|
|
|
|
2003-01-10 10:22:25 +00:00
|
|
|
gst_element_link (src, decoder);
|
|
|
|
gst_element_link (v_queue, videosink);
|
|
|
|
gst_element_link (decoder, v_queue);
|
|
|
|
gst_element_link (a_queue, audiosink);
|
|
|
|
gst_element_link (decoder, a_queue);
|
2002-06-08 14:57:15 +00:00
|
|
|
|
2002-06-09 00:26:26 +00:00
|
|
|
seekable_elements = g_list_prepend (seekable_elements, videosink);
|
|
|
|
seekable_elements = g_list_prepend (seekable_elements, audiosink);
|
2004-03-14 22:34:33 +00:00
|
|
|
rate_pads =
|
|
|
|
g_list_prepend (rate_pads, gst_element_get_pad (audiosink, "sink"));
|
|
|
|
rate_pads =
|
|
|
|
g_list_prepend (rate_pads, gst_element_get_pad (videosink, "sink"));
|
2002-06-08 14:57:15 +00:00
|
|
|
|
|
|
|
return pipeline;
|
|
|
|
}
|
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
static gchar *
|
|
|
|
format_value (GtkScale * scale, gdouble value)
|
2002-06-08 14:57:15 +00:00
|
|
|
{
|
|
|
|
gint64 real;
|
|
|
|
gint64 seconds;
|
|
|
|
gint64 subseconds;
|
|
|
|
|
|
|
|
real = value * duration / 100;
|
|
|
|
seconds = (gint64) real / GST_SECOND;
|
|
|
|
subseconds = (gint64) real / (GST_SECOND / 100);
|
|
|
|
|
Fixes: #151879, #151881, #151882, #151883, #151884, #151886, #151887, #152102, #152247.
Original commit message from CVS:
Fixes: #151879, #151881, #151882, #151883, #151884, #151886,
#151887, #152102, #152247.
* examples/indexing/indexmpeg.c: 64-bit warning fixes.
* examples/seeking/cdparanoia.c: same
* examples/seeking/cdplayer.c: same
* examples/seeking/seek.c: same
* examples/seeking/spider_seek.c: same
* examples/seeking/vorbisfile.c: same
* examples/stats/mp2ogg.c: same
* ext/esd/esdsink.c: (gst_esdsink_class_init),
(gst_esdsink_dispose): Dispose of element properly.
* ext/ivorbis/vorbisfile.c: (gst_ivorbisfile_seek): 64-bit warning
fixes.
* ext/nas/nassink.c: (gst_nassink_class_init),
(gst_nassink_dispose): Dispose of element correctly.
* gst/wavenc/gstwavenc.c: (gst_wavenc_chain): Fix leak.
* sys/ximage/ximagesink.c: (gst_ximagesink_check_xshm_calls),
(gst_ximagesink_ximage_new), (gst_ximagesink_ximage_destroy):
Fix 64-bit warning.
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_check_xshm_calls),
(gst_xvimagesink_xvimage_new), (gst_xvimagesink_xvimage_destroy):
Fix 64-bit warning.
2004-09-12 22:57:26 +00:00
|
|
|
return g_strdup_printf ("%02" G_GINT64_FORMAT ":%02" G_GINT64_FORMAT ":%02"
|
|
|
|
G_GINT64_FORMAT, seconds / 60, seconds % 60, subseconds % 100);
|
2002-06-08 14:57:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
const gchar *name;
|
|
|
|
const GstFormat format;
|
2004-03-15 19:32:27 +00:00
|
|
|
}
|
|
|
|
seek_format;
|
2002-06-08 14:57:15 +00:00
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
static seek_format seek_formats[] = {
|
|
|
|
{"tim", GST_FORMAT_TIME},
|
|
|
|
{"byt", GST_FORMAT_BYTES},
|
|
|
|
{"buf", GST_FORMAT_BUFFERS},
|
|
|
|
{"def", GST_FORMAT_DEFAULT},
|
|
|
|
{NULL, 0},
|
2002-06-08 14:57:15 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
G_GNUC_UNUSED static void
|
|
|
|
query_rates (void)
|
|
|
|
{
|
|
|
|
GList *walk = rate_pads;
|
|
|
|
|
|
|
|
while (walk) {
|
|
|
|
GstPad *pad = GST_PAD (walk->data);
|
|
|
|
gint i = 0;
|
|
|
|
|
|
|
|
g_print ("rate/sec %8.8s: ", GST_PAD_NAME (pad));
|
|
|
|
while (seek_formats[i].name) {
|
|
|
|
gint64 value;
|
|
|
|
GstFormat format;
|
|
|
|
|
|
|
|
format = seek_formats[i].format;
|
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
if (gst_pad_convert (pad, GST_FORMAT_TIME, GST_SECOND, &format, &value)) {
|
Fixes: #151879, #151881, #151882, #151883, #151884, #151886, #151887, #152102, #152247.
Original commit message from CVS:
Fixes: #151879, #151881, #151882, #151883, #151884, #151886,
#151887, #152102, #152247.
* examples/indexing/indexmpeg.c: 64-bit warning fixes.
* examples/seeking/cdparanoia.c: same
* examples/seeking/cdplayer.c: same
* examples/seeking/seek.c: same
* examples/seeking/spider_seek.c: same
* examples/seeking/vorbisfile.c: same
* examples/stats/mp2ogg.c: same
* ext/esd/esdsink.c: (gst_esdsink_class_init),
(gst_esdsink_dispose): Dispose of element properly.
* ext/ivorbis/vorbisfile.c: (gst_ivorbisfile_seek): 64-bit warning
fixes.
* ext/nas/nassink.c: (gst_nassink_class_init),
(gst_nassink_dispose): Dispose of element correctly.
* gst/wavenc/gstwavenc.c: (gst_wavenc_chain): Fix leak.
* sys/ximage/ximagesink.c: (gst_ximagesink_check_xshm_calls),
(gst_ximagesink_ximage_new), (gst_ximagesink_ximage_destroy):
Fix 64-bit warning.
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_check_xshm_calls),
(gst_xvimagesink_xvimage_new), (gst_xvimagesink_xvimage_destroy):
Fix 64-bit warning.
2004-09-12 22:57:26 +00:00
|
|
|
g_print ("%s %13" G_GINT64_FORMAT " | ", seek_formats[i].name, value);
|
2004-03-14 22:34:33 +00:00
|
|
|
} else {
|
2004-03-15 19:32:27 +00:00
|
|
|
g_print ("%s %13.13s | ", seek_formats[i].name, "*NA*");
|
2002-06-08 14:57:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
i++;
|
|
|
|
}
|
|
|
|
g_print (" %s:%s\n", GST_DEBUG_PAD_NAME (pad));
|
|
|
|
|
|
|
|
walk = g_list_next (walk);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
G_GNUC_UNUSED static void
|
2002-06-11 19:20:52 +00:00
|
|
|
query_durations ()
|
2002-06-08 14:57:15 +00:00
|
|
|
{
|
2002-06-11 19:20:52 +00:00
|
|
|
GList *walk = seekable_elements;
|
|
|
|
|
|
|
|
while (walk) {
|
|
|
|
GstElement *element = GST_ELEMENT (walk->data);
|
|
|
|
gint i = 0;
|
|
|
|
|
|
|
|
g_print ("durations %8.8s: ", GST_ELEMENT_NAME (element));
|
|
|
|
while (seek_formats[i].name) {
|
|
|
|
gboolean res;
|
|
|
|
gint64 value;
|
|
|
|
GstFormat format;
|
|
|
|
|
|
|
|
format = seek_formats[i].format;
|
2002-12-30 17:53:18 +00:00
|
|
|
res = gst_element_query (element, GST_QUERY_TOTAL, &format, &value);
|
2002-06-11 19:20:52 +00:00
|
|
|
if (res) {
|
Fixes: #151879, #151881, #151882, #151883, #151884, #151886, #151887, #152102, #152247.
Original commit message from CVS:
Fixes: #151879, #151881, #151882, #151883, #151884, #151886,
#151887, #152102, #152247.
* examples/indexing/indexmpeg.c: 64-bit warning fixes.
* examples/seeking/cdparanoia.c: same
* examples/seeking/cdplayer.c: same
* examples/seeking/seek.c: same
* examples/seeking/spider_seek.c: same
* examples/seeking/vorbisfile.c: same
* examples/stats/mp2ogg.c: same
* ext/esd/esdsink.c: (gst_esdsink_class_init),
(gst_esdsink_dispose): Dispose of element properly.
* ext/ivorbis/vorbisfile.c: (gst_ivorbisfile_seek): 64-bit warning
fixes.
* ext/nas/nassink.c: (gst_nassink_class_init),
(gst_nassink_dispose): Dispose of element correctly.
* gst/wavenc/gstwavenc.c: (gst_wavenc_chain): Fix leak.
* sys/ximage/ximagesink.c: (gst_ximagesink_check_xshm_calls),
(gst_ximagesink_ximage_new), (gst_ximagesink_ximage_destroy):
Fix 64-bit warning.
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_check_xshm_calls),
(gst_xvimagesink_xvimage_new), (gst_xvimagesink_xvimage_destroy):
Fix 64-bit warning.
2004-09-12 22:57:26 +00:00
|
|
|
g_print ("%s %13" G_GINT64_FORMAT " | ", seek_formats[i].name, value);
|
2004-03-14 22:34:33 +00:00
|
|
|
} else {
|
2004-03-15 19:32:27 +00:00
|
|
|
g_print ("%s %13.13s | ", seek_formats[i].name, "*NA*");
|
2002-06-11 19:20:52 +00:00
|
|
|
}
|
|
|
|
i++;
|
2002-06-08 14:57:15 +00:00
|
|
|
}
|
2002-06-11 19:20:52 +00:00
|
|
|
g_print (" %s\n", GST_ELEMENT_NAME (element));
|
|
|
|
walk = g_list_next (walk);
|
2002-06-08 14:57:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
G_GNUC_UNUSED static void
|
2002-06-11 19:20:52 +00:00
|
|
|
query_positions ()
|
2002-06-08 14:57:15 +00:00
|
|
|
{
|
2002-06-11 19:20:52 +00:00
|
|
|
GList *walk = seekable_elements;
|
|
|
|
|
|
|
|
while (walk) {
|
|
|
|
GstElement *element = GST_ELEMENT (walk->data);
|
|
|
|
gint i = 0;
|
|
|
|
|
|
|
|
g_print ("positions %8.8s: ", GST_ELEMENT_NAME (element));
|
|
|
|
while (seek_formats[i].name) {
|
|
|
|
gboolean res;
|
|
|
|
gint64 value;
|
|
|
|
GstFormat format;
|
|
|
|
|
|
|
|
format = seek_formats[i].format;
|
2002-12-30 17:53:18 +00:00
|
|
|
res = gst_element_query (element, GST_QUERY_POSITION, &format, &value);
|
2002-06-11 19:20:52 +00:00
|
|
|
if (res) {
|
Fixes: #151879, #151881, #151882, #151883, #151884, #151886, #151887, #152102, #152247.
Original commit message from CVS:
Fixes: #151879, #151881, #151882, #151883, #151884, #151886,
#151887, #152102, #152247.
* examples/indexing/indexmpeg.c: 64-bit warning fixes.
* examples/seeking/cdparanoia.c: same
* examples/seeking/cdplayer.c: same
* examples/seeking/seek.c: same
* examples/seeking/spider_seek.c: same
* examples/seeking/vorbisfile.c: same
* examples/stats/mp2ogg.c: same
* ext/esd/esdsink.c: (gst_esdsink_class_init),
(gst_esdsink_dispose): Dispose of element properly.
* ext/ivorbis/vorbisfile.c: (gst_ivorbisfile_seek): 64-bit warning
fixes.
* ext/nas/nassink.c: (gst_nassink_class_init),
(gst_nassink_dispose): Dispose of element correctly.
* gst/wavenc/gstwavenc.c: (gst_wavenc_chain): Fix leak.
* sys/ximage/ximagesink.c: (gst_ximagesink_check_xshm_calls),
(gst_ximagesink_ximage_new), (gst_ximagesink_ximage_destroy):
Fix 64-bit warning.
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_check_xshm_calls),
(gst_xvimagesink_xvimage_new), (gst_xvimagesink_xvimage_destroy):
Fix 64-bit warning.
2004-09-12 22:57:26 +00:00
|
|
|
g_print ("%s %13" G_GINT64_FORMAT " | ", seek_formats[i].name, value);
|
2004-03-14 22:34:33 +00:00
|
|
|
} else {
|
2004-03-15 19:32:27 +00:00
|
|
|
g_print ("%s %13.13s | ", seek_formats[i].name, "*NA*");
|
2002-06-11 19:20:52 +00:00
|
|
|
}
|
|
|
|
i++;
|
2002-06-08 14:57:15 +00:00
|
|
|
}
|
2002-06-11 19:20:52 +00:00
|
|
|
g_print (" %s\n", GST_ELEMENT_NAME (element));
|
|
|
|
walk = g_list_next (walk);
|
2002-06-08 14:57:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
2004-03-14 22:34:33 +00:00
|
|
|
update_scale (gpointer data)
|
2002-06-08 14:57:15 +00:00
|
|
|
{
|
|
|
|
GstClock *clock;
|
2002-06-11 19:20:52 +00:00
|
|
|
guint64 position;
|
|
|
|
GstFormat format = GST_FORMAT_TIME;
|
2002-06-08 14:57:15 +00:00
|
|
|
|
2002-06-11 19:20:52 +00:00
|
|
|
duration = 0;
|
2002-06-08 14:57:15 +00:00
|
|
|
clock = gst_bin_get_clock (GST_BIN (pipeline));
|
|
|
|
|
2002-06-11 19:20:52 +00:00
|
|
|
if (seekable_elements) {
|
|
|
|
GstElement *element = GST_ELEMENT (seekable_elements->data);
|
2004-03-14 22:34:33 +00:00
|
|
|
|
2002-12-30 17:53:18 +00:00
|
|
|
gst_element_query (element, GST_QUERY_TOTAL, &format, &duration);
|
2002-06-11 19:20:52 +00:00
|
|
|
}
|
2002-06-09 00:26:26 +00:00
|
|
|
position = gst_clock_get_time (clock);
|
2002-06-08 14:57:15 +00:00
|
|
|
|
2002-06-11 19:20:52 +00:00
|
|
|
if (stats) {
|
2004-10-26 05:13:22 +00:00
|
|
|
g_print ("clock: %13" G_GUINT64_FORMAT " (%s)\n",
|
|
|
|
position, gst_object_get_name (GST_OBJECT (clock)));
|
2002-06-11 19:20:52 +00:00
|
|
|
query_durations ();
|
|
|
|
query_positions ();
|
|
|
|
query_rates ();
|
2002-06-08 14:57:15 +00:00
|
|
|
}
|
|
|
|
if (duration > 0) {
|
|
|
|
gtk_adjustment_set_value (adjustment, position * 100.0 / duration);
|
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
iterate (gpointer data)
|
|
|
|
{
|
2002-06-09 10:58:37 +00:00
|
|
|
gboolean res = TRUE;
|
|
|
|
|
2002-06-08 14:57:15 +00:00
|
|
|
res = gst_bin_iterate (GST_BIN (data));
|
|
|
|
if (!res) {
|
|
|
|
gtk_timeout_remove (update_id);
|
|
|
|
g_print ("stopping iterations\n");
|
|
|
|
}
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
2004-03-14 22:34:33 +00:00
|
|
|
start_seek (GtkWidget * widget, GdkEventButton * event, gpointer user_data)
|
2002-06-08 14:57:15 +00:00
|
|
|
{
|
|
|
|
gst_element_set_state (pipeline, GST_STATE_PAUSED);
|
|
|
|
gtk_timeout_remove (update_id);
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
2004-03-14 22:34:33 +00:00
|
|
|
stop_seek (GtkWidget * widget, GdkEventButton * event, gpointer user_data)
|
2002-06-08 14:57:15 +00:00
|
|
|
{
|
|
|
|
gint64 real = gtk_range_get_value (GTK_RANGE (widget)) * duration / 100;
|
|
|
|
gboolean res;
|
|
|
|
GstEvent *s_event;
|
|
|
|
GList *walk = seekable_elements;
|
|
|
|
|
|
|
|
while (walk) {
|
|
|
|
GstElement *seekable = GST_ELEMENT (walk->data);
|
|
|
|
|
Fixes: #151879, #151881, #151882, #151883, #151884, #151886, #151887, #152102, #152247.
Original commit message from CVS:
Fixes: #151879, #151881, #151882, #151883, #151884, #151886,
#151887, #152102, #152247.
* examples/indexing/indexmpeg.c: 64-bit warning fixes.
* examples/seeking/cdparanoia.c: same
* examples/seeking/cdplayer.c: same
* examples/seeking/seek.c: same
* examples/seeking/spider_seek.c: same
* examples/seeking/vorbisfile.c: same
* examples/stats/mp2ogg.c: same
* ext/esd/esdsink.c: (gst_esdsink_class_init),
(gst_esdsink_dispose): Dispose of element properly.
* ext/ivorbis/vorbisfile.c: (gst_ivorbisfile_seek): 64-bit warning
fixes.
* ext/nas/nassink.c: (gst_nassink_class_init),
(gst_nassink_dispose): Dispose of element correctly.
* gst/wavenc/gstwavenc.c: (gst_wavenc_chain): Fix leak.
* sys/ximage/ximagesink.c: (gst_ximagesink_check_xshm_calls),
(gst_ximagesink_ximage_new), (gst_ximagesink_ximage_destroy):
Fix 64-bit warning.
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_check_xshm_calls),
(gst_xvimagesink_xvimage_new), (gst_xvimagesink_xvimage_destroy):
Fix 64-bit warning.
2004-09-12 22:57:26 +00:00
|
|
|
g_print ("seek to %" G_GINT64_FORMAT " on element %s\n", real,
|
|
|
|
GST_ELEMENT_NAME (seekable));
|
|
|
|
s_event =
|
|
|
|
gst_event_new_seek (GST_FORMAT_TIME | GST_SEEK_METHOD_SET |
|
|
|
|
GST_SEEK_FLAG_FLUSH, real);
|
2002-06-08 14:57:15 +00:00
|
|
|
|
|
|
|
res = gst_element_send_event (seekable, s_event);
|
|
|
|
|
|
|
|
walk = g_list_next (walk);
|
|
|
|
}
|
|
|
|
|
|
|
|
gst_element_set_state (pipeline, GST_STATE_PLAYING);
|
2002-06-11 19:20:52 +00:00
|
|
|
if (!GST_FLAG_IS_SET (pipeline, GST_BIN_SELF_SCHEDULABLE))
|
|
|
|
gtk_idle_add ((GtkFunction) iterate, pipeline);
|
2004-03-14 22:34:33 +00:00
|
|
|
update_id =
|
|
|
|
gtk_timeout_add (UPDATE_INTERVAL, (GtkFunction) update_scale, pipeline);
|
2002-06-08 14:57:15 +00:00
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
play_cb (GtkButton * button, gpointer data)
|
|
|
|
{
|
|
|
|
if (gst_element_get_state (pipeline) != GST_STATE_PLAYING) {
|
|
|
|
gst_element_set_state (pipeline, GST_STATE_PLAYING);
|
2002-06-11 19:20:52 +00:00
|
|
|
if (!GST_FLAG_IS_SET (pipeline, GST_BIN_SELF_SCHEDULABLE))
|
|
|
|
gtk_idle_add ((GtkFunction) iterate, pipeline);
|
2004-03-14 22:34:33 +00:00
|
|
|
update_id =
|
2004-03-15 19:32:27 +00:00
|
|
|
gtk_timeout_add (UPDATE_INTERVAL, (GtkFunction) update_scale, pipeline);
|
2002-06-08 14:57:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
pause_cb (GtkButton * button, gpointer data)
|
|
|
|
{
|
|
|
|
if (gst_element_get_state (pipeline) != GST_STATE_PAUSED) {
|
|
|
|
gst_element_set_state (pipeline, GST_STATE_PAUSED);
|
|
|
|
gtk_timeout_remove (update_id);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
stop_cb (GtkButton * button, gpointer data)
|
|
|
|
{
|
|
|
|
if (gst_element_get_state (pipeline) != GST_STATE_READY) {
|
|
|
|
gst_element_set_state (pipeline, GST_STATE_READY);
|
|
|
|
gtk_timeout_remove (update_id);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
main (int argc, char **argv)
|
|
|
|
{
|
2004-03-14 22:34:33 +00:00
|
|
|
GtkWidget *window, *hbox, *vbox,
|
|
|
|
*play_button, *pause_button, *stop_button, *hscale;
|
2002-06-09 10:58:37 +00:00
|
|
|
gboolean threaded = FALSE;
|
|
|
|
struct poptOption options[] = {
|
2004-03-14 22:34:33 +00:00
|
|
|
{"threaded", 't', POPT_ARG_NONE | POPT_ARGFLAG_STRIP, &threaded, 0,
|
2004-03-15 19:32:27 +00:00
|
|
|
"Run the pipeline in a toplevel thread", NULL},
|
2004-03-14 22:34:33 +00:00
|
|
|
{"stats", 's', POPT_ARG_NONE | POPT_ARGFLAG_STRIP, &stats, 0,
|
2004-03-15 19:32:27 +00:00
|
|
|
"Show element stats", NULL},
|
2004-03-14 22:34:33 +00:00
|
|
|
POPT_TABLEEND
|
|
|
|
};
|
2002-06-09 10:58:37 +00:00
|
|
|
|
|
|
|
gst_init_with_popt_table (&argc, &argv, options);
|
2002-06-08 14:57:15 +00:00
|
|
|
gtk_init (&argc, &argv);
|
|
|
|
|
|
|
|
if (argc != 2) {
|
|
|
|
g_print ("usage: %s <filename>\n", argv[0]);
|
|
|
|
exit (-1);
|
|
|
|
}
|
|
|
|
|
2002-06-09 10:58:37 +00:00
|
|
|
pipeline = make_spider_pipeline (argv[1], threaded);
|
2002-06-08 14:57:15 +00:00
|
|
|
|
|
|
|
/* initialize gui elements ... */
|
|
|
|
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
|
|
|
hbox = gtk_hbox_new (FALSE, 0);
|
|
|
|
vbox = gtk_vbox_new (FALSE, 0);
|
|
|
|
play_button = gtk_button_new_with_label ("play");
|
|
|
|
pause_button = gtk_button_new_with_label ("pause");
|
|
|
|
stop_button = gtk_button_new_with_label ("stop");
|
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
adjustment =
|
|
|
|
GTK_ADJUSTMENT (gtk_adjustment_new (0.0, 0.00, 100.0, 0.1, 1.0, 1.0));
|
2002-06-08 14:57:15 +00:00
|
|
|
hscale = gtk_hscale_new (adjustment);
|
|
|
|
gtk_scale_set_digits (GTK_SCALE (hscale), 2);
|
|
|
|
gtk_range_set_update_policy (GTK_RANGE (hscale), GTK_UPDATE_CONTINUOUS);
|
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
gtk_signal_connect (GTK_OBJECT (hscale),
|
|
|
|
"button_press_event", G_CALLBACK (start_seek), pipeline);
|
|
|
|
gtk_signal_connect (GTK_OBJECT (hscale),
|
|
|
|
"button_release_event", G_CALLBACK (stop_seek), pipeline);
|
|
|
|
gtk_signal_connect (GTK_OBJECT (hscale),
|
|
|
|
"format_value", G_CALLBACK (format_value), pipeline);
|
2002-06-08 14:57:15 +00:00
|
|
|
|
|
|
|
/* do the packing stuff ... */
|
|
|
|
gtk_window_set_default_size (GTK_WINDOW (window), 96, 96);
|
|
|
|
gtk_container_add (GTK_CONTAINER (window), vbox);
|
|
|
|
gtk_container_add (GTK_CONTAINER (vbox), hbox);
|
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), play_button, FALSE, FALSE, 2);
|
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), pause_button, FALSE, FALSE, 2);
|
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), stop_button, FALSE, FALSE, 2);
|
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), hscale, TRUE, TRUE, 2);
|
|
|
|
|
|
|
|
/* connect things ... */
|
2004-03-14 22:34:33 +00:00
|
|
|
g_signal_connect (G_OBJECT (play_button), "clicked", G_CALLBACK (play_cb),
|
|
|
|
pipeline);
|
|
|
|
g_signal_connect (G_OBJECT (pause_button), "clicked", G_CALLBACK (pause_cb),
|
|
|
|
pipeline);
|
|
|
|
g_signal_connect (G_OBJECT (stop_button), "clicked", G_CALLBACK (stop_cb),
|
|
|
|
pipeline);
|
2002-06-08 14:57:15 +00:00
|
|
|
g_signal_connect (G_OBJECT (window), "delete_event", gtk_main_quit, NULL);
|
|
|
|
|
|
|
|
/* show the gui. */
|
|
|
|
gtk_widget_show_all (window);
|
|
|
|
|
|
|
|
gtk_main ();
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|