Add GstVaapiPoint & GstVaapiRectangle data structures.

This commit is contained in:
gb 2010-03-22 12:16:47 +00:00
parent dba6645641
commit 873d5b7a04
9 changed files with 101 additions and 31 deletions

View file

@ -11,6 +11,7 @@
<chapter> <chapter>
<title>GStreamer VA-API Plugins Library</title> <title>GStreamer VA-API Plugins Library</title>
<xi:include href="xml/gstvaapitypes.xml"/>
<xi:include href="xml/gstvaapidisplay.xml"/> <xi:include href="xml/gstvaapidisplay.xml"/>
<xi:include href="xml/gstvaapidisplay_x11.xml"/> <xi:include href="xml/gstvaapidisplay_x11.xml"/>
<xi:include href="xml/gstvaapiwindow.xml"/> <xi:include href="xml/gstvaapiwindow.xml"/>

View file

@ -154,6 +154,13 @@ GST_VAAPI_IS_VIDEO_BUFFER_CLASS
GST_VAAPI_VIDEO_BUFFER_GET_CLASS GST_VAAPI_VIDEO_BUFFER_GET_CLASS
</SECTION> </SECTION>
<SECTION>
<FILE>gstvaapitypes</FILE>
<TITLE>Basic data structures</TITLE>
GstVaapiPoint
GstVaapiRectangle
</SECTION>
<SECTION> <SECTION>
<FILE>gstvaapiwindow</FILE> <FILE>gstvaapiwindow</FILE>
<TITLE>GstVaapiWindow</TITLE> <TITLE>GstVaapiWindow</TITLE>

View file

@ -29,6 +29,7 @@ libgstvaapi_source_h = \
gstvaapisubpicture.h \ gstvaapisubpicture.h \
gstvaapisurface.h \ gstvaapisurface.h \
gstvaapisurfacepool.h \ gstvaapisurfacepool.h \
gstvaapitypes.h \
gstvaapivideobuffer.h \ gstvaapivideobuffer.h \
gstvaapivideopool.h \ gstvaapivideopool.h \
gstvaapivideosink.h \ gstvaapivideosink.h \

View file

@ -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 <glib/gtypes.h>
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 */

View file

@ -349,27 +349,27 @@ gst_vaapi_window_set_size(GstVaapiWindow *window, guint width, guint height)
} }
static inline void static inline void
get_surface_rect(GstVaapiSurface *surface, GstVideoRectangle *rect) get_surface_rect(GstVaapiSurface *surface, GstVaapiRectangle *rect)
{ {
guint width, height; guint width, height;
gst_vaapi_surface_get_size(surface, &width, &height); gst_vaapi_surface_get_size(surface, &width, &height);
rect->x = 0; rect->x = 0;
rect->y = 0; rect->y = 0;
rect->w = width; rect->width = width;
rect->h = height; rect->height = height;
} }
static inline void static inline void
get_window_rect(GstVaapiWindow *window, GstVideoRectangle *rect) get_window_rect(GstVaapiWindow *window, GstVaapiRectangle *rect)
{ {
guint width, height; guint width, height;
gst_vaapi_window_get_size(window, &width, &height); gst_vaapi_window_get_size(window, &width, &height);
rect->x = 0; rect->x = 0;
rect->y = 0; rect->y = 0;
rect->w = width; rect->width = width;
rect->h = height; rect->height = height;
} }
/** /**
@ -394,12 +394,12 @@ gboolean
gst_vaapi_window_put_surface( gst_vaapi_window_put_surface(
GstVaapiWindow *window, GstVaapiWindow *window,
GstVaapiSurface *surface, GstVaapiSurface *surface,
const GstVideoRectangle *src_rect, const GstVaapiRectangle *src_rect,
const GstVideoRectangle *dst_rect, const GstVaapiRectangle *dst_rect,
guint flags 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(GST_VAAPI_IS_WINDOW(window), FALSE);
g_return_val_if_fail(window->priv->is_constructed, FALSE); g_return_val_if_fail(window->priv->is_constructed, FALSE);

View file

@ -22,6 +22,7 @@
#define GST_VAAPI_WINDOW_H #define GST_VAAPI_WINDOW_H
#include <gst/video/gstvideosink.h> #include <gst/video/gstvideosink.h>
#include <gst/vaapi/gstvaapitypes.h>
#include <gst/vaapi/gstvaapidisplay.h> #include <gst/vaapi/gstvaapidisplay.h>
#include <gst/vaapi/gstvaapisurface.h> #include <gst/vaapi/gstvaapisurface.h>
@ -92,8 +93,8 @@ struct _GstVaapiWindowClass {
gboolean (*resize) (GstVaapiWindow *window, guint width, guint height); gboolean (*resize) (GstVaapiWindow *window, guint width, guint height);
gboolean (*render) (GstVaapiWindow *window, gboolean (*render) (GstVaapiWindow *window,
GstVaapiSurface *surface, GstVaapiSurface *surface,
const GstVideoRectangle *src_rect, const GstVaapiRectangle *src_rect,
const GstVideoRectangle *dst_rect, const GstVaapiRectangle *dst_rect,
guint flags); guint flags);
}; };
@ -131,8 +132,8 @@ gboolean
gst_vaapi_window_put_surface( gst_vaapi_window_put_surface(
GstVaapiWindow *window, GstVaapiWindow *window,
GstVaapiSurface *surface, GstVaapiSurface *surface,
const GstVideoRectangle *src_rect, const GstVaapiRectangle *src_rect,
const GstVideoRectangle *dst_rect, const GstVaapiRectangle *dst_rect,
guint flags guint flags
); );

View file

@ -279,8 +279,8 @@ static gboolean
gst_vaapi_window_x11_render( gst_vaapi_window_x11_render(
GstVaapiWindow *window, GstVaapiWindow *window,
GstVaapiSurface *surface, GstVaapiSurface *surface,
const GstVideoRectangle *src_rect, const GstVaapiRectangle *src_rect,
const GstVideoRectangle *dst_rect, const GstVaapiRectangle *dst_rect,
guint flags guint flags
) )
{ {
@ -303,12 +303,12 @@ gst_vaapi_window_x11_render(
GST_VAAPI_WINDOW_X11(window)->priv->xid, GST_VAAPI_WINDOW_X11(window)->priv->xid,
src_rect->x, src_rect->x,
src_rect->y, src_rect->y,
src_rect->w, src_rect->width,
src_rect->h, src_rect->height,
dst_rect->x, dst_rect->x,
dst_rect->y, dst_rect->y,
dst_rect->w, dst_rect->width,
dst_rect->h, dst_rect->height,
NULL, 0, NULL, 0,
get_PutSurface_flags_from_GstVaapiSurfaceRenderFlags(flags) get_PutSurface_flags_from_GstVaapiSurfaceRenderFlags(flags)
); );

View file

@ -141,7 +141,7 @@ gst_vaapisink_set_caps(GstBaseSink *base_sink, GstCaps *caps)
{ {
GstVaapiSink * const sink = GST_VAAPISINK(base_sink); GstVaapiSink * const sink = GST_VAAPISINK(base_sink);
GstStructure * const structure = gst_caps_get_structure(caps, 0); 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 num, den;
guint win_width, win_height; guint win_width, win_height;
guint display_width, display_height, display_par_n, display_par_d; 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); GST_DEBUG("window size %ux%u", win_width, win_height);
if (sink->fullscreen) { if (sink->fullscreen) {
win_rect->x = (display_width - win_width) / 2; win_rect->x = (display_width - win_width) / 2;
win_rect->y = (display_height - win_height) / 2; win_rect->y = (display_height - win_height) / 2;
} }
else { else {
win_rect->x = 0; win_rect->x = 0;
win_rect->y = 0; win_rect->y = 0;
} }
win_rect->w = win_width; win_rect->width = win_width;
win_rect->h = win_height; win_rect->height = win_height;
if (sink->window) if (sink->window)
gst_vaapi_window_set_size(sink->window, win_width, win_height); gst_vaapi_window_set_size(sink->window, win_width, win_height);

View file

@ -62,7 +62,7 @@ struct _GstVaapiSink {
gchar *display_name; gchar *display_name;
GstVaapiDisplay *display; GstVaapiDisplay *display;
GstVaapiWindow *window; GstVaapiWindow *window;
GstVideoRectangle window_rect; GstVaapiRectangle window_rect;
guint fullscreen : 1; guint fullscreen : 1;
}; };