vaapisink: improve installation of properties.

Simplify the creation and installation process of properties, by first
accumulating them into a g_properties[] array, and next calling into
g_object_class_install_properties().

Also add missing docs and flags to some properties.
This commit is contained in:
Gwenole Beauchesne 2014-07-31 13:18:21 +02:00
parent d1f83b4570
commit 6e92a82138

View file

@ -117,11 +117,15 @@ enum
PROP_ROTATION, PROP_ROTATION,
PROP_FORCE_ASPECT_RATIO, PROP_FORCE_ASPECT_RATIO,
PROP_VIEW_ID, PROP_VIEW_ID,
N_PROPERTIES
}; };
#define DEFAULT_DISPLAY_TYPE GST_VAAPI_DISPLAY_TYPE_ANY #define DEFAULT_DISPLAY_TYPE GST_VAAPI_DISPLAY_TYPE_ANY
#define DEFAULT_ROTATION GST_VAAPI_ROTATION_0 #define DEFAULT_ROTATION GST_VAAPI_ROTATION_0
static GParamSpec *g_properties[N_PROPERTIES] = { NULL, };
static void static void
gst_vaapisink_video_overlay_expose (GstVideoOverlay * overlay); gst_vaapisink_video_overlay_expose (GstVideoOverlay * overlay);
@ -1218,41 +1222,50 @@ gst_vaapisink_class_init (GstVaapiSinkClass * klass)
pad_template = gst_static_pad_template_get (&gst_vaapisink_sink_factory); pad_template = gst_static_pad_template_get (&gst_vaapisink_sink_factory);
gst_element_class_add_pad_template (element_class, pad_template); gst_element_class_add_pad_template (element_class, pad_template);
g_object_class_install_property (object_class, /**
PROP_DISPLAY_TYPE, * GstVaapiSink:display:
*
* The type of display to use.
*/
g_properties[PROP_DISPLAY_TYPE] =
g_param_spec_enum ("display", g_param_spec_enum ("display",
"display type", "display type",
"display type to use", "display type to use",
GST_VAAPI_TYPE_DISPLAY_TYPE, GST_VAAPI_TYPE_DISPLAY_TYPE,
GST_VAAPI_DISPLAY_TYPE_ANY, GST_VAAPI_DISPLAY_TYPE_ANY, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (object_class, /**
PROP_DISPLAY_NAME, * GstVaapiSink:display-name:
*
* The native display name.
*/
g_properties[PROP_DISPLAY_NAME] =
g_param_spec_string ("display-name", g_param_spec_string ("display-name",
"display name", "display name",
"display name to use", "display name to use", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (object_class, /**
PROP_FULLSCREEN, * GstVaapiSink:fullscreen:
*
* Selects whether fullscreen mode is enabled or not.
*/
g_properties[PROP_FULLSCREEN] =
g_param_spec_boolean ("fullscreen", g_param_spec_boolean ("fullscreen",
"Fullscreen", "Fullscreen",
"Requests window in fullscreen state", "Requests window in fullscreen state",
FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
/** /**
* GstVaapiSink:rotation: * GstVaapiSink:rotation:
* *
* The VA display rotation mode, expressed as a #GstVaapiRotation. * The VA display rotation mode, expressed as a #GstVaapiRotation.
*/ */
g_object_class_install_property (object_class, g_properties[PROP_ROTATION] =
PROP_ROTATION,
g_param_spec_enum (GST_VAAPI_DISPLAY_PROP_ROTATION, g_param_spec_enum (GST_VAAPI_DISPLAY_PROP_ROTATION,
"rotation", "rotation",
"The display rotation mode", "The display rotation mode",
GST_VAAPI_TYPE_ROTATION, GST_VAAPI_TYPE_ROTATION,
DEFAULT_ROTATION, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); DEFAULT_ROTATION, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
/** /**
* GstVaapiSink:force-aspect-ratio: * GstVaapiSink:force-aspect-ratio:
@ -1260,12 +1273,11 @@ gst_vaapisink_class_init (GstVaapiSinkClass * klass)
* When enabled, scaling respects video aspect ratio; when disabled, * When enabled, scaling respects video aspect ratio; when disabled,
* the video is distorted to fit the window. * the video is distorted to fit the window.
*/ */
g_object_class_install_property (object_class, g_properties[PROP_FORCE_ASPECT_RATIO] =
PROP_FORCE_ASPECT_RATIO,
g_param_spec_boolean ("force-aspect-ratio", g_param_spec_boolean ("force-aspect-ratio",
"Force aspect ratio", "Force aspect ratio",
"When enabled, scaling will respect original aspect ratio", "When enabled, scaling will respect original aspect ratio",
TRUE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); TRUE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
/** /**
* GstVaapiSink:view-id: * GstVaapiSink:view-id:
@ -1275,12 +1287,13 @@ gst_vaapisink_class_init (GstVaapiSinkClass * klass)
* other number will indicate the desire to display the supplied * other number will indicate the desire to display the supplied
* view-id only. * view-id only.
*/ */
g_object_class_install_property (object_class, g_properties[PROP_VIEW_ID] =
PROP_VIEW_ID,
g_param_spec_int ("view-id", g_param_spec_int ("view-id",
"View ID", "View ID",
"ID of the view component of interest to display", "ID of the view component of interest to display",
-1, G_MAXINT32, -1, G_PARAM_READWRITE)); -1, G_MAXINT32, -1, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
g_object_class_install_properties (object_class, N_PROPERTIES, g_properties);
} }
static void static void