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
d1e35053
Commit
d1e35053
authored
Mar 22, 2012
by
Pierre-Eric Pelloux-Prayer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
video: various iOS fix
parent
4004034d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
34 additions
and
30 deletions
+34
-30
ioscapture.m
src/ioscapture.m
+12
-3
iosdisplay.m
src/iosdisplay.m
+18
-24
videostream.c
src/videostream.c
+4
-3
No files found.
src/ioscapture.m
View file @
d1e35053
...
...
@@ -214,7 +214,7 @@ didOutputSampleBuffer:(CMSampleBufferRef) sampleBuffer
dispatch_release
(
queue
);
captureVideoPreviewLayer
=
[[
AVCaptureVideoPreviewLayer
alloc
]
initWithSession
:
session
];
captureVideoPreviewLayer
.
videoGravity
=
AVLayerVideoGravityResizeAspectFill
;
captureVideoPreviewLayer
.
orientation
=
AVCaptureVideoOrientationPortrait
;
//AVCaptureVideoOrientationLandscapeRight;
captureVideoPreviewLayer
.
orientation
=
AVCaptureVideoOrientationPortrait
;
start_time
=
0
;
frame_count
=-
1
;
fps
=
0
;
...
...
@@ -449,8 +449,6 @@ static int v4ios_set_device_orientation (MSFilter *f, void *arg) {
if
(
webcam
->
mDeviceOrientation
!=
*
(
int
*
)(
arg
))
{
webcam
->
mDeviceOrientation
=
*
(
int
*
)(
arg
);
[
webcam
setSize
:
webcam
->
mOutputVideoSize
];
//to update size from orientation
//if ([webcam->captureVideoPreviewLayer isOrientationSupported])
// webcam->captureVideoPreviewLayer.orientation = devideOrientation2AVCaptureVideoOrientation(webcam->mDeviceOrientation);
ms_mutex_lock
(
&
webcam
->
mutex
);
if
(
webcam
->
msframe
)
{
// delete frame if any
...
...
@@ -462,6 +460,16 @@ static int v4ios_set_device_orientation (MSFilter *f, void *arg) {
return
0
;
}
/* this method is used to display the preview with correct orientation */
static
int
v4ios_set_device_orientation_display
(
MSFilter
*
f
,
void
*
arg
)
{
IOSMsWebCam
*
webcam
=
(
IOSMsWebCam
*
)
f
->
data
;
if
([
webcam
->
captureVideoPreviewLayer
isOrientationSupported
])
webcam
->
captureVideoPreviewLayer
.
orientation
=
devideOrientation2AVCaptureVideoOrientation
(
webcam
->
mDeviceOrientation
);
return
0
;
}
static
MSFilterMethod
methods
[]
=
{
{
MS_FILTER_SET_FPS
,
v4ios_set_fps
},
{
MS_FILTER_GET_FPS
,
v4ios_get_fps
},
...
...
@@ -471,6 +479,7 @@ static MSFilterMethod methods[]={
{
MS_VIDEO_DISPLAY_SET_NATIVE_WINDOW_ID
,
v4ios_set_native_window
},
//preview is managed by capture filter
{
MS_VIDEO_DISPLAY_GET_NATIVE_WINDOW_ID
,
v4ios_get_native_window
},
{
MS_VIDEO_CAPTURE_SET_DEVICE_ORIENTATION
,
v4ios_set_device_orientation
},
{
MS_VIDEO_DISPLAY_SET_DEVICE_ORIENTATION
,
v4ios_set_device_orientation_display
},
{
0
,
NULL
}
};
...
...
src/iosdisplay.m
View file @
d1e35053
...
...
@@ -101,26 +101,28 @@
return
;
@synchronized
(
self
)
{
if
(
!
[
EAGLContext
setCurrentContext
:
context
])
{
ms_error
(
"Failed to bind GL context"
);
return
;
}
glBindFramebuffer
(
GL_FRAMEBUFFER
,
defaultFrameBuffer
);
if
(
!
[
EAGLContext
setCurrentContext
:
context
])
{
ms_error
(
"Failed to bind GL context"
);
return
;
}
[
self
updateRenderStorageIfNeeded
];
glBindFramebuffer
(
GL_FRAMEBUFFER
,
defaultFrameBuffer
);
if
(
!
glInitDone
)
{
glClear
(
GL_COLOR_BUFFER_BIT
);
}
else
{
ogl_display_render
(
helper
,
deviceRotation
);
}
if
(
!
glInitDone
)
{
glClear
(
GL_COLOR_BUFFER_BIT
);
}
else
{
ogl_display_render
(
helper
,
deviceRotation
);
}
glBindRenderbuffer
(
GL_RENDERBUFFER
,
colorRenderBuffer
);
glBindRenderbuffer
(
GL_RENDERBUFFER
,
colorRenderBuffer
);
[
context
presentRenderbuffer
:
GL_RENDERBUFFER
];
[
context
presentRenderbuffer
:
GL_RENDERBUFFER
];
}
}
-
(
void
)
layoutSubviews
-
(
void
)
updateRenderStorageIfNeeded
{
@synchronized
(
self
)
{
if
(
!
(
allocatedW
==
self
.
superview
.
frame
.
size
.
width
&&
allocatedH
==
self
.
superview
.
frame
.
size
.
height
))
{
...
...
@@ -147,8 +149,6 @@
glClear
(
GL_COLOR_BUFFER_BIT
);
}
}
else
{
ogl_display_init
(
helper
,
self
.
superview
.
frame
.
size
.
width
,
self
.
superview
.
frame
.
size
.
height
);
}
}
glInitDone
=
TRUE
;
...
...
@@ -164,8 +164,7 @@
// add to new parent
[
self
.
imageView
addSubview
:
self
];
}
// handle GL/view interaction
[
self
layoutSubviews
];
// schedule rendering
displayLink
=
[
self
.
window
.
screen
displayLinkWithTarget
:
self
selector
:
@selector
(
drawView
:
)];
[
displayLink
setFrameInterval
:
4
];
...
...
@@ -181,8 +180,6 @@
[
displayLink
release
];
displayLink
=
nil
;
animating
=
FALSE
;
[
self
removeFromSuperview
];
}
}
...
...
@@ -192,10 +189,7 @@
}
static
void
iosdisplay_init
(
MSFilter
*
f
){
//IOSDisplay* thiz = [[IOSDisplay alloc] init];
//[thiz initGlRendering];
//f->data = thiz;
//f->data = nil;
}
-
(
void
)
dealloc
{
[
EAGLContext
setCurrentContext
:
context
];
...
...
src/videostream.c
View file @
d1e35053
...
...
@@ -641,14 +641,15 @@ void video_stream_use_preview_video_window(VideoStream *stream, bool_t yesno){
void
video_stream_set_device_rotation
(
VideoStream
*
stream
,
int
orientation
){
MSFilter
*
target_filter
;
if
(
stream
==
0
)
return
;
stream
->
device_orientation
=
orientation
;
target_filter
=
stream
->
source
;
if
(
target_filter
){
ms_filter_call_method
(
target_filter
,
MS_VIDEO_CAPTURE_SET_DEVICE_ORIENTATION
,
&
orientation
);
// The below code may look weird so I'll add a bit of documentation
if
(
!
stream
->
display_filter_auto_rotate_enabled
)
ms_filter_call_method
(
target_filter
,
MS_VIDEO_DISPLAY_SET_DEVICE_ORIENTATION
,
&
orientation
);
}
if
(
stream
->
output
&&
stream
->
display_filter_auto_rotate_enabled
)
{
ms_filter_call_method
(
stream
->
output
,
MS_VIDEO_DISPLAY_SET_DEVICE_ORIENTATION
,
&
orientation
);
...
...
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