Move GroupCallVideoPayload methods inside class.
This commit is contained in:
parent
039509afe7
commit
f7ed3d6b99
@ -57,13 +57,13 @@ GroupCallParticipant::GroupCallParticipant(const tl_object_ptr<telegram_api::gro
|
|||||||
version = call_version;
|
version = call_version;
|
||||||
|
|
||||||
if (participant->video_ != nullptr) {
|
if (participant->video_ != nullptr) {
|
||||||
video_payload = get_group_call_video_payload(participant->video_.get());
|
video_payload = GroupCallVideoPayload(participant->video_.get());
|
||||||
}
|
}
|
||||||
if (participant->presentation_ != nullptr) {
|
if (participant->presentation_ != nullptr) {
|
||||||
if (participant->presentation_->flags_ & telegram_api::groupCallParticipantVideo::AUDIO_SOURCE_MASK) {
|
if (participant->presentation_->flags_ & telegram_api::groupCallParticipantVideo::AUDIO_SOURCE_MASK) {
|
||||||
presentation_audio_source = participant->presentation_->audio_source_;
|
presentation_audio_source = participant->presentation_->audio_source_;
|
||||||
}
|
}
|
||||||
presentation_payload = get_group_call_video_payload(participant->presentation_.get());
|
presentation_payload = GroupCallVideoPayload(participant->presentation_.get());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -259,8 +259,8 @@ td_api::object_ptr<td_api::groupCallParticipant> GroupCallParticipant::get_group
|
|||||||
|
|
||||||
return td_api::make_object<td_api::groupCallParticipant>(
|
return td_api::make_object<td_api::groupCallParticipant>(
|
||||||
td->messages_manager_->get_message_sender_object(dialog_id), audio_source, presentation_audio_source,
|
td->messages_manager_->get_message_sender_object(dialog_id), audio_source, presentation_audio_source,
|
||||||
get_group_call_participant_video_info_object(video_payload),
|
video_payload.get_group_call_participant_video_info_object(),
|
||||||
get_group_call_participant_video_info_object(presentation_payload), about, is_self, is_speaking,
|
presentation_payload.get_group_call_participant_video_info_object(), about, is_self, is_speaking,
|
||||||
get_is_hand_raised(), can_be_muted_for_all_users, can_be_unmuted_for_all_users, can_be_muted_only_for_self,
|
get_is_hand_raised(), can_be_muted_for_all_users, can_be_unmuted_for_all_users, can_be_muted_only_for_self,
|
||||||
can_be_unmuted_only_for_self, get_is_muted_for_all_users(), get_is_muted_locally(), get_is_muted_by_themselves(),
|
can_be_unmuted_only_for_self, get_is_muted_for_all_users(), get_is_muted_locally(), get_is_muted_by_themselves(),
|
||||||
get_volume_level(), order.get_group_call_participant_order_object());
|
get_volume_level(), order.get_group_call_participant_order_object());
|
||||||
|
@ -18,35 +18,36 @@ bool operator==(const GroupCallVideoPayload &lhs, const GroupCallVideoPayload &r
|
|||||||
return lhs.source_groups == rhs.source_groups && lhs.endpoint == rhs.endpoint && lhs.is_paused == rhs.is_paused;
|
return lhs.source_groups == rhs.source_groups && lhs.endpoint == rhs.endpoint && lhs.is_paused == rhs.is_paused;
|
||||||
}
|
}
|
||||||
|
|
||||||
static td_api::object_ptr<td_api::groupCallVideoSourceGroup> get_group_call_video_source_group_object(
|
|
||||||
const GroupCallVideoSourceGroup &group) {
|
|
||||||
return td_api::make_object<td_api::groupCallVideoSourceGroup>(group.semantics, vector<int32>(group.source_ids));
|
|
||||||
}
|
|
||||||
|
|
||||||
bool GroupCallVideoPayload::is_empty() const {
|
bool GroupCallVideoPayload::is_empty() const {
|
||||||
return endpoint.empty() || source_groups.empty();
|
return endpoint.empty() || source_groups.empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
td_api::object_ptr<td_api::groupCallParticipantVideoInfo> get_group_call_participant_video_info_object(
|
td_api::object_ptr<td_api::groupCallParticipantVideoInfo>
|
||||||
const GroupCallVideoPayload &payload) {
|
GroupCallVideoPayload::get_group_call_participant_video_info_object() const {
|
||||||
if (payload.is_empty()) {
|
if (is_empty()) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
auto get_group_call_video_source_group_object = [](const GroupCallVideoSourceGroup &group) {
|
||||||
|
return td_api::make_object<td_api::groupCallVideoSourceGroup>(group.semantics, vector<int32>(group.source_ids));
|
||||||
|
};
|
||||||
return td_api::make_object<td_api::groupCallParticipantVideoInfo>(
|
return td_api::make_object<td_api::groupCallParticipantVideoInfo>(
|
||||||
transform(payload.source_groups, get_group_call_video_source_group_object), payload.endpoint, payload.is_paused);
|
transform(source_groups, get_group_call_video_source_group_object), endpoint, is_paused);
|
||||||
}
|
}
|
||||||
|
|
||||||
GroupCallVideoPayload get_group_call_video_payload(const telegram_api::groupCallParticipantVideo *video) {
|
GroupCallVideoPayload::GroupCallVideoPayload(const telegram_api::groupCallParticipantVideo *video) {
|
||||||
GroupCallVideoPayload result;
|
if (video == nullptr) {
|
||||||
result.endpoint = video->endpoint_;
|
return;
|
||||||
result.source_groups = transform(video->source_groups_, [](auto &&source_group) {
|
}
|
||||||
|
|
||||||
|
endpoint = video->endpoint_;
|
||||||
|
source_groups = transform(video->source_groups_, [](auto &&source_group) {
|
||||||
GroupCallVideoSourceGroup result;
|
GroupCallVideoSourceGroup result;
|
||||||
result.semantics = source_group->semantics_;
|
result.semantics = source_group->semantics_;
|
||||||
result.source_ids = source_group->sources_;
|
result.source_ids = source_group->sources_;
|
||||||
return result;
|
return result;
|
||||||
});
|
});
|
||||||
result.is_paused = video->paused_;
|
is_paused = video->paused_;
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace td
|
} // namespace td
|
||||||
|
@ -23,14 +23,14 @@ struct GroupCallVideoPayload {
|
|||||||
string endpoint;
|
string endpoint;
|
||||||
bool is_paused = false;
|
bool is_paused = false;
|
||||||
|
|
||||||
|
GroupCallVideoPayload() = default;
|
||||||
|
explicit GroupCallVideoPayload(const telegram_api::groupCallParticipantVideo *video);
|
||||||
|
|
||||||
bool is_empty() const;
|
bool is_empty() const;
|
||||||
|
|
||||||
|
td_api::object_ptr<td_api::groupCallParticipantVideoInfo> get_group_call_participant_video_info_object() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
bool operator==(const GroupCallVideoPayload &lhs, const GroupCallVideoPayload &rhs);
|
bool operator==(const GroupCallVideoPayload &lhs, const GroupCallVideoPayload &rhs);
|
||||||
|
|
||||||
td_api::object_ptr<td_api::groupCallParticipantVideoInfo> get_group_call_participant_video_info_object(
|
|
||||||
const GroupCallVideoPayload &payload);
|
|
||||||
|
|
||||||
GroupCallVideoPayload get_group_call_video_payload(const telegram_api::groupCallParticipantVideo *video);
|
|
||||||
|
|
||||||
} // namespace td
|
} // namespace td
|
||||||
|
Loading…
x
Reference in New Issue
Block a user