+2005-06-28 Andy Wingo <wingo@pobox.com>
+
+ * *.c: Don't cast to GstObject before reffing/unreffing.
+
2005-06-27 Andy Wingo <wingo@pobox.com>
* gst/videotestsrc/gstvideotestsrc.c
return;
}
if (fd->input)
- gst_object_unref (GST_OBJECT (fd->input));
+ gst_object_unref (fd->input);
fd->input = GST_ELEMENT (gst_parse_launch (fd->input_pipe, &error));
if (error) {
ui_feedback_add (fd->ui, "Error : parsing input pipeline : %s\n",
return;
}
if (fd->output)
- gst_object_unref (GST_OBJECT (fd->output));
+ gst_object_unref (fd->output);
fd->output = GST_ELEMENT (gst_parse_launch (fd->output_pipe, &error));
if (error) {
ui_feedback_add (fd->ui, "Error : parsing output pipeline : %s\n",
/* try to create filter */
if (fd->filter)
- gst_object_unref (GST_OBJECT (fd->filter));
+ gst_object_unref (fd->filter);
fd->filter = gst_element_factory_make (fd->filter_element, "filter");
if (fd->filter == NULL) {
ui_feedback_add (fd->ui, "Error : could not create element %s\n",
gst_element_set_state (pipeline, GST_STATE_NULL);
g_print ("free pipeline\n");
- gst_object_unref (GST_OBJECT (pipeline));
+ gst_object_unref (pipeline);
return 0;
}
gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_READY);
/* unref */
- gst_object_unref (GST_OBJECT (pipeline));
+ gst_object_unref (pipeline);
exit (0);
}
this->clock =
gst_alsa_clock_new ("alsasrcclock", gst_alsa_src_get_time, this);
/* we hold a ref to our clock until we're disposed */
- gst_object_ref (GST_OBJECT (this->clock));
+ gst_object_ref (this->clock);
gst_object_sink (GST_OBJECT (this->clock));
src->status = NULL;
GstCaps *any;
/* this is ours */
- gst_object_ref (GST_OBJECT (element));
+ gst_object_ref (element);
gst_object_sink (GST_OBJECT (element));
/* FIXME, it might not be named "sink" */
p = gst_element_get_pad (element, "src");
gst_pad_link (p, pad->elem_out);
- gst_object_unref (GST_OBJECT (p));
+ gst_object_unref (p);
}
}
}
for (i = 0; i < chain->streams->len; i++) {
GstOggPad *pad = g_array_index (chain->streams, GstOggPad *, i);
- gst_object_unref (GST_OBJECT (pad));
+ gst_object_unref (pad);
}
g_array_free (chain->streams, TRUE);
chain->streams = NULL;
ret = g_object_new (GST_TYPE_OGG_PAD, NULL);
/* we own this one */
- gst_object_ref (GST_OBJECT (ret));
+ gst_object_ref (ret);
gst_object_sink (GST_OBJECT (ret));
list = gst_tag_list_new ();
if (ogg_stream_init (&ret->stream, serialno) != 0) {
GST_ERROR ("Could not initialize ogg_stream struct for serial %08lx.",
serialno);
- gst_object_unref (GST_OBJECT (ret));
+ gst_object_unref (ret);
return NULL;
}
gst_tag_list_add (list, GST_TAG_MERGE_REPLACE, GST_TAG_SERIAL, serialno,
/* find length to read last page, we store this for later use. */
format = GST_FORMAT_BYTES;
res = gst_pad_query_position (peer, &format, NULL, &ogg->length);
- gst_object_unref (GST_OBJECT (peer));
+ gst_object_unref (peer);
if (!res)
goto no_length;
//gst_pad_use_explicit_caps (ogm->srcpad);
//if (!gst_pad_set_explicit_caps (ogm->srcpad, caps)) {
// GST_ELEMENT_ERROR (ogm, CORE, NEGOTIATION, (NULL), (NULL));
- //gst_object_unref (GST_OBJECT (ogm->srcpad));
+ //gst_object_unref (ogm->srcpad);
// ogm->srcpad = NULL;
// break;
//}
sink = GST_BASEAUDIOSINK (elem);
- return GST_CLOCK (gst_object_ref (GST_OBJECT (sink->clock)));
+ return GST_CLOCK (gst_object_ref (sink->clock));
}
static GstClockTime
case GST_STATE_PAUSED_TO_READY:
gst_ringbuffer_stop (sink->ringbuffer);
gst_ringbuffer_release (sink->ringbuffer);
- gst_object_unref (GST_OBJECT (sink->ringbuffer));
+ gst_object_unref (sink->ringbuffer);
sink->ringbuffer = NULL;
break;
case GST_STATE_READY_TO_NULL:
could_not_add:
{
gst_collectpads_remove_pad (adder->collect, newpad);
- gst_object_unref (GST_OBJECT (newpad));
+ gst_object_unref (newpad);
return NULL;
}
}
}
}
}
- gst_object_unref (GST_OBJECT (bin));
+ gst_object_unref (bin);
}
return 0;
gst_caps_unref (targetcaps);
}
}
- gst_object_unref (GST_OBJECT (otherpeer));
+ gst_object_unref (otherpeer);
}
space->width = width;
}
configure_error_target:
{
- gst_object_unref (GST_OBJECT (otherpeer));
+ gst_object_unref (otherpeer);
GST_DEBUG ("could not configure context for target");
return FALSE;
}
/* add the typefind element */
if (!gst_bin_add (GST_BIN (decode_bin), decode_bin->typefind)) {
g_warning ("Could not add typefind element, decodebin will not work");
- gst_object_unref (GST_OBJECT (decode_bin->typefind));
+ gst_object_unref (decode_bin->typefind);
decode_bin->typefind = NULL;
}
gst_element_add_pad (GST_ELEMENT (decode_bin),
gst_ghost_pad_new ("sink", pad));
- gst_object_unref (GST_OBJECT_CAST (pad));
+ gst_object_unref (pad);
/* connect a signal to find out when the typefind element found
* a type */
GstDynamic *dyn;
/* take refs */
- gst_object_ref (GST_OBJECT (element));
- gst_object_ref (GST_OBJECT (decode_bin));
+ gst_object_ref (element);
+ gst_object_ref (decode_bin);
dyn = g_new0 (GstDynamic, 1);
dyn->element = element;
g_signal_handler_disconnect (G_OBJECT (dyn->element), dyn->np_sig_id);
g_signal_handler_disconnect (G_OBJECT (dyn->element), dyn->nmp_sig_id);
- gst_object_unref (GST_OBJECT (dyn->element));
- gst_object_unref (GST_OBJECT (dyn->decode_bin));
+ gst_object_unref (dyn->element);
+ gst_object_unref (dyn->decode_bin);
dyn->element = NULL;
dyn->decode_bin = NULL;
g_free (dyn);
GST_DEBUG_OBJECT (decode_bin, "link failed on pad %s:%s, reason %d",
GST_DEBUG_PAD_NAME (pad), ret);
/* get rid of the sinkpad */
- gst_object_unref (GST_OBJECT_CAST (sinkpad));
+ gst_object_unref (sinkpad);
/* this element did not work, remove it again and continue trying
* other elements, the element will be disposed. */
gst_bin_remove (GST_BIN (decode_bin), element);
result = element;
/* get rid of the sinkpad now */
- gst_object_unref (GST_OBJECT_CAST (sinkpad));
+ gst_object_unref (sinkpad);
/* and exit */
goto done;
if (parent == GST_ELEMENT (decode_bin)) {
GST_DEBUG_OBJECT (decode_bin, "pad is our ghostpad");
- gst_object_unref (GST_OBJECT_CAST (parent));
+ gst_object_unref (parent);
return pad;
} else {
GST_DEBUG_OBJECT (decode_bin, "pad is ghostpad but not ours");
- gst_object_unref (GST_OBJECT_CAST (parent));
+ gst_object_unref (parent);
return NULL;
}
}
GST_ELEMENT_NAME (elem), GST_DEBUG_PAD_NAME (pad));
remove_element_chain (decode_bin, peer);
}
- gst_object_unref (GST_OBJECT_CAST (parent));
+ gst_object_unref (parent);
}
}
- gst_object_unref (GST_OBJECT_CAST (peer));
+ gst_object_unref (peer);
}
GST_DEBUG_OBJECT (decode_bin, "removing %s", GST_ELEMENT_NAME (elem));
decode_bin->dynamics = g_list_prepend (decode_bin->dynamics, dyn);
exit:
- gst_object_unref (GST_OBJECT (element));
- gst_object_unref (GST_OBJECT (peer));
+ gst_object_unref (element);
+ gst_object_unref (peer);
}
/* this function inspects the given element and tries to connect something
if (caps)
gst_caps_unref (caps);
- gst_object_unref (GST_OBJECT_CAST (pad));
+ gst_object_unref (pad);
}
g_list_free (to_connect);
}
/* autoplug the new pad with the caps that the signal gave us. */
pad = gst_element_get_pad (typefind, "src");
close_pad_link (typefind, pad, caps, decode_bin, FALSE);
- gst_object_unref (GST_OBJECT_CAST (pad));
+ gst_object_unref (pad);
dynamic = gst_decode_bin_is_dynamic (decode_bin);
if (dynamic == FALSE) {
gst_bin_remove (group->type[n].bin, group->type[n].selector);
} else {
/* else we can just unref it */
- gst_object_unref (GST_OBJECT (element));
- gst_object_unref (GST_OBJECT (group->type[n].selector));
+ gst_object_unref (element);
+ gst_object_unref (group->type[n].selector);
}
group->type[n].preroll = NULL;
probe = gst_probe_new (FALSE, probe_triggered, info);
/* have to REALIZE the pad as we cannot attach a padprobe to a ghostpad */
gst_pad_add_probe (preroll_pad, probe);
- gst_object_unref (GST_OBJECT_CAST (preroll_pad));
+ gst_object_unref (preroll_pad);
/* add to group list */
/* FIXME refcount elements */
srcpad = gst_element_get_pad (fakesrc, "src");
gst_bin_add (GST_BIN (play_base_bin), fakesrc);
gst_pad_link (srcpad, pad);
- gst_object_unref (GST_OBJECT_CAST (srcpad));
+ gst_object_unref (srcpad);
/* keep track of these patch elements */
g_object_set_data (G_OBJECT (pad), "fakesrc", fakesrc);
}
GST_DEBUG ("No subtitle found - ignoring");
- gst_object_unref (GST_OBJECT (play_base_bin->subtitle));
+ gst_object_unref (play_base_bin->subtitle);
play_base_bin->subtitle = NULL;
} else {
GST_DEBUG ("Subtitle set-up successful");
pad = gst_element_get_pad (group->type[type - 1].preroll, "src");
gst_pad_set_active (pad, active);
- gst_object_unref (GST_OBJECT_CAST (pad));
+ gst_object_unref (pad);
pad = gst_element_get_pad (group->type[type - 1].preroll, "sink");
gst_pad_set_active (pad, active);
- gst_object_unref (GST_OBJECT_CAST (pad));
+ gst_object_unref (pad);
pad = gst_element_get_pad (group->type[type - 1].selector, "src");
gst_pad_set_active (pad, active);
- gst_object_unref (GST_OBJECT_CAST (pad));
+ gst_object_unref (pad);
if (mute) {
g_signal_connect (group->type[type - 1].preroll, "state-change",
}
if (play_bin->audio_sink != NULL) {
- gst_object_unref (GST_OBJECT (play_bin->audio_sink));
+ gst_object_unref (play_bin->audio_sink);
play_bin->audio_sink = NULL;
}
if (play_bin->video_sink != NULL) {
- gst_object_unref (GST_OBJECT (play_bin->video_sink));
+ gst_object_unref (play_bin->video_sink);
play_bin->video_sink = NULL;
}
if (play_bin->visualisation != NULL) {
- gst_object_unref (GST_OBJECT (play_bin->visualisation));
+ gst_object_unref (play_bin->visualisation);
play_bin->visualisation = NULL;
}
g_free (play_bin->font_desc);
switch (prop_id) {
case ARG_VIDEO_SINK:
if (play_bin->video_sink != NULL) {
- gst_object_unref (GST_OBJECT (play_bin->video_sink));
+ gst_object_unref (play_bin->video_sink);
}
play_bin->video_sink = g_value_get_object (value);
if (play_bin->video_sink != NULL) {
- gst_object_ref (GST_OBJECT (play_bin->video_sink));
+ gst_object_ref (play_bin->video_sink);
gst_object_sink (GST_OBJECT (play_bin->video_sink));
}
/* when changing the videosink, we just remove the
break;
case ARG_AUDIO_SINK:
if (play_bin->audio_sink != NULL) {
- gst_object_unref (GST_OBJECT (play_bin->audio_sink));
+ gst_object_unref (play_bin->audio_sink);
}
play_bin->audio_sink = g_value_get_object (value);
if (play_bin->audio_sink != NULL) {
- gst_object_ref (GST_OBJECT (play_bin->audio_sink));
+ gst_object_ref (play_bin->audio_sink);
gst_object_sink (GST_OBJECT (play_bin->audio_sink));
}
g_hash_table_remove (play_bin->cache, "abin");
break;
case ARG_VIS_PLUGIN:
if (play_bin->visualisation != NULL) {
- gst_object_unref (GST_OBJECT (play_bin->visualisation));
+ gst_object_unref (play_bin->visualisation);
}
play_bin->visualisation = g_value_get_object (value);
if (play_bin->visualisation != NULL) {
- gst_object_ref (GST_OBJECT (play_bin->visualisation));
+ gst_object_ref (play_bin->visualisation);
gst_object_sink (GST_OBJECT (play_bin->visualisation));
}
break;
} else {
sink = gst_element_factory_make ("xvimagesink", "videosink");
}
- gst_object_ref (GST_OBJECT (sink));
+ gst_object_ref (sink);
g_hash_table_insert (play_bin->cache, "video_sink", sink);
gst_bin_add (GST_BIN (element), identity);
pad = gst_element_get_pad (identity, "sink");
gst_element_add_pad (element, gst_ghost_pad_new ("sink", pad));
- gst_object_unref (GST_OBJECT (pad));
+ gst_object_unref (pad);
gst_element_set_state (element, GST_STATE_READY);
/* since we're gonna add it to a bin but don't want to lose it,
* we keep a reference. */
- gst_object_ref (GST_OBJECT (element));
+ gst_object_ref (element);
g_hash_table_insert (play_bin->cache, "vbin", element);
return element;
#define gst_element_add_ghost_pad(element, pad, name) \
gst_element_add_pad (element, gst_ghost_pad_new (name, pad))
gst_element_add_ghost_pad (element, pad, "text_sink");
- gst_object_unref (GST_OBJECT (pad));
+ gst_object_unref (pad);
pad = gst_element_get_pad (csp, "sink");
gst_element_add_ghost_pad (element, pad, "sink");
- gst_object_unref (GST_OBJECT (pad));
+ gst_object_unref (pad);
return element;
}
sink = play_bin->audio_sink;
} else {
sink = gst_element_factory_make ("alsasink", "audiosink");
- play_bin->audio_sink = GST_ELEMENT (gst_object_ref (GST_OBJECT (sink)));
+ play_bin->audio_sink = GST_ELEMENT (gst_object_ref (sink));
}
- gst_object_ref (GST_OBJECT (sink));
+ gst_object_ref (sink);
g_hash_table_insert (play_bin->cache, "audio_sink", sink);
gst_bin_add (GST_BIN (element), conv);
pad = gst_element_get_pad (conv, "sink");
gst_element_add_ghost_pad (element, pad, "sink");
- gst_object_unref (GST_OBJECT (pad));
+ gst_object_unref (pad);
gst_element_set_state (element, GST_STATE_READY);
/* since we're gonna add it to a bin but don't want to lose it,
* we keep a reference. */
- gst_object_ref (GST_OBJECT (element));
+ gst_object_ref (element);
g_hash_table_insert (play_bin->cache, "abin", element);
return element;
conv = gst_element_factory_make ("audioconvert", "aconv");
if (play_bin->visualisation) {
- gst_object_ref (GST_OBJECT (play_bin->visualisation));
+ gst_object_ref (play_bin->visualisation);
vis = play_bin->visualisation;
} else {
vis = gst_element_factory_make ("goom", "vis");
pad = gst_element_get_pad (aqueue, "sink");
rpad = gst_element_get_request_pad (tee, "src%d");
gst_pad_link (rpad, pad);
- gst_object_unref (GST_OBJECT (rpad));
- gst_object_unref (GST_OBJECT (pad));
+ gst_object_unref (rpad);
+ gst_object_unref (pad);
gst_element_link_pads (aqueue, "src", asink, "sink");
pad = gst_element_get_pad (conv, "sink");
rpad = gst_element_get_request_pad (tee, "src%d");
gst_pad_link (rpad, pad);
- gst_object_unref (GST_OBJECT (rpad));
- gst_object_unref (GST_OBJECT (pad));
+ gst_object_unref (rpad);
+ gst_object_unref (pad);
pad = gst_element_get_pad (tee, "sink");
gst_element_add_ghost_pad (element, pad, "sink");
- gst_object_unref (GST_OBJECT (pad));
+ gst_object_unref (pad);
return element;
}
* is disposed */
play_bin->sinks = g_list_remove (play_bin->sinks, element);
gst_bin_remove (GST_BIN (parent), element);
- gst_object_unref (GST_OBJECT (parent));
+ gst_object_unref (parent);
}
}
element = g_hash_table_lookup (play_bin->cache, "vbin");
if (parent != NULL) {
play_bin->sinks = g_list_remove (play_bin->sinks, element);
gst_bin_remove (GST_BIN (parent), element);
- gst_object_unref (GST_OBJECT (parent));
+ gst_object_unref (parent);
}
}
peer = gst_pad_get_peer (pad);
if (peer) {
gst_pad_unlink (peer, pad);
- gst_object_unref (GST_OBJECT (peer));
+ gst_object_unref (peer);
}
- gst_object_unref (GST_OBJECT (pad));
+ gst_object_unref (pad);
gst_bin_remove (GST_BIN (play_bin), element);
}
/* we found a sink for this stream, now try to install it */
sinkpad = gst_element_get_pad (sink, "sink");
res = gst_pad_link (srcpad, sinkpad);
- gst_object_unref (GST_OBJECT (sinkpad));
+ gst_object_unref (sinkpad);
parent = gst_pad_get_parent (srcpad);
GST_DEBUG ("Adding sink with state %d (parent: %d, peer: %d)\n",
GST_STATE (sink), GST_STATE (play_bin), GST_STATE (parent));
- gst_object_unref (GST_OBJECT (parent));
+ gst_object_unref (parent);
/* try to link the pad of the sink to the stream */
if (res < 0) {
pad = gst_element_get_pad (group->type[GST_STREAM_TYPE_AUDIO - 1].preroll,
"src");
add_sink (play_bin, sink, pad);
- gst_object_unref (GST_OBJECT (pad));
+ gst_object_unref (pad);
}
/* link video */
gst_element_get_pad (group->type[GST_STREAM_TYPE_TEXT - 1].preroll,
"src");
gst_pad_link (textsrcpad, textsinkpad);
- gst_object_unref (GST_OBJECT (textsinkpad));
- gst_object_unref (GST_OBJECT (textsrcpad));
+ gst_object_unref (textsinkpad);
+ gst_object_unref (textsrcpad);
} else {
sink = gen_video_element (play_bin);
}
pad = gst_element_get_pad (group->type[GST_STREAM_TYPE_VIDEO - 1].preroll,
"src");
add_sink (play_bin, sink, pad);
- gst_object_unref (GST_OBJECT (pad));
+ gst_object_unref (pad);
}
if (play_bin->fakesink) {
gst_pad_set_caps (otherpad, caps);
ret = TRUE;
}
- gst_object_unref (GST_OBJECT (opeer));
+ gst_object_unref (opeer);
}
done:
return ret;
gst_element_set_state (pipeline, GST_STATE_NULL);
g_print ("free pipeline\n");
- gst_object_unref (GST_OBJECT (pipeline));
+ gst_object_unref (pipeline);
return 0;
}
return;
}
if (fd->input)
- gst_object_unref (GST_OBJECT (fd->input));
+ gst_object_unref (fd->input);
fd->input = GST_ELEMENT (gst_parse_launch (fd->input_pipe, &error));
if (error) {
ui_feedback_add (fd->ui, "Error : parsing input pipeline : %s\n",
return;
}
if (fd->output)
- gst_object_unref (GST_OBJECT (fd->output));
+ gst_object_unref (fd->output);
fd->output = GST_ELEMENT (gst_parse_launch (fd->output_pipe, &error));
if (error) {
ui_feedback_add (fd->ui, "Error : parsing output pipeline : %s\n",
/* try to create filter */
if (fd->filter)
- gst_object_unref (GST_OBJECT (fd->filter));
+ gst_object_unref (fd->filter);
fd->filter = gst_element_factory_make (fd->filter_element, "filter");
if (fd->filter == NULL) {
ui_feedback_add (fd->ui, "Error : could not create element %s\n",
gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_READY);
/* unref */
- gst_object_unref (GST_OBJECT (pipeline));
+ gst_object_unref (pipeline);
exit (0);
}
gst_bin_iterate (GST_BIN (pipeline));
if ((counter / 200) > last) {
last = counter / 200;
- gst_object_unref (GST_OBJECT (pipeline));
+ gst_object_unref (pipeline);
create_pipeline ();
}
}
g_print ("The alsa plugin mastered another test.\n");
- gst_object_unref (GST_OBJECT (pipeline));
+ gst_object_unref (pipeline);
return 0;
}
g_print ("The alsa plugin mastered another test.\n");
- gst_object_unref (GST_OBJECT (pipeline));
+ gst_object_unref (pipeline);
return 0;
}
gst_bin_iterate (GST_BIN (pipeline));
if ((counter / 200) > last) {
last = counter / 200;
- gst_object_unref (GST_OBJECT (pipeline));
+ gst_object_unref (pipeline);
create_pipeline ();
}
}
g_print ("The alsa plugin mastered another test.\n");
- gst_object_unref (GST_OBJECT (pipeline));
+ gst_object_unref (pipeline);
return 0;
}
g_print ("The alsa plugin mastered another test.\n");
- gst_object_unref (GST_OBJECT (pipeline));
+ gst_object_unref (pipeline);
return 0;
}