Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
linphone-desktop
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
linphone-desktop
Commits
7cc5c65c
Commit
7cc5c65c
authored
Jan 31, 2017
by
Ronan Abhamon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(app): video in progress
parent
cfb70bba
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
96 additions
and
95 deletions
+96
-95
CallModel.hpp
linphone-desktop/src/components/call/CallModel.hpp
+4
-0
Camera.cpp
linphone-desktop/src/components/camera/Camera.cpp
+54
-76
Camera.hpp
linphone-desktop/src/components/camera/Camera.hpp
+25
-18
CoreManager.cpp
linphone-desktop/src/components/core/CoreManager.cpp
+3
-0
main.cpp
linphone-desktop/src/main.cpp
+5
-0
Incall.qml
linphone-desktop/ui/views/App/Calls/Incall.qml
+4
-0
linphone
submodules/linphone
+1
-1
No files found.
linphone-desktop/src/components/call/CallModel.hpp
View file @
7cc5c65c
...
...
@@ -34,6 +34,10 @@ public:
CallModel
(
std
::
shared_ptr
<
linphone
::
Call
>
linphone_call
);
~
CallModel
()
=
default
;
std
::
shared_ptr
<
linphone
::
Call
>
getLinphoneCall
()
const
{
return
m_linphone_call
;
}
Q_INVOKABLE
void
accept
();
Q_INVOKABLE
void
acceptWithVideo
();
Q_INVOKABLE
void
terminate
();
...
...
linphone-desktop/src/components/camera/Camera.cpp
View file @
7cc5c65c
#include <QOpenGLFunctions>
#include <QOpenGLTexture>
#include <QtMath>
#include "Camera.hpp"
#define ATTRIBUTE_VERTEX 0
// =============================================================================
static
const
char
*
_vertex_shader
=
"attribute vec2 vertex;"
"uniform mat4 projection;"
"void main() {"
" gl_Position = projection * vec4(vertex.xy, 0, 1);"
"}"
;
static
const
char
*
_fragment_shader
=
"void main() {"
" gl_FragColor = vec4(vec3(1.0, 0.0, 0.0), 1.0);"
"}"
;
static
const
GLfloat
_camera_vertices
[]
=
{
0.0
f
,
0.0
f
,
50.0
f
,
0.0
f
,
0.0
f
,
50.0
f
,
50.0
f
,
50.0
f
};
// -----------------------------------------------------------------------------
struct
CameraStateBinder
{
CameraStateBinder
(
CameraRenderer
*
renderer
)
:
m_renderer
(
renderer
)
{
QOpenGLFunctions
*
f
=
QOpenGLContext
::
currentContext
()
->
functions
();
...
...
@@ -35,14 +16,11 @@ struct CameraStateBinder {
f
->
glDepthFunc
(
GL_LESS
);
f
->
glFrontFace
(
GL_CCW
);
f
->
glCullFace
(
GL_BACK
);
m_renderer
->
m_program
->
bind
();
}
~
CameraStateBinder
()
{
m_renderer
->
m_program
->
release
();
QOpenGLFunctions
*
f
=
QOpenGLContext
::
currentContext
()
->
functions
();
f
->
glDisable
(
GL_CULL_FACE
);
f
->
glDisable
(
GL_DEPTH_TEST
);
}
...
...
@@ -52,72 +30,44 @@ struct CameraStateBinder {
// -----------------------------------------------------------------------------
QOpenGLFramebufferObject
*
CameraRenderer
::
createFramebufferObject
(
const
QSize
&
size
)
{
m_projection
.
setToIdentity
();
m_projection
.
ortho
(
0
,
size
.
width
(),
0
,
size
.
height
(),
-
1
,
1
);
struct
ContextInfo
{
GLuint
width
;
GLuint
height
;
};
// -----------------------------------------------------------------------------
CameraRenderer
::
CameraRenderer
(
const
Camera
*
camera
)
:
m_camera
(
camera
)
{}
QOpenGLFramebufferObject
*
CameraRenderer
::
createFramebufferObject
(
const
QSize
&
size
)
{
QOpenGLFramebufferObjectFormat
format
;
format
.
setAttachment
(
QOpenGLFramebufferObject
::
CombinedDepthStencil
);
format
.
setSamples
(
4
);
ContextInfo
*
context_info
=
m_camera
->
m_context_info
;
context_info
->
width
=
size
.
width
();
context_info
->
height
=
size
.
height
();
shared_ptr
<
linphone
::
Call
>
linphone_call
=
m_camera
->
m_call
->
getLinphoneCall
();
linphone
::
CallState
state
=
linphone_call
->
getState
();
if
(
state
==
linphone
::
CallStateConnected
||
state
==
linphone
::
CallStateStreamsRunning
)
linphone_call
->
setNativeVideoWindowId
(
context_info
);
return
new
QOpenGLFramebufferObject
(
size
,
format
);
}
void
CameraRenderer
::
render
()
{
init
();
m_vao
.
bind
();
CameraStateBinder
state
(
this
);
QOpenGLFunctions
*
f
=
QOpenGLContext
::
currentContext
()
->
functions
();
f
->
glClearColor
(
0.
f
,
0.
f
,
0.
f
,
1.
f
);
f
->
glClear
(
GL_COLOR_BUFFER_BIT
|
GL_DEPTH_BUFFER_BIT
);
m_program
->
setUniformValue
(
m_projection_loc
,
m_projection
);
// Draw.
f
->
glDrawArrays
(
GL_TRIANGLE_STRIP
,
0
,
4
);
m_vao
.
release
();
}
void
CameraRenderer
::
init
()
{
if
(
m_inited
)
return
;
m_inited
=
true
;
initProgram
();
initBuffer
();
}
void
CameraRenderer
::
initBuffer
()
{
QOpenGLVertexArrayObject
::
Binder
vaoBinder
(
&
m_vao
);
m_vbo
.
create
();
m_vbo
.
bind
();
m_vbo
.
allocate
(
&
_camera_vertices
,
sizeof
_camera_vertices
);
m_camera
->
getCall
()
->
getLinphoneCall
()
->
oglRender
();
m_vbo
.
bind
();
QOpenGLFunctions
*
f
=
QOpenGLContext
::
currentContext
()
->
functions
();
f
->
glEnableVertexAttribArray
(
ATTRIBUTE_VERTEX
);
f
->
glVertexAttribPointer
(
ATTRIBUTE_VERTEX
,
2
,
GL_FLOAT
,
GL_FALSE
,
0
,
0
);
m_vbo
.
release
();
}
void
CameraRenderer
::
initProgram
()
{
m_program
.
reset
(
new
QOpenGLShaderProgram
());
m_program
->
addShaderFromSourceCode
(
QOpenGLShader
::
Vertex
,
_vertex_shader
);
m_program
->
addShaderFromSourceCode
(
QOpenGLShader
::
Fragment
,
_fragment_shader
);
m_program
->
bindAttributeLocation
(
"vertex"
,
ATTRIBUTE_VERTEX
);
m_program
->
link
();
m_projection_loc
=
m_program
->
uniformLocation
(
"projection"
);
update
();
}
// -----------------------------------------------------------------------------
...
...
@@ -125,10 +75,16 @@ void CameraRenderer::initProgram () {
Camera
::
Camera
(
QQuickItem
*
parent
)
:
QQuickFramebufferObject
(
parent
)
{
setAcceptHoverEvents
(
true
);
setAcceptedMouseButtons
(
Qt
::
LeftButton
|
Qt
::
RightButton
);
m_context_info
=
new
ContextInfo
();
}
Camera
::~
Camera
()
{
delete
m_context_info
;
}
QQuickFramebufferObject
::
Renderer
*
Camera
::
createRenderer
()
const
{
return
new
CameraRenderer
();
return
new
CameraRenderer
(
this
);
}
void
Camera
::
hoverMoveEvent
(
QHoverEvent
*
)
{}
...
...
@@ -138,3 +94,25 @@ void Camera::mousePressEvent (QMouseEvent *) {
}
void
Camera
::
keyPressEvent
(
QKeyEvent
*
)
{}
// -----------------------------------------------------------------------------
CallModel
*
Camera
::
getCall
()
const
{
return
m_call
;
}
void
Camera
::
setCall
(
CallModel
*
call
)
{
if
(
m_call
!=
call
)
{
if
(
call
)
{
shared_ptr
<
linphone
::
Call
>
linphone_call
=
call
->
getLinphoneCall
();
linphone
::
CallState
state
=
linphone_call
->
getState
();
if
(
state
==
linphone
::
CallStateConnected
||
state
==
linphone
::
CallStateStreamsRunning
)
linphone_call
->
setNativeVideoWindowId
(
m_context_info
);
}
m_call
=
call
;
emit
callChanged
(
call
);
}
}
linphone-desktop/src/components/camera/Camera.hpp
View file @
7cc5c65c
#ifndef CAMERA_H_
#define CAMERA_H_
#include <QOpenGLBuffer>
#include <QOpenGLFramebufferObject>
#include <QOpenGLShaderProgram>
#include <QOpenGLVertexArrayObject>
#include <QQuickFramebufferObject>
#include "../call/CallModel.hpp"
// =============================================================================
class
Camera
Renderer
:
public
QQuickFramebufferObject
::
Renderer
{
friend
struct
CameraStateBinder
;
class
Camera
;
struct
ContextInfo
;
class
CameraRenderer
:
public
QQuickFramebufferObject
::
Renderer
{
public:
CameraRenderer
(
const
Camera
*
camera
);
~
CameraRenderer
()
=
default
;
QOpenGLFramebufferObject
*
createFramebufferObject
(
const
QSize
&
size
)
override
;
void
render
()
override
;
private:
void
init
();
void
initBuffer
();
void
initProgram
();
bool
m_inited
=
false
;
QMatrix4x4
m_projection
;
int
m_projection_loc
;
QOpenGLVertexArrayObject
m_vao
;
QOpenGLBuffer
m_vbo
;
QScopedPointer
<
QOpenGLShaderProgram
>
m_program
;
const
Camera
*
m_camera
;
};
// -----------------------------------------------------------------------------
class
Camera
:
public
QQuickFramebufferObject
{
friend
class
CameraRenderer
;
Q_OBJECT
;
Q_PROPERTY
(
CallModel
*
call
READ
getCall
WRITE
setCall
NOTIFY
callChanged
);
public:
Camera
(
QQuickItem
*
parent
=
Q_NULLPTR
);
~
Camera
()
=
default
;
~
Camera
();
QQuickFramebufferObject
::
Renderer
*
createRenderer
()
const
override
;
signals:
void
callChanged
(
CallModel
*
call
);
protected:
void
hoverMoveEvent
(
QHoverEvent
*
event
)
override
;
void
mousePressEvent
(
QMouseEvent
*
event
)
override
;
void
keyPressEvent
(
QKeyEvent
*
event
)
override
;
private:
CallModel
*
getCall
()
const
;
void
setCall
(
CallModel
*
call
);
CallModel
*
m_call
=
nullptr
;
ContextInfo
*
m_context_info
;
};
#endif // CAMERA_H_
linphone-desktop/src/components/core/CoreManager.cpp
View file @
7cc5c65c
...
...
@@ -12,6 +12,9 @@ CoreManager *CoreManager::m_instance = nullptr;
CoreManager
::
CoreManager
(
QObject
*
parent
)
:
QObject
(
parent
),
m_handlers
(
make_shared
<
CoreHandlers
>
())
{
m_core
=
linphone
::
Factory
::
get
()
->
createCore
(
m_handlers
,
Paths
::
getConfigFilepath
(),
""
);
m_core
->
setVideoDisplayFilter
(
"MSOGL"
);
setDatabasesPaths
();
}
...
...
linphone-desktop/src/main.cpp
View file @
7cc5c65c
...
...
@@ -6,6 +6,11 @@
int
main
(
int
argc
,
char
*
argv
[])
{
Logger
::
init
();
// Force shader version 2.0.
QSurfaceFormat
fmt
;
fmt
.
setVersion
(
2
,
0
);
QSurfaceFormat
::
setDefaultFormat
(
fmt
);
QGuiApplication
::
setAttribute
(
Qt
::
AA_EnableHighDpiScaling
);
App
::
init
(
argc
,
argv
);
...
...
linphone-desktop/ui/views/App/Calls/Incall.qml
View file @
7cc5c65c
...
...
@@ -128,6 +128,8 @@ Rectangle {
Item
{
id
:
container
property
var
_call
:
call
Layout.fillWidth
:
true
Layout.fillHeight
:
true
Layout.margins
:
CallStyle
.
container
.
margins
...
...
@@ -180,11 +182,13 @@ Rectangle {
Camera
{
height
:
container
.
height
width
:
container
.
width
call
:
container
.
_call
}
}
Loader
{
anchors.centerIn
:
parent
sourceComponent
:
call
.
videoInputEnabled
?
camera
:
avatar
}
}
...
...
linphone
@
75cd64d0
Subproject commit
94bbd063687d7ace6d441dc2b9f1365514d1bf3c
Subproject commit
75cd64d0bc04a8b38dfae2b2b6cdd0299607deef
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