2002-08-11 11:45:07 +00:00
|
|
|
#include <stdlib.h>
|
2002-05-28 20:30:11 +00:00
|
|
|
#include <glib.h>
|
|
|
|
#include <gtk/gtk.h>
|
|
|
|
#include <gst/gst.h>
|
|
|
|
#include <string.h>
|
|
|
|
|
2002-06-06 20:26:52 +00:00
|
|
|
static GList *seekable_pads = NULL;
|
2002-05-28 20:30:11 +00:00
|
|
|
static GList *rate_pads = NULL;
|
2002-06-06 20:26:52 +00:00
|
|
|
static GList *seekable_elements = NULL;
|
2002-05-28 20:30:11 +00:00
|
|
|
|
|
|
|
static GstElement *pipeline;
|
2005-05-09 10:56:13 +00:00
|
|
|
static gint64 position;
|
|
|
|
static gint64 duration;
|
2002-05-28 20:30:11 +00:00
|
|
|
static GtkAdjustment *adjustment;
|
2004-07-16 11:05:53 +00:00
|
|
|
static GtkWidget *hscale;
|
2002-06-11 19:20:52 +00:00
|
|
|
static gboolean stats = FALSE;
|
examples/seeking/seek.c: Added playbin seeking example.
Original commit message from CVS:
* examples/seeking/seek.c: (make_dv_pipeline), (make_avi_pipeline),
(make_mpeg_pipeline), (make_mpegnt_pipeline),
(make_playerbin_pipeline), (query_durations_elems),
(query_durations_pads), (query_positions_elems),
(query_positions_pads), (update_scale), (iterate), (stop_seek),
(main):
Added playbin seeking example.
2004-07-08 15:43:24 +00:00
|
|
|
static gboolean elem_seek = FALSE;
|
|
|
|
static gboolean verbose = FALSE;
|
2002-05-28 20:30:11 +00:00
|
|
|
|
|
|
|
static guint update_id;
|
2005-03-31 09:43:49 +00:00
|
|
|
static guint seek_timeout_id = 0;
|
|
|
|
static gulong changed_id;
|
2002-05-28 20:30:11 +00:00
|
|
|
|
Updated seek example.
Original commit message from CVS:
* docs/libs/tmpl/gstringbuffer.sgml:
* examples/seeking/seek.c: (make_vorbis_theora_pipeline),
(query_rates), (query_positions_elems), (query_positions_pads),
(update_scale), (do_seek):
Updated seek example.
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_submit_packet),
(gst_ogg_pad_submit_page), (gst_ogg_demux_activate_chain),
(gst_ogg_demux_find_chains), (gst_ogg_demux_send_event),
(gst_ogg_demux_loop):
Push out correct discont values.
* ext/theora/theoradec.c: (theora_dec_src_convert),
(theora_dec_sink_convert), (theora_dec_src_getcaps),
(theora_dec_sink_event), (theora_handle_type_packet),
(theora_handle_header_packet), (theora_dec_push),
(theora_handle_data_packet), (theora_dec_chain),
(theora_dec_change_state):
Better timestamping.
* ext/vorbis/vorbisdec.c: (gst_vorbis_dec_init),
(vorbis_dec_sink_event), (vorbis_dec_push),
(vorbis_handle_data_packet), (vorbis_dec_chain):
* ext/vorbis/vorbisdec.h:
Better timestamping.
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_base_audio_sink_get_time), (gst_base_audio_sink_get_times),
(gst_base_audio_sink_event), (gst_base_audio_sink_render):
Handle syncing on timestamps instead of sample offsets. Make
use of DISCONT values as described in design docs.
* gst-libs/gst/audio/gstbaseaudiosrc.c:
(gst_base_audio_src_get_time):
* gst-libs/gst/audio/gstringbuffer.c: (gst_ring_buffer_acquire),
(gst_ring_buffer_set_sample), (gst_ring_buffer_commit),
(gst_ring_buffer_read):
* gst-libs/gst/audio/gstringbuffer.h:
* sys/ximage/ximagesink.c: (gst_ximagesink_get_times),
(gst_ximagesink_show_frame):
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_get_times):
Correcly convert buffer timestamp to stream time.
2005-07-16 14:47:27 +00:00
|
|
|
//#define SOURCE "filesrc"
|
2005-03-31 09:43:49 +00:00
|
|
|
#define SOURCE "gnomevfssrc"
|
examples/seeking/seek.c: Make audio sink configurable, use alsasink as default.
Original commit message from CVS:
* examples/seeking/seek.c: (make_mod_pipeline), (make_dv_pipeline),
(make_wav_pipeline), (make_flac_pipeline), (make_sid_pipeline),
(make_vorbis_pipeline), (make_vorbis_theora_pipeline),
(make_avi_msmpeg4v3_mp3_pipeline), (make_mp3_pipeline),
(make_avi_pipeline), (make_mpeg_pipeline), (make_mpegnt_pipeline):
Make audio sink configurable, use alsasink as default.
2005-04-28 16:24:23 +00:00
|
|
|
#define ASINK "alsasink"
|
|
|
|
//#define ASINK "osssink"
|
2005-05-09 10:56:13 +00:00
|
|
|
#define VSINK "xvimagesink"
|
|
|
|
//#define VSINK "ximagesink"
|
|
|
|
//#define VSINK "aasink"
|
2005-06-02 13:33:40 +00:00
|
|
|
//#define VSINK "cacasink"
|
2002-06-06 20:26:52 +00:00
|
|
|
|
2002-05-28 20:30:11 +00:00
|
|
|
#define UPDATE_INTERVAL 500
|
|
|
|
|
2005-03-31 09:43:49 +00:00
|
|
|
/* number of milliseconds to play for after a seek */
|
Updated seek example.
Original commit message from CVS:
* docs/libs/tmpl/gstringbuffer.sgml:
* examples/seeking/seek.c: (make_vorbis_theora_pipeline),
(query_rates), (query_positions_elems), (query_positions_pads),
(update_scale), (do_seek):
Updated seek example.
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_submit_packet),
(gst_ogg_pad_submit_page), (gst_ogg_demux_activate_chain),
(gst_ogg_demux_find_chains), (gst_ogg_demux_send_event),
(gst_ogg_demux_loop):
Push out correct discont values.
* ext/theora/theoradec.c: (theora_dec_src_convert),
(theora_dec_sink_convert), (theora_dec_src_getcaps),
(theora_dec_sink_event), (theora_handle_type_packet),
(theora_handle_header_packet), (theora_dec_push),
(theora_handle_data_packet), (theora_dec_chain),
(theora_dec_change_state):
Better timestamping.
* ext/vorbis/vorbisdec.c: (gst_vorbis_dec_init),
(vorbis_dec_sink_event), (vorbis_dec_push),
(vorbis_handle_data_packet), (vorbis_dec_chain):
* ext/vorbis/vorbisdec.h:
Better timestamping.
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_base_audio_sink_get_time), (gst_base_audio_sink_get_times),
(gst_base_audio_sink_event), (gst_base_audio_sink_render):
Handle syncing on timestamps instead of sample offsets. Make
use of DISCONT values as described in design docs.
* gst-libs/gst/audio/gstbaseaudiosrc.c:
(gst_base_audio_src_get_time):
* gst-libs/gst/audio/gstringbuffer.c: (gst_ring_buffer_acquire),
(gst_ring_buffer_set_sample), (gst_ring_buffer_commit),
(gst_ring_buffer_read):
* gst-libs/gst/audio/gstringbuffer.h:
* sys/ximage/ximagesink.c: (gst_ximagesink_get_times),
(gst_ximagesink_show_frame):
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_get_times):
Correcly convert buffer timestamp to stream time.
2005-07-16 14:47:27 +00:00
|
|
|
//#define SCRUB_TIME 250
|
|
|
|
//#define SCRUB
|
2005-03-31 09:43:49 +00:00
|
|
|
|
2002-05-28 20:30:11 +00:00
|
|
|
#define THREAD
|
2002-06-06 20:26:52 +00:00
|
|
|
#define PAD_SEEK
|
2002-05-28 20:30:11 +00:00
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
2004-03-14 22:34:34 +00:00
|
|
|
const gchar *padname;
|
|
|
|
GstPad *target;
|
|
|
|
GstElement *bin;
|
2004-03-15 19:32:28 +00:00
|
|
|
}
|
|
|
|
dyn_link;
|
2002-05-28 20:30:11 +00:00
|
|
|
|
2003-11-02 23:06:23 +00:00
|
|
|
static GstElement *
|
2004-03-14 22:34:34 +00:00
|
|
|
gst_element_factory_make_or_warn (gchar * type, gchar * name)
|
2003-11-02 23:06:23 +00:00
|
|
|
{
|
|
|
|
GstElement *element = gst_element_factory_make (type, name);
|
|
|
|
|
|
|
|
if (!element) {
|
2004-03-14 22:34:34 +00:00
|
|
|
g_warning ("Failed to create element %s of type %s", name, type);
|
2003-11-02 23:06:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return element;
|
|
|
|
}
|
|
|
|
|
2002-05-28 20:30:11 +00:00
|
|
|
static void
|
2004-03-14 22:34:34 +00:00
|
|
|
dynamic_link (GstPadTemplate * templ, GstPad * newpad, gpointer data)
|
2002-05-28 20:30:11 +00:00
|
|
|
{
|
2003-01-10 10:22:25 +00:00
|
|
|
dyn_link *connect = (dyn_link *) data;
|
2002-05-28 20:30:11 +00:00
|
|
|
|
2005-03-31 09:43:49 +00:00
|
|
|
if (connect->padname == NULL ||
|
|
|
|
!strcmp (gst_pad_get_name (newpad), connect->padname)) {
|
|
|
|
if (connect->bin)
|
|
|
|
gst_bin_add (GST_BIN (pipeline), connect->bin);
|
2003-01-10 10:22:25 +00:00
|
|
|
gst_pad_link (newpad, connect->target);
|
2002-05-28 20:30:11 +00:00
|
|
|
|
2005-03-31 09:43:49 +00:00
|
|
|
//seekable_pads = g_list_prepend (seekable_pads, newpad);
|
2002-05-28 20:30:11 +00:00
|
|
|
rate_pads = g_list_prepend (rate_pads, newpad);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2004-03-14 22:34:34 +00:00
|
|
|
setup_dynamic_link (GstElement * element, const gchar * padname,
|
|
|
|
GstPad * target, GstElement * bin)
|
2002-05-28 20:30:11 +00:00
|
|
|
{
|
2003-01-10 10:22:25 +00:00
|
|
|
dyn_link *connect;
|
2002-05-28 20:30:11 +00:00
|
|
|
|
2003-01-10 10:22:25 +00:00
|
|
|
connect = g_new0 (dyn_link, 1);
|
2004-03-14 22:34:34 +00:00
|
|
|
connect->padname = g_strdup (padname);
|
|
|
|
connect->target = target;
|
|
|
|
connect->bin = bin;
|
2002-05-28 20:30:11 +00:00
|
|
|
|
2004-03-14 22:34:34 +00:00
|
|
|
g_signal_connect (G_OBJECT (element), "new_pad", G_CALLBACK (dynamic_link),
|
|
|
|
connect);
|
2002-05-28 20:30:11 +00:00
|
|
|
}
|
|
|
|
|
2004-03-14 22:34:34 +00:00
|
|
|
static GstElement *
|
|
|
|
make_mod_pipeline (const gchar * location)
|
2002-06-11 19:20:52 +00:00
|
|
|
{
|
|
|
|
GstElement *pipeline;
|
|
|
|
GstElement *src, *decoder, *audiosink;
|
|
|
|
GstPad *seekable;
|
2004-03-14 22:34:34 +00:00
|
|
|
|
2002-06-11 19:20:52 +00:00
|
|
|
pipeline = gst_pipeline_new ("app");
|
|
|
|
|
2002-06-13 13:16:52 +00:00
|
|
|
src = gst_element_factory_make_or_warn (SOURCE, "src");
|
|
|
|
decoder = gst_element_factory_make_or_warn ("modplug", "decoder");
|
examples/seeking/seek.c: Make audio sink configurable, use alsasink as default.
Original commit message from CVS:
* examples/seeking/seek.c: (make_mod_pipeline), (make_dv_pipeline),
(make_wav_pipeline), (make_flac_pipeline), (make_sid_pipeline),
(make_vorbis_pipeline), (make_vorbis_theora_pipeline),
(make_avi_msmpeg4v3_mp3_pipeline), (make_mp3_pipeline),
(make_avi_pipeline), (make_mpeg_pipeline), (make_mpegnt_pipeline):
Make audio sink configurable, use alsasink as default.
2005-04-28 16:24:23 +00:00
|
|
|
audiosink = gst_element_factory_make_or_warn (ASINK, "sink");
|
2002-06-11 19:20:52 +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);
|
|
|
|
gst_bin_add (GST_BIN (pipeline), audiosink);
|
|
|
|
|
2003-01-10 10:22:25 +00:00
|
|
|
gst_element_link (src, decoder);
|
|
|
|
gst_element_link (decoder, audiosink);
|
2002-06-11 19:20:52 +00:00
|
|
|
|
|
|
|
seekable = gst_element_get_pad (decoder, "src");
|
|
|
|
seekable_pads = g_list_prepend (seekable_pads, seekable);
|
|
|
|
rate_pads = g_list_prepend (rate_pads, seekable);
|
|
|
|
rate_pads = g_list_prepend (rate_pads, gst_element_get_pad (decoder, "sink"));
|
|
|
|
|
|
|
|
return pipeline;
|
|
|
|
}
|
|
|
|
|
2004-03-14 22:34:34 +00:00
|
|
|
static GstElement *
|
|
|
|
make_dv_pipeline (const gchar * location)
|
2002-06-16 21:54:38 +00:00
|
|
|
{
|
|
|
|
GstElement *pipeline;
|
|
|
|
GstElement *src, *decoder, *audiosink, *videosink;
|
|
|
|
GstPad *seekable;
|
2004-03-14 22:34:34 +00:00
|
|
|
|
2002-06-16 21:54:38 +00:00
|
|
|
pipeline = gst_pipeline_new ("app");
|
|
|
|
|
|
|
|
src = gst_element_factory_make_or_warn (SOURCE, "src");
|
|
|
|
decoder = gst_element_factory_make_or_warn ("dvdec", "decoder");
|
2005-03-31 09:43:49 +00:00
|
|
|
videosink = gst_element_factory_make_or_warn ("ximagesink", "v_sink");
|
examples/seeking/seek.c: Make audio sink configurable, use alsasink as default.
Original commit message from CVS:
* examples/seeking/seek.c: (make_mod_pipeline), (make_dv_pipeline),
(make_wav_pipeline), (make_flac_pipeline), (make_sid_pipeline),
(make_vorbis_pipeline), (make_vorbis_theora_pipeline),
(make_avi_msmpeg4v3_mp3_pipeline), (make_mp3_pipeline),
(make_avi_pipeline), (make_mpeg_pipeline), (make_mpegnt_pipeline):
Make audio sink configurable, use alsasink as default.
2005-04-28 16:24:23 +00:00
|
|
|
audiosink = gst_element_factory_make_or_warn (ASINK, "a_sink");
|
2002-06-16 21:54:38 +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);
|
|
|
|
gst_bin_add (GST_BIN (pipeline), audiosink);
|
|
|
|
gst_bin_add (GST_BIN (pipeline), videosink);
|
|
|
|
|
2003-01-10 10:22:25 +00:00
|
|
|
gst_element_link (src, decoder);
|
|
|
|
gst_element_link (decoder, audiosink);
|
|
|
|
gst_element_link (decoder, videosink);
|
2002-06-16 21:54:38 +00:00
|
|
|
|
|
|
|
seekable = gst_element_get_pad (decoder, "video");
|
|
|
|
seekable_pads = g_list_prepend (seekable_pads, seekable);
|
|
|
|
rate_pads = g_list_prepend (rate_pads, seekable);
|
|
|
|
seekable = gst_element_get_pad (decoder, "audio");
|
|
|
|
seekable_pads = g_list_prepend (seekable_pads, seekable);
|
|
|
|
rate_pads = g_list_prepend (rate_pads, seekable);
|
|
|
|
rate_pads = g_list_prepend (rate_pads, gst_element_get_pad (decoder, "sink"));
|
|
|
|
|
|
|
|
return pipeline;
|
|
|
|
}
|
|
|
|
|
2004-03-14 22:34:34 +00:00
|
|
|
static GstElement *
|
|
|
|
make_wav_pipeline (const gchar * location)
|
2002-06-08 14:57:15 +00:00
|
|
|
{
|
|
|
|
GstElement *pipeline;
|
|
|
|
GstElement *src, *decoder, *audiosink;
|
|
|
|
GstPad *seekable;
|
2004-03-14 22:34:34 +00:00
|
|
|
|
2002-06-08 14:57:15 +00:00
|
|
|
pipeline = gst_pipeline_new ("app");
|
|
|
|
|
2002-06-13 13:16:52 +00:00
|
|
|
src = gst_element_factory_make_or_warn (SOURCE, "src");
|
|
|
|
decoder = gst_element_factory_make_or_warn ("wavparse", "decoder");
|
examples/seeking/seek.c: Make audio sink configurable, use alsasink as default.
Original commit message from CVS:
* examples/seeking/seek.c: (make_mod_pipeline), (make_dv_pipeline),
(make_wav_pipeline), (make_flac_pipeline), (make_sid_pipeline),
(make_vorbis_pipeline), (make_vorbis_theora_pipeline),
(make_avi_msmpeg4v3_mp3_pipeline), (make_mp3_pipeline),
(make_avi_pipeline), (make_mpeg_pipeline), (make_mpegnt_pipeline):
Make audio sink configurable, use alsasink as default.
2005-04-28 16:24:23 +00:00
|
|
|
audiosink = gst_element_factory_make_or_warn (ASINK, "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);
|
|
|
|
gst_bin_add (GST_BIN (pipeline), audiosink);
|
|
|
|
|
2003-01-10 10:22:25 +00:00
|
|
|
gst_element_link (src, decoder);
|
|
|
|
gst_element_link (decoder, audiosink);
|
2002-06-08 14:57:15 +00:00
|
|
|
|
|
|
|
seekable = gst_element_get_pad (decoder, "src");
|
|
|
|
seekable_pads = g_list_prepend (seekable_pads, seekable);
|
|
|
|
rate_pads = g_list_prepend (rate_pads, seekable);
|
|
|
|
rate_pads = g_list_prepend (rate_pads, gst_element_get_pad (decoder, "sink"));
|
|
|
|
|
|
|
|
return pipeline;
|
|
|
|
}
|
|
|
|
|
2004-03-14 22:34:34 +00:00
|
|
|
static GstElement *
|
|
|
|
make_flac_pipeline (const gchar * location)
|
2002-06-06 20:26:52 +00:00
|
|
|
{
|
|
|
|
GstElement *pipeline;
|
|
|
|
GstElement *src, *decoder, *audiosink;
|
|
|
|
GstPad *seekable;
|
2004-03-14 22:34:34 +00:00
|
|
|
|
2002-06-06 20:26:52 +00:00
|
|
|
pipeline = gst_pipeline_new ("app");
|
|
|
|
|
2002-06-13 13:16:52 +00:00
|
|
|
src = gst_element_factory_make_or_warn (SOURCE, "src");
|
|
|
|
decoder = gst_element_factory_make_or_warn ("flacdec", "decoder");
|
examples/seeking/seek.c: Make audio sink configurable, use alsasink as default.
Original commit message from CVS:
* examples/seeking/seek.c: (make_mod_pipeline), (make_dv_pipeline),
(make_wav_pipeline), (make_flac_pipeline), (make_sid_pipeline),
(make_vorbis_pipeline), (make_vorbis_theora_pipeline),
(make_avi_msmpeg4v3_mp3_pipeline), (make_mp3_pipeline),
(make_avi_pipeline), (make_mpeg_pipeline), (make_mpegnt_pipeline):
Make audio sink configurable, use alsasink as default.
2005-04-28 16:24:23 +00:00
|
|
|
audiosink = gst_element_factory_make_or_warn (ASINK, "sink");
|
2003-05-24 10:51:02 +00:00
|
|
|
g_object_set (G_OBJECT (audiosink), "sync", FALSE, NULL);
|
2002-06-06 20:26:52 +00:00
|
|
|
|
|
|
|
g_object_set (G_OBJECT (src), "location", location, NULL);
|
|
|
|
|
|
|
|
gst_bin_add (GST_BIN (pipeline), src);
|
|
|
|
gst_bin_add (GST_BIN (pipeline), decoder);
|
|
|
|
gst_bin_add (GST_BIN (pipeline), audiosink);
|
|
|
|
|
2003-01-10 10:22:25 +00:00
|
|
|
gst_element_link (src, decoder);
|
|
|
|
gst_element_link (decoder, audiosink);
|
2002-06-06 20:26:52 +00:00
|
|
|
|
|
|
|
seekable = gst_element_get_pad (decoder, "src");
|
|
|
|
seekable_pads = g_list_prepend (seekable_pads, seekable);
|
|
|
|
rate_pads = g_list_prepend (rate_pads, seekable);
|
|
|
|
rate_pads = g_list_prepend (rate_pads, gst_element_get_pad (decoder, "sink"));
|
|
|
|
|
|
|
|
return pipeline;
|
|
|
|
}
|
|
|
|
|
2004-03-14 22:34:34 +00:00
|
|
|
static GstElement *
|
|
|
|
make_sid_pipeline (const gchar * location)
|
2002-06-06 20:26:52 +00:00
|
|
|
{
|
|
|
|
GstElement *pipeline;
|
|
|
|
GstElement *src, *decoder, *audiosink;
|
|
|
|
GstPad *seekable;
|
2004-03-14 22:34:34 +00:00
|
|
|
|
2002-06-06 20:26:52 +00:00
|
|
|
pipeline = gst_pipeline_new ("app");
|
|
|
|
|
2002-06-13 13:16:52 +00:00
|
|
|
src = gst_element_factory_make_or_warn (SOURCE, "src");
|
|
|
|
decoder = gst_element_factory_make_or_warn ("siddec", "decoder");
|
examples/seeking/seek.c: Make audio sink configurable, use alsasink as default.
Original commit message from CVS:
* examples/seeking/seek.c: (make_mod_pipeline), (make_dv_pipeline),
(make_wav_pipeline), (make_flac_pipeline), (make_sid_pipeline),
(make_vorbis_pipeline), (make_vorbis_theora_pipeline),
(make_avi_msmpeg4v3_mp3_pipeline), (make_mp3_pipeline),
(make_avi_pipeline), (make_mpeg_pipeline), (make_mpegnt_pipeline):
Make audio sink configurable, use alsasink as default.
2005-04-28 16:24:23 +00:00
|
|
|
audiosink = gst_element_factory_make_or_warn (ASINK, "sink");
|
2002-06-06 20:26:52 +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);
|
|
|
|
gst_bin_add (GST_BIN (pipeline), audiosink);
|
|
|
|
|
2003-01-10 10:22:25 +00:00
|
|
|
gst_element_link (src, decoder);
|
|
|
|
gst_element_link (decoder, audiosink);
|
2002-06-06 20:26:52 +00:00
|
|
|
|
|
|
|
seekable = gst_element_get_pad (decoder, "src");
|
|
|
|
seekable_pads = g_list_prepend (seekable_pads, seekable);
|
|
|
|
rate_pads = g_list_prepend (rate_pads, seekable);
|
|
|
|
rate_pads = g_list_prepend (rate_pads, gst_element_get_pad (decoder, "sink"));
|
|
|
|
|
|
|
|
return pipeline;
|
|
|
|
}
|
|
|
|
|
2004-03-14 22:34:34 +00:00
|
|
|
static GstElement *
|
|
|
|
make_parse_pipeline (const gchar * location)
|
2002-05-28 20:30:11 +00:00
|
|
|
{
|
|
|
|
GstElement *pipeline;
|
|
|
|
GstElement *src, *parser, *fakesink;
|
|
|
|
GstPad *seekable;
|
2004-03-14 22:34:34 +00:00
|
|
|
|
2002-05-28 20:30:11 +00:00
|
|
|
pipeline = gst_pipeline_new ("app");
|
|
|
|
|
2002-06-13 13:16:52 +00:00
|
|
|
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");
|
2002-12-26 22:53:36 +00:00
|
|
|
g_object_set (G_OBJECT (fakesink), "silent", TRUE, NULL);
|
|
|
|
g_object_set (G_OBJECT (fakesink), "sync", TRUE, NULL);
|
2002-05-28 20:30:11 +00:00
|
|
|
|
|
|
|
g_object_set (G_OBJECT (src), "location", location, NULL);
|
|
|
|
|
|
|
|
gst_bin_add (GST_BIN (pipeline), src);
|
|
|
|
gst_bin_add (GST_BIN (pipeline), parser);
|
|
|
|
gst_bin_add (GST_BIN (pipeline), fakesink);
|
|
|
|
|
2003-01-10 10:22:25 +00:00
|
|
|
gst_element_link (src, parser);
|
|
|
|
gst_element_link (parser, fakesink);
|
2002-05-28 20:30:11 +00:00
|
|
|
|
|
|
|
seekable = gst_element_get_pad (parser, "src");
|
2002-06-06 20:26:52 +00:00
|
|
|
seekable_pads = g_list_prepend (seekable_pads, seekable);
|
2002-05-28 20:30:11 +00:00
|
|
|
rate_pads = g_list_prepend (rate_pads, seekable);
|
|
|
|
rate_pads = g_list_prepend (rate_pads, gst_element_get_pad (parser, "sink"));
|
|
|
|
|
|
|
|
return pipeline;
|
|
|
|
}
|
|
|
|
|
2004-03-14 22:34:34 +00:00
|
|
|
static GstElement *
|
|
|
|
make_vorbis_pipeline (const gchar * location)
|
2002-06-06 20:26:52 +00:00
|
|
|
{
|
2005-03-31 09:43:49 +00:00
|
|
|
GstElement *pipeline, *audio_bin;
|
|
|
|
GstElement *src, *demux, *decoder, *convert, *audiosink;
|
2002-06-06 20:26:52 +00:00
|
|
|
GstPad *seekable;
|
2004-03-14 22:34:34 +00:00
|
|
|
|
2002-06-06 20:26:52 +00:00
|
|
|
pipeline = gst_pipeline_new ("app");
|
|
|
|
|
2002-06-13 13:16:52 +00:00
|
|
|
src = gst_element_factory_make_or_warn (SOURCE, "src");
|
2005-03-31 09:43:49 +00:00
|
|
|
demux = gst_element_factory_make_or_warn ("oggdemux", "demux");
|
|
|
|
decoder = gst_element_factory_make_or_warn ("vorbisdec", "decoder");
|
|
|
|
convert = gst_element_factory_make_or_warn ("audioconvert", "convert");
|
examples/seeking/seek.c: Make audio sink configurable, use alsasink as default.
Original commit message from CVS:
* examples/seeking/seek.c: (make_mod_pipeline), (make_dv_pipeline),
(make_wav_pipeline), (make_flac_pipeline), (make_sid_pipeline),
(make_vorbis_pipeline), (make_vorbis_theora_pipeline),
(make_avi_msmpeg4v3_mp3_pipeline), (make_mp3_pipeline),
(make_avi_pipeline), (make_mpeg_pipeline), (make_mpegnt_pipeline):
Make audio sink configurable, use alsasink as default.
2005-04-28 16:24:23 +00:00
|
|
|
audiosink = gst_element_factory_make_or_warn (ASINK, "sink");
|
2003-02-02 19:25:58 +00:00
|
|
|
g_object_set (G_OBJECT (audiosink), "sync", TRUE, NULL);
|
2002-06-06 20:26:52 +00:00
|
|
|
|
|
|
|
g_object_set (G_OBJECT (src), "location", location, NULL);
|
|
|
|
|
2005-03-31 09:43:49 +00:00
|
|
|
audio_bin = gst_bin_new ("a_decoder_bin");
|
|
|
|
|
2002-06-06 20:26:52 +00:00
|
|
|
gst_bin_add (GST_BIN (pipeline), src);
|
2005-03-31 09:43:49 +00:00
|
|
|
gst_bin_add (GST_BIN (pipeline), demux);
|
|
|
|
gst_bin_add (GST_BIN (audio_bin), decoder);
|
|
|
|
gst_bin_add (GST_BIN (audio_bin), convert);
|
|
|
|
gst_bin_add (GST_BIN (audio_bin), audiosink);
|
|
|
|
gst_bin_add (GST_BIN (pipeline), audio_bin);
|
2002-06-06 20:26:52 +00:00
|
|
|
|
2005-03-31 09:43:49 +00:00
|
|
|
gst_element_link (src, demux);
|
|
|
|
gst_element_link (decoder, convert);
|
|
|
|
gst_element_link (convert, audiosink);
|
|
|
|
|
|
|
|
setup_dynamic_link (demux, NULL, gst_element_get_pad (decoder, "sink"), NULL);
|
|
|
|
|
|
|
|
seekable = gst_element_get_pad (decoder, "src");
|
|
|
|
seekable_pads = g_list_prepend (seekable_pads, seekable);
|
|
|
|
rate_pads = g_list_prepend (rate_pads, seekable);
|
|
|
|
rate_pads = g_list_prepend (rate_pads, gst_element_get_pad (decoder, "sink"));
|
|
|
|
|
|
|
|
return pipeline;
|
|
|
|
}
|
|
|
|
|
|
|
|
static GstElement *
|
|
|
|
make_theora_pipeline (const gchar * location)
|
|
|
|
{
|
|
|
|
GstElement *pipeline, *video_bin;
|
|
|
|
GstElement *src, *demux, *decoder, *convert, *videosink;
|
|
|
|
GstElement *queue;
|
|
|
|
GstPad *seekable;
|
|
|
|
|
|
|
|
pipeline = gst_pipeline_new ("app");
|
|
|
|
|
|
|
|
src = gst_element_factory_make_or_warn (SOURCE, "src");
|
|
|
|
demux = gst_element_factory_make_or_warn ("oggdemux", "demux");
|
|
|
|
queue = gst_element_factory_make_or_warn ("queue", "queue");
|
|
|
|
decoder = gst_element_factory_make_or_warn ("theoradec", "decoder");
|
|
|
|
convert = gst_element_factory_make_or_warn ("ffmpegcolorspace", "convert");
|
2005-05-09 10:56:13 +00:00
|
|
|
videosink = gst_element_factory_make_or_warn (VSINK, "sink");
|
2005-03-31 09:43:49 +00:00
|
|
|
|
|
|
|
g_object_set (G_OBJECT (src), "location", location, NULL);
|
|
|
|
|
|
|
|
video_bin = gst_bin_new ("v_decoder_bin");
|
|
|
|
|
|
|
|
gst_bin_add (GST_BIN (pipeline), src);
|
|
|
|
gst_bin_add (GST_BIN (pipeline), demux);
|
|
|
|
gst_bin_add (GST_BIN (pipeline), queue);
|
|
|
|
gst_bin_add (GST_BIN (video_bin), decoder);
|
|
|
|
gst_bin_add (GST_BIN (video_bin), convert);
|
|
|
|
gst_bin_add (GST_BIN (video_bin), videosink);
|
|
|
|
gst_bin_add (GST_BIN (pipeline), video_bin);
|
|
|
|
|
|
|
|
gst_element_link (src, demux);
|
|
|
|
gst_element_link (queue, decoder);
|
|
|
|
gst_element_link (decoder, convert);
|
|
|
|
gst_element_link (convert, videosink);
|
|
|
|
|
|
|
|
setup_dynamic_link (demux, NULL, gst_element_get_pad (queue, "sink"), NULL);
|
2002-06-06 20:26:52 +00:00
|
|
|
|
|
|
|
seekable = gst_element_get_pad (decoder, "src");
|
|
|
|
seekable_pads = g_list_prepend (seekable_pads, seekable);
|
|
|
|
rate_pads = g_list_prepend (rate_pads, seekable);
|
|
|
|
rate_pads = g_list_prepend (rate_pads, gst_element_get_pad (decoder, "sink"));
|
|
|
|
|
|
|
|
return pipeline;
|
|
|
|
}
|
|
|
|
|
2005-03-31 09:43:49 +00:00
|
|
|
static GstElement *
|
|
|
|
make_vorbis_theora_pipeline (const gchar * location)
|
|
|
|
{
|
|
|
|
GstElement *pipeline, *audio_bin, *video_bin;
|
|
|
|
GstElement *src, *demux, *a_decoder, *a_convert, *v_decoder, *v_convert;
|
|
|
|
GstElement *audiosink, *videosink;
|
|
|
|
GstElement *a_queue, *v_queue;
|
|
|
|
GstPad *seekable;
|
Updated seek example.
Original commit message from CVS:
* docs/libs/tmpl/gstringbuffer.sgml:
* examples/seeking/seek.c: (make_vorbis_theora_pipeline),
(query_rates), (query_positions_elems), (query_positions_pads),
(update_scale), (do_seek):
Updated seek example.
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_submit_packet),
(gst_ogg_pad_submit_page), (gst_ogg_demux_activate_chain),
(gst_ogg_demux_find_chains), (gst_ogg_demux_send_event),
(gst_ogg_demux_loop):
Push out correct discont values.
* ext/theora/theoradec.c: (theora_dec_src_convert),
(theora_dec_sink_convert), (theora_dec_src_getcaps),
(theora_dec_sink_event), (theora_handle_type_packet),
(theora_handle_header_packet), (theora_dec_push),
(theora_handle_data_packet), (theora_dec_chain),
(theora_dec_change_state):
Better timestamping.
* ext/vorbis/vorbisdec.c: (gst_vorbis_dec_init),
(vorbis_dec_sink_event), (vorbis_dec_push),
(vorbis_handle_data_packet), (vorbis_dec_chain):
* ext/vorbis/vorbisdec.h:
Better timestamping.
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_base_audio_sink_get_time), (gst_base_audio_sink_get_times),
(gst_base_audio_sink_event), (gst_base_audio_sink_render):
Handle syncing on timestamps instead of sample offsets. Make
use of DISCONT values as described in design docs.
* gst-libs/gst/audio/gstbaseaudiosrc.c:
(gst_base_audio_src_get_time):
* gst-libs/gst/audio/gstringbuffer.c: (gst_ring_buffer_acquire),
(gst_ring_buffer_set_sample), (gst_ring_buffer_commit),
(gst_ring_buffer_read):
* gst-libs/gst/audio/gstringbuffer.h:
* sys/ximage/ximagesink.c: (gst_ximagesink_get_times),
(gst_ximagesink_show_frame):
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_get_times):
Correcly convert buffer timestamp to stream time.
2005-07-16 14:47:27 +00:00
|
|
|
GstPad *pad;
|
2005-03-31 09:43:49 +00:00
|
|
|
|
|
|
|
pipeline = gst_pipeline_new ("app");
|
|
|
|
|
|
|
|
src = gst_element_factory_make_or_warn (SOURCE, "src");
|
|
|
|
g_object_set (G_OBJECT (src), "location", location, NULL);
|
|
|
|
|
|
|
|
demux = gst_element_factory_make_or_warn ("oggdemux", "demux");
|
|
|
|
|
|
|
|
gst_bin_add (GST_BIN (pipeline), src);
|
|
|
|
gst_bin_add (GST_BIN (pipeline), demux);
|
|
|
|
gst_element_link (src, demux);
|
|
|
|
|
|
|
|
audio_bin = gst_bin_new ("a_decoder_bin");
|
|
|
|
a_queue = gst_element_factory_make_or_warn ("queue", "a_queue");
|
|
|
|
a_decoder = gst_element_factory_make_or_warn ("vorbisdec", "a_dec");
|
|
|
|
a_convert = gst_element_factory_make_or_warn ("audioconvert", "a_convert");
|
examples/seeking/seek.c: Make audio sink configurable, use alsasink as default.
Original commit message from CVS:
* examples/seeking/seek.c: (make_mod_pipeline), (make_dv_pipeline),
(make_wav_pipeline), (make_flac_pipeline), (make_sid_pipeline),
(make_vorbis_pipeline), (make_vorbis_theora_pipeline),
(make_avi_msmpeg4v3_mp3_pipeline), (make_mp3_pipeline),
(make_avi_pipeline), (make_mpeg_pipeline), (make_mpegnt_pipeline):
Make audio sink configurable, use alsasink as default.
2005-04-28 16:24:23 +00:00
|
|
|
audiosink = gst_element_factory_make_or_warn (ASINK, "a_sink");
|
2005-03-31 09:43:49 +00:00
|
|
|
|
2005-06-02 13:33:40 +00:00
|
|
|
gst_bin_add (GST_BIN (pipeline), audio_bin);
|
2005-03-31 09:43:49 +00:00
|
|
|
|
|
|
|
gst_bin_add (GST_BIN (audio_bin), a_queue);
|
|
|
|
gst_bin_add (GST_BIN (audio_bin), a_decoder);
|
|
|
|
gst_bin_add (GST_BIN (audio_bin), a_convert);
|
|
|
|
gst_bin_add (GST_BIN (audio_bin), audiosink);
|
|
|
|
|
2005-06-02 13:33:40 +00:00
|
|
|
gst_element_link (a_queue, a_decoder);
|
|
|
|
gst_element_link (a_decoder, a_convert);
|
|
|
|
gst_element_link (a_convert, audiosink);
|
2005-03-31 09:43:49 +00:00
|
|
|
|
Updated seek example.
Original commit message from CVS:
* docs/libs/tmpl/gstringbuffer.sgml:
* examples/seeking/seek.c: (make_vorbis_theora_pipeline),
(query_rates), (query_positions_elems), (query_positions_pads),
(update_scale), (do_seek):
Updated seek example.
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_submit_packet),
(gst_ogg_pad_submit_page), (gst_ogg_demux_activate_chain),
(gst_ogg_demux_find_chains), (gst_ogg_demux_send_event),
(gst_ogg_demux_loop):
Push out correct discont values.
* ext/theora/theoradec.c: (theora_dec_src_convert),
(theora_dec_sink_convert), (theora_dec_src_getcaps),
(theora_dec_sink_event), (theora_handle_type_packet),
(theora_handle_header_packet), (theora_dec_push),
(theora_handle_data_packet), (theora_dec_chain),
(theora_dec_change_state):
Better timestamping.
* ext/vorbis/vorbisdec.c: (gst_vorbis_dec_init),
(vorbis_dec_sink_event), (vorbis_dec_push),
(vorbis_handle_data_packet), (vorbis_dec_chain):
* ext/vorbis/vorbisdec.h:
Better timestamping.
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_base_audio_sink_get_time), (gst_base_audio_sink_get_times),
(gst_base_audio_sink_event), (gst_base_audio_sink_render):
Handle syncing on timestamps instead of sample offsets. Make
use of DISCONT values as described in design docs.
* gst-libs/gst/audio/gstbaseaudiosrc.c:
(gst_base_audio_src_get_time):
* gst-libs/gst/audio/gstringbuffer.c: (gst_ring_buffer_acquire),
(gst_ring_buffer_set_sample), (gst_ring_buffer_commit),
(gst_ring_buffer_read):
* gst-libs/gst/audio/gstringbuffer.h:
* sys/ximage/ximagesink.c: (gst_ximagesink_get_times),
(gst_ximagesink_show_frame):
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_get_times):
Correcly convert buffer timestamp to stream time.
2005-07-16 14:47:27 +00:00
|
|
|
pad = gst_element_get_pad (a_queue, "sink");
|
|
|
|
gst_element_add_pad (audio_bin, gst_ghost_pad_new ("sink", pad));
|
|
|
|
gst_object_unref (GST_OBJECT_CAST (pad));
|
2005-06-02 13:33:40 +00:00
|
|
|
|
|
|
|
setup_dynamic_link (demux, NULL, gst_element_get_pad (audio_bin, "sink"),
|
|
|
|
NULL);
|
2005-03-31 09:43:49 +00:00
|
|
|
|
|
|
|
video_bin = gst_bin_new ("v_decoder_bin");
|
|
|
|
v_queue = gst_element_factory_make_or_warn ("queue", "v_queue");
|
|
|
|
v_decoder = gst_element_factory_make_or_warn ("theoradec", "v_dec");
|
|
|
|
v_convert =
|
|
|
|
gst_element_factory_make_or_warn ("ffmpegcolorspace", "v_convert");
|
2005-05-09 10:56:13 +00:00
|
|
|
videosink = gst_element_factory_make_or_warn (VSINK, "v_sink");
|
2005-06-02 13:33:40 +00:00
|
|
|
|
|
|
|
gst_bin_add (GST_BIN (pipeline), video_bin);
|
2005-03-31 09:43:49 +00:00
|
|
|
|
|
|
|
gst_bin_add (GST_BIN (video_bin), v_queue);
|
|
|
|
gst_bin_add (GST_BIN (video_bin), v_decoder);
|
|
|
|
gst_bin_add (GST_BIN (video_bin), v_convert);
|
|
|
|
gst_bin_add (GST_BIN (video_bin), videosink);
|
|
|
|
|
2005-06-02 13:33:40 +00:00
|
|
|
gst_element_link_many (v_queue, v_decoder, v_convert, videosink, NULL);
|
2005-03-31 09:43:49 +00:00
|
|
|
|
Updated seek example.
Original commit message from CVS:
* docs/libs/tmpl/gstringbuffer.sgml:
* examples/seeking/seek.c: (make_vorbis_theora_pipeline),
(query_rates), (query_positions_elems), (query_positions_pads),
(update_scale), (do_seek):
Updated seek example.
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_submit_packet),
(gst_ogg_pad_submit_page), (gst_ogg_demux_activate_chain),
(gst_ogg_demux_find_chains), (gst_ogg_demux_send_event),
(gst_ogg_demux_loop):
Push out correct discont values.
* ext/theora/theoradec.c: (theora_dec_src_convert),
(theora_dec_sink_convert), (theora_dec_src_getcaps),
(theora_dec_sink_event), (theora_handle_type_packet),
(theora_handle_header_packet), (theora_dec_push),
(theora_handle_data_packet), (theora_dec_chain),
(theora_dec_change_state):
Better timestamping.
* ext/vorbis/vorbisdec.c: (gst_vorbis_dec_init),
(vorbis_dec_sink_event), (vorbis_dec_push),
(vorbis_handle_data_packet), (vorbis_dec_chain):
* ext/vorbis/vorbisdec.h:
Better timestamping.
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_base_audio_sink_get_time), (gst_base_audio_sink_get_times),
(gst_base_audio_sink_event), (gst_base_audio_sink_render):
Handle syncing on timestamps instead of sample offsets. Make
use of DISCONT values as described in design docs.
* gst-libs/gst/audio/gstbaseaudiosrc.c:
(gst_base_audio_src_get_time):
* gst-libs/gst/audio/gstringbuffer.c: (gst_ring_buffer_acquire),
(gst_ring_buffer_set_sample), (gst_ring_buffer_commit),
(gst_ring_buffer_read):
* gst-libs/gst/audio/gstringbuffer.h:
* sys/ximage/ximagesink.c: (gst_ximagesink_get_times),
(gst_ximagesink_show_frame):
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_get_times):
Correcly convert buffer timestamp to stream time.
2005-07-16 14:47:27 +00:00
|
|
|
pad = gst_element_get_pad (v_queue, "sink");
|
|
|
|
gst_element_add_pad (video_bin, gst_ghost_pad_new ("sink", pad));
|
|
|
|
gst_object_unref (GST_OBJECT_CAST (pad));
|
2005-06-02 13:33:40 +00:00
|
|
|
|
|
|
|
setup_dynamic_link (demux, NULL, gst_element_get_pad (video_bin, "sink"),
|
|
|
|
NULL);
|
2005-03-31 09:43:49 +00:00
|
|
|
|
|
|
|
seekable = gst_element_get_pad (a_decoder, "src");
|
|
|
|
seekable_pads = g_list_prepend (seekable_pads, seekable);
|
|
|
|
rate_pads = g_list_prepend (rate_pads, seekable);
|
|
|
|
rate_pads =
|
|
|
|
g_list_prepend (rate_pads, gst_element_get_pad (a_decoder, "sink"));
|
|
|
|
|
|
|
|
return pipeline;
|
|
|
|
}
|
|
|
|
|
|
|
|
static GstElement *
|
|
|
|
make_avi_msmpeg4v3_mp3_pipeline (const gchar * location)
|
|
|
|
{
|
|
|
|
GstElement *pipeline, *audio_bin, *video_bin;
|
|
|
|
GstElement *src, *demux, *a_decoder, *a_convert, *v_decoder, *v_convert;
|
|
|
|
GstElement *audiosink, *videosink;
|
|
|
|
GstElement *a_queue, *v_queue;
|
|
|
|
GstPad *seekable;
|
|
|
|
|
|
|
|
pipeline = gst_pipeline_new ("app");
|
|
|
|
|
|
|
|
src = gst_element_factory_make_or_warn (SOURCE, "src");
|
|
|
|
g_object_set (G_OBJECT (src), "location", location, NULL);
|
|
|
|
|
|
|
|
demux = gst_element_factory_make_or_warn ("avidemux", "demux");
|
|
|
|
|
|
|
|
gst_bin_add (GST_BIN (pipeline), src);
|
|
|
|
gst_bin_add (GST_BIN (pipeline), demux);
|
|
|
|
gst_element_link (src, demux);
|
|
|
|
|
|
|
|
audio_bin = gst_bin_new ("a_decoder_bin");
|
|
|
|
a_queue = gst_element_factory_make_or_warn ("queue", "a_queue");
|
|
|
|
a_decoder = gst_element_factory_make_or_warn ("mad", "a_dec");
|
|
|
|
a_convert = gst_element_factory_make_or_warn ("audioconvert", "a_convert");
|
examples/seeking/seek.c: Make audio sink configurable, use alsasink as default.
Original commit message from CVS:
* examples/seeking/seek.c: (make_mod_pipeline), (make_dv_pipeline),
(make_wav_pipeline), (make_flac_pipeline), (make_sid_pipeline),
(make_vorbis_pipeline), (make_vorbis_theora_pipeline),
(make_avi_msmpeg4v3_mp3_pipeline), (make_mp3_pipeline),
(make_avi_pipeline), (make_mpeg_pipeline), (make_mpegnt_pipeline):
Make audio sink configurable, use alsasink as default.
2005-04-28 16:24:23 +00:00
|
|
|
audiosink = gst_element_factory_make_or_warn (ASINK, "a_sink");
|
2005-03-31 09:43:49 +00:00
|
|
|
|
|
|
|
gst_element_link (a_queue, a_decoder);
|
|
|
|
gst_element_link (a_decoder, a_convert);
|
|
|
|
gst_element_link (a_convert, audiosink);
|
|
|
|
|
|
|
|
gst_bin_add (GST_BIN (audio_bin), a_queue);
|
|
|
|
gst_bin_add (GST_BIN (audio_bin), a_decoder);
|
|
|
|
gst_bin_add (GST_BIN (audio_bin), a_convert);
|
|
|
|
gst_bin_add (GST_BIN (audio_bin), audiosink);
|
|
|
|
|
|
|
|
gst_bin_add (GST_BIN (pipeline), audio_bin);
|
|
|
|
|
|
|
|
setup_dynamic_link (demux, NULL, gst_element_get_pad (a_queue, "sink"), NULL);
|
|
|
|
|
|
|
|
video_bin = gst_bin_new ("v_decoder_bin");
|
|
|
|
v_queue = gst_element_factory_make_or_warn ("queue", "v_queue");
|
|
|
|
v_decoder = gst_element_factory_make_or_warn ("ffdec_msmpeg4", "v_dec");
|
|
|
|
v_convert =
|
|
|
|
gst_element_factory_make_or_warn ("ffmpegcolorspace", "v_convert");
|
2005-05-09 10:56:13 +00:00
|
|
|
videosink = gst_element_factory_make_or_warn (VSINK, "v_sink");
|
2005-03-31 09:43:49 +00:00
|
|
|
gst_element_link_many (v_queue, v_decoder, v_convert, videosink, NULL);
|
|
|
|
|
|
|
|
gst_bin_add (GST_BIN (video_bin), v_queue);
|
|
|
|
gst_bin_add (GST_BIN (video_bin), v_decoder);
|
|
|
|
gst_bin_add (GST_BIN (video_bin), v_convert);
|
|
|
|
gst_bin_add (GST_BIN (video_bin), videosink);
|
|
|
|
|
|
|
|
gst_bin_add (GST_BIN (pipeline), video_bin);
|
|
|
|
|
|
|
|
setup_dynamic_link (demux, NULL, gst_element_get_pad (v_queue, "sink"), NULL);
|
|
|
|
|
|
|
|
seekable = gst_element_get_pad (a_decoder, "src");
|
|
|
|
seekable_pads = g_list_prepend (seekable_pads, seekable);
|
|
|
|
rate_pads = g_list_prepend (rate_pads, seekable);
|
|
|
|
rate_pads =
|
|
|
|
g_list_prepend (rate_pads, gst_element_get_pad (a_decoder, "sink"));
|
|
|
|
|
|
|
|
return pipeline;
|
|
|
|
}
|
|
|
|
|
2004-03-14 22:34:34 +00:00
|
|
|
static GstElement *
|
|
|
|
make_mp3_pipeline (const gchar * location)
|
2002-05-28 20:30:11 +00:00
|
|
|
{
|
|
|
|
GstElement *pipeline;
|
2005-03-31 09:43:49 +00:00
|
|
|
GstElement *src, *decoder, *osssink, *queue;
|
2002-05-28 20:30:11 +00:00
|
|
|
GstPad *seekable;
|
2004-03-14 22:34:34 +00:00
|
|
|
|
2002-05-28 20:30:11 +00:00
|
|
|
pipeline = gst_pipeline_new ("app");
|
|
|
|
|
2002-06-13 13:16:52 +00:00
|
|
|
src = gst_element_factory_make_or_warn (SOURCE, "src");
|
|
|
|
decoder = gst_element_factory_make_or_warn ("mad", "dec");
|
|
|
|
queue = gst_element_factory_make_or_warn ("queue", "queue");
|
examples/seeking/seek.c: Make audio sink configurable, use alsasink as default.
Original commit message from CVS:
* examples/seeking/seek.c: (make_mod_pipeline), (make_dv_pipeline),
(make_wav_pipeline), (make_flac_pipeline), (make_sid_pipeline),
(make_vorbis_pipeline), (make_vorbis_theora_pipeline),
(make_avi_msmpeg4v3_mp3_pipeline), (make_mp3_pipeline),
(make_avi_pipeline), (make_mpeg_pipeline), (make_mpegnt_pipeline):
Make audio sink configurable, use alsasink as default.
2005-04-28 16:24:23 +00:00
|
|
|
osssink = gst_element_factory_make_or_warn (ASINK, "sink");
|
2002-06-06 20:26:52 +00:00
|
|
|
|
2005-03-31 09:43:49 +00:00
|
|
|
seekable_elements = g_list_prepend (seekable_elements, osssink);
|
2002-05-28 20:30:11 +00:00
|
|
|
|
|
|
|
g_object_set (G_OBJECT (src), "location", location, NULL);
|
2005-03-31 09:43:49 +00:00
|
|
|
g_object_set (G_OBJECT (osssink), "fragment", 0x00180008, NULL);
|
2002-05-28 20:30:11 +00:00
|
|
|
|
2002-06-06 20:26:52 +00:00
|
|
|
gst_bin_add (GST_BIN (pipeline), src);
|
|
|
|
gst_bin_add (GST_BIN (pipeline), decoder);
|
2005-03-31 09:43:49 +00:00
|
|
|
gst_bin_add (GST_BIN (pipeline), queue);
|
|
|
|
gst_bin_add (GST_BIN (pipeline), osssink);
|
2002-05-28 20:30:11 +00:00
|
|
|
|
2003-01-10 10:22:25 +00:00
|
|
|
gst_element_link (src, decoder);
|
|
|
|
gst_element_link (decoder, queue);
|
2005-03-31 09:43:49 +00:00
|
|
|
gst_element_link (queue, osssink);
|
2002-05-28 20:30:11 +00:00
|
|
|
|
2002-06-06 20:26:52 +00:00
|
|
|
seekable = gst_element_get_pad (queue, "src");
|
|
|
|
seekable_pads = g_list_prepend (seekable_pads, seekable);
|
2002-05-28 20:30:11 +00:00
|
|
|
rate_pads = g_list_prepend (rate_pads, seekable);
|
|
|
|
rate_pads = g_list_prepend (rate_pads, gst_element_get_pad (decoder, "sink"));
|
|
|
|
|
|
|
|
return pipeline;
|
|
|
|
}
|
|
|
|
|
2004-03-14 22:34:34 +00:00
|
|
|
static GstElement *
|
|
|
|
make_avi_pipeline (const gchar * location)
|
2002-05-28 20:30:11 +00:00
|
|
|
{
|
|
|
|
GstElement *pipeline, *audio_bin, *video_bin;
|
|
|
|
GstElement *src, *demux, *a_decoder, *v_decoder, *audiosink, *videosink;
|
2005-03-31 09:43:49 +00:00
|
|
|
GstElement *a_queue = NULL, *v_queue = NULL;
|
2002-05-28 20:30:11 +00:00
|
|
|
GstPad *seekable;
|
2004-03-14 22:34:34 +00:00
|
|
|
|
2002-05-28 20:30:11 +00:00
|
|
|
pipeline = gst_pipeline_new ("app");
|
|
|
|
|
2002-06-13 13:16:52 +00:00
|
|
|
src = gst_element_factory_make_or_warn (SOURCE, "src");
|
2002-05-28 20:30:11 +00:00
|
|
|
g_object_set (G_OBJECT (src), "location", location, NULL);
|
|
|
|
|
2002-06-13 13:16:52 +00:00
|
|
|
demux = gst_element_factory_make_or_warn ("avidemux", "demux");
|
2002-06-06 20:26:52 +00:00
|
|
|
seekable_elements = g_list_prepend (seekable_elements, demux);
|
2002-05-28 20:30:11 +00:00
|
|
|
|
|
|
|
gst_bin_add (GST_BIN (pipeline), src);
|
|
|
|
gst_bin_add (GST_BIN (pipeline), demux);
|
2003-01-10 10:22:25 +00:00
|
|
|
gst_element_link (src, demux);
|
2002-05-28 20:30:11 +00:00
|
|
|
|
|
|
|
audio_bin = gst_bin_new ("a_decoder_bin");
|
2002-06-13 13:16:52 +00:00
|
|
|
a_decoder = gst_element_factory_make_or_warn ("mad", "a_dec");
|
examples/seeking/seek.c: Make audio sink configurable, use alsasink as default.
Original commit message from CVS:
* examples/seeking/seek.c: (make_mod_pipeline), (make_dv_pipeline),
(make_wav_pipeline), (make_flac_pipeline), (make_sid_pipeline),
(make_vorbis_pipeline), (make_vorbis_theora_pipeline),
(make_avi_msmpeg4v3_mp3_pipeline), (make_mp3_pipeline),
(make_avi_pipeline), (make_mpeg_pipeline), (make_mpegnt_pipeline):
Make audio sink configurable, use alsasink as default.
2005-04-28 16:24:23 +00:00
|
|
|
audiosink = gst_element_factory_make_or_warn (ASINK, "a_sink");
|
2002-06-06 20:26:52 +00:00
|
|
|
//g_object_set (G_OBJECT (audiosink), "fragment", 0x00180008, NULL);
|
2002-06-13 13:16:52 +00:00
|
|
|
a_queue = gst_element_factory_make_or_warn ("queue", "a_queue");
|
2003-01-10 10:22:25 +00:00
|
|
|
gst_element_link (a_decoder, a_queue);
|
|
|
|
gst_element_link (a_queue, audiosink);
|
2002-05-28 20:30:11 +00:00
|
|
|
gst_bin_add (GST_BIN (audio_bin), a_decoder);
|
2005-03-31 09:43:49 +00:00
|
|
|
gst_bin_add (GST_BIN (audio_bin), a_queue);
|
|
|
|
gst_bin_add (GST_BIN (audio_bin), audiosink);
|
2002-07-24 21:34:23 +00:00
|
|
|
gst_element_set_state (audio_bin, GST_STATE_PAUSED);
|
2002-05-28 20:30:11 +00:00
|
|
|
|
2004-03-14 22:34:34 +00:00
|
|
|
setup_dynamic_link (demux, "audio_00", gst_element_get_pad (a_decoder,
|
2004-03-15 19:32:28 +00:00
|
|
|
"sink"), audio_bin);
|
2002-05-28 20:30:11 +00:00
|
|
|
|
|
|
|
seekable = gst_element_get_pad (a_queue, "src");
|
2002-06-06 20:26:52 +00:00
|
|
|
seekable_pads = g_list_prepend (seekable_pads, seekable);
|
2002-05-28 20:30:11 +00:00
|
|
|
rate_pads = g_list_prepend (rate_pads, seekable);
|
2004-03-14 22:34:34 +00:00
|
|
|
rate_pads =
|
|
|
|
g_list_prepend (rate_pads, gst_element_get_pad (a_decoder, "sink"));
|
2002-05-28 20:30:11 +00:00
|
|
|
|
|
|
|
video_bin = gst_bin_new ("v_decoder_bin");
|
2002-06-13 13:16:52 +00:00
|
|
|
//v_decoder = gst_element_factory_make_or_warn ("identity", "v_dec");
|
2002-12-26 22:53:36 +00:00
|
|
|
//v_decoder = gst_element_factory_make_or_warn ("windec", "v_dec");
|
2003-02-02 19:25:58 +00:00
|
|
|
v_decoder = gst_element_factory_make_or_warn ("ffmpegdecall", "v_dec");
|
2005-03-31 09:43:49 +00:00
|
|
|
videosink = gst_element_factory_make_or_warn ("ximagesink", "v_sink");
|
2002-06-13 13:16:52 +00:00
|
|
|
//videosink = gst_element_factory_make_or_warn ("fakesink", "v_sink");
|
2002-05-28 20:30:11 +00:00
|
|
|
//g_object_set (G_OBJECT (videosink), "sync", TRUE, NULL);
|
2002-06-13 13:16:52 +00:00
|
|
|
v_queue = gst_element_factory_make_or_warn ("queue", "v_queue");
|
2002-12-26 22:53:36 +00:00
|
|
|
//g_object_set (G_OBJECT (v_queue), "max_level", 10, NULL);
|
2003-01-10 10:22:25 +00:00
|
|
|
gst_element_link (v_decoder, v_queue);
|
|
|
|
gst_element_link (v_queue, videosink);
|
2002-05-28 20:30:11 +00:00
|
|
|
gst_bin_add (GST_BIN (video_bin), v_decoder);
|
2005-03-31 09:43:49 +00:00
|
|
|
gst_bin_add (GST_BIN (video_bin), v_queue);
|
|
|
|
gst_bin_add (GST_BIN (video_bin), videosink);
|
2002-05-28 20:30:11 +00:00
|
|
|
|
2002-07-24 21:34:23 +00:00
|
|
|
gst_element_set_state (video_bin, GST_STATE_PAUSED);
|
2002-05-28 20:30:11 +00:00
|
|
|
|
2004-03-14 22:34:34 +00:00
|
|
|
setup_dynamic_link (demux, "video_00", gst_element_get_pad (v_decoder,
|
2004-03-15 19:32:28 +00:00
|
|
|
"sink"), video_bin);
|
2002-05-28 20:30:11 +00:00
|
|
|
|
|
|
|
seekable = gst_element_get_pad (v_queue, "src");
|
2002-06-06 20:26:52 +00:00
|
|
|
seekable_pads = g_list_prepend (seekable_pads, seekable);
|
2002-05-28 20:30:11 +00:00
|
|
|
rate_pads = g_list_prepend (rate_pads, seekable);
|
2004-03-14 22:34:34 +00:00
|
|
|
rate_pads =
|
|
|
|
g_list_prepend (rate_pads, gst_element_get_pad (v_decoder, "sink"));
|
2002-05-28 20:30:11 +00:00
|
|
|
|
|
|
|
return pipeline;
|
|
|
|
}
|
|
|
|
|
2004-03-14 22:34:34 +00:00
|
|
|
static GstElement *
|
|
|
|
make_mpeg_pipeline (const gchar * location)
|
2002-05-28 20:30:11 +00:00
|
|
|
{
|
|
|
|
GstElement *pipeline, *audio_bin, *video_bin;
|
2002-06-13 13:16:52 +00:00
|
|
|
GstElement *src, *demux, *a_decoder, *v_decoder, *v_filter;
|
|
|
|
GstElement *audiosink, *videosink;
|
2005-03-31 09:43:49 +00:00
|
|
|
GstElement *a_queue, *v_queue;
|
2002-05-28 20:30:11 +00:00
|
|
|
GstPad *seekable;
|
2004-03-14 22:34:34 +00:00
|
|
|
|
2002-05-28 20:30:11 +00:00
|
|
|
pipeline = gst_pipeline_new ("app");
|
|
|
|
|
2002-06-13 13:16:52 +00:00
|
|
|
src = gst_element_factory_make_or_warn (SOURCE, "src");
|
2002-05-28 20:30:11 +00:00
|
|
|
g_object_set (G_OBJECT (src), "location", location, NULL);
|
|
|
|
|
2002-06-13 13:16:52 +00:00
|
|
|
demux = gst_element_factory_make_or_warn ("mpegdemux", "demux");
|
2003-02-02 19:25:58 +00:00
|
|
|
g_object_set (G_OBJECT (demux), "sync", FALSE, NULL);
|
2002-05-28 20:30:11 +00:00
|
|
|
|
2002-06-06 20:26:52 +00:00
|
|
|
seekable_elements = g_list_prepend (seekable_elements, demux);
|
|
|
|
|
2002-05-28 20:30:11 +00:00
|
|
|
gst_bin_add (GST_BIN (pipeline), src);
|
|
|
|
gst_bin_add (GST_BIN (pipeline), demux);
|
2003-01-10 10:22:25 +00:00
|
|
|
gst_element_link (src, demux);
|
2002-05-28 20:30:11 +00:00
|
|
|
|
|
|
|
audio_bin = gst_bin_new ("a_decoder_bin");
|
2002-06-13 13:16:52 +00:00
|
|
|
a_decoder = gst_element_factory_make_or_warn ("mad", "a_dec");
|
|
|
|
a_queue = gst_element_factory_make_or_warn ("queue", "a_queue");
|
examples/seeking/seek.c: Make audio sink configurable, use alsasink as default.
Original commit message from CVS:
* examples/seeking/seek.c: (make_mod_pipeline), (make_dv_pipeline),
(make_wav_pipeline), (make_flac_pipeline), (make_sid_pipeline),
(make_vorbis_pipeline), (make_vorbis_theora_pipeline),
(make_avi_msmpeg4v3_mp3_pipeline), (make_mp3_pipeline),
(make_avi_pipeline), (make_mpeg_pipeline), (make_mpegnt_pipeline):
Make audio sink configurable, use alsasink as default.
2005-04-28 16:24:23 +00:00
|
|
|
audiosink = gst_element_factory_make_or_warn (ASINK, "a_sink");
|
2002-05-28 20:30:11 +00:00
|
|
|
g_object_set (G_OBJECT (audiosink), "fragment", 0x00180008, NULL);
|
2003-01-10 10:22:25 +00:00
|
|
|
gst_element_link (a_decoder, a_queue);
|
|
|
|
gst_element_link (a_queue, audiosink);
|
2002-05-28 20:30:11 +00:00
|
|
|
gst_bin_add (GST_BIN (audio_bin), a_decoder);
|
2005-03-31 09:43:49 +00:00
|
|
|
gst_bin_add (GST_BIN (audio_bin), a_queue);
|
|
|
|
gst_bin_add (GST_BIN (audio_bin), audiosink);
|
2002-05-28 20:30:11 +00:00
|
|
|
|
2004-03-14 22:34:34 +00:00
|
|
|
setup_dynamic_link (demux, "audio_00", gst_element_get_pad (a_decoder,
|
2004-03-15 19:32:28 +00:00
|
|
|
"sink"), audio_bin);
|
2002-05-28 20:30:11 +00:00
|
|
|
|
|
|
|
seekable = gst_element_get_pad (a_queue, "src");
|
2002-06-06 20:26:52 +00:00
|
|
|
seekable_pads = g_list_prepend (seekable_pads, seekable);
|
2002-05-28 20:30:11 +00:00
|
|
|
rate_pads = g_list_prepend (rate_pads, seekable);
|
2004-03-14 22:34:34 +00:00
|
|
|
rate_pads =
|
|
|
|
g_list_prepend (rate_pads, gst_element_get_pad (a_decoder, "sink"));
|
2002-05-28 20:30:11 +00:00
|
|
|
|
|
|
|
video_bin = gst_bin_new ("v_decoder_bin");
|
2002-06-13 13:16:52 +00:00
|
|
|
v_decoder = gst_element_factory_make_or_warn ("mpeg2dec", "v_dec");
|
2002-12-26 22:53:36 +00:00
|
|
|
//g_object_set (G_OBJECT (video_thread), "priority", 2, NULL);
|
2002-06-13 13:16:52 +00:00
|
|
|
v_queue = gst_element_factory_make_or_warn ("queue", "v_queue");
|
examples/seeking/seek.c: Added playbin seeking example.
Original commit message from CVS:
* examples/seeking/seek.c: (make_dv_pipeline), (make_avi_pipeline),
(make_mpeg_pipeline), (make_mpegnt_pipeline),
(make_playerbin_pipeline), (query_durations_elems),
(query_durations_pads), (query_positions_elems),
(query_positions_pads), (update_scale), (iterate), (stop_seek),
(main):
Added playbin seeking example.
2004-07-08 15:43:24 +00:00
|
|
|
v_filter = gst_element_factory_make_or_warn ("ffmpegcolorspace", "v_filter");
|
2005-03-31 09:43:49 +00:00
|
|
|
videosink = gst_element_factory_make_or_warn ("ximagesink", "v_sink");
|
2003-01-10 10:22:25 +00:00
|
|
|
gst_element_link_many (v_decoder, v_queue, v_filter, NULL);
|
2004-03-14 22:34:34 +00:00
|
|
|
|
2003-01-10 10:22:25 +00:00
|
|
|
gst_element_link (v_filter, videosink);
|
2005-03-31 09:43:49 +00:00
|
|
|
gst_bin_add_many (GST_BIN (video_bin), v_decoder, NULL);
|
|
|
|
gst_bin_add_many (GST_BIN (video_bin), v_queue, v_filter, videosink, NULL);
|
2002-05-28 20:30:11 +00:00
|
|
|
|
2004-03-14 22:34:34 +00:00
|
|
|
setup_dynamic_link (demux, "video_00", gst_element_get_pad (v_decoder,
|
2004-03-15 19:32:28 +00:00
|
|
|
"sink"), video_bin);
|
2002-05-28 20:30:11 +00:00
|
|
|
|
|
|
|
seekable = gst_element_get_pad (v_queue, "src");
|
2002-06-06 20:26:52 +00:00
|
|
|
seekable_pads = g_list_prepend (seekable_pads, seekable);
|
2002-05-28 20:30:11 +00:00
|
|
|
rate_pads = g_list_prepend (rate_pads, seekable);
|
2004-03-14 22:34:34 +00:00
|
|
|
rate_pads =
|
|
|
|
g_list_prepend (rate_pads, gst_element_get_pad (v_decoder, "sink"));
|
2002-05-28 20:30:11 +00:00
|
|
|
|
|
|
|
return pipeline;
|
|
|
|
}
|
|
|
|
|
2004-03-14 22:34:34 +00:00
|
|
|
static GstElement *
|
|
|
|
make_mpegnt_pipeline (const gchar * location)
|
2002-07-24 21:34:23 +00:00
|
|
|
{
|
|
|
|
GstElement *pipeline, *audio_bin, *video_bin;
|
|
|
|
GstElement *src, *demux, *a_decoder, *v_decoder, *v_filter;
|
|
|
|
GstElement *audiosink, *videosink;
|
2005-03-31 09:43:49 +00:00
|
|
|
GstElement *a_queue;
|
2002-07-24 21:34:23 +00:00
|
|
|
GstPad *seekable;
|
2004-03-14 22:34:34 +00:00
|
|
|
|
2002-07-24 21:34:23 +00:00
|
|
|
pipeline = gst_pipeline_new ("app");
|
|
|
|
|
|
|
|
src = gst_element_factory_make_or_warn (SOURCE, "src");
|
|
|
|
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", TRUE, NULL);
|
|
|
|
|
|
|
|
seekable_elements = g_list_prepend (seekable_elements, demux);
|
|
|
|
|
|
|
|
gst_bin_add (GST_BIN (pipeline), src);
|
|
|
|
gst_bin_add (GST_BIN (pipeline), demux);
|
2003-01-10 10:22:25 +00:00
|
|
|
gst_element_link (src, demux);
|
2002-07-24 21:34:23 +00:00
|
|
|
|
|
|
|
audio_bin = gst_bin_new ("a_decoder_bin");
|
|
|
|
a_decoder = gst_element_factory_make_or_warn ("mad", "a_dec");
|
|
|
|
a_queue = gst_element_factory_make_or_warn ("queue", "a_queue");
|
examples/seeking/seek.c: Make audio sink configurable, use alsasink as default.
Original commit message from CVS:
* examples/seeking/seek.c: (make_mod_pipeline), (make_dv_pipeline),
(make_wav_pipeline), (make_flac_pipeline), (make_sid_pipeline),
(make_vorbis_pipeline), (make_vorbis_theora_pipeline),
(make_avi_msmpeg4v3_mp3_pipeline), (make_mp3_pipeline),
(make_avi_pipeline), (make_mpeg_pipeline), (make_mpegnt_pipeline):
Make audio sink configurable, use alsasink as default.
2005-04-28 16:24:23 +00:00
|
|
|
audiosink = gst_element_factory_make_or_warn (ASINK, "a_sink");
|
2002-07-24 21:34:23 +00:00
|
|
|
//g_object_set (G_OBJECT (audiosink), "fragment", 0x00180008, NULL);
|
|
|
|
g_object_set (G_OBJECT (audiosink), "sync", FALSE, NULL);
|
2003-01-10 10:22:25 +00:00
|
|
|
gst_element_link (a_decoder, a_queue);
|
|
|
|
gst_element_link (a_queue, audiosink);
|
2002-07-24 21:34:23 +00:00
|
|
|
gst_bin_add (GST_BIN (audio_bin), a_decoder);
|
2005-03-31 09:43:49 +00:00
|
|
|
gst_bin_add (GST_BIN (audio_bin), a_queue);
|
|
|
|
gst_bin_add (GST_BIN (audio_bin), audiosink);
|
2002-07-24 21:34:23 +00:00
|
|
|
|
2004-03-14 22:34:34 +00:00
|
|
|
setup_dynamic_link (demux, "audio_00", gst_element_get_pad (a_decoder,
|
2004-03-15 19:32:28 +00:00
|
|
|
"sink"), audio_bin);
|
2002-07-24 21:34:23 +00:00
|
|
|
|
|
|
|
seekable = gst_element_get_pad (a_queue, "src");
|
|
|
|
seekable_pads = g_list_prepend (seekable_pads, seekable);
|
|
|
|
rate_pads = g_list_prepend (rate_pads, seekable);
|
2004-03-14 22:34:34 +00:00
|
|
|
rate_pads =
|
|
|
|
g_list_prepend (rate_pads, gst_element_get_pad (a_decoder, "sink"));
|
2002-07-24 21:34:23 +00:00
|
|
|
|
|
|
|
video_bin = gst_bin_new ("v_decoder_bin");
|
|
|
|
v_decoder = gst_element_factory_make_or_warn ("mpeg2dec", "v_dec");
|
examples/seeking/seek.c: Added playbin seeking example.
Original commit message from CVS:
* examples/seeking/seek.c: (make_dv_pipeline), (make_avi_pipeline),
(make_mpeg_pipeline), (make_mpegnt_pipeline),
(make_playerbin_pipeline), (query_durations_elems),
(query_durations_pads), (query_positions_elems),
(query_positions_pads), (update_scale), (iterate), (stop_seek),
(main):
Added playbin seeking example.
2004-07-08 15:43:24 +00:00
|
|
|
v_filter = gst_element_factory_make_or_warn ("ffmpegcolorspace", "v_filter");
|
2005-03-31 09:43:49 +00:00
|
|
|
videosink = gst_element_factory_make_or_warn ("ximagesink", "v_sink");
|
2003-01-10 10:22:25 +00:00
|
|
|
gst_element_link_many (v_decoder, v_filter, videosink, NULL);
|
2004-03-14 22:34:34 +00:00
|
|
|
|
2002-07-24 21:34:23 +00:00
|
|
|
gst_bin_add_many (GST_BIN (video_bin), v_decoder, v_filter, videosink, NULL);
|
|
|
|
|
2004-03-14 22:34:34 +00:00
|
|
|
setup_dynamic_link (demux, "video_00", gst_element_get_pad (v_decoder,
|
2004-03-15 19:32:28 +00:00
|
|
|
"sink"), video_bin);
|
2002-07-24 21:34:23 +00:00
|
|
|
|
|
|
|
seekable = gst_element_get_pad (v_decoder, "src");
|
|
|
|
seekable_pads = g_list_prepend (seekable_pads, seekable);
|
|
|
|
rate_pads = g_list_prepend (rate_pads, seekable);
|
2004-03-14 22:34:34 +00:00
|
|
|
rate_pads =
|
|
|
|
g_list_prepend (rate_pads, gst_element_get_pad (v_decoder, "sink"));
|
2002-07-24 21:34:23 +00:00
|
|
|
|
|
|
|
return pipeline;
|
|
|
|
}
|
|
|
|
|
2004-03-14 22:34:34 +00:00
|
|
|
static GstElement *
|
|
|
|
make_playerbin_pipeline (const gchar * location)
|
2003-02-02 19:25:58 +00:00
|
|
|
{
|
2005-03-31 09:43:49 +00:00
|
|
|
GstElement *player;
|
examples/seeking/seek.c: Added playbin seeking example.
Original commit message from CVS:
* examples/seeking/seek.c: (make_dv_pipeline), (make_avi_pipeline),
(make_mpeg_pipeline), (make_mpegnt_pipeline),
(make_playerbin_pipeline), (query_durations_elems),
(query_durations_pads), (query_positions_elems),
(query_positions_pads), (update_scale), (iterate), (stop_seek),
(main):
Added playbin seeking example.
2004-07-08 15:43:24 +00:00
|
|
|
|
|
|
|
player = gst_element_factory_make ("playbin", "player");
|
|
|
|
g_assert (player);
|
|
|
|
|
2005-03-31 09:43:49 +00:00
|
|
|
g_object_set (G_OBJECT (player), "uri", location, NULL);
|
examples/seeking/seek.c: Added playbin seeking example.
Original commit message from CVS:
* examples/seeking/seek.c: (make_dv_pipeline), (make_avi_pipeline),
(make_mpeg_pipeline), (make_mpegnt_pipeline),
(make_playerbin_pipeline), (query_durations_elems),
(query_durations_pads), (query_positions_elems),
(query_positions_pads), (update_scale), (iterate), (stop_seek),
(main):
Added playbin seeking example.
2004-07-08 15:43:24 +00:00
|
|
|
|
|
|
|
seekable_elements = g_list_prepend (seekable_elements, player);
|
|
|
|
|
|
|
|
/* force element seeking on this pipeline */
|
|
|
|
elem_seek = TRUE;
|
|
|
|
|
|
|
|
return player;
|
2003-02-02 19:25:58 +00:00
|
|
|
}
|
|
|
|
|
2004-03-14 22:34:34 +00:00
|
|
|
static gchar *
|
|
|
|
format_value (GtkScale * scale, gdouble value)
|
2002-05-28 20:30:11 +00:00
|
|
|
{
|
2002-06-06 20:26:52 +00:00
|
|
|
gint64 real;
|
|
|
|
gint64 seconds;
|
|
|
|
gint64 subseconds;
|
|
|
|
|
|
|
|
real = value * duration / 100;
|
|
|
|
seconds = (gint64) real / GST_SECOND;
|
|
|
|
subseconds = (gint64) real / (GST_SECOND / 100);
|
2002-05-28 20:30:11 +00:00
|
|
|
|
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:27 +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-05-28 20:30:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
const gchar *name;
|
|
|
|
const GstFormat format;
|
2004-03-15 19:32:28 +00:00
|
|
|
}
|
|
|
|
seek_format;
|
2002-05-28 20:30:11 +00:00
|
|
|
|
2004-03-14 22:34:34 +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-05-28 20:30:11 +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;
|
|
|
|
|
2005-05-09 10:56:13 +00:00
|
|
|
if (gst_pad_query_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:27 +00:00
|
|
|
g_print ("%s %13" G_GINT64_FORMAT " | ", seek_formats[i].name, value);
|
2004-03-14 22:34:34 +00:00
|
|
|
} else {
|
2004-03-15 19:32:28 +00:00
|
|
|
g_print ("%s %13.13s | ", seek_formats[i].name, "*NA*");
|
2002-05-28 20:30:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
i++;
|
|
|
|
}
|
|
|
|
g_print (" %s:%s\n", GST_DEBUG_PAD_NAME (pad));
|
|
|
|
|
|
|
|
walk = g_list_next (walk);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
G_GNUC_UNUSED static void
|
examples/seeking/seek.c: Added playbin seeking example.
Original commit message from CVS:
* examples/seeking/seek.c: (make_dv_pipeline), (make_avi_pipeline),
(make_mpeg_pipeline), (make_mpegnt_pipeline),
(make_playerbin_pipeline), (query_durations_elems),
(query_durations_pads), (query_positions_elems),
(query_positions_pads), (update_scale), (iterate), (stop_seek),
(main):
Added playbin seeking example.
2004-07-08 15:43:24 +00:00
|
|
|
query_positions_elems ()
|
|
|
|
{
|
|
|
|
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) {
|
2005-05-09 10:56:13 +00:00
|
|
|
gint64 position, total;
|
examples/seeking/seek.c: Added playbin seeking example.
Original commit message from CVS:
* examples/seeking/seek.c: (make_dv_pipeline), (make_avi_pipeline),
(make_mpeg_pipeline), (make_mpegnt_pipeline),
(make_playerbin_pipeline), (query_durations_elems),
(query_durations_pads), (query_positions_elems),
(query_positions_pads), (update_scale), (iterate), (stop_seek),
(main):
Added playbin seeking example.
2004-07-08 15:43:24 +00:00
|
|
|
GstFormat format;
|
|
|
|
|
|
|
|
format = seek_formats[i].format;
|
2005-05-09 10:56:13 +00:00
|
|
|
|
|
|
|
if (gst_element_query_position (element, &format, &position, &total)) {
|
|
|
|
g_print ("%s %13" G_GINT64_FORMAT " / %13" G_GINT64_FORMAT " | ",
|
|
|
|
seek_formats[i].name, position, total);
|
examples/seeking/seek.c: Added playbin seeking example.
Original commit message from CVS:
* examples/seeking/seek.c: (make_dv_pipeline), (make_avi_pipeline),
(make_mpeg_pipeline), (make_mpegnt_pipeline),
(make_playerbin_pipeline), (query_durations_elems),
(query_durations_pads), (query_positions_elems),
(query_positions_pads), (update_scale), (iterate), (stop_seek),
(main):
Added playbin seeking example.
2004-07-08 15:43:24 +00:00
|
|
|
} else {
|
2005-05-09 10:56:13 +00:00
|
|
|
g_print ("%s %13.13s / %13.13s | ", seek_formats[i].name, "*NA*",
|
|
|
|
"*NA*");
|
examples/seeking/seek.c: Added playbin seeking example.
Original commit message from CVS:
* examples/seeking/seek.c: (make_dv_pipeline), (make_avi_pipeline),
(make_mpeg_pipeline), (make_mpegnt_pipeline),
(make_playerbin_pipeline), (query_durations_elems),
(query_durations_pads), (query_positions_elems),
(query_positions_pads), (update_scale), (iterate), (stop_seek),
(main):
Added playbin seeking example.
2004-07-08 15:43:24 +00:00
|
|
|
}
|
|
|
|
i++;
|
|
|
|
}
|
|
|
|
g_print (" %s\n", GST_ELEMENT_NAME (element));
|
|
|
|
|
|
|
|
walk = g_list_next (walk);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
G_GNUC_UNUSED static void
|
|
|
|
query_positions_pads ()
|
2002-05-28 20:30:11 +00:00
|
|
|
{
|
2002-06-11 19:20:52 +00:00
|
|
|
GList *walk = seekable_pads;
|
|
|
|
|
|
|
|
while (walk) {
|
|
|
|
GstPad *pad = GST_PAD (walk->data);
|
|
|
|
gint i = 0;
|
|
|
|
|
|
|
|
g_print ("positions %8.8s: ", GST_PAD_NAME (pad));
|
|
|
|
while (seek_formats[i].name) {
|
|
|
|
GstFormat format;
|
2005-05-09 10:56:13 +00:00
|
|
|
gint64 position, total;
|
2002-06-11 19:20:52 +00:00
|
|
|
|
|
|
|
format = seek_formats[i].format;
|
2005-05-09 10:56:13 +00:00
|
|
|
|
|
|
|
if (gst_pad_query_position (pad, &format, &position, &total)) {
|
|
|
|
g_print ("%s %13" G_GINT64_FORMAT " / %13" G_GINT64_FORMAT " | ",
|
|
|
|
seek_formats[i].name, position, total);
|
2004-03-14 22:34:34 +00:00
|
|
|
} else {
|
2005-05-09 10:56:13 +00:00
|
|
|
g_print ("%s %13.13s / %13.13s | ", seek_formats[i].name, "*NA*",
|
|
|
|
"*NA*");
|
2002-06-11 19:20:52 +00:00
|
|
|
}
|
2005-05-09 10:56:13 +00:00
|
|
|
|
2002-06-11 19:20:52 +00:00
|
|
|
i++;
|
2002-05-28 20:30:11 +00:00
|
|
|
}
|
2002-06-11 19:20:52 +00:00
|
|
|
g_print (" %s:%s\n", GST_DEBUG_PAD_NAME (pad));
|
|
|
|
|
|
|
|
walk = g_list_next (walk);
|
2002-05-28 20:30:11 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
2004-03-14 22:34:34 +00:00
|
|
|
update_scale (gpointer data)
|
2002-05-28 20:30:11 +00:00
|
|
|
{
|
|
|
|
GstClock *clock;
|
2005-05-09 10:56:13 +00:00
|
|
|
GstFormat format;
|
2002-05-28 20:30:11 +00:00
|
|
|
|
2005-05-09 10:56:13 +00:00
|
|
|
position = 0;
|
2002-06-11 19:20:52 +00:00
|
|
|
duration = 0;
|
2005-03-31 09:43:49 +00:00
|
|
|
clock = gst_pipeline_get_clock (GST_PIPELINE (pipeline));
|
2002-05-28 20:30:11 +00:00
|
|
|
|
2005-05-09 10:56:13 +00:00
|
|
|
format = GST_FORMAT_TIME;
|
|
|
|
|
examples/seeking/seek.c: Added playbin seeking example.
Original commit message from CVS:
* examples/seeking/seek.c: (make_dv_pipeline), (make_avi_pipeline),
(make_mpeg_pipeline), (make_mpegnt_pipeline),
(make_playerbin_pipeline), (query_durations_elems),
(query_durations_pads), (query_positions_elems),
(query_positions_pads), (update_scale), (iterate), (stop_seek),
(main):
Added playbin seeking example.
2004-07-08 15:43:24 +00:00
|
|
|
if (elem_seek) {
|
|
|
|
if (seekable_elements) {
|
|
|
|
GstElement *element = GST_ELEMENT (seekable_elements->data);
|
2004-03-14 22:34:34 +00:00
|
|
|
|
2005-05-09 10:56:13 +00:00
|
|
|
gst_element_query_position (element, &format, &position, &duration);
|
examples/seeking/seek.c: Added playbin seeking example.
Original commit message from CVS:
* examples/seeking/seek.c: (make_dv_pipeline), (make_avi_pipeline),
(make_mpeg_pipeline), (make_mpegnt_pipeline),
(make_playerbin_pipeline), (query_durations_elems),
(query_durations_pads), (query_positions_elems),
(query_positions_pads), (update_scale), (iterate), (stop_seek),
(main):
Added playbin seeking example.
2004-07-08 15:43:24 +00:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if (seekable_pads) {
|
|
|
|
GstPad *pad = GST_PAD (seekable_pads->data);
|
|
|
|
|
2005-05-09 10:56:13 +00:00
|
|
|
gst_pad_query_position (pad, &format, &position, &duration);
|
examples/seeking/seek.c: Added playbin seeking example.
Original commit message from CVS:
* examples/seeking/seek.c: (make_dv_pipeline), (make_avi_pipeline),
(make_mpeg_pipeline), (make_mpegnt_pipeline),
(make_playerbin_pipeline), (query_durations_elems),
(query_durations_pads), (query_positions_elems),
(query_positions_pads), (update_scale), (iterate), (stop_seek),
(main):
Added playbin seeking example.
2004-07-08 15:43:24 +00:00
|
|
|
}
|
2002-06-11 19:20:52 +00:00
|
|
|
}
|
2002-05-28 20:30:11 +00:00
|
|
|
|
2002-06-11 19:20:52 +00:00
|
|
|
if (stats) {
|
examples/seeking/seek.c: Added playbin seeking example.
Original commit message from CVS:
* examples/seeking/seek.c: (make_dv_pipeline), (make_avi_pipeline),
(make_mpeg_pipeline), (make_mpegnt_pipeline),
(make_playerbin_pipeline), (query_durations_elems),
(query_durations_pads), (query_positions_elems),
(query_positions_pads), (update_scale), (iterate), (stop_seek),
(main):
Added playbin seeking example.
2004-07-08 15:43:24 +00:00
|
|
|
if (clock) {
|
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)));
|
examples/seeking/seek.c: Added playbin seeking example.
Original commit message from CVS:
* examples/seeking/seek.c: (make_dv_pipeline), (make_avi_pipeline),
(make_mpeg_pipeline), (make_mpegnt_pipeline),
(make_playerbin_pipeline), (query_durations_elems),
(query_durations_pads), (query_positions_elems),
(query_positions_pads), (update_scale), (iterate), (stop_seek),
(main):
Added playbin seeking example.
2004-07-08 15:43:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (elem_seek) {
|
|
|
|
query_positions_elems ();
|
|
|
|
} else {
|
|
|
|
query_positions_pads ();
|
|
|
|
}
|
2002-06-11 19:20:52 +00:00
|
|
|
query_rates ();
|
2002-05-28 20:30:11 +00:00
|
|
|
}
|
2004-07-16 11:05:53 +00:00
|
|
|
if (position >= duration)
|
|
|
|
duration = position;
|
2002-05-28 20:30:11 +00:00
|
|
|
|
|
|
|
if (duration > 0) {
|
|
|
|
gtk_adjustment_set_value (adjustment, position * 100.0 / duration);
|
2004-07-16 11:05:53 +00:00
|
|
|
gtk_widget_queue_draw (hscale);
|
2002-05-28 20:30:11 +00:00
|
|
|
}
|
|
|
|
|
Updated seek example.
Original commit message from CVS:
* docs/libs/tmpl/gstringbuffer.sgml:
* examples/seeking/seek.c: (make_vorbis_theora_pipeline),
(query_rates), (query_positions_elems), (query_positions_pads),
(update_scale), (do_seek):
Updated seek example.
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_submit_packet),
(gst_ogg_pad_submit_page), (gst_ogg_demux_activate_chain),
(gst_ogg_demux_find_chains), (gst_ogg_demux_send_event),
(gst_ogg_demux_loop):
Push out correct discont values.
* ext/theora/theoradec.c: (theora_dec_src_convert),
(theora_dec_sink_convert), (theora_dec_src_getcaps),
(theora_dec_sink_event), (theora_handle_type_packet),
(theora_handle_header_packet), (theora_dec_push),
(theora_handle_data_packet), (theora_dec_chain),
(theora_dec_change_state):
Better timestamping.
* ext/vorbis/vorbisdec.c: (gst_vorbis_dec_init),
(vorbis_dec_sink_event), (vorbis_dec_push),
(vorbis_handle_data_packet), (vorbis_dec_chain):
* ext/vorbis/vorbisdec.h:
Better timestamping.
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_base_audio_sink_get_time), (gst_base_audio_sink_get_times),
(gst_base_audio_sink_event), (gst_base_audio_sink_render):
Handle syncing on timestamps instead of sample offsets. Make
use of DISCONT values as described in design docs.
* gst-libs/gst/audio/gstbaseaudiosrc.c:
(gst_base_audio_src_get_time):
* gst-libs/gst/audio/gstringbuffer.c: (gst_ring_buffer_acquire),
(gst_ring_buffer_set_sample), (gst_ring_buffer_commit),
(gst_ring_buffer_read):
* gst-libs/gst/audio/gstringbuffer.h:
* sys/ximage/ximagesink.c: (gst_ximagesink_get_times),
(gst_ximagesink_show_frame):
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_get_times):
Correcly convert buffer timestamp to stream time.
2005-07-16 14:47:27 +00:00
|
|
|
gst_object_unref (clock);
|
|
|
|
|
2002-05-28 20:30:11 +00:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2005-03-31 09:43:49 +00:00
|
|
|
static void do_seek (GtkWidget * widget);
|
2002-05-28 20:30:11 +00:00
|
|
|
|
2005-03-31 09:43:49 +00:00
|
|
|
#ifdef SCRUB
|
2002-05-28 20:30:11 +00:00
|
|
|
static gboolean
|
2005-03-31 09:43:49 +00:00
|
|
|
end_scrub (GtkWidget * widget)
|
2002-05-28 20:30:11 +00:00
|
|
|
{
|
|
|
|
gst_element_set_state (pipeline, GST_STATE_PAUSED);
|
2005-03-31 09:43:49 +00:00
|
|
|
seek_timeout_id = 0;
|
2002-05-28 20:30:11 +00:00
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
2005-03-31 09:43:49 +00:00
|
|
|
#endif
|
2002-05-28 20:30:11 +00:00
|
|
|
|
2005-03-31 09:43:49 +00:00
|
|
|
static void
|
|
|
|
do_seek (GtkWidget * widget)
|
2002-05-28 20:30:11 +00:00
|
|
|
{
|
|
|
|
gint64 real = gtk_range_get_value (GTK_RANGE (widget)) * duration / 100;
|
2005-06-02 13:33:40 +00:00
|
|
|
gboolean res = FALSE;
|
2002-05-28 20:30:11 +00:00
|
|
|
GstEvent *s_event;
|
2004-03-14 22:34:34 +00:00
|
|
|
|
examples/seeking/seek.c: Added playbin seeking example.
Original commit message from CVS:
* examples/seeking/seek.c: (make_dv_pipeline), (make_avi_pipeline),
(make_mpeg_pipeline), (make_mpegnt_pipeline),
(make_playerbin_pipeline), (query_durations_elems),
(query_durations_pads), (query_positions_elems),
(query_positions_pads), (update_scale), (iterate), (stop_seek),
(main):
Added playbin seeking example.
2004-07-08 15:43:24 +00:00
|
|
|
if (!elem_seek) {
|
|
|
|
GList *walk = seekable_pads;
|
2002-05-28 20:30:11 +00:00
|
|
|
|
examples/seeking/seek.c: Added playbin seeking example.
Original commit message from CVS:
* examples/seeking/seek.c: (make_dv_pipeline), (make_avi_pipeline),
(make_mpeg_pipeline), (make_mpegnt_pipeline),
(make_playerbin_pipeline), (query_durations_elems),
(query_durations_pads), (query_positions_elems),
(query_positions_pads), (update_scale), (iterate), (stop_seek),
(main):
Added playbin seeking example.
2004-07-08 15:43:24 +00:00
|
|
|
while (walk) {
|
|
|
|
GstPad *seekable = GST_PAD (walk->data);
|
2002-05-28 20:30:11 +00:00
|
|
|
|
2005-03-31 09:43:49 +00:00
|
|
|
g_print ("seek to %" GST_TIME_FORMAT " on pad %s:%s\n",
|
|
|
|
GST_TIME_ARGS (real), GST_DEBUG_PAD_NAME (seekable));
|
examples/seeking/seek.c: Added playbin seeking example.
Original commit message from CVS:
* examples/seeking/seek.c: (make_dv_pipeline), (make_avi_pipeline),
(make_mpeg_pipeline), (make_mpegnt_pipeline),
(make_playerbin_pipeline), (query_durations_elems),
(query_durations_pads), (query_positions_elems),
(query_positions_pads), (update_scale), (iterate), (stop_seek),
(main):
Added playbin seeking example.
2004-07-08 15:43:24 +00:00
|
|
|
s_event =
|
|
|
|
gst_event_new_seek (GST_FORMAT_TIME | GST_SEEK_METHOD_SET |
|
|
|
|
GST_SEEK_FLAG_FLUSH, real);
|
2002-05-28 20:30:11 +00:00
|
|
|
|
examples/seeking/seek.c: Added playbin seeking example.
Original commit message from CVS:
* examples/seeking/seek.c: (make_dv_pipeline), (make_avi_pipeline),
(make_mpeg_pipeline), (make_mpegnt_pipeline),
(make_playerbin_pipeline), (query_durations_elems),
(query_durations_pads), (query_positions_elems),
(query_positions_pads), (update_scale), (iterate), (stop_seek),
(main):
Added playbin seeking example.
2004-07-08 15:43:24 +00:00
|
|
|
res = gst_pad_send_event (seekable, s_event);
|
2002-05-28 20:30:11 +00:00
|
|
|
|
examples/seeking/seek.c: Added playbin seeking example.
Original commit message from CVS:
* examples/seeking/seek.c: (make_dv_pipeline), (make_avi_pipeline),
(make_mpeg_pipeline), (make_mpegnt_pipeline),
(make_playerbin_pipeline), (query_durations_elems),
(query_durations_pads), (query_positions_elems),
(query_positions_pads), (update_scale), (iterate), (stop_seek),
(main):
Added playbin seeking example.
2004-07-08 15:43:24 +00:00
|
|
|
walk = g_list_next (walk);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
GList *walk = seekable_elements;
|
2002-06-06 20:26:52 +00:00
|
|
|
|
examples/seeking/seek.c: Added playbin seeking example.
Original commit message from CVS:
* examples/seeking/seek.c: (make_dv_pipeline), (make_avi_pipeline),
(make_mpeg_pipeline), (make_mpegnt_pipeline),
(make_playerbin_pipeline), (query_durations_elems),
(query_durations_pads), (query_positions_elems),
(query_positions_pads), (update_scale), (iterate), (stop_seek),
(main):
Added playbin seeking example.
2004-07-08 15:43:24 +00:00
|
|
|
while (walk) {
|
|
|
|
GstElement *seekable = GST_ELEMENT (walk->data);
|
2002-06-06 20:26:52 +00:00
|
|
|
|
2005-06-02 13:33:40 +00:00
|
|
|
g_print ("seek to %" GST_TIME_FORMAT " on element %s\n",
|
|
|
|
GST_TIME_ARGS (real), GST_ELEMENT_NAME (seekable));
|
|
|
|
|
examples/seeking/seek.c: Added playbin seeking example.
Original commit message from CVS:
* examples/seeking/seek.c: (make_dv_pipeline), (make_avi_pipeline),
(make_mpeg_pipeline), (make_mpegnt_pipeline),
(make_playerbin_pipeline), (query_durations_elems),
(query_durations_pads), (query_positions_elems),
(query_positions_pads), (update_scale), (iterate), (stop_seek),
(main):
Added playbin seeking example.
2004-07-08 15:43:24 +00:00
|
|
|
s_event =
|
|
|
|
gst_event_new_seek (GST_FORMAT_TIME | GST_SEEK_METHOD_SET |
|
|
|
|
GST_SEEK_FLAG_FLUSH, real);
|
2002-06-06 20:26:52 +00:00
|
|
|
|
examples/seeking/seek.c: Added playbin seeking example.
Original commit message from CVS:
* examples/seeking/seek.c: (make_dv_pipeline), (make_avi_pipeline),
(make_mpeg_pipeline), (make_mpegnt_pipeline),
(make_playerbin_pipeline), (query_durations_elems),
(query_durations_pads), (query_positions_elems),
(query_positions_pads), (update_scale), (iterate), (stop_seek),
(main):
Added playbin seeking example.
2004-07-08 15:43:24 +00:00
|
|
|
res = gst_element_send_event (seekable, s_event);
|
2002-06-06 20:26:52 +00:00
|
|
|
|
examples/seeking/seek.c: Added playbin seeking example.
Original commit message from CVS:
* examples/seeking/seek.c: (make_dv_pipeline), (make_avi_pipeline),
(make_mpeg_pipeline), (make_mpegnt_pipeline),
(make_playerbin_pipeline), (query_durations_elems),
(query_durations_pads), (query_positions_elems),
(query_positions_pads), (update_scale), (iterate), (stop_seek),
(main):
Added playbin seeking example.
2004-07-08 15:43:24 +00:00
|
|
|
walk = g_list_next (walk);
|
|
|
|
}
|
2002-06-06 20:26:52 +00:00
|
|
|
}
|
2002-05-28 20:30:11 +00:00
|
|
|
|
2005-06-02 13:33:40 +00:00
|
|
|
if (res)
|
Updated seek example.
Original commit message from CVS:
* docs/libs/tmpl/gstringbuffer.sgml:
* examples/seeking/seek.c: (make_vorbis_theora_pipeline),
(query_rates), (query_positions_elems), (query_positions_pads),
(update_scale), (do_seek):
Updated seek example.
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_submit_packet),
(gst_ogg_pad_submit_page), (gst_ogg_demux_activate_chain),
(gst_ogg_demux_find_chains), (gst_ogg_demux_send_event),
(gst_ogg_demux_loop):
Push out correct discont values.
* ext/theora/theoradec.c: (theora_dec_src_convert),
(theora_dec_sink_convert), (theora_dec_src_getcaps),
(theora_dec_sink_event), (theora_handle_type_packet),
(theora_handle_header_packet), (theora_dec_push),
(theora_handle_data_packet), (theora_dec_chain),
(theora_dec_change_state):
Better timestamping.
* ext/vorbis/vorbisdec.c: (gst_vorbis_dec_init),
(vorbis_dec_sink_event), (vorbis_dec_push),
(vorbis_handle_data_packet), (vorbis_dec_chain):
* ext/vorbis/vorbisdec.h:
Better timestamping.
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_base_audio_sink_get_time), (gst_base_audio_sink_get_times),
(gst_base_audio_sink_event), (gst_base_audio_sink_render):
Handle syncing on timestamps instead of sample offsets. Make
use of DISCONT values as described in design docs.
* gst-libs/gst/audio/gstbaseaudiosrc.c:
(gst_base_audio_src_get_time):
* gst-libs/gst/audio/gstringbuffer.c: (gst_ring_buffer_acquire),
(gst_ring_buffer_set_sample), (gst_ring_buffer_commit),
(gst_ring_buffer_read):
* gst-libs/gst/audio/gstringbuffer.h:
* sys/ximage/ximagesink.c: (gst_ximagesink_get_times),
(gst_ximagesink_show_frame):
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_get_times):
Correcly convert buffer timestamp to stream time.
2005-07-16 14:47:27 +00:00
|
|
|
gst_pipeline_set_new_stream_time (GST_PIPELINE (pipeline), 0);
|
2005-06-02 13:33:40 +00:00
|
|
|
else
|
|
|
|
g_print ("seek failed\n");
|
2005-03-31 09:43:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
seek_cb (GtkWidget * widget)
|
|
|
|
{
|
examples/seeking/seek.c: Updated seek example.
Original commit message from CVS:
* examples/seeking/seek.c: (make_vorbis_theora_pipeline),
(query_rates), (query_positions_elems), (query_positions_pads),
(do_seek), (seek_cb), (stop_seek):
Updated seek example.
* gst/playback/gstdecodebin.c: (remove_element_chain), (unlinked):
* gst/playback/gstplaybasebin.c: (queue_threshold_reached),
(queue_out_of_data), (gen_preroll_element), (new_decoded_pad):
* gst/playback/gstplaybin.c: (add_sink):
* gst/playback/gststreaminfo.c: (gst_stream_info_dispose),
(gst_stream_info_set_mute):
Some refcount leak fixes.
2005-07-18 10:53:03 +00:00
|
|
|
#ifndef SCRUB
|
|
|
|
GTimeVal timeval;
|
|
|
|
#else
|
2005-03-31 09:43:49 +00:00
|
|
|
/* If the timer hasn't expired yet, then the pipeline is running */
|
|
|
|
if (seek_timeout_id != 0) {
|
|
|
|
gst_element_set_state (pipeline, GST_STATE_PAUSED);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
do_seek (widget);
|
|
|
|
|
examples/seeking/seek.c: Updated seek example.
Original commit message from CVS:
* examples/seeking/seek.c: (make_vorbis_theora_pipeline),
(query_rates), (query_positions_elems), (query_positions_pads),
(do_seek), (seek_cb), (stop_seek):
Updated seek example.
* gst/playback/gstdecodebin.c: (remove_element_chain), (unlinked):
* gst/playback/gstplaybasebin.c: (queue_threshold_reached),
(queue_out_of_data), (gen_preroll_element), (new_decoded_pad):
* gst/playback/gstplaybin.c: (add_sink):
* gst/playback/gststreaminfo.c: (gst_stream_info_dispose),
(gst_stream_info_set_mute):
Some refcount leak fixes.
2005-07-18 10:53:03 +00:00
|
|
|
#ifndef SCRUB
|
|
|
|
/* wait for preroll */
|
|
|
|
GST_TIME_TO_TIMEVAL (50 * GST_MSECOND, timeval);
|
|
|
|
gst_element_get_state (pipeline, NULL, NULL, &timeval);
|
|
|
|
#endif
|
|
|
|
|
2005-03-31 09:43:49 +00:00
|
|
|
#ifdef SCRUB
|
2002-05-28 20:30:11 +00:00
|
|
|
gst_element_set_state (pipeline, GST_STATE_PLAYING);
|
2005-03-31 09:43:49 +00:00
|
|
|
|
|
|
|
if (seek_timeout_id == 0) {
|
|
|
|
seek_timeout_id =
|
|
|
|
gtk_timeout_add (SCRUB_TIME, (GSourceFunc) end_scrub, widget);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
start_seek (GtkWidget * widget, GdkEventButton * event, gpointer user_data)
|
|
|
|
{
|
|
|
|
gst_element_set_state (pipeline, GST_STATE_PAUSED);
|
|
|
|
gtk_timeout_remove (update_id);
|
|
|
|
|
|
|
|
if (changed_id == 0) {
|
|
|
|
changed_id = gtk_signal_connect (GTK_OBJECT (hscale),
|
|
|
|
"value_changed", G_CALLBACK (seek_cb), pipeline);
|
|
|
|
}
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
stop_seek (GtkWidget * widget, gpointer user_data)
|
|
|
|
{
|
|
|
|
g_signal_handler_disconnect (GTK_OBJECT (hscale), changed_id);
|
|
|
|
changed_id = 0;
|
|
|
|
if (seek_timeout_id != 0) {
|
|
|
|
gtk_timeout_remove (seek_timeout_id);
|
|
|
|
seek_timeout_id = 0;
|
|
|
|
/* Still scrubbing, so the pipeline is already playing */
|
examples/seeking/seek.c: Updated seek example.
Original commit message from CVS:
* examples/seeking/seek.c: (make_vorbis_theora_pipeline),
(query_rates), (query_positions_elems), (query_positions_pads),
(do_seek), (seek_cb), (stop_seek):
Updated seek example.
* gst/playback/gstdecodebin.c: (remove_element_chain), (unlinked):
* gst/playback/gstplaybasebin.c: (queue_threshold_reached),
(queue_out_of_data), (gen_preroll_element), (new_decoded_pad):
* gst/playback/gstplaybin.c: (add_sink):
* gst/playback/gststreaminfo.c: (gst_stream_info_dispose),
(gst_stream_info_set_mute):
Some refcount leak fixes.
2005-07-18 10:53:03 +00:00
|
|
|
} else {
|
2005-03-31 09:43:49 +00:00
|
|
|
gst_element_set_state (pipeline, GST_STATE_PLAYING);
|
examples/seeking/seek.c: Updated seek example.
Original commit message from CVS:
* examples/seeking/seek.c: (make_vorbis_theora_pipeline),
(query_rates), (query_positions_elems), (query_positions_pads),
(do_seek), (seek_cb), (stop_seek):
Updated seek example.
* gst/playback/gstdecodebin.c: (remove_element_chain), (unlinked):
* gst/playback/gstplaybasebin.c: (queue_threshold_reached),
(queue_out_of_data), (gen_preroll_element), (new_decoded_pad):
* gst/playback/gstplaybin.c: (add_sink):
* gst/playback/gststreaminfo.c: (gst_stream_info_dispose),
(gst_stream_info_set_mute):
Some refcount leak fixes.
2005-07-18 10:53:03 +00:00
|
|
|
}
|
2005-03-31 09:43:49 +00:00
|
|
|
|
2004-03-14 22:34:34 +00:00
|
|
|
update_id =
|
|
|
|
gtk_timeout_add (UPDATE_INTERVAL, (GtkFunction) update_scale, pipeline);
|
2002-05-28 20:30:11 +00:00
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
play_cb (GtkButton * button, gpointer data)
|
|
|
|
{
|
2005-03-31 09:43:49 +00:00
|
|
|
GstElementState state;
|
|
|
|
|
|
|
|
gst_element_get_state (pipeline, &state, NULL, NULL);
|
|
|
|
if (state != GST_STATE_PLAYING) {
|
2005-05-09 10:56:13 +00:00
|
|
|
g_print ("PLAY pipeline\n");
|
2002-06-06 20:26:52 +00:00
|
|
|
gst_element_set_state (pipeline, GST_STATE_PLAYING);
|
2004-03-14 22:34:34 +00:00
|
|
|
update_id =
|
2004-03-15 19:32:28 +00:00
|
|
|
gtk_timeout_add (UPDATE_INTERVAL, (GtkFunction) update_scale, pipeline);
|
2002-06-06 20:26:52 +00:00
|
|
|
}
|
2002-05-28 20:30:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
pause_cb (GtkButton * button, gpointer data)
|
|
|
|
{
|
2005-03-31 09:43:49 +00:00
|
|
|
GstElementState state;
|
|
|
|
|
|
|
|
gst_element_get_state (pipeline, &state, NULL, NULL);
|
|
|
|
if (state != GST_STATE_PAUSED) {
|
2005-05-09 10:56:13 +00:00
|
|
|
g_print ("PAUSE pipeline\n");
|
2002-06-06 20:26:52 +00:00
|
|
|
gst_element_set_state (pipeline, GST_STATE_PAUSED);
|
|
|
|
gtk_timeout_remove (update_id);
|
|
|
|
}
|
2002-05-28 20:30:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
stop_cb (GtkButton * button, gpointer data)
|
|
|
|
{
|
2005-03-31 09:43:49 +00:00
|
|
|
GstElementState state;
|
|
|
|
|
|
|
|
gst_element_get_state (pipeline, &state, NULL, NULL);
|
|
|
|
if (state != GST_STATE_READY) {
|
2005-05-09 10:56:13 +00:00
|
|
|
g_print ("READY pipeline\n");
|
2002-06-06 20:26:52 +00:00
|
|
|
gst_element_set_state (pipeline, GST_STATE_READY);
|
2004-07-12 09:15:37 +00:00
|
|
|
gtk_adjustment_set_value (adjustment, 0.0);
|
2002-06-06 20:26:52 +00:00
|
|
|
gtk_timeout_remove (update_id);
|
|
|
|
}
|
2002-05-28 20:30:11 +00:00
|
|
|
}
|
|
|
|
|
2003-02-02 19:25:58 +00:00
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
gchar *name;
|
2004-03-14 22:34:34 +00:00
|
|
|
GstElement *(*func) (const gchar * location);
|
2004-03-15 19:32:28 +00:00
|
|
|
}
|
|
|
|
Pipeline;
|
2003-02-02 19:25:58 +00:00
|
|
|
|
|
|
|
static Pipeline pipelines[] = {
|
2004-03-14 22:34:34 +00:00
|
|
|
{"mp3", make_mp3_pipeline},
|
|
|
|
{"avi", make_avi_pipeline},
|
|
|
|
{"mpeg1", make_mpeg_pipeline},
|
|
|
|
{"mpegparse", make_parse_pipeline},
|
|
|
|
{"vorbis", make_vorbis_pipeline},
|
2005-03-31 09:43:49 +00:00
|
|
|
{"theora", make_theora_pipeline},
|
|
|
|
{"ogg/v/t", make_vorbis_theora_pipeline},
|
|
|
|
{"avi/msmpeg4v3/mp3", make_avi_msmpeg4v3_mp3_pipeline},
|
2004-03-14 22:34:34 +00:00
|
|
|
{"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},
|
2003-02-02 19:25:58 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#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);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-05-28 20:30:11 +00:00
|
|
|
int
|
|
|
|
main (int argc, char **argv)
|
|
|
|
{
|
2004-07-16 11:05:53 +00:00
|
|
|
GtkWidget *window, *hbox, *vbox, *play_button, *pause_button, *stop_button;
|
2002-06-11 19:20:52 +00:00
|
|
|
struct poptOption options[] = {
|
2004-03-14 22:34:34 +00:00
|
|
|
{"stats", 's', POPT_ARG_NONE | POPT_ARGFLAG_STRIP, &stats, 0,
|
2004-03-15 19:32:28 +00:00
|
|
|
"Show pad stats", NULL},
|
examples/seeking/seek.c: Added playbin seeking example.
Original commit message from CVS:
* examples/seeking/seek.c: (make_dv_pipeline), (make_avi_pipeline),
(make_mpeg_pipeline), (make_mpegnt_pipeline),
(make_playerbin_pipeline), (query_durations_elems),
(query_durations_pads), (query_positions_elems),
(query_positions_pads), (update_scale), (iterate), (stop_seek),
(main):
Added playbin seeking example.
2004-07-08 15:43:24 +00:00
|
|
|
{"elem", 'e', POPT_ARG_NONE | POPT_ARGFLAG_STRIP, &elem_seek, 0,
|
|
|
|
"Seek on elements instead of pads", NULL},
|
|
|
|
{"verbose", 'v', POPT_ARG_NONE | POPT_ARGFLAG_STRIP, &verbose, 0,
|
|
|
|
"Verbose properties", NULL},
|
2002-06-11 19:20:52 +00:00
|
|
|
POPT_TABLEEND
|
|
|
|
};
|
2003-02-02 19:25:58 +00:00
|
|
|
gint type;
|
2004-03-14 22:34:34 +00:00
|
|
|
|
2002-06-11 19:20:52 +00:00
|
|
|
gst_init_with_popt_table (&argc, &argv, options);
|
2002-05-28 20:30:11 +00:00
|
|
|
gtk_init (&argc, &argv);
|
|
|
|
|
|
|
|
if (argc != 3) {
|
2003-02-02 19:25:58 +00:00
|
|
|
print_usage (argc, argv);
|
|
|
|
exit (-1);
|
|
|
|
}
|
|
|
|
|
|
|
|
type = atoi (argv[1]);
|
|
|
|
|
|
|
|
if (type < 0 || type >= NUM_TYPES) {
|
|
|
|
print_usage (argc, argv);
|
2002-05-28 20:30:11 +00:00
|
|
|
exit (-1);
|
|
|
|
}
|
|
|
|
|
2003-02-02 19:25:58 +00:00
|
|
|
pipeline = pipelines[type].func (argv[2]);
|
|
|
|
g_assert (pipeline);
|
2002-05-28 20:30:11 +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:34 +00:00
|
|
|
adjustment =
|
|
|
|
GTK_ADJUSTMENT (gtk_adjustment_new (0.0, 0.00, 100.0, 0.1, 1.0, 1.0));
|
2002-05-28 20:30:11 +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:34 +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-05-28 20:30:11 +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:34 +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-05-28 20:30:11 +00:00
|
|
|
g_signal_connect (G_OBJECT (window), "delete_event", gtk_main_quit, NULL);
|
|
|
|
|
|
|
|
/* show the gui. */
|
|
|
|
gtk_widget_show_all (window);
|
|
|
|
|
examples/seeking/seek.c: Added playbin seeking example.
Original commit message from CVS:
* examples/seeking/seek.c: (make_dv_pipeline), (make_avi_pipeline),
(make_mpeg_pipeline), (make_mpegnt_pipeline),
(make_playerbin_pipeline), (query_durations_elems),
(query_durations_pads), (query_positions_elems),
(query_positions_pads), (update_scale), (iterate), (stop_seek),
(main):
Added playbin seeking example.
2004-07-08 15:43:24 +00:00
|
|
|
if (verbose) {
|
|
|
|
g_signal_connect (pipeline, "deep_notify",
|
2005-03-31 09:43:49 +00:00
|
|
|
G_CALLBACK (gst_object_default_deep_notify), NULL);
|
examples/seeking/seek.c: Added playbin seeking example.
Original commit message from CVS:
* examples/seeking/seek.c: (make_dv_pipeline), (make_avi_pipeline),
(make_mpeg_pipeline), (make_mpegnt_pipeline),
(make_playerbin_pipeline), (query_durations_elems),
(query_durations_pads), (query_positions_elems),
(query_positions_pads), (update_scale), (iterate), (stop_seek),
(main):
Added playbin seeking example.
2004-07-08 15:43:24 +00:00
|
|
|
}
|
2002-05-28 20:30:11 +00:00
|
|
|
gtk_main ();
|
|
|
|
|
2005-05-09 10:56:13 +00:00
|
|
|
g_print ("NULL pipeline\n");
|
2002-12-26 22:53:36 +00:00
|
|
|
gst_element_set_state (pipeline, GST_STATE_NULL);
|
|
|
|
|
2005-05-09 10:56:13 +00:00
|
|
|
g_print ("free pipeline\n");
|
2005-06-28 10:16:13 +00:00
|
|
|
gst_object_unref (pipeline);
|
2002-05-28 20:30:11 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|