autoconvert: port to 0.11

This commit is contained in:
Olivier Crête 2012-01-25 16:37:22 +01:00
parent 4878946130
commit 7aead77649
5 changed files with 267 additions and 507 deletions

View file

@ -314,7 +314,7 @@ dnl *** plug-ins to include ***
dnl Non ported plugins (non-dependant, then dependant)
dnl Make sure you have a space before and after all plugins
GST_PLUGINS_NONPORTED=" adpcmdec adpcmenc aiff asfmux \
autoconvert camerabin cdxaparse coloreffects \
camerabin cdxaparse coloreffects \
dccp debugutils faceoverlay festival \
fieldanalysis freeverb freeze frei0r gaudieffects geometrictransform h264parse \
hdvparse hls id3tag inter interlace ivfparse jpegformat jp2kdecimator \

File diff suppressed because it is too large Load diff

View file

@ -52,10 +52,6 @@ struct _GstAutoConvert
GstElement *current_subelement;
GstPad *current_internal_srcpad;
GstPad *current_internal_sinkpad;
GList *cached_events;
GstSegment sink_segment;
gboolean drop_newseg;
};
struct _GstAutoConvertClass

View file

@ -89,8 +89,9 @@ gst_auto_video_convert_create_factory_list (GstAutoVideoConvert *
GList *result = NULL;
/* get the feature list using the filter */
result = gst_default_registry_feature_filter ((GstPluginFeatureFilter)
gst_auto_video_convert_element_filter, FALSE, autovideoconvert);
result = gst_registry_feature_filter (gst_registry_get (),
(GstPluginFeatureFilter) gst_auto_video_convert_element_filter,
FALSE, autovideoconvert);
/* sort on rank and name */
result = g_list_sort (result, gst_plugin_feature_rank_compare_func);
@ -108,16 +109,19 @@ gst_auto_video_convert_update_factory_list (GstAutoVideoConvert *
/* test if a factories list already exist or not */
if (!factories) {
/* no factories list create it */
factories_cookie = gst_default_registry_get_feature_list_cookie ();
factories_cookie =
gst_registry_get_feature_list_cookie (gst_registry_get ());
factories = gst_auto_video_convert_create_factory_list (autovideoconvert);
} else {
/* a factories list exist but is it up to date? */
if (factories_cookie != gst_default_registry_get_feature_list_cookie ()) {
if (factories_cookie !=
gst_registry_get_feature_list_cookie (gst_registry_get ())) {
/* we need to update the factories list */
/* first free the old one */
gst_plugin_feature_list_free (factories);
/* then create an updated one */
factories_cookie = gst_default_registry_get_feature_list_cookie ();
factories_cookie =
gst_registry_get_feature_list_cookie (gst_registry_get ());
factories = gst_auto_video_convert_create_factory_list (autovideoconvert);
}
}
@ -125,42 +129,26 @@ gst_auto_video_convert_update_factory_list (GstAutoVideoConvert *
g_static_mutex_unlock (&factories_mutex);
}
GST_BOILERPLATE (GstAutoVideoConvert, gst_auto_video_convert, GstBin,
GST_TYPE_BIN);
static void
gst_auto_video_convert_base_init (gpointer klass)
{
GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
gst_element_class_add_pad_template (element_class,
gst_static_pad_template_get (&srctemplate));
gst_element_class_add_pad_template (element_class,
gst_static_pad_template_get (&sinktemplate));
gst_element_class_set_details_simple (element_class,
"Select color space convertor based on caps", "Generic/Bin",
"Selects the right color space convertor based on the caps",
"Benjamin Gaignard <benjamin.gaignard@stericsson.com>");
}
static void
gst_auto_video_convert_dispose (GObject * object)
{
G_OBJECT_CLASS (parent_class)->dispose (object);
}
G_DEFINE_TYPE (GstAutoVideoConvert, gst_auto_video_convert, GST_TYPE_BIN);
static void
gst_auto_video_convert_class_init (GstAutoVideoConvertClass * klass)
{
GObjectClass *gobject_class = (GObjectClass *) klass;
GstElementClass *gstelement_class = (GstElementClass *) klass;
gobject_class->dispose = GST_DEBUG_FUNCPTR (gst_auto_video_convert_dispose);
GST_DEBUG_CATEGORY_INIT (autovideoconvert_debug, "autovideoconvert", 0,
"Auto color space converter");
gst_element_class_add_pad_template (gstelement_class,
gst_static_pad_template_get (&srctemplate));
gst_element_class_add_pad_template (gstelement_class,
gst_static_pad_template_get (&sinktemplate));
gst_element_class_set_details_simple (gstelement_class,
"Select color space convertor based on caps", "Generic/Bin",
"Selects the right color space convertor based on the caps",
"Benjamin Gaignard <benjamin.gaignard@stericsson.com>");
gstelement_class->change_state =
GST_DEBUG_FUNCPTR (gst_auto_video_convert_change_state);
@ -218,8 +206,7 @@ gst_auto_video_convert_remove_autoconvert (GstAutoVideoConvert *
}
static void
gst_auto_video_convert_init (GstAutoVideoConvert * autovideoconvert,
GstAutoVideoConvertClass * klass)
gst_auto_video_convert_init (GstAutoVideoConvert * autovideoconvert)
{
GstPadTemplate *pad_tmpl;
@ -271,7 +258,8 @@ gst_auto_video_convert_change_state (GstElement * element,
break;
}
ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
ret = GST_ELEMENT_CLASS (gst_auto_video_convert_parent_class)->change_state
(element, transition);
if (ret == GST_STATE_CHANGE_FAILURE)
return ret;

View file

@ -101,7 +101,7 @@ GST_START_TEST (test_autovideoconvert_rbg2bayer)
pipeline =
g_strdup_printf
("videotestsrc num-buffers=1 ! video/x-raw-rgb,bpp=32,depth=32,width=100,height=100,framerate=10/1 ! autovideoconvert ! video/x-raw-bayer,width=100,height=100,format=bggr,framerate=10/1 ! fakesink");
("videotestsrc num-buffers=1 ! video/x-raw,format=ARGB,depth=32,width=100,height=100,framerate=10/1 ! autovideoconvert ! video/x-raw-bayer,width=100,height=100,format=bggr,framerate=10/1 ! fakesink");
run_test (pipeline);
g_free (pipeline);
@ -109,13 +109,13 @@ GST_START_TEST (test_autovideoconvert_rbg2bayer)
GST_END_TEST;
GST_START_TEST (test_autovideoconvert_ffmpegcolorspace)
GST_START_TEST (test_autovideoconvert_videoconvert)
{
gchar *pipeline;
pipeline =
g_strdup_printf
("videotestsrc num-buffers=1 ! video/x-raw-rgb,bpp=32,width=100,height=100,framerate=10/1 ! autovideoconvert ! video/x-raw-rgb,bpp=16,width=100,height=100,framerate=10/1 ! fakesink");
("videotestsrc num-buffers=1 ! video/x-raw, format=RGB,width=100,height=100,framerate=10/1 ! autovideoconvert ! video/x-raw,format=BGR,width=100,height=100,framerate=10/1 ! fakesink");
run_test (pipeline);
g_free (pipeline);
@ -131,7 +131,7 @@ autovideoconvert_suite (void)
suite_add_tcase (s, tc_basic);
tcase_add_test (tc_basic, test_autovideoconvert_rbg2bayer);
tcase_add_test (tc_basic, test_autovideoconvert_ffmpegcolorspace);
tcase_add_test (tc_basic, test_autovideoconvert_videoconvert);
return s;
}