Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
savoirfairelinux
jami-libclient
Commits
6791e0bc
Commit
6791e0bc
authored
Oct 28, 2019
by
Andreas Traczyk
Browse files
avmodel: use video device id in video settings
Change-Id: If84646714e9f37e3987230cf86acadc7a0089dc4
parent
cef0d466
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/api/avmodel.h
View file @
6791e0bc
...
...
@@ -85,20 +85,20 @@ public:
std
::
vector
<
std
::
string
>
getDevices
()
const
;
/**
* Retrieve current default video device
* @return current default video device
name
* @return current default video device
id
*/
std
::
string
getDefaultDevice
Name
()
const
;
std
::
string
getDefaultDevice
()
const
;
/**
* Set new default video device
* @param
name
of the device
* @param
id
of the device
*/
void
setDefaultDevice
(
const
std
::
string
&
name
);
void
setDefaultDevice
(
const
std
::
string
&
deviceId
);
/**
* Retrieve current framerate/resolution/etc of a device
* @param
name
of the device
* @param
id
of the device
* @return settings of the device
*/
video
::
Settings
getDeviceSettings
(
const
std
::
string
&
name
)
const
;
video
::
Settings
getDeviceSettings
(
const
std
::
string
&
deviceId
)
const
;
/**
* Set device settings
* @param video::Settings
...
...
@@ -106,10 +106,10 @@ public:
void
setDeviceSettings
(
video
::
Settings
&
settings
);
/**
* Retrieve all framerate/resolution/etc possibilities of a device
* @param
name
of the device
* @param
id
of the device
* @return possibilities of the device
*/
video
::
Capabilities
getDeviceCapabilities
(
const
std
::
string
&
name
)
const
;
video
::
Capabilities
getDeviceCapabilities
(
const
std
::
string
&
deviceId
)
const
;
/**
* Get supported audio managers
...
...
src/api/newvideo.h
View file @
6791e0bc
...
...
@@ -95,6 +95,7 @@ struct Settings
{
Channel
channel
=
""
;
std
::
string
name
=
""
;
std
::
string
id
=
""
;
Framerate
rate
=
0
;
Resolution
size
=
""
;
};
...
...
src/avmodel.cpp
View file @
6791e0bc
/****************************************************************************
* Copyright (C) 2018-2019 Savoir-faire Linux Inc.
*
* Copyright (C) 2018-2019 Savoir-faire Linux Inc. *
* Author: Hugo Lefeuvre <hugo.lefeuvre@savoirfairelinux.com> *
* Author: Sébastien Blin <sebastien.blin@savoirfairelinux.com> *
* *
...
...
@@ -197,28 +197,32 @@ AVModel::getDevices() const
}
std
::
string
AVModel
::
getDefaultDevice
Name
()
const
AVModel
::
getDefaultDevice
()
const
{
QString
name
=
VideoManager
::
instance
().
getDefaultDevice
();
return
name
.
toStdString
();
}
void
AVModel
::
setDefaultDevice
(
const
std
::
string
&
name
)
AVModel
::
setDefaultDevice
(
const
std
::
string
&
deviceId
)
{
VideoManager
::
instance
().
setDefaultDevice
(
name
.
c_str
());
VideoManager
::
instance
().
setDefaultDevice
(
deviceId
.
c_str
());
}
video
::
Settings
AVModel
::
getDeviceSettings
(
const
std
::
string
&
name
)
const
AVModel
::
getDeviceSettings
(
const
std
::
string
&
deviceId
)
const
{
if
(
deviceId
.
empty
())
{
return
video
::
Settings
();
}
MapStringString
settings
=
VideoManager
::
instance
()
.
getSettings
(
name
.
c_str
());
if
(
settings
[
"
name
"
].
toStdString
()
!=
name
)
{
throw
std
::
out_of_range
(
"Device "
+
name
+
" not found"
);
.
getSettings
(
deviceId
.
c_str
());
if
(
settings
[
"
id
"
].
toStdString
()
!=
deviceId
)
{
throw
std
::
out_of_range
(
"Device
'
"
+
deviceId
+
"
'
not found"
);
}
video
::
Settings
result
;
result
.
name
=
settings
[
"name"
].
toStdString
();
result
.
id
=
settings
[
"id"
].
toStdString
();
result
.
channel
=
settings
[
"channel"
].
toStdString
();
result
.
size
=
settings
[
"size"
].
toStdString
();
result
.
rate
=
settings
[
"rate"
].
toFloat
();
...
...
@@ -226,11 +230,11 @@ AVModel::getDeviceSettings(const std::string& name) const
}
video
::
Capabilities
AVModel
::
getDeviceCapabilities
(
const
std
::
string
&
name
)
const
AVModel
::
getDeviceCapabilities
(
const
std
::
string
&
deviceId
)
const
{
// Channel x Resolution x Framerate
QMap
<
QString
,
QMap
<
QString
,
QVector
<
QString
>>>
capabilites
=
VideoManager
::
instance
().
getCapabilities
(
name
.
c_str
());
VideoManager
::
instance
().
getCapabilities
(
deviceId
.
c_str
());
video
::
Capabilities
result
;
for
(
auto
&
channel
:
capabilites
.
toStdMap
())
{
video
::
ResRateList
channelCapabilities
;
...
...
@@ -265,9 +269,10 @@ AVModel::setDeviceSettings(video::Settings& settings)
rate
=
rate
.
left
(
rate
.
length
()
-
1
);
newSettings
[
"channel"
]
=
settings
.
channel
.
c_str
();
newSettings
[
"name"
]
=
settings
.
name
.
c_str
();
newSettings
[
"id"
]
=
settings
.
id
.
c_str
();
newSettings
[
"rate"
]
=
rate
;
newSettings
[
"size"
]
=
settings
.
size
.
c_str
();
VideoManager
::
instance
().
applySettings
(
settings
.
name
.
c_str
(),
newSettings
);
VideoManager
::
instance
().
applySettings
(
settings
.
id
.
c_str
(),
newSettings
);
// If the preview is running, reload it
// doing this during a call will cause re-invite, this is unwanted
...
...
@@ -639,7 +644,7 @@ AVModelPimpl::AVModelPimpl(AVModel& linked, const CallbacksHandler& callbacksHan
try
{
renderers_
.
insert
(
std
::
make_pair
(
video
::
PREVIEW_RENDERER_ID
,
std
::
make_unique
<
video
::
Renderer
>
(
video
::
PREVIEW_RENDERER_ID
,
linked_
.
getDeviceSettings
(
linked_
.
getDefaultDevice
Name
()),
linked_
.
getDeviceSettings
(
linked_
.
getDefaultDevice
()),
""
,
useAVFrame_
)));
}
catch
(
const
std
::
out_of_range
&
e
)
{
...
...
Write
Preview
Supports
Markdown
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