{
GstVaapiSink * const sink = GST_VAAPISINK(base_sink);
GstStructure * const structure = gst_caps_get_structure(caps, 0);
- GstVaapiRectangle * const win_rect = &sink->window_rect;
+ GstVaapiRectangle * const disp_rect = &sink->display_rect;
guint num, den;
guint win_width, win_height;
guint display_width, display_height, display_par_n, display_par_d;
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;
+ disp_rect->x = (display_width - win_width) / 2;
+ disp_rect->y = (display_height - win_height) / 2;
}
else {
- win_rect->x = 0;
- win_rect->y = 0;
+ disp_rect->x = 0;
+ disp_rect->y = 0;
}
- win_rect->width = win_width;
- win_rect->height = win_height;
+ disp_rect->width = win_width;
+ disp_rect->height = win_height;
if (sink->window)
gst_vaapi_window_set_size(sink->window, win_width, win_height);
else {
+ if (sink->fullscreen) {
+ win_width = display_width;
+ win_height = display_height;
+ }
if (!gst_vaapisink_ensure_window(sink, win_width, win_height))
return FALSE;
gst_vaapi_window_set_fullscreen(sink->window, sink->fullscreen);
gst_vaapi_window_show(sink->window);
}
+ sink->window_width = win_width;
+ sink->window_height = win_height;
return TRUE;
}
<http://cgit.freedesktop.org/~macslow/gl-gst-player/> */
GLfloat fStartX = 0.0f;
GLfloat fStartY = 0.0f;
- GLfloat fWidth = (GLfloat)sink->window_rect.width;
- GLfloat fHeight = (GLfloat)sink->window_rect.height;
+ GLfloat fWidth = (GLfloat)sink->window_width;
+ GLfloat fHeight = (GLfloat)sink->window_height;
glClear(GL_COLOR_BUFFER_BIT);
glBegin(GL_QUADS);
static void
render_frame(GstVaapiSink *sink)
{
- const guint w = sink->window_rect.width;
- const guint h = sink->window_rect.height;
+ const guint w = sink->window_width;
+ const guint h = sink->window_height;
glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
glBegin(GL_QUADS);
static void
render_reflection(GstVaapiSink *sink)
{
- const guint w = sink->window_rect.width;
- const guint h = sink->window_rect.height;
+ const guint w = sink->window_width;
+ const guint h = sink->window_height;
const guint rh = h / 5;
GLfloat ry = 1.0f - (GLfloat)rh / (GLfloat)h;
if (!sink->use_reflection)
return gst_vaapi_window_glx_put_texture(window, sink->texture,
- NULL, &sink->window_rect);
+ NULL, &sink->display_rect);
target = gst_vaapi_texture_get_target(sink->texture);
texture = gst_vaapi_texture_get_id(sink->texture);
glTranslatef(50.0f, 0.0f, 0.0f);
render_frame(sink);
glPushMatrix();
- glTranslatef(0.0, (GLfloat)sink->window_rect.height + 5.0f, 0.0f);
+ glTranslatef(0.0, (GLfloat)sink->window_height + 5.0f, 0.0f);
render_reflection(sink);
glPopMatrix();
glPopMatrix();
#endif
if (!gst_vaapi_window_put_surface(sink->window, surface,
- NULL, &sink->window_rect, flags)) {
+ NULL, &sink->display_rect, flags)) {
GST_DEBUG("could not render VA surface");
return GST_FLOW_UNEXPECTED;
}
sink->display_name = NULL;
sink->display = NULL;
sink->window = NULL;
+ sink->window_width = 0;
+ sink->window_height = 0;
sink->texture = NULL;
sink->video_width = 0;
sink->video_height = 0;