* Copyright (C) 1999,2000,2001,2002 Erik Walthinsen <omega@cse.ogi.edu>
* 2000,2001,2002 Wim Taymans <wtay@chello.be>
* 2002 Steve Baker <steve@stevebaker.org>
- * 2003 Julien Moutte <julien@moutte.net>
+ * 2003 Julien Moutte <julien@moutte.net>
*
* play.c: GstPlay object code
*
} info;
struct {
GstElement* element;
- gchar* error;
+ char* error;
} error;
} signal_data;
};
GstFormat format = GST_FORMAT_TIME;
gboolean query_worked = FALSE;
- g_print("trying to get length\n");
if ( (play->audio_sink_element != NULL) &&
(GST_IS_ELEMENT (play->audio_sink_element)) ) {
- g_mutex_lock(play->audio_bin_mutex);
query_worked = gst_element_query (play->audio_sink_element, GST_QUERY_TOTAL, &format, &value);
- g_mutex_unlock(play->audio_bin_mutex);
- g_message ("getting length from audio sink");
}
else if ( (play->video_sink_element != NULL) &&
(GST_IS_ELEMENT (play->video_sink_element)) ) {
- g_mutex_lock(play->video_bin_mutex);
query_worked = gst_element_query (play->video_sink_element, GST_QUERY_TOTAL, &format, &value);
- g_mutex_unlock(play->video_bin_mutex);
}
if (query_worked){
- g_print("got length %" G_GINT64_FORMAT "\n", value);
g_signal_emit (G_OBJECT (play), gst_play_signals [STREAM_LENGTH], 0, value);
play->length_nanos = value;
return FALSE;
gst_element_set_state(play->pipeline, GST_STATE_READY);
g_signal_emit (G_OBJECT (play), gst_play_signals[PIPELINE_ERROR], 0,
signal->signal_data.error.element, signal->signal_data.error.error);
+ if (signal->signal_data.error.error)
+ g_free (signal->signal_data.error.error);
gst_object_unref (GST_OBJECT(signal->signal_data.error.element));
break;
default:
play->idle_add_func ((GSourceFunc) gst_play_idle_signal, play);
}
-static void
-callback_bin_pre_iterate ( GstBin *bin,
- GMutex *mutex)
-{
- g_mutex_lock(mutex);
-}
-
-static void
-callback_bin_post_iterate ( GstBin *bin,
- GMutex *mutex)
-{
- g_mutex_unlock(mutex);
-}
-
static void
callback_pipeline_error ( GstElement *object,
GstElement *orig,
- gchar *error,
+ char *error,
GstPlay* play)
{
GstPlaySignal *signal;
signal = g_new0(GstPlaySignal, 1);
signal->signal_id = PIPELINE_ERROR;
signal->signal_data.error.element = orig;
- signal->signal_data.error.error = error;
+ signal->signal_data.error.error = g_strdup(error);
gst_object_ref (GST_OBJECT(orig));
/* Removing all sources */
while (g_source_remove_by_user_data (play));
-
+
G_OBJECT_CLASS (parent_class)->dispose (object);
- g_mutex_free(play->audio_bin_mutex);
- g_mutex_free(play->video_bin_mutex);
}
static void
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (GstPlayClass, pipeline_error),
NULL, NULL,
- gst_marshal_VOID__OBJECT_PARAM,
+ gst_marshal_VOID__OBJECT_STRING,
G_TYPE_NONE, 2,
G_TYPE_OBJECT, G_TYPE_STRING);
play->video_sink_element = NULL;
play->volume = NULL;
play->other_elements = g_hash_table_new(g_str_hash, g_str_equal);
- play->audio_bin_mutex = g_mutex_new();
- play->video_bin_mutex = g_mutex_new();
gst_play_set_idle_timeout_funcs( play,
gst_play_default_timeout_add,
* Copyright (C) 1999,2000,2001,2002 Erik Walthinsen <omega@cse.ogi.edu>
* 2000,2001,2002 Wim Taymans <wtay@chello.be>
* 2002 Steve Baker <steve@stevebaker.org>
- * 2003 Julien Moutte <julien@moutte.net>
+ * 2003 Julien Moutte <julien@moutte.net>
*
* play.h: GstPlay object code
*
GstClock *clock;
- GMutex *audio_bin_mutex;
- GMutex *video_bin_mutex;
-
gboolean need_stream_length;
gboolean need_seek;
gint time_seconds;
GObjectClass parent_class;
/* signals */
- void (*information) ( GstPlay* play,
+ void (*information) (GstPlay* play,
GstObject* element,
GParamSpec *param);
- void (*pipeline_error) ( GstPlay* play,
+ void (*pipeline_error) (GstPlay* play,
GstElement* element,
- gchar *error);
- void (*state_changed) ( GstPlay* play,
+ char *error);
+ void (*state_changed) (GstPlay* play,
GstElementState old_state,
GstElementState new_state);
- void (*stream_end) ( GstPlay* play);
- void (*time_tick) ( GstPlay* play,
+ void (*stream_end) (GstPlay* play);
+ void (*time_tick) (GstPlay* play,
gint64 time_nanos);
- void (*stream_length) ( GstPlay* play,
+ void (*stream_length) (GstPlay* play,
gint64 length_nanos);
- void (*have_xid) ( GstPlay* play,
+ void (*have_xid) (GstPlay* play,
gint xid);
- void (*have_vis_xid) ( GstPlay* play,
+ void (*have_vis_xid) (GstPlay* play,
gint xid);
- void (*have_video_size) ( GstPlay* play,
+ void (*have_video_size) (GstPlay* play,
gint width,
gint height);
};
* Copyright (C) 1999,2000,2001,2002 Erik Walthinsen <omega@cse.ogi.edu>
* 2000,2001,2002 Wim Taymans <wtay@chello.be>
* 2002 Steve Baker <steve@stevebaker.org>
- * 2003 Julien Moutte <julien@moutte.net>
+ * 2003 Julien Moutte <julien@moutte.net>
*
* playpipelines.c: Set up pipelines for playback
*
play->audio_sink, NULL);
gst_element_link (play->volume, play->audio_sink);
-
- gst_bin_set_pre_iterate_function(
- GST_BIN (play->pipeline),
- (GstBinPrePostIterateFunction) callback_bin_pre_iterate,
- play->audio_bin_mutex);
-
- gst_bin_set_post_iterate_function(
- GST_BIN (play->pipeline),
- (GstBinPrePostIterateFunction) callback_bin_post_iterate,
- play->audio_bin_mutex);
return TRUE;
}
gst_element_link (play->volume, play->audio_sink);
- gst_bin_set_pre_iterate_function(
- GST_BIN (play->pipeline),
- (GstBinPrePostIterateFunction) callback_bin_pre_iterate,
- play->audio_bin_mutex);
-
- gst_bin_set_post_iterate_function(
- GST_BIN (play->pipeline),
- (GstBinPrePostIterateFunction) callback_bin_post_iterate,
- play->audio_bin_mutex);
-
return TRUE;
}
gst_bin_add (GST_BIN (play->pipeline), audio_thread);
- gst_bin_set_pre_iterate_function(
- GST_BIN (audio_thread),
- (GstBinPrePostIterateFunction) callback_bin_pre_iterate,
- play->audio_bin_mutex);
-
- gst_bin_set_post_iterate_function(
- GST_BIN (audio_thread),
- (GstBinPrePostIterateFunction) callback_bin_post_iterate,
- play->audio_bin_mutex);
-
return TRUE;
}
}
g_hash_table_insert (play->other_elements, "audio_bin", audio_bin);
- /* setting up iterate functions */
- gst_bin_set_pre_iterate_function (
- GST_BIN (audio_bin),
- (GstBinPrePostIterateFunction) callback_bin_pre_iterate,
- play->audio_bin_mutex);
- gst_bin_set_post_iterate_function (
- GST_BIN (audio_bin),
- (GstBinPrePostIterateFunction) callback_bin_post_iterate,
- play->audio_bin_mutex);
-
/* adding all that stuff to bin */
gst_bin_add_many (
GST_BIN (audio_bin), audio_queue, play->volume,
gst_element_link_many (video_queue, colorspace,
play->video_sink, NULL);
- /* setting up iterate functions */
- gst_bin_set_pre_iterate_function (
- GST_BIN (video_bin),
- (GstBinPrePostIterateFunction) callback_bin_pre_iterate,
- play->video_bin_mutex);
- gst_bin_set_post_iterate_function (
- GST_BIN (video_bin),
- (GstBinPrePostIterateFunction) callback_bin_post_iterate,
- play->video_bin_mutex);
-
gst_element_add_ghost_pad (
video_bin, gst_element_get_pad (video_queue, "sink"),
"sink");
gst_element_add_ghost_pad ( play->audio_sink,
gst_element_get_pad (audio_queue, "sink"),
"sink");
-
- /* setting up iterate functions */
- gst_bin_set_pre_iterate_function (
- GST_BIN (play->audio_sink),
- (GstBinPrePostIterateFunction) callback_bin_pre_iterate,
- play->audio_bin_mutex);
- gst_bin_set_post_iterate_function (
- GST_BIN (play->audio_sink),
- (GstBinPrePostIterateFunction) callback_bin_post_iterate,
- play->audio_bin_mutex);
-
+
/* Creating video part of the visualisation bin
{ queue ! (visualisation) ! colorspace ! (videosink) }
*/
gst_element_link_many (video_queue, colorspace,
play->video_sink, NULL);
-
- /* setting up iterate functions */
- gst_bin_set_pre_iterate_function (
- GST_BIN (video_bin),
- (GstBinPrePostIterateFunction) callback_bin_pre_iterate,
- play->video_bin_mutex);
- gst_bin_set_post_iterate_function (
- GST_BIN (video_bin),
- (GstBinPrePostIterateFunction) callback_bin_post_iterate,
- play->video_bin_mutex);
-
+
gst_element_add_ghost_pad (
video_bin, gst_element_get_pad (video_queue, "sink"),
"sink");