ext/alsa/gstalsasink.c: Free the device name string.

Original commit message from CVS:
* ext/alsa/gstalsasink.c: (gst_alsasink_finalise),
(gst_alsasink_class_init):
Free the device name string.

* ext/ogg/gstoggmux.c: (gst_ogg_mux_class_init),
(gst_ogg_mux_request_new_pad), (gst_ogg_mux_release_pad),
(gst_ogg_mux_handle_src_event), (gst_ogg_mux_clear_collectpads):
Don't remove a pad from the collectpads structure until it
is released - it's a request pad, and may receive data again
if the element gets moved back to PLAYING state.

* sys/xvimage/xvimagesink.c: (gst_xvimagesink_get_xv_support):
Ensure we turn on double buffering on the Xv port, and
set the colour key to something dark and mysterious that
isn't black.
This commit is contained in:
Jan Schmidt 2006-01-27 01:36:01 +00:00
parent 4f10b0983d
commit 2b5b4217d4
4 changed files with 107 additions and 14 deletions

View file

@ -1,3 +1,21 @@
2006-01-27 Jan Schmidt <thaytan@mad.scientist.com>
* ext/alsa/gstalsasink.c: (gst_alsasink_finalise),
(gst_alsasink_class_init):
Free the device name string.
* ext/ogg/gstoggmux.c: (gst_ogg_mux_class_init),
(gst_ogg_mux_request_new_pad), (gst_ogg_mux_release_pad),
(gst_ogg_mux_handle_src_event), (gst_ogg_mux_clear_collectpads):
Don't remove a pad from the collectpads structure until it
is released - it's a request pad, and may receive data again
if the element gets moved back to PLAYING state.
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_get_xv_support):
Ensure we turn on double buffering on the Xv port, and
set the colour key to something dark and mysterious that
isn't black.
2006-01-27 Thomas Vander Stichele <thomas at apestaart dot org>
* ext/alsa/gstalsaplugin.c: (plugin_init):

View file

@ -51,6 +51,7 @@ static void gst_alsasink_base_init (gpointer g_class);
static void gst_alsasink_class_init (GstAlsaSinkClass * klass);
static void gst_alsasink_init (GstAlsaSink * alsasink);
static void gst_alsasink_dispose (GObject * object);
static void gst_alsasink_finalise (GObject * object);
static void gst_alsasink_set_property (GObject * object,
guint prop_id, const GValue * value, GParamSpec * pspec);
static void gst_alsasink_get_property (GObject * object,
@ -133,6 +134,14 @@ gst_alsasink_dispose (GObject * object)
G_OBJECT_CLASS (parent_class)->dispose (object);
}
static void
gst_alsasink_finalise (GObject * object)
{
GstAlsaSink *sink = GST_ALSA_SINK (object);
g_free (sink->device);
}
static void
gst_alsasink_base_init (gpointer g_class)
{
@ -161,6 +170,7 @@ gst_alsasink_class_init (GstAlsaSinkClass * klass)
parent_class = g_type_class_ref (GST_TYPE_BASE_AUDIO_SINK);
gobject_class->dispose = GST_DEBUG_FUNCPTR (gst_alsasink_dispose);
gobject_class->finalize = GST_DEBUG_FUNCPTR (gst_alsasink_finalise);
gobject_class->get_property = GST_DEBUG_FUNCPTR (gst_alsasink_get_property);
gobject_class->set_property = GST_DEBUG_FUNCPTR (gst_alsasink_set_property);

View file

@ -170,6 +170,8 @@ gst_ogg_mux_collected (GstCollectPads * pads, GstOggMux * ogg_mux);
static gboolean gst_ogg_mux_handle_src_event (GstPad * pad, GstEvent * event);
static GstPad *gst_ogg_mux_request_new_pad (GstElement * element,
GstPadTemplate * templ, const gchar * name);
static void gst_ogg_mux_release_pad (GstElement * element, GstPad * pad);
static void gst_ogg_mux_set_property (GObject * object,
guint prop_id, const GValue * value, GParamSpec * pspec);
static void gst_ogg_mux_get_property (GObject * object,
@ -235,6 +237,7 @@ gst_ogg_mux_class_init (GstOggMuxClass * klass)
gobject_class->set_property = gst_ogg_mux_set_property;
gstelement_class->request_new_pad = gst_ogg_mux_request_new_pad;
gstelement_class->release_pad = gst_ogg_mux_release_pad;
g_object_class_install_property (gobject_class, ARG_MAX_DELAY,
g_param_spec_uint64 ("max-delay", "Max delay",
@ -384,10 +387,6 @@ gst_ogg_mux_request_new_pad (GstElement * element,
oggpad->new_page = TRUE;
oggpad->first_delta = FALSE;
oggpad->prev_delta = FALSE;
/* TODO: delete this queue (and the things contained within) later,
* possibly when doing gst_collect_pads_remove_pad() (which we don't seem
* to do at all?)
*/
oggpad->pagebuffers = g_queue_new ();
}
}
@ -412,15 +411,50 @@ wrong_template:
}
}
static void
gst_ogg_mux_release_pad (GstElement * element, GstPad * pad)
{
GstOggMux *ogg_mux;
GSList *walk;
ogg_mux = GST_OGG_MUX (gst_pad_get_parent (pad));
/* FIXME: When a request pad is released while paused or playing,
* we probably need to do something to finalise its stream in the
* ogg data we're producing, but I'm not sure what */
/* Find out GstOggPad in the collect pads info and clean it up */
GST_OBJECT_LOCK (ogg_mux->collect);
walk = ogg_mux->collect->data;
while (walk) {
GstOggPad *oggpad = (GstOggPad *) walk->data;
GstCollectData *cdata = (GstCollectData *) walk->data;
GstBuffer *buf;
if (cdata->pad == pad) {
/* FIXME: clear the ogg stream stuff? -
* ogg_stream_clear (&oggpad->stream); */
while ((buf = g_queue_pop_head (oggpad->pagebuffers)) != NULL) {
gst_buffer_unref (buf);
}
g_queue_free (oggpad->pagebuffers);
}
walk = g_slist_next (walk);
}
GST_OBJECT_UNLOCK (ogg_mux->collect);
gst_collect_pads_remove_pad (ogg_mux->collect, pad);
}
/* handle events */
static gboolean
gst_ogg_mux_handle_src_event (GstPad * pad, GstEvent * event)
{
GstOggMux *ogg_mux;
GstEventType type;
ogg_mux = GST_OGG_MUX (gst_pad_get_parent (pad));
type = event ? GST_EVENT_TYPE (event) : GST_EVENT_UNKNOWN;
switch (type) {
@ -1299,6 +1333,7 @@ gst_ogg_mux_set_property (GObject * object,
}
}
/* Clear all buffers from the collectpads object */
static void
gst_ogg_mux_clear_collectpads (GstCollectPads * collect)
{
@ -1306,18 +1341,27 @@ gst_ogg_mux_clear_collectpads (GstCollectPads * collect)
walk = collect->data;
while (walk) {
GstOggPad *pad = (GstOggPad *) walk->data;
GstOggPad *oggpad = (GstOggPad *) walk->data;
GstBuffer *buf;
ogg_stream_clear (&pad->stream);
ogg_stream_clear (&oggpad->stream);
while ((buf = g_queue_pop_head (pad->pagebuffers)) != NULL) {
while ((buf = g_queue_pop_head (oggpad->pagebuffers)) != NULL) {
gst_buffer_unref (buf);
}
g_queue_free (pad->pagebuffers);
gst_collect_pads_remove_pad (collect, ((GstCollectData *) pad)->pad);
walk = collect->data;
ogg_stream_init (&oggpad->stream, oggpad->serial);
oggpad->packetno = 0;
oggpad->pageno = 0;
oggpad->eos = FALSE;
/* we assume there will be some control data first for this pad */
oggpad->state = GST_OGG_PAD_STATE_CONTROL;
oggpad->new_page = TRUE;
oggpad->first_delta = FALSE;
oggpad->prev_delta = FALSE;
oggpad->pagebuffers = g_queue_new ();
walk = g_slist_next (walk);
}
}

View file

@ -1072,12 +1072,14 @@ gst_xvimagesink_get_xv_support (GstXvImageSink * xvimagesink,
return NULL;
}
/* Set XV_AUTOPAINT_COLORKEY */
/* Set XV_AUTOPAINT_COLORKEY and XV_DOUBLE_BUFFER and XV_COLORKEY */
{
int count;
XvAttribute *const attr = XvQueryPortAttributes (xcontext->disp,
xcontext->xv_port_id, &count);
static const char autopaint[] = "XV_AUTOPAINT_COLORKEY";
static const char dbl_buffer[] = "XV_DOUBLE_BUFFER";
static const char colorkey[] = "XV_COLORKEY";
for (i = 0; i < count; i++)
if (!strcmp (attr[i].name, autopaint)) {
@ -1087,6 +1089,25 @@ gst_xvimagesink_get_xv_support (GstXvImageSink * xvimagesink,
break;
}
for (i = 0; i < count; i++)
if (!strcmp (attr[i].name, dbl_buffer)) {
const Atom atom = XInternAtom (xcontext->disp, dbl_buffer, False);
XvSetPortAttribute (xcontext->disp, xcontext->xv_port_id, atom, 1);
break;
}
/* Set the colorkey to something that is dark but hopefully won't randomly
* appear on the screen elsewhere (ie not black or greys) */
for (i = 0; i < count; i++)
if (!strcmp (attr[i].name, colorkey)) {
const Atom atom = XInternAtom (xcontext->disp, colorkey, False);
XvSetPortAttribute (xcontext->disp, xcontext->xv_port_id, atom,
0x010203);
break;
}
XFree (attr);
}