mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-25 16:48:11 +00:00
ext/libcaca/gstcacasink.*: Cleanups.
Original commit message from CVS: * ext/libcaca/gstcacasink.c: (gst_cacasink_setcaps), (gst_cacasink_render), (gst_cacasink_open), (gst_cacasink_close), (gst_cacasink_change_state): * ext/libcaca/gstcacasink.h: Cleanups.
This commit is contained in:
parent
924a50450f
commit
d564e75b34
4 changed files with 27 additions and 36 deletions
|
@ -1,3 +1,11 @@
|
||||||
|
2005-05-17 Wim Taymans <wim@fluendo.com>
|
||||||
|
|
||||||
|
* ext/libcaca/gstcacasink.c: (gst_cacasink_setcaps),
|
||||||
|
(gst_cacasink_render), (gst_cacasink_open), (gst_cacasink_close),
|
||||||
|
(gst_cacasink_change_state):
|
||||||
|
* ext/libcaca/gstcacasink.h:
|
||||||
|
Cleanups.
|
||||||
|
|
||||||
2005-05-15 David Schleef <ds@schleef.org>
|
2005-05-15 David Schleef <ds@schleef.org>
|
||||||
|
|
||||||
Move core plugins out of core. I don't mind fdsrc/fdsink
|
Move core plugins out of core. I don't mind fdsrc/fdsink
|
||||||
|
|
2
common
2
common
|
@ -1 +1 @@
|
||||||
Subproject commit 131c2632127e6f061b5270d8f80651782a4fdd13
|
Subproject commit 67b7e6c0db99415e0440d0c576495641b53e976a
|
|
@ -191,12 +191,6 @@ gst_cacasink_setcaps (GstBaseSink * basesink, GstCaps * caps)
|
||||||
|
|
||||||
cacasink = GST_CACASINK (basesink);
|
cacasink = GST_CACASINK (basesink);
|
||||||
|
|
||||||
/* We cannot use library functions if the sink is not open */
|
|
||||||
if (!GST_FLAG_IS_SET (GST_ELEMENT (cacasink), GST_CACASINK_OPEN))
|
|
||||||
return FALSE;
|
|
||||||
/*if (!GST_CAPS_IS_FIXED (caps))
|
|
||||||
return FALSE; */
|
|
||||||
|
|
||||||
structure = gst_caps_get_structure (caps, 0);
|
structure = gst_caps_get_structure (caps, 0);
|
||||||
gst_structure_get_int (structure, "width", &(cacasink->width));
|
gst_structure_get_int (structure, "width", &(cacasink->width));
|
||||||
gst_structure_get_int (structure, "height", &(cacasink->height));
|
gst_structure_get_int (structure, "height", &(cacasink->height));
|
||||||
|
@ -261,10 +255,6 @@ gst_cacasink_render (GstBaseSink * basesink, GstBuffer * buffer)
|
||||||
{
|
{
|
||||||
GstCACASink *cacasink = GST_CACASINK (basesink);
|
GstCACASink *cacasink = GST_CACASINK (basesink);
|
||||||
|
|
||||||
/* We cannot use library functions if the sink is not open */
|
|
||||||
if (!GST_FLAG_IS_SET (GST_ELEMENT (cacasink), GST_CACASINK_OPEN))
|
|
||||||
return GST_FLOW_WRONG_STATE;
|
|
||||||
|
|
||||||
GST_DEBUG ("render");
|
GST_DEBUG ("render");
|
||||||
|
|
||||||
caca_clear ();
|
caca_clear ();
|
||||||
|
@ -344,8 +334,6 @@ gst_cacasink_get_property (GObject * object, guint prop_id, GValue * value,
|
||||||
static gboolean
|
static gboolean
|
||||||
gst_cacasink_open (GstCACASink * cacasink)
|
gst_cacasink_open (GstCACASink * cacasink)
|
||||||
{
|
{
|
||||||
g_return_val_if_fail (!GST_FLAG_IS_SET (cacasink, GST_CACASINK_OPEN), FALSE);
|
|
||||||
|
|
||||||
cacasink->bitmap = NULL;
|
cacasink->bitmap = NULL;
|
||||||
caca_init ();
|
caca_init ();
|
||||||
|
|
||||||
|
@ -356,45 +344,46 @@ gst_cacasink_open (GstCACASink * cacasink)
|
||||||
cacasink->dither = 0;
|
cacasink->dither = 0;
|
||||||
caca_set_dithering (CACA_DITHERING_NONE);
|
caca_set_dithering (CACA_DITHERING_NONE);
|
||||||
|
|
||||||
|
|
||||||
GST_FLAG_SET (cacasink, GST_CACASINK_OPEN);
|
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_cacasink_close (GstCACASink * cacasink)
|
gst_cacasink_close (GstCACASink * cacasink)
|
||||||
{
|
{
|
||||||
g_return_if_fail (GST_FLAG_IS_SET (cacasink, GST_CACASINK_OPEN));
|
|
||||||
|
|
||||||
if (cacasink->bitmap) {
|
if (cacasink->bitmap) {
|
||||||
caca_free_bitmap (cacasink->bitmap);
|
caca_free_bitmap (cacasink->bitmap);
|
||||||
cacasink->bitmap = NULL;
|
cacasink->bitmap = NULL;
|
||||||
}
|
}
|
||||||
caca_end ();
|
caca_end ();
|
||||||
|
|
||||||
GST_FLAG_UNSET (cacasink, GST_CACASINK_OPEN);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static GstElementStateReturn
|
static GstElementStateReturn
|
||||||
gst_cacasink_change_state (GstElement * element)
|
gst_cacasink_change_state (GstElement * element)
|
||||||
{
|
{
|
||||||
g_return_val_if_fail (GST_IS_CACASINK (element), GST_STATE_FAILURE);
|
GstElementStateReturn ret;
|
||||||
|
gint transition;
|
||||||
|
|
||||||
if (GST_STATE_PENDING (element) == GST_STATE_NULL) {
|
transition = GST_STATE_TRANSITION (element);
|
||||||
if (GST_FLAG_IS_SET (element, GST_CACASINK_OPEN))
|
|
||||||
gst_cacasink_close (GST_CACASINK (element));
|
switch (transition) {
|
||||||
} else {
|
case GST_STATE_READY_TO_PAUSED:
|
||||||
if (!GST_FLAG_IS_SET (element, GST_CACASINK_OPEN)) {
|
|
||||||
if (!gst_cacasink_open (GST_CACASINK (element)))
|
if (!gst_cacasink_open (GST_CACASINK (element)))
|
||||||
return GST_STATE_FAILURE;
|
return GST_STATE_FAILURE;
|
||||||
}
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GST_ELEMENT_CLASS (parent_class)->change_state)
|
ret = GST_ELEMENT_CLASS (parent_class)->change_state (element);
|
||||||
return GST_ELEMENT_CLASS (parent_class)->change_state (element);
|
|
||||||
|
|
||||||
return GST_STATE_SUCCESS;
|
switch (transition) {
|
||||||
|
case GST_STATE_PAUSED_TO_READY:
|
||||||
|
gst_cacasink_close (GST_CACASINK (element));
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
|
|
|
@ -53,12 +53,6 @@ extern "C" {
|
||||||
#define GST_IS_CACASINK_CLASS(obj) \
|
#define GST_IS_CACASINK_CLASS(obj) \
|
||||||
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_CACASINK))
|
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_CACASINK))
|
||||||
|
|
||||||
typedef enum {
|
|
||||||
GST_CACASINK_OPEN = GST_ELEMENT_FLAG_LAST,
|
|
||||||
|
|
||||||
GST_CACASINK_FLAG_LAST = GST_ELEMENT_FLAG_LAST + 2,
|
|
||||||
} GstCACASinkFlags;
|
|
||||||
|
|
||||||
typedef struct _GstCACASink GstCACASink;
|
typedef struct _GstCACASink GstCACASink;
|
||||||
typedef struct _GstCACASinkClass GstCACASinkClass;
|
typedef struct _GstCACASinkClass GstCACASinkClass;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue