Commit 7ebd7b97 authored by Andy Wingo Wingo's avatar Andy Wingo Wingo
Browse files

All plugins updated for element state changes.

Original commit message from CVS:
2005-09-02  Andy Wingo  <wingo@pobox.com>

* All plugins updated for element state changes.
parent e6280d44
......@@ -103,7 +103,8 @@ GST_START_TEST (test_int16)
g_object_set (level, "message", TRUE, "interval", 0.1, NULL);
fail_unless (gst_element_set_state (level,
GST_STATE_PLAYING) == GST_STATE_SUCCESS, "could not set to playing");
GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
"could not set to playing");
/* create a fake 0.1 sec buffer with a half-amplitude block signal */
inbuffer = gst_buffer_new_and_alloc (400);
......
......@@ -158,7 +158,7 @@ main (int argc, char *argv[])
/* Change state to PLAYING */
if (gst_element_set_state (GST_ELEMENT (play),
GST_STATE_PLAYING) == GST_STATE_FAILURE)
GST_STATE_PLAYING) == GST_STATE_CHANGE_FAILURE)
g_error ("Could not set state to PLAYING");
g_timeout_add (20000, (GSourceFunc) seek_timer, play);
......
......@@ -59,7 +59,8 @@ main (gint argc, gchar * argv[])
dec_sink = gst_element_get_pad (decoder, "sink");
enc_src = gst_element_get_pad (encoder, "src");
if (gst_element_set_state (pipeline, GST_STATE_PLAYING) != GST_STATE_SUCCESS) {
if (gst_element_set_state (pipeline,
GST_STATE_PLAYING) != GST_STATE_CHANGE_SUCCESS) {
g_print ("pipeline doesn't want to play\n");
return -1;
}
......
......@@ -81,7 +81,8 @@ static void gst_aasink_set_property (GObject * object, guint prop_id,
static void gst_aasink_get_property (GObject * object, guint prop_id,
GValue * value, GParamSpec * pspec);
static GstElementStateReturn gst_aasink_change_state (GstElement * element);
static GstStateChangeReturn gst_aasink_change_state (GstElement * element,
GstStateChange transition);
static GstElementClass *parent_class = NULL;
static guint gst_aasink_signals[LAST_SIGNAL] = { 0 };
......@@ -492,35 +493,33 @@ gst_aasink_close (GstAASink * aasink)
return TRUE;
}
static GstElementStateReturn
gst_aasink_change_state (GstElement * element)
static GstStateChangeReturn
gst_aasink_change_state (GstElement * element, GstStateChange transition)
{
GstElementStateReturn ret;
gint transition;
GstStateChangeReturn ret;
transition = GST_STATE_TRANSITION (element);
switch (transition) {
case GST_STATE_NULL_TO_READY:
case GST_STATE_CHANGE_NULL_TO_READY:
break;
case GST_STATE_READY_TO_PAUSED:
case GST_STATE_CHANGE_READY_TO_PAUSED:
if (!gst_aasink_open (GST_AASINK (element)))
goto open_failed;
break;
case GST_STATE_PAUSED_TO_PLAYING:
case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
break;
default:
break;
}
ret = GST_ELEMENT_CLASS (parent_class)->change_state (element);
ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
switch (transition) {
case GST_STATE_PLAYING_TO_PAUSED:
case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
break;
case GST_STATE_PAUSED_TO_READY:
case GST_STATE_CHANGE_PAUSED_TO_READY:
break;
case GST_STATE_READY_TO_NULL:
case GST_STATE_CHANGE_READY_TO_NULL:
gst_aasink_close (GST_AASINK (element));
break;
default:
......@@ -531,7 +530,7 @@ gst_aasink_change_state (GstElement * element)
open_failed:
{
return GST_STATE_FAILURE;
return GST_STATE_CHANGE_FAILURE;
}
}
......
......@@ -77,8 +77,7 @@ static void gst_textoverlay_set_property (GObject * object,
guint prop_id, const GValue * value, GParamSpec * pspec);
static void gst_textoverlay_get_property (GObject * object,
guint prop_id, GValue * value, GParamSpec * pspec);
static GstElementStateReturn gst_textoverlay_change_state (GstElement *
element);
static GstStateChangeReturn gst_textoverlay_change_state (GstElement * element);
static void gst_textoverlay_finalize (GObject * object);
......@@ -550,25 +549,25 @@ gst_textoverlay_font_init (GstTextOverlay * overlay)
overlay->need_render = TRUE;
}
static GstElementStateReturn
gst_textoverlay_change_state (GstElement * element)
static GstStateChangeReturn
gst_textoverlay_change_state (GstElement * element, GstStateChange transition)
{
GstTextOverlay *overlay;
overlay = GST_TEXTOVERLAY (element);
switch (GST_STATE_TRANSITION (element)) {
case GST_STATE_PAUSED_TO_PLAYING:
switch (transition) {
case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
break;
case GST_STATE_PLAYING_TO_PAUSED:
case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
break;
case GST_STATE_PAUSED_TO_READY:
case GST_STATE_CHANGE_PAUSED_TO_READY:
break;
}
parent_class->change_state (element);
parent_class->change_state (element, transition);
return GST_STATE_SUCCESS;
return GST_STATE_CHANGE_SUCCESS;
}
static void
......
......@@ -115,7 +115,8 @@ GST_BOILERPLATE (GstDVDec, gst_dvdec, GstElement, GST_TYPE_ELEMENT);
static gboolean gst_dvdec_sink_setcaps (GstPad * pad, GstCaps * caps);
static GstFlowReturn gst_dvdec_chain (GstPad * pad, GstBuffer * buffer);
static GstElementStateReturn gst_dvdec_change_state (GstElement * element);
static GstStateChangeReturn gst_dvdec_change_state (GstElement * element,
GstStateChange transition);
static void gst_dvdec_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec);
......@@ -309,19 +310,17 @@ no_buffer:
}
}
static GstElementStateReturn
gst_dvdec_change_state (GstElement * element)
static GstStateChangeReturn
gst_dvdec_change_state (GstElement * element, GstStateChange transition)
{
GstDVDec *dvdec = GST_DVDEC (element);
GstElementStateReturn ret;
gint transition;
GstStateChangeReturn ret;
transition = GST_STATE_TRANSITION (element);
switch (transition) {
case GST_STATE_NULL_TO_READY:
case GST_STATE_CHANGE_NULL_TO_READY:
break;
case GST_STATE_READY_TO_PAUSED:
case GST_STATE_CHANGE_READY_TO_PAUSED:
dvdec->decoder =
dv_decoder_new (0, dvdec->clamp_luma, dvdec->clamp_chroma);
dvdec->decoder->quality = qualities[dvdec->quality];
......@@ -331,23 +330,23 @@ gst_dvdec_change_state (GstElement * element)
*/
/* dv_set_quality (dvdec->decoder, qualities [dvdec->quality]); */
break;
case GST_STATE_PAUSED_TO_PLAYING:
case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
break;
default:
break;
}
ret = parent_class->change_state (element);
ret = parent_class->change_state (element, transition);
switch (transition) {
case GST_STATE_PLAYING_TO_PAUSED:
case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
break;
case GST_STATE_PAUSED_TO_READY:
case GST_STATE_CHANGE_PAUSED_TO_READY:
dv_decoder_free (dvdec->decoder);
dvdec->decoder = NULL;
dvdec->headers_seen = FALSE;
break;
case GST_STATE_READY_TO_NULL:
case GST_STATE_CHANGE_READY_TO_NULL:
break;
default:
break;
......
......@@ -130,7 +130,8 @@ static GstFlowReturn gst_dvdemux_flush (GstDVDemux * dvdemux);
static GstFlowReturn gst_dvdemux_chain (GstPad * pad, GstBuffer * buffer);
static gboolean gst_dvdemux_handle_sink_event (GstPad * pad, GstEvent * event);
static GstElementStateReturn gst_dvdemux_change_state (GstElement * element);
static GstStateChangeReturn gst_dvdemux_change_state (GstElement * element,
GstStateChange transition);
static void
......@@ -955,21 +956,19 @@ gst_dvdemux_chain (GstPad * pad, GstBuffer * buffer)
return ret;
}
static GstElementStateReturn
gst_dvdemux_change_state (GstElement * element)
static GstStateChangeReturn
gst_dvdemux_change_state (GstElement * element, GstStateChange transition)
{
GstDVDemux *dvdemux = GST_DVDEMUX (element);
GstElementStateReturn ret;
gint transition;
GstStateChangeReturn ret;
transition = GST_STATE_TRANSITION (element);
switch (transition) {
case GST_STATE_NULL_TO_READY:
case GST_STATE_CHANGE_NULL_TO_READY:
if (!dvdemux->videosrcpad)
gst_dvdemux_add_pads (dvdemux);
break;
case GST_STATE_READY_TO_PAUSED:
case GST_STATE_CHANGE_READY_TO_PAUSED:
dvdemux->decoder = dv_decoder_new (0, FALSE, FALSE);
dvdemux->audio_offset = 0;
dvdemux->video_offset = 0;
......@@ -977,23 +976,23 @@ gst_dvdemux_change_state (GstElement * element)
dvdemux->found_header = FALSE;
dvdemux->frame_len = -1;
break;
case GST_STATE_PAUSED_TO_PLAYING:
case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
break;
default:
break;
}
ret = parent_class->change_state (element);
ret = parent_class->change_state (element, transition);
switch (transition) {
case GST_STATE_PLAYING_TO_PAUSED:
case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
break;
case GST_STATE_PAUSED_TO_READY:
case GST_STATE_CHANGE_PAUSED_TO_READY:
gst_adapter_clear (dvdemux->adapter);
dv_decoder_free (dvdemux->decoder);
dvdemux->decoder = NULL;
break;
case GST_STATE_READY_TO_NULL:
case GST_STATE_CHANGE_READY_TO_NULL:
break;
default:
break;
......
......@@ -76,7 +76,8 @@ static void gst_esdmon_init (GTypeInstance * instance, gpointer g_class);
static gboolean gst_esdmon_open_audio (GstEsdmon * src);
static void gst_esdmon_close_audio (GstEsdmon * src);
static GstElementStateReturn gst_esdmon_change_state (GstElement * element);
static GstStateChangeReturn gst_esdmon_change_state (GstElement * element,
GstStateChange transition);
static gboolean gst_esdmon_sync_parms (GstEsdmon * esdmon);
static GstData *gst_esdmon_get (GstPad * pad);
......@@ -422,8 +423,8 @@ gst_esdmon_close_audio (GstEsdmon * src)
GST_DEBUG ("esdmon: closed sound device");
}
static GstElementStateReturn
gst_esdmon_change_state (GstElement * element)
static GstStateChangeReturn
gst_esdmon_change_state (GstElement * element, GstStateChange transition)
{
g_return_val_if_fail (GST_IS_ESDMON (element), FALSE);
......@@ -435,11 +436,11 @@ gst_esdmon_change_state (GstElement * element)
} else {
if (!GST_FLAG_IS_SET (element, GST_ESDMON_OPEN)) {
if (!gst_esdmon_open_audio (GST_ESDMON (element)))
return GST_STATE_FAILURE;
return GST_STATE_CHANGE_FAILURE;
}
}
if (GST_ELEMENT_CLASS (parent_class)->change_state)
return GST_ELEMENT_CLASS (parent_class)->change_state (element);
return GST_STATE_SUCCESS;
return GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
return GST_STATE_CHANGE_SUCCESS;
}
......@@ -48,7 +48,8 @@ static void gst_flacdec_init (FlacDec * flacdec);
static void gst_flacdec_finalize (GObject * object);
static void gst_flacdec_loop (GstPad * pad);
static GstElementStateReturn gst_flacdec_change_state (GstElement * element);
static GstStateChangeReturn gst_flacdec_change_state (GstElement * element,
GstStateChange transition);
static const GstQueryType *gst_flacdec_get_src_query_types (GstPad * pad);
static gboolean gst_flacdec_src_query (GstPad * pad, GstQuery * query);
static gboolean gst_flacdec_convert_src (GstPad * pad, GstFormat src_format,
......@@ -766,13 +767,13 @@ gst_flacdec_sink_activate_pull (GstPad * sinkpad, gboolean active)
return TRUE;
}
static GstElementStateReturn
gst_flacdec_change_state (GstElement * element)
static GstStateChangeReturn
gst_flacdec_change_state (GstElement * element, GstStateChange transition)
{
FlacDec *flacdec = GST_FLACDEC (element);
switch (GST_STATE_TRANSITION (element)) {
case GST_STATE_READY_TO_PAUSED:
switch (transition) {
case GST_STATE_CHANGE_READY_TO_PAUSED:
flacdec->seek_pending = FALSE;
flacdec->total_samples = 0;
flacdec->eos = FALSE;
......@@ -781,7 +782,7 @@ gst_flacdec_change_state (GstElement * element)
FLAC__seekable_stream_decoder_reset (flacdec->decoder);
}
break;
case GST_STATE_PAUSED_TO_PLAYING:
case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
flacdec->eos = FALSE;
break;
default:
......@@ -789,7 +790,7 @@ gst_flacdec_change_state (GstElement * element)
}
if (GST_ELEMENT_CLASS (parent_class)->change_state)
return GST_ELEMENT_CLASS (parent_class)->change_state (element);
return GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
return GST_STATE_SUCCESS;
return GST_STATE_CHANGE_SUCCESS;
}
......@@ -78,7 +78,8 @@ static void gst_flacenc_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec);
static void gst_flacenc_get_property (GObject * object, guint prop_id,
GValue * value, GParamSpec * pspec);
static GstElementStateReturn gst_flacenc_change_state (GstElement * element);
static GstStateChangeReturn gst_flacenc_change_state (GstElement * element,
GstStateChange transition);
static FLAC__StreamEncoderWriteStatus
gst_flacenc_write_callback (const FLAC__SeekableStreamEncoder * encoder,
......@@ -778,21 +779,21 @@ gst_flacenc_get_property (GObject * object, guint prop_id,
}
}
static GstElementStateReturn
gst_flacenc_change_state (GstElement * element)
static GstStateChangeReturn
gst_flacenc_change_state (GstElement * element, GstStateChange transition)
{
FlacEnc *flacenc = GST_FLACENC (element);
switch (GST_STATE_TRANSITION (element)) {
case GST_STATE_NULL_TO_READY:
case GST_STATE_READY_TO_PAUSED:
switch (transition) {
case GST_STATE_CHANGE_NULL_TO_READY:
case GST_STATE_CHANGE_READY_TO_PAUSED:
flacenc->first = TRUE;
flacenc->stopped = FALSE;
break;
case GST_STATE_PAUSED_TO_PLAYING:
case GST_STATE_PLAYING_TO_PAUSED:
case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
break;
case GST_STATE_PAUSED_TO_READY:
case GST_STATE_CHANGE_PAUSED_TO_READY:
if (FLAC__seekable_stream_encoder_get_state (flacenc->encoder) !=
FLAC__STREAM_ENCODER_UNINITIALIZED) {
flacenc->stopped = TRUE;
......@@ -811,13 +812,13 @@ gst_flacenc_change_state (GstElement * element)
flacenc->meta = NULL;
}
break;
case GST_STATE_READY_TO_NULL:
case GST_STATE_CHANGE_READY_TO_NULL:
default:
break;
}
if (GST_ELEMENT_CLASS (parent_class)->change_state)
return GST_ELEMENT_CLASS (parent_class)->change_state (element);
return GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
return GST_STATE_SUCCESS;
return GST_STATE_CHANGE_SUCCESS;
}
......@@ -127,7 +127,8 @@ static void gst_flac_tag_init (GstFlacTag * tag);
static void gst_flac_tag_chain (GstPad * pad, GstData * data);
static GstElementStateReturn gst_flac_tag_change_state (GstElement * element);
static GstStateChangeReturn gst_flac_tag_change_state (GstElement * element,
GstStateChange transition);
static GstElementClass *parent_class = NULL;
......@@ -553,24 +554,24 @@ gst_flac_tag_chain (GstPad * pad, GstData * data)
}
static GstElementStateReturn
gst_flac_tag_change_state (GstElement * element)
static GstStateChangeReturn
gst_flac_tag_change_state (GstElement * element, GstStateChange transition)
{
GstFlacTag *tag;
tag = GST_FLAC_TAG (element);
switch (GST_STATE_TRANSITION (element)) {
case GST_STATE_NULL_TO_READY:
switch (transition) {
case GST_STATE_CHANGE_NULL_TO_READY:
break;
case GST_STATE_READY_TO_PAUSED:
case GST_STATE_CHANGE_READY_TO_PAUSED:
break;
case GST_STATE_PAUSED_TO_PLAYING:
case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
/* do something to get out of the chain function faster */
break;
case GST_STATE_PLAYING_TO_PAUSED:
case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
break;
case GST_STATE_PAUSED_TO_READY:
case GST_STATE_CHANGE_PAUSED_TO_READY:
if (tag->buffer) {
gst_buffer_unref (tag->buffer);
tag->buffer = NULL;
......@@ -584,9 +585,9 @@ gst_flac_tag_change_state (GstElement * element)
}
tag->state = GST_FLAC_TAG_STATE_INIT;
break;
case GST_STATE_READY_TO_NULL:
case GST_STATE_CHANGE_READY_TO_NULL:
break;
}
return parent_class->change_state (element);
return parent_class->change_state (element, transition);
}
......@@ -27,8 +27,9 @@
static void gst_gconf_audio_sink_dispose (GObject * object);
static void cb_toggle_element (GConfClient * client,
guint connection_id, GConfEntry * entry, gpointer data);
static GstElementStateReturn
gst_gconf_audio_sink_change_state (GstElement * element);
static GstStateChangeReturn
gst_gconf_audio_sink_change_state (GstElement * element,
GstStateChange transition);
GST_BOILERPLATE (GstGConfAudioSink, gst_gconf_audio_sink, GstBin, GST_TYPE_BIN);
......@@ -150,17 +151,18 @@ cb_toggle_element (GConfClient * client,
do_toggle_element (GST_GCONF_AUDIO_SINK (data));
}
static GstElementStateReturn
gst_gconf_audio_sink_change_state (GstElement * element)
static GstStateChangeReturn
gst_gconf_audio_sink_change_state (GstElement * element,
GstStateChange transition)
{
GstGConfAudioSink *sink = GST_GCONF_AUDIO_SINK (element);
switch (GST_STATE_TRANSITION (element)) {
case GST_STATE_NULL_TO_READY:
switch (transition) {
case GST_STATE_CHANGE_NULL_TO_READY:
if (!do_toggle_element (sink))
return GST_STATE_FAILURE;
return GST_STATE_CHANGE_FAILURE;
break;
case GST_STATE_READY_TO_NULL:
case GST_STATE_CHANGE_READY_TO_NULL:
gst_gconf_audio_sink_reset (sink);
break;
default:
......@@ -168,5 +170,5 @@ gst_gconf_audio_sink_change_state (GstElement * element)
}
return GST_CALL_PARENT_WITH_DEFAULT (GST_ELEMENT_CLASS, change_state,
(element), GST_STATE_SUCCESS);
(element, transition), GST_STATE_CHANGE_SUCCESS);
}
......@@ -27,8 +27,9 @@
static void gst_gconf_video_sink_dispose (GObject * object);
static void cb_toggle_element (GConfClient * client,
guint connection_id, GConfEntry * entry, gpointer data);
static GstElementStateReturn
gst_gconf_video_sink_change_state (GstElement * element);
static GstStateChangeReturn
gst_gconf_video_sink_change_state (GstElement * element,
GstStateChange transition);
GST_BOILERPLATE (GstGConfVideoSink, gst_gconf_video_sink, GstBin, GST_TYPE_BIN);
......@@ -150,17 +151,18 @@ cb_toggle_element (GConfClient * client,
do_toggle_element (GST_GCONF_VIDEO_SINK (data));
}
static GstElementStateReturn
gst_gconf_video_sink_change_state (GstElement * element)
static GstStateChangeReturn
gst_gconf_video_sink_change_state (GstElement * element,
GstStateChange transition)
{
GstGConfVideoSink *sink = GST_GCONF_VIDEO_SINK (element);
switch (GST_STATE_TRANSITION (element)) {
case GST_STATE_NULL_TO_READY:
switch (transition) {
case GST_STATE_CHANGE_NULL_TO_READY:
if (!do_toggle_element (sink))
return GST_STATE_FAILURE;
return GST_STATE_CHANGE_FAILURE;
break;
case GST_STATE_READY_TO_NULL:
case GST_STATE_CHANGE_READY_TO_NULL:
gst_gconf_video_sink_reset (sink);
break;
default:
......@@ -168,5 +170,5 @@ gst_gconf_video_sink_change_state (GstElement * element)
}
return GST_CALL_PARENT_WITH_DEFAULT (GST_ELEMENT_CLASS, change_state,
(element), GST_STATE_SUCCESS);
(element, transition), GST_STATE_CHANGE_SUCCESS);
}
......@@ -323,7 +323,7 @@ gst_gdk_animation_iter_create_pipeline (GstGdkAnimationIter * iter)
if (!gst_element_link_filtered (colorspace, sink, caps))
goto error;
if (gst_element_set_state (iter->pipeline,
GST_STATE_PLAYING) != GST_STATE_SUCCESS)
GST_STATE_PLAYING) != GST_STATE_CHANGE_SUCCESS)
goto error;
return TRUE;
......
......@@ -80,7 +80,8 @@ static void gst_jpeg_dec_init (GstJpegDec * jpegdec);
static GstFlowReturn gst_jpeg_dec_chain (GstPad * pad, GstBuffer * buffer);
static gboolean gst_jpeg_dec_setcaps (GstPad * pad, GstCaps * caps);
static GstElementStateReturn gst_jpeg_dec_change_state (GstElement * element);
static GstStateChangeReturn gst_jpeg_dec_change_state (GstElement * element,
GstStateChange transition);
GType
gst_jpeg_dec_get_type (void)
......@@ -882,16 +883,16 @@ done:
return ret;
}
static GstElementStateReturn
gst_jpeg_dec_change_state (GstElement * element)
static GstStateChangeReturn
gst_jpeg_dec_change_state (GstElement * element, GstStateChange transition)
{
GstElementStateReturn ret;
GstStateChangeReturn ret;
GstJpegDec *dec;
dec = GST_JPEG_DEC (element);
switch (GST_STATE_TRANSITION (element)) {
case GST_STATE_NULL_TO_READY:
switch (transition) {
case GST_STATE_CHANGE_NULL_TO_READY:
dec->next_ts = 0;
dec->packetized = FALSE;
break;
......@@ -899,10 +900,10 @@ gst_jpeg_dec_change_state (GstElement * element)
break;
}
ret = GST_ELEMENT_CLASS (parent_class)->change_state (element);
ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
switch (GST_STATE_TRANSITION (element)) {
case GST_STATE_PAUSED_TO_READY:
switch (transition) {
case GST_STATE_CHANGE_PAUSED_TO_READY:
if (dec->tempbuf) {
gst_buffer_unref (dec->tempbuf);
dec->tempbuf = NULL;
......
......@@ -86,7 +86,8 @@ static void gst_jpegenc_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec);
static void gst_jpegenc_get_property (GObject * object, guint prop_id,
GValue * value, GParamSpec * pspec);
static GstElementStateReturn gst_jpegenc_change_state (GstElement * element);
static GstStateChangeReturn gst_jpegenc_change_state (GstElement * element,
GstStateChange transition);
static GstElementClass *parent_class = NULL;
......