From 873d5b7a0437d63e03f1a1e9df44e52bb5dc1cf2 Mon Sep 17 00:00:00 2001 From: gb Date: Mon, 22 Mar 2010 12:16:47 +0000 Subject: [PATCH] Add GstVaapiPoint & GstVaapiRectangle data structures. --- docs/reference/libs/libs-docs.xml.in | 1 + docs/reference/libs/libs-sections.txt | 7 ++++ gst-libs/gst/vaapi/Makefile.am | 1 + gst-libs/gst/vaapi/gstvaapitypes.h | 60 +++++++++++++++++++++++++++++++++ gst-libs/gst/vaapi/gstvaapiwindow.c | 26 +++++++------- gst-libs/gst/vaapi/gstvaapiwindow.h | 9 ++--- gst-libs/gst/vaapi/gstvaapiwindow_x11.c | 12 +++---- sys/vaapisink/gstvaapisink.c | 14 ++++---- sys/vaapisink/gstvaapisink.h | 2 +- 9 files changed, 101 insertions(+), 31 deletions(-) create mode 100644 gst-libs/gst/vaapi/gstvaapitypes.h diff --git a/docs/reference/libs/libs-docs.xml.in b/docs/reference/libs/libs-docs.xml.in index c9683ac..48fccf2 100644 --- a/docs/reference/libs/libs-docs.xml.in +++ b/docs/reference/libs/libs-docs.xml.in @@ -11,6 +11,7 @@ GStreamer VA-API Plugins Library + diff --git a/docs/reference/libs/libs-sections.txt b/docs/reference/libs/libs-sections.txt index a6b14a3..852bd32 100644 --- a/docs/reference/libs/libs-sections.txt +++ b/docs/reference/libs/libs-sections.txt @@ -155,6 +155,13 @@ GST_VAAPI_VIDEO_BUFFER_GET_CLASS
+gstvaapitypes +Basic data structures +GstVaapiPoint +GstVaapiRectangle +
+ +
gstvaapiwindow GstVaapiWindow GstVaapiWindow diff --git a/gst-libs/gst/vaapi/Makefile.am b/gst-libs/gst/vaapi/Makefile.am index 25386c6..e9e47de 100644 --- a/gst-libs/gst/vaapi/Makefile.am +++ b/gst-libs/gst/vaapi/Makefile.am @@ -29,6 +29,7 @@ libgstvaapi_source_h = \ gstvaapisubpicture.h \ gstvaapisurface.h \ gstvaapisurfacepool.h \ + gstvaapitypes.h \ gstvaapivideobuffer.h \ gstvaapivideopool.h \ gstvaapivideosink.h \ diff --git a/gst-libs/gst/vaapi/gstvaapitypes.h b/gst-libs/gst/vaapi/gstvaapitypes.h new file mode 100644 index 0000000..97dd598 --- /dev/null +++ b/gst-libs/gst/vaapi/gstvaapitypes.h @@ -0,0 +1,60 @@ +/* + * gstvaapitypes.h - Misc types + * + * 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_TYPES_H +#define GST_VAAPI_TYPES_H + +#include + +G_BEGIN_DECLS + +/** + * GstVaapiPoint: + * @x: X coordinate + * @y: Y coordinate + * + * A location within a surface. + */ +typedef struct _GstVaapiPoint GstVaapiPoint; +struct _GstVaapiPoint { + guint32 x; + guint32 y; +}; + +/** + * GstVaapiRectangle: + * @x: X coordinate + * @y: Y coordinate + * @width: region width + * @height: region height + * + * A rectangle region within a surface. + */ +typedef struct _GstVaapiRectangle GstVaapiRectangle; +struct _GstVaapiRectangle { + guint32 x; + guint32 y; + guint32 width; + guint32 height; +}; + +G_END_DECLS + +#endif /* GST_VAAPI_TYPES_H */ diff --git a/gst-libs/gst/vaapi/gstvaapiwindow.c b/gst-libs/gst/vaapi/gstvaapiwindow.c index 58121ac..2348540 100644 --- a/gst-libs/gst/vaapi/gstvaapiwindow.c +++ b/gst-libs/gst/vaapi/gstvaapiwindow.c @@ -349,27 +349,27 @@ gst_vaapi_window_set_size(GstVaapiWindow *window, guint width, guint height) } static inline void -get_surface_rect(GstVaapiSurface *surface, GstVideoRectangle *rect) +get_surface_rect(GstVaapiSurface *surface, GstVaapiRectangle *rect) { guint width, height; gst_vaapi_surface_get_size(surface, &width, &height); - rect->x = 0; - rect->y = 0; - rect->w = width; - rect->h = height; + rect->x = 0; + rect->y = 0; + rect->width = width; + rect->height = height; } static inline void -get_window_rect(GstVaapiWindow *window, GstVideoRectangle *rect) +get_window_rect(GstVaapiWindow *window, GstVaapiRectangle *rect) { guint width, height; gst_vaapi_window_get_size(window, &width, &height); - rect->x = 0; - rect->y = 0; - rect->w = width; - rect->h = height; + rect->x = 0; + rect->y = 0; + rect->width = width; + rect->height = height; } /** @@ -394,12 +394,12 @@ gboolean gst_vaapi_window_put_surface( GstVaapiWindow *window, GstVaapiSurface *surface, - const GstVideoRectangle *src_rect, - const GstVideoRectangle *dst_rect, + const GstVaapiRectangle *src_rect, + const GstVaapiRectangle *dst_rect, guint flags ) { - GstVideoRectangle src_rect_default, dst_rect_default; + GstVaapiRectangle src_rect_default, dst_rect_default; g_return_val_if_fail(GST_VAAPI_IS_WINDOW(window), FALSE); g_return_val_if_fail(window->priv->is_constructed, FALSE); diff --git a/gst-libs/gst/vaapi/gstvaapiwindow.h b/gst-libs/gst/vaapi/gstvaapiwindow.h index 804b035..d1db986 100644 --- a/gst-libs/gst/vaapi/gstvaapiwindow.h +++ b/gst-libs/gst/vaapi/gstvaapiwindow.h @@ -22,6 +22,7 @@ #define GST_VAAPI_WINDOW_H #include +#include #include #include @@ -92,8 +93,8 @@ struct _GstVaapiWindowClass { gboolean (*resize) (GstVaapiWindow *window, guint width, guint height); gboolean (*render) (GstVaapiWindow *window, GstVaapiSurface *surface, - const GstVideoRectangle *src_rect, - const GstVideoRectangle *dst_rect, + const GstVaapiRectangle *src_rect, + const GstVaapiRectangle *dst_rect, guint flags); }; @@ -131,8 +132,8 @@ gboolean gst_vaapi_window_put_surface( GstVaapiWindow *window, GstVaapiSurface *surface, - const GstVideoRectangle *src_rect, - const GstVideoRectangle *dst_rect, + const GstVaapiRectangle *src_rect, + const GstVaapiRectangle *dst_rect, guint flags ); diff --git a/gst-libs/gst/vaapi/gstvaapiwindow_x11.c b/gst-libs/gst/vaapi/gstvaapiwindow_x11.c index c0b1f0c..c7474e8 100644 --- a/gst-libs/gst/vaapi/gstvaapiwindow_x11.c +++ b/gst-libs/gst/vaapi/gstvaapiwindow_x11.c @@ -279,8 +279,8 @@ static gboolean gst_vaapi_window_x11_render( GstVaapiWindow *window, GstVaapiSurface *surface, - const GstVideoRectangle *src_rect, - const GstVideoRectangle *dst_rect, + const GstVaapiRectangle *src_rect, + const GstVaapiRectangle *dst_rect, guint flags ) { @@ -303,12 +303,12 @@ gst_vaapi_window_x11_render( GST_VAAPI_WINDOW_X11(window)->priv->xid, src_rect->x, src_rect->y, - src_rect->w, - src_rect->h, + src_rect->width, + src_rect->height, dst_rect->x, dst_rect->y, - dst_rect->w, - dst_rect->h, + dst_rect->width, + dst_rect->height, NULL, 0, get_PutSurface_flags_from_GstVaapiSurfaceRenderFlags(flags) ); diff --git a/sys/vaapisink/gstvaapisink.c b/sys/vaapisink/gstvaapisink.c index 8a6d1d6..a89dce8 100644 --- a/sys/vaapisink/gstvaapisink.c +++ b/sys/vaapisink/gstvaapisink.c @@ -141,7 +141,7 @@ gst_vaapisink_set_caps(GstBaseSink *base_sink, GstCaps *caps) { GstVaapiSink * const sink = GST_VAAPISINK(base_sink); GstStructure * const structure = gst_caps_get_structure(caps, 0); - GstVideoRectangle * const win_rect = &sink->window_rect; + GstVaapiRectangle * const win_rect = &sink->window_rect; guint num, den; guint win_width, win_height; guint display_width, display_height, display_par_n, display_par_d; @@ -202,15 +202,15 @@ gst_vaapisink_set_caps(GstBaseSink *base_sink, GstCaps *caps) GST_DEBUG("window size %ux%u", win_width, win_height); if (sink->fullscreen) { - win_rect->x = (display_width - win_width) / 2; - win_rect->y = (display_height - win_height) / 2; + win_rect->x = (display_width - win_width) / 2; + win_rect->y = (display_height - win_height) / 2; } else { - win_rect->x = 0; - win_rect->y = 0; + win_rect->x = 0; + win_rect->y = 0; } - win_rect->w = win_width; - win_rect->h = win_height; + win_rect->width = win_width; + win_rect->height = win_height; if (sink->window) gst_vaapi_window_set_size(sink->window, win_width, win_height); diff --git a/sys/vaapisink/gstvaapisink.h b/sys/vaapisink/gstvaapisink.h index 8f27191..d6ff8f3 100644 --- a/sys/vaapisink/gstvaapisink.h +++ b/sys/vaapisink/gstvaapisink.h @@ -62,7 +62,7 @@ struct _GstVaapiSink { gchar *display_name; GstVaapiDisplay *display; GstVaapiWindow *window; - GstVideoRectangle window_rect; + GstVaapiRectangle window_rect; guint fullscreen : 1; }; -- 2.7.4