Compile FrogPilot
This commit is contained in:
@@ -1,311 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <deque>
|
||||
#include <filesystem>
|
||||
#include <QDir>
|
||||
#include <QDirIterator>
|
||||
#include <QFileInfo>
|
||||
#include <QJsonArray>
|
||||
#include <QJsonDocument>
|
||||
#include <QJsonObject>
|
||||
|
||||
#include "selfdrive/ui/qt/offroad/settings.h"
|
||||
#include "selfdrive/ui/qt/widgets/controls.h"
|
||||
#include "selfdrive/ui/ui.h"
|
||||
|
||||
QMap<QString, QString> northeastMap = {
|
||||
{"CT", "Connecticut"}, {"DE", "Delaware"}, {"MA", "Massachusetts"},
|
||||
{"MD", "Maryland"}, {"ME", "Maine"}, {"NH", "New Hampshire"},
|
||||
{"NJ", "New Jersey"}, {"NY", "New York"}, {"PA", "Pennsylvania"},
|
||||
{"RI", "Rhode Island"}, {"VT", "Vermont"}
|
||||
};
|
||||
|
||||
QMap<QString, QString> midwestMap = {
|
||||
{"IA", "Iowa"}, {"IL", "Illinois"}, {"IN", "Indiana"},
|
||||
{"KS", "Kansas"}, {"MI", "Michigan"}, {"MN", "Minnesota"},
|
||||
{"MO", "Missouri"}, {"ND", "North Dakota"}, {"NE", "Nebraska"},
|
||||
{"OH", "Ohio"}, {"SD", "South Dakota"}, {"WI", "Wisconsin"}
|
||||
};
|
||||
|
||||
QMap<QString, QString> southMap = {
|
||||
{"AL", "Alabama"}, {"AR", "Arkansas"}, {"FL", "Florida"},
|
||||
{"GA", "Georgia"}, {"KY", "Kentucky"}, {"LA", "Louisiana"},
|
||||
{"MS", "Mississippi"}, {"NC", "North Carolina"}, {"OK", "Oklahoma"},
|
||||
{"SC", "South Carolina"}, {"TN", "Tennessee"}, {"TX", "Texas"},
|
||||
{"VA", "Virginia"}, {"WV", "West Virginia"}
|
||||
};
|
||||
|
||||
QMap<QString, QString> westMap = {
|
||||
{"AK", "Alaska"}, {"AZ", "Arizona"}, {"CA", "California"},
|
||||
{"CO", "Colorado"}, {"HI", "Hawaii"}, {"ID", "Idaho"},
|
||||
{"MT", "Montana"}, {"NM", "New Mexico"}, {"NV", "Nevada"},
|
||||
{"OR", "Oregon"}, {"UT", "Utah"}, {"WA", "Washington"},
|
||||
{"WY", "Wyoming"}
|
||||
};
|
||||
|
||||
QMap<QString, QString> territoriesMap = {
|
||||
{"AS", "American Samoa"}, {"DC", "District of Columbia"},
|
||||
{"GM", "Guam"}, {"MP", "North Mariana Islands"},
|
||||
{"PR", "Puerto Rico"}, {"VI", "Virgin Islands"}
|
||||
};
|
||||
|
||||
QMap<QString, QString> africaMap = {
|
||||
{"DZ", "Algeria"}, {"AO", "Angola"}, {"BJ", "Benin"}, {"BW", "Botswana"},
|
||||
{"BF", "Burkina Faso"}, {"BI", "Burundi"}, {"CM", "Cameroon"}, {"CV", "Cape Verde"},
|
||||
{"CF", "Central African Republic"}, {"TD", "Chad"}, {"KM", "Comoros"}, {"CG", "Congo (Brazzaville)"},
|
||||
{"CD", "Congo (Kinshasa)"}, {"CI", "Ivory Coast"}, {"DJ", "Djibouti"}, {"EG", "Egypt"},
|
||||
{"GQ", "Equatorial Guinea"}, {"ER", "Eritrea"}, {"SZ", "Eswatini"}, {"ET", "Ethiopia"},
|
||||
{"GA", "Gabon"}, {"GM", "Gambia"}, {"GH", "Ghana"}, {"GN", "Guinea"},
|
||||
{"GW", "Guinea-Bissau"}, {"KE", "Kenya"}, {"LS", "Lesotho"}, {"LR", "Liberia"},
|
||||
{"LY", "Libya"}, {"MG", "Madagascar"}, {"MW", "Malawi"}, {"ML", "Mali"},
|
||||
{"MR", "Mauritania"}, {"MU", "Mauritius"}, {"MA", "Morocco"}, {"MZ", "Mozambique"},
|
||||
{"NA", "Namibia"}, {"NE", "Niger"}, {"NG", "Nigeria"}, {"RW", "Rwanda"},
|
||||
{"ST", "Sao Tome and Principe"}, {"SN", "Senegal"}, {"SC", "Seychelles"}, {"SL", "Sierra Leone"},
|
||||
{"SO", "Somalia"}, {"ZA", "South Africa"}, {"SS", "South Sudan"}, {"SD", "Sudan"},
|
||||
{"TZ", "Tanzania"}, {"TG", "Togo"}, {"TN", "Tunisia"}, {"UG", "Uganda"},
|
||||
{"EH", "Western Sahara"}, {"ZM", "Zambia"}, {"ZW", "Zimbabwe"}
|
||||
};
|
||||
|
||||
QMap<QString, QString> antarcticaMap = {
|
||||
{"AQ", "Antarctica"}
|
||||
};
|
||||
|
||||
QMap<QString, QString> asiaMap = {
|
||||
{"AF", "Afghanistan"}, {"AM", "Armenia"}, {"AZ", "Azerbaijan"}, {"BH", "Bahrain"},
|
||||
{"BD", "Bangladesh"}, {"BT", "Bhutan"}, {"BN", "Brunei"}, {"KH", "Cambodia"},
|
||||
{"CN", "China"}, {"CY", "Cyprus"}, {"GE", "Georgia"}, {"IN", "India"},
|
||||
{"ID", "Indonesia"}, {"IR", "Iran"}, {"IQ", "Iraq"}, {"IL", "Israel"},
|
||||
{"JP", "Japan"}, {"JO", "Jordan"}, {"KZ", "Kazakhstan"}, {"KP", "North Korea"},
|
||||
{"KR", "South Korea"}, {"KW", "Kuwait"}, {"KG", "Kyrgyzstan"}, {"LA", "Laos"},
|
||||
{"LB", "Lebanon"}, {"MY", "Malaysia"}, {"MV", "Maldives"}, {"MN", "Mongolia"},
|
||||
{"MM", "Myanmar"}, {"NP", "Nepal"}, {"OM", "Oman"}, {"PK", "Pakistan"},
|
||||
{"PS", "Palestine"}, {"PH", "Philippines"}, {"QA", "Qatar"}, {"SA", "Saudi Arabia"},
|
||||
{"SG", "Singapore"}, {"LK", "Sri Lanka"}, {"SY", "Syria"}, {"TW", "Taiwan"},
|
||||
{"TJ", "Tajikistan"}, {"TH", "Thailand"}, {"TL", "Timor-Leste"}, {"TR", "Turkey"},
|
||||
{"TM", "Turkmenistan"}, {"AE", "United Arab Emirates"}, {"UZ", "Uzbekistan"}, {"VN", "Vietnam"},
|
||||
{"YE", "Yemen"}
|
||||
};
|
||||
|
||||
QMap<QString, QString> europeMap = {
|
||||
{"AL", "Albania"}, {"AD", "Andorra"}, {"AT", "Austria"}, {"BY", "Belarus"},
|
||||
{"BE", "Belgium"}, {"BA", "Bosnia and Herzegovina"}, {"BG", "Bulgaria"}, {"HR", "Croatia"},
|
||||
{"CY", "Cyprus"}, {"CZ", "Czech Republic"}, {"DK", "Denmark"}, {"EE", "Estonia"},
|
||||
{"FI", "Finland"}, {"FR", "France"}, {"DE", "Germany"}, {"GR", "Greece"},
|
||||
{"HU", "Hungary"}, {"IS", "Iceland"}, {"IE", "Ireland"}, {"IT", "Italy"},
|
||||
{"LV", "Latvia"}, {"LI", "Liechtenstein"}, {"LT", "Lithuania"}, {"LU", "Luxembourg"},
|
||||
{"MT", "Malta"}, {"MD", "Moldova"}, {"MC", "Monaco"}, {"ME", "Montenegro"},
|
||||
{"NL", "Netherlands"}, {"MK", "North Macedonia"}, {"NO", "Norway"}, {"PL", "Poland"},
|
||||
{"PT", "Portugal"}, {"RO", "Romania"}, {"RU", "Russia"}, {"SM", "San Marino"},
|
||||
{"RS", "Serbia"}, {"SK", "Slovakia"}, {"SI", "Slovenia"}, {"ES", "Spain"},
|
||||
{"SE", "Sweden"}, {"CH", "Switzerland"}, {"TR", "Turkey"}, {"UA", "Ukraine"},
|
||||
{"GB", "United Kingdom"}, {"VA", "Vatican City"}
|
||||
};
|
||||
|
||||
QMap<QString, QString> northAmericaMap = {
|
||||
{"AG", "Antigua and Barbuda"}, {"BS", "Bahamas"}, {"BB", "Barbados"}, {"BZ", "Belize"},
|
||||
{"CA", "Canada"}, {"CR", "Costa Rica"}, {"CU", "Cuba"}, {"DM", "Dominica"},
|
||||
{"DO", "Dominican Republic"}, {"SV", "El Salvador"}, {"GD", "Grenada"}, {"GT", "Guatemala"},
|
||||
{"HT", "Haiti"}, {"HN", "Honduras"}, {"JM", "Jamaica"}, {"MX", "Mexico"},
|
||||
{"NI", "Nicaragua"}, {"PA", "Panama"}, {"KN", "Saint Kitts and Nevis"}, {"LC", "Saint Lucia"},
|
||||
{"VC", "Saint Vincent and the Grenadines"}, {"TT", "Trinidad and Tobago"}, {"US", "United States"}
|
||||
};
|
||||
|
||||
QMap<QString, QString> oceaniaMap = {
|
||||
{"AU", "Australia"}, {"FJ", "Fiji"}, {"KI", "Kiribati"}, {"MH", "Marshall Islands"},
|
||||
{"FM", "Micronesia"}, {"NR", "Nauru"}, {"NZ", "New Zealand"}, {"PW", "Palau"},
|
||||
{"PG", "Papua New Guinea"}, {"WS", "Samoa"}, {"SB", "Solomon Islands"}, {"TO", "Tonga"},
|
||||
{"TV", "Tuvalu"}, {"VU", "Vanuatu"}
|
||||
};
|
||||
|
||||
QMap<QString, QString> southAmericaMap = {
|
||||
{"AR", "Argentina"}, {"BO", "Bolivia"}, {"BR", "Brazil"}, {"CL", "Chile"},
|
||||
{"CO", "Colombia"}, {"EC", "Ecuador"}, {"GY", "Guyana"}, {"PY", "Paraguay"},
|
||||
{"PE", "Peru"}, {"SR", "Suriname"}, {"TT", "Trinidad and Tobago"}, {"UY", "Uruguay"},
|
||||
{"VE", "Venezuela"}
|
||||
};
|
||||
|
||||
class ButtonSelectionControl : public QWidget {
|
||||
public:
|
||||
static QString selectedStates;
|
||||
static QString selectedCountries;
|
||||
|
||||
explicit ButtonSelectionControl(const QString &id, const QString &title, const QString &description,
|
||||
const QMap<QString, QString> &map, bool isCountry, QWidget *parent = nullptr)
|
||||
: QWidget(parent), country(isCountry) {
|
||||
QVBoxLayout *layout = new QVBoxLayout(this);
|
||||
layout->setAlignment(Qt::AlignTop);
|
||||
layout->setSpacing(10);
|
||||
|
||||
QHBoxLayout *buttonsLayout = new QHBoxLayout();
|
||||
buttonsLayout->setSpacing(10);
|
||||
layout->addLayout(buttonsLayout);
|
||||
|
||||
int count = 0;
|
||||
int max = country ? 3 : 4;
|
||||
|
||||
QJsonObject mapsSelected = QJsonDocument::fromJson(QString::fromStdString(Params().get("MapsSelected")).toUtf8()).object();
|
||||
|
||||
for (const QString &stateCode : map.keys()) {
|
||||
if (count % max == 0 && count != 0) {
|
||||
buttonsLayout = new QHBoxLayout();
|
||||
buttonsLayout->setSpacing(10);
|
||||
layout->addLayout(buttonsLayout);
|
||||
}
|
||||
|
||||
QPushButton *button = createButton(buttonsLayout, map[stateCode], stateCode);
|
||||
|
||||
QString key = country ? "nations" : "states";
|
||||
if (mapsSelected.contains(key)) {
|
||||
QJsonArray selectedItems = mapsSelected.value(key).toArray();
|
||||
button->setChecked(selectedItems.contains(stateCode));
|
||||
}
|
||||
|
||||
count++;
|
||||
}
|
||||
|
||||
adjustButtonWidths(buttonsLayout);
|
||||
}
|
||||
|
||||
private:
|
||||
bool country;
|
||||
|
||||
const QString buttonStyle = R"(
|
||||
QPushButton {
|
||||
border-radius: 50px; font-size: 40px; font-weight: 500;
|
||||
height: 100px; padding: 0 25 0 25; color: #E4E4E4;
|
||||
background-color: #393939;
|
||||
}
|
||||
QPushButton:pressed, QPushButton:checked {
|
||||
background-color: #4a4a4a;
|
||||
}
|
||||
QPushButton:checked:enabled {
|
||||
background-color: #33Ab4C;
|
||||
}
|
||||
QPushButton:disabled {
|
||||
color: #33E4E4E4;
|
||||
}
|
||||
)";
|
||||
|
||||
QPushButton *createButton(QHBoxLayout *layout, const QString &label, const QString &stateCode) {
|
||||
QPushButton *button = new QPushButton(label, this);
|
||||
button->setCheckable(true);
|
||||
button->setStyleSheet(buttonStyle);
|
||||
connect(button, &QPushButton::clicked, this, [this, button, stateCode] { updateState(stateCode, button); });
|
||||
layout->addWidget(button);
|
||||
return button;
|
||||
}
|
||||
|
||||
void adjustButtonWidths(QHBoxLayout *layout) {
|
||||
if (!layout || layout->count() == (country ? 3 : 4)) return;
|
||||
|
||||
for (int i = 0; i < layout->count(); ++i) {
|
||||
QWidget *widget = layout->itemAt(i)->widget();
|
||||
QPushButton *button = qobject_cast<QPushButton *>(widget);
|
||||
if (button) {
|
||||
button->setMinimumWidth(button->sizeHint().width());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void updateState(const QString &newState, QPushButton *button) {
|
||||
QString &selectedList = country ? selectedCountries : selectedStates;
|
||||
QStringList tempList = selectedList.split(',');
|
||||
|
||||
if (button->isChecked()) {
|
||||
if (!selectedList.isEmpty()) selectedList += ",";
|
||||
selectedList += newState;
|
||||
} else {
|
||||
tempList.removeAll(newState);
|
||||
selectedList = tempList.join(',');
|
||||
}
|
||||
|
||||
Params("/dev/shm/params").remove("OSMDownloadLocations");
|
||||
}
|
||||
};
|
||||
|
||||
QString ButtonSelectionControl::selectedStates = "";
|
||||
QString ButtonSelectionControl::selectedCountries = "";
|
||||
|
||||
namespace {
|
||||
template <typename T>
|
||||
T extractFromJson(const std::string &jsonData, const std::string &key, T defaultValue = 0) {
|
||||
std::string::size_type pos = jsonData.find(key);
|
||||
return pos != std::string::npos ? std::stol(jsonData.substr(pos + key.length())) : defaultValue;
|
||||
}
|
||||
}
|
||||
|
||||
QString formatTime(long timeInSeconds) {
|
||||
long minutes = timeInSeconds / 60;
|
||||
long seconds = timeInSeconds % 60;
|
||||
QString formattedTime = (minutes > 0) ? QString::number(minutes) + "m " : "";
|
||||
formattedTime += QString::number(seconds) + "s";
|
||||
return formattedTime;
|
||||
}
|
||||
|
||||
QString formatDateTime(const std::chrono::time_point<std::chrono::system_clock> &timePoint) {
|
||||
return QDateTime::fromTime_t(std::chrono::system_clock::to_time_t(timePoint)).toString("h:mm ap");
|
||||
}
|
||||
|
||||
QString calculateElapsedTime(int totalFiles, int downloadedFiles, const std::chrono::steady_clock::time_point &startTime) {
|
||||
using namespace std::chrono;
|
||||
if (totalFiles <= 0 || downloadedFiles >= totalFiles) return "Calculating...";
|
||||
|
||||
long elapsed = duration_cast<seconds>(steady_clock::now() - startTime).count();
|
||||
return formatTime(elapsed);
|
||||
}
|
||||
|
||||
QString calculateETA(int totalFiles, int downloadedFiles, const std::chrono::steady_clock::time_point &startTime) {
|
||||
using namespace std::chrono;
|
||||
if (totalFiles <= 0 || downloadedFiles >= totalFiles) return "Calculating...";
|
||||
|
||||
long elapsed = duration_cast<seconds>(steady_clock::now() - startTime).count();
|
||||
|
||||
if (downloadedFiles == 0 || elapsed <= 0) {
|
||||
return "Calculating...";
|
||||
}
|
||||
|
||||
double averageTimePerFile = static_cast<double>(elapsed) / downloadedFiles;
|
||||
int remainingFiles = totalFiles - downloadedFiles;
|
||||
long estimatedTimeRemaining = static_cast<long>(averageTimePerFile * remainingFiles);
|
||||
|
||||
std::chrono::time_point<std::chrono::system_clock> estimatedCompletionTime = system_clock::now() + seconds(estimatedTimeRemaining);
|
||||
QString estimatedTimeStr = formatDateTime(estimatedCompletionTime);
|
||||
|
||||
return formatTime(estimatedTimeRemaining) + " (" + estimatedTimeStr + ")";
|
||||
|
||||
}
|
||||
|
||||
QString formatDownloadStatus(int totalFiles, int downloadedFiles) {
|
||||
if (totalFiles <= 0) return "Calculating...";
|
||||
if (downloadedFiles >= totalFiles) return "Downloaded";
|
||||
|
||||
int percentage = static_cast<int>(100 * downloadedFiles / totalFiles);
|
||||
return QString::asprintf("Downloading: %d/%d (%d%%)", downloadedFiles, totalFiles, percentage);
|
||||
}
|
||||
|
||||
quint64 calculateDirectorySize(const QString &path) {
|
||||
quint64 totalSize = 0;
|
||||
QDirIterator it(path, QDir::Files, QDirIterator::Subdirectories);
|
||||
while (it.hasNext()) {
|
||||
it.next();
|
||||
QFileInfo fileInfo(it.filePath());
|
||||
if (fileInfo.isFile()) {
|
||||
totalSize += fileInfo.size();
|
||||
}
|
||||
}
|
||||
return totalSize;
|
||||
}
|
||||
|
||||
QString formatSize(qint64 size) {
|
||||
const qint64 kb = 1024;
|
||||
const qint64 mb = 1024 * kb;
|
||||
const qint64 gb = 1024 * mb;
|
||||
|
||||
if (size < gb) {
|
||||
double sizeMB = size / static_cast<double>(mb);
|
||||
return QString::number(sizeMB, 'f', 2) + " MB";
|
||||
} else {
|
||||
double sizeGB = size / static_cast<double>(gb);
|
||||
return QString::number(sizeGB, 'f', 2) + " GB";
|
||||
}
|
||||
}
|
||||
@@ -1,574 +0,0 @@
|
||||
#include <QMouseEvent>
|
||||
|
||||
#include "selfdrive/frogpilot/navigation/ui/navigation_functions.h"
|
||||
#include "selfdrive/frogpilot/navigation/ui/navigation_settings.h"
|
||||
|
||||
FrogPilotNavigationPanel::FrogPilotNavigationPanel(QWidget *parent) : QFrame(parent), scene(uiState()->scene) {
|
||||
mainLayout = new QStackedLayout(this);
|
||||
|
||||
navigationWidget = new QWidget();
|
||||
QVBoxLayout *navigationLayout = new QVBoxLayout(navigationWidget);
|
||||
navigationLayout->setMargin(40);
|
||||
|
||||
FrogPilotListWidget *list = new FrogPilotListWidget(navigationWidget);
|
||||
|
||||
Primeless *primelessPanel = new Primeless(this);
|
||||
mainLayout->addWidget(primelessPanel);
|
||||
|
||||
ButtonControl *manageNOOButton = new ButtonControl(tr("Manage Primeless Navigation Settings"), tr("MANAGE"), tr("Manage primeless navigate on openpilot settings."));
|
||||
QObject::connect(manageNOOButton, &ButtonControl::clicked, [=]() { mainLayout->setCurrentWidget(primelessPanel); });
|
||||
QObject::connect(primelessPanel, &Primeless::backPress, [=]() { mainLayout->setCurrentWidget(navigationWidget); });
|
||||
list->addItem(manageNOOButton);
|
||||
manageNOOButton->setVisible(!uiState()->hasPrime());
|
||||
|
||||
std::vector<QString> scheduleOptions{tr("Manually"), tr("Weekly"), tr("Monthly")};
|
||||
ButtonParamControl *preferredSchedule = new ButtonParamControl("PreferredSchedule", tr("Maps Scheduler"),
|
||||
tr("Choose the frequency for updating maps with the latest OpenStreetMap (OSM) changes. "
|
||||
"Weekly updates begin at midnight every Sunday, while monthly updates start at midnight on the 1st of each month. "
|
||||
"If your device is off or not connected to WiFi during a scheduled update, the download will be conducted the next "
|
||||
"time you're offroad with a WiFi connection."),
|
||||
"",
|
||||
scheduleOptions);
|
||||
schedule = params.getInt("PreferredSchedule");
|
||||
schedulePending = params.getBool("SchedulePending");
|
||||
list->addItem(preferredSchedule);
|
||||
|
||||
list->addItem(offlineMapsSize = new LabelControl(tr("Offline Maps Size"), formatSize(calculateDirectorySize(offlineFolderPath))));
|
||||
offlineMapsSize->setVisible(true);
|
||||
list->addItem(lastMapsDownload = new LabelControl(tr("Last Download"), ""));
|
||||
lastMapsDownload->setVisible(!params.get("LastMapsUpdate").empty());
|
||||
lastMapsDownload->setText(QString::fromStdString(params.get("LastMapsUpdate")));
|
||||
list->addItem(offlineMapsStatus = new LabelControl(tr("Offline Maps Status"), ""));
|
||||
offlineMapsStatus->setVisible(false);
|
||||
list->addItem(offlineMapsETA = new LabelControl(tr("Offline Maps ETA"), ""));
|
||||
offlineMapsETA->setVisible(false);
|
||||
list->addItem(offlineMapsElapsed = new LabelControl(tr("Time Elapsed"), ""));
|
||||
offlineMapsElapsed->setVisible(false);
|
||||
|
||||
cancelDownloadButton = new ButtonControl(tr("Cancel Download"), tr("CANCEL"), tr("Cancel your current download."));
|
||||
QObject::connect(cancelDownloadButton, &ButtonControl::clicked, [this] { cancelDownload(this); });
|
||||
list->addItem(cancelDownloadButton);
|
||||
cancelDownloadButton->setVisible(false);
|
||||
|
||||
downloadOfflineMapsButton = new ButtonControl(tr("Download Offline Maps"), tr("DOWNLOAD"), tr("Download your selected offline maps to use with openpilot."));
|
||||
QObject::connect(downloadOfflineMapsButton, &ButtonControl::clicked, [this] { downloadMaps(); });
|
||||
list->addItem(downloadOfflineMapsButton);
|
||||
downloadOfflineMapsButton->setVisible(!params.get("MapsSelected").empty());
|
||||
|
||||
SelectMaps *mapsPanel = new SelectMaps(this);
|
||||
mainLayout->addWidget(mapsPanel);
|
||||
|
||||
QObject::connect(mapsPanel, &SelectMaps::setMaps, [=]() { setMaps(); });
|
||||
|
||||
ButtonControl *selectMapsButton = new ButtonControl(tr("Select Offline Maps"), tr("SELECT"), tr("Select your maps to use with OSM."));
|
||||
QObject::connect(selectMapsButton, &ButtonControl::clicked, [=]() { mainLayout->setCurrentWidget(mapsPanel); });
|
||||
QObject::connect(mapsPanel, &SelectMaps::backPress, [=]() { mainLayout->setCurrentWidget(navigationWidget); });
|
||||
list->addItem(selectMapsButton);
|
||||
|
||||
removeOfflineMapsButton = new ButtonControl(tr("Remove Offline Maps"), tr("REMOVE"), tr("Remove your downloaded offline maps to clear up storage space."));
|
||||
QObject::connect(removeOfflineMapsButton, &ButtonControl::clicked, [this] { removeMaps(this); });
|
||||
list->addItem(removeOfflineMapsButton);
|
||||
removeOfflineMapsButton->setVisible(QDir(offlineFolderPath).exists());
|
||||
|
||||
navigationLayout->addWidget(new ScrollView(list, navigationWidget));
|
||||
navigationWidget->setLayout(navigationLayout);
|
||||
mainLayout->addWidget(navigationWidget);
|
||||
mainLayout->setCurrentWidget(navigationWidget);
|
||||
|
||||
QObject::connect(uiState(), &UIState::uiUpdate, this, &FrogPilotNavigationPanel::updateState);
|
||||
|
||||
checkIfUpdateMissed();
|
||||
}
|
||||
|
||||
void FrogPilotNavigationPanel::hideEvent(QHideEvent *event) {
|
||||
QWidget::hideEvent(event);
|
||||
mainLayout->setCurrentWidget(navigationWidget);
|
||||
}
|
||||
|
||||
void FrogPilotNavigationPanel::updateState() {
|
||||
if (!isVisible() && downloadActive) updateVisibility(downloadActive);
|
||||
if (downloadActive) updateStatuses();
|
||||
if (schedule) downloadSchedule();
|
||||
}
|
||||
|
||||
void FrogPilotNavigationPanel::updateStatuses() {
|
||||
static std::chrono::steady_clock::time_point startTime = std::chrono::steady_clock::now();
|
||||
osmDownloadProgress = params.get("OSMDownloadProgress");
|
||||
|
||||
const int totalFiles = extractFromJson<int>(osmDownloadProgress, "\"total_files\":");
|
||||
const int downloadedFiles = extractFromJson<int>(osmDownloadProgress, "\"downloaded_files\":");
|
||||
|
||||
if (paramsMemory.get("OSMDownloadLocations").empty()) {
|
||||
downloadActive = false;
|
||||
updateDownloadedLabel();
|
||||
qint64 fileSize = calculateDirectorySize(offlineFolderPath);
|
||||
offlineMapsSize->setText(formatSize(fileSize));
|
||||
previousOSMDownloadProgress = osmDownloadProgress;
|
||||
}
|
||||
|
||||
if (osmDownloadProgress != previousOSMDownloadProgress && isVisible()) {
|
||||
qint64 fileSize = calculateDirectorySize(offlineFolderPath);
|
||||
offlineMapsSize->setText(formatSize(fileSize));
|
||||
previousOSMDownloadProgress = osmDownloadProgress;
|
||||
}
|
||||
|
||||
elapsedTime = calculateElapsedTime(totalFiles, downloadedFiles, startTime);
|
||||
|
||||
offlineMapsElapsed->setText(elapsedTime);
|
||||
offlineMapsETA->setText(calculateETA(totalFiles, downloadedFiles, startTime));
|
||||
offlineMapsStatus->setText(formatDownloadStatus(totalFiles, downloadedFiles));
|
||||
|
||||
if (downloadActive != previousDownloadActive) {
|
||||
startTime = !downloadActive ? std::chrono::steady_clock::now() : startTime;
|
||||
updateVisibility(downloadActive);
|
||||
previousDownloadActive = downloadActive;
|
||||
}
|
||||
}
|
||||
|
||||
void FrogPilotNavigationPanel::updateVisibility(bool visibility) {
|
||||
cancelDownloadButton->setVisible(visibility);
|
||||
offlineMapsElapsed->setVisible(visibility);
|
||||
offlineMapsETA->setVisible(visibility);
|
||||
offlineMapsStatus->setVisible(visibility);
|
||||
downloadOfflineMapsButton->setVisible(!visibility);
|
||||
lastMapsDownload->setVisible(QDir(offlineFolderPath).exists() && !downloadActive);
|
||||
removeOfflineMapsButton->setVisible(QDir(offlineFolderPath).exists() && !downloadActive);
|
||||
update();
|
||||
}
|
||||
|
||||
void FrogPilotNavigationPanel::checkIfUpdateMissed() {
|
||||
std::string lastMapsUpdate = params.get("LastMapsUpdate");
|
||||
|
||||
if (lastMapsUpdate.empty() || schedule == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
std::time_t currentTime = std::time(nullptr);
|
||||
std::tm *now = std::localtime(¤tTime);
|
||||
|
||||
std::tm lastUpdate = {};
|
||||
sscanf(lastMapsUpdate.c_str(), "%d-%d-%d", &lastUpdate.tm_year, &lastUpdate.tm_mon, &lastUpdate.tm_mday);
|
||||
lastUpdate.tm_year -= 1900;
|
||||
lastUpdate.tm_mon -= 1;
|
||||
|
||||
std::time_t lastUpdateTime = std::mktime(&lastUpdate);
|
||||
std::tm *lastUpdateDay = std::localtime(&lastUpdateTime);
|
||||
|
||||
if (schedule == 1) {
|
||||
schedulePending = (now->tm_wday == 0 && lastUpdateDay->tm_wday != 0) || (now->tm_wday > lastUpdateDay->tm_wday);
|
||||
} else if (schedule == 2) {
|
||||
schedulePending = (now->tm_mday == 1 && lastUpdate.tm_mday != 1) || (now->tm_mon != lastUpdate.tm_mon);
|
||||
}
|
||||
}
|
||||
|
||||
void FrogPilotNavigationPanel::updateDownloadedLabel() {
|
||||
std::time_t t = std::time(nullptr);
|
||||
std::tm now = *std::localtime(&t);
|
||||
char dateBuffer[11];
|
||||
std::strftime(dateBuffer, sizeof(dateBuffer), "%Y-%m-%d", &now);
|
||||
QDate date = QDate::fromString(dateBuffer, "yyyy-MM-dd");
|
||||
|
||||
int day = date.day();
|
||||
std::string suffix = (day == 1 || day == 21 || day == 31) ? "st" :
|
||||
(day == 2 || day == 22) ? "nd" :
|
||||
(day == 3 || day == 23) ? "rd" : "th";
|
||||
std::string lastMapsUpdate = date.toString("MMMM d").toStdString() + suffix + date.toString(", yyyy").toStdString();
|
||||
lastMapsDownload->setText(QString::fromStdString(lastMapsUpdate));
|
||||
params.put("LastMapsUpdate", lastMapsUpdate);
|
||||
}
|
||||
|
||||
void FrogPilotNavigationPanel::downloadSchedule() {
|
||||
const bool wifi = (*uiState()->sm)["deviceState"].getDeviceState().getNetworkType() == cereal::DeviceState::NetworkType::WIFI;
|
||||
|
||||
const std::time_t t = std::time(nullptr);
|
||||
const std::tm *now = std::localtime(&t);
|
||||
|
||||
const bool isScheduleTime = (schedule == 1 && now->tm_wday == 0) || (schedule == 2 && now->tm_mday == 1);
|
||||
|
||||
if ((isScheduleTime || schedulePending) && !(scene.started || scheduleCompleted) && wifi) {
|
||||
downloadMaps();
|
||||
scheduleCompleted = true;
|
||||
|
||||
if (schedulePending) {
|
||||
schedulePending = false;
|
||||
params.putBool("SchedulePending", false);
|
||||
}
|
||||
} else if (!isScheduleTime) {
|
||||
scheduleCompleted = false;
|
||||
} else {
|
||||
if (!schedulePending) {
|
||||
params.putBool("SchedulePending", true);
|
||||
}
|
||||
schedulePending = true;
|
||||
}
|
||||
}
|
||||
|
||||
void FrogPilotNavigationPanel::cancelDownload(QWidget *parent) {
|
||||
if (FrogPilotConfirmationDialog::yesorno("Are you sure you want to cancel the download?", parent)) {
|
||||
std::thread([&] {
|
||||
std::system("pkill mapd");
|
||||
}).detach();
|
||||
if (FrogPilotConfirmationDialog::toggle("Reboot required to re-enable map downloads", "Reboot Now", parent)) {
|
||||
Hardware::soft_reboot();
|
||||
}
|
||||
downloadActive = false;
|
||||
updateVisibility(downloadActive);
|
||||
downloadOfflineMapsButton->setVisible(downloadActive);
|
||||
}
|
||||
}
|
||||
|
||||
void FrogPilotNavigationPanel::downloadMaps() {
|
||||
params.remove("OSMDownloadProgress");
|
||||
paramsMemory.put("OSMDownloadLocations", params.get("MapsSelected"));
|
||||
removeOfflineMapsButton->setVisible(true);
|
||||
downloadActive = true;
|
||||
}
|
||||
|
||||
void FrogPilotNavigationPanel::removeMaps(QWidget *parent) {
|
||||
if (FrogPilotConfirmationDialog::yesorno("Are you sure you want to delete all of your downloaded maps?", parent)) {
|
||||
std::thread([&] {
|
||||
lastMapsDownload->setVisible(false);
|
||||
removeOfflineMapsButton->setVisible(false);
|
||||
offlineMapsSize->setText(formatSize(0));
|
||||
params.remove("LastMapsUpdate");
|
||||
std::system("rm -rf /data/media/0/osm/offline");
|
||||
}).detach();
|
||||
}
|
||||
}
|
||||
|
||||
void FrogPilotNavigationPanel::setMaps() {
|
||||
std::thread([&] {
|
||||
QStringList states = ButtonSelectionControl::selectedStates.split(',', QString::SkipEmptyParts);
|
||||
QStringList countries = ButtonSelectionControl::selectedCountries.split(',', QString::SkipEmptyParts);
|
||||
|
||||
QJsonObject json;
|
||||
json.insert("states", QJsonArray::fromStringList(states));
|
||||
json.insert("nations", QJsonArray::fromStringList(countries));
|
||||
|
||||
params.put("MapsSelected", QJsonDocument(json).toJson(QJsonDocument::Compact).toStdString());
|
||||
|
||||
if (!states.isEmpty() || !countries.isEmpty()) {
|
||||
downloadOfflineMapsButton->setVisible(true);
|
||||
update();
|
||||
} else {
|
||||
params.remove("MapsSelected");
|
||||
}
|
||||
}).detach();
|
||||
}
|
||||
|
||||
SelectMaps::SelectMaps(QWidget *parent) : QWidget(parent) {
|
||||
QVBoxLayout *mainLayout = new QVBoxLayout(this);
|
||||
|
||||
QHBoxLayout *buttonsLayout = new QHBoxLayout();
|
||||
buttonsLayout->setContentsMargins(20, 40, 20, 0);
|
||||
|
||||
backButton = new QPushButton(tr("Back"), this);
|
||||
statesButton = new QPushButton(tr("States"), this);
|
||||
countriesButton = new QPushButton(tr("Countries"), this);
|
||||
|
||||
backButton->setFixedSize(400, 100);
|
||||
statesButton->setFixedSize(400, 100);
|
||||
countriesButton->setFixedSize(400, 100);
|
||||
|
||||
buttonsLayout->addWidget(backButton);
|
||||
buttonsLayout->addStretch();
|
||||
buttonsLayout->addWidget(statesButton);
|
||||
buttonsLayout->addStretch();
|
||||
buttonsLayout->addWidget(countriesButton);
|
||||
mainLayout->addLayout(buttonsLayout);
|
||||
|
||||
mainLayout->addWidget(horizontalLine());
|
||||
mainLayout->setSpacing(20);
|
||||
|
||||
mapsLayout = new QStackedLayout();
|
||||
mapsLayout->setMargin(40);
|
||||
mapsLayout->setSpacing(20);
|
||||
mainLayout->addLayout(mapsLayout);
|
||||
|
||||
QObject::connect(backButton, &QPushButton::clicked, this, [this]() { emit backPress(), emit setMaps(); });
|
||||
|
||||
FrogPilotListWidget *statesList = new FrogPilotListWidget();
|
||||
|
||||
LabelControl *northeastLabel = new LabelControl(tr("United States - Northeast"), "");
|
||||
statesList->addItem(northeastLabel);
|
||||
|
||||
ButtonSelectionControl *northeastControl = new ButtonSelectionControl("", tr(""), tr(""), northeastMap, false);
|
||||
statesList->addItem(northeastControl);
|
||||
|
||||
LabelControl *midwestLabel = new LabelControl(tr("United States - Midwest"), "");
|
||||
statesList->addItem(midwestLabel);
|
||||
|
||||
ButtonSelectionControl *midwestControl = new ButtonSelectionControl("", tr(""), tr(""), midwestMap, false);
|
||||
statesList->addItem(midwestControl);
|
||||
|
||||
LabelControl *southLabel = new LabelControl(tr("United States - South"), "");
|
||||
statesList->addItem(southLabel);
|
||||
|
||||
ButtonSelectionControl *southControl = new ButtonSelectionControl("", tr(""), tr(""), southMap, false);
|
||||
statesList->addItem(southControl);
|
||||
|
||||
LabelControl *westLabel = new LabelControl(tr("United States - West"), "");
|
||||
statesList->addItem(westLabel);
|
||||
|
||||
ButtonSelectionControl *westControl = new ButtonSelectionControl("", tr(""), tr(""), westMap, false);
|
||||
statesList->addItem(westControl);
|
||||
|
||||
LabelControl *territoriesLabel = new LabelControl(tr("United States - Territories"), "");
|
||||
statesList->addItem(territoriesLabel);
|
||||
|
||||
ButtonSelectionControl *territoriesControl = new ButtonSelectionControl("", tr(""), tr(""), territoriesMap, false);
|
||||
statesList->addItem(territoriesControl);
|
||||
|
||||
statesScrollView = new ScrollView(statesList);
|
||||
mapsLayout->addWidget(statesScrollView);
|
||||
|
||||
QObject::connect(statesButton, &QPushButton::clicked, this, [this]() {
|
||||
mapsLayout->setCurrentWidget(statesScrollView);
|
||||
statesButton->setStyleSheet(activeButtonStyle);
|
||||
countriesButton->setStyleSheet(normalButtonStyle);
|
||||
});
|
||||
|
||||
FrogPilotListWidget *countriesList = new FrogPilotListWidget();
|
||||
|
||||
LabelControl *africaLabel = new LabelControl(tr("Africa"), "");
|
||||
countriesList->addItem(africaLabel);
|
||||
|
||||
ButtonSelectionControl *africaControl = new ButtonSelectionControl("", tr(""), tr(""), africaMap, true);
|
||||
countriesList->addItem(africaControl);
|
||||
|
||||
LabelControl *antarcticaLabel = new LabelControl(tr("Antarctica"), "");
|
||||
countriesList->addItem(antarcticaLabel);
|
||||
|
||||
ButtonSelectionControl *antarcticaControl = new ButtonSelectionControl("", tr(""), tr(""), antarcticaMap, true);
|
||||
countriesList->addItem(antarcticaControl);
|
||||
|
||||
LabelControl *asiaLabel = new LabelControl(tr("Asia"), "");
|
||||
countriesList->addItem(asiaLabel);
|
||||
|
||||
ButtonSelectionControl *asiaControl = new ButtonSelectionControl("", tr(""), tr(""), asiaMap, true);
|
||||
countriesList->addItem(asiaControl);
|
||||
|
||||
LabelControl *europeLabel = new LabelControl(tr("Europe"), "");
|
||||
countriesList->addItem(europeLabel);
|
||||
|
||||
ButtonSelectionControl *europeControl = new ButtonSelectionControl("", tr(""), tr(""), europeMap, true);
|
||||
countriesList->addItem(europeControl);
|
||||
|
||||
LabelControl *northAmericaLabel = new LabelControl(tr("North America"), "");
|
||||
countriesList->addItem(northAmericaLabel);
|
||||
|
||||
ButtonSelectionControl *northAmericaControl = new ButtonSelectionControl("", tr(""), tr(""), northAmericaMap, true);
|
||||
countriesList->addItem(northAmericaControl);
|
||||
|
||||
LabelControl *oceaniaLabel = new LabelControl(tr("Oceania"), "");
|
||||
countriesList->addItem(oceaniaLabel);
|
||||
|
||||
ButtonSelectionControl *oceaniaControl = new ButtonSelectionControl("", tr(""), tr(""), oceaniaMap, true);
|
||||
countriesList->addItem(oceaniaControl);
|
||||
|
||||
LabelControl *southAmericaLabel = new LabelControl(tr("South America"), "");
|
||||
countriesList->addItem(southAmericaLabel);
|
||||
|
||||
ButtonSelectionControl *southAmericaControl = new ButtonSelectionControl("", tr(""), tr(""), southAmericaMap, true);
|
||||
countriesList->addItem(southAmericaControl);
|
||||
|
||||
countriesScrollView = new ScrollView(countriesList);
|
||||
mapsLayout->addWidget(countriesScrollView);
|
||||
|
||||
QObject::connect(countriesButton, &QPushButton::clicked, this, [this]() {
|
||||
mapsLayout->setCurrentWidget(countriesScrollView);
|
||||
statesButton->setStyleSheet(normalButtonStyle);
|
||||
countriesButton->setStyleSheet(activeButtonStyle);
|
||||
});
|
||||
|
||||
mapsLayout->setCurrentWidget(statesScrollView);
|
||||
statesButton->setStyleSheet(activeButtonStyle);
|
||||
|
||||
setStyleSheet(R"(
|
||||
QPushButton {
|
||||
font-size: 50px;
|
||||
margin: 0px;
|
||||
padding: 15px;
|
||||
border-width: 0;
|
||||
border-radius: 30px;
|
||||
color: #dddddd;
|
||||
background-color: #393939;
|
||||
}
|
||||
QPushButton:pressed {
|
||||
background-color: #4a4a4a;
|
||||
}
|
||||
)");
|
||||
}
|
||||
|
||||
QString SelectMaps::activeButtonStyle = R"(
|
||||
font-size: 50px;
|
||||
margin: 0px;
|
||||
padding: 15px;
|
||||
border-width: 0;
|
||||
border-radius: 30px;
|
||||
color: #dddddd;
|
||||
background-color: #33Ab4C;
|
||||
)";
|
||||
|
||||
QString SelectMaps::normalButtonStyle = R"(
|
||||
font-size: 50px;
|
||||
margin: 0px;
|
||||
padding: 15px;
|
||||
border-width: 0;
|
||||
border-radius: 30px;
|
||||
color: #dddddd;
|
||||
background-color: #393939;
|
||||
)";
|
||||
|
||||
QFrame *SelectMaps::horizontalLine(QWidget *parent) const {
|
||||
QFrame *line = new QFrame(parent);
|
||||
|
||||
line->setFrameShape(QFrame::StyledPanel);
|
||||
line->setStyleSheet(R"(
|
||||
border-width: 2px;
|
||||
border-bottom-style: solid;
|
||||
border-color: gray;
|
||||
)");
|
||||
line->setFixedHeight(2);
|
||||
|
||||
return line;
|
||||
}
|
||||
|
||||
void SelectMaps::hideEvent(QHideEvent *event) {
|
||||
QWidget::hideEvent(event);
|
||||
emit setMaps();
|
||||
}
|
||||
|
||||
Primeless::Primeless(QWidget *parent) : QWidget(parent) {
|
||||
QStackedLayout *primelessLayout = new QStackedLayout(this);
|
||||
|
||||
QWidget *mainWidget = new QWidget();
|
||||
mainLayout = new QVBoxLayout(mainWidget);
|
||||
mainLayout->setMargin(40);
|
||||
|
||||
backButton = new QPushButton(tr("Back"), this);
|
||||
backButton->setObjectName("backButton");
|
||||
backButton->setFixedSize(400, 100);
|
||||
QObject::connect(backButton, &QPushButton::clicked, this, [this]() { emit backPress(); });
|
||||
mainLayout->addWidget(backButton, 0, Qt::AlignLeft);
|
||||
|
||||
list = new FrogPilotListWidget(mainWidget);
|
||||
|
||||
wifi = new WifiManager(this);
|
||||
ipLabel = new LabelControl(tr("Manage Your Settings At"), QString("%1:8082").arg(wifi->getIp4Address()));
|
||||
list->addItem(ipLabel);
|
||||
|
||||
std::vector<QString> searchOptions{tr("MapBox"), tr("Amap"), tr("Google")};
|
||||
ButtonParamControl *searchInput = new ButtonParamControl("SearchInput", tr("Destination Search Provider"),
|
||||
tr("Select a search provider for destination queries in Navigate on Openpilot. Options include MapBox (recommended), Amap, and Google Maps."),
|
||||
"", searchOptions);
|
||||
list->addItem(searchInput);
|
||||
|
||||
createMapboxKeyControl(publicMapboxKeyControl, tr("Public Mapbox Key"), "MapboxPublicKey", "pk.");
|
||||
createMapboxKeyControl(secretMapboxKeyControl, tr("Secret Mapbox Key"), "MapboxSecretKey", "sk.");
|
||||
|
||||
mapboxPublicKeySet = !params.get("MapboxPublicKey").empty();
|
||||
mapboxSecretKeySet = !params.get("MapboxSecretKey").empty();
|
||||
setupCompleted = mapboxPublicKeySet && mapboxSecretKeySet;
|
||||
|
||||
QHBoxLayout *setupLayout = new QHBoxLayout();
|
||||
setupLayout->setMargin(0);
|
||||
|
||||
imageLabel = new QLabel(this);
|
||||
pixmap.load(currentStep);
|
||||
imageLabel->setPixmap(pixmap.scaledToWidth(1500, Qt::SmoothTransformation));
|
||||
setupLayout->addWidget(imageLabel, 0, Qt::AlignCenter);
|
||||
imageLabel->hide();
|
||||
|
||||
ButtonControl *setupButton = new ButtonControl(tr("Mapbox Setup Instructions"), tr("VIEW"), tr("View the instructions to set up MapBox for Primeless Navigation."), this);
|
||||
QObject::connect(setupButton, &ButtonControl::clicked, this, [this]() {
|
||||
updateStep();
|
||||
backButton->hide();
|
||||
list->setVisible(false);
|
||||
imageLabel->show();
|
||||
});
|
||||
list->addItem(setupButton);
|
||||
|
||||
QObject::connect(uiState(), &UIState::uiUpdate, this, &Primeless::updateState);
|
||||
|
||||
mainLayout->addLayout(setupLayout);
|
||||
mainLayout->addWidget(new ScrollView(list, mainWidget));
|
||||
mainWidget->setLayout(mainLayout);
|
||||
primelessLayout->addWidget(mainWidget);
|
||||
|
||||
setLayout(primelessLayout);
|
||||
|
||||
setStyleSheet(R"(
|
||||
QPushButton {
|
||||
font-size: 50px;
|
||||
margin: 0px;
|
||||
padding: 15px;
|
||||
border-width: 0;
|
||||
border-radius: 30px;
|
||||
color: #dddddd;
|
||||
background-color: #393939;
|
||||
}
|
||||
QPushButton:pressed {
|
||||
background-color: #4a4a4a;
|
||||
}
|
||||
)");
|
||||
}
|
||||
|
||||
void Primeless::hideEvent(QHideEvent *event) {
|
||||
QWidget::hideEvent(event);
|
||||
backButton->show();
|
||||
list->setVisible(true);
|
||||
imageLabel->hide();
|
||||
}
|
||||
|
||||
void Primeless::mousePressEvent(QMouseEvent *event) {
|
||||
backButton->show();
|
||||
list->setVisible(true);
|
||||
imageLabel->hide();
|
||||
}
|
||||
|
||||
void Primeless::updateState() {
|
||||
if (!isVisible()) return;
|
||||
|
||||
QString ipAddress = wifi->getIp4Address();
|
||||
ipLabel->setText(ipAddress.isEmpty() ? tr("Device Offline") : QString("%1:8082").arg(ipAddress));
|
||||
|
||||
mapboxPublicKeySet = !params.get("MapboxPublicKey").empty();
|
||||
mapboxSecretKeySet = !params.get("MapboxSecretKey").empty();
|
||||
setupCompleted = mapboxPublicKeySet && mapboxSecretKeySet && setupCompleted;
|
||||
|
||||
publicMapboxKeyControl->setText(mapboxPublicKeySet ? tr("REMOVE") : tr("ADD"));
|
||||
secretMapboxKeyControl->setText(mapboxSecretKeySet ? tr("REMOVE") : tr("ADD"));
|
||||
|
||||
if (imageLabel->isVisible()) {
|
||||
updateStep();
|
||||
}
|
||||
}
|
||||
|
||||
void Primeless::createMapboxKeyControl(ButtonControl *&control, const QString &label, const std::string ¶mKey, const QString &prefix) {
|
||||
control = new ButtonControl(label, "", tr("Manage your %1."), this);
|
||||
QObject::connect(control, &ButtonControl::clicked, this, [this, control, label, paramKey, prefix] {
|
||||
if (control->text() == tr("ADD")) {
|
||||
QString key = InputDialog::getText(tr("Enter your %1").arg(label), this);
|
||||
if (!key.startsWith(prefix)) {
|
||||
key = prefix + key;
|
||||
}
|
||||
if (key.length() >= 80) {
|
||||
params.put(paramKey, key.toStdString());
|
||||
}
|
||||
} else {
|
||||
params.remove(paramKey);
|
||||
}
|
||||
});
|
||||
list->addItem(control);
|
||||
control->setText(params.get(paramKey).empty() ? tr("ADD") : tr("REMOVE"));
|
||||
}
|
||||
|
||||
void Primeless::updateStep() {
|
||||
currentStep = setupCompleted ? "../frogpilot/navigation/navigation_training/setup_completed.png" :
|
||||
(mapboxPublicKeySet && mapboxSecretKeySet) ? "../frogpilot/navigation/navigation_training/both_keys_set.png" :
|
||||
mapboxPublicKeySet ? "../frogpilot/navigation/navigation_training/public_key_set.png" : "../frogpilot/navigation/navigation_training/no_keys_set.png";
|
||||
|
||||
pixmap.load(currentStep);
|
||||
imageLabel->setPixmap(pixmap.scaledToWidth(1500, Qt::SmoothTransformation));
|
||||
}
|
||||
@@ -1,121 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include "selfdrive/frogpilot/ui/frogpilot_ui_functions.h"
|
||||
#include "selfdrive/ui/qt/network/wifi_manager.h"
|
||||
#include "selfdrive/ui/qt/offroad/settings.h"
|
||||
#include "selfdrive/ui/qt/widgets/scrollview.h"
|
||||
#include "selfdrive/ui/ui.h"
|
||||
|
||||
class Primeless : public QWidget {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit Primeless(QWidget *parent = nullptr);
|
||||
|
||||
protected:
|
||||
void mousePressEvent(QMouseEvent *event) override;
|
||||
void hideEvent(QHideEvent *event) override;
|
||||
|
||||
private:
|
||||
void createMapboxKeyControl(ButtonControl *&control, const QString &label, const std::string ¶mKey, const QString &prefix);
|
||||
void updateState();
|
||||
void updateStep();
|
||||
|
||||
QVBoxLayout *mainLayout;
|
||||
FrogPilotListWidget *list;
|
||||
|
||||
QPushButton *backButton;
|
||||
QLabel *imageLabel;
|
||||
|
||||
ButtonControl *publicMapboxKeyControl;
|
||||
ButtonControl *secretMapboxKeyControl;
|
||||
LabelControl *ipLabel;
|
||||
|
||||
WifiManager *wifi;
|
||||
|
||||
bool mapboxPublicKeySet;
|
||||
bool mapboxSecretKeySet;
|
||||
bool setupCompleted;
|
||||
QPixmap pixmap;
|
||||
QString currentStep = "../assets/images/setup_completed.png";
|
||||
|
||||
Params params;
|
||||
|
||||
signals:
|
||||
void backPress();
|
||||
};
|
||||
|
||||
class SelectMaps : public QWidget {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit SelectMaps(QWidget *parent = nullptr);
|
||||
|
||||
QFrame *horizontalLine(QWidget *parent = nullptr) const;
|
||||
|
||||
private:
|
||||
void hideEvent(QHideEvent *event);
|
||||
|
||||
ScrollView *countriesScrollView;
|
||||
ScrollView *statesScrollView;
|
||||
QStackedLayout *mapsLayout;
|
||||
|
||||
QPushButton *backButton;
|
||||
QPushButton *statesButton;
|
||||
QPushButton *countriesButton;
|
||||
|
||||
static QString activeButtonStyle;
|
||||
static QString normalButtonStyle;
|
||||
|
||||
signals:
|
||||
void backPress();
|
||||
void setMaps();
|
||||
};
|
||||
|
||||
class FrogPilotNavigationPanel : public QFrame {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit FrogPilotNavigationPanel(QWidget *parent = 0);
|
||||
|
||||
private:
|
||||
void cancelDownload(QWidget *parent);
|
||||
void checkIfUpdateMissed();
|
||||
void downloadMaps();
|
||||
void downloadSchedule();
|
||||
void hideEvent(QHideEvent *event);
|
||||
void removeMaps(QWidget *parent);
|
||||
void setMaps();
|
||||
void updateDownloadedLabel();
|
||||
void updateState();
|
||||
void updateStatuses();
|
||||
void updateVisibility(bool visibility);
|
||||
|
||||
QStackedLayout *mainLayout;
|
||||
QWidget *navigationWidget;
|
||||
|
||||
ButtonControl *cancelDownloadButton;
|
||||
ButtonControl *downloadOfflineMapsButton;
|
||||
ButtonControl *redownloadOfflineMapsButton;
|
||||
ButtonControl *removeOfflineMapsButton;
|
||||
|
||||
LabelControl *lastMapsDownload;
|
||||
LabelControl *offlineMapsSize;
|
||||
LabelControl *offlineMapsStatus;
|
||||
LabelControl *offlineMapsETA;
|
||||
LabelControl *offlineMapsElapsed;
|
||||
|
||||
bool downloadActive;
|
||||
bool previousDownloadActive;
|
||||
bool scheduleCompleted;
|
||||
bool schedulePending;
|
||||
int schedule;
|
||||
QString elapsedTime;
|
||||
QString offlineFolderPath = "/data/media/0/osm/offline";
|
||||
std::string osmDownloadProgress;
|
||||
std::string previousOSMDownloadProgress;
|
||||
|
||||
Params params;
|
||||
Params paramsMemory{"/dev/shm/params"};
|
||||
UIScene &scene;
|
||||
};
|
||||
@@ -1,89 +0,0 @@
|
||||
#pragma once
|
||||
#include <iostream>
|
||||
#include <queue>
|
||||
#include <mutex>
|
||||
|
||||
template <class T>
|
||||
class BlockingQueue
|
||||
{
|
||||
public:
|
||||
std::deque<T> content;
|
||||
size_t capacity;
|
||||
|
||||
std::mutex mutex;
|
||||
std::condition_variable not_empty;
|
||||
std::condition_variable not_full;
|
||||
|
||||
BlockingQueue(const BlockingQueue &) = delete;
|
||||
BlockingQueue(BlockingQueue &&) = delete;
|
||||
BlockingQueue &operator = (const BlockingQueue &) = delete;
|
||||
BlockingQueue &operator = (BlockingQueue &&) = delete;
|
||||
|
||||
public:
|
||||
BlockingQueue(size_t capacity): capacity(capacity) {}
|
||||
|
||||
void clear() {
|
||||
{
|
||||
std::unique_lock<std::mutex> lk(mutex);
|
||||
content.clear();
|
||||
}
|
||||
not_full.notify_one();
|
||||
}
|
||||
|
||||
void push(T &&item) {
|
||||
{
|
||||
std::unique_lock<std::mutex> lk(mutex);
|
||||
not_full.wait(lk, [this]() { return content.size() < capacity; });
|
||||
content.push_back(std::move(item));
|
||||
}
|
||||
not_empty.notify_one();
|
||||
}
|
||||
|
||||
bool try_push(T &&item) {
|
||||
{
|
||||
std::unique_lock<std::mutex> lk(mutex);
|
||||
if (content.size() == capacity)
|
||||
return false;
|
||||
content.push_back(std::move(item));
|
||||
}
|
||||
not_empty.notify_one();
|
||||
return true;
|
||||
}
|
||||
|
||||
void pop(T &item) {
|
||||
{
|
||||
std::unique_lock<std::mutex> lk(mutex);
|
||||
not_empty.wait(lk, [this]() { return !content.empty(); });
|
||||
item = std::move(content.front());
|
||||
content.pop_front();
|
||||
}
|
||||
not_full.notify_one();
|
||||
}
|
||||
|
||||
bool pop_wait_for(T &item, std::chrono::milliseconds duration) {
|
||||
{
|
||||
std::unique_lock<std::mutex> lk(mutex);
|
||||
if(not_empty.wait_for(lk, duration, [this]() { return !content.empty(); })) {
|
||||
item = std::move(content.front());
|
||||
content.pop_front();
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
not_full.notify_one();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool try_pop(T &item) {
|
||||
{
|
||||
std::unique_lock<std::mutex> lk(mutex);
|
||||
if (content.empty())
|
||||
return false;
|
||||
item = std::move(content.front());
|
||||
content.pop_front();
|
||||
}
|
||||
not_full.notify_one();
|
||||
return true;
|
||||
}
|
||||
};
|
||||
@@ -1,697 +0,0 @@
|
||||
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||
|
||||
#include "selfdrive/frogpilot/screenrecorder/omx_encoder.h"
|
||||
|
||||
#include <fcntl.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <cassert>
|
||||
#include <cstdlib>
|
||||
#include <cstdio>
|
||||
|
||||
#include <OMX_Component.h>
|
||||
#include <OMX_IndexExt.h>
|
||||
#include <OMX_QCOMExtns.h>
|
||||
#include <OMX_VideoExt.h>
|
||||
#include "libyuv.h"
|
||||
#include "msm_media_info.h"
|
||||
#include "common/swaglog.h"
|
||||
#include "common/util.h"
|
||||
|
||||
|
||||
using namespace libyuv;
|
||||
|
||||
LIBYUV_API
|
||||
int ABGRToNV12(const uint8_t* src_abgr,
|
||||
int src_stride_abgr,
|
||||
uint8_t* dst_y,
|
||||
int dst_stride_y,
|
||||
uint8_t* dst_uv,
|
||||
int dst_stride_uv,
|
||||
int width,
|
||||
int height) {
|
||||
int y;
|
||||
int halfwidth = (width + 1) >> 1;
|
||||
void (*ABGRToUVRow)(const uint8_t* src_abgr0, int src_stride_abgr,
|
||||
uint8_t* dst_u, uint8_t* dst_v, int width) =
|
||||
ABGRToUVRow_C;
|
||||
void (*ABGRToYRow)(const uint8_t* src_abgr, uint8_t* dst_y, int width) =
|
||||
ABGRToYRow_C;
|
||||
void (*MergeUVRow_)(const uint8_t* src_u, const uint8_t* src_v, uint8_t* dst_uv, int width) = MergeUVRow_C;
|
||||
if (!src_abgr || !dst_y || !dst_uv || width <= 0 || height == 0) {
|
||||
return -1;
|
||||
}
|
||||
if (height < 0) { // Negative height means invert the image.
|
||||
height = -height;
|
||||
src_abgr = src_abgr + (height - 1) * src_stride_abgr;
|
||||
src_stride_abgr = -src_stride_abgr;
|
||||
}
|
||||
#if defined(HAS_ABGRTOYROW_SSSE3) && defined(HAS_ABGRTOUVROW_SSSE3)
|
||||
if (TestCpuFlag(kCpuHasSSSE3)) {
|
||||
ABGRToUVRow = ABGRToUVRow_Any_SSSE3;
|
||||
ABGRToYRow = ABGRToYRow_Any_SSSE3;
|
||||
if (IS_ALIGNED(width, 16)) {
|
||||
ABGRToUVRow = ABGRToUVRow_SSSE3;
|
||||
ABGRToYRow = ABGRToYRow_SSSE3;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#if defined(HAS_ABGRTOYROW_AVX2) && defined(HAS_ABGRTOUVROW_AVX2)
|
||||
if (TestCpuFlag(kCpuHasAVX2)) {
|
||||
ABGRToUVRow = ABGRToUVRow_Any_AVX2;
|
||||
ABGRToYRow = ABGRToYRow_Any_AVX2;
|
||||
if (IS_ALIGNED(width, 32)) {
|
||||
ABGRToUVRow = ABGRToUVRow_AVX2;
|
||||
ABGRToYRow = ABGRToYRow_AVX2;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#if defined(HAS_ABGRTOYROW_NEON)
|
||||
if (TestCpuFlag(kCpuHasNEON)) {
|
||||
ABGRToYRow = ABGRToYRow_Any_NEON;
|
||||
if (IS_ALIGNED(width, 8)) {
|
||||
ABGRToYRow = ABGRToYRow_NEON;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#if defined(HAS_ABGRTOUVROW_NEON)
|
||||
if (TestCpuFlag(kCpuHasNEON)) {
|
||||
ABGRToUVRow = ABGRToUVRow_Any_NEON;
|
||||
if (IS_ALIGNED(width, 16)) {
|
||||
ABGRToUVRow = ABGRToUVRow_NEON;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#if defined(HAS_ABGRTOYROW_MMI) && defined(HAS_ABGRTOUVROW_MMI)
|
||||
if (TestCpuFlag(kCpuHasMMI)) {
|
||||
ABGRToYRow = ABGRToYRow_Any_MMI;
|
||||
ABGRToUVRow = ABGRToUVRow_Any_MMI;
|
||||
if (IS_ALIGNED(width, 8)) {
|
||||
ABGRToYRow = ABGRToYRow_MMI;
|
||||
}
|
||||
if (IS_ALIGNED(width, 16)) {
|
||||
ABGRToUVRow = ABGRToUVRow_MMI;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#if defined(HAS_ABGRTOYROW_MSA) && defined(HAS_ABGRTOUVROW_MSA)
|
||||
if (TestCpuFlag(kCpuHasMSA)) {
|
||||
ABGRToYRow = ABGRToYRow_Any_MSA;
|
||||
ABGRToUVRow = ABGRToUVRow_Any_MSA;
|
||||
if (IS_ALIGNED(width, 16)) {
|
||||
ABGRToYRow = ABGRToYRow_MSA;
|
||||
}
|
||||
if (IS_ALIGNED(width, 32)) {
|
||||
ABGRToUVRow = ABGRToUVRow_MSA;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#if defined(HAS_MERGEUVROW_SSE2)
|
||||
if (TestCpuFlag(kCpuHasSSE2)) {
|
||||
MergeUVRow_ = MergeUVRow_Any_SSE2;
|
||||
if (IS_ALIGNED(halfwidth, 16)) {
|
||||
MergeUVRow_ = MergeUVRow_SSE2;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#if defined(HAS_MERGEUVROW_AVX2)
|
||||
if (TestCpuFlag(kCpuHasAVX2)) {
|
||||
MergeUVRow_ = MergeUVRow_Any_AVX2;
|
||||
if (IS_ALIGNED(halfwidth, 32)) {
|
||||
MergeUVRow_ = MergeUVRow_AVX2;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#if defined(HAS_MERGEUVROW_NEON)
|
||||
if (TestCpuFlag(kCpuHasNEON)) {
|
||||
MergeUVRow_ = MergeUVRow_Any_NEON;
|
||||
if (IS_ALIGNED(halfwidth, 16)) {
|
||||
MergeUVRow_ = MergeUVRow_NEON;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#if defined(HAS_MERGEUVROW_MMI)
|
||||
if (TestCpuFlag(kCpuHasMMI)) {
|
||||
MergeUVRow_ = MergeUVRow_Any_MMI;
|
||||
if (IS_ALIGNED(halfwidth, 8)) {
|
||||
MergeUVRow_ = MergeUVRow_MMI;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#if defined(HAS_MERGEUVROW_MSA)
|
||||
if (TestCpuFlag(kCpuHasMSA)) {
|
||||
MergeUVRow_ = MergeUVRow_Any_MSA;
|
||||
if (IS_ALIGNED(halfwidth, 16)) {
|
||||
MergeUVRow_ = MergeUVRow_MSA;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
{
|
||||
// Allocate a rows of uv.
|
||||
align_buffer_64(row_u, ((halfwidth + 31) & ~31) * 2);
|
||||
uint8_t* row_v = row_u + ((halfwidth + 31) & ~31);
|
||||
|
||||
for (y = 0; y < height - 1; y += 2) {
|
||||
ABGRToUVRow(src_abgr, src_stride_abgr, row_u, row_v, width);
|
||||
MergeUVRow_(row_u, row_v, dst_uv, halfwidth);
|
||||
ABGRToYRow(src_abgr, dst_y, width);
|
||||
ABGRToYRow(src_abgr + src_stride_abgr, dst_y + dst_stride_y, width);
|
||||
src_abgr += src_stride_abgr * 2;
|
||||
dst_y += dst_stride_y * 2;
|
||||
dst_uv += dst_stride_uv;
|
||||
}
|
||||
if (height & 1) {
|
||||
ABGRToUVRow(src_abgr, 0, row_u, row_v, width);
|
||||
MergeUVRow_(row_u, row_v, dst_uv, halfwidth);
|
||||
ABGRToYRow(src_abgr, dst_y, width);
|
||||
}
|
||||
free_aligned_buffer_64(row_u);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Check the OMX error code and assert if an error occurred.
|
||||
#define OMX_CHECK(_expr) \
|
||||
do { \
|
||||
assert(OMX_ErrorNone == (_expr)); \
|
||||
} while (0)
|
||||
|
||||
extern ExitHandler do_exit;
|
||||
|
||||
// ***** OMX callback functions *****
|
||||
|
||||
void OmxEncoder::wait_for_state(OMX_STATETYPE state_) {
|
||||
std::unique_lock lk(this->state_lock);
|
||||
while (this->state != state_) {
|
||||
this->state_cv.wait(lk);
|
||||
}
|
||||
}
|
||||
|
||||
static OMX_CALLBACKTYPE omx_callbacks = {
|
||||
.EventHandler = OmxEncoder::event_handler,
|
||||
.EmptyBufferDone = OmxEncoder::empty_buffer_done,
|
||||
.FillBufferDone = OmxEncoder::fill_buffer_done,
|
||||
};
|
||||
|
||||
OMX_ERRORTYPE OmxEncoder::event_handler(OMX_HANDLETYPE component, OMX_PTR app_data, OMX_EVENTTYPE event,
|
||||
OMX_U32 data1, OMX_U32 data2, OMX_PTR event_data) {
|
||||
OmxEncoder *e = (OmxEncoder*)app_data;
|
||||
if (event == OMX_EventCmdComplete) {
|
||||
assert(data1 == OMX_CommandStateSet);
|
||||
LOG("set state event 0x%x", data2);
|
||||
{
|
||||
std::unique_lock lk(e->state_lock);
|
||||
e->state = (OMX_STATETYPE)data2;
|
||||
}
|
||||
e->state_cv.notify_all();
|
||||
} else if (event == OMX_EventError) {
|
||||
LOGE("OMX error 0x%08x", data1);
|
||||
} else {
|
||||
LOGE("OMX unhandled event %d", event);
|
||||
assert(false);
|
||||
}
|
||||
|
||||
return OMX_ErrorNone;
|
||||
}
|
||||
|
||||
OMX_ERRORTYPE OmxEncoder::empty_buffer_done(OMX_HANDLETYPE component, OMX_PTR app_data,
|
||||
OMX_BUFFERHEADERTYPE *buffer) {
|
||||
OmxEncoder *e = (OmxEncoder*)app_data;
|
||||
e->free_in.push(buffer);
|
||||
return OMX_ErrorNone;
|
||||
}
|
||||
|
||||
OMX_ERRORTYPE OmxEncoder::fill_buffer_done(OMX_HANDLETYPE component, OMX_PTR app_data,
|
||||
OMX_BUFFERHEADERTYPE *buffer) {
|
||||
OmxEncoder *e = (OmxEncoder*)app_data;
|
||||
e->done_out.push(buffer);
|
||||
return OMX_ErrorNone;
|
||||
}
|
||||
|
||||
#define PORT_INDEX_IN 0
|
||||
#define PORT_INDEX_OUT 1
|
||||
|
||||
static const char* omx_color_fomat_name(uint32_t format) __attribute__((unused));
|
||||
static const char* omx_color_fomat_name(uint32_t format) {
|
||||
switch (format) {
|
||||
case OMX_COLOR_FormatUnused: return "OMX_COLOR_FormatUnused";
|
||||
case OMX_COLOR_FormatMonochrome: return "OMX_COLOR_FormatMonochrome";
|
||||
case OMX_COLOR_Format8bitRGB332: return "OMX_COLOR_Format8bitRGB332";
|
||||
case OMX_COLOR_Format12bitRGB444: return "OMX_COLOR_Format12bitRGB444";
|
||||
case OMX_COLOR_Format16bitARGB4444: return "OMX_COLOR_Format16bitARGB4444";
|
||||
case OMX_COLOR_Format16bitARGB1555: return "OMX_COLOR_Format16bitARGB1555";
|
||||
case OMX_COLOR_Format16bitRGB565: return "OMX_COLOR_Format16bitRGB565";
|
||||
case OMX_COLOR_Format16bitBGR565: return "OMX_COLOR_Format16bitBGR565";
|
||||
case OMX_COLOR_Format18bitRGB666: return "OMX_COLOR_Format18bitRGB666";
|
||||
case OMX_COLOR_Format18bitARGB1665: return "OMX_COLOR_Format18bitARGB1665";
|
||||
case OMX_COLOR_Format19bitARGB1666: return "OMX_COLOR_Format19bitARGB1666";
|
||||
case OMX_COLOR_Format24bitRGB888: return "OMX_COLOR_Format24bitRGB888";
|
||||
case OMX_COLOR_Format24bitBGR888: return "OMX_COLOR_Format24bitBGR888";
|
||||
case OMX_COLOR_Format24bitARGB1887: return "OMX_COLOR_Format24bitARGB1887";
|
||||
case OMX_COLOR_Format25bitARGB1888: return "OMX_COLOR_Format25bitARGB1888";
|
||||
case OMX_COLOR_Format32bitBGRA8888: return "OMX_COLOR_Format32bitBGRA8888";
|
||||
case OMX_COLOR_Format32bitARGB8888: return "OMX_COLOR_Format32bitARGB8888";
|
||||
case OMX_COLOR_FormatYUV411Planar: return "OMX_COLOR_FormatYUV411Planar";
|
||||
case OMX_COLOR_FormatYUV411PackedPlanar: return "OMX_COLOR_FormatYUV411PackedPlanar";
|
||||
case OMX_COLOR_FormatYUV420Planar: return "OMX_COLOR_FormatYUV420Planar";
|
||||
case OMX_COLOR_FormatYUV420PackedPlanar: return "OMX_COLOR_FormatYUV420PackedPlanar";
|
||||
case OMX_COLOR_FormatYUV420SemiPlanar: return "OMX_COLOR_FormatYUV420SemiPlanar";
|
||||
case OMX_COLOR_FormatYUV422Planar: return "OMX_COLOR_FormatYUV422Planar";
|
||||
case OMX_COLOR_FormatYUV422PackedPlanar: return "OMX_COLOR_FormatYUV422PackedPlanar";
|
||||
case OMX_COLOR_FormatYUV422SemiPlanar: return "OMX_COLOR_FormatYUV422SemiPlanar";
|
||||
case OMX_COLOR_FormatYCbYCr: return "OMX_COLOR_FormatYCbYCr";
|
||||
case OMX_COLOR_FormatYCrYCb: return "OMX_COLOR_FormatYCrYCb";
|
||||
case OMX_COLOR_FormatCbYCrY: return "OMX_COLOR_FormatCbYCrY";
|
||||
case OMX_COLOR_FormatCrYCbY: return "OMX_COLOR_FormatCrYCbY";
|
||||
case OMX_COLOR_FormatYUV444Interleaved: return "OMX_COLOR_FormatYUV444Interleaved";
|
||||
case OMX_COLOR_FormatRawBayer8bit: return "OMX_COLOR_FormatRawBayer8bit";
|
||||
case OMX_COLOR_FormatRawBayer10bit: return "OMX_COLOR_FormatRawBayer10bit";
|
||||
case OMX_COLOR_FormatRawBayer8bitcompressed: return "OMX_COLOR_FormatRawBayer8bitcompressed";
|
||||
case OMX_COLOR_FormatL2: return "OMX_COLOR_FormatL2";
|
||||
case OMX_COLOR_FormatL4: return "OMX_COLOR_FormatL4";
|
||||
case OMX_COLOR_FormatL8: return "OMX_COLOR_FormatL8";
|
||||
case OMX_COLOR_FormatL16: return "OMX_COLOR_FormatL16";
|
||||
case OMX_COLOR_FormatL24: return "OMX_COLOR_FormatL24";
|
||||
case OMX_COLOR_FormatL32: return "OMX_COLOR_FormatL32";
|
||||
case OMX_COLOR_FormatYUV420PackedSemiPlanar: return "OMX_COLOR_FormatYUV420PackedSemiPlanar";
|
||||
case OMX_COLOR_FormatYUV422PackedSemiPlanar: return "OMX_COLOR_FormatYUV422PackedSemiPlanar";
|
||||
case OMX_COLOR_Format18BitBGR666: return "OMX_COLOR_Format18BitBGR666";
|
||||
case OMX_COLOR_Format24BitARGB6666: return "OMX_COLOR_Format24BitARGB6666";
|
||||
case OMX_COLOR_Format24BitABGR6666: return "OMX_COLOR_Format24BitABGR6666";
|
||||
|
||||
case OMX_COLOR_FormatAndroidOpaque: return "OMX_COLOR_FormatAndroidOpaque";
|
||||
case OMX_TI_COLOR_FormatYUV420PackedSemiPlanar: return "OMX_TI_COLOR_FormatYUV420PackedSemiPlanar";
|
||||
case OMX_QCOM_COLOR_FormatYVU420SemiPlanar: return "OMX_QCOM_COLOR_FormatYVU420SemiPlanar";
|
||||
case OMX_QCOM_COLOR_FormatYUV420PackedSemiPlanar64x32Tile2m8ka: return "OMX_QCOM_COLOR_FormatYUV420PackedSemiPlanar64x32Tile2m8ka";
|
||||
case OMX_SEC_COLOR_FormatNV12Tiled: return "OMX_SEC_COLOR_FormatNV12Tiled";
|
||||
case OMX_QCOM_COLOR_FormatYUV420PackedSemiPlanar32m: return "OMX_QCOM_COLOR_FormatYUV420PackedSemiPlanar32m";
|
||||
|
||||
case QOMX_COLOR_FormatYVU420PackedSemiPlanar32m4ka: return "QOMX_COLOR_FormatYVU420PackedSemiPlanar32m4ka";
|
||||
case QOMX_COLOR_FormatYUV420PackedSemiPlanar16m2ka: return "QOMX_COLOR_FormatYUV420PackedSemiPlanar16m2ka";
|
||||
case QOMX_COLOR_FORMATYUV420PackedSemiPlanar32mMultiView: return "QOMX_COLOR_FORMATYUV420PackedSemiPlanar32mMultiView";
|
||||
case QOMX_COLOR_FORMATYUV420PackedSemiPlanar32mCompressed: return "QOMX_COLOR_FORMATYUV420PackedSemiPlanar32mCompressed";
|
||||
case QOMX_COLOR_Format32bitRGBA8888: return "QOMX_COLOR_Format32bitRGBA8888";
|
||||
case QOMX_COLOR_Format32bitRGBA8888Compressed: return "QOMX_COLOR_Format32bitRGBA8888Compressed";
|
||||
|
||||
default:
|
||||
return "unkn";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ***** encoder functions *****
|
||||
|
||||
OmxEncoder::OmxEncoder(const char* path, int width, int height, int fps, int bitrate, bool h265, bool downscale) {
|
||||
this->path = path;
|
||||
this->width = width;
|
||||
this->height = height;
|
||||
this->fps = fps;
|
||||
this->remuxing = !h265;
|
||||
|
||||
this->downscale = downscale;
|
||||
if (this->downscale) {
|
||||
this->y_ptr2 = (uint8_t *)malloc(this->width*this->height);
|
||||
this->u_ptr2 = (uint8_t *)malloc(this->width*this->height/4);
|
||||
this->v_ptr2 = (uint8_t *)malloc(this->width*this->height/4);
|
||||
}
|
||||
|
||||
auto component = (OMX_STRING)(h265 ? "OMX.qcom.video.encoder.hevc" : "OMX.qcom.video.encoder.avc");
|
||||
int err = OMX_GetHandle(&this->handle, component, this, &omx_callbacks);
|
||||
if (err != OMX_ErrorNone) {
|
||||
LOGE("error getting codec: %x", err);
|
||||
}
|
||||
|
||||
// setup input port
|
||||
|
||||
OMX_PARAM_PORTDEFINITIONTYPE in_port = {0};
|
||||
in_port.nSize = sizeof(in_port);
|
||||
in_port.nPortIndex = (OMX_U32) PORT_INDEX_IN;
|
||||
OMX_CHECK(OMX_GetParameter(this->handle, OMX_IndexParamPortDefinition, (OMX_PTR) &in_port));
|
||||
|
||||
in_port.format.video.nFrameWidth = this->width;
|
||||
in_port.format.video.nFrameHeight = this->height;
|
||||
in_port.format.video.nStride = VENUS_Y_STRIDE(COLOR_FMT_NV12, this->width);
|
||||
in_port.format.video.nSliceHeight = this->height;
|
||||
in_port.nBufferSize = VENUS_BUFFER_SIZE(COLOR_FMT_NV12, this->width, this->height);
|
||||
in_port.format.video.xFramerate = (this->fps * 65536);
|
||||
in_port.format.video.eCompressionFormat = OMX_VIDEO_CodingUnused;
|
||||
in_port.format.video.eColorFormat = (OMX_COLOR_FORMATTYPE)QOMX_COLOR_FORMATYUV420PackedSemiPlanar32m;
|
||||
|
||||
OMX_CHECK(OMX_SetParameter(this->handle, OMX_IndexParamPortDefinition, (OMX_PTR) &in_port));
|
||||
OMX_CHECK(OMX_GetParameter(this->handle, OMX_IndexParamPortDefinition, (OMX_PTR) &in_port));
|
||||
this->in_buf_headers.resize(in_port.nBufferCountActual);
|
||||
|
||||
// setup output port
|
||||
|
||||
OMX_PARAM_PORTDEFINITIONTYPE out_port = {0};
|
||||
out_port.nSize = sizeof(out_port);
|
||||
out_port.nPortIndex = (OMX_U32) PORT_INDEX_OUT;
|
||||
OMX_CHECK(OMX_GetParameter(this->handle, OMX_IndexParamPortDefinition, (OMX_PTR)&out_port));
|
||||
out_port.format.video.nFrameWidth = this->width;
|
||||
out_port.format.video.nFrameHeight = this->height;
|
||||
out_port.format.video.xFramerate = 0;
|
||||
out_port.format.video.nBitrate = bitrate;
|
||||
if (h265) {
|
||||
out_port.format.video.eCompressionFormat = OMX_VIDEO_CodingHEVC;
|
||||
} else {
|
||||
out_port.format.video.eCompressionFormat = OMX_VIDEO_CodingAVC;
|
||||
}
|
||||
out_port.format.video.eColorFormat = OMX_COLOR_FormatUnused;
|
||||
|
||||
OMX_CHECK(OMX_SetParameter(this->handle, OMX_IndexParamPortDefinition, (OMX_PTR) &out_port));
|
||||
|
||||
OMX_CHECK(OMX_GetParameter(this->handle, OMX_IndexParamPortDefinition, (OMX_PTR) &out_port));
|
||||
this->out_buf_headers.resize(out_port.nBufferCountActual);
|
||||
|
||||
OMX_VIDEO_PARAM_BITRATETYPE bitrate_type = {0};
|
||||
bitrate_type.nSize = sizeof(bitrate_type);
|
||||
bitrate_type.nPortIndex = (OMX_U32) PORT_INDEX_OUT;
|
||||
OMX_CHECK(OMX_GetParameter(this->handle, OMX_IndexParamVideoBitrate, (OMX_PTR) &bitrate_type));
|
||||
bitrate_type.eControlRate = OMX_Video_ControlRateVariable;
|
||||
bitrate_type.nTargetBitrate = bitrate;
|
||||
|
||||
OMX_CHECK(OMX_SetParameter(this->handle, OMX_IndexParamVideoBitrate, (OMX_PTR) &bitrate_type));
|
||||
|
||||
if (h265) {
|
||||
// setup HEVC
|
||||
#ifndef QCOM2
|
||||
OMX_VIDEO_PARAM_HEVCTYPE hevc_type = {0};
|
||||
OMX_INDEXTYPE index_type = (OMX_INDEXTYPE) OMX_IndexParamVideoHevc;
|
||||
#else
|
||||
OMX_VIDEO_PARAM_PROFILELEVELTYPE hevc_type = {0};
|
||||
OMX_INDEXTYPE index_type = OMX_IndexParamVideoProfileLevelCurrent;
|
||||
#endif
|
||||
hevc_type.nSize = sizeof(hevc_type);
|
||||
hevc_type.nPortIndex = (OMX_U32) PORT_INDEX_OUT;
|
||||
OMX_CHECK(OMX_GetParameter(this->handle, index_type, (OMX_PTR) &hevc_type));
|
||||
|
||||
hevc_type.eProfile = OMX_VIDEO_HEVCProfileMain;
|
||||
hevc_type.eLevel = OMX_VIDEO_HEVCHighTierLevel5;
|
||||
|
||||
OMX_CHECK(OMX_SetParameter(this->handle, index_type, (OMX_PTR) &hevc_type));
|
||||
} else {
|
||||
// setup h264
|
||||
OMX_VIDEO_PARAM_AVCTYPE avc = { 0 };
|
||||
avc.nSize = sizeof(avc);
|
||||
avc.nPortIndex = (OMX_U32) PORT_INDEX_OUT;
|
||||
OMX_CHECK(OMX_GetParameter(this->handle, OMX_IndexParamVideoAvc, &avc));
|
||||
|
||||
avc.nBFrames = 0;
|
||||
avc.nPFrames = 15;
|
||||
|
||||
avc.eProfile = OMX_VIDEO_AVCProfileHigh;
|
||||
avc.eLevel = OMX_VIDEO_AVCLevel31;
|
||||
|
||||
avc.nAllowedPictureTypes |= OMX_VIDEO_PictureTypeB;
|
||||
avc.eLoopFilterMode = OMX_VIDEO_AVCLoopFilterEnable;
|
||||
|
||||
avc.nRefFrames = 1;
|
||||
avc.bUseHadamard = OMX_TRUE;
|
||||
avc.bEntropyCodingCABAC = OMX_TRUE;
|
||||
avc.bWeightedPPrediction = OMX_TRUE;
|
||||
avc.bconstIpred = OMX_TRUE;
|
||||
|
||||
OMX_CHECK(OMX_SetParameter(this->handle, OMX_IndexParamVideoAvc, &avc));
|
||||
}
|
||||
|
||||
OMX_CHECK(OMX_SendCommand(this->handle, OMX_CommandStateSet, OMX_StateIdle, NULL));
|
||||
|
||||
for (auto &buf : this->in_buf_headers) {
|
||||
OMX_CHECK(OMX_AllocateBuffer(this->handle, &buf, PORT_INDEX_IN, this,
|
||||
in_port.nBufferSize));
|
||||
}
|
||||
|
||||
for (auto &buf : this->out_buf_headers) {
|
||||
OMX_CHECK(OMX_AllocateBuffer(this->handle, &buf, PORT_INDEX_OUT, this,
|
||||
out_port.nBufferSize));
|
||||
}
|
||||
|
||||
wait_for_state(OMX_StateIdle);
|
||||
|
||||
OMX_CHECK(OMX_SendCommand(this->handle, OMX_CommandStateSet, OMX_StateExecuting, NULL));
|
||||
|
||||
wait_for_state(OMX_StateExecuting);
|
||||
|
||||
// give omx all the output buffers
|
||||
for (auto &buf : this->out_buf_headers) {
|
||||
OMX_CHECK(OMX_FillThisBuffer(this->handle, buf));
|
||||
}
|
||||
|
||||
// fill the input free queue
|
||||
for (auto &buf : this->in_buf_headers) {
|
||||
this->free_in.push(buf);
|
||||
}
|
||||
}
|
||||
|
||||
void OmxEncoder::handle_out_buf(OmxEncoder *e, OMX_BUFFERHEADERTYPE *out_buf) {
|
||||
int err;
|
||||
uint8_t *buf_data = out_buf->pBuffer + out_buf->nOffset;
|
||||
|
||||
if (out_buf->nFlags & OMX_BUFFERFLAG_CODECCONFIG) {
|
||||
if (e->codec_config_len < out_buf->nFilledLen) {
|
||||
e->codec_config = (uint8_t *)realloc(e->codec_config, out_buf->nFilledLen);
|
||||
}
|
||||
e->codec_config_len = out_buf->nFilledLen;
|
||||
memcpy(e->codec_config, buf_data, out_buf->nFilledLen);
|
||||
#ifdef QCOM2
|
||||
out_buf->nTimeStamp = 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
if (e->of) {
|
||||
fwrite(buf_data, out_buf->nFilledLen, 1, e->of);
|
||||
}
|
||||
|
||||
if (e->remuxing) {
|
||||
if (!e->wrote_codec_config && e->codec_config_len > 0) {
|
||||
// extradata will be freed by av_free() in avcodec_free_context()
|
||||
e->codec_ctx->extradata = (uint8_t*)av_mallocz(e->codec_config_len + AV_INPUT_BUFFER_PADDING_SIZE);
|
||||
e->codec_ctx->extradata_size = e->codec_config_len;
|
||||
memcpy(e->codec_ctx->extradata, e->codec_config, e->codec_config_len);
|
||||
|
||||
err = avcodec_parameters_from_context(e->out_stream->codecpar, e->codec_ctx);
|
||||
assert(err >= 0);
|
||||
err = avformat_write_header(e->ofmt_ctx, NULL);
|
||||
assert(err >= 0);
|
||||
|
||||
e->wrote_codec_config = true;
|
||||
}
|
||||
|
||||
if (out_buf->nTimeStamp > 0) {
|
||||
// input timestamps are in microseconds
|
||||
AVRational in_timebase = {1, 1000000};
|
||||
|
||||
AVPacket pkt;
|
||||
av_init_packet(&pkt);
|
||||
pkt.data = buf_data;
|
||||
pkt.size = out_buf->nFilledLen;
|
||||
|
||||
enum AVRounding rnd = static_cast<enum AVRounding>(AV_ROUND_NEAR_INF|AV_ROUND_PASS_MINMAX);
|
||||
pkt.pts = pkt.dts = av_rescale_q_rnd(out_buf->nTimeStamp, in_timebase, e->ofmt_ctx->streams[0]->time_base, rnd);
|
||||
pkt.duration = av_rescale_q(50*1000, in_timebase, e->ofmt_ctx->streams[0]->time_base);
|
||||
|
||||
if (out_buf->nFlags & OMX_BUFFERFLAG_SYNCFRAME) {
|
||||
pkt.flags |= AV_PKT_FLAG_KEY;
|
||||
}
|
||||
|
||||
err = av_write_frame(e->ofmt_ctx, &pkt);
|
||||
if (err < 0) { LOGW("ts encoder write issue"); }
|
||||
|
||||
av_free_packet(&pkt);
|
||||
}
|
||||
}
|
||||
|
||||
// give omx back the buffer
|
||||
#ifdef QCOM2
|
||||
if (out_buf->nFlags & OMX_BUFFERFLAG_EOS) {
|
||||
out_buf->nTimeStamp = 0;
|
||||
}
|
||||
#endif
|
||||
OMX_CHECK(OMX_FillThisBuffer(e->handle, out_buf));
|
||||
}
|
||||
|
||||
int OmxEncoder::encode_frame_rgba(const uint8_t *ptr, int in_width, int in_height, uint64_t ts) {
|
||||
int err;
|
||||
if (!this->is_open) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
// this sometimes freezes... put it outside the encoder lock so we can still trigger rotates...
|
||||
// THIS IS A REALLY BAD IDEA, but apparently the race has to happen 30 times to trigger this
|
||||
OMX_BUFFERHEADERTYPE* in_buf = nullptr;
|
||||
while (!this->free_in.try_pop(in_buf, 20)) {
|
||||
if (do_exit) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
int ret = this->counter;
|
||||
|
||||
uint8_t *in_buf_ptr = in_buf->pBuffer;
|
||||
|
||||
uint8_t *in_y_ptr = in_buf_ptr;
|
||||
int in_y_stride = VENUS_Y_STRIDE(COLOR_FMT_NV12, this->width);
|
||||
int in_uv_stride = VENUS_UV_STRIDE(COLOR_FMT_NV12, this->width);
|
||||
uint8_t *in_uv_ptr = in_buf_ptr + (in_y_stride * VENUS_Y_SCANLINES(COLOR_FMT_NV12, this->height));
|
||||
|
||||
err = ABGRToNV12(ptr, this->width*4,
|
||||
in_y_ptr, in_y_stride,
|
||||
in_uv_ptr, in_uv_stride,
|
||||
this->width, this->height);
|
||||
assert(err == 0);
|
||||
|
||||
in_buf->nFilledLen = VENUS_BUFFER_SIZE(COLOR_FMT_NV12, this->width, this->height);
|
||||
in_buf->nFlags = OMX_BUFFERFLAG_ENDOFFRAME;
|
||||
in_buf->nOffset = 0;
|
||||
in_buf->nTimeStamp = ts/1000LL; // OMX_TICKS, in microseconds
|
||||
this->last_t = in_buf->nTimeStamp;
|
||||
|
||||
OMX_CHECK(OMX_EmptyThisBuffer(this->handle, in_buf));
|
||||
|
||||
// pump output
|
||||
while (true) {
|
||||
OMX_BUFFERHEADERTYPE *out_buf;
|
||||
if (!this->done_out.try_pop(out_buf)) {
|
||||
break;
|
||||
}
|
||||
handle_out_buf(this, out_buf);
|
||||
}
|
||||
|
||||
this->dirty = true;
|
||||
|
||||
this->counter++;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
void OmxEncoder::encoder_open(const char* filename) {
|
||||
int err;
|
||||
|
||||
struct stat st = {0};
|
||||
if (stat(this->path.c_str(), &st) == -1) {
|
||||
mkdir(this->path.c_str(), 0755);
|
||||
}
|
||||
|
||||
snprintf(this->vid_path, sizeof(this->vid_path), "%s/%s", this->path.c_str(), filename);
|
||||
printf("encoder_open %s remuxing:%d\n", this->vid_path, this->remuxing);
|
||||
|
||||
if (this->remuxing) {
|
||||
avformat_alloc_output_context2(&this->ofmt_ctx, NULL, NULL, this->vid_path);
|
||||
assert(this->ofmt_ctx);
|
||||
|
||||
this->out_stream = avformat_new_stream(this->ofmt_ctx, NULL);
|
||||
assert(this->out_stream);
|
||||
|
||||
// set codec correctly
|
||||
av_register_all();
|
||||
|
||||
AVCodec *codec = NULL;
|
||||
codec = avcodec_find_encoder(AV_CODEC_ID_H264);
|
||||
assert(codec);
|
||||
|
||||
this->codec_ctx = avcodec_alloc_context3(codec);
|
||||
assert(this->codec_ctx);
|
||||
this->codec_ctx->width = this->width;
|
||||
this->codec_ctx->height = this->height;
|
||||
this->codec_ctx->pix_fmt = AV_PIX_FMT_YUV420P;
|
||||
this->codec_ctx->time_base = (AVRational){ 1, this->fps };
|
||||
|
||||
err = avio_open(&this->ofmt_ctx->pb, this->vid_path, AVIO_FLAG_WRITE);
|
||||
assert(err >= 0);
|
||||
|
||||
this->wrote_codec_config = false;
|
||||
} else {
|
||||
this->of = fopen(this->vid_path, "wb");
|
||||
assert(this->of);
|
||||
#ifndef QCOM2
|
||||
if (this->codec_config_len > 0) {
|
||||
fwrite(this->codec_config, this->codec_config_len, 1, this->of);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
// create camera lock file
|
||||
snprintf(this->lock_path, sizeof(this->lock_path), "%s/%s.lock", this->path.c_str(), filename);
|
||||
int lock_fd = HANDLE_EINTR(open(this->lock_path, O_RDWR | O_CREAT, 0664));
|
||||
assert(lock_fd >= 0);
|
||||
close(lock_fd);
|
||||
|
||||
this->is_open = true;
|
||||
this->counter = 0;
|
||||
}
|
||||
|
||||
void OmxEncoder::encoder_close() {
|
||||
if (this->is_open) {
|
||||
if (this->dirty) {
|
||||
// drain output only if there could be frames in the encoder
|
||||
|
||||
OMX_BUFFERHEADERTYPE* in_buf = this->free_in.pop();
|
||||
in_buf->nFilledLen = 0;
|
||||
in_buf->nOffset = 0;
|
||||
in_buf->nFlags = OMX_BUFFERFLAG_EOS;
|
||||
in_buf->nTimeStamp = this->last_t + 1000000LL/this->fps;
|
||||
|
||||
OMX_CHECK(OMX_EmptyThisBuffer(this->handle, in_buf));
|
||||
|
||||
while (true) {
|
||||
OMX_BUFFERHEADERTYPE *out_buf = this->done_out.pop();
|
||||
|
||||
handle_out_buf(this, out_buf);
|
||||
|
||||
if (out_buf->nFlags & OMX_BUFFERFLAG_EOS) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
this->dirty = false;
|
||||
}
|
||||
|
||||
if (this->remuxing) {
|
||||
av_write_trailer(this->ofmt_ctx);
|
||||
avcodec_free_context(&this->codec_ctx);
|
||||
avio_closep(&this->ofmt_ctx->pb);
|
||||
avformat_free_context(this->ofmt_ctx);
|
||||
} else {
|
||||
fclose(this->of);
|
||||
this->of = nullptr;
|
||||
}
|
||||
unlink(this->lock_path);
|
||||
}
|
||||
this->is_open = false;
|
||||
}
|
||||
|
||||
OmxEncoder::~OmxEncoder() {
|
||||
assert(!this->is_open);
|
||||
|
||||
OMX_CHECK(OMX_SendCommand(this->handle, OMX_CommandStateSet, OMX_StateIdle, NULL));
|
||||
|
||||
wait_for_state(OMX_StateIdle);
|
||||
|
||||
OMX_CHECK(OMX_SendCommand(this->handle, OMX_CommandStateSet, OMX_StateLoaded, NULL));
|
||||
|
||||
for (auto &buf : this->in_buf_headers) {
|
||||
OMX_CHECK(OMX_FreeBuffer(this->handle, PORT_INDEX_IN, buf));
|
||||
}
|
||||
|
||||
for (auto &buf : this->out_buf_headers) {
|
||||
OMX_CHECK(OMX_FreeBuffer(this->handle, PORT_INDEX_OUT, buf));
|
||||
}
|
||||
|
||||
wait_for_state(OMX_StateLoaded);
|
||||
|
||||
OMX_CHECK(OMX_FreeHandle(this->handle));
|
||||
|
||||
OMX_BUFFERHEADERTYPE *out_buf;
|
||||
while (this->free_in.try_pop(out_buf));
|
||||
while (this->done_out.try_pop(out_buf));
|
||||
|
||||
if (this->codec_config) {
|
||||
free(this->codec_config);
|
||||
}
|
||||
|
||||
if (this->downscale) {
|
||||
free(this->y_ptr2);
|
||||
free(this->u_ptr2);
|
||||
free(this->v_ptr2);
|
||||
}
|
||||
}
|
||||
@@ -1,72 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
#include <cstdio>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
#include <OMX_Component.h>
|
||||
extern "C" {
|
||||
#include <libavformat/avformat.h>
|
||||
}
|
||||
|
||||
#include "common/queue.h"
|
||||
|
||||
// OmxEncoder, lossey codec using hardware hevc
|
||||
class OmxEncoder {
|
||||
public:
|
||||
OmxEncoder(const char* path, int width, int height, int fps, int bitrate, bool h265, bool downscale);
|
||||
~OmxEncoder();
|
||||
|
||||
int encode_frame_rgba(const uint8_t *ptr, int in_width, int in_height, uint64_t ts);
|
||||
void encoder_open(const char* filename);
|
||||
void encoder_close();
|
||||
|
||||
// OMX callbacks
|
||||
static OMX_ERRORTYPE event_handler(OMX_HANDLETYPE component, OMX_PTR app_data, OMX_EVENTTYPE event,
|
||||
OMX_U32 data1, OMX_U32 data2, OMX_PTR event_data);
|
||||
static OMX_ERRORTYPE empty_buffer_done(OMX_HANDLETYPE component, OMX_PTR app_data,
|
||||
OMX_BUFFERHEADERTYPE *buffer);
|
||||
static OMX_ERRORTYPE fill_buffer_done(OMX_HANDLETYPE component, OMX_PTR app_data,
|
||||
OMX_BUFFERHEADERTYPE *buffer);
|
||||
|
||||
private:
|
||||
void wait_for_state(OMX_STATETYPE state);
|
||||
static void handle_out_buf(OmxEncoder *e, OMX_BUFFERHEADERTYPE *out_buf);
|
||||
|
||||
int width, height, fps;
|
||||
char vid_path[1024];
|
||||
char lock_path[1024];
|
||||
bool is_open = false;
|
||||
bool dirty = false;
|
||||
int counter = 0;
|
||||
|
||||
std::string path;
|
||||
FILE *of;
|
||||
|
||||
size_t codec_config_len;
|
||||
uint8_t *codec_config = NULL;
|
||||
bool wrote_codec_config;
|
||||
|
||||
std::mutex state_lock;
|
||||
std::condition_variable state_cv;
|
||||
OMX_STATETYPE state = OMX_StateLoaded;
|
||||
|
||||
OMX_HANDLETYPE handle;
|
||||
|
||||
std::vector<OMX_BUFFERHEADERTYPE *> in_buf_headers;
|
||||
std::vector<OMX_BUFFERHEADERTYPE *> out_buf_headers;
|
||||
|
||||
uint64_t last_t;
|
||||
|
||||
SafeQueue<OMX_BUFFERHEADERTYPE *> free_in;
|
||||
SafeQueue<OMX_BUFFERHEADERTYPE *> done_out;
|
||||
|
||||
AVFormatContext *ofmt_ctx;
|
||||
AVCodecContext *codec_ctx;
|
||||
AVStream *out_stream;
|
||||
bool remuxing;
|
||||
|
||||
bool downscale;
|
||||
uint8_t *y_ptr2, *u_ptr2, *v_ptr2;
|
||||
};
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,579 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2008 The Khronos Group Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject
|
||||
* to the following conditions:
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
/** OMX_Component.h - OpenMax IL version 1.1.2
|
||||
* The OMX_Component header file contains the definitions used to define
|
||||
* the public interface of a component. This header file is intended to
|
||||
* be used by both the application and the component.
|
||||
*/
|
||||
|
||||
#ifndef OMX_Component_h
|
||||
#define OMX_Component_h
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
|
||||
|
||||
/* Each OMX header must include all required header files to allow the
|
||||
* header to compile without errors. The includes below are required
|
||||
* for this header file to compile successfully
|
||||
*/
|
||||
|
||||
#include <OMX_Audio.h>
|
||||
#include <OMX_Video.h>
|
||||
#include <OMX_Image.h>
|
||||
#include <OMX_Other.h>
|
||||
|
||||
/** @ingroup comp */
|
||||
typedef enum OMX_PORTDOMAINTYPE {
|
||||
OMX_PortDomainAudio,
|
||||
OMX_PortDomainVideo,
|
||||
OMX_PortDomainImage,
|
||||
OMX_PortDomainOther,
|
||||
OMX_PortDomainKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
|
||||
OMX_PortDomainVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
|
||||
OMX_PortDomainMax = 0x7ffffff
|
||||
} OMX_PORTDOMAINTYPE;
|
||||
|
||||
/** @ingroup comp */
|
||||
typedef struct OMX_PARAM_PORTDEFINITIONTYPE {
|
||||
OMX_U32 nSize; /**< Size of the structure in bytes */
|
||||
OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
|
||||
OMX_U32 nPortIndex; /**< Port number the structure applies to */
|
||||
OMX_DIRTYPE eDir; /**< Direction (input or output) of this port */
|
||||
OMX_U32 nBufferCountActual; /**< The actual number of buffers allocated on this port */
|
||||
OMX_U32 nBufferCountMin; /**< The minimum number of buffers this port requires */
|
||||
OMX_U32 nBufferSize; /**< Size, in bytes, for buffers to be used for this channel */
|
||||
OMX_BOOL bEnabled; /**< Ports default to enabled and are enabled/disabled by
|
||||
OMX_CommandPortEnable/OMX_CommandPortDisable.
|
||||
When disabled a port is unpopulated. A disabled port
|
||||
is not populated with buffers on a transition to IDLE. */
|
||||
OMX_BOOL bPopulated; /**< Port is populated with all of its buffers as indicated by
|
||||
nBufferCountActual. A disabled port is always unpopulated.
|
||||
An enabled port is populated on a transition to OMX_StateIdle
|
||||
and unpopulated on a transition to loaded. */
|
||||
OMX_PORTDOMAINTYPE eDomain; /**< Domain of the port. Determines the contents of metadata below. */
|
||||
union {
|
||||
OMX_AUDIO_PORTDEFINITIONTYPE audio;
|
||||
OMX_VIDEO_PORTDEFINITIONTYPE video;
|
||||
OMX_IMAGE_PORTDEFINITIONTYPE image;
|
||||
OMX_OTHER_PORTDEFINITIONTYPE other;
|
||||
} format;
|
||||
OMX_BOOL bBuffersContiguous;
|
||||
OMX_U32 nBufferAlignment;
|
||||
} OMX_PARAM_PORTDEFINITIONTYPE;
|
||||
|
||||
/** @ingroup comp */
|
||||
typedef struct OMX_PARAM_U32TYPE {
|
||||
OMX_U32 nSize; /**< Size of this structure, in Bytes */
|
||||
OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
|
||||
OMX_U32 nPortIndex; /**< port that this structure applies to */
|
||||
OMX_U32 nU32; /**< U32 value */
|
||||
} OMX_PARAM_U32TYPE;
|
||||
|
||||
/** @ingroup rpm */
|
||||
typedef enum OMX_SUSPENSIONPOLICYTYPE {
|
||||
OMX_SuspensionDisabled, /**< No suspension; v1.0 behavior */
|
||||
OMX_SuspensionEnabled, /**< Suspension allowed */
|
||||
OMX_SuspensionPolicyKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
|
||||
OMX_SuspensionPolicyStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
|
||||
OMX_SuspensionPolicyMax = 0x7fffffff
|
||||
} OMX_SUSPENSIONPOLICYTYPE;
|
||||
|
||||
/** @ingroup rpm */
|
||||
typedef struct OMX_PARAM_SUSPENSIONPOLICYTYPE {
|
||||
OMX_U32 nSize;
|
||||
OMX_VERSIONTYPE nVersion;
|
||||
OMX_SUSPENSIONPOLICYTYPE ePolicy;
|
||||
} OMX_PARAM_SUSPENSIONPOLICYTYPE;
|
||||
|
||||
/** @ingroup rpm */
|
||||
typedef enum OMX_SUSPENSIONTYPE {
|
||||
OMX_NotSuspended, /**< component is not suspended */
|
||||
OMX_Suspended, /**< component is suspended */
|
||||
OMX_SuspensionKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
|
||||
OMX_SuspensionVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
|
||||
OMX_SuspendMax = 0x7FFFFFFF
|
||||
} OMX_SUSPENSIONTYPE;
|
||||
|
||||
/** @ingroup rpm */
|
||||
typedef struct OMX_PARAM_SUSPENSIONTYPE {
|
||||
OMX_U32 nSize;
|
||||
OMX_VERSIONTYPE nVersion;
|
||||
OMX_SUSPENSIONTYPE eType;
|
||||
} OMX_PARAM_SUSPENSIONTYPE ;
|
||||
|
||||
typedef struct OMX_CONFIG_BOOLEANTYPE {
|
||||
OMX_U32 nSize;
|
||||
OMX_VERSIONTYPE nVersion;
|
||||
OMX_BOOL bEnabled;
|
||||
} OMX_CONFIG_BOOLEANTYPE;
|
||||
|
||||
/* Parameter specifying the content uri to use. */
|
||||
/** @ingroup cp */
|
||||
typedef struct OMX_PARAM_CONTENTURITYPE
|
||||
{
|
||||
OMX_U32 nSize; /**< size of the structure in bytes, including
|
||||
actual URI name */
|
||||
OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
|
||||
OMX_U8 contentURI[1]; /**< The URI name */
|
||||
} OMX_PARAM_CONTENTURITYPE;
|
||||
|
||||
/* Parameter specifying the pipe to use. */
|
||||
/** @ingroup cp */
|
||||
typedef struct OMX_PARAM_CONTENTPIPETYPE
|
||||
{
|
||||
OMX_U32 nSize; /**< size of the structure in bytes */
|
||||
OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
|
||||
OMX_HANDLETYPE hPipe; /**< The pipe handle*/
|
||||
} OMX_PARAM_CONTENTPIPETYPE;
|
||||
|
||||
/** @ingroup rpm */
|
||||
typedef struct OMX_RESOURCECONCEALMENTTYPE {
|
||||
OMX_U32 nSize; /**< size of the structure in bytes */
|
||||
OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
|
||||
OMX_BOOL bResourceConcealmentForbidden; /**< disallow the use of resource concealment
|
||||
methods (like degrading algorithm quality to
|
||||
lower resource consumption or functional bypass)
|
||||
on a component as a resolution to resource conflicts. */
|
||||
} OMX_RESOURCECONCEALMENTTYPE;
|
||||
|
||||
|
||||
/** @ingroup metadata */
|
||||
typedef enum OMX_METADATACHARSETTYPE {
|
||||
OMX_MetadataCharsetUnknown = 0,
|
||||
OMX_MetadataCharsetASCII,
|
||||
OMX_MetadataCharsetBinary,
|
||||
OMX_MetadataCharsetCodePage1252,
|
||||
OMX_MetadataCharsetUTF8,
|
||||
OMX_MetadataCharsetJavaConformantUTF8,
|
||||
OMX_MetadataCharsetUTF7,
|
||||
OMX_MetadataCharsetImapUTF7,
|
||||
OMX_MetadataCharsetUTF16LE,
|
||||
OMX_MetadataCharsetUTF16BE,
|
||||
OMX_MetadataCharsetGB12345,
|
||||
OMX_MetadataCharsetHZGB2312,
|
||||
OMX_MetadataCharsetGB2312,
|
||||
OMX_MetadataCharsetGB18030,
|
||||
OMX_MetadataCharsetGBK,
|
||||
OMX_MetadataCharsetBig5,
|
||||
OMX_MetadataCharsetISO88591,
|
||||
OMX_MetadataCharsetISO88592,
|
||||
OMX_MetadataCharsetISO88593,
|
||||
OMX_MetadataCharsetISO88594,
|
||||
OMX_MetadataCharsetISO88595,
|
||||
OMX_MetadataCharsetISO88596,
|
||||
OMX_MetadataCharsetISO88597,
|
||||
OMX_MetadataCharsetISO88598,
|
||||
OMX_MetadataCharsetISO88599,
|
||||
OMX_MetadataCharsetISO885910,
|
||||
OMX_MetadataCharsetISO885913,
|
||||
OMX_MetadataCharsetISO885914,
|
||||
OMX_MetadataCharsetISO885915,
|
||||
OMX_MetadataCharsetShiftJIS,
|
||||
OMX_MetadataCharsetISO2022JP,
|
||||
OMX_MetadataCharsetISO2022JP1,
|
||||
OMX_MetadataCharsetISOEUCJP,
|
||||
OMX_MetadataCharsetSMS7Bit,
|
||||
OMX_MetadataCharsetKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
|
||||
OMX_MetadataCharsetVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
|
||||
OMX_MetadataCharsetTypeMax= 0x7FFFFFFF
|
||||
} OMX_METADATACHARSETTYPE;
|
||||
|
||||
/** @ingroup metadata */
|
||||
typedef enum OMX_METADATASCOPETYPE
|
||||
{
|
||||
OMX_MetadataScopeAllLevels,
|
||||
OMX_MetadataScopeTopLevel,
|
||||
OMX_MetadataScopePortLevel,
|
||||
OMX_MetadataScopeNodeLevel,
|
||||
OMX_MetadataScopeKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
|
||||
OMX_MetadataScopeVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
|
||||
OMX_MetadataScopeTypeMax = 0x7fffffff
|
||||
} OMX_METADATASCOPETYPE;
|
||||
|
||||
/** @ingroup metadata */
|
||||
typedef enum OMX_METADATASEARCHMODETYPE
|
||||
{
|
||||
OMX_MetadataSearchValueSizeByIndex,
|
||||
OMX_MetadataSearchItemByIndex,
|
||||
OMX_MetadataSearchNextItemByKey,
|
||||
OMX_MetadataSearchKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
|
||||
OMX_MetadataSearchVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
|
||||
OMX_MetadataSearchTypeMax = 0x7fffffff
|
||||
} OMX_METADATASEARCHMODETYPE;
|
||||
/** @ingroup metadata */
|
||||
typedef struct OMX_CONFIG_METADATAITEMCOUNTTYPE
|
||||
{
|
||||
OMX_U32 nSize;
|
||||
OMX_VERSIONTYPE nVersion;
|
||||
OMX_METADATASCOPETYPE eScopeMode;
|
||||
OMX_U32 nScopeSpecifier;
|
||||
OMX_U32 nMetadataItemCount;
|
||||
} OMX_CONFIG_METADATAITEMCOUNTTYPE;
|
||||
|
||||
/** @ingroup metadata */
|
||||
typedef struct OMX_CONFIG_METADATAITEMTYPE
|
||||
{
|
||||
OMX_U32 nSize;
|
||||
OMX_VERSIONTYPE nVersion;
|
||||
OMX_METADATASCOPETYPE eScopeMode;
|
||||
OMX_U32 nScopeSpecifier;
|
||||
OMX_U32 nMetadataItemIndex;
|
||||
OMX_METADATASEARCHMODETYPE eSearchMode;
|
||||
OMX_METADATACHARSETTYPE eKeyCharset;
|
||||
OMX_U8 nKeySizeUsed;
|
||||
OMX_U8 nKey[128];
|
||||
OMX_METADATACHARSETTYPE eValueCharset;
|
||||
OMX_STRING sLanguageCountry;
|
||||
OMX_U32 nValueMaxSize;
|
||||
OMX_U32 nValueSizeUsed;
|
||||
OMX_U8 nValue[1];
|
||||
} OMX_CONFIG_METADATAITEMTYPE;
|
||||
|
||||
/* @ingroup metadata */
|
||||
typedef struct OMX_CONFIG_CONTAINERNODECOUNTTYPE
|
||||
{
|
||||
OMX_U32 nSize;
|
||||
OMX_VERSIONTYPE nVersion;
|
||||
OMX_BOOL bAllKeys;
|
||||
OMX_U32 nParentNodeID;
|
||||
OMX_U32 nNumNodes;
|
||||
} OMX_CONFIG_CONTAINERNODECOUNTTYPE;
|
||||
|
||||
/** @ingroup metadata */
|
||||
typedef struct OMX_CONFIG_CONTAINERNODEIDTYPE
|
||||
{
|
||||
OMX_U32 nSize;
|
||||
OMX_VERSIONTYPE nVersion;
|
||||
OMX_BOOL bAllKeys;
|
||||
OMX_U32 nParentNodeID;
|
||||
OMX_U32 nNodeIndex;
|
||||
OMX_U32 nNodeID;
|
||||
OMX_STRING cNodeName;
|
||||
OMX_BOOL bIsLeafType;
|
||||
} OMX_CONFIG_CONTAINERNODEIDTYPE;
|
||||
|
||||
/** @ingroup metadata */
|
||||
typedef struct OMX_PARAM_METADATAFILTERTYPE
|
||||
{
|
||||
OMX_U32 nSize;
|
||||
OMX_VERSIONTYPE nVersion;
|
||||
OMX_BOOL bAllKeys; /* if true then this structure refers to all keys and
|
||||
* the three key fields below are ignored */
|
||||
OMX_METADATACHARSETTYPE eKeyCharset;
|
||||
OMX_U32 nKeySizeUsed;
|
||||
OMX_U8 nKey [128];
|
||||
OMX_U32 nLanguageCountrySizeUsed;
|
||||
OMX_U8 nLanguageCountry[128];
|
||||
OMX_BOOL bEnabled; /* if true then key is part of filter (e.g.
|
||||
* retained for query later). If false then
|
||||
* key is not part of filter */
|
||||
} OMX_PARAM_METADATAFILTERTYPE;
|
||||
|
||||
/** The OMX_HANDLETYPE structure defines the component handle. The component
|
||||
* handle is used to access all of the component's public methods and also
|
||||
* contains pointers to the component's private data area. The component
|
||||
* handle is initialized by the OMX core (with help from the component)
|
||||
* during the process of loading the component. After the component is
|
||||
* successfully loaded, the application can safely access any of the
|
||||
* component's public functions (although some may return an error because
|
||||
* the state is inappropriate for the access).
|
||||
*
|
||||
* @ingroup comp
|
||||
*/
|
||||
typedef struct OMX_COMPONENTTYPE
|
||||
{
|
||||
/** The size of this structure, in bytes. It is the responsibility
|
||||
of the allocator of this structure to fill in this value. Since
|
||||
this structure is allocated by the GetHandle function, this
|
||||
function will fill in this value. */
|
||||
OMX_U32 nSize;
|
||||
|
||||
/** nVersion is the version of the OMX specification that the structure
|
||||
is built against. It is the responsibility of the creator of this
|
||||
structure to initialize this value and every user of this structure
|
||||
should verify that it knows how to use the exact version of
|
||||
this structure found herein. */
|
||||
OMX_VERSIONTYPE nVersion;
|
||||
|
||||
/** pComponentPrivate is a pointer to the component private data area.
|
||||
This member is allocated and initialized by the component when the
|
||||
component is first loaded. The application should not access this
|
||||
data area. */
|
||||
OMX_PTR pComponentPrivate;
|
||||
|
||||
/** pApplicationPrivate is a pointer that is a parameter to the
|
||||
OMX_GetHandle method, and contains an application private value
|
||||
provided by the IL client. This application private data is
|
||||
returned to the IL Client by OMX in all callbacks */
|
||||
OMX_PTR pApplicationPrivate;
|
||||
|
||||
/** refer to OMX_GetComponentVersion in OMX_core.h or the OMX IL
|
||||
specification for details on the GetComponentVersion method.
|
||||
*/
|
||||
OMX_ERRORTYPE (*GetComponentVersion)(
|
||||
OMX_IN OMX_HANDLETYPE hComponent,
|
||||
OMX_OUT OMX_STRING pComponentName,
|
||||
OMX_OUT OMX_VERSIONTYPE* pComponentVersion,
|
||||
OMX_OUT OMX_VERSIONTYPE* pSpecVersion,
|
||||
OMX_OUT OMX_UUIDTYPE* pComponentUUID);
|
||||
|
||||
/** refer to OMX_SendCommand in OMX_core.h or the OMX IL
|
||||
specification for details on the SendCommand method.
|
||||
*/
|
||||
OMX_ERRORTYPE (*SendCommand)(
|
||||
OMX_IN OMX_HANDLETYPE hComponent,
|
||||
OMX_IN OMX_COMMANDTYPE Cmd,
|
||||
OMX_IN OMX_U32 nParam1,
|
||||
OMX_IN OMX_PTR pCmdData);
|
||||
|
||||
/** refer to OMX_GetParameter in OMX_core.h or the OMX IL
|
||||
specification for details on the GetParameter method.
|
||||
*/
|
||||
OMX_ERRORTYPE (*GetParameter)(
|
||||
OMX_IN OMX_HANDLETYPE hComponent,
|
||||
OMX_IN OMX_INDEXTYPE nParamIndex,
|
||||
OMX_INOUT OMX_PTR pComponentParameterStructure);
|
||||
|
||||
|
||||
/** refer to OMX_SetParameter in OMX_core.h or the OMX IL
|
||||
specification for details on the SetParameter method.
|
||||
*/
|
||||
OMX_ERRORTYPE (*SetParameter)(
|
||||
OMX_IN OMX_HANDLETYPE hComponent,
|
||||
OMX_IN OMX_INDEXTYPE nIndex,
|
||||
OMX_IN OMX_PTR pComponentParameterStructure);
|
||||
|
||||
|
||||
/** refer to OMX_GetConfig in OMX_core.h or the OMX IL
|
||||
specification for details on the GetConfig method.
|
||||
*/
|
||||
OMX_ERRORTYPE (*GetConfig)(
|
||||
OMX_IN OMX_HANDLETYPE hComponent,
|
||||
OMX_IN OMX_INDEXTYPE nIndex,
|
||||
OMX_INOUT OMX_PTR pComponentConfigStructure);
|
||||
|
||||
|
||||
/** refer to OMX_SetConfig in OMX_core.h or the OMX IL
|
||||
specification for details on the SetConfig method.
|
||||
*/
|
||||
OMX_ERRORTYPE (*SetConfig)(
|
||||
OMX_IN OMX_HANDLETYPE hComponent,
|
||||
OMX_IN OMX_INDEXTYPE nIndex,
|
||||
OMX_IN OMX_PTR pComponentConfigStructure);
|
||||
|
||||
|
||||
/** refer to OMX_GetExtensionIndex in OMX_core.h or the OMX IL
|
||||
specification for details on the GetExtensionIndex method.
|
||||
*/
|
||||
OMX_ERRORTYPE (*GetExtensionIndex)(
|
||||
OMX_IN OMX_HANDLETYPE hComponent,
|
||||
OMX_IN OMX_STRING cParameterName,
|
||||
OMX_OUT OMX_INDEXTYPE* pIndexType);
|
||||
|
||||
|
||||
/** refer to OMX_GetState in OMX_core.h or the OMX IL
|
||||
specification for details on the GetState method.
|
||||
*/
|
||||
OMX_ERRORTYPE (*GetState)(
|
||||
OMX_IN OMX_HANDLETYPE hComponent,
|
||||
OMX_OUT OMX_STATETYPE* pState);
|
||||
|
||||
|
||||
/** The ComponentTunnelRequest method will interact with another OMX
|
||||
component to determine if tunneling is possible and to setup the
|
||||
tunneling. The return codes for this method can be used to
|
||||
determine if tunneling is not possible, or if tunneling is not
|
||||
supported.
|
||||
|
||||
Base profile components (i.e. non-interop) do not support this
|
||||
method and should return OMX_ErrorNotImplemented
|
||||
|
||||
The interop profile component MUST support tunneling to another
|
||||
interop profile component with a compatible port parameters.
|
||||
A component may also support proprietary communication.
|
||||
|
||||
If proprietary communication is supported the negotiation of
|
||||
proprietary communication is done outside of OMX in a vendor
|
||||
specific way. It is only required that the proper result be
|
||||
returned and the details of how the setup is done is left
|
||||
to the component implementation.
|
||||
|
||||
When this method is invoked when nPort in an output port, the
|
||||
component will:
|
||||
1. Populate the pTunnelSetup structure with the output port's
|
||||
requirements and constraints for the tunnel.
|
||||
|
||||
When this method is invoked when nPort in an input port, the
|
||||
component will:
|
||||
1. Query the necessary parameters from the output port to
|
||||
determine if the ports are compatible for tunneling
|
||||
2. If the ports are compatible, the component should store
|
||||
the tunnel step provided by the output port
|
||||
3. Determine which port (either input or output) is the buffer
|
||||
supplier, and call OMX_SetParameter on the output port to
|
||||
indicate this selection.
|
||||
|
||||
The component will return from this call within 5 msec.
|
||||
|
||||
@param [in] hComp
|
||||
Handle of the component to be accessed. This is the component
|
||||
handle returned by the call to the OMX_GetHandle method.
|
||||
@param [in] nPort
|
||||
nPort is used to select the port on the component to be used
|
||||
for tunneling.
|
||||
@param [in] hTunneledComp
|
||||
Handle of the component to tunnel with. This is the component
|
||||
handle returned by the call to the OMX_GetHandle method. When
|
||||
this parameter is 0x0 the component should setup the port for
|
||||
communication with the application / IL Client.
|
||||
@param [in] nPortOutput
|
||||
nPortOutput is used indicate the port the component should
|
||||
tunnel with.
|
||||
@param [in] pTunnelSetup
|
||||
Pointer to the tunnel setup structure. When nPort is an output port
|
||||
the component should populate the fields of this structure. When
|
||||
When nPort is an input port the component should review the setup
|
||||
provided by the component with the output port.
|
||||
@return OMX_ERRORTYPE
|
||||
If the command successfully executes, the return code will be
|
||||
OMX_ErrorNone. Otherwise the appropriate OMX error will be returned.
|
||||
@ingroup tun
|
||||
*/
|
||||
|
||||
OMX_ERRORTYPE (*ComponentTunnelRequest)(
|
||||
OMX_IN OMX_HANDLETYPE hComp,
|
||||
OMX_IN OMX_U32 nPort,
|
||||
OMX_IN OMX_HANDLETYPE hTunneledComp,
|
||||
OMX_IN OMX_U32 nTunneledPort,
|
||||
OMX_INOUT OMX_TUNNELSETUPTYPE* pTunnelSetup);
|
||||
|
||||
/** refer to OMX_UseBuffer in OMX_core.h or the OMX IL
|
||||
specification for details on the UseBuffer method.
|
||||
@ingroup buf
|
||||
*/
|
||||
OMX_ERRORTYPE (*UseBuffer)(
|
||||
OMX_IN OMX_HANDLETYPE hComponent,
|
||||
OMX_INOUT OMX_BUFFERHEADERTYPE** ppBufferHdr,
|
||||
OMX_IN OMX_U32 nPortIndex,
|
||||
OMX_IN OMX_PTR pAppPrivate,
|
||||
OMX_IN OMX_U32 nSizeBytes,
|
||||
OMX_IN OMX_U8* pBuffer);
|
||||
|
||||
/** refer to OMX_AllocateBuffer in OMX_core.h or the OMX IL
|
||||
specification for details on the AllocateBuffer method.
|
||||
@ingroup buf
|
||||
*/
|
||||
OMX_ERRORTYPE (*AllocateBuffer)(
|
||||
OMX_IN OMX_HANDLETYPE hComponent,
|
||||
OMX_INOUT OMX_BUFFERHEADERTYPE** ppBuffer,
|
||||
OMX_IN OMX_U32 nPortIndex,
|
||||
OMX_IN OMX_PTR pAppPrivate,
|
||||
OMX_IN OMX_U32 nSizeBytes);
|
||||
|
||||
/** refer to OMX_FreeBuffer in OMX_core.h or the OMX IL
|
||||
specification for details on the FreeBuffer method.
|
||||
@ingroup buf
|
||||
*/
|
||||
OMX_ERRORTYPE (*FreeBuffer)(
|
||||
OMX_IN OMX_HANDLETYPE hComponent,
|
||||
OMX_IN OMX_U32 nPortIndex,
|
||||
OMX_IN OMX_BUFFERHEADERTYPE* pBuffer);
|
||||
|
||||
/** refer to OMX_EmptyThisBuffer in OMX_core.h or the OMX IL
|
||||
specification for details on the EmptyThisBuffer method.
|
||||
@ingroup buf
|
||||
*/
|
||||
OMX_ERRORTYPE (*EmptyThisBuffer)(
|
||||
OMX_IN OMX_HANDLETYPE hComponent,
|
||||
OMX_IN OMX_BUFFERHEADERTYPE* pBuffer);
|
||||
|
||||
/** refer to OMX_FillThisBuffer in OMX_core.h or the OMX IL
|
||||
specification for details on the FillThisBuffer method.
|
||||
@ingroup buf
|
||||
*/
|
||||
OMX_ERRORTYPE (*FillThisBuffer)(
|
||||
OMX_IN OMX_HANDLETYPE hComponent,
|
||||
OMX_IN OMX_BUFFERHEADERTYPE* pBuffer);
|
||||
|
||||
/** The SetCallbacks method is used by the core to specify the callback
|
||||
structure from the application to the component. This is a blocking
|
||||
call. The component will return from this call within 5 msec.
|
||||
@param [in] hComponent
|
||||
Handle of the component to be accessed. This is the component
|
||||
handle returned by the call to the GetHandle function.
|
||||
@param [in] pCallbacks
|
||||
pointer to an OMX_CALLBACKTYPE structure used to provide the
|
||||
callback information to the component
|
||||
@param [in] pAppData
|
||||
pointer to an application defined value. It is anticipated that
|
||||
the application will pass a pointer to a data structure or a "this
|
||||
pointer" in this area to allow the callback (in the application)
|
||||
to determine the context of the call
|
||||
@return OMX_ERRORTYPE
|
||||
If the command successfully executes, the return code will be
|
||||
OMX_ErrorNone. Otherwise the appropriate OMX error will be returned.
|
||||
*/
|
||||
OMX_ERRORTYPE (*SetCallbacks)(
|
||||
OMX_IN OMX_HANDLETYPE hComponent,
|
||||
OMX_IN OMX_CALLBACKTYPE* pCallbacks,
|
||||
OMX_IN OMX_PTR pAppData);
|
||||
|
||||
/** ComponentDeInit method is used to deinitialize the component
|
||||
providing a means to free any resources allocated at component
|
||||
initialization. NOTE: After this call the component handle is
|
||||
not valid for further use.
|
||||
@param [in] hComponent
|
||||
Handle of the component to be accessed. This is the component
|
||||
handle returned by the call to the GetHandle function.
|
||||
@return OMX_ERRORTYPE
|
||||
If the command successfully executes, the return code will be
|
||||
OMX_ErrorNone. Otherwise the appropriate OMX error will be returned.
|
||||
*/
|
||||
OMX_ERRORTYPE (*ComponentDeInit)(
|
||||
OMX_IN OMX_HANDLETYPE hComponent);
|
||||
|
||||
/** @ingroup buf */
|
||||
OMX_ERRORTYPE (*UseEGLImage)(
|
||||
OMX_IN OMX_HANDLETYPE hComponent,
|
||||
OMX_INOUT OMX_BUFFERHEADERTYPE** ppBufferHdr,
|
||||
OMX_IN OMX_U32 nPortIndex,
|
||||
OMX_IN OMX_PTR pAppPrivate,
|
||||
OMX_IN void* eglImage);
|
||||
|
||||
OMX_ERRORTYPE (*ComponentRoleEnum)(
|
||||
OMX_IN OMX_HANDLETYPE hComponent,
|
||||
OMX_OUT OMX_U8 *cRole,
|
||||
OMX_IN OMX_U32 nIndex);
|
||||
|
||||
} OMX_COMPONENTTYPE;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif
|
||||
/* File EOF */
|
||||
@@ -1,195 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2008 The Khronos Group Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject
|
||||
* to the following conditions:
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
/** OMX_ContentPipe.h - OpenMax IL version 1.1.2
|
||||
* The OMX_ContentPipe header file contains the definitions used to define
|
||||
* the public interface for content piples. This header file is intended to
|
||||
* be used by the component.
|
||||
*/
|
||||
|
||||
#ifndef OMX_CONTENTPIPE_H
|
||||
#define OMX_CONTENTPIPE_H
|
||||
|
||||
#ifndef KD_EACCES
|
||||
/* OpenKODE error codes. CPResult values may be zero (indicating success
|
||||
or one of the following values) */
|
||||
#define KD_EACCES (1)
|
||||
#define KD_EADDRINUSE (2)
|
||||
#define KD_EAGAIN (5)
|
||||
#define KD_EBADF (7)
|
||||
#define KD_EBUSY (8)
|
||||
#define KD_ECONNREFUSED (9)
|
||||
#define KD_ECONNRESET (10)
|
||||
#define KD_EDEADLK (11)
|
||||
#define KD_EDESTADDRREQ (12)
|
||||
#define KD_ERANGE (35)
|
||||
#define KD_EEXIST (13)
|
||||
#define KD_EFBIG (14)
|
||||
#define KD_EHOSTUNREACH (15)
|
||||
#define KD_EINVAL (17)
|
||||
#define KD_EIO (18)
|
||||
#define KD_EISCONN (20)
|
||||
#define KD_EISDIR (21)
|
||||
#define KD_EMFILE (22)
|
||||
#define KD_ENAMETOOLONG (23)
|
||||
#define KD_ENOENT (24)
|
||||
#define KD_ENOMEM (25)
|
||||
#define KD_ENOSPC (26)
|
||||
#define KD_ENOSYS (27)
|
||||
#define KD_ENOTCONN (28)
|
||||
#define KD_EPERM (33)
|
||||
#define KD_ETIMEDOUT (36)
|
||||
#define KD_EILSEQ (19)
|
||||
#endif
|
||||
|
||||
/** Map types from OMX standard types only here so interface is as generic as possible. */
|
||||
typedef OMX_U32 CPresult;
|
||||
typedef char * CPstring;
|
||||
typedef void * CPhandle;
|
||||
typedef OMX_U32 CPuint;
|
||||
typedef OMX_S32 CPint;
|
||||
typedef char CPbyte;
|
||||
typedef OMX_BOOL CPbool;
|
||||
|
||||
/** enumeration of origin types used in the CP_PIPETYPE's Seek function
|
||||
* @ingroup cp
|
||||
*/
|
||||
typedef enum CP_ORIGINTYPE {
|
||||
CP_OriginBegin,
|
||||
CP_OriginCur,
|
||||
CP_OriginEnd,
|
||||
CP_OriginKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
|
||||
CP_OriginVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
|
||||
CP_OriginMax = 0X7FFFFFFF
|
||||
} CP_ORIGINTYPE;
|
||||
|
||||
/** enumeration of contact access types used in the CP_PIPETYPE's Open function
|
||||
* @ingroup cp
|
||||
*/
|
||||
typedef enum CP_ACCESSTYPE {
|
||||
CP_AccessRead,
|
||||
CP_AccessWrite,
|
||||
CP_AccessReadWrite ,
|
||||
CP_AccessKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
|
||||
CP_AccessVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
|
||||
CP_AccessMax = 0X7FFFFFFF
|
||||
} CP_ACCESSTYPE;
|
||||
|
||||
/** enumeration of results returned by the CP_PIPETYPE's CheckAvailableBytes function
|
||||
* @ingroup cp
|
||||
*/
|
||||
typedef enum CP_CHECKBYTESRESULTTYPE
|
||||
{
|
||||
CP_CheckBytesOk, /**< There are at least the request number
|
||||
of bytes available */
|
||||
CP_CheckBytesNotReady, /**< The pipe is still retrieving bytes
|
||||
and presently lacks sufficient bytes.
|
||||
Client will be called when they are
|
||||
sufficient bytes are available. */
|
||||
CP_CheckBytesInsufficientBytes , /**< The pipe has retrieved all bytes
|
||||
but those available are less than those
|
||||
requested */
|
||||
CP_CheckBytesAtEndOfStream, /**< The pipe has reached the end of stream
|
||||
and no more bytes are available. */
|
||||
CP_CheckBytesOutOfBuffers, /**< All read/write buffers are currently in use. */
|
||||
CP_CheckBytesKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
|
||||
CP_CheckBytesVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
|
||||
CP_CheckBytesMax = 0X7FFFFFFF
|
||||
} CP_CHECKBYTESRESULTTYPE;
|
||||
|
||||
/** enumeration of content pipe events sent to the client callback.
|
||||
* @ingroup cp
|
||||
*/
|
||||
typedef enum CP_EVENTTYPE{
|
||||
CP_BytesAvailable, /** bytes requested in a CheckAvailableBytes call are now available*/
|
||||
CP_Overflow, /** enumeration of content pipe events sent to the client callback*/
|
||||
CP_PipeDisconnected , /** enumeration of content pipe events sent to the client callback*/
|
||||
CP_EventKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
|
||||
CP_EventVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
|
||||
CP_EventMax = 0X7FFFFFFF
|
||||
} CP_EVENTTYPE;
|
||||
|
||||
/** content pipe definition
|
||||
* @ingroup cp
|
||||
*/
|
||||
typedef struct CP_PIPETYPE
|
||||
{
|
||||
/** Open a content stream for reading or writing. */
|
||||
CPresult (*Open)( CPhandle* hContent, CPstring szURI, CP_ACCESSTYPE eAccess );
|
||||
|
||||
/** Close a content stream. */
|
||||
CPresult (*Close)( CPhandle hContent );
|
||||
|
||||
/** Create a content source and open it for writing. */
|
||||
CPresult (*Create)( CPhandle *hContent, CPstring szURI );
|
||||
|
||||
/** Check the that specified number of bytes are available for reading or writing (depending on access type).*/
|
||||
CPresult (*CheckAvailableBytes)( CPhandle hContent, CPuint nBytesRequested, CP_CHECKBYTESRESULTTYPE *eResult );
|
||||
|
||||
/** Seek to certain position in the content relative to the specified origin. */
|
||||
CPresult (*SetPosition)( CPhandle hContent, CPint nOffset, CP_ORIGINTYPE eOrigin);
|
||||
|
||||
/** Retrieve the current position relative to the start of the content. */
|
||||
CPresult (*GetPosition)( CPhandle hContent, CPuint *pPosition);
|
||||
|
||||
/** Retrieve data of the specified size from the content stream (advance content pointer by size of data).
|
||||
Note: pipe client provides pointer. This function is appropriate for small high frequency reads. */
|
||||
CPresult (*Read)( CPhandle hContent, CPbyte *pData, CPuint nSize);
|
||||
|
||||
/** Retrieve a buffer allocated by the pipe that contains the requested number of bytes.
|
||||
Buffer contains the next block of bytes, as specified by nSize, of the content. nSize also
|
||||
returns the size of the block actually read. Content pointer advances the by the returned size.
|
||||
Note: pipe provides pointer. This function is appropriate for large reads. The client must call
|
||||
ReleaseReadBuffer when done with buffer.
|
||||
|
||||
In some cases the requested block may not reside in contiguous memory within the
|
||||
pipe implementation. For instance if the pipe leverages a circular buffer then the requested
|
||||
block may straddle the boundary of the circular buffer. By default a pipe implementation
|
||||
performs a copy in this case to provide the block to the pipe client in one contiguous buffer.
|
||||
If, however, the client sets bForbidCopy, then the pipe returns only those bytes preceding the memory
|
||||
boundary. Here the client may retrieve the data in segments over successive calls. */
|
||||
CPresult (*ReadBuffer)( CPhandle hContent, CPbyte **ppBuffer, CPuint *nSize, CPbool bForbidCopy);
|
||||
|
||||
/** Release a buffer obtained by ReadBuffer back to the pipe. */
|
||||
CPresult (*ReleaseReadBuffer)(CPhandle hContent, CPbyte *pBuffer);
|
||||
|
||||
/** Write data of the specified size to the content (advance content pointer by size of data).
|
||||
Note: pipe client provides pointer. This function is appropriate for small high frequency writes. */
|
||||
CPresult (*Write)( CPhandle hContent, CPbyte *data, CPuint nSize);
|
||||
|
||||
/** Retrieve a buffer allocated by the pipe used to write data to the content.
|
||||
Client will fill buffer with output data. Note: pipe provides pointer. This function is appropriate
|
||||
for large writes. The client must call WriteBuffer when done it has filled the buffer with data.*/
|
||||
CPresult (*GetWriteBuffer)( CPhandle hContent, CPbyte **ppBuffer, CPuint nSize);
|
||||
|
||||
/** Deliver a buffer obtained via GetWriteBuffer to the pipe. Pipe will write the
|
||||
the contents of the buffer to content and advance content pointer by the size of the buffer */
|
||||
CPresult (*WriteBuffer)( CPhandle hContent, CPbyte *pBuffer, CPuint nFilledSize);
|
||||
|
||||
/** Register a per-handle client callback with the content pipe. */
|
||||
CPresult (*RegisterCallback)( CPhandle hContent, CPresult (*ClientCallback)(CP_EVENTTYPE eEvent, CPuint iParam));
|
||||
|
||||
} CP_PIPETYPE;
|
||||
|
||||
#endif
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,66 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2009 The Khronos Group Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject
|
||||
* to the following conditions:
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
/** OMX_CoreExt.h - OpenMax IL version 1.1.2
|
||||
* The OMX_CoreExt header file contains extensions to the definitions used
|
||||
* by both the application and the component to access common items.
|
||||
*/
|
||||
|
||||
#ifndef OMX_CoreExt_h
|
||||
#define OMX_CoreExt_h
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/* Each OMX header shall include all required header files to allow the
|
||||
* header to compile without errors. The includes below are required
|
||||
* for this header file to compile successfully
|
||||
*/
|
||||
#include <OMX_Core.h>
|
||||
|
||||
|
||||
/** Event type extensions. */
|
||||
typedef enum OMX_EVENTEXTTYPE
|
||||
{
|
||||
OMX_EventIndexSettingChanged = OMX_EventKhronosExtensions, /**< component signals the IL client of a change
|
||||
in a param, config, or extension */
|
||||
OMX_EventExtMax = 0x7FFFFFFF
|
||||
} OMX_EVENTEXTTYPE;
|
||||
|
||||
|
||||
/** Enable or disable a callback event. */
|
||||
typedef struct OMX_CONFIG_CALLBACKREQUESTTYPE {
|
||||
OMX_U32 nSize; /**< size of the structure in bytes */
|
||||
OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
|
||||
OMX_U32 nPortIndex; /**< port that this structure applies to */
|
||||
OMX_INDEXTYPE nIndex; /**< the index the callback is requested for */
|
||||
OMX_BOOL bEnable; /**< enable (OMX_TRUE) or disable (OMX_FALSE) the callback */
|
||||
} OMX_CONFIG_CALLBACKREQUESTTYPE;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* OMX_CoreExt_h */
|
||||
/* File EOF */
|
||||
@@ -1,933 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2008 The Khronos Group Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject
|
||||
* to the following conditions:
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file OMX_IVCommon.h - OpenMax IL version 1.1.2
|
||||
* The structures needed by Video and Image components to exchange
|
||||
* parameters and configuration data with the components.
|
||||
*/
|
||||
#ifndef OMX_IVCommon_h
|
||||
#define OMX_IVCommon_h
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/**
|
||||
* Each OMX header must include all required header files to allow the header
|
||||
* to compile without errors. The includes below are required for this header
|
||||
* file to compile successfully
|
||||
*/
|
||||
|
||||
#include <OMX_Core.h>
|
||||
|
||||
/** @defgroup iv OpenMAX IL Imaging and Video Domain
|
||||
* Common structures for OpenMAX IL Imaging and Video domains
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Enumeration defining possible uncompressed image/video formats.
|
||||
*
|
||||
* ENUMS:
|
||||
* Unused : Placeholder value when format is N/A
|
||||
* Monochrome : black and white
|
||||
* 8bitRGB332 : Red 7:5, Green 4:2, Blue 1:0
|
||||
* 12bitRGB444 : Red 11:8, Green 7:4, Blue 3:0
|
||||
* 16bitARGB4444 : Alpha 15:12, Red 11:8, Green 7:4, Blue 3:0
|
||||
* 16bitARGB1555 : Alpha 15, Red 14:10, Green 9:5, Blue 4:0
|
||||
* 16bitRGB565 : Red 15:11, Green 10:5, Blue 4:0
|
||||
* 16bitBGR565 : Blue 15:11, Green 10:5, Red 4:0
|
||||
* 18bitRGB666 : Red 17:12, Green 11:6, Blue 5:0
|
||||
* 18bitARGB1665 : Alpha 17, Red 16:11, Green 10:5, Blue 4:0
|
||||
* 19bitARGB1666 : Alpha 18, Red 17:12, Green 11:6, Blue 5:0
|
||||
* 24bitRGB888 : Red 24:16, Green 15:8, Blue 7:0
|
||||
* 24bitBGR888 : Blue 24:16, Green 15:8, Red 7:0
|
||||
* 24bitARGB1887 : Alpha 23, Red 22:15, Green 14:7, Blue 6:0
|
||||
* 25bitARGB1888 : Alpha 24, Red 23:16, Green 15:8, Blue 7:0
|
||||
* 32bitBGRA8888 : Blue 31:24, Green 23:16, Red 15:8, Alpha 7:0
|
||||
* 32bitARGB8888 : Alpha 31:24, Red 23:16, Green 15:8, Blue 7:0
|
||||
* YUV411Planar : U,Y are subsampled by a factor of 4 horizontally
|
||||
* YUV411PackedPlanar : packed per payload in planar slices
|
||||
* YUV420Planar : Three arrays Y,U,V.
|
||||
* YUV420PackedPlanar : packed per payload in planar slices
|
||||
* YUV420SemiPlanar : Two arrays, one is all Y, the other is U and V
|
||||
* YUV422Planar : Three arrays Y,U,V.
|
||||
* YUV422PackedPlanar : packed per payload in planar slices
|
||||
* YUV422SemiPlanar : Two arrays, one is all Y, the other is U and V
|
||||
* YCbYCr : Organized as 16bit YUYV (i.e. YCbYCr)
|
||||
* YCrYCb : Organized as 16bit YVYU (i.e. YCrYCb)
|
||||
* CbYCrY : Organized as 16bit UYVY (i.e. CbYCrY)
|
||||
* CrYCbY : Organized as 16bit VYUY (i.e. CrYCbY)
|
||||
* YUV444Interleaved : Each pixel contains equal parts YUV
|
||||
* RawBayer8bit : SMIA camera output format
|
||||
* RawBayer10bit : SMIA camera output format
|
||||
* RawBayer8bitcompressed : SMIA camera output format
|
||||
*/
|
||||
typedef enum OMX_COLOR_FORMATTYPE {
|
||||
OMX_COLOR_FormatUnused,
|
||||
OMX_COLOR_FormatMonochrome,
|
||||
OMX_COLOR_Format8bitRGB332,
|
||||
OMX_COLOR_Format12bitRGB444,
|
||||
OMX_COLOR_Format16bitARGB4444,
|
||||
OMX_COLOR_Format16bitARGB1555,
|
||||
OMX_COLOR_Format16bitRGB565,
|
||||
OMX_COLOR_Format16bitBGR565,
|
||||
OMX_COLOR_Format18bitRGB666,
|
||||
OMX_COLOR_Format18bitARGB1665,
|
||||
OMX_COLOR_Format19bitARGB1666,
|
||||
OMX_COLOR_Format24bitRGB888,
|
||||
OMX_COLOR_Format24bitBGR888,
|
||||
OMX_COLOR_Format24bitARGB1887,
|
||||
OMX_COLOR_Format25bitARGB1888,
|
||||
OMX_COLOR_Format32bitBGRA8888,
|
||||
OMX_COLOR_Format32bitARGB8888,
|
||||
OMX_COLOR_FormatYUV411Planar,
|
||||
OMX_COLOR_FormatYUV411PackedPlanar,
|
||||
OMX_COLOR_FormatYUV420Planar,
|
||||
OMX_COLOR_FormatYUV420PackedPlanar,
|
||||
OMX_COLOR_FormatYUV420SemiPlanar,
|
||||
OMX_COLOR_FormatYUV422Planar,
|
||||
OMX_COLOR_FormatYUV422PackedPlanar,
|
||||
OMX_COLOR_FormatYUV422SemiPlanar,
|
||||
OMX_COLOR_FormatYCbYCr,
|
||||
OMX_COLOR_FormatYCrYCb,
|
||||
OMX_COLOR_FormatCbYCrY,
|
||||
OMX_COLOR_FormatCrYCbY,
|
||||
OMX_COLOR_FormatYUV444Interleaved,
|
||||
OMX_COLOR_FormatRawBayer8bit,
|
||||
OMX_COLOR_FormatRawBayer10bit,
|
||||
OMX_COLOR_FormatRawBayer8bitcompressed,
|
||||
OMX_COLOR_FormatL2,
|
||||
OMX_COLOR_FormatL4,
|
||||
OMX_COLOR_FormatL8,
|
||||
OMX_COLOR_FormatL16,
|
||||
OMX_COLOR_FormatL24,
|
||||
OMX_COLOR_FormatL32,
|
||||
OMX_COLOR_FormatYUV420PackedSemiPlanar,
|
||||
OMX_COLOR_FormatYUV422PackedSemiPlanar,
|
||||
OMX_COLOR_Format18BitBGR666,
|
||||
OMX_COLOR_Format24BitARGB6666,
|
||||
OMX_COLOR_Format24BitABGR6666,
|
||||
OMX_COLOR_FormatKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
|
||||
OMX_COLOR_FormatVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
|
||||
/**<Reserved android opaque colorformat. Tells the encoder that
|
||||
* the actual colorformat will be relayed by the
|
||||
* Gralloc Buffers.
|
||||
* FIXME: In the process of reserving some enum values for
|
||||
* Android-specific OMX IL colorformats. Change this enum to
|
||||
* an acceptable range once that is done.
|
||||
* */
|
||||
OMX_COLOR_FormatAndroidOpaque = 0x7F000789,
|
||||
OMX_TI_COLOR_FormatYUV420PackedSemiPlanar = 0x7F000100,
|
||||
OMX_QCOM_COLOR_FormatYVU420SemiPlanar = 0x7FA30C00,
|
||||
OMX_QCOM_COLOR_FormatYUV420PackedSemiPlanar64x32Tile2m8ka = 0x7FA30C03,
|
||||
OMX_SEC_COLOR_FormatNV12Tiled = 0x7FC00002,
|
||||
OMX_QCOM_COLOR_FormatYUV420PackedSemiPlanar32m = 0x7FA30C04,
|
||||
OMX_COLOR_FormatMax = 0x7FFFFFFF
|
||||
} OMX_COLOR_FORMATTYPE;
|
||||
|
||||
|
||||
/**
|
||||
* Defines the matrix for conversion from RGB to YUV or vice versa.
|
||||
* iColorMatrix should be initialized with the fixed point values
|
||||
* used in converting between formats.
|
||||
*/
|
||||
typedef struct OMX_CONFIG_COLORCONVERSIONTYPE {
|
||||
OMX_U32 nSize; /**< Size of the structure in bytes */
|
||||
OMX_VERSIONTYPE nVersion; /**< OMX specification version info */
|
||||
OMX_U32 nPortIndex; /**< Port that this struct applies to */
|
||||
OMX_S32 xColorMatrix[3][3]; /**< Stored in signed Q16 format */
|
||||
OMX_S32 xColorOffset[4]; /**< Stored in signed Q16 format */
|
||||
}OMX_CONFIG_COLORCONVERSIONTYPE;
|
||||
|
||||
|
||||
/**
|
||||
* Structure defining percent to scale each frame dimension. For example:
|
||||
* To make the width 50% larger, use fWidth = 1.5 and to make the width
|
||||
* 1/2 the original size, use fWidth = 0.5
|
||||
*/
|
||||
typedef struct OMX_CONFIG_SCALEFACTORTYPE {
|
||||
OMX_U32 nSize; /**< Size of the structure in bytes */
|
||||
OMX_VERSIONTYPE nVersion; /**< OMX specification version info */
|
||||
OMX_U32 nPortIndex; /**< Port that this struct applies to */
|
||||
OMX_S32 xWidth; /**< Fixed point value stored as Q16 */
|
||||
OMX_S32 xHeight; /**< Fixed point value stored as Q16 */
|
||||
}OMX_CONFIG_SCALEFACTORTYPE;
|
||||
|
||||
|
||||
/**
|
||||
* Enumeration of possible image filter types
|
||||
*/
|
||||
typedef enum OMX_IMAGEFILTERTYPE {
|
||||
OMX_ImageFilterNone,
|
||||
OMX_ImageFilterNoise,
|
||||
OMX_ImageFilterEmboss,
|
||||
OMX_ImageFilterNegative,
|
||||
OMX_ImageFilterSketch,
|
||||
OMX_ImageFilterOilPaint,
|
||||
OMX_ImageFilterHatch,
|
||||
OMX_ImageFilterGpen,
|
||||
OMX_ImageFilterAntialias,
|
||||
OMX_ImageFilterDeRing,
|
||||
OMX_ImageFilterSolarize,
|
||||
OMX_ImageFilterKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
|
||||
OMX_ImageFilterVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
|
||||
OMX_ImageFilterMax = 0x7FFFFFFF
|
||||
} OMX_IMAGEFILTERTYPE;
|
||||
|
||||
|
||||
/**
|
||||
* Image filter configuration
|
||||
*
|
||||
* STRUCT MEMBERS:
|
||||
* nSize : Size of the structure in bytes
|
||||
* nVersion : OMX specification version information
|
||||
* nPortIndex : Port that this structure applies to
|
||||
* eImageFilter : Image filter type enumeration
|
||||
*/
|
||||
typedef struct OMX_CONFIG_IMAGEFILTERTYPE {
|
||||
OMX_U32 nSize;
|
||||
OMX_VERSIONTYPE nVersion;
|
||||
OMX_U32 nPortIndex;
|
||||
OMX_IMAGEFILTERTYPE eImageFilter;
|
||||
} OMX_CONFIG_IMAGEFILTERTYPE;
|
||||
|
||||
|
||||
/**
|
||||
* Customized U and V for color enhancement
|
||||
*
|
||||
* STRUCT MEMBERS:
|
||||
* nSize : Size of the structure in bytes
|
||||
* nVersion : OMX specification version information
|
||||
* nPortIndex : Port that this structure applies to
|
||||
* bColorEnhancement : Enable/disable color enhancement
|
||||
* nCustomizedU : Practical values: 16-240, range: 0-255, value set for
|
||||
* U component
|
||||
* nCustomizedV : Practical values: 16-240, range: 0-255, value set for
|
||||
* V component
|
||||
*/
|
||||
typedef struct OMX_CONFIG_COLORENHANCEMENTTYPE {
|
||||
OMX_U32 nSize;
|
||||
OMX_VERSIONTYPE nVersion;
|
||||
OMX_U32 nPortIndex;
|
||||
OMX_BOOL bColorEnhancement;
|
||||
OMX_U8 nCustomizedU;
|
||||
OMX_U8 nCustomizedV;
|
||||
} OMX_CONFIG_COLORENHANCEMENTTYPE;
|
||||
|
||||
|
||||
/**
|
||||
* Define color key and color key mask
|
||||
*
|
||||
* STRUCT MEMBERS:
|
||||
* nSize : Size of the structure in bytes
|
||||
* nVersion : OMX specification version information
|
||||
* nPortIndex : Port that this structure applies to
|
||||
* nARGBColor : 32bit Alpha, Red, Green, Blue Color
|
||||
* nARGBMask : 32bit Mask for Alpha, Red, Green, Blue channels
|
||||
*/
|
||||
typedef struct OMX_CONFIG_COLORKEYTYPE {
|
||||
OMX_U32 nSize;
|
||||
OMX_VERSIONTYPE nVersion;
|
||||
OMX_U32 nPortIndex;
|
||||
OMX_U32 nARGBColor;
|
||||
OMX_U32 nARGBMask;
|
||||
} OMX_CONFIG_COLORKEYTYPE;
|
||||
|
||||
|
||||
/**
|
||||
* List of color blend types for pre/post processing
|
||||
*
|
||||
* ENUMS:
|
||||
* None : No color blending present
|
||||
* AlphaConstant : Function is (alpha_constant * src) +
|
||||
* (1 - alpha_constant) * dst)
|
||||
* AlphaPerPixel : Function is (alpha * src) + (1 - alpha) * dst)
|
||||
* Alternate : Function is alternating pixels from src and dst
|
||||
* And : Function is (src & dst)
|
||||
* Or : Function is (src | dst)
|
||||
* Invert : Function is ~src
|
||||
*/
|
||||
typedef enum OMX_COLORBLENDTYPE {
|
||||
OMX_ColorBlendNone,
|
||||
OMX_ColorBlendAlphaConstant,
|
||||
OMX_ColorBlendAlphaPerPixel,
|
||||
OMX_ColorBlendAlternate,
|
||||
OMX_ColorBlendAnd,
|
||||
OMX_ColorBlendOr,
|
||||
OMX_ColorBlendInvert,
|
||||
OMX_ColorBlendKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
|
||||
OMX_ColorBlendVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
|
||||
OMX_ColorBlendMax = 0x7FFFFFFF
|
||||
} OMX_COLORBLENDTYPE;
|
||||
|
||||
|
||||
/**
|
||||
* Color blend configuration
|
||||
*
|
||||
* STRUCT MEMBERS:
|
||||
* nSize : Size of the structure in bytes
|
||||
* nVersion : OMX specification version information
|
||||
* nPortIndex : Port that this structure applies to
|
||||
* nRGBAlphaConstant : Constant global alpha values when global alpha is used
|
||||
* eColorBlend : Color blend type enumeration
|
||||
*/
|
||||
typedef struct OMX_CONFIG_COLORBLENDTYPE {
|
||||
OMX_U32 nSize;
|
||||
OMX_VERSIONTYPE nVersion;
|
||||
OMX_U32 nPortIndex;
|
||||
OMX_U32 nRGBAlphaConstant;
|
||||
OMX_COLORBLENDTYPE eColorBlend;
|
||||
} OMX_CONFIG_COLORBLENDTYPE;
|
||||
|
||||
|
||||
/**
|
||||
* Hold frame dimension
|
||||
*
|
||||
* STRUCT MEMBERS:
|
||||
* nSize : Size of the structure in bytes
|
||||
* nVersion : OMX specification version information
|
||||
* nPortIndex : Port that this structure applies to
|
||||
* nWidth : Frame width in pixels
|
||||
* nHeight : Frame height in pixels
|
||||
*/
|
||||
typedef struct OMX_FRAMESIZETYPE {
|
||||
OMX_U32 nSize;
|
||||
OMX_VERSIONTYPE nVersion;
|
||||
OMX_U32 nPortIndex;
|
||||
OMX_U32 nWidth;
|
||||
OMX_U32 nHeight;
|
||||
} OMX_FRAMESIZETYPE;
|
||||
|
||||
|
||||
/**
|
||||
* Rotation configuration
|
||||
*
|
||||
* STRUCT MEMBERS:
|
||||
* nSize : Size of the structure in bytes
|
||||
* nVersion : OMX specification version information
|
||||
* nPortIndex : Port that this structure applies to
|
||||
* nRotation : +/- integer rotation value
|
||||
*/
|
||||
typedef struct OMX_CONFIG_ROTATIONTYPE {
|
||||
OMX_U32 nSize;
|
||||
OMX_VERSIONTYPE nVersion;
|
||||
OMX_U32 nPortIndex;
|
||||
OMX_S32 nRotation;
|
||||
} OMX_CONFIG_ROTATIONTYPE;
|
||||
|
||||
|
||||
/**
|
||||
* Possible mirroring directions for pre/post processing
|
||||
*
|
||||
* ENUMS:
|
||||
* None : No mirroring
|
||||
* Vertical : Vertical mirroring, flip on X axis
|
||||
* Horizontal : Horizontal mirroring, flip on Y axis
|
||||
* Both : Both vertical and horizontal mirroring
|
||||
*/
|
||||
typedef enum OMX_MIRRORTYPE {
|
||||
OMX_MirrorNone = 0,
|
||||
OMX_MirrorVertical,
|
||||
OMX_MirrorHorizontal,
|
||||
OMX_MirrorBoth,
|
||||
OMX_MirrorKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
|
||||
OMX_MirrorVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
|
||||
OMX_MirrorMax = 0x7FFFFFFF
|
||||
} OMX_MIRRORTYPE;
|
||||
|
||||
|
||||
/**
|
||||
* Mirroring configuration
|
||||
*
|
||||
* STRUCT MEMBERS:
|
||||
* nSize : Size of the structure in bytes
|
||||
* nVersion : OMX specification version information
|
||||
* nPortIndex : Port that this structure applies to
|
||||
* eMirror : Mirror type enumeration
|
||||
*/
|
||||
typedef struct OMX_CONFIG_MIRRORTYPE {
|
||||
OMX_U32 nSize;
|
||||
OMX_VERSIONTYPE nVersion;
|
||||
OMX_U32 nPortIndex;
|
||||
OMX_MIRRORTYPE eMirror;
|
||||
} OMX_CONFIG_MIRRORTYPE;
|
||||
|
||||
|
||||
/**
|
||||
* Position information only
|
||||
*
|
||||
* STRUCT MEMBERS:
|
||||
* nSize : Size of the structure in bytes
|
||||
* nVersion : OMX specification version information
|
||||
* nPortIndex : Port that this structure applies to
|
||||
* nX : X coordinate for the point
|
||||
* nY : Y coordinate for the point
|
||||
*/
|
||||
typedef struct OMX_CONFIG_POINTTYPE {
|
||||
OMX_U32 nSize;
|
||||
OMX_VERSIONTYPE nVersion;
|
||||
OMX_U32 nPortIndex;
|
||||
OMX_S32 nX;
|
||||
OMX_S32 nY;
|
||||
} OMX_CONFIG_POINTTYPE;
|
||||
|
||||
|
||||
/**
|
||||
* Frame size plus position
|
||||
*
|
||||
* STRUCT MEMBERS:
|
||||
* nSize : Size of the structure in bytes
|
||||
* nVersion : OMX specification version information
|
||||
* nPortIndex : Port that this structure applies to
|
||||
* nLeft : X Coordinate of the top left corner of the rectangle
|
||||
* nTop : Y Coordinate of the top left corner of the rectangle
|
||||
* nWidth : Width of the rectangle
|
||||
* nHeight : Height of the rectangle
|
||||
*/
|
||||
typedef struct OMX_CONFIG_RECTTYPE {
|
||||
OMX_U32 nSize;
|
||||
OMX_VERSIONTYPE nVersion;
|
||||
OMX_U32 nPortIndex;
|
||||
OMX_S32 nLeft;
|
||||
OMX_S32 nTop;
|
||||
OMX_U32 nWidth;
|
||||
OMX_U32 nHeight;
|
||||
} OMX_CONFIG_RECTTYPE;
|
||||
|
||||
|
||||
/**
|
||||
* Deblocking state; it is required to be set up before starting the codec
|
||||
*
|
||||
* STRUCT MEMBERS:
|
||||
* nSize : Size of the structure in bytes
|
||||
* nVersion : OMX specification version information
|
||||
* nPortIndex : Port that this structure applies to
|
||||
* bDeblocking : Enable/disable deblocking mode
|
||||
*/
|
||||
typedef struct OMX_PARAM_DEBLOCKINGTYPE {
|
||||
OMX_U32 nSize;
|
||||
OMX_VERSIONTYPE nVersion;
|
||||
OMX_U32 nPortIndex;
|
||||
OMX_BOOL bDeblocking;
|
||||
} OMX_PARAM_DEBLOCKINGTYPE;
|
||||
|
||||
|
||||
/**
|
||||
* Stabilization state
|
||||
*
|
||||
* STRUCT MEMBERS:
|
||||
* nSize : Size of the structure in bytes
|
||||
* nVersion : OMX specification version information
|
||||
* nPortIndex : Port that this structure applies to
|
||||
* bStab : Enable/disable frame stabilization state
|
||||
*/
|
||||
typedef struct OMX_CONFIG_FRAMESTABTYPE {
|
||||
OMX_U32 nSize;
|
||||
OMX_VERSIONTYPE nVersion;
|
||||
OMX_U32 nPortIndex;
|
||||
OMX_BOOL bStab;
|
||||
} OMX_CONFIG_FRAMESTABTYPE;
|
||||
|
||||
|
||||
/**
|
||||
* White Balance control type
|
||||
*
|
||||
* STRUCT MEMBERS:
|
||||
* SunLight : Referenced in JSR-234
|
||||
* Flash : Optimal for device's integrated flash
|
||||
*/
|
||||
typedef enum OMX_WHITEBALCONTROLTYPE {
|
||||
OMX_WhiteBalControlOff = 0,
|
||||
OMX_WhiteBalControlAuto,
|
||||
OMX_WhiteBalControlSunLight,
|
||||
OMX_WhiteBalControlCloudy,
|
||||
OMX_WhiteBalControlShade,
|
||||
OMX_WhiteBalControlTungsten,
|
||||
OMX_WhiteBalControlFluorescent,
|
||||
OMX_WhiteBalControlIncandescent,
|
||||
OMX_WhiteBalControlFlash,
|
||||
OMX_WhiteBalControlHorizon,
|
||||
OMX_WhiteBalControlKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
|
||||
OMX_WhiteBalControlVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
|
||||
OMX_WhiteBalControlMax = 0x7FFFFFFF
|
||||
} OMX_WHITEBALCONTROLTYPE;
|
||||
|
||||
|
||||
/**
|
||||
* White Balance control configuration
|
||||
*
|
||||
* STRUCT MEMBERS:
|
||||
* nSize : Size of the structure in bytes
|
||||
* nVersion : OMX specification version information
|
||||
* nPortIndex : Port that this structure applies to
|
||||
* eWhiteBalControl : White balance enumeration
|
||||
*/
|
||||
typedef struct OMX_CONFIG_WHITEBALCONTROLTYPE {
|
||||
OMX_U32 nSize;
|
||||
OMX_VERSIONTYPE nVersion;
|
||||
OMX_U32 nPortIndex;
|
||||
OMX_WHITEBALCONTROLTYPE eWhiteBalControl;
|
||||
} OMX_CONFIG_WHITEBALCONTROLTYPE;
|
||||
|
||||
|
||||
/**
|
||||
* Exposure control type
|
||||
*/
|
||||
typedef enum OMX_EXPOSURECONTROLTYPE {
|
||||
OMX_ExposureControlOff = 0,
|
||||
OMX_ExposureControlAuto,
|
||||
OMX_ExposureControlNight,
|
||||
OMX_ExposureControlBackLight,
|
||||
OMX_ExposureControlSpotLight,
|
||||
OMX_ExposureControlSports,
|
||||
OMX_ExposureControlSnow,
|
||||
OMX_ExposureControlBeach,
|
||||
OMX_ExposureControlLargeAperture,
|
||||
OMX_ExposureControlSmallApperture,
|
||||
OMX_ExposureControlKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
|
||||
OMX_ExposureControlVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
|
||||
OMX_ExposureControlMax = 0x7FFFFFFF
|
||||
} OMX_EXPOSURECONTROLTYPE;
|
||||
|
||||
|
||||
/**
|
||||
* White Balance control configuration
|
||||
*
|
||||
* STRUCT MEMBERS:
|
||||
* nSize : Size of the structure in bytes
|
||||
* nVersion : OMX specification version information
|
||||
* nPortIndex : Port that this structure applies to
|
||||
* eExposureControl : Exposure control enumeration
|
||||
*/
|
||||
typedef struct OMX_CONFIG_EXPOSURECONTROLTYPE {
|
||||
OMX_U32 nSize;
|
||||
OMX_VERSIONTYPE nVersion;
|
||||
OMX_U32 nPortIndex;
|
||||
OMX_EXPOSURECONTROLTYPE eExposureControl;
|
||||
} OMX_CONFIG_EXPOSURECONTROLTYPE;
|
||||
|
||||
|
||||
/**
|
||||
* Defines sensor supported mode.
|
||||
*
|
||||
* STRUCT MEMBERS:
|
||||
* nSize : Size of the structure in bytes
|
||||
* nVersion : OMX specification version information
|
||||
* nPortIndex : Port that this structure applies to
|
||||
* nFrameRate : Single shot mode is indicated by a 0
|
||||
* bOneShot : Enable for single shot, disable for streaming
|
||||
* sFrameSize : Framesize
|
||||
*/
|
||||
typedef struct OMX_PARAM_SENSORMODETYPE {
|
||||
OMX_U32 nSize;
|
||||
OMX_VERSIONTYPE nVersion;
|
||||
OMX_U32 nPortIndex;
|
||||
OMX_U32 nFrameRate;
|
||||
OMX_BOOL bOneShot;
|
||||
OMX_FRAMESIZETYPE sFrameSize;
|
||||
} OMX_PARAM_SENSORMODETYPE;
|
||||
|
||||
|
||||
/**
|
||||
* Defines contrast level
|
||||
*
|
||||
* STRUCT MEMBERS:
|
||||
* nSize : Size of the structure in bytes
|
||||
* nVersion : OMX specification version information
|
||||
* nPortIndex : Port that this structure applies to
|
||||
* nContrast : Values allowed for contrast -100 to 100, zero means no change
|
||||
*/
|
||||
typedef struct OMX_CONFIG_CONTRASTTYPE {
|
||||
OMX_U32 nSize;
|
||||
OMX_VERSIONTYPE nVersion;
|
||||
OMX_U32 nPortIndex;
|
||||
OMX_S32 nContrast;
|
||||
} OMX_CONFIG_CONTRASTTYPE;
|
||||
|
||||
|
||||
/**
|
||||
* Defines brightness level
|
||||
*
|
||||
* STRUCT MEMBERS:
|
||||
* nSize : Size of the structure in bytes
|
||||
* nVersion : OMX specification version information
|
||||
* nPortIndex : Port that this structure applies to
|
||||
* nBrightness : 0-100%
|
||||
*/
|
||||
typedef struct OMX_CONFIG_BRIGHTNESSTYPE {
|
||||
OMX_U32 nSize;
|
||||
OMX_VERSIONTYPE nVersion;
|
||||
OMX_U32 nPortIndex;
|
||||
OMX_U32 nBrightness;
|
||||
} OMX_CONFIG_BRIGHTNESSTYPE;
|
||||
|
||||
|
||||
/**
|
||||
* Defines backlight level configuration for a video sink, e.g. LCD panel
|
||||
*
|
||||
* STRUCT MEMBERS:
|
||||
* nSize : Size of the structure in bytes
|
||||
* nVersion : OMX specification version information
|
||||
* nPortIndex : Port that this structure applies to
|
||||
* nBacklight : Values allowed for backlight 0-100%
|
||||
* nTimeout : Number of milliseconds before backlight automatically turns
|
||||
* off. A value of 0x0 disables backight timeout
|
||||
*/
|
||||
typedef struct OMX_CONFIG_BACKLIGHTTYPE {
|
||||
OMX_U32 nSize;
|
||||
OMX_VERSIONTYPE nVersion;
|
||||
OMX_U32 nPortIndex;
|
||||
OMX_U32 nBacklight;
|
||||
OMX_U32 nTimeout;
|
||||
} OMX_CONFIG_BACKLIGHTTYPE;
|
||||
|
||||
|
||||
/**
|
||||
* Defines setting for Gamma
|
||||
*
|
||||
* STRUCT MEMBERS:
|
||||
* nSize : Size of the structure in bytes
|
||||
* nVersion : OMX specification version information
|
||||
* nPortIndex : Port that this structure applies to
|
||||
* nGamma : Values allowed for gamma -100 to 100, zero means no change
|
||||
*/
|
||||
typedef struct OMX_CONFIG_GAMMATYPE {
|
||||
OMX_U32 nSize;
|
||||
OMX_VERSIONTYPE nVersion;
|
||||
OMX_U32 nPortIndex;
|
||||
OMX_S32 nGamma;
|
||||
} OMX_CONFIG_GAMMATYPE;
|
||||
|
||||
|
||||
/**
|
||||
* Define for setting saturation
|
||||
*
|
||||
* STRUCT MEMBERS:
|
||||
* nSize : Size of the structure in bytes
|
||||
* nVersion : OMX specification version information
|
||||
* nPortIndex : Port that this structure applies to
|
||||
* nSaturation : Values allowed for saturation -100 to 100, zero means
|
||||
* no change
|
||||
*/
|
||||
typedef struct OMX_CONFIG_SATURATIONTYPE {
|
||||
OMX_U32 nSize;
|
||||
OMX_VERSIONTYPE nVersion;
|
||||
OMX_U32 nPortIndex;
|
||||
OMX_S32 nSaturation;
|
||||
} OMX_CONFIG_SATURATIONTYPE;
|
||||
|
||||
|
||||
/**
|
||||
* Define for setting Lightness
|
||||
*
|
||||
* STRUCT MEMBERS:
|
||||
* nSize : Size of the structure in bytes
|
||||
* nVersion : OMX specification version information
|
||||
* nPortIndex : Port that this structure applies to
|
||||
* nLightness : Values allowed for lightness -100 to 100, zero means no
|
||||
* change
|
||||
*/
|
||||
typedef struct OMX_CONFIG_LIGHTNESSTYPE {
|
||||
OMX_U32 nSize;
|
||||
OMX_VERSIONTYPE nVersion;
|
||||
OMX_U32 nPortIndex;
|
||||
OMX_S32 nLightness;
|
||||
} OMX_CONFIG_LIGHTNESSTYPE;
|
||||
|
||||
|
||||
/**
|
||||
* Plane blend configuration
|
||||
*
|
||||
* STRUCT MEMBERS:
|
||||
* nSize : Size of the structure in bytes
|
||||
* nVersion : OMX specification version information
|
||||
* nPortIndex : Index of input port associated with the plane.
|
||||
* nDepth : Depth of the plane in relation to the screen. Higher
|
||||
* numbered depths are "behind" lower number depths.
|
||||
* This number defaults to the Port Index number.
|
||||
* nAlpha : Transparency blending component for the entire plane.
|
||||
* See blending modes for more detail.
|
||||
*/
|
||||
typedef struct OMX_CONFIG_PLANEBLENDTYPE {
|
||||
OMX_U32 nSize;
|
||||
OMX_VERSIONTYPE nVersion;
|
||||
OMX_U32 nPortIndex;
|
||||
OMX_U32 nDepth;
|
||||
OMX_U32 nAlpha;
|
||||
} OMX_CONFIG_PLANEBLENDTYPE;
|
||||
|
||||
|
||||
/**
|
||||
* Define interlace type
|
||||
*
|
||||
* STRUCT MEMBERS:
|
||||
* nSize : Size of the structure in bytes
|
||||
* nVersion : OMX specification version information
|
||||
* nPortIndex : Port that this structure applies to
|
||||
* bEnable : Enable control variable for this functionality
|
||||
* (see below)
|
||||
* nInterleavePortIndex : Index of input or output port associated with
|
||||
* the interleaved plane.
|
||||
* pPlanarPortIndexes[4] : Index of input or output planar ports.
|
||||
*/
|
||||
typedef struct OMX_PARAM_INTERLEAVETYPE {
|
||||
OMX_U32 nSize;
|
||||
OMX_VERSIONTYPE nVersion;
|
||||
OMX_U32 nPortIndex;
|
||||
OMX_BOOL bEnable;
|
||||
OMX_U32 nInterleavePortIndex;
|
||||
} OMX_PARAM_INTERLEAVETYPE;
|
||||
|
||||
|
||||
/**
|
||||
* Defines the picture effect used for an input picture
|
||||
*/
|
||||
typedef enum OMX_TRANSITIONEFFECTTYPE {
|
||||
OMX_EffectNone,
|
||||
OMX_EffectFadeFromBlack,
|
||||
OMX_EffectFadeToBlack,
|
||||
OMX_EffectUnspecifiedThroughConstantColor,
|
||||
OMX_EffectDissolve,
|
||||
OMX_EffectWipe,
|
||||
OMX_EffectUnspecifiedMixOfTwoScenes,
|
||||
OMX_EffectKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
|
||||
OMX_EffectVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
|
||||
OMX_EffectMax = 0x7FFFFFFF
|
||||
} OMX_TRANSITIONEFFECTTYPE;
|
||||
|
||||
|
||||
/**
|
||||
* Structure used to configure current transition effect
|
||||
*
|
||||
* STRUCT MEMBERS:
|
||||
* nSize : Size of the structure in bytes
|
||||
* nVersion : OMX specification version information
|
||||
* nPortIndex : Port that this structure applies to
|
||||
* eEffect : Effect to enable
|
||||
*/
|
||||
typedef struct OMX_CONFIG_TRANSITIONEFFECTTYPE {
|
||||
OMX_U32 nSize;
|
||||
OMX_VERSIONTYPE nVersion;
|
||||
OMX_U32 nPortIndex;
|
||||
OMX_TRANSITIONEFFECTTYPE eEffect;
|
||||
} OMX_CONFIG_TRANSITIONEFFECTTYPE;
|
||||
|
||||
|
||||
/**
|
||||
* Defines possible data unit types for encoded video data. The data unit
|
||||
* types are used both for encoded video input for playback as well as
|
||||
* encoded video output from recording.
|
||||
*/
|
||||
typedef enum OMX_DATAUNITTYPE {
|
||||
OMX_DataUnitCodedPicture,
|
||||
OMX_DataUnitVideoSegment,
|
||||
OMX_DataUnitSeveralSegments,
|
||||
OMX_DataUnitArbitraryStreamSection,
|
||||
OMX_DataUnitKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
|
||||
OMX_DataUnitVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
|
||||
OMX_DataUnitMax = 0x7FFFFFFF
|
||||
} OMX_DATAUNITTYPE;
|
||||
|
||||
|
||||
/**
|
||||
* Defines possible encapsulation types for coded video data unit. The
|
||||
* encapsulation information is used both for encoded video input for
|
||||
* playback as well as encoded video output from recording.
|
||||
*/
|
||||
typedef enum OMX_DATAUNITENCAPSULATIONTYPE {
|
||||
OMX_DataEncapsulationElementaryStream,
|
||||
OMX_DataEncapsulationGenericPayload,
|
||||
OMX_DataEncapsulationRtpPayload,
|
||||
OMX_DataEncapsulationKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
|
||||
OMX_DataEncapsulationVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
|
||||
OMX_DataEncapsulationMax = 0x7FFFFFFF
|
||||
} OMX_DATAUNITENCAPSULATIONTYPE;
|
||||
|
||||
|
||||
/**
|
||||
* Structure used to configure the type of being decoded/encoded
|
||||
*/
|
||||
typedef struct OMX_PARAM_DATAUNITTYPE {
|
||||
OMX_U32 nSize; /**< Size of the structure in bytes */
|
||||
OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
|
||||
OMX_U32 nPortIndex; /**< Port that this structure applies to */
|
||||
OMX_DATAUNITTYPE eUnitType;
|
||||
OMX_DATAUNITENCAPSULATIONTYPE eEncapsulationType;
|
||||
} OMX_PARAM_DATAUNITTYPE;
|
||||
|
||||
|
||||
/**
|
||||
* Defines dither types
|
||||
*/
|
||||
typedef enum OMX_DITHERTYPE {
|
||||
OMX_DitherNone,
|
||||
OMX_DitherOrdered,
|
||||
OMX_DitherErrorDiffusion,
|
||||
OMX_DitherOther,
|
||||
OMX_DitherKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
|
||||
OMX_DitherVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
|
||||
OMX_DitherMax = 0x7FFFFFFF
|
||||
} OMX_DITHERTYPE;
|
||||
|
||||
|
||||
/**
|
||||
* Structure used to configure current type of dithering
|
||||
*/
|
||||
typedef struct OMX_CONFIG_DITHERTYPE {
|
||||
OMX_U32 nSize; /**< Size of the structure in bytes */
|
||||
OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
|
||||
OMX_U32 nPortIndex; /**< Port that this structure applies to */
|
||||
OMX_DITHERTYPE eDither; /**< Type of dithering to use */
|
||||
} OMX_CONFIG_DITHERTYPE;
|
||||
|
||||
typedef struct OMX_CONFIG_CAPTUREMODETYPE {
|
||||
OMX_U32 nSize;
|
||||
OMX_VERSIONTYPE nVersion;
|
||||
OMX_U32 nPortIndex; /**< Port that this structure applies to */
|
||||
OMX_BOOL bContinuous; /**< If true then ignore frame rate and emit capture
|
||||
* data as fast as possible (otherwise obey port's frame rate). */
|
||||
OMX_BOOL bFrameLimited; /**< If true then terminate capture after the port emits the
|
||||
* specified number of frames (otherwise the port does not
|
||||
* terminate the capture until instructed to do so by the client).
|
||||
* Even if set, the client may manually terminate the capture prior
|
||||
* to reaching the limit. */
|
||||
OMX_U32 nFrameLimit; /**< Limit on number of frames emitted during a capture (only
|
||||
* valid if bFrameLimited is set). */
|
||||
} OMX_CONFIG_CAPTUREMODETYPE;
|
||||
|
||||
typedef enum OMX_METERINGTYPE {
|
||||
|
||||
OMX_MeteringModeAverage, /**< Center-weighted average metering. */
|
||||
OMX_MeteringModeSpot, /**< Spot (partial) metering. */
|
||||
OMX_MeteringModeMatrix, /**< Matrix or evaluative metering. */
|
||||
|
||||
OMX_MeteringKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
|
||||
OMX_MeteringVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
|
||||
OMX_EVModeMax = 0x7fffffff
|
||||
} OMX_METERINGTYPE;
|
||||
|
||||
typedef struct OMX_CONFIG_EXPOSUREVALUETYPE {
|
||||
OMX_U32 nSize;
|
||||
OMX_VERSIONTYPE nVersion;
|
||||
OMX_U32 nPortIndex;
|
||||
OMX_METERINGTYPE eMetering;
|
||||
OMX_S32 xEVCompensation; /**< Fixed point value stored as Q16 */
|
||||
OMX_U32 nApertureFNumber; /**< e.g. nApertureFNumber = 2 implies "f/2" - Q16 format */
|
||||
OMX_BOOL bAutoAperture; /**< Whether aperture number is defined automatically */
|
||||
OMX_U32 nShutterSpeedMsec; /**< Shutterspeed in milliseconds */
|
||||
OMX_BOOL bAutoShutterSpeed; /**< Whether shutter speed is defined automatically */
|
||||
OMX_U32 nSensitivity; /**< e.g. nSensitivity = 100 implies "ISO 100" */
|
||||
OMX_BOOL bAutoSensitivity; /**< Whether sensitivity is defined automatically */
|
||||
} OMX_CONFIG_EXPOSUREVALUETYPE;
|
||||
|
||||
/**
|
||||
* Focus region configuration
|
||||
*
|
||||
* STRUCT MEMBERS:
|
||||
* nSize : Size of the structure in bytes
|
||||
* nVersion : OMX specification version information
|
||||
* nPortIndex : Port that this structure applies to
|
||||
* bCenter : Use center region as focus region of interest
|
||||
* bLeft : Use left region as focus region of interest
|
||||
* bRight : Use right region as focus region of interest
|
||||
* bTop : Use top region as focus region of interest
|
||||
* bBottom : Use bottom region as focus region of interest
|
||||
* bTopLeft : Use top left region as focus region of interest
|
||||
* bTopRight : Use top right region as focus region of interest
|
||||
* bBottomLeft : Use bottom left region as focus region of interest
|
||||
* bBottomRight : Use bottom right region as focus region of interest
|
||||
*/
|
||||
typedef struct OMX_CONFIG_FOCUSREGIONTYPE {
|
||||
OMX_U32 nSize;
|
||||
OMX_VERSIONTYPE nVersion;
|
||||
OMX_U32 nPortIndex;
|
||||
OMX_BOOL bCenter;
|
||||
OMX_BOOL bLeft;
|
||||
OMX_BOOL bRight;
|
||||
OMX_BOOL bTop;
|
||||
OMX_BOOL bBottom;
|
||||
OMX_BOOL bTopLeft;
|
||||
OMX_BOOL bTopRight;
|
||||
OMX_BOOL bBottomLeft;
|
||||
OMX_BOOL bBottomRight;
|
||||
} OMX_CONFIG_FOCUSREGIONTYPE;
|
||||
|
||||
/**
|
||||
* Focus Status type
|
||||
*/
|
||||
typedef enum OMX_FOCUSSTATUSTYPE {
|
||||
OMX_FocusStatusOff = 0,
|
||||
OMX_FocusStatusRequest,
|
||||
OMX_FocusStatusReached,
|
||||
OMX_FocusStatusUnableToReach,
|
||||
OMX_FocusStatusLost,
|
||||
OMX_FocusStatusKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
|
||||
OMX_FocusStatusVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
|
||||
OMX_FocusStatusMax = 0x7FFFFFFF
|
||||
} OMX_FOCUSSTATUSTYPE;
|
||||
|
||||
/**
|
||||
* Focus status configuration
|
||||
*
|
||||
* STRUCT MEMBERS:
|
||||
* nSize : Size of the structure in bytes
|
||||
* nVersion : OMX specification version information
|
||||
* nPortIndex : Port that this structure applies to
|
||||
* eFocusStatus : Specifies the focus status
|
||||
* bCenterStatus : Use center region as focus region of interest
|
||||
* bLeftStatus : Use left region as focus region of interest
|
||||
* bRightStatus : Use right region as focus region of interest
|
||||
* bTopStatus : Use top region as focus region of interest
|
||||
* bBottomStatus : Use bottom region as focus region of interest
|
||||
* bTopLeftStatus : Use top left region as focus region of interest
|
||||
* bTopRightStatus : Use top right region as focus region of interest
|
||||
* bBottomLeftStatus : Use bottom left region as focus region of interest
|
||||
* bBottomRightStatus : Use bottom right region as focus region of interest
|
||||
*/
|
||||
typedef struct OMX_PARAM_FOCUSSTATUSTYPE {
|
||||
OMX_U32 nSize;
|
||||
OMX_VERSIONTYPE nVersion;
|
||||
OMX_U32 nPortIndex;
|
||||
OMX_FOCUSSTATUSTYPE eFocusStatus;
|
||||
OMX_BOOL bCenterStatus;
|
||||
OMX_BOOL bLeftStatus;
|
||||
OMX_BOOL bRightStatus;
|
||||
OMX_BOOL bTopStatus;
|
||||
OMX_BOOL bBottomStatus;
|
||||
OMX_BOOL bTopLeftStatus;
|
||||
OMX_BOOL bTopRightStatus;
|
||||
OMX_BOOL bBottomLeftStatus;
|
||||
OMX_BOOL bBottomRightStatus;
|
||||
} OMX_PARAM_FOCUSSTATUSTYPE;
|
||||
|
||||
/** @} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif
|
||||
/* File EOF */
|
||||
@@ -1,328 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2008 The Khronos Group Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject
|
||||
* to the following conditions:
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file OMX_Image.h - OpenMax IL version 1.1.2
|
||||
* The structures needed by Image components to exchange parameters and
|
||||
* configuration data with the components.
|
||||
*/
|
||||
#ifndef OMX_Image_h
|
||||
#define OMX_Image_h
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
|
||||
/**
|
||||
* Each OMX header must include all required header files to allow the
|
||||
* header to compile without errors. The includes below are required
|
||||
* for this header file to compile successfully
|
||||
*/
|
||||
|
||||
#include <OMX_IVCommon.h>
|
||||
|
||||
/** @defgroup imaging OpenMAX IL Imaging Domain
|
||||
* @ingroup iv
|
||||
* Structures for OpenMAX IL Imaging domain
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* Enumeration used to define the possible image compression coding.
|
||||
*/
|
||||
typedef enum OMX_IMAGE_CODINGTYPE {
|
||||
OMX_IMAGE_CodingUnused, /**< Value when format is N/A */
|
||||
OMX_IMAGE_CodingAutoDetect, /**< Auto detection of image format */
|
||||
OMX_IMAGE_CodingJPEG, /**< JPEG/JFIF image format */
|
||||
OMX_IMAGE_CodingJPEG2K, /**< JPEG 2000 image format */
|
||||
OMX_IMAGE_CodingEXIF, /**< EXIF image format */
|
||||
OMX_IMAGE_CodingTIFF, /**< TIFF image format */
|
||||
OMX_IMAGE_CodingGIF, /**< Graphics image format */
|
||||
OMX_IMAGE_CodingPNG, /**< PNG image format */
|
||||
OMX_IMAGE_CodingLZW, /**< LZW image format */
|
||||
OMX_IMAGE_CodingBMP, /**< Windows Bitmap format */
|
||||
OMX_IMAGE_CodingKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
|
||||
OMX_IMAGE_CodingVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
|
||||
OMX_IMAGE_CodingMax = 0x7FFFFFFF
|
||||
} OMX_IMAGE_CODINGTYPE;
|
||||
|
||||
|
||||
/**
|
||||
* Data structure used to define an image path. The number of image paths
|
||||
* for input and output will vary by type of the image component.
|
||||
*
|
||||
* Input (aka Source) : Zero Inputs, one Output,
|
||||
* Splitter : One Input, 2 or more Outputs,
|
||||
* Processing Element : One Input, one output,
|
||||
* Mixer : 2 or more inputs, one output,
|
||||
* Output (aka Sink) : One Input, zero outputs.
|
||||
*
|
||||
* The PortDefinition structure is used to define all of the parameters
|
||||
* necessary for the compliant component to setup an input or an output
|
||||
* image path. If additional vendor specific data is required, it should
|
||||
* be transmitted to the component using the CustomCommand function.
|
||||
* Compliant components will prepopulate this structure with optimal
|
||||
* values during the OMX_GetParameter() command.
|
||||
*
|
||||
* STRUCT MEMBERS:
|
||||
* cMIMEType : MIME type of data for the port
|
||||
* pNativeRender : Platform specific reference for a display if a
|
||||
* sync, otherwise this field is 0
|
||||
* nFrameWidth : Width of frame to be used on port if
|
||||
* uncompressed format is used. Use 0 for
|
||||
* unknown, don't care or variable
|
||||
* nFrameHeight : Height of frame to be used on port if
|
||||
* uncompressed format is used. Use 0 for
|
||||
* unknown, don't care or variable
|
||||
* nStride : Number of bytes per span of an image (i.e.
|
||||
* indicates the number of bytes to get from
|
||||
* span N to span N+1, where negative stride
|
||||
* indicates the image is bottom up
|
||||
* nSliceHeight : Height used when encoding in slices
|
||||
* bFlagErrorConcealment : Turns on error concealment if it is supported by
|
||||
* the OMX component
|
||||
* eCompressionFormat : Compression format used in this instance of
|
||||
* the component. When OMX_IMAGE_CodingUnused is
|
||||
* specified, eColorFormat is valid
|
||||
* eColorFormat : Decompressed format used by this component
|
||||
* pNativeWindow : Platform specific reference for a window object if a
|
||||
* display sink , otherwise this field is 0x0.
|
||||
*/
|
||||
typedef struct OMX_IMAGE_PORTDEFINITIONTYPE {
|
||||
OMX_STRING cMIMEType;
|
||||
OMX_NATIVE_DEVICETYPE pNativeRender;
|
||||
OMX_U32 nFrameWidth;
|
||||
OMX_U32 nFrameHeight;
|
||||
OMX_S32 nStride;
|
||||
OMX_U32 nSliceHeight;
|
||||
OMX_BOOL bFlagErrorConcealment;
|
||||
OMX_IMAGE_CODINGTYPE eCompressionFormat;
|
||||
OMX_COLOR_FORMATTYPE eColorFormat;
|
||||
OMX_NATIVE_WINDOWTYPE pNativeWindow;
|
||||
} OMX_IMAGE_PORTDEFINITIONTYPE;
|
||||
|
||||
|
||||
/**
|
||||
* Port format parameter. This structure is used to enumerate the various
|
||||
* data input/output format supported by the port.
|
||||
*
|
||||
* STRUCT MEMBERS:
|
||||
* nSize : Size of the structure in bytes
|
||||
* nVersion : OMX specification version information
|
||||
* nPortIndex : Indicates which port to set
|
||||
* nIndex : Indicates the enumeration index for the format from
|
||||
* 0x0 to N-1
|
||||
* eCompressionFormat : Compression format used in this instance of the
|
||||
* component. When OMX_IMAGE_CodingUnused is specified,
|
||||
* eColorFormat is valid
|
||||
* eColorFormat : Decompressed format used by this component
|
||||
*/
|
||||
typedef struct OMX_IMAGE_PARAM_PORTFORMATTYPE {
|
||||
OMX_U32 nSize;
|
||||
OMX_VERSIONTYPE nVersion;
|
||||
OMX_U32 nPortIndex;
|
||||
OMX_U32 nIndex;
|
||||
OMX_IMAGE_CODINGTYPE eCompressionFormat;
|
||||
OMX_COLOR_FORMATTYPE eColorFormat;
|
||||
} OMX_IMAGE_PARAM_PORTFORMATTYPE;
|
||||
|
||||
|
||||
/**
|
||||
* Flash control type
|
||||
*
|
||||
* ENUMS
|
||||
* Torch : Flash forced constantly on
|
||||
*/
|
||||
typedef enum OMX_IMAGE_FLASHCONTROLTYPE {
|
||||
OMX_IMAGE_FlashControlOn = 0,
|
||||
OMX_IMAGE_FlashControlOff,
|
||||
OMX_IMAGE_FlashControlAuto,
|
||||
OMX_IMAGE_FlashControlRedEyeReduction,
|
||||
OMX_IMAGE_FlashControlFillin,
|
||||
OMX_IMAGE_FlashControlTorch,
|
||||
OMX_IMAGE_FlashControlKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
|
||||
OMX_IMAGE_FlashControlVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
|
||||
OMX_IMAGE_FlashControlMax = 0x7FFFFFFF
|
||||
} OMX_IMAGE_FLASHCONTROLTYPE;
|
||||
|
||||
|
||||
/**
|
||||
* Flash control configuration
|
||||
*
|
||||
* STRUCT MEMBERS:
|
||||
* nSize : Size of the structure in bytes
|
||||
* nVersion : OMX specification version information
|
||||
* nPortIndex : Port that this structure applies to
|
||||
* eFlashControl : Flash control type
|
||||
*/
|
||||
typedef struct OMX_IMAGE_PARAM_FLASHCONTROLTYPE {
|
||||
OMX_U32 nSize;
|
||||
OMX_VERSIONTYPE nVersion;
|
||||
OMX_U32 nPortIndex;
|
||||
OMX_IMAGE_FLASHCONTROLTYPE eFlashControl;
|
||||
} OMX_IMAGE_PARAM_FLASHCONTROLTYPE;
|
||||
|
||||
|
||||
/**
|
||||
* Focus control type
|
||||
*/
|
||||
typedef enum OMX_IMAGE_FOCUSCONTROLTYPE {
|
||||
OMX_IMAGE_FocusControlOn = 0,
|
||||
OMX_IMAGE_FocusControlOff,
|
||||
OMX_IMAGE_FocusControlAuto,
|
||||
OMX_IMAGE_FocusControlAutoLock,
|
||||
OMX_IMAGE_FocusControlKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
|
||||
OMX_IMAGE_FocusControlVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
|
||||
OMX_IMAGE_FocusControlMax = 0x7FFFFFFF
|
||||
} OMX_IMAGE_FOCUSCONTROLTYPE;
|
||||
|
||||
|
||||
/**
|
||||
* Focus control configuration
|
||||
*
|
||||
* STRUCT MEMBERS:
|
||||
* nSize : Size of the structure in bytes
|
||||
* nVersion : OMX specification version information
|
||||
* nPortIndex : Port that this structure applies to
|
||||
* eFocusControl : Focus control
|
||||
* nFocusSteps : Focus can take on values from 0 mm to infinity.
|
||||
* Interest is only in number of steps over this range.
|
||||
* nFocusStepIndex : Current focus step index
|
||||
*/
|
||||
typedef struct OMX_IMAGE_CONFIG_FOCUSCONTROLTYPE {
|
||||
OMX_U32 nSize;
|
||||
OMX_VERSIONTYPE nVersion;
|
||||
OMX_U32 nPortIndex;
|
||||
OMX_IMAGE_FOCUSCONTROLTYPE eFocusControl;
|
||||
OMX_U32 nFocusSteps;
|
||||
OMX_U32 nFocusStepIndex;
|
||||
} OMX_IMAGE_CONFIG_FOCUSCONTROLTYPE;
|
||||
|
||||
|
||||
/**
|
||||
* Q Factor for JPEG compression, which controls the tradeoff between image
|
||||
* quality and size. Q Factor provides a more simple means of controlling
|
||||
* JPEG compression quality, without directly programming Quantization
|
||||
* tables for chroma and luma
|
||||
*
|
||||
* STRUCT MEMBERS:
|
||||
* nSize : Size of the structure in bytes
|
||||
* nVersion : OMX specification version information
|
||||
* nPortIndex : Port that this structure applies to
|
||||
* nQFactor : JPEG Q factor value in the range of 1-100. A factor of 1
|
||||
* produces the smallest, worst quality images, and a factor
|
||||
* of 100 produces the largest, best quality images. A
|
||||
* typical default is 75 for small good quality images
|
||||
*/
|
||||
typedef struct OMX_IMAGE_PARAM_QFACTORTYPE {
|
||||
OMX_U32 nSize;
|
||||
OMX_VERSIONTYPE nVersion;
|
||||
OMX_U32 nPortIndex;
|
||||
OMX_U32 nQFactor;
|
||||
} OMX_IMAGE_PARAM_QFACTORTYPE;
|
||||
|
||||
/**
|
||||
* Quantization table type
|
||||
*/
|
||||
|
||||
typedef enum OMX_IMAGE_QUANTIZATIONTABLETYPE {
|
||||
OMX_IMAGE_QuantizationTableLuma = 0,
|
||||
OMX_IMAGE_QuantizationTableChroma,
|
||||
OMX_IMAGE_QuantizationTableChromaCb,
|
||||
OMX_IMAGE_QuantizationTableChromaCr,
|
||||
OMX_IMAGE_QuantizationTableKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
|
||||
OMX_IMAGE_QuantizationTableVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
|
||||
OMX_IMAGE_QuantizationTableMax = 0x7FFFFFFF
|
||||
} OMX_IMAGE_QUANTIZATIONTABLETYPE;
|
||||
|
||||
/**
|
||||
* JPEG quantization tables are used to determine DCT compression for
|
||||
* YUV data, as an alternative to specifying Q factor, providing exact
|
||||
* control of compression
|
||||
*
|
||||
* STRUCT MEMBERS:
|
||||
* nSize : Size of the structure in bytes
|
||||
* nVersion : OMX specification version information
|
||||
* nPortIndex : Port that this structure applies to
|
||||
* eQuantizationTable : Quantization table type
|
||||
* nQuantizationMatrix[64] : JPEG quantization table of coefficients stored
|
||||
* in increasing columns then by rows of data (i.e.
|
||||
* row 1, ... row 8). Quantization values are in
|
||||
* the range 0-255 and stored in linear order
|
||||
* (i.e. the component will zig-zag the
|
||||
* quantization table data if required internally)
|
||||
*/
|
||||
typedef struct OMX_IMAGE_PARAM_QUANTIZATIONTABLETYPE {
|
||||
OMX_U32 nSize;
|
||||
OMX_VERSIONTYPE nVersion;
|
||||
OMX_U32 nPortIndex;
|
||||
OMX_IMAGE_QUANTIZATIONTABLETYPE eQuantizationTable;
|
||||
OMX_U8 nQuantizationMatrix[64];
|
||||
} OMX_IMAGE_PARAM_QUANTIZATIONTABLETYPE;
|
||||
|
||||
|
||||
/**
|
||||
* Huffman table type, the same Huffman table is applied for chroma and
|
||||
* luma component
|
||||
*/
|
||||
typedef enum OMX_IMAGE_HUFFMANTABLETYPE {
|
||||
OMX_IMAGE_HuffmanTableAC = 0,
|
||||
OMX_IMAGE_HuffmanTableDC,
|
||||
OMX_IMAGE_HuffmanTableACLuma,
|
||||
OMX_IMAGE_HuffmanTableACChroma,
|
||||
OMX_IMAGE_HuffmanTableDCLuma,
|
||||
OMX_IMAGE_HuffmanTableDCChroma,
|
||||
OMX_IMAGE_HuffmanTableKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
|
||||
OMX_IMAGE_HuffmanTableVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
|
||||
OMX_IMAGE_HuffmanTableMax = 0x7FFFFFFF
|
||||
} OMX_IMAGE_HUFFMANTABLETYPE;
|
||||
|
||||
/**
|
||||
* JPEG Huffman table
|
||||
*
|
||||
* STRUCT MEMBERS:
|
||||
* nSize : Size of the structure in bytes
|
||||
* nVersion : OMX specification version information
|
||||
* nPortIndex : Port that this structure applies to
|
||||
* eHuffmanTable : Huffman table type
|
||||
* nNumberOfHuffmanCodeOfLength[16] : 0-16, number of Huffman codes of each
|
||||
* possible length
|
||||
* nHuffmanTable[256] : 0-255, the size used for AC and DC
|
||||
* HuffmanTable are 16 and 162
|
||||
*/
|
||||
typedef struct OMX_IMAGE_PARAM_HUFFMANTTABLETYPE {
|
||||
OMX_U32 nSize;
|
||||
OMX_VERSIONTYPE nVersion;
|
||||
OMX_U32 nPortIndex;
|
||||
OMX_IMAGE_HUFFMANTABLETYPE eHuffmanTable;
|
||||
OMX_U8 nNumberOfHuffmanCodeOfLength[16];
|
||||
OMX_U8 nHuffmanTable[256];
|
||||
}OMX_IMAGE_PARAM_HUFFMANTTABLETYPE;
|
||||
|
||||
/** @} */
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif
|
||||
/* File EOF */
|
||||
@@ -1,259 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2008 The Khronos Group Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject
|
||||
* to the following conditions:
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
/** @file OMX_Index.h - OpenMax IL version 1.1.2
|
||||
* The OMX_Index header file contains the definitions for both applications
|
||||
* and components .
|
||||
*/
|
||||
|
||||
|
||||
#ifndef OMX_Index_h
|
||||
#define OMX_Index_h
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
|
||||
/* Each OMX header must include all required header files to allow the
|
||||
* header to compile without errors. The includes below are required
|
||||
* for this header file to compile successfully
|
||||
*/
|
||||
#include <OMX_Types.h>
|
||||
|
||||
|
||||
/** The OMX_INDEXTYPE enumeration is used to select a structure when either
|
||||
* getting or setting parameters and/or configuration data. Each entry in
|
||||
* this enumeration maps to an OMX specified structure. When the
|
||||
* OMX_GetParameter, OMX_SetParameter, OMX_GetConfig or OMX_SetConfig methods
|
||||
* are used, the second parameter will always be an entry from this enumeration
|
||||
* and the third entry will be the structure shown in the comments for the entry.
|
||||
* For example, if the application is initializing a cropping function, the
|
||||
* OMX_SetConfig command would have OMX_IndexConfigCommonInputCrop as the second parameter
|
||||
* and would send a pointer to an initialized OMX_RECTTYPE structure as the
|
||||
* third parameter.
|
||||
*
|
||||
* The enumeration entries named with the OMX_Config prefix are sent using
|
||||
* the OMX_SetConfig command and the enumeration entries named with the
|
||||
* OMX_PARAM_ prefix are sent using the OMX_SetParameter command.
|
||||
*/
|
||||
typedef enum OMX_INDEXTYPE {
|
||||
|
||||
OMX_IndexComponentStartUnused = 0x01000000,
|
||||
OMX_IndexParamPriorityMgmt, /**< reference: OMX_PRIORITYMGMTTYPE */
|
||||
OMX_IndexParamAudioInit, /**< reference: OMX_PORT_PARAM_TYPE */
|
||||
OMX_IndexParamImageInit, /**< reference: OMX_PORT_PARAM_TYPE */
|
||||
OMX_IndexParamVideoInit, /**< reference: OMX_PORT_PARAM_TYPE */
|
||||
OMX_IndexParamOtherInit, /**< reference: OMX_PORT_PARAM_TYPE */
|
||||
OMX_IndexParamNumAvailableStreams, /**< reference: OMX_PARAM_U32TYPE */
|
||||
OMX_IndexParamActiveStream, /**< reference: OMX_PARAM_U32TYPE */
|
||||
OMX_IndexParamSuspensionPolicy, /**< reference: OMX_PARAM_SUSPENSIONPOLICYTYPE */
|
||||
OMX_IndexParamComponentSuspended, /**< reference: OMX_PARAM_SUSPENSIONTYPE */
|
||||
OMX_IndexConfigCapturing, /**< reference: OMX_CONFIG_BOOLEANTYPE */
|
||||
OMX_IndexConfigCaptureMode, /**< reference: OMX_CONFIG_CAPTUREMODETYPE */
|
||||
OMX_IndexAutoPauseAfterCapture, /**< reference: OMX_CONFIG_BOOLEANTYPE */
|
||||
OMX_IndexParamContentURI, /**< reference: OMX_PARAM_CONTENTURITYPE */
|
||||
OMX_IndexParamCustomContentPipe, /**< reference: OMX_PARAM_CONTENTPIPETYPE */
|
||||
OMX_IndexParamDisableResourceConcealment, /**< reference: OMX_RESOURCECONCEALMENTTYPE */
|
||||
OMX_IndexConfigMetadataItemCount, /**< reference: OMX_CONFIG_METADATAITEMCOUNTTYPE */
|
||||
OMX_IndexConfigContainerNodeCount, /**< reference: OMX_CONFIG_CONTAINERNODECOUNTTYPE */
|
||||
OMX_IndexConfigMetadataItem, /**< reference: OMX_CONFIG_METADATAITEMTYPE */
|
||||
OMX_IndexConfigCounterNodeID, /**< reference: OMX_CONFIG_CONTAINERNODEIDTYPE */
|
||||
OMX_IndexParamMetadataFilterType, /**< reference: OMX_PARAM_METADATAFILTERTYPE */
|
||||
OMX_IndexParamMetadataKeyFilter, /**< reference: OMX_PARAM_METADATAFILTERTYPE */
|
||||
OMX_IndexConfigPriorityMgmt, /**< reference: OMX_PRIORITYMGMTTYPE */
|
||||
OMX_IndexParamStandardComponentRole, /**< reference: OMX_PARAM_COMPONENTROLETYPE */
|
||||
|
||||
OMX_IndexPortStartUnused = 0x02000000,
|
||||
OMX_IndexParamPortDefinition, /**< reference: OMX_PARAM_PORTDEFINITIONTYPE */
|
||||
OMX_IndexParamCompBufferSupplier, /**< reference: OMX_PARAM_BUFFERSUPPLIERTYPE */
|
||||
OMX_IndexReservedStartUnused = 0x03000000,
|
||||
|
||||
/* Audio parameters and configurations */
|
||||
OMX_IndexAudioStartUnused = 0x04000000,
|
||||
OMX_IndexParamAudioPortFormat, /**< reference: OMX_AUDIO_PARAM_PORTFORMATTYPE */
|
||||
OMX_IndexParamAudioPcm, /**< reference: OMX_AUDIO_PARAM_PCMMODETYPE */
|
||||
OMX_IndexParamAudioAac, /**< reference: OMX_AUDIO_PARAM_AACPROFILETYPE */
|
||||
OMX_IndexParamAudioRa, /**< reference: OMX_AUDIO_PARAM_RATYPE */
|
||||
OMX_IndexParamAudioMp3, /**< reference: OMX_AUDIO_PARAM_MP3TYPE */
|
||||
OMX_IndexParamAudioAdpcm, /**< reference: OMX_AUDIO_PARAM_ADPCMTYPE */
|
||||
OMX_IndexParamAudioG723, /**< reference: OMX_AUDIO_PARAM_G723TYPE */
|
||||
OMX_IndexParamAudioG729, /**< reference: OMX_AUDIO_PARAM_G729TYPE */
|
||||
OMX_IndexParamAudioAmr, /**< reference: OMX_AUDIO_PARAM_AMRTYPE */
|
||||
OMX_IndexParamAudioWma, /**< reference: OMX_AUDIO_PARAM_WMATYPE */
|
||||
OMX_IndexParamAudioSbc, /**< reference: OMX_AUDIO_PARAM_SBCTYPE */
|
||||
OMX_IndexParamAudioMidi, /**< reference: OMX_AUDIO_PARAM_MIDITYPE */
|
||||
OMX_IndexParamAudioGsm_FR, /**< reference: OMX_AUDIO_PARAM_GSMFRTYPE */
|
||||
OMX_IndexParamAudioMidiLoadUserSound, /**< reference: OMX_AUDIO_PARAM_MIDILOADUSERSOUNDTYPE */
|
||||
OMX_IndexParamAudioG726, /**< reference: OMX_AUDIO_PARAM_G726TYPE */
|
||||
OMX_IndexParamAudioGsm_EFR, /**< reference: OMX_AUDIO_PARAM_GSMEFRTYPE */
|
||||
OMX_IndexParamAudioGsm_HR, /**< reference: OMX_AUDIO_PARAM_GSMHRTYPE */
|
||||
OMX_IndexParamAudioPdc_FR, /**< reference: OMX_AUDIO_PARAM_PDCFRTYPE */
|
||||
OMX_IndexParamAudioPdc_EFR, /**< reference: OMX_AUDIO_PARAM_PDCEFRTYPE */
|
||||
OMX_IndexParamAudioPdc_HR, /**< reference: OMX_AUDIO_PARAM_PDCHRTYPE */
|
||||
OMX_IndexParamAudioTdma_FR, /**< reference: OMX_AUDIO_PARAM_TDMAFRTYPE */
|
||||
OMX_IndexParamAudioTdma_EFR, /**< reference: OMX_AUDIO_PARAM_TDMAEFRTYPE */
|
||||
OMX_IndexParamAudioQcelp8, /**< reference: OMX_AUDIO_PARAM_QCELP8TYPE */
|
||||
OMX_IndexParamAudioQcelp13, /**< reference: OMX_AUDIO_PARAM_QCELP13TYPE */
|
||||
OMX_IndexParamAudioEvrc, /**< reference: OMX_AUDIO_PARAM_EVRCTYPE */
|
||||
OMX_IndexParamAudioSmv, /**< reference: OMX_AUDIO_PARAM_SMVTYPE */
|
||||
OMX_IndexParamAudioVorbis, /**< reference: OMX_AUDIO_PARAM_VORBISTYPE */
|
||||
|
||||
OMX_IndexConfigAudioMidiImmediateEvent, /**< reference: OMX_AUDIO_CONFIG_MIDIIMMEDIATEEVENTTYPE */
|
||||
OMX_IndexConfigAudioMidiControl, /**< reference: OMX_AUDIO_CONFIG_MIDICONTROLTYPE */
|
||||
OMX_IndexConfigAudioMidiSoundBankProgram, /**< reference: OMX_AUDIO_CONFIG_MIDISOUNDBANKPROGRAMTYPE */
|
||||
OMX_IndexConfigAudioMidiStatus, /**< reference: OMX_AUDIO_CONFIG_MIDISTATUSTYPE */
|
||||
OMX_IndexConfigAudioMidiMetaEvent, /**< reference: OMX_AUDIO_CONFIG_MIDIMETAEVENTTYPE */
|
||||
OMX_IndexConfigAudioMidiMetaEventData, /**< reference: OMX_AUDIO_CONFIG_MIDIMETAEVENTDATATYPE */
|
||||
OMX_IndexConfigAudioVolume, /**< reference: OMX_AUDIO_CONFIG_VOLUMETYPE */
|
||||
OMX_IndexConfigAudioBalance, /**< reference: OMX_AUDIO_CONFIG_BALANCETYPE */
|
||||
OMX_IndexConfigAudioChannelMute, /**< reference: OMX_AUDIO_CONFIG_CHANNELMUTETYPE */
|
||||
OMX_IndexConfigAudioMute, /**< reference: OMX_AUDIO_CONFIG_MUTETYPE */
|
||||
OMX_IndexConfigAudioLoudness, /**< reference: OMX_AUDIO_CONFIG_LOUDNESSTYPE */
|
||||
OMX_IndexConfigAudioEchoCancelation, /**< reference: OMX_AUDIO_CONFIG_ECHOCANCELATIONTYPE */
|
||||
OMX_IndexConfigAudioNoiseReduction, /**< reference: OMX_AUDIO_CONFIG_NOISEREDUCTIONTYPE */
|
||||
OMX_IndexConfigAudioBass, /**< reference: OMX_AUDIO_CONFIG_BASSTYPE */
|
||||
OMX_IndexConfigAudioTreble, /**< reference: OMX_AUDIO_CONFIG_TREBLETYPE */
|
||||
OMX_IndexConfigAudioStereoWidening, /**< reference: OMX_AUDIO_CONFIG_STEREOWIDENINGTYPE */
|
||||
OMX_IndexConfigAudioChorus, /**< reference: OMX_AUDIO_CONFIG_CHORUSTYPE */
|
||||
OMX_IndexConfigAudioEqualizer, /**< reference: OMX_AUDIO_CONFIG_EQUALIZERTYPE */
|
||||
OMX_IndexConfigAudioReverberation, /**< reference: OMX_AUDIO_CONFIG_REVERBERATIONTYPE */
|
||||
OMX_IndexConfigAudioChannelVolume, /**< reference: OMX_AUDIO_CONFIG_CHANNELVOLUMETYPE */
|
||||
|
||||
/* Image specific parameters and configurations */
|
||||
OMX_IndexImageStartUnused = 0x05000000,
|
||||
OMX_IndexParamImagePortFormat, /**< reference: OMX_IMAGE_PARAM_PORTFORMATTYPE */
|
||||
OMX_IndexParamFlashControl, /**< reference: OMX_IMAGE_PARAM_FLASHCONTROLTYPE */
|
||||
OMX_IndexConfigFocusControl, /**< reference: OMX_IMAGE_CONFIG_FOCUSCONTROLTYPE */
|
||||
OMX_IndexParamQFactor, /**< reference: OMX_IMAGE_PARAM_QFACTORTYPE */
|
||||
OMX_IndexParamQuantizationTable, /**< reference: OMX_IMAGE_PARAM_QUANTIZATIONTABLETYPE */
|
||||
OMX_IndexParamHuffmanTable, /**< reference: OMX_IMAGE_PARAM_HUFFMANTTABLETYPE */
|
||||
OMX_IndexConfigFlashControl, /**< reference: OMX_IMAGE_PARAM_FLASHCONTROLTYPE */
|
||||
|
||||
/* Video specific parameters and configurations */
|
||||
OMX_IndexVideoStartUnused = 0x06000000,
|
||||
OMX_IndexParamVideoPortFormat, /**< reference: OMX_VIDEO_PARAM_PORTFORMATTYPE */
|
||||
OMX_IndexParamVideoQuantization, /**< reference: OMX_VIDEO_PARAM_QUANTIZATIONTYPE */
|
||||
OMX_IndexParamVideoFastUpdate, /**< reference: OMX_VIDEO_PARAM_VIDEOFASTUPDATETYPE */
|
||||
OMX_IndexParamVideoBitrate, /**< reference: OMX_VIDEO_PARAM_BITRATETYPE */
|
||||
OMX_IndexParamVideoMotionVector, /**< reference: OMX_VIDEO_PARAM_MOTIONVECTORTYPE */
|
||||
OMX_IndexParamVideoIntraRefresh, /**< reference: OMX_VIDEO_PARAM_INTRAREFRESHTYPE */
|
||||
OMX_IndexParamVideoErrorCorrection, /**< reference: OMX_VIDEO_PARAM_ERRORCORRECTIONTYPE */
|
||||
OMX_IndexParamVideoVBSMC, /**< reference: OMX_VIDEO_PARAM_VBSMCTYPE */
|
||||
OMX_IndexParamVideoMpeg2, /**< reference: OMX_VIDEO_PARAM_MPEG2TYPE */
|
||||
OMX_IndexParamVideoMpeg4, /**< reference: OMX_VIDEO_PARAM_MPEG4TYPE */
|
||||
OMX_IndexParamVideoWmv, /**< reference: OMX_VIDEO_PARAM_WMVTYPE */
|
||||
OMX_IndexParamVideoRv, /**< reference: OMX_VIDEO_PARAM_RVTYPE */
|
||||
OMX_IndexParamVideoAvc, /**< reference: OMX_VIDEO_PARAM_AVCTYPE */
|
||||
OMX_IndexParamVideoH263, /**< reference: OMX_VIDEO_PARAM_H263TYPE */
|
||||
OMX_IndexParamVideoProfileLevelQuerySupported, /**< reference: OMX_VIDEO_PARAM_PROFILELEVELTYPE */
|
||||
OMX_IndexParamVideoProfileLevelCurrent, /**< reference: OMX_VIDEO_PARAM_PROFILELEVELTYPE */
|
||||
OMX_IndexConfigVideoBitrate, /**< reference: OMX_VIDEO_CONFIG_BITRATETYPE */
|
||||
OMX_IndexConfigVideoFramerate, /**< reference: OMX_CONFIG_FRAMERATETYPE */
|
||||
OMX_IndexConfigVideoIntraVOPRefresh, /**< reference: OMX_CONFIG_INTRAREFRESHVOPTYPE */
|
||||
OMX_IndexConfigVideoIntraMBRefresh, /**< reference: OMX_CONFIG_MACROBLOCKERRORMAPTYPE */
|
||||
OMX_IndexConfigVideoMBErrorReporting, /**< reference: OMX_CONFIG_MBERRORREPORTINGTYPE */
|
||||
OMX_IndexParamVideoMacroblocksPerFrame, /**< reference: OMX_PARAM_MACROBLOCKSTYPE */
|
||||
OMX_IndexConfigVideoMacroBlockErrorMap, /**< reference: OMX_CONFIG_MACROBLOCKERRORMAPTYPE */
|
||||
OMX_IndexParamVideoSliceFMO, /**< reference: OMX_VIDEO_PARAM_AVCSLICEFMO */
|
||||
OMX_IndexConfigVideoAVCIntraPeriod, /**< reference: OMX_VIDEO_CONFIG_AVCINTRAPERIOD */
|
||||
OMX_IndexConfigVideoNalSize, /**< reference: OMX_VIDEO_CONFIG_NALSIZE */
|
||||
OMX_IndexConfigCommonDeinterlace, /**< reference: OMX_VIDEO_CONFIG_DEINTERLACE */
|
||||
|
||||
/* Image & Video common Configurations */
|
||||
OMX_IndexCommonStartUnused = 0x07000000,
|
||||
OMX_IndexParamCommonDeblocking, /**< reference: OMX_PARAM_DEBLOCKINGTYPE */
|
||||
OMX_IndexParamCommonSensorMode, /**< reference: OMX_PARAM_SENSORMODETYPE */
|
||||
OMX_IndexParamCommonInterleave, /**< reference: OMX_PARAM_INTERLEAVETYPE */
|
||||
OMX_IndexConfigCommonColorFormatConversion, /**< reference: OMX_CONFIG_COLORCONVERSIONTYPE */
|
||||
OMX_IndexConfigCommonScale, /**< reference: OMX_CONFIG_SCALEFACTORTYPE */
|
||||
OMX_IndexConfigCommonImageFilter, /**< reference: OMX_CONFIG_IMAGEFILTERTYPE */
|
||||
OMX_IndexConfigCommonColorEnhancement, /**< reference: OMX_CONFIG_COLORENHANCEMENTTYPE */
|
||||
OMX_IndexConfigCommonColorKey, /**< reference: OMX_CONFIG_COLORKEYTYPE */
|
||||
OMX_IndexConfigCommonColorBlend, /**< reference: OMX_CONFIG_COLORBLENDTYPE */
|
||||
OMX_IndexConfigCommonFrameStabilisation,/**< reference: OMX_CONFIG_FRAMESTABTYPE */
|
||||
OMX_IndexConfigCommonRotate, /**< reference: OMX_CONFIG_ROTATIONTYPE */
|
||||
OMX_IndexConfigCommonMirror, /**< reference: OMX_CONFIG_MIRRORTYPE */
|
||||
OMX_IndexConfigCommonOutputPosition, /**< reference: OMX_CONFIG_POINTTYPE */
|
||||
OMX_IndexConfigCommonInputCrop, /**< reference: OMX_CONFIG_RECTTYPE */
|
||||
OMX_IndexConfigCommonOutputCrop, /**< reference: OMX_CONFIG_RECTTYPE */
|
||||
OMX_IndexConfigCommonDigitalZoom, /**< reference: OMX_CONFIG_SCALEFACTORTYPE */
|
||||
OMX_IndexConfigCommonOpticalZoom, /**< reference: OMX_CONFIG_SCALEFACTORTYPE*/
|
||||
OMX_IndexConfigCommonWhiteBalance, /**< reference: OMX_CONFIG_WHITEBALCONTROLTYPE */
|
||||
OMX_IndexConfigCommonExposure, /**< reference: OMX_CONFIG_EXPOSURECONTROLTYPE */
|
||||
OMX_IndexConfigCommonContrast, /**< reference: OMX_CONFIG_CONTRASTTYPE */
|
||||
OMX_IndexConfigCommonBrightness, /**< reference: OMX_CONFIG_BRIGHTNESSTYPE */
|
||||
OMX_IndexConfigCommonBacklight, /**< reference: OMX_CONFIG_BACKLIGHTTYPE */
|
||||
OMX_IndexConfigCommonGamma, /**< reference: OMX_CONFIG_GAMMATYPE */
|
||||
OMX_IndexConfigCommonSaturation, /**< reference: OMX_CONFIG_SATURATIONTYPE */
|
||||
OMX_IndexConfigCommonLightness, /**< reference: OMX_CONFIG_LIGHTNESSTYPE */
|
||||
OMX_IndexConfigCommonExclusionRect, /**< reference: OMX_CONFIG_RECTTYPE */
|
||||
OMX_IndexConfigCommonDithering, /**< reference: OMX_CONFIG_DITHERTYPE */
|
||||
OMX_IndexConfigCommonPlaneBlend, /**< reference: OMX_CONFIG_PLANEBLENDTYPE */
|
||||
OMX_IndexConfigCommonExposureValue, /**< reference: OMX_CONFIG_EXPOSUREVALUETYPE */
|
||||
OMX_IndexConfigCommonOutputSize, /**< reference: OMX_FRAMESIZETYPE */
|
||||
OMX_IndexParamCommonExtraQuantData, /**< reference: OMX_OTHER_EXTRADATATYPE */
|
||||
OMX_IndexConfigCommonFocusRegion, /**< reference: OMX_CONFIG_FOCUSREGIONTYPE */
|
||||
OMX_IndexConfigCommonFocusStatus, /**< reference: OMX_PARAM_FOCUSSTATUSTYPE */
|
||||
OMX_IndexConfigCommonTransitionEffect, /**< reference: OMX_CONFIG_TRANSITIONEFFECTTYPE */
|
||||
|
||||
/* Reserved Configuration range */
|
||||
OMX_IndexOtherStartUnused = 0x08000000,
|
||||
OMX_IndexParamOtherPortFormat, /**< reference: OMX_OTHER_PARAM_PORTFORMATTYPE */
|
||||
OMX_IndexConfigOtherPower, /**< reference: OMX_OTHER_CONFIG_POWERTYPE */
|
||||
OMX_IndexConfigOtherStats, /**< reference: OMX_OTHER_CONFIG_STATSTYPE */
|
||||
|
||||
|
||||
/* Reserved Time range */
|
||||
OMX_IndexTimeStartUnused = 0x09000000,
|
||||
OMX_IndexConfigTimeScale, /**< reference: OMX_TIME_CONFIG_SCALETYPE */
|
||||
OMX_IndexConfigTimeClockState, /**< reference: OMX_TIME_CONFIG_CLOCKSTATETYPE */
|
||||
OMX_IndexConfigTimeActiveRefClock, /**< reference: OMX_TIME_CONFIG_ACTIVEREFCLOCKTYPE */
|
||||
OMX_IndexConfigTimeCurrentMediaTime, /**< reference: OMX_TIME_CONFIG_TIMESTAMPTYPE (read only) */
|
||||
OMX_IndexConfigTimeCurrentWallTime, /**< reference: OMX_TIME_CONFIG_TIMESTAMPTYPE (read only) */
|
||||
OMX_IndexConfigTimeCurrentAudioReference, /**< reference: OMX_TIME_CONFIG_TIMESTAMPTYPE (write only) */
|
||||
OMX_IndexConfigTimeCurrentVideoReference, /**< reference: OMX_TIME_CONFIG_TIMESTAMPTYPE (write only) */
|
||||
OMX_IndexConfigTimeMediaTimeRequest, /**< reference: OMX_TIME_CONFIG_MEDIATIMEREQUESTTYPE (write only) */
|
||||
OMX_IndexConfigTimeClientStartTime, /**<reference: OMX_TIME_CONFIG_TIMESTAMPTYPE (write only) */
|
||||
OMX_IndexConfigTimePosition, /**< reference: OMX_TIME_CONFIG_TIMESTAMPTYPE */
|
||||
OMX_IndexConfigTimeSeekMode, /**< reference: OMX_TIME_CONFIG_SEEKMODETYPE */
|
||||
|
||||
|
||||
OMX_IndexKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
|
||||
/* Vendor specific area */
|
||||
OMX_IndexVendorStartUnused = 0x7F000000,
|
||||
/* Vendor specific structures should be in the range of 0x7F000000
|
||||
to 0x7FFFFFFE. This range is not broken out by vendor, so
|
||||
private indexes are not guaranteed unique and therefore should
|
||||
only be sent to the appropriate component. */
|
||||
|
||||
OMX_IndexMax = 0x7FFFFFFF
|
||||
|
||||
} OMX_INDEXTYPE;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif
|
||||
/* File EOF */
|
||||
@@ -1,95 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2010 The Khronos Group Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject
|
||||
* to the following conditions:
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
/** @file OMX_IndexExt.h - OpenMax IL version 1.1.2
|
||||
* The OMX_IndexExt header file contains extensions to the definitions
|
||||
* for both applications and components .
|
||||
*/
|
||||
|
||||
#ifndef OMX_IndexExt_h
|
||||
#define OMX_IndexExt_h
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/* Each OMX header shall include all required header files to allow the
|
||||
* header to compile without errors. The includes below are required
|
||||
* for this header file to compile successfully
|
||||
*/
|
||||
#include <OMX_Index.h>
|
||||
|
||||
|
||||
/** Khronos standard extension indices.
|
||||
|
||||
This enum lists the current Khronos extension indices to OpenMAX IL.
|
||||
*/
|
||||
typedef enum OMX_INDEXEXTTYPE {
|
||||
|
||||
/* Component parameters and configurations */
|
||||
OMX_IndexExtComponentStartUnused = OMX_IndexKhronosExtensions + 0x00100000,
|
||||
OMX_IndexConfigCallbackRequest, /**< reference: OMX_CONFIG_CALLBACKREQUESTTYPE */
|
||||
OMX_IndexConfigCommitMode, /**< reference: OMX_CONFIG_COMMITMODETYPE */
|
||||
OMX_IndexConfigCommit, /**< reference: OMX_CONFIG_COMMITTYPE */
|
||||
|
||||
/* Port parameters and configurations */
|
||||
OMX_IndexExtPortStartUnused = OMX_IndexKhronosExtensions + 0x00200000,
|
||||
|
||||
/* Audio parameters and configurations */
|
||||
OMX_IndexExtAudioStartUnused = OMX_IndexKhronosExtensions + 0x00400000,
|
||||
|
||||
/* Image parameters and configurations */
|
||||
OMX_IndexExtImageStartUnused = OMX_IndexKhronosExtensions + 0x00500000,
|
||||
|
||||
/* Video parameters and configurations */
|
||||
OMX_IndexExtVideoStartUnused = OMX_IndexKhronosExtensions + 0x00600000,
|
||||
OMX_IndexParamNalStreamFormatSupported, /**< reference: OMX_NALSTREAMFORMATTYPE */
|
||||
OMX_IndexParamNalStreamFormat, /**< reference: OMX_NALSTREAMFORMATTYPE */
|
||||
OMX_IndexParamNalStreamFormatSelect, /**< reference: OMX_NALSTREAMFORMATTYPE */
|
||||
OMX_IndexParamVideoVp8, /**< reference: OMX_VIDEO_PARAM_VP8TYPE */
|
||||
OMX_IndexConfigVideoVp8ReferenceFrame, /**< reference: OMX_VIDEO_VP8REFERENCEFRAMETYPE */
|
||||
OMX_IndexConfigVideoVp8ReferenceFrameType, /**< reference: OMX_VIDEO_VP8REFERENCEFRAMEINFOTYPE */
|
||||
OMX_IndexParamVideoReserved, /**< Reserved for future index */
|
||||
OMX_IndexParamVideoHevc, /**< reference: OMX_VIDEO_PARAM_HEVCTYPE */
|
||||
|
||||
/* Image & Video common configurations */
|
||||
OMX_IndexExtCommonStartUnused = OMX_IndexKhronosExtensions + 0x00700000,
|
||||
|
||||
/* Other configurations */
|
||||
OMX_IndexExtOtherStartUnused = OMX_IndexKhronosExtensions + 0x00800000,
|
||||
OMX_IndexConfigAutoFramerateConversion, /**< reference: OMX_CONFIG_BOOLEANTYPE */
|
||||
OMX_IndexConfigPriority, /**< reference: OMX_PARAM_U32TYPE */
|
||||
OMX_IndexConfigOperatingRate, /**< reference: OMX_PARAM_U32TYPE in Q16 format for video and in Hz for audio */
|
||||
|
||||
/* Time configurations */
|
||||
OMX_IndexExtTimeStartUnused = OMX_IndexKhronosExtensions + 0x00900000,
|
||||
|
||||
OMX_IndexExtMax = 0x7FFFFFFF
|
||||
} OMX_INDEXEXTTYPE;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* OMX_IndexExt_h */
|
||||
/* File EOF */
|
||||
@@ -1,337 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2008 The Khronos Group Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject
|
||||
* to the following conditions:
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
/** @file OMX_Other.h - OpenMax IL version 1.1.2
|
||||
* The structures needed by Other components to exchange
|
||||
* parameters and configuration data with the components.
|
||||
*/
|
||||
|
||||
#ifndef OMX_Other_h
|
||||
#define OMX_Other_h
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
|
||||
/* Each OMX header must include all required header files to allow the
|
||||
* header to compile without errors. The includes below are required
|
||||
* for this header file to compile successfully
|
||||
*/
|
||||
|
||||
#include <OMX_Core.h>
|
||||
|
||||
|
||||
/**
|
||||
* Enumeration of possible data types which match to multiple domains or no
|
||||
* domain at all. For types which are vendor specific, a value above
|
||||
* OMX_OTHER_VENDORTSTART should be used.
|
||||
*/
|
||||
typedef enum OMX_OTHER_FORMATTYPE {
|
||||
OMX_OTHER_FormatTime = 0, /**< Transmission of various timestamps, elapsed time,
|
||||
time deltas, etc */
|
||||
OMX_OTHER_FormatPower, /**< Perhaps used for enabling/disabling power
|
||||
management, setting clocks? */
|
||||
OMX_OTHER_FormatStats, /**< Could be things such as frame rate, frames
|
||||
dropped, etc */
|
||||
OMX_OTHER_FormatBinary, /**< Arbitrary binary data */
|
||||
OMX_OTHER_FormatVendorReserved = 1000, /**< Starting value for vendor specific
|
||||
formats */
|
||||
|
||||
OMX_OTHER_FormatKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
|
||||
OMX_OTHER_FormatVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
|
||||
OMX_OTHER_FormatMax = 0x7FFFFFFF
|
||||
} OMX_OTHER_FORMATTYPE;
|
||||
|
||||
/**
|
||||
* Enumeration of seek modes.
|
||||
*/
|
||||
typedef enum OMX_TIME_SEEKMODETYPE {
|
||||
OMX_TIME_SeekModeFast = 0, /**< Prefer seeking to an approximation
|
||||
* of the requested seek position over
|
||||
* the actual seek position if it
|
||||
* results in a faster seek. */
|
||||
OMX_TIME_SeekModeAccurate, /**< Prefer seeking to the actual seek
|
||||
* position over an approximation
|
||||
* of the requested seek position even
|
||||
* if it results in a slower seek. */
|
||||
OMX_TIME_SeekModeKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
|
||||
OMX_TIME_SeekModeVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
|
||||
OMX_TIME_SeekModeMax = 0x7FFFFFFF
|
||||
} OMX_TIME_SEEKMODETYPE;
|
||||
|
||||
/* Structure representing the seekmode of the component */
|
||||
typedef struct OMX_TIME_CONFIG_SEEKMODETYPE {
|
||||
OMX_U32 nSize; /**< size of the structure in bytes */
|
||||
OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
|
||||
OMX_TIME_SEEKMODETYPE eType; /**< The seek mode */
|
||||
} OMX_TIME_CONFIG_SEEKMODETYPE;
|
||||
|
||||
/** Structure representing a time stamp used with the following configs
|
||||
* on the Clock Component (CC):
|
||||
*
|
||||
* OMX_IndexConfigTimeCurrentWallTime: query of the CC’s current wall
|
||||
* time
|
||||
* OMX_IndexConfigTimeCurrentMediaTime: query of the CC’s current media
|
||||
* time
|
||||
* OMX_IndexConfigTimeCurrentAudioReference and
|
||||
* OMX_IndexConfigTimeCurrentVideoReference: audio/video reference
|
||||
* clock sending SC its reference time
|
||||
* OMX_IndexConfigTimeClientStartTime: a Clock Component client sends
|
||||
* this structure to the Clock Component via a SetConfig on its
|
||||
* client port when it receives a buffer with
|
||||
* OMX_BUFFERFLAG_STARTTIME set. It must use the timestamp
|
||||
* specified by that buffer for nStartTimestamp.
|
||||
*
|
||||
* It’s also used with the following config on components in general:
|
||||
*
|
||||
* OMX_IndexConfigTimePosition: IL client querying component position
|
||||
* (GetConfig) or commanding a component to seek to the given location
|
||||
* (SetConfig)
|
||||
*/
|
||||
typedef struct OMX_TIME_CONFIG_TIMESTAMPTYPE {
|
||||
OMX_U32 nSize; /**< size of the structure in bytes */
|
||||
OMX_VERSIONTYPE nVersion; /**< OMX specification version
|
||||
* information */
|
||||
OMX_U32 nPortIndex; /**< port that this structure applies to */
|
||||
OMX_TICKS nTimestamp; /**< timestamp .*/
|
||||
} OMX_TIME_CONFIG_TIMESTAMPTYPE;
|
||||
|
||||
/** Enumeration of possible reference clocks to the media time. */
|
||||
typedef enum OMX_TIME_UPDATETYPE {
|
||||
OMX_TIME_UpdateRequestFulfillment, /**< Update is the fulfillment of a media time request. */
|
||||
OMX_TIME_UpdateScaleChanged, /**< Update was generated because the scale chagned. */
|
||||
OMX_TIME_UpdateClockStateChanged, /**< Update was generated because the clock state changed. */
|
||||
OMX_TIME_UpdateKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
|
||||
OMX_TIME_UpdateVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
|
||||
OMX_TIME_UpdateMax = 0x7FFFFFFF
|
||||
} OMX_TIME_UPDATETYPE;
|
||||
|
||||
/** Enumeration of possible reference clocks to the media time. */
|
||||
typedef enum OMX_TIME_REFCLOCKTYPE {
|
||||
OMX_TIME_RefClockNone, /**< Use no references. */
|
||||
OMX_TIME_RefClockAudio, /**< Use references sent through OMX_IndexConfigTimeCurrentAudioReference */
|
||||
OMX_TIME_RefClockVideo, /**< Use references sent through OMX_IndexConfigTimeCurrentVideoReference */
|
||||
OMX_TIME_RefClockKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
|
||||
OMX_TIME_RefClockVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
|
||||
OMX_TIME_RefClockMax = 0x7FFFFFFF
|
||||
} OMX_TIME_REFCLOCKTYPE;
|
||||
|
||||
/** Enumeration of clock states. */
|
||||
typedef enum OMX_TIME_CLOCKSTATE {
|
||||
OMX_TIME_ClockStateRunning, /**< Clock running. */
|
||||
OMX_TIME_ClockStateWaitingForStartTime, /**< Clock waiting until the
|
||||
* prescribed clients emit their
|
||||
* start time. */
|
||||
OMX_TIME_ClockStateStopped, /**< Clock stopped. */
|
||||
OMX_TIME_ClockStateKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
|
||||
OMX_TIME_ClockStateVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
|
||||
OMX_TIME_ClockStateMax = 0x7FFFFFFF
|
||||
} OMX_TIME_CLOCKSTATE;
|
||||
|
||||
/** Structure representing a media time request to the clock component.
|
||||
*
|
||||
* A client component sends this structure to the Clock Component via a SetConfig
|
||||
* on its client port to specify a media timestamp the Clock Component
|
||||
* should emit. The Clock Component should fulfill the request by sending a
|
||||
* OMX_TIME_MEDIATIMETYPE when its media clock matches the requested
|
||||
* timestamp.
|
||||
*
|
||||
* The client may require a media time request be fulfilled slightly
|
||||
* earlier than the media time specified. In this case the client specifies
|
||||
* an offset which is equal to the difference between wall time corresponding
|
||||
* to the requested media time and the wall time when it will be
|
||||
* fulfilled.
|
||||
*
|
||||
* A client component may uses these requests and the OMX_TIME_MEDIATIMETYPE to
|
||||
* time events according to timestamps. If a client must perform an operation O at
|
||||
* a time T (e.g. deliver a video frame at its corresponding timestamp), it makes a
|
||||
* media time request at T (perhaps specifying an offset to ensure the request fulfillment
|
||||
* is a little early). When the clock component passes the resulting OMX_TIME_MEDIATIMETYPE
|
||||
* structure back to the client component, the client may perform operation O (perhaps having
|
||||
* to wait a slight amount more time itself as specified by the return values).
|
||||
*/
|
||||
|
||||
typedef struct OMX_TIME_CONFIG_MEDIATIMEREQUESTTYPE {
|
||||
OMX_U32 nSize; /**< size of the structure in bytes */
|
||||
OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
|
||||
OMX_U32 nPortIndex; /**< port that this structure applies to */
|
||||
OMX_PTR pClientPrivate; /**< Client private data to disabiguate this media time
|
||||
* from others (e.g. the number of the frame to deliver).
|
||||
* Duplicated in the media time structure that fulfills
|
||||
* this request. A value of zero is reserved for time scale
|
||||
* updates. */
|
||||
OMX_TICKS nMediaTimestamp; /**< Media timestamp requested.*/
|
||||
OMX_TICKS nOffset; /**< Amount of wall clock time by which this
|
||||
* request should be fulfilled early */
|
||||
} OMX_TIME_CONFIG_MEDIATIMEREQUESTTYPE;
|
||||
|
||||
/**< Structure sent from the clock component client either when fulfilling
|
||||
* a media time request or when the time scale has changed.
|
||||
*
|
||||
* In the former case the Clock Component fills this structure and times its emission
|
||||
* to a client component (via the client port) according to the corresponding media
|
||||
* time request sent by the client. The Clock Component should time the emission to occur
|
||||
* when the requested timestamp matches the Clock Component's media time but also the
|
||||
* prescribed offset early.
|
||||
*
|
||||
* Upon scale changes the clock component clears the nClientPrivate data, sends the current
|
||||
* media time and sets the nScale to the new scale via the client port. It emits a
|
||||
* OMX_TIME_MEDIATIMETYPE to all clients independent of any requests. This allows clients to
|
||||
* alter processing to accomodate scaling. For instance a video component might skip inter-frames
|
||||
* in the case of extreme fastforward. Likewise an audio component might add or remove samples
|
||||
* from an audio frame to scale audio data.
|
||||
*
|
||||
* It is expected that some clock components may not be able to fulfill requests
|
||||
* at exactly the prescribed time. This is acceptable so long as the request is
|
||||
* fulfilled at least as early as described and not later. This structure provides
|
||||
* fields the client may use to wait for the remaining time.
|
||||
*
|
||||
* The client may use either the nOffset or nWallTimeAtMedia fields to determine the
|
||||
* wall time until the nMediaTimestamp actually occurs. In the latter case the
|
||||
* client can get a more accurate value for offset by getting the current wall
|
||||
* from the cloc component and subtracting it from nWallTimeAtMedia.
|
||||
*/
|
||||
|
||||
typedef struct OMX_TIME_MEDIATIMETYPE {
|
||||
OMX_U32 nSize; /**< size of the structure in bytes */
|
||||
OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
|
||||
OMX_U32 nClientPrivate; /**< Client private data to disabiguate this media time
|
||||
* from others. Copied from the media time request.
|
||||
* A value of zero is reserved for time scale updates. */
|
||||
OMX_TIME_UPDATETYPE eUpdateType; /**< Reason for the update */
|
||||
OMX_TICKS nMediaTimestamp; /**< Media time requested. If no media time was
|
||||
* requested then this is the current media time. */
|
||||
OMX_TICKS nOffset; /**< Amount of wall clock time by which this
|
||||
* request was actually fulfilled early */
|
||||
|
||||
OMX_TICKS nWallTimeAtMediaTime; /**< Wall time corresponding to nMediaTimeStamp.
|
||||
* A client may compare this value to current
|
||||
* media time obtained from the Clock Component to determine
|
||||
* the wall time until the media timestamp is really
|
||||
* current. */
|
||||
OMX_S32 xScale; /**< Current media time scale in Q16 format. */
|
||||
OMX_TIME_CLOCKSTATE eState; /* Seeking Change. Added 7/12.*/
|
||||
/**< State of the media time. */
|
||||
} OMX_TIME_MEDIATIMETYPE;
|
||||
|
||||
/** Structure representing the current media time scale factor. Applicable only to clock
|
||||
* component, other components see scale changes via OMX_TIME_MEDIATIMETYPE buffers sent via
|
||||
* the clock component client ports. Upon recieving this config the clock component changes
|
||||
* the rate by which the media time increases or decreases effectively implementing trick modes.
|
||||
*/
|
||||
typedef struct OMX_TIME_CONFIG_SCALETYPE {
|
||||
OMX_U32 nSize; /**< size of the structure in bytes */
|
||||
OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
|
||||
OMX_S32 xScale; /**< This is a value in Q16 format which is used for
|
||||
* scaling the media time */
|
||||
} OMX_TIME_CONFIG_SCALETYPE;
|
||||
|
||||
/** Bits used to identify a clock port. Used in OMX_TIME_CONFIG_CLOCKSTATETYPE’s nWaitMask field */
|
||||
#define OMX_CLOCKPORT0 0x00000001
|
||||
#define OMX_CLOCKPORT1 0x00000002
|
||||
#define OMX_CLOCKPORT2 0x00000004
|
||||
#define OMX_CLOCKPORT3 0x00000008
|
||||
#define OMX_CLOCKPORT4 0x00000010
|
||||
#define OMX_CLOCKPORT5 0x00000020
|
||||
#define OMX_CLOCKPORT6 0x00000040
|
||||
#define OMX_CLOCKPORT7 0x00000080
|
||||
|
||||
/** Structure representing the current mode of the media clock.
|
||||
* IL Client uses this config to change or query the mode of the
|
||||
* media clock of the clock component. Applicable only to clock
|
||||
* component.
|
||||
*
|
||||
* On a SetConfig if eState is OMX_TIME_ClockStateRunning media time
|
||||
* starts immediately at the prescribed start time. If
|
||||
* OMX_TIME_ClockStateWaitingForStartTime the Clock Component ignores
|
||||
* the given nStartTime and waits for all clients specified in the
|
||||
* nWaitMask to send starttimes (via
|
||||
* OMX_IndexConfigTimeClientStartTime). The Clock Component then starts
|
||||
* the media clock using the earliest start time supplied. */
|
||||
typedef struct OMX_TIME_CONFIG_CLOCKSTATETYPE {
|
||||
OMX_U32 nSize; /**< size of the structure in bytes */
|
||||
OMX_VERSIONTYPE nVersion; /**< OMX specification version
|
||||
* information */
|
||||
OMX_TIME_CLOCKSTATE eState; /**< State of the media time. */
|
||||
OMX_TICKS nStartTime; /**< Start time of the media time. */
|
||||
OMX_TICKS nOffset; /**< Time to offset the media time by
|
||||
* (e.g. preroll). Media time will be
|
||||
* reported to be nOffset ticks earlier.
|
||||
*/
|
||||
OMX_U32 nWaitMask; /**< Mask of OMX_CLOCKPORT values. */
|
||||
} OMX_TIME_CONFIG_CLOCKSTATETYPE;
|
||||
|
||||
/** Structure representing the reference clock currently being used to
|
||||
* compute media time. IL client uses this config to change or query the
|
||||
* clock component's active reference clock */
|
||||
typedef struct OMX_TIME_CONFIG_ACTIVEREFCLOCKTYPE {
|
||||
OMX_U32 nSize; /**< size of the structure in bytes */
|
||||
OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
|
||||
OMX_TIME_REFCLOCKTYPE eClock; /**< Reference clock used to compute media time */
|
||||
} OMX_TIME_CONFIG_ACTIVEREFCLOCKTYPE;
|
||||
|
||||
/** Descriptor for setting specifics of power type.
|
||||
* Note: this structure is listed for backwards compatibility. */
|
||||
typedef struct OMX_OTHER_CONFIG_POWERTYPE {
|
||||
OMX_U32 nSize; /**< size of the structure in bytes */
|
||||
OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
|
||||
OMX_BOOL bEnablePM; /**< Flag to enable Power Management */
|
||||
} OMX_OTHER_CONFIG_POWERTYPE;
|
||||
|
||||
|
||||
/** Descriptor for setting specifics of stats type.
|
||||
* Note: this structure is listed for backwards compatibility. */
|
||||
typedef struct OMX_OTHER_CONFIG_STATSTYPE {
|
||||
OMX_U32 nSize; /**< size of the structure in bytes */
|
||||
OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
|
||||
/* what goes here */
|
||||
} OMX_OTHER_CONFIG_STATSTYPE;
|
||||
|
||||
|
||||
/**
|
||||
* The PortDefinition structure is used to define all of the parameters
|
||||
* necessary for the compliant component to setup an input or an output other
|
||||
* path.
|
||||
*/
|
||||
typedef struct OMX_OTHER_PORTDEFINITIONTYPE {
|
||||
OMX_OTHER_FORMATTYPE eFormat; /**< Type of data expected for this channel */
|
||||
} OMX_OTHER_PORTDEFINITIONTYPE;
|
||||
|
||||
/** Port format parameter. This structure is used to enumerate
|
||||
* the various data input/output format supported by the port.
|
||||
*/
|
||||
typedef struct OMX_OTHER_PARAM_PORTFORMATTYPE {
|
||||
OMX_U32 nSize; /**< size of the structure in bytes */
|
||||
OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
|
||||
OMX_U32 nPortIndex; /**< Indicates which port to set */
|
||||
OMX_U32 nIndex; /**< Indicates the enumeration index for the format from 0x0 to N-1 */
|
||||
OMX_OTHER_FORMATTYPE eFormat; /**< Type of data expected for this channel */
|
||||
} OMX_OTHER_PARAM_PORTFORMATTYPE;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif
|
||||
/* File EOF */
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,155 +0,0 @@
|
||||
/*@@@+++@@@@******************************************************************
|
||||
|
||||
Microsoft Skype Engineering
|
||||
Copyright (C) 2014 Microsoft Corporation.
|
||||
|
||||
MIT License
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
|
||||
*@@@---@@@@******************************************************************/
|
||||
|
||||
|
||||
#ifndef __OMX_SKYPE_VIDEOEXTENSIONS_H__
|
||||
#define __OMX_SKYPE_VIDEOEXTENSIONS_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
#include <OMX_Core.h>
|
||||
|
||||
#pragma pack(push, 1)
|
||||
|
||||
|
||||
typedef enum OMX_SKYPE_VIDEO_SliceControlMode
|
||||
{
|
||||
OMX_SKYPE_VIDEO_SliceControlModeNone = 0,
|
||||
OMX_SKYPE_VIDEO_SliceControlModeMB = 1,
|
||||
OMX_SKYPE_VIDEO_SliceControlModeByte = 2,
|
||||
OMX_SKYPE_VIDEO_SliceControlModMBRow = 3,
|
||||
} OMX_SKYPE_VIDEO_SliceControlMode;
|
||||
|
||||
|
||||
typedef enum OMX_SKYPE_VIDEO_HierarType
|
||||
{
|
||||
OMX_SKYPE_VIDEO_HierarType_P = 0x01,
|
||||
OMX_SKYPE_VIDEO_HierarType_B = 0x02,
|
||||
} OMX_SKYPE_VIDEO_HIERAR_HierarType;
|
||||
|
||||
typedef enum OMX_VIDEO_EXTENSION_AVCPROFILETYPE
|
||||
{
|
||||
OMX_VIDEO_EXT_AVCProfileConstrainedBaseline = 0x01,
|
||||
OMX_VIDEO_EXT_AVCProfileConstrainedHigh = 0x02,
|
||||
} OMX_VIDEO_EXTENSION_AVCPROFILETYPE;
|
||||
|
||||
typedef struct OMX_SKYPE_VIDEO_ENCODERPARAMS {
|
||||
OMX_BOOL bLowLatency;
|
||||
OMX_BOOL bUseExtendedProfile;
|
||||
OMX_BOOL bSequenceHeaderWithIDR;
|
||||
OMX_VIDEO_EXTENSION_AVCPROFILETYPE eProfile;
|
||||
OMX_U32 nLTRFrames;
|
||||
OMX_SKYPE_VIDEO_HierarType eHierarType;
|
||||
OMX_U32 nMaxTemporalLayerCount;
|
||||
OMX_SKYPE_VIDEO_SliceControlMode eSliceControlMode;
|
||||
OMX_U32 nSarIndex;
|
||||
OMX_U32 nSarWidth;
|
||||
OMX_U32 nSarHeight;
|
||||
} OMX_SKYPE_VIDEO_ENCODERPARAMS;
|
||||
|
||||
typedef struct OMX_SKYPE_VIDEO_PARAM_ENCODERSETTING {
|
||||
OMX_U32 nSize;
|
||||
OMX_VERSIONTYPE nVersion;
|
||||
OMX_U32 nPortIndex;
|
||||
OMX_SKYPE_VIDEO_ENCODERPARAMS stEncParam;
|
||||
} OMX_SKYPE_VIDEO_PARAM_ENCODESETTING;
|
||||
|
||||
typedef struct OMX_SKYPE_VIDEO_ENCODERCAP {
|
||||
OMX_BOOL bLowLatency;
|
||||
OMX_U32 nMaxFrameWidth;
|
||||
OMX_U32 nMaxFrameHeight;
|
||||
OMX_U32 nMaxInstances;
|
||||
OMX_U32 nMaxTemporaLayerCount;
|
||||
OMX_U32 nMaxRefFrames;
|
||||
OMX_U32 nMaxLTRFrames;
|
||||
OMX_VIDEO_AVCLEVELTYPE nMaxLevel;
|
||||
OMX_U32 nSliceControlModesBM;
|
||||
OMX_U32 nMaxMacroblockProcessingRate;
|
||||
OMX_U32 xMinScaleFactor;
|
||||
} OMX_SKYPE_VIDEO_ENCODERCAP;
|
||||
|
||||
typedef struct OMX_SKYPE_VIDEO_PARAM_ENCODERCAP {
|
||||
OMX_U32 nSize;
|
||||
OMX_VERSIONTYPE nVersion;
|
||||
OMX_U32 nPortIndex;
|
||||
OMX_SKYPE_VIDEO_ENCODERCAP stEncCap;
|
||||
} OMX_SKYPE_VIDEO_PARAM_ENCODERCAP;
|
||||
|
||||
typedef struct OMX_SKYPE_VIDEO_DECODERCAP {
|
||||
OMX_BOOL bLowLatency;
|
||||
OMX_U32 nMaxFrameWidth;
|
||||
OMX_U32 nMaxFrameHeight;
|
||||
OMX_U32 nMaxInstances;
|
||||
OMX_VIDEO_AVCLEVELTYPE nMaxLevel;
|
||||
OMX_U32 nMaxMacroblockProcessingRate;
|
||||
} OMX_SKYPE_VIDEO_DECODERCAP;
|
||||
|
||||
typedef struct OMX_SKYPE_VIDEO_PARAM_DECODERCAP {
|
||||
OMX_U32 nSize;
|
||||
OMX_VERSIONTYPE nVersion;
|
||||
OMX_U32 nPortIndex;
|
||||
OMX_SKYPE_VIDEO_DECODERCAP stDecoderCap;
|
||||
} OMX_SKYPE_VIDEO_PARAM_DECODERCAP;
|
||||
|
||||
typedef struct OMX_SKYPE_VIDEO_CONFIG_QP {
|
||||
OMX_U32 nSize;
|
||||
OMX_VERSIONTYPE nVersion;
|
||||
OMX_U32 nPortIndex;
|
||||
OMX_U32 nQP;
|
||||
} OMX_SKYPE_VIDEO_CONFIG_QP;
|
||||
|
||||
typedef struct OMX_SKYPE_VIDEO_CONFIG_BASELAYERPID{
|
||||
OMX_U32 nSize;
|
||||
OMX_VERSIONTYPE nVersion;
|
||||
OMX_U32 nPortIndex;
|
||||
OMX_U32 nPID;
|
||||
} OMX_SKYPE_VIDEO_CONFIG_BASELAYERPID;
|
||||
|
||||
typedef struct OMX_SKYPE_VIDEO_PARAM_DRIVERVER {
|
||||
OMX_U32 nSize;
|
||||
OMX_VERSIONTYPE nVersion;
|
||||
OMX_U32 nPortIndex;
|
||||
OMX_U64 nDriverVersion;
|
||||
} OMX_SKYPE_VIDEO_PARAM_DRIVERVER;
|
||||
|
||||
typedef enum OMX_SKYPE_VIDEO_DownScaleFactor
|
||||
{
|
||||
OMX_SKYPE_VIDEO_DownScaleFactor_1_1 = 0,
|
||||
OMX_SKYPE_VIDEO_DownScaleFactor_Equal_AR = 1,
|
||||
OMX_SKYPE_VIDEO_DownScaleFactor_Any = 2,
|
||||
} OMX_SKYPE_VIDEO_DownScaleFactor;
|
||||
|
||||
#pragma pack(pop)
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -1,359 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2008 The Khronos Group Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject
|
||||
* to the following conditions:
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
/** OMX_Types.h - OpenMax IL version 1.1.2
|
||||
* The OMX_Types header file contains the primitive type definitions used by
|
||||
* the core, the application and the component. This file may need to be
|
||||
* modified to be used on systems that do not have "char" set to 8 bits,
|
||||
* "short" set to 16 bits and "long" set to 32 bits.
|
||||
*/
|
||||
|
||||
#ifndef OMX_Types_h
|
||||
#define OMX_Types_h
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/** The OMX_API and OMX_APIENTRY are platform specific definitions used
|
||||
* to declare OMX function prototypes. They are modified to meet the
|
||||
* requirements for a particular platform */
|
||||
#ifdef __SYMBIAN32__
|
||||
# ifdef __OMX_EXPORTS
|
||||
# define OMX_API __declspec(dllexport)
|
||||
# else
|
||||
# ifdef _WIN32
|
||||
# define OMX_API __declspec(dllexport)
|
||||
# else
|
||||
# define OMX_API __declspec(dllimport)
|
||||
# endif
|
||||
# endif
|
||||
#else
|
||||
# ifdef _WIN32
|
||||
# ifdef __OMX_EXPORTS
|
||||
# define OMX_API __declspec(dllexport)
|
||||
# else
|
||||
# define OMX_API __declspec(dllimport)
|
||||
# endif
|
||||
# else
|
||||
# ifdef __OMX_EXPORTS
|
||||
# define OMX_API
|
||||
# else
|
||||
# define OMX_API extern
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef OMX_APIENTRY
|
||||
#define OMX_APIENTRY
|
||||
#endif
|
||||
|
||||
/** OMX_IN is used to identify inputs to an OMX function. This designation
|
||||
will also be used in the case of a pointer that points to a parameter
|
||||
that is used as an output. */
|
||||
#ifndef OMX_IN
|
||||
#define OMX_IN
|
||||
#endif
|
||||
|
||||
/** OMX_OUT is used to identify outputs from an OMX function. This
|
||||
designation will also be used in the case of a pointer that points
|
||||
to a parameter that is used as an input. */
|
||||
#ifndef OMX_OUT
|
||||
#define OMX_OUT
|
||||
#endif
|
||||
|
||||
|
||||
/** OMX_INOUT is used to identify parameters that may be either inputs or
|
||||
outputs from an OMX function at the same time. This designation will
|
||||
also be used in the case of a pointer that points to a parameter that
|
||||
is used both as an input and an output. */
|
||||
#ifndef OMX_INOUT
|
||||
#define OMX_INOUT
|
||||
#endif
|
||||
|
||||
/** OMX_ALL is used to as a wildcard to select all entities of the same type
|
||||
* when specifying the index, or referring to a object by an index. (i.e.
|
||||
* use OMX_ALL to indicate all N channels). When used as a port index
|
||||
* for a config or parameter this OMX_ALL denotes that the config or
|
||||
* parameter applies to the entire component not just one port. */
|
||||
#define OMX_ALL 0xFFFFFFFF
|
||||
|
||||
/** In the following we define groups that help building doxygen documentation */
|
||||
|
||||
/** @defgroup core OpenMAX IL core
|
||||
* Functions and structure related to the OMX IL core
|
||||
*/
|
||||
|
||||
/** @defgroup comp OpenMAX IL component
|
||||
* Functions and structure related to the OMX IL component
|
||||
*/
|
||||
|
||||
/** @defgroup rpm Resource and Policy Management
|
||||
* Structures for resource and policy management of components
|
||||
*/
|
||||
|
||||
/** @defgroup buf Buffer Management
|
||||
* Buffer handling functions and structures
|
||||
*/
|
||||
|
||||
/** @defgroup tun Tunneling
|
||||
* @ingroup core comp
|
||||
* Structures and functions to manage tunnels among component ports
|
||||
*/
|
||||
|
||||
/** @defgroup cp Content Pipes
|
||||
* @ingroup core
|
||||
*/
|
||||
|
||||
/** @defgroup metadata Metadata handling
|
||||
*
|
||||
*/
|
||||
|
||||
/** OMX_U8 is an 8 bit unsigned quantity that is byte aligned */
|
||||
typedef unsigned char OMX_U8;
|
||||
|
||||
/** OMX_S8 is an 8 bit signed quantity that is byte aligned */
|
||||
typedef signed char OMX_S8;
|
||||
|
||||
/** OMX_U16 is a 16 bit unsigned quantity that is 16 bit word aligned */
|
||||
typedef unsigned short OMX_U16;
|
||||
|
||||
/** OMX_S16 is a 16 bit signed quantity that is 16 bit word aligned */
|
||||
typedef signed short OMX_S16;
|
||||
|
||||
/** OMX_U32 is a 32 bit unsigned quantity that is 32 bit word aligned */
|
||||
typedef unsigned int OMX_U32;
|
||||
|
||||
/** OMX_S32 is a 32 bit signed quantity that is 32 bit word aligned */
|
||||
typedef signed int OMX_S32;
|
||||
|
||||
|
||||
/* Users with compilers that cannot accept the "long long" designation should
|
||||
define the OMX_SKIP64BIT macro. It should be noted that this may cause
|
||||
some components to fail to compile if the component was written to require
|
||||
64 bit integral types. However, these components would NOT compile anyway
|
||||
since the compiler does not support the way the component was written.
|
||||
*/
|
||||
#ifndef OMX_SKIP64BIT
|
||||
#ifdef __SYMBIAN32__
|
||||
/** OMX_U64 is a 64 bit unsigned quantity that is 64 bit word aligned */
|
||||
typedef unsigned long long OMX_U64;
|
||||
|
||||
/** OMX_S64 is a 64 bit signed quantity that is 64 bit word aligned */
|
||||
typedef signed long long OMX_S64;
|
||||
|
||||
#elif defined(WIN32)
|
||||
|
||||
/** OMX_U64 is a 64 bit unsigned quantity that is 64 bit word aligned */
|
||||
typedef unsigned __int64 OMX_U64;
|
||||
|
||||
/** OMX_S64 is a 64 bit signed quantity that is 64 bit word aligned */
|
||||
typedef signed __int64 OMX_S64;
|
||||
|
||||
#else /* WIN32 */
|
||||
|
||||
/** OMX_U64 is a 64 bit unsigned quantity that is 64 bit word aligned */
|
||||
typedef unsigned long long OMX_U64;
|
||||
|
||||
/** OMX_S64 is a 64 bit signed quantity that is 64 bit word aligned */
|
||||
typedef signed long long OMX_S64;
|
||||
|
||||
#endif /* WIN32 */
|
||||
#endif
|
||||
|
||||
|
||||
/** The OMX_BOOL type is intended to be used to represent a true or a false
|
||||
value when passing parameters to and from the OMX core and components. The
|
||||
OMX_BOOL is a 32 bit quantity and is aligned on a 32 bit word boundary.
|
||||
*/
|
||||
typedef enum OMX_BOOL {
|
||||
OMX_FALSE = 0,
|
||||
OMX_TRUE = !OMX_FALSE,
|
||||
OMX_BOOL_MAX = 0x7FFFFFFF
|
||||
} OMX_BOOL;
|
||||
|
||||
#ifdef OMX_ANDROID_COMPILE_AS_32BIT_ON_64BIT_PLATFORMS
|
||||
|
||||
typedef OMX_U32 OMX_PTR;
|
||||
typedef OMX_PTR OMX_STRING;
|
||||
typedef OMX_PTR OMX_BYTE;
|
||||
|
||||
#else
|
||||
|
||||
/** The OMX_PTR type is intended to be used to pass pointers between the OMX
|
||||
applications and the OMX Core and components. This is a 32 bit pointer and
|
||||
is aligned on a 32 bit boundary.
|
||||
*/
|
||||
typedef void* OMX_PTR;
|
||||
|
||||
/** The OMX_STRING type is intended to be used to pass "C" type strings between
|
||||
the application and the core and component. The OMX_STRING type is a 32
|
||||
bit pointer to a zero terminated string. The pointer is word aligned and
|
||||
the string is byte aligned.
|
||||
*/
|
||||
typedef char* OMX_STRING;
|
||||
|
||||
/** The OMX_BYTE type is intended to be used to pass arrays of bytes such as
|
||||
buffers between the application and the component and core. The OMX_BYTE
|
||||
type is a 32 bit pointer to a zero terminated string. The pointer is word
|
||||
aligned and the string is byte aligned.
|
||||
*/
|
||||
typedef unsigned char* OMX_BYTE;
|
||||
|
||||
/** OMX_UUIDTYPE is a very long unique identifier to uniquely identify
|
||||
at runtime. This identifier should be generated by a component in a way
|
||||
that guarantees that every instance of the identifier running on the system
|
||||
is unique. */
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
typedef unsigned char OMX_UUIDTYPE[128];
|
||||
|
||||
/** The OMX_DIRTYPE enumeration is used to indicate if a port is an input or
|
||||
an output port. This enumeration is common across all component types.
|
||||
*/
|
||||
typedef enum OMX_DIRTYPE
|
||||
{
|
||||
OMX_DirInput, /**< Port is an input port */
|
||||
OMX_DirOutput, /**< Port is an output port */
|
||||
OMX_DirMax = 0x7FFFFFFF
|
||||
} OMX_DIRTYPE;
|
||||
|
||||
/** The OMX_ENDIANTYPE enumeration is used to indicate the bit ordering
|
||||
for numerical data (i.e. big endian, or little endian).
|
||||
*/
|
||||
typedef enum OMX_ENDIANTYPE
|
||||
{
|
||||
OMX_EndianBig, /**< big endian */
|
||||
OMX_EndianLittle, /**< little endian */
|
||||
OMX_EndianMax = 0x7FFFFFFF
|
||||
} OMX_ENDIANTYPE;
|
||||
|
||||
|
||||
/** The OMX_NUMERICALDATATYPE enumeration is used to indicate if data
|
||||
is signed or unsigned
|
||||
*/
|
||||
typedef enum OMX_NUMERICALDATATYPE
|
||||
{
|
||||
OMX_NumericalDataSigned, /**< signed data */
|
||||
OMX_NumericalDataUnsigned, /**< unsigned data */
|
||||
OMX_NumercialDataMax = 0x7FFFFFFF
|
||||
} OMX_NUMERICALDATATYPE;
|
||||
|
||||
|
||||
/** Unsigned bounded value type */
|
||||
typedef struct OMX_BU32 {
|
||||
OMX_U32 nValue; /**< actual value */
|
||||
OMX_U32 nMin; /**< minimum for value (i.e. nValue >= nMin) */
|
||||
OMX_U32 nMax; /**< maximum for value (i.e. nValue <= nMax) */
|
||||
} OMX_BU32;
|
||||
|
||||
|
||||
/** Signed bounded value type */
|
||||
typedef struct OMX_BS32 {
|
||||
OMX_S32 nValue; /**< actual value */
|
||||
OMX_S32 nMin; /**< minimum for value (i.e. nValue >= nMin) */
|
||||
OMX_S32 nMax; /**< maximum for value (i.e. nValue <= nMax) */
|
||||
} OMX_BS32;
|
||||
|
||||
|
||||
/** Structure representing some time or duration in microseconds. This structure
|
||||
* must be interpreted as a signed 64 bit value. The quantity is signed to accommodate
|
||||
* negative deltas and preroll scenarios. The quantity is represented in microseconds
|
||||
* to accomodate high resolution timestamps (e.g. DVD presentation timestamps based
|
||||
* on a 90kHz clock) and to allow more accurate and synchronized delivery (e.g.
|
||||
* individual audio samples delivered at 192 kHz). The quantity is 64 bit to
|
||||
* accommodate a large dynamic range (signed 32 bit values would allow only for plus
|
||||
* or minus 35 minutes).
|
||||
*
|
||||
* Implementations with limited precision may convert the signed 64 bit value to
|
||||
* a signed 32 bit value internally but risk loss of precision.
|
||||
*/
|
||||
#ifndef OMX_SKIP64BIT
|
||||
typedef OMX_S64 OMX_TICKS;
|
||||
#else
|
||||
typedef struct OMX_TICKS
|
||||
{
|
||||
OMX_U32 nLowPart; /** low bits of the signed 64 bit tick value */
|
||||
OMX_U32 nHighPart; /** high bits of the signed 64 bit tick value */
|
||||
} OMX_TICKS;
|
||||
#endif
|
||||
#define OMX_TICKS_PER_SECOND 1000000
|
||||
|
||||
/** Define the public interface for the OMX Handle. The core will not use
|
||||
this value internally, but the application should only use this value.
|
||||
*/
|
||||
typedef void* OMX_HANDLETYPE;
|
||||
|
||||
typedef struct OMX_MARKTYPE
|
||||
{
|
||||
OMX_HANDLETYPE hMarkTargetComponent; /**< The component that will
|
||||
generate a mark event upon
|
||||
processing the mark. */
|
||||
OMX_PTR pMarkData; /**< Application specific data associated with
|
||||
the mark sent on a mark event to disambiguate
|
||||
this mark from others. */
|
||||
} OMX_MARKTYPE;
|
||||
|
||||
|
||||
/** OMX_NATIVE_DEVICETYPE is used to map a OMX video port to the
|
||||
* platform & operating specific object used to reference the display
|
||||
* or can be used by a audio port for native audio rendering */
|
||||
typedef void* OMX_NATIVE_DEVICETYPE;
|
||||
|
||||
/** OMX_NATIVE_WINDOWTYPE is used to map a OMX video port to the
|
||||
* platform & operating specific object used to reference the window */
|
||||
typedef void* OMX_NATIVE_WINDOWTYPE;
|
||||
|
||||
/** The OMX_VERSIONTYPE union is used to specify the version for
|
||||
a structure or component. For a component, the version is entirely
|
||||
specified by the component vendor. Components doing the same function
|
||||
from different vendors may or may not have the same version. For
|
||||
structures, the version shall be set by the entity that allocates the
|
||||
structure. For structures specified in the OMX 1.1 specification, the
|
||||
value of the version shall be set to 1.1.0.0 in all cases. Access to the
|
||||
OMX_VERSIONTYPE can be by a single 32 bit access (e.g. by nVersion) or
|
||||
by accessing one of the structure elements to, for example, check only
|
||||
the Major revision.
|
||||
*/
|
||||
typedef union OMX_VERSIONTYPE
|
||||
{
|
||||
struct
|
||||
{
|
||||
OMX_U8 nVersionMajor; /**< Major version accessor element */
|
||||
OMX_U8 nVersionMinor; /**< Minor version accessor element */
|
||||
OMX_U8 nRevision; /**< Revision version accessor element */
|
||||
OMX_U8 nStep; /**< Step version accessor element */
|
||||
} s;
|
||||
OMX_U32 nVersion; /**< 32 bit value to make accessing the
|
||||
version easily done in a single word
|
||||
size copy/compare operation */
|
||||
} OMX_VERSIONTYPE;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif
|
||||
/* File EOF */
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,166 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2010 The Khronos Group Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject
|
||||
* to the following conditions:
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
/** OMX_VideoExt.h - OpenMax IL version 1.1.2
|
||||
* The OMX_VideoExt header file contains extensions to the
|
||||
* definitions used by both the application and the component to
|
||||
* access video items.
|
||||
*/
|
||||
|
||||
#ifndef OMX_VideoExt_h
|
||||
#define OMX_VideoExt_h
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/* Each OMX header shall include all required header files to allow the
|
||||
* header to compile without errors. The includes below are required
|
||||
* for this header file to compile successfully
|
||||
*/
|
||||
#include <OMX_Core.h>
|
||||
|
||||
/** NALU Formats */
|
||||
typedef enum OMX_NALUFORMATSTYPE {
|
||||
OMX_NaluFormatStartCodes = 1,
|
||||
OMX_NaluFormatOneNaluPerBuffer = 2,
|
||||
OMX_NaluFormatOneByteInterleaveLength = 4,
|
||||
OMX_NaluFormatTwoByteInterleaveLength = 8,
|
||||
OMX_NaluFormatFourByteInterleaveLength = 16,
|
||||
OMX_NaluFormatCodingMax = 0x7FFFFFFF
|
||||
} OMX_NALUFORMATSTYPE;
|
||||
|
||||
/** NAL Stream Format */
|
||||
typedef struct OMX_NALSTREAMFORMATTYPE{
|
||||
OMX_U32 nSize;
|
||||
OMX_VERSIONTYPE nVersion;
|
||||
OMX_U32 nPortIndex;
|
||||
OMX_NALUFORMATSTYPE eNaluFormat;
|
||||
} OMX_NALSTREAMFORMATTYPE;
|
||||
|
||||
/** VP8 profiles */
|
||||
typedef enum OMX_VIDEO_VP8PROFILETYPE {
|
||||
OMX_VIDEO_VP8ProfileMain = 0x01,
|
||||
OMX_VIDEO_VP8ProfileUnknown = 0x6EFFFFFF,
|
||||
OMX_VIDEO_VP8ProfileMax = 0x7FFFFFFF
|
||||
} OMX_VIDEO_VP8PROFILETYPE;
|
||||
|
||||
/** VP8 levels */
|
||||
typedef enum OMX_VIDEO_VP8LEVELTYPE {
|
||||
OMX_VIDEO_VP8Level_Version0 = 0x01,
|
||||
OMX_VIDEO_VP8Level_Version1 = 0x02,
|
||||
OMX_VIDEO_VP8Level_Version2 = 0x04,
|
||||
OMX_VIDEO_VP8Level_Version3 = 0x08,
|
||||
OMX_VIDEO_VP8LevelUnknown = 0x6EFFFFFF,
|
||||
OMX_VIDEO_VP8LevelMax = 0x7FFFFFFF
|
||||
} OMX_VIDEO_VP8LEVELTYPE;
|
||||
|
||||
/** VP8 Param */
|
||||
typedef struct OMX_VIDEO_PARAM_VP8TYPE {
|
||||
OMX_U32 nSize;
|
||||
OMX_VERSIONTYPE nVersion;
|
||||
OMX_U32 nPortIndex;
|
||||
OMX_VIDEO_VP8PROFILETYPE eProfile;
|
||||
OMX_VIDEO_VP8LEVELTYPE eLevel;
|
||||
OMX_U32 nDCTPartitions;
|
||||
OMX_BOOL bErrorResilientMode;
|
||||
} OMX_VIDEO_PARAM_VP8TYPE;
|
||||
|
||||
/** Structure for configuring VP8 reference frames */
|
||||
typedef struct OMX_VIDEO_VP8REFERENCEFRAMETYPE {
|
||||
OMX_U32 nSize;
|
||||
OMX_VERSIONTYPE nVersion;
|
||||
OMX_U32 nPortIndex;
|
||||
OMX_BOOL bPreviousFrameRefresh;
|
||||
OMX_BOOL bGoldenFrameRefresh;
|
||||
OMX_BOOL bAlternateFrameRefresh;
|
||||
OMX_BOOL bUsePreviousFrame;
|
||||
OMX_BOOL bUseGoldenFrame;
|
||||
OMX_BOOL bUseAlternateFrame;
|
||||
} OMX_VIDEO_VP8REFERENCEFRAMETYPE;
|
||||
|
||||
/** Structure for querying VP8 reference frame type */
|
||||
typedef struct OMX_VIDEO_VP8REFERENCEFRAMEINFOTYPE {
|
||||
OMX_U32 nSize;
|
||||
OMX_VERSIONTYPE nVersion;
|
||||
OMX_U32 nPortIndex;
|
||||
OMX_BOOL bIsIntraFrame;
|
||||
OMX_BOOL bIsGoldenOrAlternateFrame;
|
||||
} OMX_VIDEO_VP8REFERENCEFRAMEINFOTYPE;
|
||||
|
||||
/** HEVC Profiles */
|
||||
typedef enum OMX_VIDEO_HEVCPROFILETYPE {
|
||||
OMX_VIDEO_HEVCProfileMain = 0x01,
|
||||
OMX_VIDEO_HEVCProfileMain10 = 0x02,
|
||||
OMX_VIDEO_HEVCProfileUnknown = 0x6EFFFFFF,
|
||||
OMX_VIDEO_HEVCProfileMax = 0x7FFFFFFF
|
||||
} OMX_VIDEO_HEVCPROFILETYPE;
|
||||
|
||||
/** HEVC levels */
|
||||
typedef enum OMX_VIDEO_HEVCLEVELTYPE {
|
||||
OMX_VIDEO_HEVCLevel_Version0 = 0x0,
|
||||
OMX_VIDEO_HEVCMainTierLevel1 = 0x1,
|
||||
OMX_VIDEO_HEVCHighTierLevel1 = 0x2,
|
||||
OMX_VIDEO_HEVCMainTierLevel2 = 0x4,
|
||||
OMX_VIDEO_HEVCHighTierLevel2 = 0x8,
|
||||
OMX_VIDEO_HEVCMainTierLevel21 = 0x10,
|
||||
OMX_VIDEO_HEVCHighTierLevel21 = 0x20,
|
||||
OMX_VIDEO_HEVCMainTierLevel3 = 0x40,
|
||||
OMX_VIDEO_HEVCHighTierLevel3 = 0x80,
|
||||
OMX_VIDEO_HEVCMainTierLevel31 = 0x100,
|
||||
OMX_VIDEO_HEVCHighTierLevel31 = 0x200,
|
||||
OMX_VIDEO_HEVCMainTierLevel4 = 0x400,
|
||||
OMX_VIDEO_HEVCHighTierLevel4 = 0x800,
|
||||
OMX_VIDEO_HEVCMainTierLevel41 = 0x1000,
|
||||
OMX_VIDEO_HEVCHighTierLevel41 = 0x2000,
|
||||
OMX_VIDEO_HEVCMainTierLevel5 = 0x4000,
|
||||
OMX_VIDEO_HEVCHighTierLevel5 = 0x8000,
|
||||
OMX_VIDEO_HEVCMainTierLevel51 = 0x10000,
|
||||
OMX_VIDEO_HEVCHighTierLevel51 = 0x20000,
|
||||
OMX_VIDEO_HEVCMainTierLevel52 = 0x40000,
|
||||
OMX_VIDEO_HEVCHighTierLevel52 = 0x80000,
|
||||
OMX_VIDEO_HEVCMainTierLevel6 = 0x100000,
|
||||
OMX_VIDEO_HEVCHighTierLevel6 = 0x200000,
|
||||
OMX_VIDEO_HEVCMainTierLevel61 = 0x400000,
|
||||
OMX_VIDEO_HEVCHighTierLevel61 = 0x800000,
|
||||
OMX_VIDEO_HEVCMainTierLevel62 = 0x1000000,
|
||||
OMX_VIDEO_HEVCLevelUnknown = 0x6EFFFFFF,
|
||||
OMX_VIDEO_HEVCLevelMax = 0x7FFFFFFF
|
||||
} OMX_VIDEO_HEVCLEVELTYPE;
|
||||
|
||||
/** HEVC Param */
|
||||
typedef struct OMX_VIDEO_PARAM_HEVCTYPE {
|
||||
OMX_U32 nSize;
|
||||
OMX_VERSIONTYPE nVersion;
|
||||
OMX_U32 nPortIndex;
|
||||
OMX_VIDEO_HEVCPROFILETYPE eProfile;
|
||||
OMX_VIDEO_HEVCLEVELTYPE eLevel;
|
||||
} OMX_VIDEO_PARAM_HEVCTYPE;
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* OMX_VideoExt_h */
|
||||
/* File EOF */
|
||||
@@ -1,155 +0,0 @@
|
||||
#include "libyuv.h"
|
||||
|
||||
#include "selfdrive/frogpilot/screenrecorder/screenrecorder.h"
|
||||
#include "selfdrive/ui/qt/util.h"
|
||||
|
||||
static long long milliseconds() {
|
||||
struct timespec t;
|
||||
clock_gettime(CLOCK_REALTIME, &t);
|
||||
return static_cast<long long>(t.tv_sec * 1000.0 + t.tv_nsec * 1e-6);
|
||||
}
|
||||
|
||||
ScreenRecorder::ScreenRecorder(QWidget *parent) : QPushButton(parent), image_queue(30), recording(false), started(0), frame(0) {
|
||||
setFixedSize(192 / 2 + 25, 192 / 2);
|
||||
setFocusPolicy(Qt::NoFocus);
|
||||
|
||||
screen_height = 1080;
|
||||
screen_width = 2160;
|
||||
recording_height = 720;
|
||||
recording_width = (screen_width * recording_height) / screen_height + (recording_width % 2);
|
||||
|
||||
rgb_scale_buffer = std::make_unique<uint8_t[]>(recording_width * recording_height * 4);
|
||||
|
||||
connect(this, &QPushButton::released, this, &ScreenRecorder::toggle);
|
||||
|
||||
initializeEncoder();
|
||||
}
|
||||
|
||||
void ScreenRecorder::initializeEncoder() {
|
||||
const std::string path = "/data/media/0/videos";
|
||||
encoder = std::make_unique<OmxEncoder>(path.c_str(), recording_width, recording_height, 60, 2 * 1024 * 1024, false, false);
|
||||
}
|
||||
|
||||
ScreenRecorder::~ScreenRecorder() {
|
||||
stop();
|
||||
}
|
||||
|
||||
void ScreenRecorder::applyColor() {
|
||||
if (frame % (UI_FREQ / 2) == 0) {
|
||||
recording_color = (frame % UI_FREQ < (UI_FREQ / 2)) ? QColor::fromRgbF(1, 1, 1, 1) : QColor::fromRgbF(0, 0, 0, 1);
|
||||
update();
|
||||
}
|
||||
}
|
||||
|
||||
void ScreenRecorder::paintEvent(QPaintEvent *event) {
|
||||
QPainter p(this);
|
||||
p.setRenderHint(QPainter::Antialiasing);
|
||||
|
||||
QRect fullRect(0, 0, 192 / 2, 192 / 2);
|
||||
QColor outerColor = recording ? recording_color : QColor::fromRgbF(1, 1, 1, 1);
|
||||
int outerRedWidth = fullRect.width() * 0.05;
|
||||
|
||||
QRect outerRect = fullRect;
|
||||
p.setBrush(outerColor);
|
||||
p.setPen(Qt::NoPen);
|
||||
p.drawEllipse(outerRect);
|
||||
|
||||
QRect middleRect = fullRect.marginsRemoved(QMargins(outerRedWidth, outerRedWidth, outerRedWidth, outerRedWidth));
|
||||
p.setBrush(QColor::fromRgbF(1, 0, 0, 1));
|
||||
p.drawEllipse(middleRect);
|
||||
}
|
||||
|
||||
void ScreenRecorder::openEncoder(const char *filename) {
|
||||
encoder->encoder_open(filename);
|
||||
}
|
||||
|
||||
void ScreenRecorder::closeEncoder() {
|
||||
if (encoder) {
|
||||
encoder->encoder_close();
|
||||
}
|
||||
}
|
||||
|
||||
void ScreenRecorder::toggle() {
|
||||
if (!recording) {
|
||||
start();
|
||||
} else {
|
||||
stop();
|
||||
}
|
||||
}
|
||||
|
||||
void ScreenRecorder::start() {
|
||||
if (recording) return;
|
||||
|
||||
char filename[64];
|
||||
const time_t t = time(NULL);
|
||||
const struct tm tm = *localtime(&t);
|
||||
snprintf(filename, sizeof(filename), "%04d%02d%02d-%02d%02d%02d.mp4",
|
||||
tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday,
|
||||
tm.tm_hour, tm.tm_min, tm.tm_sec);
|
||||
|
||||
recording = true;
|
||||
frame = 0;
|
||||
QWidget *widget = this;
|
||||
while (widget->parentWidget() != nullptr) {
|
||||
widget = widget->parentWidget();
|
||||
}
|
||||
rootWidget = widget;
|
||||
openEncoder(filename);
|
||||
encoding_thread = std::thread(&ScreenRecorder::encoding_thread_func, this);
|
||||
|
||||
update();
|
||||
started = milliseconds();
|
||||
}
|
||||
|
||||
void ScreenRecorder::encoding_thread_func() {
|
||||
const uint64_t start_time = nanos_since_boot();
|
||||
while (recording && encoder) {
|
||||
QImage popImage;
|
||||
if (image_queue.pop_wait_for(popImage, std::chrono::milliseconds(10))) {
|
||||
const QImage image = popImage.convertToFormat(QImage::Format_RGBA8888);
|
||||
libyuv::ARGBScale(image.bits(), image.width() * 4,
|
||||
image.width(), image.height(),
|
||||
rgb_scale_buffer.get(), recording_width * 4,
|
||||
recording_width, recording_height,
|
||||
libyuv::kFilterLinear);
|
||||
encoder->encode_frame_rgba(rgb_scale_buffer.get(), recording_width, recording_height,
|
||||
static_cast<uint64_t>(nanos_since_boot() - start_time));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ScreenRecorder::stop() {
|
||||
if (!recording) return;
|
||||
|
||||
recording = false;
|
||||
update();
|
||||
|
||||
if (encoding_thread.joinable()) {
|
||||
encoding_thread.join();
|
||||
}
|
||||
closeEncoder();
|
||||
image_queue.clear();
|
||||
}
|
||||
|
||||
void ScreenRecorder::update_screen() {
|
||||
if (!uiState()->scene.started) {
|
||||
if (recording) {
|
||||
stop();
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (!recording) return;
|
||||
|
||||
if (milliseconds() - started > 1000 * 60 * 3) {
|
||||
stop();
|
||||
start();
|
||||
return;
|
||||
}
|
||||
|
||||
applyColor();
|
||||
if (rootWidget != nullptr) {
|
||||
const QPixmap pixmap = rootWidget->grab();
|
||||
image_queue.push(pixmap.toImage());
|
||||
}
|
||||
frame++;
|
||||
}
|
||||
@@ -1,55 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <QPushButton>
|
||||
|
||||
#include "omx_encoder.h"
|
||||
#include "blocking_queue.h"
|
||||
#include "selfdrive/ui/ui.h"
|
||||
|
||||
class ScreenRecorder : public QPushButton {
|
||||
#ifdef NO_SR
|
||||
public:
|
||||
explicit ScreenRecorder(QWidget *parent = nullptr){}
|
||||
~ScreenRecorder() override{}
|
||||
|
||||
void update_screen(){}
|
||||
void toggle(){}
|
||||
#else
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit ScreenRecorder(QWidget *parent = nullptr);
|
||||
~ScreenRecorder() override;
|
||||
|
||||
void update_screen();
|
||||
void toggle();
|
||||
|
||||
protected:
|
||||
void paintEvent(QPaintEvent *event) override;
|
||||
|
||||
private:
|
||||
void applyColor();
|
||||
void closeEncoder();
|
||||
void encoding_thread_func();
|
||||
void initializeEncoder();
|
||||
void openEncoder(const char *filename);
|
||||
void start();
|
||||
void stop();
|
||||
|
||||
bool recording;
|
||||
int frame;
|
||||
int recording_height;
|
||||
int recording_width;
|
||||
int screen_height;
|
||||
int screen_width;
|
||||
long long started = 0;
|
||||
|
||||
std::unique_ptr<OmxEncoder> encoder;
|
||||
std::unique_ptr<uint8_t[]> rgb_scale_buffer;
|
||||
std::thread encoding_thread;
|
||||
|
||||
BlockingQueue<QImage> image_queue;
|
||||
QColor recording_color;
|
||||
QWidget *rootWidget;
|
||||
#endif //NO_SR
|
||||
};
|
||||
@@ -1,729 +0,0 @@
|
||||
#include "selfdrive/frogpilot/ui/control_settings.h"
|
||||
|
||||
FrogPilotControlsPanel::FrogPilotControlsPanel(SettingsWindow *parent) : FrogPilotListWidget(parent) {
|
||||
const std::vector<std::tuple<QString, QString, QString, QString>> controlToggles {
|
||||
{"AdjustablePersonalities", "Adjustable Personalities", "Use the 'Distance' button on the steering wheel or the onroad UI to switch between openpilot's driving personalities.\n\n1 bar = Aggressive\n2 bars = Standard\n3 bars = Relaxed", "../frogpilot/assets/toggle_icons/icon_distance.png"},
|
||||
|
||||
{"AlwaysOnLateral", "Always on Lateral", "Maintain openpilot lateral control when the brake or gas pedals are used.\n\nDeactivation occurs only through the 'Cruise Control' button.", "../frogpilot/assets/toggle_icons/icon_always_on_lateral.png"},
|
||||
{"AlwaysOnLateralMain", "Enable On Cruise Main", "Enable 'Always On Lateral' by simply turning on 'Cruise Control'.", ""},
|
||||
{"HideAOLStatusBar", "Hide the Status Bar", "Don't use the status bar for 'Always On Lateral'.", ""},
|
||||
|
||||
{"ConditionalExperimental", "Conditional Experimental Mode", "Automatically switches to 'Experimental Mode' under predefined conditions.", "../frogpilot/assets/toggle_icons/icon_conditional.png"},
|
||||
{"CECurves", "Curve Detected Ahead", "Switch to 'Experimental Mode' when a curve is detected.", ""},
|
||||
{"CENavigation", "Navigation Based", "Switch to 'Experimental Mode' based on navigation data. (i.e. Intersections, stop signs, etc.)", ""},
|
||||
{"CESlowerLead", "Slower Lead Detected Ahead", "Switch to 'Experimental Mode' when a slower lead vehicle is detected ahead.", ""},
|
||||
{"CEStopLights", "Stop Lights and Stop Signs", "Switch to 'Experimental Mode' when a stop light or stop sign is detected.", ""},
|
||||
{"CESignal", "Turn Signal When Below Highway Speeds", "Switch to 'Experimental Mode' when using turn signals below highway speeds to help assit with turns.", ""},
|
||||
{"HideCEMStatusBar", "Hide the Status Bar", "Don't use the status bar for 'Conditional Experimental Mode'.", ""},
|
||||
|
||||
{"CustomPersonalities", "Custom Driving Personalities", "Customize the driving personality profiles to your driving style.", "../frogpilot/assets/toggle_icons/icon_custom.png"},
|
||||
{"DeviceShutdown", "Device Shutdown Timer", "Configure the timer for automatic device shutdown when offroad conserving energy and preventing battery drain.", "../frogpilot/assets/toggle_icons/icon_time.png"},
|
||||
|
||||
{"ExperimentalModeActivation", "Experimental Mode Activation", "Toggle Experimental Mode with either buttons on ethe steering wheel or the screen.\n\nOverrides 'Conditional Experimental Mode'.", "../assets/img_experimental_white.svg"},
|
||||
{"ExperimentalModeViaLKAS", "Double Clicking the LKAS Button", "Enable/disable 'Experimental Mode' by double clicking the 'LKAS' button on your steering wheel.", ""},
|
||||
{"ExperimentalModeViaScreen", "Double Taping the Onroad UI", "Enable/disable 'Experimental Mode' by double taping the onroad UI within a 0.5 second time frame.", ""},
|
||||
{"ExperimentalModeViaDistance", "Long Pressing the Distance Button", "Enable/disable 'Experimental Mode' by holding down the 'distance' button on your steering wheel for 0.5 seconds.", ""},
|
||||
|
||||
{"FireTheBabysitter", "Fire the Babysitter", "Deactivate some of openpilot's 'Babysitter' protocols for more user autonomy.", "../frogpilot/assets/toggle_icons/icon_babysitter.png"},
|
||||
{"MuteOverheated", "Bypass Thermal Safety Limits", "Allow the device to run at any temperature even above comma's recommended thermal limits.", ""},
|
||||
{"NoLogging", "Disable Logging", "Turn off all data tracking to enhance privacy or reduce thermal load.\n\nWARNING: This action will prevent drive recording and data cannot be recovered!", ""},
|
||||
{"NoUploads", "Disable Uploads", "Turn off all data uploads to comma's servers.\n\nWARNING: This action will prevent your drives from appearing on comma connect which may impact debugging and support!", ""},
|
||||
{"OfflineMode", "Offline Mode", "Allow the device to be offline indefinitely.", ""},
|
||||
|
||||
{"LateralTune", "Lateral Tuning", "Modify openpilot's steering behavior.", "../frogpilot/assets/toggle_icons/icon_lateral_tune.png"},
|
||||
{"ForceAutoTune", "Force Auto Tune", "Forces comma's auto lateral tuning for unsupported vehicles.", ""},
|
||||
{"NNFF", "NNFF - Neural Network Feedforward", "Use Twilsonco's Neural Network Feedforward for enhanced precision in lateral control.", ""},
|
||||
{"SteerRatio", steerRatioStock != 0 ? QString("Steer Ratio (Default: %1)").arg(steerRatioStock, 0, 'f', 2) : "Steer Ratio", "Set a custom steer ratio for your vehicle controls.", ""},
|
||||
{"UseLateralJerk", "Use Lateral Jerk", "Include steer torque necessary to achieve desired steer rate (lateral jerk).", ""},
|
||||
|
||||
{"LongitudinalTune", "Longitudinal Tuning", "Modify openpilot's acceleration and braking behavior.", "../frogpilot/assets/toggle_icons/icon_longitudinal_tune.png"},
|
||||
{"AccelerationProfile", "Acceleration Profile", "Change the acceleration rate to be either sporty or eco-friendly.", ""},
|
||||
{"DecelerationProfile", "Deceleration Profile", "Change the deceleration rate to be either sporty or eco-friendly.", ""},
|
||||
{"AggressiveAcceleration", "Aggressive Acceleration With Lead", "Increase acceleration aggressiveness when following a lead vehicle from a stop.", ""},
|
||||
{"StoppingDistance", "Increase Stop Distance Behind Lead", "Increase the stopping distance for a more comfortable stop from lead vehicles.", ""},
|
||||
{"LeadDetectionThreshold", "Lead Detection Threshold", "Increase or decrease the lead detection threshold to either detect leads sooner, or increase model confidence.", ""},
|
||||
{"SmoothBraking", "Smoother Braking Behind Lead", "Smoothen out the braking behavior when approaching slower vehicles.", ""},
|
||||
{"TrafficMode", "Traffic Mode", "Hold down the 'distance' button for 2.5 seconds to enable more aggressive driving behavior catered towards stop and go traffic.", ""},
|
||||
|
||||
{"Model", "Model Selector", "Choose your preferred openpilot model.", "../assets/offroad/icon_calibration.png"},
|
||||
|
||||
{"MTSCEnabled", "Map Turn Speed Control", "Slow down for anticipated curves detected by your downloaded maps.", "../frogpilot/assets/toggle_icons/icon_speed_map.png"},
|
||||
{"DisableMTSCSmoothing", "Disable MTSC UI Smoothing", "Disables the smoothing for the requested speed in the onroad UI.", ""},
|
||||
{"MTSCCurvatureCheck", "Model Curvature Detection Failsafe", "Only trigger MTSC when the model detects a curve in the road. Purely used as a failsafe to prevent false positives. Leave this off if you never experience false positives.", ""},
|
||||
{"MTSCLimit", "Speed Change Hard Cap", "Set a hard cap for MTSC. If MTSC requests a speed decrease greater than this value, it ignores the requested speed from MTSC. Purely used as a failsafe to prevent false positives. Leave this off if you never experience false positives.", ""},
|
||||
{"MTSCAggressiveness", "Turn Speed Aggressiveness", "Set turn speed aggressiveness. Higher values result in faster turns, lower values yield gentler turns.\n\nA change of +- 1% results in the velocity being raised or lowered by about 1 mph.", ""},
|
||||
|
||||
{"NudgelessLaneChange", "Nudgeless Lane Change", "Enable lane changes without manual steering input.", "../frogpilot/assets/toggle_icons/icon_lane.png"},
|
||||
{"LaneChangeTime", "Lane Change Timer", "Specify a delay before executing a nudgeless lane change.", ""},
|
||||
{"LaneDetection", "Lane Detection", "Block nudgeless lane changes when a lane isn't detected.", ""},
|
||||
{"LaneDetectionWidth", "Lane Detection Threshold", "Set the required lane width to be qualified as a lane.", ""},
|
||||
{"OneLaneChange", "One Lane Change Per Signal", "Limit to one nudgeless lane change per turn signal activation.", ""},
|
||||
|
||||
{"QOLControls", "Quality of Life", "Miscellaneous quality of life changes to improve your overall openpilot experience.", "../frogpilot/assets/toggle_icons/quality_of_life.png"},
|
||||
{"DisableOnroadUploads", "Disable Onroad Uploads", "Prevent large data uploads when onroad.", ""},
|
||||
{"HigherBitrate", "Higher Bitrate Recording", "Increases the quality of the footage uploaded to comma connect.", ""},
|
||||
{"NavChill", "Navigate on Chill Mode", "Allows cars without longitudinal support to navigate. Allows navigation without experimental mode.", ""},
|
||||
{"PauseLateralOnSignal", "Pause Lateral On Turn Signal Below", "Temporarily disable lateral control during turn signal use below the set speed.", ""},
|
||||
{"ReverseCruise", "Reverse Cruise Increase", "Reverses the 'long press' functionality when increasing the max set speed. Useful to increase the max speed quickly.", ""},
|
||||
{"SetSpeedOffset", "Set Speed Offset", "Set an offset for your desired set speed.", ""},
|
||||
|
||||
{"SpeedLimitController", "Speed Limit Controller", "Automatically adjust vehicle speed to match speed limits using 'Open Street Map's, 'Navigate On openpilot', or your car's dashboard (TSS2 Toyotas only).", "../assets/offroad/icon_speed_limit.png"},
|
||||
{"SLCControls", "Controls Settings", "Manage settings for the controls.", ""},
|
||||
{"Offset1", "Speed Limit Offset (0-34 mph)", "Speed limit offset for speed limits between 0-34 mph.", ""},
|
||||
{"Offset2", "Speed Limit Offset (35-54 mph)", "Speed limit offset for speed limits between 35-54 mph.", ""},
|
||||
{"Offset3", "Speed Limit Offset (55-64 mph)", "Speed limit offset for speed limits between 55-64 mph.", ""},
|
||||
{"Offset4", "Speed Limit Offset (65-99 mph)", "Speed limit offset for speed limits between 65-99 mph.", ""},
|
||||
{"SLCFallback", "Fallback Method", "Choose your fallback method for when there are no speed limits currently being obtained from Navigation, OSM, and the car's dashboard.", ""},
|
||||
{"SLCOverride", "Override Method", "Choose your preferred method to override the current speed limit.", ""},
|
||||
{"SLCPriority", "Priority Order", "Determine the priority order for what speed limits to use.", ""},
|
||||
{"SLCQOL", "Quality of Life Settings", "Manage quality of life settings.", ""},
|
||||
{"SLCConfirmation", "Confirm New Speed Limits", "Don't automatically start using the new speed limit until it's been manually confirmed first.", ""},
|
||||
{"ForceMPHDashboard", "Force MPH From Dashboard Readings", "Force MPH readings from the dashboard. Only use this if you live in an area where the speed limits from your dashboard are in KPH but you use MPH.", ""},
|
||||
{"SetSpeedLimit", "Use Current Speed Limit As Set Speed", "Sets your max speed to the current speed limit if one is populated when you initially enable openpilot.", ""},
|
||||
{"SLCVisuals", "Visuals Settings", "Manage visual settings.", ""},
|
||||
{"ShowSLCOffset", "Show Speed Limit Offset", "Show the speed limit offset seperated from the speed limit in the onroad UI when using 'Speed Limit Controller'.", ""},
|
||||
{"UseVienna", "Use Vienna Speed Limit Signs", "Use the Vienna (EU) speed limit style signs as opposed to MUTCD (US).", ""},
|
||||
|
||||
{"TurnDesires", "Use Turn Desires", "Use turn desires for enhanced precision in turns below the minimum lane change speed.", "../assets/navigation/direction_continue_right.png"},
|
||||
|
||||
{"VisionTurnControl", "Vision Turn Speed Controller", "Slow down for detected road curvature for smoother curve handling.", "../frogpilot/assets/toggle_icons/icon_vtc.png"},
|
||||
{"DisableVTSCSmoothing", "Disable VTSC UI Smoothing", "Disables the smoothing for the requested speed in the onroad UI.", ""},
|
||||
{"CurveSensitivity", "Curve Detection Sensitivity", "Set curve detection sensitivity. Higher values prompt earlier responses, lower values lead to smoother but later reactions.", ""},
|
||||
{"TurnAggressiveness", "Turn Speed Aggressiveness", "Set turn speed aggressiveness. Higher values result in faster turns, lower values yield gentler turns.", ""},
|
||||
};
|
||||
|
||||
for (const auto &[param, title, desc, icon] : controlToggles) {
|
||||
ParamControl *toggle;
|
||||
|
||||
if (param == "AdjustablePersonalities") {
|
||||
std::vector<QString> adjustablePersonalitiesToggles{"PersonalitiesViaWheel", "PersonalitiesViaScreen"};
|
||||
std::vector<QString> adjustablePersonalitiesNames{tr("Distance Button"), tr("Screen")};
|
||||
toggle = new FrogPilotParamToggleControl(param, title, desc, icon, adjustablePersonalitiesToggles, adjustablePersonalitiesNames);
|
||||
|
||||
} else if (param == "AlwaysOnLateral") {
|
||||
FrogPilotParamManageControl *aolToggle = new FrogPilotParamManageControl(param, title, desc, icon, this);
|
||||
QObject::connect(aolToggle, &FrogPilotParamManageControl::manageButtonClicked, this, [this]() {
|
||||
parentToggleClicked();
|
||||
for (auto &[key, toggle] : toggles) {
|
||||
toggle->setVisible(aolKeys.find(key.c_str()) != aolKeys.end());
|
||||
}
|
||||
});
|
||||
toggle = aolToggle;
|
||||
|
||||
} else if (param == "ConditionalExperimental") {
|
||||
FrogPilotParamManageControl *conditionalExperimentalToggle = new FrogPilotParamManageControl(param, title, desc, icon, this);
|
||||
QObject::connect(conditionalExperimentalToggle, &FrogPilotParamManageControl::manageButtonClicked, this, [this]() {
|
||||
parentToggleClicked();
|
||||
conditionalSpeedsImperial->setVisible(!isMetric);
|
||||
conditionalSpeedsMetric->setVisible(isMetric);
|
||||
for (auto &[key, toggle] : toggles) {
|
||||
toggle->setVisible(conditionalExperimentalKeys.find(key.c_str()) != conditionalExperimentalKeys.end());
|
||||
}
|
||||
});
|
||||
toggle = conditionalExperimentalToggle;
|
||||
} else if (param == "CECurves") {
|
||||
FrogPilotParamValueControl *CESpeedImperial = new FrogPilotParamValueControl("CESpeed", "Below", "Switch to 'Experimental Mode' below this speed in absence of a lead vehicle.", "", 0, 99,
|
||||
std::map<int, QString>(), this, false, " mph");
|
||||
FrogPilotParamValueControl *CESpeedLeadImperial = new FrogPilotParamValueControl("CESpeedLead", " w/Lead", "Switch to 'Experimental Mode' below this speed when following a lead vehicle.", "", 0, 99,
|
||||
std::map<int, QString>(), this, false, " mph");
|
||||
conditionalSpeedsImperial = new FrogPilotDualParamControl(CESpeedImperial, CESpeedLeadImperial, this);
|
||||
addItem(conditionalSpeedsImperial);
|
||||
|
||||
FrogPilotParamValueControl *CESpeedMetric = new FrogPilotParamValueControl("CESpeed", "Below", "Switch to 'Experimental Mode' below this speed in absence of a lead vehicle.", "", 0, 150,
|
||||
std::map<int, QString>(), this, false, " kph");
|
||||
FrogPilotParamValueControl *CESpeedLeadMetric = new FrogPilotParamValueControl("CESpeedLead", " w/Lead", "Switch to 'Experimental Mode' below this speed when following a lead vehicle.", "", 0, 150,
|
||||
std::map<int, QString>(), this, false, " kph");
|
||||
conditionalSpeedsMetric = new FrogPilotDualParamControl(CESpeedMetric, CESpeedLeadMetric, this);
|
||||
addItem(conditionalSpeedsMetric);
|
||||
|
||||
std::vector<QString> curveToggles{"CECurvesLead"};
|
||||
std::vector<QString> curveToggleNames{tr("With Lead")};
|
||||
toggle = new FrogPilotParamToggleControl(param, title, desc, icon, curveToggles, curveToggleNames);
|
||||
} else if (param == "CENavigation") {
|
||||
std::vector<QString> navigationToggles{"CENavigationIntersections", "CENavigationTurns", "CENavigationLead"};
|
||||
std::vector<QString> navigationToggleNames{tr("Intersections"), tr("Turns"), tr("With Lead")};
|
||||
toggle = new FrogPilotParamToggleControl(param, title, desc, icon, navigationToggles, navigationToggleNames);
|
||||
} else if (param == "CEStopLights") {
|
||||
std::vector<QString> stopLightToggles{"CEStopLightsLead"};
|
||||
std::vector<QString> stopLightToggleNames{tr("With Lead")};
|
||||
toggle = new FrogPilotParamToggleControl(param, title, desc, icon, stopLightToggles, stopLightToggleNames);
|
||||
|
||||
} else if (param == "CustomPersonalities") {
|
||||
FrogPilotParamManageControl *customPersonalitiesToggle = new FrogPilotParamManageControl(param, title, desc, icon, this);
|
||||
QObject::connect(customPersonalitiesToggle, &FrogPilotParamManageControl::manageButtonClicked, this, [this]() {
|
||||
parentToggleClicked();
|
||||
for (auto &[key, toggle] : toggles) {
|
||||
toggle->setVisible(false);
|
||||
}
|
||||
aggressiveProfile->setVisible(true);
|
||||
standardProfile->setVisible(true);
|
||||
relaxedProfile->setVisible(true);
|
||||
});
|
||||
toggle = customPersonalitiesToggle;
|
||||
|
||||
FrogPilotParamValueControl *aggressiveFollow = new FrogPilotParamValueControl("AggressiveFollow", "Follow",
|
||||
"Set the 'Aggressive' personality' following distance. "
|
||||
"Represents seconds to follow behind the lead vehicle.\n\nStock: 1.25 seconds.",
|
||||
"../frogpilot/assets/other_images/aggressive.png",
|
||||
1, 5, std::map<int, QString>(), this, false, " sec", 1, 0.01);
|
||||
FrogPilotParamValueControl *aggressiveJerk = new FrogPilotParamValueControl("AggressiveJerk", " Jerk",
|
||||
"Configure brake/gas pedal responsiveness for the 'Aggressive' personality. "
|
||||
"Higher jerk value = smoother rides.\nLower jerk value = faster response.\n\nStock: 0.5.",
|
||||
"",
|
||||
0.01, 5, std::map<int, QString>(), this, false, "", 1, 0.01);
|
||||
aggressiveProfile = new FrogPilotDualParamControl(aggressiveFollow, aggressiveJerk, this, true);
|
||||
addItem(aggressiveProfile);
|
||||
|
||||
FrogPilotParamValueControl *standardFollow = new FrogPilotParamValueControl("StandardFollow", "Follow",
|
||||
"Set the 'Standard' personality following distance. "
|
||||
"Represents seconds to follow behind the lead vehicle.\n\nStock: 1.45 seconds.",
|
||||
"../frogpilot/assets/other_images/standard.png",
|
||||
1, 5, std::map<int, QString>(), this, false, " sec", 1, 0.01);
|
||||
FrogPilotParamValueControl *standardJerk = new FrogPilotParamValueControl("StandardJerk", " Jerk",
|
||||
"Adjust brake/gas pedal responsiveness for the 'Standard' personality. "
|
||||
"Higher jerk value = smoother rides.\nLower jerk value = faster response.\n\nStock: 1.0.",
|
||||
"",
|
||||
0.01, 5, std::map<int, QString>(), this, false, "", 1, 0.01);
|
||||
standardProfile = new FrogPilotDualParamControl(standardFollow, standardJerk, this, true);
|
||||
addItem(standardProfile);
|
||||
|
||||
FrogPilotParamValueControl *relaxedFollow = new FrogPilotParamValueControl("RelaxedFollow", "Follow",
|
||||
"Set the 'Relaxed' personality following distance. "
|
||||
"Represents seconds to follow behind the lead vehicle.\n\nStock: 1.75 seconds.",
|
||||
"../frogpilot/assets/other_images/relaxed.png",
|
||||
1, 5, std::map<int, QString>(), this, false, " sec", 1, 0.01);
|
||||
FrogPilotParamValueControl *relaxedJerk = new FrogPilotParamValueControl("RelaxedJerk", " Jerk",
|
||||
"Set brake/gas pedal responsiveness for the 'Relaxed' personality. "
|
||||
"Higher jerk value = smoother rides.\nLower jerk value = faster response.\n\nStock: 1.0.",
|
||||
"",
|
||||
0.01, 5, std::map<int, QString>(), this, false, "", 1, 0.01);
|
||||
relaxedProfile = new FrogPilotDualParamControl(relaxedFollow, relaxedJerk, this, true);
|
||||
addItem(relaxedProfile);
|
||||
|
||||
} else if (param == "DeviceShutdown") {
|
||||
std::map<int, QString> shutdownLabels;
|
||||
for (int i = 0; i <= 33; ++i) {
|
||||
shutdownLabels[i] = i == 0 ? "Instant" : i <= 3 ? QString::number(i * 15) + " mins" : QString::number(i - 3) + (i == 4 ? " hour" : " hours");
|
||||
}
|
||||
toggle = new FrogPilotParamValueControl(param, title, desc, icon, 0, 33, shutdownLabels, this, false);
|
||||
|
||||
} else if (param == "ExperimentalModeActivation") {
|
||||
FrogPilotParamManageControl *experimentalModeActivationToggle = new FrogPilotParamManageControl(param, title, desc, icon, this);
|
||||
QObject::connect(experimentalModeActivationToggle, &FrogPilotParamManageControl::manageButtonClicked, this, [this]() {
|
||||
parentToggleClicked();
|
||||
for (auto &[key, toggle] : toggles) {
|
||||
toggle->setVisible(experimentalModeActivationKeys.find(key.c_str()) != experimentalModeActivationKeys.end());
|
||||
}
|
||||
});
|
||||
toggle = experimentalModeActivationToggle;
|
||||
|
||||
} else if (param == "FireTheBabysitter") {
|
||||
FrogPilotParamManageControl *fireTheBabysitterToggle = new FrogPilotParamManageControl(param, title, desc, icon, this);
|
||||
QObject::connect(fireTheBabysitterToggle, &FrogPilotParamManageControl::manageButtonClicked, this, [this]() {
|
||||
parentToggleClicked();
|
||||
for (auto &[key, toggle] : toggles) {
|
||||
toggle->setVisible(fireTheBabysitterKeys.find(key.c_str()) != fireTheBabysitterKeys.end());
|
||||
}
|
||||
});
|
||||
toggle = fireTheBabysitterToggle;
|
||||
|
||||
} else if (param == "LateralTune") {
|
||||
FrogPilotParamManageControl *lateralTuneToggle = new FrogPilotParamManageControl(param, title, desc, icon, this);
|
||||
QObject::connect(lateralTuneToggle, &FrogPilotParamManageControl::manageButtonClicked, this, [this]() {
|
||||
parentToggleClicked();
|
||||
for (auto &[key, toggle] : toggles) {
|
||||
toggle->setVisible(lateralTuneKeys.find(key.c_str()) != lateralTuneKeys.end());
|
||||
}
|
||||
});
|
||||
toggle = lateralTuneToggle;
|
||||
} else if (param == "SteerRatio") {
|
||||
toggle = new FrogPilotParamValueControl(param, title, desc, icon, steerRatioStock * 0.75, steerRatioStock * 1.25, std::map<int, QString>(), this, false, "", 1, 0.01);
|
||||
|
||||
} else if (param == "LongitudinalTune") {
|
||||
FrogPilotParamManageControl *longitudinalTuneToggle = new FrogPilotParamManageControl(param, title, desc, icon, this);
|
||||
QObject::connect(longitudinalTuneToggle, &FrogPilotParamManageControl::manageButtonClicked, this, [this]() {
|
||||
parentToggleClicked();
|
||||
for (auto &[key, toggle] : toggles) {
|
||||
toggle->setVisible(longitudinalTuneKeys.find(key.c_str()) != longitudinalTuneKeys.end());
|
||||
}
|
||||
});
|
||||
toggle = longitudinalTuneToggle;
|
||||
} else if (param == "AccelerationProfile") {
|
||||
std::vector<QString> profileOptions{tr("Standard"), tr("Eco"), tr("Sport"), tr("Sport+")};
|
||||
FrogPilotButtonParamControl *profileSelection = new FrogPilotButtonParamControl(param, title, desc, icon, profileOptions);
|
||||
toggle = profileSelection;
|
||||
|
||||
QObject::connect(static_cast<FrogPilotButtonParamControl*>(toggle), &FrogPilotButtonParamControl::buttonClicked, [this](int id) {
|
||||
if (id == 3) {
|
||||
FrogPilotConfirmationDialog::toggleAlert("WARNING: This maxes out openpilot's acceleration from 2.0 m/s to 4.0 m/s and may cause oscillations when accelerating!",
|
||||
"I understand the risks.", this);
|
||||
}
|
||||
});
|
||||
} else if (param == "DecelerationProfile") {
|
||||
std::vector<QString> profileOptions{tr("Standard"), tr("Eco"), tr("Sport")};
|
||||
FrogPilotButtonParamControl *profileSelection = new FrogPilotButtonParamControl(param, title, desc, icon, profileOptions);
|
||||
toggle = profileSelection;
|
||||
} else if (param == "StoppingDistance") {
|
||||
toggle = new FrogPilotParamValueControl(param, title, desc, icon, 0, 10, std::map<int, QString>(), this, false, " feet");
|
||||
} else if (param == "LeadDetectionThreshold") {
|
||||
toggle = new FrogPilotParamValueControl(param, title, desc, icon, 1, 100, std::map<int, QString>(), this, false, "%");
|
||||
|
||||
} else if (param == "Model") {
|
||||
modelSelectorButton = new FrogPilotButtonIconControl(title, tr("SELECT"), desc, icon);
|
||||
QStringList models = {"los-angeles", "certified-herbalist", "duck-amigo", "recertified-herbalist"};
|
||||
QStringList modelLabels = {"Los Angeles (Default)", "Certified Herbalist", "Duck Amigo", "Recertified Herbalist"};
|
||||
QObject::connect(modelSelectorButton, &FrogPilotButtonIconControl::clicked, this, [this, models, modelLabels]() {
|
||||
QString selection = MultiOptionDialog::getSelection(tr("Select a driving model"), modelLabels, "", this);
|
||||
|
||||
if (!selection.isEmpty()) {
|
||||
int selectedModelIndex = modelLabels.indexOf(selection);
|
||||
QString selectedModelValue = models[selectedModelIndex];
|
||||
params.put("Model", selectedModelValue.toStdString());
|
||||
modelSelectorButton->setValue(selection);
|
||||
if (FrogPilotConfirmationDialog::yesorno("Do you want to start with a fresh calibration for the newly selected model?", this)) {
|
||||
params.remove("CalibrationParams");
|
||||
params.remove("LiveTorqueParameters");
|
||||
}
|
||||
if (started) {
|
||||
if (FrogPilotConfirmationDialog::toggle("Reboot required to take effect.", "Reboot Now", this)) {
|
||||
Hardware::soft_reboot();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
int initialModelIndex = models.indexOf(QString::fromStdString(params.get("Model")));
|
||||
QString initialModelLabel = modelLabels[initialModelIndex];
|
||||
modelSelectorButton->setValue(initialModelLabel);
|
||||
addItem(modelSelectorButton);
|
||||
|
||||
} else if (param == "MTSCEnabled") {
|
||||
FrogPilotParamManageControl *mtscToggle = new FrogPilotParamManageControl(param, title, desc, icon, this);
|
||||
QObject::connect(mtscToggle, &FrogPilotParamManageControl::manageButtonClicked, this, [this]() {
|
||||
parentToggleClicked();
|
||||
for (auto &[key, toggle] : toggles) {
|
||||
toggle->setVisible(mtscKeys.find(key.c_str()) != mtscKeys.end());
|
||||
}
|
||||
});
|
||||
toggle = mtscToggle;
|
||||
} else if (param == "MTSCAggressiveness") {
|
||||
toggle = new FrogPilotParamValueControl(param, title, desc, icon, 1, 200, std::map<int, QString>(), this, false, "%");
|
||||
} else if (param == "MTSCLimit") {
|
||||
toggle = new FrogPilotParamValueControl(param, title, desc, icon, 0, 99, std::map<int, QString>(), this, false, " mph");
|
||||
|
||||
} else if (param == "QOLControls") {
|
||||
FrogPilotParamManageControl *qolToggle = new FrogPilotParamManageControl(param, title, desc, icon, this);
|
||||
QObject::connect(qolToggle, &FrogPilotParamManageControl::manageButtonClicked, this, [this]() {
|
||||
parentToggleClicked();
|
||||
for (auto &[key, toggle] : toggles) {
|
||||
toggle->setVisible(qolKeys.find(key.c_str()) != qolKeys.end());
|
||||
}
|
||||
});
|
||||
toggle = qolToggle;
|
||||
} else if (param == "PauseLateralOnSignal") {
|
||||
toggle = new FrogPilotParamValueControl(param, title, desc, icon, 0, 99, std::map<int, QString>(), this, false, " mph");
|
||||
} else if (param == "ReverseCruise") {
|
||||
std::vector<QString> reverseCruiseToggles{"ReverseCruiseUI"};
|
||||
std::vector<QString> reverseCruiseNames{tr("Control Via UI")};
|
||||
toggle = new FrogPilotParamToggleControl(param, title, desc, icon, reverseCruiseToggles, reverseCruiseNames);
|
||||
} else if (param == "SetSpeedOffset") {
|
||||
toggle = new FrogPilotParamValueControl(param, title, desc, icon, 0, 99, std::map<int, QString>(), this, false, " mph");
|
||||
|
||||
} else if (param == "NudgelessLaneChange") {
|
||||
FrogPilotParamManageControl *laneChangeToggle = new FrogPilotParamManageControl(param, title, desc, icon, this);
|
||||
QObject::connect(laneChangeToggle, &FrogPilotParamManageControl::manageButtonClicked, this, [this]() {
|
||||
parentToggleClicked();
|
||||
for (auto &[key, toggle] : toggles) {
|
||||
toggle->setVisible(laneChangeKeys.find(key.c_str()) != laneChangeKeys.end());
|
||||
}
|
||||
});
|
||||
toggle = laneChangeToggle;
|
||||
} else if (param == "LaneChangeTime") {
|
||||
std::map<int, QString> laneChangeTimeLabels;
|
||||
for (int i = 0; i <= 10; ++i) {
|
||||
laneChangeTimeLabels[i] = i == 0 ? "Instant" : QString::number(i / 2.0) + " seconds";
|
||||
}
|
||||
toggle = new FrogPilotParamValueControl(param, title, desc, icon, 0, 10, laneChangeTimeLabels, this, false);
|
||||
} else if (param == "LaneDetectionWidth") {
|
||||
toggle = new FrogPilotParamValueControl(param, title, desc, icon, 0, 100, std::map<int, QString>(), this, false, " feet", 10);
|
||||
|
||||
} else if (param == "SpeedLimitController") {
|
||||
FrogPilotParamManageControl *speedLimitControllerToggle = new FrogPilotParamManageControl(param, title, desc, icon, this);
|
||||
QObject::connect(speedLimitControllerToggle, &FrogPilotParamManageControl::manageButtonClicked, this, [this]() {
|
||||
parentToggleClicked();
|
||||
for (auto &[key, toggle] : toggles) {
|
||||
toggle->setVisible(speedLimitControllerKeys.find(key.c_str()) != speedLimitControllerKeys.end());
|
||||
}
|
||||
});
|
||||
toggle = speedLimitControllerToggle;
|
||||
} else if (param == "SLCControls") {
|
||||
FrogPilotParamManageControl *manageSLCControlsToggle = new FrogPilotParamManageControl(param, title, desc, icon, this, true);
|
||||
QObject::connect(manageSLCControlsToggle, &FrogPilotParamManageControl::manageButtonClicked, this, [this]() {
|
||||
parentToggleClicked();
|
||||
for (auto &[key, toggle] : toggles) {
|
||||
toggle->setVisible(speedLimitControllerControlsKeys.find(key.c_str()) != speedLimitControllerControlsKeys.end());
|
||||
subParentToggleClicked();
|
||||
}
|
||||
slcPriorityButton->setVisible(true);
|
||||
});
|
||||
toggle = manageSLCControlsToggle;
|
||||
} else if (param == "SLCQOL") {
|
||||
FrogPilotParamManageControl *manageSLCQOLToggle = new FrogPilotParamManageControl(param, title, desc, icon, this, true);
|
||||
QObject::connect(manageSLCQOLToggle, &FrogPilotParamManageControl::manageButtonClicked, this, [this]() {
|
||||
parentToggleClicked();
|
||||
for (auto &[key, toggle] : toggles) {
|
||||
toggle->setVisible(speedLimitControllerQOLKeys.find(key.c_str()) != speedLimitControllerQOLKeys.end());
|
||||
subParentToggleClicked();
|
||||
}
|
||||
});
|
||||
toggle = manageSLCQOLToggle;
|
||||
} else if (param == "SLCConfirmation") {
|
||||
std::vector<QString> slcConfirmationToggles{"SLCConfirmationLower", "SLCConfirmationHigher"};
|
||||
std::vector<QString> slcConfirmationNames{tr("Lower Limits"), tr("Higher Limits")};
|
||||
toggle = new FrogPilotParamToggleControl(param, title, desc, icon, slcConfirmationToggles, slcConfirmationNames);
|
||||
} else if (param == "SLCVisuals") {
|
||||
FrogPilotParamManageControl *manageSLCVisualsToggle = new FrogPilotParamManageControl(param, title, desc, icon, this, true);
|
||||
QObject::connect(manageSLCVisualsToggle, &FrogPilotParamManageControl::manageButtonClicked, this, [this]() {
|
||||
parentToggleClicked();
|
||||
for (auto &[key, toggle] : toggles) {
|
||||
toggle->setVisible(speedLimitControllerVisualsKeys.find(key.c_str()) != speedLimitControllerVisualsKeys.end());
|
||||
subParentToggleClicked();
|
||||
}
|
||||
});
|
||||
toggle = manageSLCVisualsToggle;
|
||||
} else if (param == "Offset1" || param == "Offset2" || param == "Offset3" || param == "Offset4") {
|
||||
toggle = new FrogPilotParamValueControl(param, title, desc, icon, -99, 99, std::map<int, QString>(), this, false, " mph");
|
||||
} else if (param == "ShowSLCOffset") {
|
||||
std::vector<QString> slcOffsetToggles{"ShowSLCOffsetUI"};
|
||||
std::vector<QString> slcOffsetToggleNames{tr("Control Via UI")};
|
||||
toggle = new FrogPilotParamToggleControl(param, title, desc, icon, slcOffsetToggles, slcOffsetToggleNames);
|
||||
} else if (param == "SLCFallback") {
|
||||
std::vector<QString> fallbackOptions{tr("Set Speed"), tr("Experimental Mode"), tr("Previous Limit")};
|
||||
FrogPilotButtonParamControl *fallbackSelection = new FrogPilotButtonParamControl(param, title, desc, icon, fallbackOptions);
|
||||
toggle = fallbackSelection;
|
||||
} else if (param == "SLCOverride") {
|
||||
std::vector<QString> overrideOptions{tr("None"), tr("Manual Set Speed"), tr("Set Speed")};
|
||||
FrogPilotButtonParamControl *overrideSelection = new FrogPilotButtonParamControl(param, title, desc, icon, overrideOptions);
|
||||
toggle = overrideSelection;
|
||||
} else if (param == "SLCPriority") {
|
||||
slcPriorityButton = new ButtonControl(title, tr("SELECT"), desc);
|
||||
QStringList primaryPriorities = {"None", "Dashboard", "Navigation", "Offline Maps", "Highest", "Lowest"};
|
||||
QStringList secondaryTertiaryPriorities = {"None", "Dashboard", "Navigation", "Offline Maps"};
|
||||
QStringList priorityPrompts = {tr("Select your primary priority"), tr("Select your secondary priority"), tr("Select your tertiary priority")};
|
||||
|
||||
QObject::connect(slcPriorityButton, &ButtonControl::clicked, this, [this, primaryPriorities, secondaryTertiaryPriorities, priorityPrompts]() {
|
||||
QStringList availablePriorities = primaryPriorities;
|
||||
QStringList selectedPriorities;
|
||||
for (int i = 1; i <= 3; ++i) {
|
||||
QStringList currentPriorities = (i == 1) ? availablePriorities : secondaryTertiaryPriorities;
|
||||
|
||||
for (const QString &selectedPriority : selectedPriorities) {
|
||||
currentPriorities.removeAll(selectedPriority);
|
||||
}
|
||||
|
||||
QString priorityKey = QString("SLCPriority%1").arg(i);
|
||||
QString selection = MultiOptionDialog::getSelection(priorityPrompts[i - 1], currentPriorities, "", this);
|
||||
if (!selection.isEmpty()) {
|
||||
params.put(priorityKey.toStdString(), selection.toStdString());
|
||||
selectedPriorities.append(selection);
|
||||
|
||||
if (i == 1 && (selection == "Highest" || selection == "Lowest" || selection == "None")) {
|
||||
for (int j = i + 1; j <= 3; ++j) {
|
||||
QString remainingPriorityKeys = QString("SLCPriority%1").arg(j);
|
||||
params.putInt(remainingPriorityKeys.toStdString(), 0);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
updateToggles();
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
selectedPriorities.removeAll("None");
|
||||
slcPriorityButton->setValue(selectedPriorities.join(", "));
|
||||
});
|
||||
|
||||
QStringList initialPriorities;
|
||||
for (int i = 1; i <= 3; ++i) {
|
||||
QString priorityKey = QString("SLCPriority%1").arg(i);
|
||||
std::string priorityValue = params.get(priorityKey.toStdString());
|
||||
QString priorityString = QString::fromStdString(priorityValue);
|
||||
if (!priorityString.isEmpty() && primaryPriorities.contains(priorityString) && priorityString != "None") {
|
||||
initialPriorities.append(priorityString);
|
||||
}
|
||||
}
|
||||
slcPriorityButton->setValue(initialPriorities.join(", "));
|
||||
addItem(slcPriorityButton);
|
||||
|
||||
} else if (param == "VisionTurnControl") {
|
||||
FrogPilotParamManageControl *visionTurnControlToggle = new FrogPilotParamManageControl(param, title, desc, icon, this);
|
||||
QObject::connect(visionTurnControlToggle, &FrogPilotParamManageControl::manageButtonClicked, this, [this]() {
|
||||
parentToggleClicked();
|
||||
for (auto &[key, toggle] : toggles) {
|
||||
toggle->setVisible(visionTurnControlKeys.find(key.c_str()) != visionTurnControlKeys.end());
|
||||
}
|
||||
});
|
||||
toggle = visionTurnControlToggle;
|
||||
} else if (param == "CurveSensitivity" || param == "TurnAggressiveness") {
|
||||
toggle = new FrogPilotParamValueControl(param, title, desc, icon, 1, 200, std::map<int, QString>(), this, false, "%");
|
||||
|
||||
} else {
|
||||
toggle = new ParamControl(param, title, desc, icon, this);
|
||||
}
|
||||
|
||||
addItem(toggle);
|
||||
toggles[param.toStdString()] = toggle;
|
||||
|
||||
QObject::connect(toggle, &ToggleControl::toggleFlipped, [this]() {
|
||||
updateToggles();
|
||||
});
|
||||
|
||||
QObject::connect(static_cast<FrogPilotButtonParamControl*>(toggle), &FrogPilotButtonParamControl::buttonClicked, [this]() {
|
||||
updateToggles();
|
||||
});
|
||||
|
||||
QObject::connect(static_cast<FrogPilotParamValueControl*>(toggle), &FrogPilotParamValueControl::valueChanged, [this]() {
|
||||
updateToggles();
|
||||
});
|
||||
|
||||
QObject::connect(toggle, &AbstractControl::showDescriptionEvent, [this]() {
|
||||
update();
|
||||
});
|
||||
|
||||
QObject::connect(static_cast<FrogPilotParamManageControl*>(toggle), &FrogPilotParamManageControl::manageButtonClicked, this, [this]() {
|
||||
update();
|
||||
});
|
||||
}
|
||||
|
||||
QObject::connect(toggles["AlwaysOnLateralMain"], &ToggleControl::toggleFlipped, [this]() {
|
||||
if (params.getBool("AlwaysOnLateralMain")) {
|
||||
FrogPilotConfirmationDialog::toggleAlert(
|
||||
"WARNING: This isn't guaranteed to work, so if you run into any issues, please report it in the FrogPilot Discord!",
|
||||
"I understand the risks.", this);
|
||||
}
|
||||
});
|
||||
|
||||
QObject::connect(toggles["MuteOverheated"], &ToggleControl::toggleFlipped, [this]() {
|
||||
if (params.getBool("MuteOverheated")) {
|
||||
FrogPilotConfirmationDialog::toggleAlert(
|
||||
"WARNING: This MAY cause premature wear or damage by running the device over comma's recommended temperature limits!",
|
||||
"I understand the risks.", this);
|
||||
}
|
||||
});
|
||||
|
||||
std::set<std::string> rebootKeys = {"AlwaysOnLateral", "HigherBitrate", "NNFF", "UseLateralJerk"};
|
||||
for (const std::string &key : rebootKeys) {
|
||||
QObject::connect(toggles[key], &ToggleControl::toggleFlipped, [this, key]() {
|
||||
if (started) {
|
||||
if (FrogPilotConfirmationDialog::toggle("Reboot required to take effect.", "Reboot Now", this)) {
|
||||
Hardware::soft_reboot();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
QObject::connect(device(), &Device::interactiveTimeout, this, &FrogPilotControlsPanel::hideSubToggles);
|
||||
QObject::connect(parent, &SettingsWindow::closeParentToggle, this, &FrogPilotControlsPanel::hideSubToggles);
|
||||
QObject::connect(parent, &SettingsWindow::closeSubParentToggle, this, &FrogPilotControlsPanel::hideSubSubToggles);
|
||||
QObject::connect(parent, &SettingsWindow::updateMetric, this, &FrogPilotControlsPanel::updateMetric);
|
||||
QObject::connect(uiState(), &UIState::offroadTransition, this, &FrogPilotControlsPanel::updateCarToggles);
|
||||
QObject::connect(uiState(), &UIState::uiUpdate, this, &FrogPilotControlsPanel::updateState);
|
||||
|
||||
hideSubToggles();
|
||||
updateMetric();
|
||||
}
|
||||
|
||||
void FrogPilotControlsPanel::updateState(const UIState &s) {
|
||||
started = s.scene.started;
|
||||
}
|
||||
|
||||
void FrogPilotControlsPanel::updateToggles() {
|
||||
std::thread([this]() {
|
||||
paramsMemory.putBool("FrogPilotTogglesUpdated", true);
|
||||
std::this_thread::sleep_for(std::chrono::seconds(1));
|
||||
paramsMemory.putBool("FrogPilotTogglesUpdated", false);
|
||||
}).detach();
|
||||
}
|
||||
|
||||
void FrogPilotControlsPanel::updateCarToggles() {
|
||||
steerRatioStock = params.getFloat("SteerRatioStock");
|
||||
|
||||
if (steerRatioStock == 0.0) {
|
||||
QTimer *timer = new QTimer(this);
|
||||
timer->setInterval(1000);
|
||||
connect(timer, &QTimer::timeout, this, [this, timer]() {
|
||||
steerRatioStock = params.getFloat("SteerRatioStock");
|
||||
if (steerRatioStock != 0.0) {
|
||||
timer->stop();
|
||||
timer->deleteLater();
|
||||
|
||||
FrogPilotParamValueControl *steerRatioToggle = static_cast<FrogPilotParamValueControl*>(toggles["SteerRatio"]);
|
||||
steerRatioToggle->setTitle(QString("Steer Ratio (Default: %1)").arg(steerRatioStock, 0, 'f', 2));
|
||||
steerRatioToggle->updateControl(steerRatioStock * 0.75, steerRatioStock * 1.25, "", 0.01);
|
||||
steerRatioToggle->refresh();
|
||||
}
|
||||
});
|
||||
timer->start();
|
||||
} else {
|
||||
FrogPilotParamValueControl *steerRatioToggle = static_cast<FrogPilotParamValueControl*>(toggles["SteerRatio"]);
|
||||
steerRatioToggle->setTitle(QString("Steer Ratio (Default: %1)").arg(steerRatioStock, 0, 'f', 2));
|
||||
steerRatioToggle->updateControl(steerRatioStock * 0.75, steerRatioStock * 1.25, "", 0.01);
|
||||
steerRatioToggle->refresh();
|
||||
}
|
||||
}
|
||||
|
||||
void FrogPilotControlsPanel::updateMetric() {
|
||||
bool previousIsMetric = isMetric;
|
||||
isMetric = params.getBool("IsMetric");
|
||||
|
||||
if (isMetric != previousIsMetric) {
|
||||
double distanceConversion = isMetric ? FOOT_TO_METER : METER_TO_FOOT;
|
||||
double speedConversion = isMetric ? MILE_TO_KM : KM_TO_MILE;
|
||||
params.putIntNonBlocking("CESpeed", std::nearbyint(params.getInt("CESpeed") * speedConversion));
|
||||
params.putIntNonBlocking("CESpeedLead", std::nearbyint(params.getInt("CESpeedLead") * speedConversion));
|
||||
params.putIntNonBlocking("LaneDetectionWidth", std::nearbyint(params.getInt("LaneDetectionWidth") * distanceConversion));
|
||||
params.putIntNonBlocking("MTSCLimit", std::nearbyint(params.getInt("MTSCLimit") * speedConversion));
|
||||
params.putIntNonBlocking("Offset1", std::nearbyint(params.getInt("Offset1") * speedConversion));
|
||||
params.putIntNonBlocking("Offset2", std::nearbyint(params.getInt("Offset2") * speedConversion));
|
||||
params.putIntNonBlocking("Offset3", std::nearbyint(params.getInt("Offset3") * speedConversion));
|
||||
params.putIntNonBlocking("Offset4", std::nearbyint(params.getInt("Offset4") * speedConversion));
|
||||
params.putIntNonBlocking("PauseLateralOnSignal", std::nearbyint(params.getInt("PauseLateralOnSignal") * speedConversion));
|
||||
params.putIntNonBlocking("SetSpeedOffset", std::nearbyint(params.getInt("SetSpeedOffset") * speedConversion));
|
||||
params.putIntNonBlocking("StoppingDistance", std::nearbyint(params.getInt("StoppingDistance") * distanceConversion));
|
||||
}
|
||||
|
||||
FrogPilotParamValueControl *laneWidthToggle = static_cast<FrogPilotParamValueControl*>(toggles["LaneDetectionWidth"]);
|
||||
FrogPilotParamValueControl *mtscLimitToggle = static_cast<FrogPilotParamValueControl*>(toggles["MTSCLimit"]);
|
||||
FrogPilotParamValueControl *offset1Toggle = static_cast<FrogPilotParamValueControl*>(toggles["Offset1"]);
|
||||
FrogPilotParamValueControl *offset2Toggle = static_cast<FrogPilotParamValueControl*>(toggles["Offset2"]);
|
||||
FrogPilotParamValueControl *offset3Toggle = static_cast<FrogPilotParamValueControl*>(toggles["Offset3"]);
|
||||
FrogPilotParamValueControl *offset4Toggle = static_cast<FrogPilotParamValueControl*>(toggles["Offset4"]);
|
||||
FrogPilotParamValueControl *pauseLateralToggle = static_cast<FrogPilotParamValueControl*>(toggles["PauseLateralOnSignal"]);
|
||||
FrogPilotParamValueControl *setSpeedOffsetToggle = static_cast<FrogPilotParamValueControl*>(toggles["SetSpeedOffset"]);
|
||||
FrogPilotParamValueControl *stoppingDistanceToggle = static_cast<FrogPilotParamValueControl*>(toggles["StoppingDistance"]);
|
||||
|
||||
if (isMetric) {
|
||||
offset1Toggle->setTitle("Speed Limit Offset (0-34 kph)");
|
||||
offset2Toggle->setTitle("Speed Limit Offset (35-54 kph)");
|
||||
offset3Toggle->setTitle("Speed Limit Offset (55-64 kph)");
|
||||
offset4Toggle->setTitle("Speed Limit Offset (65-99 kph)");
|
||||
|
||||
offset1Toggle->setDescription("Set speed limit offset for limits between 0-34 kph.");
|
||||
offset2Toggle->setDescription("Set speed limit offset for limits between 35-54 kph.");
|
||||
offset3Toggle->setDescription("Set speed limit offset for limits between 55-64 kph.");
|
||||
offset4Toggle->setDescription("Set speed limit offset for limits between 65-99 kph.");
|
||||
|
||||
laneWidthToggle->updateControl(0, 30, " meters", 10);
|
||||
|
||||
mtscLimitToggle->updateControl(0, 99, " kph");
|
||||
|
||||
offset1Toggle->updateControl(-99, 99, " kph");
|
||||
offset2Toggle->updateControl(-99, 99, " kph");
|
||||
offset3Toggle->updateControl(-99, 99, " kph");
|
||||
offset4Toggle->updateControl(-99, 99, " kph");
|
||||
|
||||
pauseLateralToggle->updateControl(0, 150, " kph");
|
||||
setSpeedOffsetToggle->updateControl(0, 150, " kph");
|
||||
|
||||
stoppingDistanceToggle->updateControl(0, 5, " meters");
|
||||
} else {
|
||||
offset1Toggle->setTitle("Speed Limit Offset (0-34 mph)");
|
||||
offset2Toggle->setTitle("Speed Limit Offset (35-54 mph)");
|
||||
offset3Toggle->setTitle("Speed Limit Offset (55-64 mph)");
|
||||
offset4Toggle->setTitle("Speed Limit Offset (65-99 mph)");
|
||||
|
||||
offset1Toggle->setDescription("Set speed limit offset for limits between 0-34 mph.");
|
||||
offset2Toggle->setDescription("Set speed limit offset for limits between 35-54 mph.");
|
||||
offset3Toggle->setDescription("Set speed limit offset for limits between 55-64 mph.");
|
||||
offset4Toggle->setDescription("Set speed limit offset for limits between 65-99 mph.");
|
||||
|
||||
laneWidthToggle->updateControl(0, 100, " feet", 10);
|
||||
|
||||
mtscLimitToggle->updateControl(0, 99, " mph");
|
||||
|
||||
offset1Toggle->updateControl(-99, 99, " mph");
|
||||
offset2Toggle->updateControl(-99, 99, " mph");
|
||||
offset3Toggle->updateControl(-99, 99, " mph");
|
||||
offset4Toggle->updateControl(-99, 99, " mph");
|
||||
|
||||
pauseLateralToggle->updateControl(0, 99, " mph");
|
||||
setSpeedOffsetToggle->updateControl(0, 99, " mph");
|
||||
|
||||
stoppingDistanceToggle->updateControl(0, 10, " feet");
|
||||
}
|
||||
|
||||
laneWidthToggle->refresh();
|
||||
mtscLimitToggle->refresh();
|
||||
offset1Toggle->refresh();
|
||||
offset2Toggle->refresh();
|
||||
offset3Toggle->refresh();
|
||||
offset4Toggle->refresh();
|
||||
pauseLateralToggle->refresh();
|
||||
setSpeedOffsetToggle->refresh();
|
||||
stoppingDistanceToggle->refresh();
|
||||
|
||||
previousIsMetric = isMetric;
|
||||
}
|
||||
|
||||
void FrogPilotControlsPanel::parentToggleClicked() {
|
||||
aggressiveProfile->setVisible(false);
|
||||
conditionalSpeedsImperial->setVisible(false);
|
||||
conditionalSpeedsMetric->setVisible(false);
|
||||
modelSelectorButton->setVisible(false);
|
||||
slcPriorityButton->setVisible(false);
|
||||
standardProfile->setVisible(false);
|
||||
relaxedProfile->setVisible(false);
|
||||
|
||||
openParentToggle();
|
||||
}
|
||||
|
||||
void FrogPilotControlsPanel::subParentToggleClicked() {
|
||||
openSubParentToggle();
|
||||
}
|
||||
|
||||
void FrogPilotControlsPanel::hideSubToggles() {
|
||||
aggressiveProfile->setVisible(false);
|
||||
conditionalSpeedsImperial->setVisible(false);
|
||||
conditionalSpeedsMetric->setVisible(false);
|
||||
modelSelectorButton->setVisible(true);
|
||||
slcPriorityButton->setVisible(false);
|
||||
standardProfile->setVisible(false);
|
||||
relaxedProfile->setVisible(false);
|
||||
|
||||
for (auto &[key, toggle] : toggles) {
|
||||
bool subToggles = aolKeys.find(key.c_str()) != aolKeys.end() ||
|
||||
conditionalExperimentalKeys.find(key.c_str()) != conditionalExperimentalKeys.end() ||
|
||||
experimentalModeActivationKeys.find(key.c_str()) != experimentalModeActivationKeys.end() ||
|
||||
fireTheBabysitterKeys.find(key.c_str()) != fireTheBabysitterKeys.end() ||
|
||||
laneChangeKeys.find(key.c_str()) != laneChangeKeys.end() ||
|
||||
lateralTuneKeys.find(key.c_str()) != lateralTuneKeys.end() ||
|
||||
longitudinalTuneKeys.find(key.c_str()) != longitudinalTuneKeys.end() ||
|
||||
mtscKeys.find(key.c_str()) != mtscKeys.end() ||
|
||||
qolKeys.find(key.c_str()) != qolKeys.end() ||
|
||||
speedLimitControllerKeys.find(key.c_str()) != speedLimitControllerKeys.end() ||
|
||||
speedLimitControllerControlsKeys.find(key.c_str()) != speedLimitControllerControlsKeys.end() ||
|
||||
speedLimitControllerQOLKeys.find(key.c_str()) != speedLimitControllerQOLKeys.end() ||
|
||||
speedLimitControllerVisualsKeys.find(key.c_str()) != speedLimitControllerVisualsKeys.end() ||
|
||||
visionTurnControlKeys.find(key.c_str()) != visionTurnControlKeys.end();
|
||||
toggle->setVisible(!subToggles);
|
||||
}
|
||||
|
||||
closeParentToggle();
|
||||
}
|
||||
|
||||
void FrogPilotControlsPanel::hideSubSubToggles() {
|
||||
slcPriorityButton->setVisible(false);
|
||||
|
||||
for (auto &[key, toggle] : toggles) {
|
||||
bool isVisible = speedLimitControllerKeys.find(key.c_str()) != speedLimitControllerKeys.end();
|
||||
toggle->setVisible(isVisible);
|
||||
}
|
||||
|
||||
closeSubParentToggle();
|
||||
update();
|
||||
}
|
||||
|
||||
void FrogPilotControlsPanel::hideEvent(QHideEvent *event) {
|
||||
hideSubToggles();
|
||||
}
|
||||
@@ -1,66 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <set>
|
||||
|
||||
#include "selfdrive/frogpilot/ui/frogpilot_ui_functions.h"
|
||||
#include "selfdrive/ui/qt/offroad/settings.h"
|
||||
#include "selfdrive/ui/ui.h"
|
||||
|
||||
class FrogPilotControlsPanel : public FrogPilotListWidget {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit FrogPilotControlsPanel(SettingsWindow *parent);
|
||||
|
||||
signals:
|
||||
void closeParentToggle();
|
||||
void closeSubParentToggle();
|
||||
void openParentToggle();
|
||||
void openSubParentToggle();
|
||||
|
||||
private:
|
||||
void hideEvent(QHideEvent *event);
|
||||
void hideSubSubToggles();
|
||||
void hideSubToggles();
|
||||
void parentToggleClicked();
|
||||
void subParentToggleClicked();
|
||||
void updateCarToggles();
|
||||
void updateMetric();
|
||||
void updateState(const UIState &s);
|
||||
void updateToggles();
|
||||
|
||||
ButtonControl *slcPriorityButton;
|
||||
|
||||
FrogPilotButtonIconControl *modelSelectorButton;
|
||||
|
||||
FrogPilotDualParamControl *aggressiveProfile;
|
||||
FrogPilotDualParamControl *conditionalSpeedsImperial;
|
||||
FrogPilotDualParamControl *conditionalSpeedsMetric;
|
||||
FrogPilotDualParamControl *standardProfile;
|
||||
FrogPilotDualParamControl *relaxedProfile;
|
||||
|
||||
std::set<QString> aolKeys = {"AlwaysOnLateralMain", "HideAOLStatusBar"};
|
||||
std::set<QString> conditionalExperimentalKeys = {"CECurves", "CECurvesLead", "CESlowerLead", "CENavigation", "CEStopLights", "CESignal", "HideCEMStatusBar"};
|
||||
std::set<QString> experimentalModeActivationKeys = {"ExperimentalModeViaDistance", "ExperimentalModeViaLKAS", "ExperimentalModeViaScreen"};
|
||||
std::set<QString> fireTheBabysitterKeys = {"NoLogging", "MuteOverheated", "NoUploads", "OfflineMode"};
|
||||
std::set<QString> laneChangeKeys = {"LaneChangeTime", "LaneDetection", "LaneDetectionWidth", "OneLaneChange"};
|
||||
std::set<QString> lateralTuneKeys = {"ForceAutoTune", "NNFF", "SteerRatio", "UseLateralJerk"};
|
||||
std::set<QString> longitudinalTuneKeys = {"AccelerationProfile", "DecelerationProfile", "AggressiveAcceleration", "LeadDetectionThreshold", "SmoothBraking", "StoppingDistance", "TrafficMode"};
|
||||
std::set<QString> mtscKeys = {"DisableMTSCSmoothing", "MTSCAggressiveness", "MTSCCurvatureCheck", "MTSCLimit"};
|
||||
std::set<QString> qolKeys = {"DisableOnroadUploads", "HigherBitrate", "NavChill", "PauseLateralOnSignal", "ReverseCruise", "SetSpeedOffset"};
|
||||
std::set<QString> speedLimitControllerKeys = {"SLCControls", "SLCQOL", "SLCVisuals"};
|
||||
std::set<QString> speedLimitControllerControlsKeys = {"Offset1", "Offset2", "Offset3", "Offset4", "SLCFallback", "SLCOverride", "SLCPriority"};
|
||||
std::set<QString> speedLimitControllerQOLKeys = {"SLCConfirmation", "ForceMPHDashboard", "SetSpeedLimit"};
|
||||
std::set<QString> speedLimitControllerVisualsKeys = {"ShowSLCOffset", "UseVienna"};
|
||||
std::set<QString> visionTurnControlKeys = {"DisableVTSCSmoothing", "CurveSensitivity", "TurnAggressiveness"};
|
||||
|
||||
std::map<std::string, ParamControl*> toggles;
|
||||
|
||||
Params params;
|
||||
Params paramsMemory{"/dev/shm/params"};
|
||||
|
||||
bool isMetric = params.getBool("IsMetric");
|
||||
bool started = false;
|
||||
|
||||
float steerRatioStock = params.getFloat("SteerRatioStock");
|
||||
};
|
||||
@@ -1,42 +0,0 @@
|
||||
#include <filesystem>
|
||||
|
||||
#include "selfdrive/frogpilot/ui/frogpilot_ui_functions.h"
|
||||
#include "selfdrive/ui/ui.h"
|
||||
|
||||
bool FrogPilotConfirmationDialog::toggle(const QString &prompt_text, const QString &confirm_text, QWidget *parent) {
|
||||
ConfirmationDialog d = ConfirmationDialog(prompt_text, confirm_text, tr("Reboot Later"), false, parent);
|
||||
return d.exec();
|
||||
}
|
||||
|
||||
bool FrogPilotConfirmationDialog::toggleAlert(const QString &prompt_text, const QString &button_text, QWidget *parent) {
|
||||
ConfirmationDialog d = ConfirmationDialog(prompt_text, button_text, "", false, parent);
|
||||
return d.exec();
|
||||
}
|
||||
|
||||
bool FrogPilotConfirmationDialog::yesorno(const QString &prompt_text, QWidget *parent) {
|
||||
ConfirmationDialog d = ConfirmationDialog(prompt_text, tr("Yes"), tr("No"), false, parent);
|
||||
return d.exec();
|
||||
}
|
||||
|
||||
FrogPilotButtonIconControl::FrogPilotButtonIconControl(const QString &title, const QString &text, const QString &desc, const QString &icon, QWidget *parent) : AbstractControl(title, desc, icon, parent) {
|
||||
btn.setText(text);
|
||||
btn.setStyleSheet(R"(
|
||||
QPushButton {
|
||||
padding: 0;
|
||||
border-radius: 50px;
|
||||
font-size: 35px;
|
||||
font-weight: 500;
|
||||
color: #E4E4E4;
|
||||
background-color: #393939;
|
||||
}
|
||||
QPushButton:pressed {
|
||||
background-color: #4a4a4a;
|
||||
}
|
||||
QPushButton:disabled {
|
||||
color: #33E4E4E4;
|
||||
}
|
||||
)");
|
||||
btn.setFixedSize(250, 100);
|
||||
QObject::connect(&btn, &QPushButton::clicked, this, &FrogPilotButtonIconControl::clicked);
|
||||
hlayout->addWidget(&btn);
|
||||
}
|
||||
@@ -1,745 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <cmath>
|
||||
|
||||
#include <QTimer>
|
||||
|
||||
#include "selfdrive/ui/qt/widgets/controls.h"
|
||||
|
||||
class FrogPilotConfirmationDialog : public ConfirmationDialog {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit FrogPilotConfirmationDialog(const QString &prompt_text, const QString &confirm_text,
|
||||
const QString &cancel_text, const bool rich, QWidget* parent);
|
||||
static bool toggle(const QString &prompt_text, const QString &confirm_text, QWidget *parent);
|
||||
static bool toggleAlert(const QString &prompt_text, const QString &button_text, QWidget *parent);
|
||||
static bool yesorno(const QString &prompt_text, QWidget *parent);
|
||||
};
|
||||
|
||||
class FrogPilotListWidget : public QWidget {
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit FrogPilotListWidget(QWidget *parent = 0) : QWidget(parent), outer_layout(this) {
|
||||
outer_layout.setMargin(0);
|
||||
outer_layout.setSpacing(0);
|
||||
outer_layout.addLayout(&inner_layout);
|
||||
inner_layout.setMargin(0);
|
||||
inner_layout.setSpacing(25); // default spacing is 25
|
||||
outer_layout.addStretch();
|
||||
}
|
||||
inline void addItem(QWidget *w) { inner_layout.addWidget(w); }
|
||||
inline void addItem(QLayout *layout) { inner_layout.addLayout(layout); }
|
||||
inline void setSpacing(int spacing) { inner_layout.setSpacing(spacing); }
|
||||
|
||||
private:
|
||||
void paintEvent(QPaintEvent *) override {
|
||||
QPainter p(this);
|
||||
p.setPen(Qt::gray);
|
||||
|
||||
int visibleWidgetCount = 0;
|
||||
std::vector<QRect> visibleRects;
|
||||
|
||||
for (int i = 0; i < inner_layout.count(); ++i) {
|
||||
QWidget *widget = inner_layout.itemAt(i)->widget();
|
||||
if (widget && widget->isVisible()) {
|
||||
visibleWidgetCount++;
|
||||
visibleRects.push_back(inner_layout.itemAt(i)->geometry());
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < visibleWidgetCount - 1; ++i) {
|
||||
int bottom = visibleRects[i].bottom() + inner_layout.spacing() / 2;
|
||||
p.drawLine(visibleRects[i].left() + 40, bottom, visibleRects[i].right() - 40, bottom);
|
||||
}
|
||||
}
|
||||
QVBoxLayout outer_layout;
|
||||
QVBoxLayout inner_layout;
|
||||
};
|
||||
|
||||
class FrogPilotDualParamControl : public QFrame {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
FrogPilotDualParamControl(ParamControl *control1, ParamControl *control2, QWidget *parent = nullptr, bool split=false)
|
||||
: QFrame(parent) {
|
||||
QHBoxLayout *hlayout = new QHBoxLayout(this);
|
||||
|
||||
control1->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Preferred);
|
||||
control1->setMaximumWidth(split ? 850 : 700);
|
||||
|
||||
control2->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Preferred);
|
||||
control2->setMaximumWidth(split ? 700 : 850);
|
||||
|
||||
hlayout->addWidget(control1);
|
||||
hlayout->addWidget(control2);
|
||||
}
|
||||
};
|
||||
|
||||
class FrogPilotButtonControl : public AbstractControl {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
FrogPilotButtonControl(const QString &title, const QString &text, const QString &desc = "", QWidget *parent = nullptr);
|
||||
inline void setText(const QString &text) { btn.setText(text); }
|
||||
inline QString text() const { return btn.text(); }
|
||||
|
||||
signals:
|
||||
void clicked();
|
||||
|
||||
public slots:
|
||||
void setEnabled(bool enabled) { btn.setEnabled(enabled); }
|
||||
|
||||
private:
|
||||
QPushButton btn;
|
||||
};
|
||||
|
||||
class FrogPilotButtonIconControl : public AbstractControl {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
FrogPilotButtonIconControl(const QString &title, const QString &text, const QString &desc = "", const QString &icon = "", QWidget *parent = nullptr);
|
||||
inline void setText(const QString &text) { btn.setText(text); }
|
||||
inline QString text() const { return btn.text(); }
|
||||
|
||||
signals:
|
||||
void clicked();
|
||||
|
||||
public slots:
|
||||
void setEnabled(bool enabled) { btn.setEnabled(enabled); }
|
||||
|
||||
private:
|
||||
QPushButton btn;
|
||||
};
|
||||
|
||||
class FrogPilotButtonParamControl : public ParamControl {
|
||||
Q_OBJECT
|
||||
public:
|
||||
FrogPilotButtonParamControl(const QString ¶m, const QString &title, const QString &desc, const QString &icon,
|
||||
const std::vector<QString> &button_texts, const int minimum_button_width = 225)
|
||||
: ParamControl(param, title, desc, icon) {
|
||||
const QString style = R"(
|
||||
QPushButton {
|
||||
border-radius: 50px;
|
||||
font-size: 40px;
|
||||
font-weight: 500;
|
||||
height:100px;
|
||||
padding: 0 25 0 25;
|
||||
color: #E4E4E4;
|
||||
background-color: #393939;
|
||||
}
|
||||
QPushButton:pressed {
|
||||
background-color: #4a4a4a;
|
||||
}
|
||||
QPushButton:checked:enabled {
|
||||
background-color: #33Ab4C;
|
||||
}
|
||||
QPushButton:disabled {
|
||||
color: #33E4E4E4;
|
||||
}
|
||||
)";
|
||||
|
||||
key = param.toStdString();
|
||||
int value = atoi(params.get(key).c_str());
|
||||
|
||||
button_group = new QButtonGroup(this);
|
||||
button_group->setExclusive(true);
|
||||
for (size_t i = 0; i < button_texts.size(); i++) {
|
||||
QPushButton *button = new QPushButton(button_texts[i], this);
|
||||
button->setCheckable(true);
|
||||
button->setChecked(i == value);
|
||||
button->setStyleSheet(style);
|
||||
button->setMinimumWidth(minimum_button_width);
|
||||
hlayout->addWidget(button);
|
||||
button_group->addButton(button, i);
|
||||
}
|
||||
|
||||
QObject::connect(button_group, QOverload<int, bool>::of(&QButtonGroup::buttonToggled), [=](int id, bool checked) {
|
||||
if (checked) {
|
||||
params.put(key, std::to_string(id));
|
||||
refresh();
|
||||
emit buttonClicked(id);
|
||||
}
|
||||
});
|
||||
|
||||
toggle.hide();
|
||||
}
|
||||
|
||||
void setEnabled(bool enable) {
|
||||
for (auto btn : button_group->buttons()) {
|
||||
btn->setEnabled(enable);
|
||||
}
|
||||
}
|
||||
|
||||
signals:
|
||||
void buttonClicked(int id);
|
||||
|
||||
private:
|
||||
std::string key;
|
||||
Params params;
|
||||
QButtonGroup *button_group;
|
||||
};
|
||||
|
||||
class FrogPilotButtonsControl : public ParamControl {
|
||||
Q_OBJECT
|
||||
public:
|
||||
FrogPilotButtonsControl(const QString &title, const QString &desc, const QString &icon,
|
||||
const std::vector<QString> &button_texts, const int minimum_button_width = 225)
|
||||
: ParamControl("", title, desc, icon) {
|
||||
const QString style = R"(
|
||||
QPushButton {
|
||||
border-radius: 50px;
|
||||
font-size: 40px;
|
||||
font-weight: 500;
|
||||
height: 100px;
|
||||
padding: 0 25px 0 25px;
|
||||
color: #E4E4E4;
|
||||
background-color: #393939;
|
||||
}
|
||||
QPushButton:pressed {
|
||||
background-color: #33Ab4C;
|
||||
}
|
||||
QPushButton:disabled {
|
||||
color: #33E4E4E4;
|
||||
}
|
||||
)";
|
||||
|
||||
button_group = new QButtonGroup(this);
|
||||
|
||||
for (size_t i = 0; i < button_texts.size(); i++) {
|
||||
QPushButton *button = new QPushButton(button_texts[i], this);
|
||||
button->setStyleSheet(style);
|
||||
button->setMinimumWidth(minimum_button_width);
|
||||
hlayout->addWidget(button);
|
||||
button_group->addButton(button, static_cast<int>(i));
|
||||
|
||||
connect(button, &QPushButton::clicked, this, [this, i]() {
|
||||
emit buttonClicked(static_cast<int>(i));
|
||||
});
|
||||
}
|
||||
|
||||
toggle.hide();
|
||||
}
|
||||
|
||||
signals:
|
||||
void buttonClicked(int id);
|
||||
|
||||
private:
|
||||
QButtonGroup *button_group;
|
||||
};
|
||||
|
||||
class FrogPilotButtonsParamControl : public ParamControl {
|
||||
Q_OBJECT
|
||||
public:
|
||||
FrogPilotButtonsParamControl(const QString ¶m, const QString &title, const QString &desc, const QString &icon,
|
||||
const std::vector<std::pair<QString, QString>> &button_params)
|
||||
: ParamControl(param, title, desc, icon) {
|
||||
const QString style = R"(
|
||||
QPushButton {
|
||||
border-radius: 50px;
|
||||
font-size: 40px;
|
||||
font-weight: 500;
|
||||
height:100px;
|
||||
padding: 0 25 0 25;
|
||||
color: #E4E4E4;
|
||||
background-color: #393939;
|
||||
}
|
||||
QPushButton:pressed {
|
||||
background-color: #4a4a4a;
|
||||
}
|
||||
QPushButton:checked:enabled {
|
||||
background-color: #33Ab4C;
|
||||
}
|
||||
QPushButton:disabled {
|
||||
color: #33E4E4E4;
|
||||
}
|
||||
)";
|
||||
|
||||
button_group = new QButtonGroup(this);
|
||||
button_group->setExclusive(true);
|
||||
|
||||
for (const auto ¶m_pair : button_params) {
|
||||
const QString ¶m_toggle = param_pair.first;
|
||||
const QString &button_text = param_pair.second;
|
||||
|
||||
QPushButton *button = new QPushButton(button_text, this);
|
||||
button->setCheckable(true);
|
||||
|
||||
bool value = params.getBool(param_toggle.toStdString());
|
||||
button->setChecked(value);
|
||||
button->setStyleSheet(style);
|
||||
button->setMinimumWidth(225);
|
||||
hlayout->addWidget(button);
|
||||
|
||||
QObject::connect(button, &QPushButton::toggled, this, [=](bool checked) {
|
||||
if (checked) {
|
||||
for (const auto &inner_param_pair : button_params) {
|
||||
const QString &inner_param = inner_param_pair.first;
|
||||
params.putBool(inner_param.toStdString(), inner_param == param_toggle);
|
||||
}
|
||||
refresh();
|
||||
emit buttonClicked();
|
||||
}
|
||||
});
|
||||
|
||||
button_group->addButton(button);
|
||||
}
|
||||
|
||||
toggle.hide();
|
||||
}
|
||||
|
||||
void setEnabled(bool enable) {
|
||||
for (auto btn : button_group->buttons()) {
|
||||
btn->setEnabled(enable);
|
||||
}
|
||||
}
|
||||
|
||||
signals:
|
||||
void buttonClicked();
|
||||
|
||||
private:
|
||||
Params params;
|
||||
QButtonGroup *button_group;
|
||||
};
|
||||
|
||||
class FrogPilotParamManageControl : public ParamControl {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
FrogPilotParamManageControl(const QString ¶m, const QString &title, const QString &desc, const QString &icon, QWidget *parent = nullptr, bool hideToggle = false)
|
||||
: ParamControl(param, title, desc, icon, parent),
|
||||
hideToggle(hideToggle),
|
||||
key(param.toStdString()),
|
||||
manageButton(new ButtonControl(tr(""), tr("MANAGE"), tr(""))) {
|
||||
hlayout->insertWidget(hlayout->indexOf(&toggle) - 1, manageButton);
|
||||
|
||||
connect(this, &ToggleControl::toggleFlipped, this, [this](bool state) {
|
||||
refresh();
|
||||
});
|
||||
|
||||
connect(manageButton, &ButtonControl::clicked, this, &FrogPilotParamManageControl::manageButtonClicked);
|
||||
|
||||
if (hideToggle) {
|
||||
toggle.hide();
|
||||
}
|
||||
}
|
||||
|
||||
void refresh() {
|
||||
ParamControl::refresh();
|
||||
manageButton->setVisible(params.getBool(key) || hideToggle);
|
||||
}
|
||||
|
||||
void showEvent(QShowEvent *event) override {
|
||||
ParamControl::showEvent(event);
|
||||
refresh();
|
||||
}
|
||||
|
||||
signals:
|
||||
void manageButtonClicked();
|
||||
|
||||
private:
|
||||
bool hideToggle;
|
||||
std::string key;
|
||||
Params params;
|
||||
ButtonControl *manageButton;
|
||||
};
|
||||
|
||||
class FrogPilotParamToggleControl : public ParamControl {
|
||||
Q_OBJECT
|
||||
public:
|
||||
FrogPilotParamToggleControl(const QString ¶m, const QString &title, const QString &desc,
|
||||
const QString &icon, const std::vector<QString> &button_params,
|
||||
const std::vector<QString> &button_texts, QWidget *parent = nullptr,
|
||||
const int minimum_button_width = 225)
|
||||
: ParamControl(param, title, desc, icon, parent) {
|
||||
|
||||
key = param.toStdString();
|
||||
|
||||
connect(this, &ToggleControl::toggleFlipped, this, [this](bool state) {
|
||||
refreshButtons(state);
|
||||
});
|
||||
|
||||
const QString style = R"(
|
||||
QPushButton {
|
||||
border-radius: 50px;
|
||||
font-size: 40px;
|
||||
font-weight: 500;
|
||||
height:100px;
|
||||
padding: 0 25 0 25;
|
||||
color: #E4E4E4;
|
||||
background-color: #393939;
|
||||
}
|
||||
QPushButton:pressed {
|
||||
background-color: #4a4a4a;
|
||||
}
|
||||
QPushButton:checked:enabled {
|
||||
background-color: #33Ab4C;
|
||||
}
|
||||
QPushButton:disabled {
|
||||
color: #33E4E4E4;
|
||||
}
|
||||
)";
|
||||
|
||||
button_group = new QButtonGroup(this);
|
||||
button_group->setExclusive(false);
|
||||
this->button_params = button_params;
|
||||
|
||||
for (int i = 0; i < button_texts.size(); ++i) {
|
||||
QPushButton *button = new QPushButton(button_texts[i], this);
|
||||
button->setCheckable(true);
|
||||
button->setStyleSheet(style);
|
||||
button->setMinimumWidth(minimum_button_width);
|
||||
button_group->addButton(button, i);
|
||||
|
||||
connect(button, &QPushButton::clicked, [this, i](bool checked) {
|
||||
params.putBool(this->button_params[i].toStdString(), checked);
|
||||
button_group->button(i)->setChecked(checked);
|
||||
emit buttonClicked(checked);
|
||||
});
|
||||
|
||||
hlayout->insertWidget(hlayout->indexOf(&toggle) - 1, button);
|
||||
}
|
||||
}
|
||||
|
||||
void refresh() {
|
||||
bool state = params.getBool(key);
|
||||
if (state != toggle.on) {
|
||||
toggle.togglePosition();
|
||||
}
|
||||
|
||||
refreshButtons(state);
|
||||
updateButtonStates();
|
||||
}
|
||||
|
||||
void refreshButtons(bool state) {
|
||||
for (QAbstractButton *button : button_group->buttons()) {
|
||||
button->setVisible(state);
|
||||
}
|
||||
}
|
||||
|
||||
void updateButtonStates() {
|
||||
for (int i = 0; i < button_group->buttons().size(); ++i) {
|
||||
bool checked = params.getBool(button_params[i].toStdString());
|
||||
QAbstractButton *button = button_group->button(i);
|
||||
if (button) {
|
||||
button->setChecked(checked);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void showEvent(QShowEvent *event) override {
|
||||
refresh();
|
||||
QWidget::showEvent(event);
|
||||
}
|
||||
|
||||
signals:
|
||||
void buttonClicked(const bool checked);
|
||||
|
||||
private:
|
||||
std::string key;
|
||||
Params params;
|
||||
QButtonGroup *button_group;
|
||||
std::vector<QString> button_params;
|
||||
};
|
||||
|
||||
class FrogPilotParamValueControl : public ParamControl {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
FrogPilotParamValueControl(const QString ¶m, const QString &title, const QString &desc, const QString &icon,
|
||||
const float &minValue, const float &maxValue, const std::map<int, QString> &valueLabels,
|
||||
QWidget *parent = nullptr, const bool &loop = true, const QString &label = "",
|
||||
const float &division = 1.0f, const float &intervals = 1.0f)
|
||||
: ParamControl(param, title, desc, icon, parent),
|
||||
minValue(minValue), maxValue(maxValue), valueLabelMappings(valueLabels), loop(loop), labelText(label),
|
||||
division(division), previousValue(0.0f), value(0.0f) {
|
||||
key = param.toStdString();
|
||||
|
||||
valueLabel = new QLabel(this);
|
||||
hlayout->addWidget(valueLabel);
|
||||
|
||||
QPushButton *decrementButton = createButton("-", this);
|
||||
QPushButton *incrementButton = createButton("+", this);
|
||||
|
||||
hlayout->addWidget(decrementButton);
|
||||
hlayout->addWidget(incrementButton);
|
||||
|
||||
countdownTimer = new QTimer(this);
|
||||
countdownTimer->setInterval(150);
|
||||
countdownTimer->setSingleShot(true);
|
||||
|
||||
connect(countdownTimer, &QTimer::timeout, this, &FrogPilotParamValueControl::handleTimeout);
|
||||
|
||||
connect(decrementButton, &QPushButton::pressed, this, [=]() { updateValue(-intervals); });
|
||||
connect(incrementButton, &QPushButton::pressed, this, [=]() { updateValue(intervals); });
|
||||
|
||||
connect(decrementButton, &QPushButton::released, this, &FrogPilotParamValueControl::restartTimer);
|
||||
connect(incrementButton, &QPushButton::released, this, &FrogPilotParamValueControl::restartTimer);
|
||||
|
||||
toggle.hide();
|
||||
}
|
||||
|
||||
void restartTimer() {
|
||||
countdownTimer->stop();
|
||||
countdownTimer->start();
|
||||
}
|
||||
|
||||
void handleTimeout() {
|
||||
previousValue = value;
|
||||
}
|
||||
|
||||
void updateValue(float increment) {
|
||||
if (std::fabs(previousValue - value) > 5.0f && std::fmod(value, 5.0f) == 0.0f) {
|
||||
increment *= 5;
|
||||
}
|
||||
value += increment;
|
||||
|
||||
if (loop) {
|
||||
if (value < minValue) value = maxValue;
|
||||
else if (value > maxValue) value = minValue;
|
||||
} else {
|
||||
value = std::max(minValue, std::min(maxValue, value));
|
||||
}
|
||||
|
||||
params.putFloat(key, value);
|
||||
refresh();
|
||||
emit valueChanged(value);
|
||||
}
|
||||
|
||||
void refresh() {
|
||||
value = params.getFloat(key);
|
||||
|
||||
QString text;
|
||||
auto it = valueLabelMappings.find(value);
|
||||
|
||||
if (division > 1.0f) {
|
||||
text = QString::number(value / division, 'g', division >= 10.0f ? 4 : 3);
|
||||
} else {
|
||||
if (it != valueLabelMappings.end()) {
|
||||
text = it->second;
|
||||
} else {
|
||||
text = QString::number(value, 'g', 4);
|
||||
}
|
||||
}
|
||||
|
||||
if (!labelText.isEmpty()) {
|
||||
text += labelText;
|
||||
}
|
||||
|
||||
valueLabel->setText(text);
|
||||
valueLabel->setStyleSheet("QLabel { color: #E0E879; }");
|
||||
}
|
||||
|
||||
void updateControl(float newMinValue, float newMaxValue, const QString &newLabel, float newDivision = 1.0f) {
|
||||
minValue = newMinValue;
|
||||
maxValue = newMaxValue;
|
||||
labelText = newLabel;
|
||||
division = newDivision;
|
||||
}
|
||||
|
||||
void showEvent(QShowEvent *event) override {
|
||||
refresh();
|
||||
previousValue = value;
|
||||
}
|
||||
|
||||
signals:
|
||||
void valueChanged(float value);
|
||||
|
||||
private:
|
||||
bool loop;
|
||||
float division;
|
||||
float maxValue;
|
||||
float minValue;
|
||||
float previousValue;
|
||||
float value;
|
||||
QLabel *valueLabel;
|
||||
QString labelText;
|
||||
std::map<int, QString> valueLabelMappings;
|
||||
std::string key;
|
||||
Params params;
|
||||
QTimer *countdownTimer;
|
||||
|
||||
QPushButton *createButton(const QString &text, QWidget *parent) {
|
||||
QPushButton *button = new QPushButton(text, parent);
|
||||
button->setFixedSize(150, 100);
|
||||
button->setAutoRepeat(true);
|
||||
button->setAutoRepeatInterval(150);
|
||||
button->setAutoRepeatDelay(500);
|
||||
button->setStyleSheet(R"(
|
||||
QPushButton {
|
||||
border-radius: 50px;
|
||||
font-size: 50px;
|
||||
font-weight: 500;
|
||||
height: 100px;
|
||||
padding: 0 25 0 25;
|
||||
color: #E4E4E4;
|
||||
background-color: #393939;
|
||||
}
|
||||
QPushButton:pressed {
|
||||
background-color: #4a4a4a;
|
||||
}
|
||||
)");
|
||||
return button;
|
||||
}
|
||||
};
|
||||
|
||||
class FrogPilotParamValueToggleControl : public ParamControl {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
FrogPilotParamValueToggleControl(const QString ¶m, const QString &title, const QString &desc, const QString &icon,
|
||||
const int &minValue, const int &maxValue, const std::map<int, QString> &valueLabels,
|
||||
QWidget *parent = nullptr, const bool &loop = true, const QString &label = "", const int &division = 1,
|
||||
const std::vector<QString> &button_params = std::vector<QString>(), const std::vector<QString> &button_texts = std::vector<QString>(),
|
||||
const int minimum_button_width = 225)
|
||||
: ParamControl(param, title, desc, icon, parent),
|
||||
minValue(minValue), maxValue(maxValue), valueLabelMappings(valueLabels), loop(loop), labelText(label), division(division) {
|
||||
key = param.toStdString();
|
||||
|
||||
const QString style = R"(
|
||||
QPushButton {
|
||||
border-radius: 50px;
|
||||
font-size: 40px;
|
||||
font-weight: 500;
|
||||
height:100px;
|
||||
padding: 0 25 0 25;
|
||||
color: #E4E4E4;
|
||||
background-color: #393939;
|
||||
}
|
||||
QPushButton:pressed {
|
||||
background-color: #4a4a4a;
|
||||
}
|
||||
QPushButton:checked:enabled {
|
||||
background-color: #33Ab4C;
|
||||
}
|
||||
QPushButton:disabled {
|
||||
color: #33E4E4E4;
|
||||
}
|
||||
)";
|
||||
|
||||
button_group = new QButtonGroup(this);
|
||||
button_group->setExclusive(false);
|
||||
|
||||
std::map<QString, bool> paramState;
|
||||
for (const QString &button_param : button_params) {
|
||||
paramState[button_param] = params.getBool(button_param.toStdString());
|
||||
}
|
||||
|
||||
for (int i = 0; i < button_texts.size(); ++i) {
|
||||
QPushButton *button = new QPushButton(button_texts[i], this);
|
||||
button->setCheckable(true);
|
||||
button->setChecked(paramState[button_params[i]]);
|
||||
button->setStyleSheet(style);
|
||||
button->setMinimumWidth(minimum_button_width);
|
||||
button_group->addButton(button, i);
|
||||
|
||||
connect(button, &QPushButton::clicked, [this, button_params, i](bool checked) {
|
||||
params.putBool(button_params[i].toStdString(), checked);
|
||||
button_group->button(i)->setChecked(checked);
|
||||
});
|
||||
|
||||
hlayout->addWidget(button);
|
||||
}
|
||||
|
||||
valueLabel = new QLabel(this);
|
||||
hlayout->addWidget(valueLabel);
|
||||
|
||||
QPushButton *decrementButton = createButton("-", this);
|
||||
QPushButton *incrementButton = createButton("+", this);
|
||||
|
||||
hlayout->addWidget(decrementButton);
|
||||
hlayout->addWidget(incrementButton);
|
||||
|
||||
connect(decrementButton, &QPushButton::clicked, this, [=]() {
|
||||
updateValue(-1);
|
||||
});
|
||||
|
||||
connect(incrementButton, &QPushButton::clicked, this, [=]() {
|
||||
updateValue(1);
|
||||
});
|
||||
|
||||
toggle.hide();
|
||||
}
|
||||
|
||||
void updateValue(int increment) {
|
||||
value = value + increment;
|
||||
|
||||
if (loop) {
|
||||
if (value < minValue) value = maxValue;
|
||||
else if (value > maxValue) value = minValue;
|
||||
} else {
|
||||
value = std::max(minValue, std::min(maxValue, value));
|
||||
}
|
||||
|
||||
params.putInt(key, value);
|
||||
refresh();
|
||||
emit valueChanged(value);
|
||||
}
|
||||
|
||||
void refresh() {
|
||||
value = params.getInt(key);
|
||||
|
||||
QString text;
|
||||
auto it = valueLabelMappings.find(value);
|
||||
if (division > 1) {
|
||||
text = QString::number(value / (division * 1.0), 'g');
|
||||
} else {
|
||||
text = it != valueLabelMappings.end() ? it->second : QString::number(value);
|
||||
}
|
||||
if (!labelText.isEmpty()) {
|
||||
text += labelText;
|
||||
}
|
||||
valueLabel->setText(text);
|
||||
valueLabel->setStyleSheet("QLabel { color: #E0E879; }");
|
||||
}
|
||||
|
||||
void updateControl(int newMinValue, int newMaxValue, const QString &newLabel, int newDivision) {
|
||||
minValue = newMinValue;
|
||||
maxValue = newMaxValue;
|
||||
labelText = newLabel;
|
||||
division = newDivision;
|
||||
}
|
||||
|
||||
void showEvent(QShowEvent *event) override {
|
||||
refresh();
|
||||
}
|
||||
|
||||
signals:
|
||||
void valueChanged(int value);
|
||||
|
||||
private:
|
||||
bool loop;
|
||||
int division;
|
||||
int maxValue;
|
||||
int minValue;
|
||||
int value;
|
||||
QButtonGroup *button_group;
|
||||
QLabel *valueLabel;
|
||||
QString labelText;
|
||||
std::map<int, QString> valueLabelMappings;
|
||||
std::string key;
|
||||
Params params;
|
||||
|
||||
QPushButton *createButton(const QString &text, QWidget *parent) {
|
||||
QPushButton *button = new QPushButton(text, parent);
|
||||
button->setFixedSize(150, 100);
|
||||
button->setAutoRepeat(true);
|
||||
button->setAutoRepeatInterval(150);
|
||||
button->setAutoRepeatDelay(350);
|
||||
button->setStyleSheet(R"(
|
||||
QPushButton {
|
||||
border-radius: 50px;
|
||||
font-size: 50px;
|
||||
font-weight: 500;
|
||||
height: 100px;
|
||||
padding: 0 25 0 25;
|
||||
color: #E4E4E4;
|
||||
background-color: #393939;
|
||||
}
|
||||
QPushButton:pressed {
|
||||
background-color: #4a4a4a;
|
||||
}
|
||||
)");
|
||||
return button;
|
||||
}
|
||||
};
|
||||
@@ -1,233 +0,0 @@
|
||||
#include <QDir>
|
||||
#include <QRegularExpression>
|
||||
#include <QTextStream>
|
||||
|
||||
#include "selfdrive/frogpilot/ui/vehicle_settings.h"
|
||||
|
||||
QStringList getCarNames(const QString &carMake) {
|
||||
QMap<QString, QString> makeMap;
|
||||
makeMap["acura"] = "honda";
|
||||
makeMap["audi"] = "volkswagen";
|
||||
makeMap["buick"] = "gm";
|
||||
makeMap["cadillac"] = "gm";
|
||||
makeMap["chevrolet"] = "gm";
|
||||
makeMap["chrysler"] = "chrysler";
|
||||
makeMap["dodge"] = "chrysler";
|
||||
makeMap["ford"] = "ford";
|
||||
makeMap["gm"] = "gm";
|
||||
makeMap["gmc"] = "gm";
|
||||
makeMap["genesis"] = "hyundai";
|
||||
makeMap["honda"] = "honda";
|
||||
makeMap["hyundai"] = "hyundai";
|
||||
makeMap["infiniti"] = "nissan";
|
||||
makeMap["jeep"] = "chrysler";
|
||||
makeMap["kia"] = "hyundai";
|
||||
makeMap["lexus"] = "toyota";
|
||||
makeMap["lincoln"] = "ford";
|
||||
makeMap["man"] = "volkswagen";
|
||||
makeMap["mazda"] = "mazda";
|
||||
makeMap["nissan"] = "nissan";
|
||||
makeMap["ram"] = "chrysler";
|
||||
makeMap["seat"] = "volkswagen";
|
||||
makeMap["subaru"] = "subaru";
|
||||
makeMap["tesla"] = "tesla";
|
||||
makeMap["toyota"] = "toyota";
|
||||
makeMap["volkswagen"] = "volkswagen";
|
||||
makeMap["skoda"] = "volkswagen";
|
||||
|
||||
QString dirPath = "../../selfdrive/car";
|
||||
QDir dir(dirPath);
|
||||
QString targetFolder = makeMap.value(carMake, carMake);
|
||||
QStringList names;
|
||||
|
||||
foreach (const QString &folder, dir.entryList(QDir::Dirs | QDir::NoDotAndDotDot)) {
|
||||
if (folder == targetFolder) {
|
||||
QFile file(dirPath + "/" + folder + "/values.py");
|
||||
if (file.open(QIODevice::ReadOnly | QIODevice::Text)) {
|
||||
QRegularExpression regex("class CAR\\(StrEnum\\):([\\s\\S]*?)(?=^\\w)", QRegularExpression::MultilineOption);
|
||||
QRegularExpressionMatch match = regex.match(QTextStream(&file).readAll());
|
||||
file.close();
|
||||
|
||||
if (match.hasMatch()) {
|
||||
QRegularExpression nameRegex("=\\s*\"([^\"]+)\"");
|
||||
QRegularExpressionMatchIterator it = nameRegex.globalMatch(match.captured(1));
|
||||
while (it.hasNext()) {
|
||||
names << it.next().captured(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
std::sort(names.begin(), names.end());
|
||||
return names;
|
||||
}
|
||||
|
||||
FrogPilotVehiclesPanel::FrogPilotVehiclesPanel(SettingsWindow *parent) : FrogPilotListWidget(parent) {
|
||||
selectMakeButton = new ButtonControl(tr("Select Make"), tr("SELECT"));
|
||||
QObject::connect(selectMakeButton, &ButtonControl::clicked, [this]() {
|
||||
QStringList makes = {
|
||||
"Acura", "Audi", "BMW", "Buick", "Cadillac", "Chevrolet", "Chrysler", "Dodge", "Ford", "GM", "GMC",
|
||||
"Genesis", "Honda", "Hyundai", "Infiniti", "Jeep", "Kia", "Lexus", "Lincoln", "MAN", "Mazda",
|
||||
"Mercedes", "Nissan", "Ram", "SEAT", "Subaru", "Tesla", "Toyota", "Volkswagen", "Volvo", "Škoda",
|
||||
};
|
||||
|
||||
QString newMakeSelection = MultiOptionDialog::getSelection(tr("Select a Make"), makes, "", this);
|
||||
if (!newMakeSelection.isEmpty()) {
|
||||
carMake = newMakeSelection;
|
||||
params.putNonBlocking("CarMake", carMake.toStdString());
|
||||
selectMakeButton->setValue(newMakeSelection);
|
||||
setModels();
|
||||
}
|
||||
});
|
||||
addItem(selectMakeButton);
|
||||
|
||||
selectModelButton = new ButtonControl(tr("Select Model"), tr("SELECT"));
|
||||
QString modelSelection = QString::fromStdString(params.get("CarModel"));
|
||||
QObject::connect(selectModelButton, &ButtonControl::clicked, [this]() {
|
||||
QString newModelSelection = MultiOptionDialog::getSelection(tr("Select a Model"), models, "", this);
|
||||
if (!newModelSelection.isEmpty()) {
|
||||
params.putNonBlocking("CarModel", newModelSelection.toStdString());
|
||||
selectModelButton->setValue(newModelSelection);
|
||||
}
|
||||
});
|
||||
selectModelButton->setValue(modelSelection);
|
||||
addItem(selectModelButton);
|
||||
selectModelButton->setVisible(false);
|
||||
|
||||
ParamControl *forceFingerprint = new ParamControl("ForceFingerprint", "Disable Automatic Fingerprint Detection", "Forces the selected fingerprint and prevents it from ever changing.", "", this);
|
||||
addItem(forceFingerprint);
|
||||
|
||||
ParamControl *disableOpenpilotLong = new ParamControl("DisableOpenpilotLongitudinal", "Disable Openpilot Longitudinal Control", "Disables openpilot longitudinal control to use stock ACC.", "", this);
|
||||
addItem(disableOpenpilotLong);
|
||||
|
||||
QObject::connect(disableOpenpilotLong, &ToggleControl::toggleFlipped, [=]() {
|
||||
if (started) {
|
||||
if (FrogPilotConfirmationDialog::toggle("Reboot required to take effect.", "Reboot Now", this)) {
|
||||
Hardware::reboot();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
std::vector<std::tuple<QString, QString, QString, QString>> vehicleToggles {
|
||||
{"EVTable", "EV Lookup Tables", "Smoothen out the gas and brake controls for EV vehicles.", ""},
|
||||
{"GasRegenCmd", "GM Truck Gas Tune", "Increase acceleration and smoothen brake to stop. For use on Silverado/Sierra only.", ""},
|
||||
{"LongPitch", "Long Pitch Compensation", "Reduce speed and acceleration error for greater passenger comfort and improved vehicle efficiency.", ""},
|
||||
{"LowerVolt", "Lower Volt Enable Speed", "Lower the Volt's minimum enable speed to enable openpilot at any speed.", ""},
|
||||
|
||||
{"CrosstrekTorque", "Subaru Crosstrek Torque Increase", "Increases the maximum allowed torque for the Subaru Crosstrek.", ""},
|
||||
|
||||
{"LockDoors", "Lock Doors In Drive", "Automatically lock the doors when in drive and unlock when in park.", ""},
|
||||
{"LongitudinalTune", "Longitudinal Tune", "Use a custom Toyota longitudinal tune.\n\nCydia = More focused on TSS-P vehicles but works for all Toyotas\n\nDragonPilot = Focused on TSS2 vehicles\n\nFrogPilot = Takes the best of both worlds with some personal tweaks focused around my 2019 Lexus ES 350", ""},
|
||||
{"SNGHack", "Stop and Go Hack", "Enable the 'Stop and Go' hack for vehicles without stock stop and go functionality.", ""},
|
||||
};
|
||||
|
||||
for (const auto &[param, title, desc, icon] : vehicleToggles) {
|
||||
ParamControl *toggle;
|
||||
|
||||
if (param == "LongitudinalTune") {
|
||||
std::vector<std::pair<QString, QString>> tuneOptions{
|
||||
{"StockTune", tr("Stock")},
|
||||
{"CydiaTune", tr("Cydia's")},
|
||||
{"DragonPilotTune", tr("DragonPilot's")},
|
||||
{"FrogsGoMooTune", tr("FrogPilot's")},
|
||||
};
|
||||
toggle = new FrogPilotButtonsParamControl(param, title, desc, icon, tuneOptions);
|
||||
|
||||
QObject::connect(static_cast<FrogPilotButtonsParamControl*>(toggle), &FrogPilotButtonsParamControl::buttonClicked, [this]() {
|
||||
if (started) {
|
||||
if (FrogPilotConfirmationDialog::toggle("Reboot required to take effect.", "Reboot Now", this)) {
|
||||
Hardware::soft_reboot();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
} else {
|
||||
toggle = new ParamControl(param, title, desc, icon, this);
|
||||
}
|
||||
|
||||
toggle->setVisible(false);
|
||||
addItem(toggle);
|
||||
toggles[param.toStdString()] = toggle;
|
||||
|
||||
QObject::connect(toggle, &ToggleControl::toggleFlipped, [this]() {
|
||||
updateToggles();
|
||||
});
|
||||
|
||||
QObject::connect(toggle, &AbstractControl::showDescriptionEvent, [this]() {
|
||||
update();
|
||||
});
|
||||
}
|
||||
|
||||
std::set<std::string> rebootKeys = {"CrosstrekTorque", "GasRegenCmd", "LowerVolt"};
|
||||
for (const std::string &key : rebootKeys) {
|
||||
QObject::connect(toggles[key], &ToggleControl::toggleFlipped, [this]() {
|
||||
if (started) {
|
||||
if (FrogPilotConfirmationDialog::toggle("Reboot required to take effect.", "Reboot Now", this)) {
|
||||
Hardware::soft_reboot();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
QObject::connect(uiState(), &UIState::offroadTransition, this, [this](bool offroad) {
|
||||
if (!offroad) {
|
||||
std::thread([this]() {
|
||||
while (carMake.isEmpty()) {
|
||||
std::this_thread::sleep_for(std::chrono::seconds(1));
|
||||
carMake = QString::fromStdString(params.get("CarMake"));
|
||||
}
|
||||
setModels();
|
||||
}).detach();
|
||||
}
|
||||
});
|
||||
|
||||
QObject::connect(uiState(), &UIState::uiUpdate, this, &FrogPilotVehiclesPanel::updateState);
|
||||
|
||||
carMake = QString::fromStdString(params.get("CarMake"));
|
||||
if (!carMake.isEmpty()) {
|
||||
setModels();
|
||||
}
|
||||
}
|
||||
|
||||
void FrogPilotVehiclesPanel::updateState(const UIState &s) {
|
||||
started = s.scene.started;
|
||||
}
|
||||
|
||||
void FrogPilotVehiclesPanel::updateToggles() {
|
||||
std::thread([this]() {
|
||||
paramsMemory.putBool("FrogPilotTogglesUpdated", true);
|
||||
std::this_thread::sleep_for(std::chrono::seconds(1));
|
||||
paramsMemory.putBool("FrogPilotTogglesUpdated", false);
|
||||
}).detach();
|
||||
}
|
||||
|
||||
void FrogPilotVehiclesPanel::setModels() {
|
||||
models = getCarNames(carMake.toLower());
|
||||
setToggles();
|
||||
}
|
||||
|
||||
void FrogPilotVehiclesPanel::setToggles() {
|
||||
selectMakeButton->setValue(carMake);
|
||||
selectModelButton->setVisible(!carMake.isEmpty());
|
||||
|
||||
bool gm = carMake == "Buick" || carMake == "Cadillac" || carMake == "Chevrolet" || carMake == "GM" || carMake == "GMC";
|
||||
bool subaru = carMake == "Subaru";
|
||||
bool toyota = carMake == "Lexus" || carMake == "Toyota";
|
||||
|
||||
for (auto &[key, toggle] : toggles) {
|
||||
if (toggle) {
|
||||
toggle->setVisible(false);
|
||||
|
||||
if (gm) {
|
||||
toggle->setVisible(gmKeys.find(key.c_str()) != gmKeys.end());
|
||||
} else if (subaru) {
|
||||
toggle->setVisible(subaruKeys.find(key.c_str()) != subaruKeys.end());
|
||||
} else if (toyota) {
|
||||
toggle->setVisible(toyotaKeys.find(key.c_str()) != toyotaKeys.end());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
update();
|
||||
}
|
||||
@@ -1,39 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <set>
|
||||
|
||||
#include <QStringList>
|
||||
|
||||
#include "selfdrive/frogpilot/ui/frogpilot_ui_functions.h"
|
||||
#include "selfdrive/ui/qt/offroad/settings.h"
|
||||
#include "selfdrive/ui/ui.h"
|
||||
|
||||
class FrogPilotVehiclesPanel : public FrogPilotListWidget {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit FrogPilotVehiclesPanel(SettingsWindow *parent);
|
||||
|
||||
private:
|
||||
void setModels();
|
||||
void setToggles();
|
||||
void updateState(const UIState &s);
|
||||
void updateToggles();
|
||||
|
||||
ButtonControl *selectMakeButton;
|
||||
ButtonControl *selectModelButton;
|
||||
|
||||
QString carMake;
|
||||
QStringList models;
|
||||
|
||||
std::map<std::string, ParamControl*> toggles;
|
||||
|
||||
std::set<QString> gmKeys = {"EVTable", "GasRegenCmd", "LongPitch", "LowerVolt"};
|
||||
std::set<QString> subaruKeys = {"CrosstrekTorque"};
|
||||
std::set<QString> toyotaKeys = {"LockDoors", "LongitudinalTune", "SNGHack"};
|
||||
|
||||
Params params;
|
||||
Params paramsMemory{"/dev/shm/params"};
|
||||
|
||||
bool started = false;
|
||||
};
|
||||
@@ -1,388 +0,0 @@
|
||||
#include "selfdrive/frogpilot/ui/visual_settings.h"
|
||||
|
||||
FrogPilotVisualsPanel::FrogPilotVisualsPanel(SettingsWindow *parent) : FrogPilotListWidget(parent) {
|
||||
const std::vector<std::tuple<QString, QString, QString, QString>> visualToggles {
|
||||
{"CustomTheme", "Custom Themes", "Enable the ability to use custom themes.", "../frogpilot/assets/wheel_images/frog.png"},
|
||||
{"HolidayThemes", "Holiday Themes", "The openpilot theme changes according to the current/upcoming holiday. Minor holidays last a day, major holidays (Easter, Christmas, Halloween, etc.) last a week.", ""},
|
||||
{"CustomColors", "Color Theme", "Switch out the standard openpilot color scheme with a custom color scheme.\n\nWant to submit your own color scheme? Post it in the 'feature-request' channel in the FrogPilot Discord!", ""},
|
||||
{"CustomIcons", "Icon Pack", "Switch out the standard openpilot icons with a set of custom icons.\n\nWant to submit your own icon pack? Post it in the 'feature-request' channel in the FrogPilot Discord!", ""},
|
||||
{"CustomSignals", "Turn Signals", "Add custom animations for your turn signals for a personal touch!\n\nWant to submit your own turn signal animation? Post it in the 'feature-request' channel in the FrogPilot Discord!", ""},
|
||||
{"CustomSounds", "Sound Pack", "Switch out the standard openpilot sounds with a set of custom sounds.\n\nWant to submit your own sound pack? Post it in the 'feature-request' channel in the FrogPilot Discord!", ""},
|
||||
|
||||
{"AlertVolumeControl", "Alert Volume Control", "Control the volume level for each individual sound in openpilot.", "../frogpilot/assets/toggle_icons/icon_mute.png"},
|
||||
{"DisengageVolume", "Disengage Volume", "Related alerts:\n\nAdaptive Cruise Disabled\nParking Brake Engaged\nPedal Pressed\nSpeed too Low", ""},
|
||||
{"EngageVolume", "Engage Volume", "Related alerts:\n\nNNFF Torque Controller loaded", ""},
|
||||
{"PromptVolume", "Prompt Volume", "Related alerts:\n\nCar Detected in Blindspot\nLight turned green\nSpeed too Low\nSteer Unavailable Below 'X'\nTake Control, Turn Exceeds Steering Limit", ""},
|
||||
{"PromptDistractedVolume", "Prompt Distracted Volume", "Related alerts:\n\nPay Attention, Driver Distracted\nTouch Steering Wheel, Driver Unresponsive", ""},
|
||||
{"RefuseVolume", "Refuse Volume", "Related alerts:\n\nopenpilot Unavailable", ""},
|
||||
{"WarningSoftVolume", "Warning Soft Volume", "Related alerts:\n\nBRAKE!, Risk of Collision\nTAKE CONTROL IMMEDIATELY", ""},
|
||||
{"WarningImmediateVolume", "Warning Immediate Volume", "Related alerts:\n\nDISENGAGE IMMEDIATELY, Driver Distracted\nDISENGAGE IMMEDIATELY, Driver Unresponsive", ""},
|
||||
|
||||
{"CameraView", "Camera View", "Choose your preferred camera view for the onroad UI. This is a visual change only and doesn't impact openpilot.", "../frogpilot/assets/toggle_icons/icon_camera.png"},
|
||||
{"Compass", "Compass", "Add a compass to your onroad UI.", "../frogpilot/assets/toggle_icons/icon_compass.png"},
|
||||
|
||||
{"CustomAlerts", "Custom Alerts", "Enable custom alerts for various logic or situational changes.", "../frogpilot/assets/toggle_icons/icon_green_light.png"},
|
||||
{"GreenLightAlert", "Green Light Alert", "Get an alert when a traffic light changes from red to green.", ""},
|
||||
{"LeadDepartingAlert", "Lead Departing Alert", "Get an alert when your lead vehicle starts departing when you're at a standstill.", ""},
|
||||
{"LoudBlindspotAlert", "Loud Blindspot Alert", "Enable a louder alert for when a vehicle is detected in your blindspot when attempting to change lanes.", ""},
|
||||
{"SpeedLimitChangedAlert", "Speed Limit Changed Alert", "Trigger an alert whenever the current speed limit changes.", ""},
|
||||
|
||||
{"CustomUI", "Custom Onroad UI", "Customize the Onroad UI with some additional visual functions.", "../assets/offroad/icon_road.png"},
|
||||
{"AccelerationPath", "Acceleration Path", "Visualize the car's intended acceleration or deceleration with a color-coded path.", ""},
|
||||
{"AdjacentPath", "Adjacent Paths", "Display paths to the left and right of your car, visualizing where the model detects lanes.", ""},
|
||||
{"BlindSpotPath", "Blind Spot Path", "Visualize your blind spots with a red path when another vehicle is detected nearby.", ""},
|
||||
{"FPSCounter", "FPS Counter", "Display the Frames Per Second (FPS) of your onroad UI for monitoring system performance.", ""},
|
||||
{"LeadInfo", "Lead Info and Logics", "Get detailed information about the vehicle ahead, including speed and distance, and the logic behind your following distance.", ""},
|
||||
{"PedalsOnUI", "Pedals Being Pressed", "Display which pedals are being pressed on the onroad UI below the steering wheel icon.", ""},
|
||||
{"RoadNameUI", "Road Name", "See the name of the road you're on at the bottom of your screen. Sourced from OpenStreetMap.", ""},
|
||||
|
||||
{"DriverCamera", "Driver Camera On Reverse", "Show the driver's camera feed when you shift to reverse.", "../assets/img_driver_face_static.png"},
|
||||
|
||||
{"ModelUI", "Model UI", "Personalize how the model's visualizations appear on your screen.", "../assets/offroad/icon_calibration.png"},
|
||||
{"DynamicPathWidth", "Dynamic Path Width", "Have the path width dynamically adjust based on the current engagement state of openpilot.", ""},
|
||||
{"HideLeadMarker", "Hide Lead Marker", "Hide the lead marker from the onroad UI.", ""},
|
||||
{"LaneLinesWidth", "Lane Lines", "Adjust the visual thickness of lane lines on your display.\n\nDefault matches the MUTCD average of 4 inches.", ""},
|
||||
{"PathEdgeWidth", "Path Edges", "Adjust the width of the path edges shown on your UI to represent different driving modes and statuses.\n\nDefault is 20% of the total path.\n\nBlue = Navigation\nLight Blue = Always On Lateral\nGreen = Default with 'FrogPilot Colors'\nLight Green = Default with stock colors\nOrange = Experimental Mode Active\nYellow = Conditional Overriden", ""},
|
||||
{"PathWidth", "Path Width", "Customize the width of the driving path shown on your UI.\n\nDefault matches the width of a 2019 Lexus ES 350.", ""},
|
||||
{"RoadEdgesWidth", "Road Edges", "Adjust the visual thickness of road edges on your display.\n\nDefault is 1/2 of the MUTCD average lane line width of 4 inches.", ""},
|
||||
{"UnlimitedLength", "'Unlimited' Road UI Length", "Extend the display of the path, lane lines, and road edges as far as the system can detect, providing a more expansive view of the road ahead.", ""},
|
||||
|
||||
{"NumericalTemp", "Numerical Temperature Gauge", "Replace the 'GOOD', 'OK', and 'HIGH' temperature statuses with a numerical temperature gauge based on the highest temperature between the memory, CPU, and GPU.", "../frogpilot/assets/toggle_icons/icon_temperature.png"},
|
||||
|
||||
{"QOLVisuals", "Quality of Life", "Miscellaneous quality of life changes to improve your overall openpilot experience.", "../frogpilot/assets/toggle_icons/quality_of_life.png"},
|
||||
{"DriveStats", "Drive Stats In Home Screen", "Display your device's drive stats in the home screen.", ""},
|
||||
{"FullMap", "Full Sized Map", "Maximize the size of the map in the onroad UI.", ""},
|
||||
{"HideSpeed", "Hide Speed", "Hide the speed indicator in the onroad UI. Additional toggle allows it to be hidden/shown via tapping the speed itself.", ""},
|
||||
{"MapStyle", "Map Style", "Use a custom map style to be used for 'Navigate on openpilot'.", ""},
|
||||
{"WheelSpeed", "Use Wheel Speed", "Use the wheel speed metric as opposed to the artificial speed.", ""},
|
||||
|
||||
{"RandomEvents", "Random Events", "Enjoy a bit of unpredictability with random events that can occur during certain driving conditions.", "../frogpilot/assets/toggle_icons/icon_random.png"},
|
||||
|
||||
{"ScreenManagement", "Screen Management", "Manage your screen's brightness, timeout settings, and hide specific onroad UI elements.", "../frogpilot/assets/toggle_icons/icon_light.png"},
|
||||
{"HideUIElements", "Hide UI Elements", "Hide the selected UI elements from the onroad screen.", ""},
|
||||
{"ScreenBrightness", "Screen Brightness", "Customize your screen brightness when offroad.", ""},
|
||||
{"ScreenBrightnessOnroad", "Screen Brightness (Onroad)", "Customize your screen brightness when onroad.", ""},
|
||||
{"ScreenRecorder", "Screen Recorder", "Enable the screen recorder button to record the screen.", ""},
|
||||
{"ScreenTimeout", "Screen Timeout", "Customize how long it takes for your screen to turn off.", ""},
|
||||
{"ScreenTimeoutOnroad", "Screen Timeout (Onroad)", "Customize how long it takes for your screen to turn off after going onroad.", ""},
|
||||
{"StandbyMode", "Standby Mode", "Turn the screen off after your screen times out when onroad but wake it back up when engagement state changes or important alerts are triggered.", ""},
|
||||
|
||||
{"WheelIcon", "Steering Wheel Icon", "Replace the default steering wheel icon with a custom design, adding a unique touch to your interface.", "../assets/offroad/icon_openpilot.png"},
|
||||
};
|
||||
|
||||
for (const auto &[param, title, desc, icon] : visualToggles) {
|
||||
ParamControl *toggle;
|
||||
|
||||
if (param == "AlertVolumeControl") {
|
||||
FrogPilotParamManageControl *alertVolumeControlToggle = new FrogPilotParamManageControl(param, title, desc, icon, this);
|
||||
QObject::connect(alertVolumeControlToggle, &FrogPilotParamManageControl::manageButtonClicked, this, [this]() {
|
||||
parentToggleClicked();
|
||||
for (auto &[key, toggle] : toggles) {
|
||||
toggle->setVisible(alertVolumeControlKeys.find(key.c_str()) != alertVolumeControlKeys.end());
|
||||
}
|
||||
});
|
||||
toggle = alertVolumeControlToggle;
|
||||
} else if (alertVolumeControlKeys.find(param) != alertVolumeControlKeys.end()) {
|
||||
if (param == "WarningImmediateVolume") {
|
||||
toggle = new FrogPilotParamValueControl(param, title, desc, icon, 25, 100, std::map<int, QString>(), this, false, "%");
|
||||
} else {
|
||||
toggle = new FrogPilotParamValueControl(param, title, desc, icon, 0, 100, std::map<int, QString>(), this, false, "%");
|
||||
}
|
||||
|
||||
} else if (param == "CameraView") {
|
||||
std::vector<QString> cameraOptions{tr("Auto"), tr("Standard"), tr("Wide"), tr("Driver")};
|
||||
FrogPilotButtonParamControl *preferredCamera = new FrogPilotButtonParamControl(param, title, desc, icon, cameraOptions);
|
||||
toggle = preferredCamera;
|
||||
|
||||
} else if (param == "CustomAlerts") {
|
||||
FrogPilotParamManageControl *customAlertsToggle = new FrogPilotParamManageControl(param, title, desc, icon, this);
|
||||
QObject::connect(customAlertsToggle, &FrogPilotParamManageControl::manageButtonClicked, this, [this]() {
|
||||
parentToggleClicked();
|
||||
for (auto &[key, toggle] : toggles) {
|
||||
toggle->setVisible(customAlertsKeys .find(key.c_str()) != customAlertsKeys .end());
|
||||
}
|
||||
});
|
||||
toggle = customAlertsToggle;
|
||||
|
||||
} else if (param == "CustomTheme") {
|
||||
FrogPilotParamManageControl *customThemeToggle = new FrogPilotParamManageControl(param, title, desc, icon, this);
|
||||
QObject::connect(customThemeToggle, &FrogPilotParamManageControl::manageButtonClicked, this, [this]() {
|
||||
parentToggleClicked();
|
||||
for (auto &[key, toggle] : toggles) {
|
||||
toggle->setVisible(customThemeKeys.find(key.c_str()) != customThemeKeys.end());
|
||||
}
|
||||
});
|
||||
toggle = customThemeToggle;
|
||||
} else if (customThemeKeys.find(param) != customThemeKeys.end() && param != "HolidayThemes") {
|
||||
std::vector<QString> themeOptions{tr("Stock"), tr("Frog"), tr("Tesla"), tr("Stalin")};
|
||||
FrogPilotButtonParamControl *themeSelection = new FrogPilotButtonParamControl(param, title, desc, icon, themeOptions);
|
||||
toggle = themeSelection;
|
||||
|
||||
if (param == "CustomSounds") {
|
||||
QObject::connect(static_cast<FrogPilotButtonParamControl*>(toggle), &FrogPilotButtonParamControl::buttonClicked, [this](int id) {
|
||||
if (id == 1) {
|
||||
if (FrogPilotConfirmationDialog::yesorno("Do you want to enable the bonus 'Goat' sound effect?", this)) {
|
||||
params.putBoolNonBlocking("GoatScream", true);
|
||||
} else {
|
||||
params.putBoolNonBlocking("GoatScream", false);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
} else if (param == "CustomUI") {
|
||||
FrogPilotParamManageControl *customUIToggle = new FrogPilotParamManageControl(param, title, desc, icon, this);
|
||||
QObject::connect(customUIToggle, &FrogPilotParamManageControl::manageButtonClicked, this, [this]() {
|
||||
parentToggleClicked();
|
||||
for (auto &[key, toggle] : toggles) {
|
||||
toggle->setVisible(customOnroadUIKeys.find(key.c_str()) != customOnroadUIKeys.end());
|
||||
}
|
||||
});
|
||||
toggle = customUIToggle;
|
||||
} else if (param == "LeadInfo") {
|
||||
std::vector<QString> leadInfoToggles{"UseSI"};
|
||||
std::vector<QString> leadInfoToggleNames{tr("Use SI Values")};
|
||||
toggle = new FrogPilotParamToggleControl(param, title, desc, icon, leadInfoToggles, leadInfoToggleNames);
|
||||
} else if (param == "AdjacentPath") {
|
||||
std::vector<QString> adjacentPathToggles{"AdjacentPathMetrics"};
|
||||
std::vector<QString> adjacentPathToggleNames{tr("Display Metrics")};
|
||||
toggle = new FrogPilotParamToggleControl(param, title, desc, icon, adjacentPathToggles, adjacentPathToggleNames);
|
||||
|
||||
} else if (param == "ModelUI") {
|
||||
FrogPilotParamManageControl *modelUIToggle = new FrogPilotParamManageControl(param, title, desc, icon, this);
|
||||
QObject::connect(modelUIToggle, &FrogPilotParamManageControl::manageButtonClicked, this, [this]() {
|
||||
parentToggleClicked();
|
||||
for (auto &[key, toggle] : toggles) {
|
||||
toggle->setVisible(modelUIKeys.find(key.c_str()) != modelUIKeys.end());
|
||||
}
|
||||
});
|
||||
toggle = modelUIToggle;
|
||||
} else if (param == "LaneLinesWidth" || param == "RoadEdgesWidth") {
|
||||
toggle = new FrogPilotParamValueControl(param, title, desc, icon, 0, 24, std::map<int, QString>(), this, false, " inches");
|
||||
} else if (param == "PathEdgeWidth") {
|
||||
toggle = new FrogPilotParamValueControl(param, title, desc, icon, 0, 100, std::map<int, QString>(), this, false, "%");
|
||||
} else if (param == "PathWidth") {
|
||||
toggle = new FrogPilotParamValueControl(param, title, desc, icon, 0, 100, std::map<int, QString>(), this, false, " feet", 10);
|
||||
|
||||
} else if (param == "NumericalTemp") {
|
||||
std::vector<QString> temperatureToggles{"Fahrenheit"};
|
||||
std::vector<QString> temperatureToggleNames{tr("Fahrenheit")};
|
||||
toggle = new FrogPilotParamToggleControl(param, title, desc, icon, temperatureToggles, temperatureToggleNames);
|
||||
|
||||
} else if (param == "QOLVisuals") {
|
||||
FrogPilotParamManageControl *qolToggle = new FrogPilotParamManageControl(param, title, desc, icon, this);
|
||||
QObject::connect(qolToggle, &FrogPilotParamManageControl::manageButtonClicked, this, [this]() {
|
||||
parentToggleClicked();
|
||||
for (auto &[key, toggle] : toggles) {
|
||||
toggle->setVisible(qolKeys.find(key.c_str()) != qolKeys.end());
|
||||
}
|
||||
mapStyleButton->setVisible(true);
|
||||
});
|
||||
toggle = qolToggle;
|
||||
} else if (param == "HideSpeed") {
|
||||
std::vector<QString> hideSpeedToggles{"HideSpeedUI"};
|
||||
std::vector<QString> hideSpeedToggleNames{tr("Control Via UI")};
|
||||
toggle = new FrogPilotParamToggleControl(param, title, desc, icon, hideSpeedToggles, hideSpeedToggleNames);
|
||||
} else if (param == "MapStyle") {
|
||||
QMap<int, QString> styleMap = {
|
||||
{0, tr("Stock openpilot")},
|
||||
{1, tr("Mapbox Streets")},
|
||||
{2, tr("Mapbox Outdoors")},
|
||||
{3, tr("Mapbox Light")},
|
||||
{4, tr("Mapbox Dark")},
|
||||
{5, tr("Mapbox Satellite")},
|
||||
{6, tr("Mapbox Satellite Streets")},
|
||||
{7, tr("Mapbox Navigation Day")},
|
||||
{8, tr("Mapbox Navigation Night")},
|
||||
{9, tr("Mapbox Traffic Night")},
|
||||
{10, tr("mike854's (Satellite hybrid)")},
|
||||
};
|
||||
|
||||
QStringList styles = styleMap.values();
|
||||
|
||||
mapStyleButton = new ButtonControl(title, tr("SELECT"), desc);
|
||||
QObject::connect(mapStyleButton, &ButtonControl::clicked, this, [this, styleMap]() {
|
||||
QStringList styles = styleMap.values();
|
||||
QString selection = MultiOptionDialog::getSelection(tr("Select a map style"), styles, "", this);
|
||||
if (!selection.isEmpty()) {
|
||||
int selectedStyle = styleMap.key(selection);
|
||||
params.putInt("MapStyle", selectedStyle);
|
||||
mapStyleButton->setValue(selection);
|
||||
updateToggles();
|
||||
}
|
||||
});
|
||||
|
||||
int currentStyle = params.getInt("MapStyle");
|
||||
mapStyleButton->setValue(styleMap[currentStyle]);
|
||||
|
||||
addItem(mapStyleButton);
|
||||
|
||||
} else if (param == "ScreenManagement") {
|
||||
FrogPilotParamManageControl *screenToggle = new FrogPilotParamManageControl(param, title, desc, icon, this);
|
||||
QObject::connect(screenToggle, &FrogPilotParamManageControl::manageButtonClicked, this, [this]() {
|
||||
parentToggleClicked();
|
||||
for (auto &[key, toggle] : toggles) {
|
||||
toggle->setVisible(screenKeys.find(key.c_str()) != screenKeys.end());
|
||||
}
|
||||
});
|
||||
toggle = screenToggle;
|
||||
} else if (param == "HideUIElements") {
|
||||
std::vector<QString> uiElementsToggles{"HideAlerts", "HideMapIcon", "HideMaxSpeed"};
|
||||
std::vector<QString> uiElementsToggleNames{tr("Alerts"), tr("Map Icon"), tr("Max Speed")};
|
||||
toggle = new FrogPilotParamToggleControl(param, title, desc, icon, uiElementsToggles, uiElementsToggleNames);
|
||||
} else if (param == "ScreenBrightness" || param == "ScreenBrightnessOnroad") {
|
||||
std::map<int, QString> brightnessLabels;
|
||||
for (int i = 0; i <= 101; ++i) {
|
||||
brightnessLabels[i] = i == 0 ? "Screen Off" : i == 101 ? "Auto" : QString::number(i) + "%";
|
||||
}
|
||||
toggle = new FrogPilotParamValueControl(param, title, desc, icon, 0, 101, brightnessLabels, this, false);
|
||||
} else if (param == "ScreenTimeout" || param == "ScreenTimeoutOnroad") {
|
||||
toggle = new FrogPilotParamValueControl(param, title, desc, icon, 5, 60, std::map<int, QString>(), this, false, " seconds");
|
||||
|
||||
} else if (param == "WheelIcon") {
|
||||
std::vector<QString> wheelToggles{"RotatingWheel"};
|
||||
std::vector<QString> wheelToggleNames{tr("Rotating")};
|
||||
std::map<int, QString> steeringWheelLabels = {{-1, "None"}, {0, "Stock"}, {1, "Lexus"}, {2, "Toyota"}, {3, "Frog"}, {4, "Rocket"}, {5, "Hyundai"}, {6, "Stalin"}};
|
||||
toggle = new FrogPilotParamValueToggleControl(param, title, desc, icon, -1, 6, steeringWheelLabels, this, true, "", 1, wheelToggles, wheelToggleNames);
|
||||
|
||||
} else {
|
||||
toggle = new ParamControl(param, title, desc, icon, this);
|
||||
}
|
||||
|
||||
addItem(toggle);
|
||||
toggles[param.toStdString()] = toggle;
|
||||
|
||||
QObject::connect(toggle, &ToggleControl::toggleFlipped, [this]() {
|
||||
updateToggles();
|
||||
});
|
||||
|
||||
QObject::connect(static_cast<FrogPilotButtonParamControl*>(toggle), &FrogPilotButtonParamControl::buttonClicked, [this]() {
|
||||
updateToggles();
|
||||
});
|
||||
|
||||
QObject::connect(static_cast<FrogPilotParamValueControl*>(toggle), &FrogPilotParamValueControl::valueChanged, [this]() {
|
||||
updateToggles();
|
||||
});
|
||||
|
||||
QObject::connect(toggle, &AbstractControl::showDescriptionEvent, [this]() {
|
||||
update();
|
||||
});
|
||||
|
||||
QObject::connect(static_cast<FrogPilotParamManageControl*>(toggle), &FrogPilotParamManageControl::manageButtonClicked, [this]() {
|
||||
update();
|
||||
});
|
||||
}
|
||||
|
||||
std::set<std::string> rebootKeys = {"DriveStats"};
|
||||
for (const std::string &key : rebootKeys) {
|
||||
QObject::connect(toggles[key], &ToggleControl::toggleFlipped, [this, key]() {
|
||||
if (started || key == "DriveStats") {
|
||||
if (FrogPilotConfirmationDialog::toggle("Reboot required to take effect.", "Reboot Now", this)) {
|
||||
Hardware::soft_reboot();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
QObject::connect(device(), &Device::interactiveTimeout, this, &FrogPilotVisualsPanel::hideSubToggles);
|
||||
QObject::connect(parent, &SettingsWindow::closeParentToggle, this, &FrogPilotVisualsPanel::hideSubToggles);
|
||||
QObject::connect(parent, &SettingsWindow::closeSubParentToggle, this, &FrogPilotVisualsPanel::hideSubSubToggles);
|
||||
QObject::connect(parent, &SettingsWindow::updateMetric, this, &FrogPilotVisualsPanel::updateMetric);
|
||||
QObject::connect(uiState(), &UIState::uiUpdate, this, &FrogPilotVisualsPanel::updateState);
|
||||
|
||||
hideSubToggles();
|
||||
updateMetric();
|
||||
}
|
||||
|
||||
void FrogPilotVisualsPanel::updateState(const UIState &s) {
|
||||
started = s.scene.started;
|
||||
}
|
||||
|
||||
void FrogPilotVisualsPanel::updateToggles() {
|
||||
std::thread([this]() {
|
||||
paramsMemory.putBool("FrogPilotTogglesUpdated", true);
|
||||
std::this_thread::sleep_for(std::chrono::seconds(1));
|
||||
paramsMemory.putBool("FrogPilotTogglesUpdated", false);
|
||||
}).detach();
|
||||
}
|
||||
|
||||
void FrogPilotVisualsPanel::updateMetric() {
|
||||
bool previousIsMetric = isMetric;
|
||||
isMetric = params.getBool("IsMetric");
|
||||
|
||||
if (isMetric != previousIsMetric) {
|
||||
double distanceConversion = isMetric ? INCH_TO_CM : CM_TO_INCH;
|
||||
double speedConversion = isMetric ? FOOT_TO_METER : METER_TO_FOOT;
|
||||
params.putIntNonBlocking("LaneLinesWidth", std::nearbyint(params.getInt("LaneLinesWidth") * distanceConversion));
|
||||
params.putIntNonBlocking("RoadEdgesWidth", std::nearbyint(params.getInt("RoadEdgesWidth") * distanceConversion));
|
||||
params.putIntNonBlocking("PathWidth", std::nearbyint(params.getInt("PathWidth") * speedConversion));
|
||||
}
|
||||
|
||||
FrogPilotParamValueControl *laneLinesWidthToggle = static_cast<FrogPilotParamValueControl*>(toggles["LaneLinesWidth"]);
|
||||
FrogPilotParamValueControl *roadEdgesWidthToggle = static_cast<FrogPilotParamValueControl*>(toggles["RoadEdgesWidth"]);
|
||||
FrogPilotParamValueControl *pathWidthToggle = static_cast<FrogPilotParamValueControl*>(toggles["PathWidth"]);
|
||||
|
||||
if (isMetric) {
|
||||
laneLinesWidthToggle->setDescription("Customize the lane line width.\n\nDefault matches the Vienna average of 10 centimeters.");
|
||||
roadEdgesWidthToggle->setDescription("Customize the road edges width.\n\nDefault is 1/2 of the Vienna average lane line width of 10 centimeters.");
|
||||
|
||||
laneLinesWidthToggle->updateControl(0, 60, " centimeters");
|
||||
roadEdgesWidthToggle->updateControl(0, 60, " centimeters");
|
||||
pathWidthToggle->updateControl(0, 30, " meters", 10);
|
||||
} else {
|
||||
laneLinesWidthToggle->setDescription("Customize the lane line width.\n\nDefault matches the MUTCD average of 4 inches.");
|
||||
roadEdgesWidthToggle->setDescription("Customize the road edges width.\n\nDefault is 1/2 of the MUTCD average lane line width of 4 inches.");
|
||||
|
||||
laneLinesWidthToggle->updateControl(0, 24, " inches");
|
||||
roadEdgesWidthToggle->updateControl(0, 24, " inches");
|
||||
pathWidthToggle->updateControl(0, 100, " feet", 10);
|
||||
}
|
||||
|
||||
laneLinesWidthToggle->refresh();
|
||||
roadEdgesWidthToggle->refresh();
|
||||
|
||||
previousIsMetric = isMetric;
|
||||
}
|
||||
|
||||
void FrogPilotVisualsPanel::parentToggleClicked() {
|
||||
mapStyleButton->setVisible(false);
|
||||
|
||||
openParentToggle();
|
||||
}
|
||||
|
||||
void FrogPilotVisualsPanel::subParentToggleClicked() {
|
||||
mapStyleButton->setVisible(false);
|
||||
|
||||
openSubParentToggle();
|
||||
}
|
||||
|
||||
void FrogPilotVisualsPanel::hideSubToggles() {
|
||||
mapStyleButton->setVisible(false);
|
||||
|
||||
for (auto &[key, toggle] : toggles) {
|
||||
bool subToggles = alertVolumeControlKeys.find(key.c_str()) != alertVolumeControlKeys.end() ||
|
||||
customAlertsKeys.find(key.c_str()) != customAlertsKeys.end() ||
|
||||
customOnroadUIKeys.find(key.c_str()) != customOnroadUIKeys.end() ||
|
||||
customThemeKeys.find(key.c_str()) != customThemeKeys.end() ||
|
||||
modelUIKeys.find(key.c_str()) != modelUIKeys.end() ||
|
||||
qolKeys.find(key.c_str()) != qolKeys.end() ||
|
||||
screenKeys.find(key.c_str()) != screenKeys.end();
|
||||
toggle->setVisible(!subToggles);
|
||||
}
|
||||
|
||||
closeParentToggle();
|
||||
}
|
||||
|
||||
void FrogPilotVisualsPanel::hideSubSubToggles() {
|
||||
for (auto &[key, toggle] : toggles) {
|
||||
bool isVisible = false;
|
||||
toggle->setVisible(isVisible);
|
||||
}
|
||||
|
||||
closeSubParentToggle();
|
||||
update();
|
||||
}
|
||||
|
||||
void FrogPilotVisualsPanel::hideEvent(QHideEvent *event) {
|
||||
hideSubToggles();
|
||||
}
|
||||
@@ -1,48 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <set>
|
||||
|
||||
#include "selfdrive/frogpilot/ui/frogpilot_ui_functions.h"
|
||||
#include "selfdrive/ui/qt/offroad/settings.h"
|
||||
#include "selfdrive/ui/ui.h"
|
||||
|
||||
class FrogPilotVisualsPanel : public FrogPilotListWidget {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit FrogPilotVisualsPanel(SettingsWindow *parent);
|
||||
|
||||
signals:
|
||||
void closeParentToggle();
|
||||
void closeSubParentToggle();
|
||||
void openParentToggle();
|
||||
void openSubParentToggle();
|
||||
|
||||
private:
|
||||
void hideEvent(QHideEvent *event);
|
||||
void hideSubToggles();
|
||||
void hideSubSubToggles();
|
||||
void parentToggleClicked();
|
||||
void subParentToggleClicked();
|
||||
void updateMetric();
|
||||
void updateState(const UIState &s);
|
||||
void updateToggles();
|
||||
|
||||
ButtonControl *mapStyleButton;
|
||||
|
||||
std::set<QString> alertVolumeControlKeys = {"EngageVolume", "DisengageVolume", "RefuseVolume", "PromptVolume", "PromptDistractedVolume", "WarningSoftVolume", "WarningImmediateVolume"};
|
||||
std::set<QString> customAlertsKeys = {"GreenLightAlert", "LeadDepartingAlert", "LoudBlindspotAlert", "SpeedLimitChangedAlert"};
|
||||
std::set<QString> customOnroadUIKeys = {"AccelerationPath", "AdjacentPath", "BlindSpotPath", "FPSCounter", "LeadInfo", "PedalsOnUI", "RoadNameUI"};
|
||||
std::set<QString> customThemeKeys = {"HolidayThemes", "CustomColors", "CustomIcons", "CustomSignals", "CustomSounds"};
|
||||
std::set<QString> modelUIKeys = {"DynamicPathWidth", "HideLeadMarker", "LaneLinesWidth", "PathEdgeWidth", "PathWidth", "RoadEdgesWidth", "UnlimitedLength"};
|
||||
std::set<QString> qolKeys = {"DriveStats", "FullMap", "HideSpeed", "MapStyle", "WheelSpeed"};
|
||||
std::set<QString> screenKeys = {"HideUIElements", "ScreenBrightness", "ScreenBrightnessOnroad", "ScreenRecorder", "ScreenTimeout", "ScreenTimeoutOnroad", "StandbyMode"};
|
||||
|
||||
std::map<std::string, ParamControl*> toggles;
|
||||
|
||||
Params params;
|
||||
Params paramsMemory{"/dev/shm/params"};
|
||||
|
||||
bool isMetric = params.getBool("IsMetric");
|
||||
bool started = false;
|
||||
};
|
||||
Reference in New Issue
Block a user