status[0] = '|';
format = GST_FORMAT_PERCENT;
- res = gst_pad_query (pad, GST_PAD_QUERY_POSITION, &format, &value);
+ res = gst_pad_query (pad, GST_QUERY_POSITION, &format, &value);
if (res) {
percent = value / (2 * GST_FORMAT_PERCENT_SCALE);
}
/* create index that elements can fill */
index = gst_index_factory_make ("memindex");
- index = NULL;
if (verbose && index)
g_signal_connect (G_OBJECT (index), "entry_added", G_CALLBACK (entry_added), NULL);
definition = gst_format_get_details (*formats);
format = *formats;
- res = gst_pad_query (pad, GST_PAD_QUERY_POSITION,
+ res = gst_pad_query (pad, GST_QUERY_POSITION,
&format, &position);
if (format == GST_FORMAT_TIME) {
definition = gst_format_get_details (*formats);
format = *formats;
- res = gst_pad_query (pad, GST_PAD_QUERY_TOTAL,
+ res = gst_pad_query (pad, GST_QUERY_TOTAL,
&format, &total);
if (res) {
if (format == GST_FORMAT_TIME) {
static guint update_id;
-//#define SOURCE "gnomevfssrc"
-#define SOURCE "filesrc"
-
#define UPDATE_INTERVAL 500
static GstElement*
-make_cdaudio_pipeline (gboolean thread)
+make_cdaudio_pipeline (void)
{
- GstElement *pipeline;
GstElement *cdaudio;
- if (thread) {
- pipeline = gst_thread_new ("app");
- }
- else {
- pipeline = gst_pipeline_new ("app");
- }
-
cdaudio = gst_element_factory_make ("cdaudio", "cdaudio");
-
- gst_bin_add (GST_BIN (pipeline), cdaudio);
+ g_assert (cdaudio != NULL);
seekable_elements = g_list_prepend (seekable_elements, cdaudio);
- return pipeline;
+ return cdaudio;
}
static gchar*
GstFormat format;
format = seek_formats[i].format;
- res = gst_element_query (element, GST_PAD_QUERY_TOTAL, &format, &value);
+ res = gst_element_query (element, GST_QUERY_TOTAL, &format, &value);
if (res) {
g_print ("%s %13lld | ", seek_formats[i].name, value);
}
GstFormat format;
format = seek_formats[i].format;
- res = gst_element_query (element, GST_PAD_QUERY_POSITION, &format, &value);
+ res = gst_element_query (element, GST_QUERY_POSITION, &format, &value);
if (res) {
g_print ("%s %13lld | ", seek_formats[i].name, value);
}
update_scale (gpointer data)
{
GstClock *clock;
- guint64 position;
+ guint64 position = 0;
GstFormat format = GST_FORMAT_TIME;
duration = 0;
if (seekable_elements) {
GstElement *element = GST_ELEMENT (seekable_elements->data);
- gst_element_query (element, GST_PAD_QUERY_TOTAL, &format, &duration);
+ gst_element_query (element, GST_QUERY_TOTAL, &format, &duration);
}
- position = gst_clock_get_time (clock);
+ if (clock)
+ position = gst_clock_get_time (clock);
if (stats) {
- g_print ("clock: %13llu (%s)\n", position, gst_object_get_name (GST_OBJECT (clock)));
+ if (clock)
+ g_print ("clock: %13llu (%s)\n", position, gst_object_get_name (GST_OBJECT (clock)));
query_durations ();
query_positions ();
}
{
gboolean res = TRUE;
+ g_print ("iterate\n");
res = gst_bin_iterate (GST_BIN (data));
if (!res) {
gtk_timeout_remove (update_id);
GtkWidget *window, *hbox, *vbox,
*play_button, *pause_button, *stop_button,
*hscale;
- gboolean threaded = FALSE;
struct poptOption options[] = {
- {"threaded", 't', POPT_ARG_NONE|POPT_ARGFLAG_STRIP, &threaded, 0,
- "Run the pipeline in a toplevel thread", NULL},
{"stats", 's', POPT_ARG_NONE|POPT_ARGFLAG_STRIP, &stats, 0,
"Show element stats", NULL},
POPT_TABLEEND
gst_init_with_popt_table (&argc, &argv, options);
gtk_init (&argc, &argv);
- pipeline = make_cdaudio_pipeline (threaded);
+ pipeline = make_cdaudio_pipeline ();
+
+ g_signal_connect (pipeline, "deep_notify", G_CALLBACK (gst_element_default_deep_notify), NULL);
+ g_signal_connect (pipeline, "error", G_CALLBACK (gst_element_default_error), NULL);
/* initialize gui elements ... */
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_main ();
+ gst_element_set_state (pipeline, GST_STATE_NULL);
+
gst_buffer_print_stats();
gst_event_print_stats();
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);
+ g_object_set (G_OBJECT (demux), "sync", TRUE, NULL);
seekable_elements = g_list_prepend (seekable_elements, demux);
GstFormat format;
format = seek_formats[i].format;
- res = gst_pad_query (pad, GST_PAD_QUERY_TOTAL, &format, &value);
+ res = gst_pad_query (pad, GST_QUERY_TOTAL, &format, &value);
if (res) {
g_print ("%s %13lld | ", seek_formats[i].name, value);
}
GstFormat format;
format = seek_formats[i].format;
- res = gst_pad_query (pad, GST_PAD_QUERY_POSITION, &format, &value);
+ res = gst_pad_query (pad, GST_QUERY_POSITION, &format, &value);
if (res) {
g_print ("%s %13lld | ", seek_formats[i].name, value);
}
if (seekable_pads) {
GstPad *pad = GST_PAD (seekable_pads->data);
- gst_pad_query (pad, GST_PAD_QUERY_TOTAL, &format, &duration);
+ gst_pad_query (pad, GST_QUERY_TOTAL, &format, &duration);
}
position = gst_clock_get_time (clock);
GstFormat format;
format = seek_formats[i].format;
- res = gst_element_query (element, GST_PAD_QUERY_TOTAL, &format, &value);
+ res = gst_element_query (element, GST_QUERY_TOTAL, &format, &value);
if (res) {
g_print ("%s %13lld | ", seek_formats[i].name, value);
}
GstFormat format;
format = seek_formats[i].format;
- res = gst_element_query (element, GST_PAD_QUERY_POSITION, &format, &value);
+ res = gst_element_query (element, GST_QUERY_POSITION, &format, &value);
if (res) {
g_print ("%s %13lld | ", seek_formats[i].name, value);
}
if (seekable_elements) {
GstElement *element = GST_ELEMENT (seekable_elements->data);
- gst_element_query (element, GST_PAD_QUERY_TOTAL, &format, &duration);
+ gst_element_query (element, GST_QUERY_TOTAL, &format, &duration);
}
position = gst_clock_get_time (clock);
format = *formats;
formats++;
- res = gst_pad_query (context->pad, GST_PAD_QUERY_TOTAL,
+ res = gst_pad_query (context->pad, GST_QUERY_TOTAL,
&format, &value);
definition = gst_format_get_details (format);
format = GST_FORMAT_TIME;
/* get the position */
- gst_pad_query (enc_src, GST_PAD_QUERY_POSITION,
+ gst_pad_query (enc_src, GST_QUERY_POSITION,
&format, &position);
/* get the total duration */
- gst_pad_query (enc_src, GST_PAD_QUERY_TOTAL,
+ gst_pad_query (enc_src, GST_QUERY_TOTAL,
&format, &duration);
format = GST_FORMAT_BYTES;
static void gst_dvdec_class_init (GstDVDecClass *klass);
static void gst_dvdec_init (GstDVDec *dvdec);
-static const GstPadQueryType*
+static const GstQueryType*
gst_dvdec_get_src_query_types (GstPad *pad);
-static gboolean gst_dvdec_src_query (GstPad *pad, GstPadQueryType type,
+static gboolean gst_dvdec_src_query (GstPad *pad, GstQueryType type,
GstFormat *format, gint64 *value);
static const GstFormat* gst_dvdec_get_formats (GstPad *pad);
static gboolean gst_dvdec_sink_convert (GstPad *pad, GstFormat src_format, gint64 src_value,
return res;
}
-static const GstPadQueryType*
+static const GstQueryType*
gst_dvdec_get_src_query_types (GstPad *pad)
{
- static const GstPadQueryType src_query_types[] = {
- GST_PAD_QUERY_TOTAL,
- GST_PAD_QUERY_POSITION,
+ static const GstQueryType src_query_types[] = {
+ GST_QUERY_TOTAL,
+ GST_QUERY_POSITION,
0
};
return src_query_types;
}
static gboolean
-gst_dvdec_src_query (GstPad *pad, GstPadQueryType type,
+gst_dvdec_src_query (GstPad *pad, GstQueryType type,
GstFormat *format, gint64 *value)
{
gboolean res = TRUE;
dvdec = GST_DVDEC (gst_pad_get_parent (pad));
switch (type) {
- case GST_PAD_QUERY_TOTAL:
+ case GST_QUERY_TOTAL:
switch (*format) {
case GST_FORMAT_DEFAULT:
*format = GST_FORMAT_TIME;
}
}
break;
- case GST_PAD_QUERY_POSITION:
+ case GST_QUERY_POSITION:
switch (*format) {
case GST_FORMAT_DEFAULT:
*format = GST_FORMAT_TIME;
}
format = GST_FORMAT_TIME;
- gst_pad_query (dvdec->videosrcpad, GST_PAD_QUERY_POSITION, &format, &ts);
+ gst_pad_query (dvdec->videosrcpad, GST_QUERY_POSITION, &format, &ts);
/* FIXME this is inaccurate for NTSC */
dvdec->next_ts += GST_SECOND / dvdec->framerate;
static const GstFormat* gst_flacdec_get_src_formats (GstPad *pad);
static gboolean gst_flacdec_convert_src (GstPad *pad, GstFormat src_format, gint64 src_value,
GstFormat *dest_format, gint64 *dest_value);
-static const GstPadQueryType*
+static const GstQueryType*
gst_flacdec_get_src_query_types (GstPad *pad);
-static gboolean gst_flacdec_src_query (GstPad *pad, GstPadQueryType type,
+static gboolean gst_flacdec_src_query (GstPad *pad, GstQueryType type,
GstFormat *format, gint64 *value);
static const GstEventMask*
gst_flacdec_get_src_event_masks (GstPad *pad);
GST_DEBUG (GST_CAT_PLUGIN_INFO, "flacdec: _loop end");
}
-GST_FORMATS_FUNCTION (gst_flacdec_get_src_formats,
+GST_PAD_FORMATS_FUNCTION (gst_flacdec_get_src_formats,
GST_FORMAT_UNITS,
GST_FORMAT_BYTES,
GST_FORMAT_TIME
}
GST_PAD_QUERY_TYPE_FUNCTION (gst_flacdec_get_src_query_types,
- GST_PAD_QUERY_TOTAL,
- GST_PAD_QUERY_POSITION
+ GST_QUERY_TOTAL,
+ GST_QUERY_POSITION
)
static gboolean
-gst_flacdec_src_query (GstPad *pad, GstPadQueryType type,
+gst_flacdec_src_query (GstPad *pad, GstQueryType type,
GstFormat *format, gint64 *value)
{
gboolean res = TRUE;
FlacDec *flacdec = GST_FLACDEC (gst_pad_get_parent (pad));
switch (type) {
- case GST_PAD_QUERY_TOTAL:
+ case GST_QUERY_TOTAL:
{
guint64 samples;
format, value);
break;
}
- case GST_PAD_QUERY_POSITION:
+ case GST_QUERY_POSITION:
gst_pad_convert (flacdec->srcpad,
GST_FORMAT_UNITS,
flacdec->total_samples,
return res;
}
-GST_EVENT_MASK_FUNCTION (gst_flacdec_get_src_event_masks,
+GST_PAD_EVENT_MASK_FUNCTION (gst_flacdec_get_src_event_masks,
{ GST_EVENT_SEEK, GST_SEEK_FLAG_ACCURATE }
);
gst_avi_demux_get_event_mask (GstPad *pad);
static gboolean gst_avi_demux_handle_src_event (GstPad *pad, GstEvent *event);
static const GstFormat* gst_avi_demux_get_src_formats (GstPad *pad);
-static const GstPadQueryType*
+static const GstQueryType*
gst_avi_demux_get_src_query_types (GstPad *pad);
-static gboolean gst_avi_demux_handle_src_query (GstPad *pad, GstPadQueryType type,
+static gboolean gst_avi_demux_handle_src_query (GstPad *pad, GstQueryType type,
GstFormat *format, gint64 *value);
static gboolean gst_avi_demux_src_convert (GstPad *pad, GstFormat src_format, gint64 src_value,
GstFormat *dest_format, gint64 *dest_value);
return res;
}
-static const GstPadQueryType*
+static const GstQueryType*
gst_avi_demux_get_src_query_types (GstPad *pad)
{
- static const GstPadQueryType src_types[] = {
- GST_PAD_QUERY_TOTAL,
- GST_PAD_QUERY_POSITION,
+ static const GstQueryType src_types[] = {
+ GST_QUERY_TOTAL,
+ GST_QUERY_POSITION,
0
};
}
static gboolean
-gst_avi_demux_handle_src_query (GstPad *pad, GstPadQueryType type,
+gst_avi_demux_handle_src_query (GstPad *pad, GstQueryType type,
GstFormat *format, gint64 *value)
{
gboolean res = TRUE;
avi_stream_context *stream = gst_pad_get_element_private (pad);
switch (type) {
- case GST_PAD_QUERY_TOTAL:
+ case GST_QUERY_TOTAL:
switch (*format) {
case GST_FORMAT_DEFAULT:
*format = GST_FORMAT_TIME;
break;
}
break;
- case GST_PAD_QUERY_POSITION:
+ case GST_QUERY_POSITION:
switch (*format) {
case GST_FORMAT_DEFAULT:
*format = GST_FORMAT_TIME;
chunkid, *chunksize, stream_id);
format = GST_FORMAT_TIME;
- gst_pad_query (stream->pad, GST_PAD_QUERY_POSITION, &format, &next_ts);
+ gst_pad_query (stream->pad, GST_QUERY_POSITION, &format, &next_ts);
if (stream->strh.init_frames == stream->current_frame && stream->delay==0)
stream->delay = next_ts;
static GstCaps* wav_type_find (GstBuffer *buf, gpointer private);
static const GstFormat* gst_wavparse_get_formats (GstPad *pad);
-static const GstPadQueryType *
+static const GstQueryType *
gst_wavparse_get_query_types (GstPad *pad);
static gboolean gst_wavparse_pad_query (GstPad *pad,
- GstPadQueryType type,
+ GstQueryType type,
GstFormat *format,
gint64 *value);
static gboolean gst_wavparse_pad_convert (GstPad *pad,
return TRUE;
}
-static const GstPadQueryType *
+static const GstQueryType *
gst_wavparse_get_query_types (GstPad *pad)
{
- static const GstPadQueryType types[] = {
- GST_PAD_QUERY_TOTAL,
- GST_PAD_QUERY_POSITION
+ static const GstQueryType types[] = {
+ GST_QUERY_TOTAL,
+ GST_QUERY_POSITION
};
return types;
}
/* handle queries for location and length in requested format */
static gboolean
-gst_wavparse_pad_query (GstPad *pad, GstPadQueryType type,
+gst_wavparse_pad_query (GstPad *pad, GstQueryType type,
GstFormat *format, gint64 *value)
{
GstFormat peer_format = GST_FORMAT_BYTES;
static const GstFormat* gst_osssink_get_formats (GstPad *pad);
static gboolean gst_osssink_convert (GstPad *pad, GstFormat src_format, gint64 src_value,
GstFormat *dest_format, gint64 *dest_value);
-static const GstPadQueryType* gst_osssink_get_query_types (GstPad *pad);
-static gboolean gst_osssink_query (GstElement *element, GstPadQueryType type,
+static const GstQueryType* gst_osssink_get_query_types (GstPad *pad);
+static gboolean gst_osssink_query (GstElement *element, GstQueryType type,
GstFormat *format, gint64 *value);
-static gboolean gst_osssink_sink_query (GstPad *pad, GstPadQueryType type,
+static gboolean gst_osssink_sink_query (GstPad *pad, GstQueryType type,
GstFormat *format, gint64 *value);
static GstPadConnectReturn gst_osssink_sinkconnect (GstPad *pad, GstCaps *caps);
dest_format, dest_value);
}
-static const GstPadQueryType*
+static const GstQueryType*
gst_osssink_get_query_types (GstPad *pad)
{
- static const GstPadQueryType query_types[] = {
- GST_PAD_QUERY_LATENCY,
- GST_PAD_QUERY_POSITION,
+ static const GstQueryType query_types[] = {
+ GST_QUERY_LATENCY,
+ GST_QUERY_POSITION,
0,
};
return query_types;
}
static gboolean
-gst_osssink_sink_query (GstPad *pad, GstPadQueryType type, GstFormat *format, gint64 *value)
+gst_osssink_sink_query (GstPad *pad, GstQueryType type, GstFormat *format, gint64 *value)
{
gboolean res = TRUE;
GstOssSink *osssink;
osssink = GST_OSSSINK (gst_pad_get_parent (pad));
switch (type) {
- case GST_PAD_QUERY_LATENCY:
+ case GST_QUERY_LATENCY:
if (!gst_osssink_convert (pad,
GST_FORMAT_BYTES, gst_osssink_get_delay (osssink),
format, value))
res = FALSE;
}
break;
- case GST_PAD_QUERY_POSITION:
+ case GST_QUERY_POSITION:
if (!gst_osssink_convert (pad,
GST_FORMAT_TIME, gst_clock_get_time (osssink->provided_clock),
format, value))
}
static gboolean
-gst_osssink_query (GstElement *element, GstPadQueryType type, GstFormat *format, gint64 *value)
+gst_osssink_query (GstElement *element, GstQueryType type, GstFormat *format, gint64 *value)
{
GstOssSink *osssink = GST_OSSSINK (element);
static const GstEventMask* gst_osssrc_get_event_masks (GstPad *pad);
static gboolean gst_osssrc_src_event (GstPad *pad, GstEvent *event);
static gboolean gst_osssrc_send_event (GstElement *element, GstEvent *event);
-static const GstPadQueryType* gst_osssrc_get_query_types (GstPad *pad);
-static gboolean gst_osssrc_src_query (GstPad *pad, GstPadQueryType type,
+static const GstQueryType* gst_osssrc_get_query_types (GstPad *pad);
+static gboolean gst_osssrc_src_query (GstPad *pad, GstQueryType type,
GstFormat *format, gint64 *value);
static GstBuffer * gst_osssrc_get (GstPad *pad);
return gst_osssrc_src_event (osssrc->srcpad, event);
}
-static const GstPadQueryType*
+static const GstQueryType*
gst_osssrc_get_query_types (GstPad *pad)
{
- static const GstPadQueryType query_types[] = {
- GST_PAD_QUERY_POSITION,
+ static const GstQueryType query_types[] = {
+ GST_QUERY_POSITION,
0,
};
return query_types;
}
static gboolean
-gst_osssrc_src_query (GstPad *pad, GstPadQueryType type, GstFormat *format, gint64 *value)
+gst_osssrc_src_query (GstPad *pad, GstQueryType type, GstFormat *format, gint64 *value)
{
gboolean res = FALSE;
GstOssSrc *osssrc;
osssrc = GST_OSSSRC (gst_pad_get_parent (pad));
switch (type) {
- case GST_PAD_QUERY_POSITION:
+ case GST_QUERY_POSITION:
res = gst_osscommon_convert (&osssrc->common,
GST_FORMAT_BYTES, osssrc->curoffset,
format, value);