mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-03-30 12:49:40 +00:00
osxvideosink: fix broken aspect ration and frame drawing region
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4346>
This commit is contained in:
parent
2952caab9c
commit
1ba677abda
1 changed files with 9 additions and 5 deletions
|
@ -370,8 +370,8 @@ const gchar* gst_keycode_to_keyname(gint16 keycode)
|
||||||
|
|
||||||
pi_texture = 0;
|
pi_texture = 0;
|
||||||
data = nil;
|
data = nil;
|
||||||
width = frame.size.width;
|
width = frame.size.width * [[NSScreen mainScreen] backingScaleFactor];
|
||||||
height = frame.size.height;
|
height = frame.size.height * [[NSScreen mainScreen] backingScaleFactor];
|
||||||
drawingBounds = NSMakeRect(0, 0, width, height);
|
drawingBounds = NSMakeRect(0, 0, width, height);
|
||||||
|
|
||||||
GST_LOG ("Width: %d Height: %d", width, height);
|
GST_LOG ("Width: %d Height: %d", width, height);
|
||||||
|
@ -395,7 +395,7 @@ const gchar* gst_keycode_to_keyname(gint16 keycode)
|
||||||
- (void) reshape {
|
- (void) reshape {
|
||||||
NSRect bounds;
|
NSRect bounds;
|
||||||
gdouble frame_par, view_par;
|
gdouble frame_par, view_par;
|
||||||
gint view_height, view_width, c_height, c_width, c_x, c_y;
|
gint view_height, view_width, c_height, c_width, c_x, c_y, scale_factor;
|
||||||
|
|
||||||
[super reshape];
|
[super reshape];
|
||||||
|
|
||||||
|
@ -410,6 +410,7 @@ const gchar* gst_keycode_to_keyname(gint16 keycode)
|
||||||
bounds = [self bounds];
|
bounds = [self bounds];
|
||||||
view_width = bounds.size.width;
|
view_width = bounds.size.width;
|
||||||
view_height = bounds.size.height;
|
view_height = bounds.size.height;
|
||||||
|
scale_factor = [[NSScreen mainScreen] backingScaleFactor];
|
||||||
|
|
||||||
frame_par = (gdouble) width / height;
|
frame_par = (gdouble) width / height;
|
||||||
view_par = (gdouble) view_width / view_height;
|
view_par = (gdouble) view_width / view_height;
|
||||||
|
@ -433,8 +434,8 @@ const gchar* gst_keycode_to_keyname(gint16 keycode)
|
||||||
c_y = (view_height - c_height) / 2;
|
c_y = (view_height - c_height) / 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
drawingBounds = NSMakeRect(c_x, c_y, c_width, c_height);
|
drawingBounds = NSMakeRect(c_x * scale_factor, c_y * scale_factor,
|
||||||
glViewport (c_x, c_y, (GLint) c_width, (GLint) c_height);
|
c_width * scale_factor, c_height * scale_factor);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) initTextures {
|
- (void) initTextures {
|
||||||
|
@ -544,6 +545,9 @@ const gchar* gst_keycode_to_keyname(gint16 keycode)
|
||||||
/* Black background */
|
/* Black background */
|
||||||
glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||||
|
|
||||||
|
glViewport ((GLint) drawingBounds.origin.x, (GLint) drawingBounds.origin.y,
|
||||||
|
(GLint) drawingBounds.size.width, (GLint) drawingBounds.size.height);
|
||||||
|
|
||||||
if (!initDone) {
|
if (!initDone) {
|
||||||
[actualContext flushBuffer];
|
[actualContext flushBuffer];
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in a new issue