mirror of
https://git.jami.net/savoirfairelinux/jami-client-qt.git
synced 2025-09-10 12:03:18 +02:00
callmodel: remove deprecated switchInput
The only missing case were for changing the current default camera. Other methods can be removed. Change-Id: I91fce779f4a41fe4d667444aea57b1b454aa702b GitLab: #651
This commit is contained in:
parent
ae4aed0532
commit
a374f8cf67
3 changed files with 37 additions and 95 deletions
|
@ -271,7 +271,7 @@ VideoDevices::setDefaultDevice(int index, bool useSourceModel)
|
|||
lrcInstance_->avModel().setDefaultDevice(deviceId);
|
||||
|
||||
if (!callId.isEmpty())
|
||||
lrcInstance_->getCurrentCallModel()->switchInputTo(deviceId, callId);
|
||||
lrcInstance_->getCurrentCallModel()->replaceDefaultCamera(callId, deviceId);
|
||||
|
||||
updateData();
|
||||
}
|
||||
|
@ -455,37 +455,18 @@ VideoDevices::onVideoDeviceEvent()
|
|||
deviceEvent = DeviceEvent::Removed;
|
||||
}
|
||||
|
||||
auto cb = [this, currentDeviceListSize, deviceEvent, defaultDevice, callId] {
|
||||
auto& avModel = lrcInstance_->avModel();
|
||||
auto* callModel = lrcInstance_->getCurrentCallModel();
|
||||
if (currentDeviceListSize == 0) {
|
||||
callModel->switchInputTo({}, callId);
|
||||
avModel.stopPreview(this->getDefaultDevice());
|
||||
} else if (deviceEvent == DeviceEvent::Removed) {
|
||||
callModel->switchInputTo(defaultDevice, callId);
|
||||
}
|
||||
|
||||
updateData();
|
||||
Q_EMIT deviceListChanged(currentDeviceListSize);
|
||||
};
|
||||
|
||||
if (deviceEvent == DeviceEvent::Added) {
|
||||
updateData();
|
||||
Q_EMIT deviceListChanged(currentDeviceListSize);
|
||||
} else if (deviceEvent == DeviceEvent::FirstDevice) {
|
||||
updateData();
|
||||
|
||||
if (callId.isEmpty()) {
|
||||
if (callId.isEmpty())
|
||||
Q_EMIT deviceAvailable();
|
||||
} else {
|
||||
callModel->switchInputTo(defaultDevice, callId);
|
||||
}
|
||||
|
||||
Q_EMIT deviceListChanged(currentDeviceListSize);
|
||||
} else if (deviceOpen_) {
|
||||
updateData();
|
||||
} else {
|
||||
cb();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -374,22 +374,7 @@ public:
|
|||
*/
|
||||
video::RenderedDevice getCurrentRenderedDevice(const QString& call_id) const;
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* Render a file to the call id specified
|
||||
* @param uri the path of the file
|
||||
* @param callId
|
||||
* @note callId can be omitted to switch the input of the local recorder
|
||||
*/
|
||||
void setInputFile(const QString& uri, const QString& callId = {});
|
||||
/**
|
||||
* Change the current device rendered for the call id specified
|
||||
* @param id of the camera
|
||||
* @param callId
|
||||
* @note renders a black frame if device not found or empty
|
||||
* @note callId can be omitted to switch the input of the local recorder
|
||||
*/
|
||||
void switchInputTo(const QString& id, const QString& callId = {});
|
||||
void replaceDefaultCamera(const QString& callId, const QString& deviceId);
|
||||
/**
|
||||
* Get the current display resource string
|
||||
* @param idx of the display
|
||||
|
@ -404,18 +389,8 @@ public:
|
|||
* @param windowId
|
||||
*/
|
||||
QString getDisplay(const QString& windowId);
|
||||
/**
|
||||
* @deprecated
|
||||
* Render the current display to the call id specified
|
||||
* @param idx of the display
|
||||
* @param x top left of the area
|
||||
* @param y top up of the area
|
||||
* @param w width of the area
|
||||
* @param h height of the area
|
||||
* @param callId
|
||||
* @note callId can be omitted to switch the input of the local recorder
|
||||
*/
|
||||
void setDisplay(int idx, int x, int y, int w, int h, const QString& callId = {});
|
||||
|
||||
void emplaceConversationConference(const QString& callId);
|
||||
Q_SIGNALS:
|
||||
|
||||
/**
|
||||
|
|
|
@ -419,6 +419,38 @@ CallModel::muteMedia(const QString& callId, const QString& label, bool mute)
|
|||
CallManager::instance().requestMediaChange(owner.id, callId, proposedList);
|
||||
}
|
||||
|
||||
void
|
||||
CallModel::replaceDefaultCamera(const QString& callId, const QString& deviceId)
|
||||
{
|
||||
auto& callInfo = pimpl_->calls[callId];
|
||||
if (!callInfo)
|
||||
return;
|
||||
|
||||
VectorMapStringString proposedList = callInfo->mediaList;
|
||||
QString oldPreview, newPreview;
|
||||
for (auto& media : proposedList) {
|
||||
if (media[MediaAttributeKey::MEDIA_TYPE] == MediaAttributeValue::VIDEO
|
||||
&& media[MediaAttributeKey::SOURCE].startsWith(
|
||||
DRing::Media::VideoProtocolPrefix::CAMERA)) {
|
||||
oldPreview = media[MediaAttributeKey::SOURCE];
|
||||
QString resource = QString("%1%2%3")
|
||||
.arg(DRing::Media::VideoProtocolPrefix::CAMERA)
|
||||
.arg(DRing::Media::VideoProtocolPrefix::SEPARATOR)
|
||||
.arg(deviceId);
|
||||
media[MediaAttributeKey::SOURCE] = resource;
|
||||
newPreview = resource;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!newPreview.isEmpty()) {
|
||||
pimpl_->lrc.getAVModel().stopPreview(oldPreview);
|
||||
pimpl_->lrc.getAVModel().startPreview(newPreview);
|
||||
}
|
||||
|
||||
CallManager::instance().requestMediaChange(owner.id, callId, proposedList);
|
||||
}
|
||||
|
||||
void
|
||||
CallModel::addMedia(const QString& callId, const QString& source, MediaRequestType type, bool mute)
|
||||
{
|
||||
|
@ -840,22 +872,6 @@ CallModel::getCurrentRenderedDevice(const QString& call_id) const
|
|||
return result;
|
||||
}
|
||||
|
||||
void
|
||||
CallModel::setInputFile(const QString& uri, const QString& callId)
|
||||
{
|
||||
QString sep = DRing::Media::VideoProtocolPrefix::SEPARATOR;
|
||||
auto resource = !uri.isEmpty() ? QString("%1%2%3")
|
||||
.arg(DRing::Media::VideoProtocolPrefix::FILE)
|
||||
.arg(sep)
|
||||
.arg(QUrl(uri).toLocalFile())
|
||||
: DRing::Media::VideoProtocolPrefix::NONE;
|
||||
if (callId.isEmpty()) {
|
||||
VideoManager::instance().openVideoInput(resource);
|
||||
} else {
|
||||
CallManager::instance().switchInput(owner.id, callId, resource);
|
||||
}
|
||||
}
|
||||
|
||||
QString
|
||||
CallModel::getDisplay(int idx, int x, int y, int w, int h)
|
||||
{
|
||||
|
@ -880,36 +896,6 @@ CallModel::getDisplay(const QString& windowId)
|
|||
.arg(windowId);
|
||||
}
|
||||
|
||||
void
|
||||
CallModel::setDisplay(int idx, int x, int y, int w, int h, const QString& callId)
|
||||
{
|
||||
auto resource = getDisplay(idx, x, y, w, h);
|
||||
if (callId.isEmpty()) {
|
||||
VideoManager::instance().openVideoInput(resource);
|
||||
} else {
|
||||
CallManager::instance().switchInput(owner.id, callId, resource);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
CallModel::switchInputTo(const QString& id, const QString& callId)
|
||||
{
|
||||
QString resource;
|
||||
auto devices = pimpl_->lrc.getAVModel().getDevices();
|
||||
auto deviceAvailable = std::find(std::begin(devices), std::end(devices), id);
|
||||
if (deviceAvailable != devices.end()) {
|
||||
QString sep = DRing::Media::VideoProtocolPrefix::SEPARATOR;
|
||||
resource = QString("%1%2%3").arg(DRing::Media::VideoProtocolPrefix::CAMERA).arg(sep).arg(id);
|
||||
} else {
|
||||
resource = QString(DRing::Media::VideoProtocolPrefix::NONE);
|
||||
}
|
||||
if (callId.isEmpty()) {
|
||||
VideoManager::instance().openVideoInput(resource);
|
||||
} else {
|
||||
CallManager::instance().switchInput(owner.id, callId, resource);
|
||||
}
|
||||
}
|
||||
|
||||
CallModelPimpl::CallModelPimpl(const CallModel& linked,
|
||||
Lrc& lrc,
|
||||
const CallbacksHandler& callbacksHandler,
|
||||
|
|
Loading…
Add table
Reference in a new issue