Add suggested_video_note_* options.

This commit is contained in:
levlam 2021-07-28 06:15:57 +03:00
parent 103b0efcaa
commit 4ed0b15a41
3 changed files with 42 additions and 1 deletions

View File

@ -3235,7 +3235,7 @@ networkStatistics since_date:int32 entries:vector<NetworkStatisticsEntry> = Netw
//@max_photo_file_size The maximum size of a photo file to be auto-downloaded //@max_photo_file_size The maximum size of a photo file to be auto-downloaded
//@max_video_file_size The maximum size of a video file to be auto-downloaded //@max_video_file_size The maximum size of a video file to be auto-downloaded
//@max_other_file_size The maximum size of other file types to be auto-downloaded //@max_other_file_size The maximum size of other file types to be auto-downloaded
//@video_upload_bitrate The maximum suggested bitrate for uploaded videos //@video_upload_bitrate The maximum suggested bitrate for uploaded videos, in kbit/s
//@preload_large_videos True, if the beginning of video files needs to be preloaded for instant playback //@preload_large_videos True, if the beginning of video files needs to be preloaded for instant playback
//@preload_next_audio True, if the next audio track needs to be preloaded while the user is listening to an audio file //@preload_next_audio True, if the next audio track needs to be preloaded while the user is listening to an audio file
//@use_less_data_for_calls True, if "use less data for calls" option needs to be enabled //@use_less_data_for_calls True, if "use less data for calls" option needs to be enabled

View File

@ -1678,6 +1678,38 @@ void ConfigManager::process_app_config(tl_object_ptr<telegram_api::JSONValue> &c
} }
continue; continue;
} }
if (key == "round_video_encoding") {
if (value->get_id() == telegram_api::jsonObject::ID) {
auto video_note_settings = std::move(static_cast<telegram_api::jsonObject *>(value)->value_);
for (auto &video_note_setting : video_note_settings) {
CHECK(video_note_setting != nullptr);
if (video_note_setting->key_ != "diameter" && video_note_setting->key_ != "video_bitrate" &&
video_note_setting->key_ != "audio_bitrate") {
continue;
}
if (video_note_setting->value_->get_id() == telegram_api::jsonNumber::ID) {
auto setting_value = static_cast<int32>(
static_cast<const telegram_api::jsonNumber *>(video_note_setting->value_.get())->value_);
if (value > 0) {
if (video_note_setting->key_ == "diameter") {
G()->shared_config().set_option_integer("suggested_video_note_length", setting_value);
}
if (video_note_setting->key_ == "video_bitrate") {
G()->shared_config().set_option_integer("suggested_video_note_video_bitrate", setting_value);
}
if (video_note_setting->key_ == "audio_bitrate") {
G()->shared_config().set_option_integer("suggested_video_note_audio_bitrate", setting_value);
}
}
} else {
LOG(ERROR) << "Receive unexpected video note setting " << to_string(video_note_setting);
}
}
} else {
LOG(ERROR) << "Receive unexpected round_video_encoding " << to_string(*value);
}
continue;
}
new_values.push_back(std::move(key_value)); new_values.push_back(std::move(key_value));
} }

View File

@ -4255,6 +4255,15 @@ void Td::init_options_and_network() {
if (!G()->shared_config().have_option("message_caption_length_max")) { if (!G()->shared_config().have_option("message_caption_length_max")) {
G()->shared_config().set_option_integer("message_caption_length_max", 1024); G()->shared_config().set_option_integer("message_caption_length_max", 1024);
} }
if (!G()->shared_config().have_option("suggested_video_note_length")) {
G()->shared_config().set_option_integer("suggested_video_note_length", 384);
}
if (!G()->shared_config().have_option("suggested_video_note_video_bitrate")) {
G()->shared_config().set_option_integer("suggested_video_note_video_bitrate", 1000);
}
if (!G()->shared_config().have_option("suggested_video_note_audio_bitrate")) {
G()->shared_config().set_option_integer("suggested_video_note_audio_bitrate", 64);
}
init_connection_creator(); init_connection_creator();