Commit 7e8b50ef authored by Benjamin Otte's avatar Benjamin Otte

fix ffmpeg by using an ugly hack (put data as GType 0 when there is no type available yet)

Original commit message from CVS:
fix ffmpeg by using an ugly hack (put data as GType 0 when there is no type available yet)
parent 28ba7932
......@@ -498,7 +498,6 @@ gboolean
gst_ffmpegcsp_register (GstPlugin *plugin)
{
GstCaps *caps;
GstPadTemplate *srctempl, *sinktempl;
/* template caps */
caps = gst_ffmpeg_codectype_to_caps (CODEC_TYPE_VIDEO, NULL);
......@@ -508,7 +507,7 @@ gst_ffmpegcsp_register (GstPlugin *plugin)
GST_PAD_SRC,
GST_PAD_ALWAYS,
caps, NULL);
gst_caps_ref (caps);
gst_caps_ref (caps); /* FIXME: pad_template_new refs the caps, doesn't it? */
sinktempl = gst_pad_template_new ("sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
......
......@@ -122,6 +122,10 @@ gst_ffmpegdec_base_init (GstFFMpegDecClass *klass)
params = g_hash_table_lookup (global_plugins,
GINT_TO_POINTER (G_OBJECT_CLASS_TYPE (gobject_class)));
if (!params)
params = g_hash_table_lookup (global_plugins,
GINT_TO_POINTER (0));
g_assert (params);
/* construct the element details struct */
details = g_new0 (GstElementDetails, 1);
......@@ -495,15 +499,19 @@ gst_ffmpegdec_register (GstPlugin *plugin)
goto next;
}
params = g_new0 (GstFFMpegDecClassParams, 1);
params->in_plugin = in_plugin;
params->srccaps = srccaps;
params->sinkcaps = sinkcaps;
g_hash_table_insert (global_plugins,
GINT_TO_POINTER (0),
(gpointer) params);
/* create the gtype now */
type = g_type_register_static(GST_TYPE_ELEMENT, type_name , &typeinfo, 0);
if (!gst_element_register (plugin, type_name, GST_RANK_MARGINAL, type))
return FALSE;
params = g_new0 (GstFFMpegDecClassParams, 1);
params->in_plugin = in_plugin;
params->srccaps = srccaps;
params->sinkcaps = sinkcaps;
g_hash_table_insert (global_plugins,
GINT_TO_POINTER (type),
(gpointer) params);
......@@ -511,6 +519,7 @@ gst_ffmpegdec_register (GstPlugin *plugin)
next:
in_plugin = in_plugin->next;
}
g_hash_table_remove (global_plugins, GINT_TO_POINTER (0));
return TRUE;
}
......@@ -114,6 +114,10 @@ gst_ffmpegdemux_base_init (GstFFMpegDemuxClass *klass)
params = g_hash_table_lookup (global_plugins,
GINT_TO_POINTER (G_OBJECT_CLASS_TYPE (gobject_class)));
if (!params)
params = g_hash_table_lookup (global_plugins,
GINT_TO_POINTER (0));
g_assert (params);
/* construct the element details struct */
details = g_new0 (GstElementDetails, 1);
......@@ -453,10 +457,7 @@ gst_ffmpegdemux_register (GstPlugin *plugin)
g_free(type_name);
goto next;
}
/* create the type now */
type = g_type_register_static(GST_TYPE_ELEMENT, type_name , &typeinfo, 0);
/* create a cache for these properties */
params = g_new0 (GstFFMpegDemuxClassParams, 1);
params->in_plugin = in_plugin;
......@@ -464,6 +465,13 @@ gst_ffmpegdemux_register (GstPlugin *plugin)
params->videosrccaps = videosrccaps;
params->audiosrccaps = audiosrccaps;
g_hash_table_insert (global_plugins,
GINT_TO_POINTER (0),
(gpointer) params);
/* create the type now */
type = g_type_register_static(GST_TYPE_ELEMENT, type_name , &typeinfo, 0);
g_hash_table_insert (global_plugins,
GINT_TO_POINTER (type),
(gpointer) params);
......@@ -479,6 +487,7 @@ gst_ffmpegdemux_register (GstPlugin *plugin)
next:
in_plugin = in_plugin->next;
}
g_hash_table_remove (global_plugins, GINT_TO_POINTER (0));
return TRUE;
}
......@@ -152,6 +152,12 @@ gst_ffmpegenc_base_init (GstFFMpegEncClass *klass)
params = g_hash_table_lookup (enc_global_plugins,
GINT_TO_POINTER (G_OBJECT_CLASS_TYPE (gobject_class)));
/* HACK: if we don't have a GType yet, our params are stored at position 0 */
if (!params) {
params = g_hash_table_lookup (enc_global_plugins,
GINT_TO_POINTER (0));
}
g_assert (params);
/* construct the element details struct */
details = g_new0 (GstElementDetails, 1);
......@@ -551,16 +557,20 @@ gst_ffmpegenc_register (GstPlugin *plugin)
goto next;
}
/* create the glib type now */
type = g_type_register_static(GST_TYPE_ELEMENT, type_name , &typeinfo, 0);
if (!gst_element_register (plugin, type_name, GST_RANK_NONE, type))
return FALSE;
params = g_new0 (GstFFMpegEncClassParams, 1);
params->in_plugin = in_plugin;
params->srccaps = srccaps;
params->sinkcaps = sinkcaps;
g_hash_table_insert (enc_global_plugins,
GINT_TO_POINTER (0),
(gpointer) params);
/* create the glib type now */
type = g_type_register_static(GST_TYPE_ELEMENT, type_name , &typeinfo, 0);
if (!gst_element_register (plugin, type_name, GST_RANK_NONE, type))
return FALSE;
g_hash_table_insert (enc_global_plugins,
GINT_TO_POINTER (type),
(gpointer) params);
......@@ -568,6 +578,7 @@ gst_ffmpegenc_register (GstPlugin *plugin)
next:
in_plugin = in_plugin->next;
}
g_hash_table_remove (enc_global_plugins, GINT_TO_POINTER (0));
return TRUE;
}
......@@ -120,6 +120,10 @@ gst_ffmpegmux_base_init (GstFFMpegMuxClass *klass)
params = g_hash_table_lookup (global_plugins,
GINT_TO_POINTER (G_OBJECT_CLASS_TYPE (gobject_class)));
if (!params)
params = g_hash_table_lookup (global_plugins,
GINT_TO_POINTER (0));
g_assert (params);
/* construct the element details struct */
details = g_new0 (GstElementDetails, 1);
......@@ -506,11 +510,6 @@ gst_ffmpegmux_register (GstPlugin *plugin)
goto next;
}
/* create the type now */
type = g_type_register_static(GST_TYPE_ELEMENT, type_name , &typeinfo, 0);
if (!gst_element_register (plugin, type_name, GST_RANK_NONE, type))
return FALSE;
/* create a cache for these properties */
params = g_new0 (GstFFMpegMuxClassParams, 1);
params->in_plugin = in_plugin;
......@@ -518,6 +517,15 @@ gst_ffmpegmux_register (GstPlugin *plugin)
params->videosinkcaps = videosinkcaps;
params->audiosinkcaps = audiosinkcaps;
g_hash_table_insert (global_plugins,
GINT_TO_POINTER (0),
(gpointer) params);
/* create the type now */
type = g_type_register_static(GST_TYPE_ELEMENT, type_name , &typeinfo, 0);
if (!gst_element_register (plugin, type_name, GST_RANK_NONE, type))
return FALSE;
g_hash_table_insert (global_plugins,
GINT_TO_POINTER (type),
(gpointer) params);
......@@ -525,6 +533,7 @@ gst_ffmpegmux_register (GstPlugin *plugin)
next:
in_plugin = in_plugin->next;
}
g_hash_table_remove (global_plugins, GINT_TO_POINTER (0));
return TRUE;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment