Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
mediastreamer2
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
3
Issues
3
List
Board
Labels
Milestones
Merge Requests
7
Merge Requests
7
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
External Wiki
External Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
BC
public
mediastreamer2
Commits
55a90c37
Commit
55a90c37
authored
Mar 14, 2012
by
Pierre-Eric Pelloux-Prayer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ios: handle video parent view change properly (resize GL view)
parent
98b7e61d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
22 deletions
+24
-22
iosdisplay.h
src/iosdisplay.h
+3
-3
iosdisplay.m
src/iosdisplay.m
+19
-18
opengles_display.c
src/opengles_display.c
+2
-1
No files found.
src/iosdisplay.h
View file @
55a90c37
...
...
@@ -35,12 +35,12 @@
GLuint
defaultFrameBuffer
,
colorRenderBuffer
;
struct
opengles_display
*
helper
;
BOOL
glInitDone
;
BOOL
storageAllocationDone
;
BOOL
glInitDone
;
id
displayLink
;
BOOL
animating
;
int
allocatedW
,
allocatedH
;
}
-
(
void
)
drawView
:
(
id
)
sender
;
...
...
src/iosdisplay.m
View file @
55a90c37
...
...
@@ -90,7 +90,7 @@
[
EAGLContext
setCurrentContext
:
nil
];
glInitDone
=
FALSE
;
storageAllocationDone
=
FALSE
;
allocatedW
=
allocatedH
=
0
;
}
-
(
void
)
drawView
:
(
id
)
sender
...
...
@@ -125,24 +125,27 @@
-
(
void
)
layoutSubviews
{
if
(
!
storageAllocationDone
)
{
if
(
!
(
allocatedW
==
self
.
superview
.
frame
.
size
.
width
&&
allocatedH
==
self
.
superview
.
frame
.
size
.
height
)
)
{
[
EAGLContext
setCurrentContext
:
context
];
int
width
,
height
;
glBindRenderbuffer
(
GL_RENDERBUFFER
,
colorRenderBuffer
);
CAEAGLLayer
*
layer
=
(
CAEAGLLayer
*
)
self
.
layer
;
if
(
allocatedW
!=
0
||
allocatedH
!=
0
)
{
// release previously allocated storage
[
context
renderbufferStorage
:
GL_RENDERBUFFER
fromDrawable
:
nil
];
}
// allocate storage
if
(
!
[
context
renderbufferStorage
:
GL_RENDERBUFFER
fromDrawable
:
layer
])
{
NSLog
(
@"Error in renderbufferStorage"
);
}
glGetRenderbufferParameteriv
(
GL_RENDERBUFFER
,
GL_RENDERBUFFER_WIDTH
,
&
width
);
glGetRenderbufferParameteriv
(
GL_RENDERBUFFER
,
GL_RENDERBUFFER_HEIGHT
,
&
height
);
storageAllocationDone
=
TRUE
;
}
else
{
glGetRenderbufferParameteriv
(
GL_RENDERBUFFER
,
GL_RENDERBUFFER_WIDTH
,
&
allocatedW
);
glGetRenderbufferParameteriv
(
GL_RENDERBUFFER
,
GL_RENDERBUFFER_HEIGHT
,
&
allocatedH
);
ms_message
(
"GL renderbuffer allocation size: %dx%d"
,
allocatedW
,
allocatedH
);
ogl_display_init
(
helper
,
self
.
superview
.
frame
.
size
.
width
,
self
.
superview
.
frame
.
size
.
height
);
ogl_display_init
(
helper
,
self
.
superview
.
frame
.
size
.
width
,
self
.
superview
.
frame
.
size
.
height
);
glClear
(
GL_COLOR_BUFFER_BIT
);
//ogl_display_init(helper, width, height);
glClear
(
GL_COLOR_BUFFER_BIT
);
}
}
else
{
ogl_display_init
(
helper
,
self
.
superview
.
frame
.
size
.
width
,
self
.
superview
.
frame
.
size
.
height
);
}
...
...
@@ -159,13 +162,11 @@
// add to new parent
[
self
.
imageView
addSubview
:
self
];
}
// we use a square view, so we need to offset it
// the GL code draws in the bottom-left corner
// handle GL/view interaction
[
self
layoutSubviews
];
// schedule rendering
displayLink
=
[
self
.
window
.
screen
displayLinkWithTarget
:
self
selector
:
@selector
(
drawView
:
)];
[
displayLink
setFrameInterval
:
4
];
[
displayLink
addToRunLoop
:[
NSRunLoop
currentRunLoop
]
forMode
:
NSDefaultRunLoopMode
];
animating
=
TRUE
;
}
...
...
@@ -216,7 +217,6 @@ static void iosdisplay_process(MSFilter *f){
ogl_display_set_yuv_to_display
(
thiz
->
helper
,
m
);
}
ms_queue_flush
(
f
->
inputs
[
0
]);
if
(
f
->
inputs
[
1
])
ms_queue_flush
(
f
->
inputs
[
1
]);
...
...
@@ -242,6 +242,7 @@ static int iosdisplay_set_native_window(MSFilter *f, void *arg) {
if
(
f
->
data
!=
nil
)
{
NSLog
(
@"OpenGL view parent changed."
);
thiz
=
f
->
data
;
thiz
.
frame
=
CGRectMake
(
0
,
0
,
parentView
.
frame
.
size
.
width
,
parentView
.
frame
.
size
.
height
);
[
thiz
performSelectorOnMainThread
:
@selector
(
stopRendering
:)
withObject
:
nil
waitUntilDone
:
NO
];
}
else
if
(
parentView
==
nil
)
{
return
0
;
...
...
src/opengles_display.c
View file @
55a90c37
...
...
@@ -298,7 +298,8 @@ static void ogl_display_render_type(struct opengles_display* gldisp, enum ImageT
void
ogl_display_render
(
struct
opengles_display
*
gldisp
,
int
orientation
)
{
ogl_display_render_type
(
gldisp
,
REMOTE_IMAGE
,
TRUE
,
0
,
0
,
1
,
1
,
orientation
);
ogl_display_render_type
(
gldisp
,
PREVIEW_IMAGE
,
FALSE
,
0
.
8
f
,
0
.
0
f
,
0
.
2
f
,
0
.
2
f
,
orientation
);
// preview image already have the correct orientation
ogl_display_render_type
(
gldisp
,
PREVIEW_IMAGE
,
FALSE
,
0
.
8
f
,
0
.
0
f
,
0
.
2
f
,
0
.
2
f
,
0
);
}
static
void
check_GL_errors
(
const
char
*
context
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment