plugins: move up interfaces (cosmetics).
authorGwenole Beauchesne <gwenole.beauchesne@intel.com>
Wed, 20 Mar 2013 17:04:39 +0000 (18:04 +0100)
committerGwenole Beauchesne <gwenole.beauchesne@intel.com>
Wed, 20 Mar 2013 17:35:01 +0000 (18:35 +0100)
Move GstImplementsInterface and GstVideoContext support functions up
so that to keep a clear separation between the plugin element and its
interface hooks.

gst/vaapi/gstvaapidecode.c
gst/vaapi/gstvaapidownload.c
gst/vaapi/gstvaapipostproc.c
gst/vaapi/gstvaapisink.c
gst/vaapi/gstvaapiupload.c

index 545a604..b1f4bc5 100644 (file)
@@ -88,11 +88,36 @@ static GstStaticPadTemplate gst_vaapidecode_src_factory =
         GST_PAD_ALWAYS,
         GST_STATIC_CAPS(gst_vaapidecode_src_caps_str));
 
+/* GstImplementsInterface interface */
+static gboolean
+gst_vaapidecode_implements_interface_supported(
+    GstImplementsInterface *iface,
+    GType                   type
+)
+{
+    return (type == GST_TYPE_VIDEO_CONTEXT);
+}
+
+static void
+gst_vaapidecode_implements_iface_init(GstImplementsInterfaceClass *iface)
+{
+    iface->supported = gst_vaapidecode_implements_interface_supported;
+}
+
+/* GstVideoContext interface */
 static void
-gst_vaapidecode_implements_iface_init(GstImplementsInterfaceClass *iface);
+gst_vaapidecode_set_video_context(GstVideoContext *context, const gchar *type,
+    const GValue *value)
+{
+    GstVaapiDecode *decode = GST_VAAPIDECODE (context);
+    gst_vaapi_set_display (type, value, &decode->display);
+}
 
 static void
-gst_video_context_interface_init(GstVideoContextInterface *iface);
+gst_video_context_interface_init(GstVideoContextInterface *iface)
+{
+    iface->set_context = gst_vaapidecode_set_video_context;
+}
 
 #define GstVideoContextClass GstVideoContextInterface
 G_DEFINE_TYPE_WITH_CODE(
@@ -417,39 +442,6 @@ gst_vaapidecode_reset_full(GstVaapiDecode *decode, GstCaps *caps, gboolean hard)
     return gst_vaapidecode_create(decode, caps);
 }
 
-/* GstImplementsInterface interface */
-
-static gboolean
-gst_vaapidecode_implements_interface_supported(
-    GstImplementsInterface *iface,
-    GType                   type
-)
-{
-    return (type == GST_TYPE_VIDEO_CONTEXT);
-}
-
-static void
-gst_vaapidecode_implements_iface_init(GstImplementsInterfaceClass *iface)
-{
-    iface->supported = gst_vaapidecode_implements_interface_supported;
-}
-
-/* GstVideoContext interface */
-
-static void
-gst_vaapidecode_set_video_context(GstVideoContext *context, const gchar *type,
-    const GValue *value)
-{
-    GstVaapiDecode *decode = GST_VAAPIDECODE (context);
-    gst_vaapi_set_display (type, value, &decode->display);
-}
-
-static void
-gst_video_context_interface_init(GstVideoContextInterface *iface)
-{
-    iface->set_context = gst_vaapidecode_set_video_context;
-}
-
 static void
 gst_vaapidecode_finalize(GObject *object)
 {
index 4d1d49f..5a29501 100644 (file)
@@ -99,11 +99,36 @@ struct _GstVaapiDownloadClass {
     GstBaseTransformClass parent_class;
 };
 
+/* GstImplementsInterface interface */
+static gboolean
+gst_vaapidownload_implements_interface_supported(
+    GstImplementsInterface *iface,
+    GType                   type
+)
+{
+    return (type == GST_TYPE_VIDEO_CONTEXT);
+}
+
+static void
+gst_vaapidownload_implements_iface_init(GstImplementsInterfaceClass *iface)
+{
+    iface->supported = gst_vaapidownload_implements_interface_supported;
+}
+
+/* GstVideoContext interface */
 static void
-gst_vaapidownload_implements_iface_init(GstImplementsInterfaceClass *iface);
+gst_vaapidownload_set_video_context(GstVideoContext *context, const gchar *type,
+    const GValue *value)
+{
+  GstVaapiDownload *download = GST_VAAPIDOWNLOAD (context);
+  gst_vaapi_set_display (type, value, &download->display);
+}
 
 static void
-gst_video_context_interface_init(GstVideoContextInterface *iface);
+gst_video_context_interface_init(GstVideoContextInterface *iface)
+{
+    iface->set_context = gst_vaapidownload_set_video_context;
+}
 
 #define GstVideoContextClass GstVideoContextInterface
 G_DEFINE_TYPE_WITH_CODE(
@@ -161,39 +186,6 @@ gst_vaapidownload_query(
     GstQuery *query
 );
 
-/* GstImplementsInterface interface */
-
-static gboolean
-gst_vaapidownload_implements_interface_supported(
-    GstImplementsInterface *iface,
-    GType                   type
-)
-{
-    return (type == GST_TYPE_VIDEO_CONTEXT);
-}
-
-static void
-gst_vaapidownload_implements_iface_init(GstImplementsInterfaceClass *iface)
-{
-    iface->supported = gst_vaapidownload_implements_interface_supported;
-}
-
-/* GstVideoContext interface */
-
-static void
-gst_vaapidownload_set_video_context(GstVideoContext *context, const gchar *type,
-    const GValue *value)
-{
-  GstVaapiDownload *download = GST_VAAPIDOWNLOAD (context);
-  gst_vaapi_set_display (type, value, &download->display);
-}
-
-static void
-gst_video_context_interface_init(GstVideoContextInterface *iface)
-{
-    iface->set_context = gst_vaapidownload_set_video_context;
-}
-
 static void
 gst_vaapidownload_destroy(GstVaapiDownload *download)
 {
index a40352f..3172482 100644 (file)
@@ -74,11 +74,40 @@ static GstStaticPadTemplate gst_vaapipostproc_src_factory =
         GST_PAD_ALWAYS,
         GST_STATIC_CAPS(gst_vaapipostproc_src_caps_str));
 
+/* GstImplementsInterface interface */
+static gboolean
+gst_vaapipostproc_implements_interface_supported(
+    GstImplementsInterface *iface,
+    GType                   type
+)
+{
+    return (type == GST_TYPE_VIDEO_CONTEXT);
+}
+
+static void
+gst_vaapipostproc_implements_iface_init(GstImplementsInterfaceClass *iface)
+{
+    iface->supported = gst_vaapipostproc_implements_interface_supported;
+}
+
+/* GstVideoContext interface */
 static void
-gst_vaapipostproc_implements_iface_init(GstImplementsInterfaceClass *iface);
+gst_vaapipostproc_set_video_context(
+    GstVideoContext *context,
+    const gchar     *type,
+    const GValue    *value
+)
+{
+    GstVaapiPostproc * const postproc = GST_VAAPIPOSTPROC(context);
+
+    gst_vaapi_set_display(type, value, &postproc->display);
+}
 
 static void
-gst_video_context_interface_init(GstVideoContextInterface *iface);
+gst_video_context_interface_init(GstVideoContextInterface *iface)
+{
+    iface->set_context = gst_vaapipostproc_set_video_context;
+}
 
 #define GstVideoContextClass GstVideoContextInterface
 G_DEFINE_TYPE_WITH_CODE(
@@ -161,43 +190,6 @@ get_vaapipostproc_from_pad(GstPad *pad)
     return GST_VAAPIPOSTPROC(gst_pad_get_parent_element(pad));
 }
 
-/* GstImplementsInterface interface */
-
-static gboolean
-gst_vaapipostproc_implements_interface_supported(
-    GstImplementsInterface *iface,
-    GType                   type
-)
-{
-    return (type == GST_TYPE_VIDEO_CONTEXT);
-}
-
-static void
-gst_vaapipostproc_implements_iface_init(GstImplementsInterfaceClass *iface)
-{
-    iface->supported = gst_vaapipostproc_implements_interface_supported;
-}
-
-/* GstVideoContext interface */
-
-static void
-gst_vaapipostproc_set_video_context(
-    GstVideoContext *context,
-    const gchar     *type,
-    const GValue    *value
-)
-{
-    GstVaapiPostproc * const postproc = GST_VAAPIPOSTPROC(context);
-
-    gst_vaapi_set_display(type, value, &postproc->display);
-}
-
-static void
-gst_video_context_interface_init(GstVideoContextInterface *iface)
-{
-    iface->set_context = gst_vaapipostproc_set_video_context;
-}
-
 static inline gboolean
 gst_vaapipostproc_ensure_display(GstVaapiPostproc *postproc)
 {
index 5d41d05..90350de 100644 (file)
@@ -85,41 +85,7 @@ static GstStaticPadTemplate gst_vaapisink_sink_factory =
         GST_PAD_ALWAYS,
         GST_STATIC_CAPS(gst_vaapisink_sink_caps_str));
 
-static void
-gst_vaapisink_implements_iface_init(GstImplementsInterfaceClass *iface);
-
-static void
-gst_vaapisink_video_context_iface_init(GstVideoContextInterface *iface);
-
-static void
-gst_vaapisink_xoverlay_iface_init(GstXOverlayClass *iface);
-
-G_DEFINE_TYPE_WITH_CODE(
-    GstVaapiSink,
-    gst_vaapisink,
-    GST_TYPE_VIDEO_SINK,
-    G_IMPLEMENT_INTERFACE(GST_TYPE_IMPLEMENTS_INTERFACE,
-                          gst_vaapisink_implements_iface_init);
-    G_IMPLEMENT_INTERFACE(GST_TYPE_VIDEO_CONTEXT,
-                          gst_vaapisink_video_context_iface_init);
-    G_IMPLEMENT_INTERFACE(GST_TYPE_X_OVERLAY,
-                          gst_vaapisink_xoverlay_iface_init))
-
-enum {
-    PROP_0,
-
-    PROP_DISPLAY_TYPE,
-    PROP_FULLSCREEN,
-    PROP_SYNCHRONOUS,
-    PROP_USE_REFLECTION,
-    PROP_ROTATION,
-};
-
-#define DEFAULT_DISPLAY_TYPE            GST_VAAPI_DISPLAY_TYPE_ANY
-#define DEFAULT_ROTATION                GST_VAAPI_ROTATION_0
-
 /* GstImplementsInterface interface */
-
 static gboolean
 gst_vaapisink_implements_interface_supported(
     GstImplementsInterface *iface,
@@ -137,7 +103,6 @@ gst_vaapisink_implements_iface_init(GstImplementsInterfaceClass *iface)
 }
 
 /* GstVideoContext interface */
-
 static void
 gst_vaapisink_set_video_context(GstVideoContext *context, const gchar *type,
     const GValue *value)
@@ -152,6 +117,33 @@ gst_vaapisink_video_context_iface_init(GstVideoContextInterface *iface)
     iface->set_context = gst_vaapisink_set_video_context;
 }
 
+static void
+gst_vaapisink_xoverlay_iface_init(GstXOverlayClass *iface);
+
+G_DEFINE_TYPE_WITH_CODE(
+    GstVaapiSink,
+    gst_vaapisink,
+    GST_TYPE_VIDEO_SINK,
+    G_IMPLEMENT_INTERFACE(GST_TYPE_IMPLEMENTS_INTERFACE,
+                          gst_vaapisink_implements_iface_init);
+    G_IMPLEMENT_INTERFACE(GST_TYPE_VIDEO_CONTEXT,
+                          gst_vaapisink_video_context_iface_init);
+    G_IMPLEMENT_INTERFACE(GST_TYPE_X_OVERLAY,
+                          gst_vaapisink_xoverlay_iface_init))
+
+enum {
+    PROP_0,
+
+    PROP_DISPLAY_TYPE,
+    PROP_FULLSCREEN,
+    PROP_SYNCHRONOUS,
+    PROP_USE_REFLECTION,
+    PROP_ROTATION,
+};
+
+#define DEFAULT_DISPLAY_TYPE            GST_VAAPI_DISPLAY_TYPE_ANY
+#define DEFAULT_ROTATION                GST_VAAPI_ROTATION_0
+
 /* GstXOverlay interface */
 
 #if USE_X11
index 6118454..05941d5 100644 (file)
@@ -75,11 +75,41 @@ static GstStaticPadTemplate gst_vaapiupload_src_factory =
         GST_PAD_ALWAYS,
         GST_STATIC_CAPS(gst_vaapiupload_vaapi_caps_str));
 
+
+/* GstImplementsInterface interface */
+static gboolean
+gst_vaapiupload_implements_interface_supported(
+    GstImplementsInterface *iface,
+    GType                   type
+)
+{
+    return (type == GST_TYPE_VIDEO_CONTEXT);
+}
+
 static void
-gst_vaapiupload_implements_iface_init(GstImplementsInterfaceClass *iface);
+gst_vaapiupload_implements_iface_init(GstImplementsInterfaceClass *iface)
+{
+    iface->supported = gst_vaapiupload_implements_interface_supported;
+}
 
+/* GstVideoContext interface */
 static void
-gst_video_context_interface_init(GstVideoContextInterface *iface);
+gst_vaapiupload_set_video_context(GstVideoContext *context, const gchar *type,
+    const GValue *value)
+{
+    GstVaapiUpload * const upload = GST_VAAPIUPLOAD(context);
+
+    gst_vaapi_set_display(type, value, &upload->display);
+
+    if (upload->uploader)
+        gst_vaapi_uploader_ensure_display(upload->uploader, upload->display);
+}
+
+static void
+gst_video_context_interface_init(GstVideoContextInterface *iface)
+{
+    iface->set_context = gst_vaapiupload_set_video_context;
+}
 
 #define GstVideoContextClass GstVideoContextInterface
 G_DEFINE_TYPE_WITH_CODE(
@@ -149,43 +179,6 @@ gst_vaapiupload_query(
     GstQuery *query
 );
 
-/* GstImplementsInterface interface */
-
-static gboolean
-gst_vaapiupload_implements_interface_supported(
-    GstImplementsInterface *iface,
-    GType                   type
-)
-{
-    return (type == GST_TYPE_VIDEO_CONTEXT);
-}
-
-static void
-gst_vaapiupload_implements_iface_init(GstImplementsInterfaceClass *iface)
-{
-    iface->supported = gst_vaapiupload_implements_interface_supported;
-}
-
-/* GstVideoContext interface */
-
-static void
-gst_vaapiupload_set_video_context(GstVideoContext *context, const gchar *type,
-    const GValue *value)
-{
-    GstVaapiUpload * const upload = GST_VAAPIUPLOAD(context);
-
-    gst_vaapi_set_display(type, value, &upload->display);
-
-    if (upload->uploader)
-        gst_vaapi_uploader_ensure_display(upload->uploader, upload->display);
-}
-
-static void
-gst_video_context_interface_init(GstVideoContextInterface *iface)
-{
-    iface->set_context = gst_vaapiupload_set_video_context;
-}
-
 static void
 gst_vaapiupload_destroy(GstVaapiUpload *upload)
 {