Add private API to set window size & fullscreen modes
authorgb <gb@5584edef-b1fe-4b99-b61b-dd2bab72e969>
Mon, 22 Mar 2010 13:05:05 +0000 (13:05 +0000)
committergb <gb@5584edef-b1fe-4b99-b61b-dd2bab72e969>
Mon, 22 Mar 2010 13:05:05 +0000 (13:05 +0000)
without triggering any notification or virtual functions.
This is useful for derived class to fix up sizes whenever appropriate.

gst-libs/gst/vaapi/Makefile.am
gst-libs/gst/vaapi/gstvaapiwindow.c
gst-libs/gst/vaapi/gstvaapiwindow_priv.h [new file with mode: 0644]

index e9e47de..a8c927e 100644 (file)
@@ -39,6 +39,7 @@ libgstvaapi_source_h =                                \
 libgstvaapi_source_priv_h =                    \
        gstvaapidebug.h                         \
        gstvaapiutils.h                         \
+       gstvaapiwindow_priv.h                   \
        $(NULL)
 
 libgstvaapi_x11_source_c =                     \
index 9f2d2ab..049f285 100644 (file)
@@ -25,6 +25,7 @@
 
 #include "config.h"
 #include "gstvaapiwindow.h"
+#include "gstvaapiwindow_priv.h"
 
 #define DEBUG 1
 #include "gstvaapidebug.h"
@@ -304,6 +305,12 @@ gst_vaapi_window_get_fullscreen(GstVaapiWindow *window)
  * Requests to place the @window in fullscreen or unfullscreen states.
  */
 void
+_gst_vaapi_window_set_fullscreen(GstVaapiWindow *window, gboolean fullscreen)
+{
+    window->priv->is_fullscreen = fullscreen;
+}
+
+void
 gst_vaapi_window_set_fullscreen(GstVaapiWindow *window, gboolean fullscreen)
 {
     GstVaapiWindowClass *klass;
@@ -313,8 +320,8 @@ gst_vaapi_window_set_fullscreen(GstVaapiWindow *window, gboolean fullscreen)
     klass = GST_VAAPI_WINDOW_GET_CLASS(window);
 
     if (window->priv->is_fullscreen != fullscreen && klass->set_fullscreen) {
+        _gst_vaapi_window_set_fullscreen(window, fullscreen);
         klass->set_fullscreen(window, fullscreen);
-        window->priv->is_fullscreen = fullscreen;
     }
 }
 
@@ -411,17 +418,25 @@ gst_vaapi_window_set_height(GstVaapiWindow *window, guint height)
  *
  * Resizes the @window to match the specified @width and @height.
  */
+gboolean
+_gst_vaapi_window_set_size(GstVaapiWindow *window, guint width, guint height)
+{
+    if (width == window->priv->width && height == window->priv->height)
+        return FALSE;
+
+    window->priv->width  = width;
+    window->priv->height = height;
+    return TRUE;
+}
+
 void
 gst_vaapi_window_set_size(GstVaapiWindow *window, guint width, guint height)
 {
     g_return_if_fail(GST_VAAPI_IS_WINDOW(window));
 
-    if (width == window->priv->width && height == window->priv->height)
+    if (!_gst_vaapi_window_set_size(window, width, height))
         return;
 
-    window->priv->width  = width;
-    window->priv->height = height;
-
     if (window->priv->is_constructed)
         GST_VAAPI_WINDOW_GET_CLASS(window)->resize(window, width, height);
 }
diff --git a/gst-libs/gst/vaapi/gstvaapiwindow_priv.h b/gst-libs/gst/vaapi/gstvaapiwindow_priv.h
new file mode 100644 (file)
index 0000000..4c26027
--- /dev/null
@@ -0,0 +1,38 @@
+/*
+ *  gstvaapiwindow_priv.h - VA window abstraction (private API)
+ *
+ *  gstreamer-vaapi (C) 2010 Splitted-Desktop Systems
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
+ */
+
+#ifndef GST_VAAPI_WINDOW_PRIVATE_H
+#define GST_VAAPI_WINDOW_PRIVATE_H
+
+#include "config.h"
+
+G_BEGIN_DECLS
+
+void
+_gst_vaapi_window_set_fullscreen(GstVaapiWindow *window, gboolean fullscreen)
+    attribute_hidden;
+
+gboolean
+_gst_vaapi_window_set_size(GstVaapiWindow *window, guint width, guint height)
+    attribute_hidden;
+
+G_END_DECLS
+
+#endif /* GST_VAAPI_WINDOW_H */