- // Add a submenu for selecting video input, with an action for each input.
- QMenu video_input_submenu;
- QActionGroup video_input_group(&video_input_submenu);
- std::map<uint32_t, string> video_inputs = global_mixer->get_available_video_inputs(current_card);
- uint32_t current_video_input = global_mixer->get_current_video_input(current_card);
- for (const auto &mode : video_inputs) {
- QString description(QString::fromStdString(mode.second));
- QAction *action = new QAction(description, &video_input_group);
- action->setCheckable(true);
- if (mode.first == current_video_input) {
- action->setChecked(true);
+ YCbCrInterpretation current_interpretation = global_mixer->get_input_ycbcr_interpretation(current_card);
+ {
+ QAction *action = new QAction("Auto", &interpretation_group);
+ action->setCheckable(true);
+ if (current_interpretation.ycbcr_coefficients_auto) {
+ action->setChecked(true);
+ }
+ action->setData(QList<QVariant>{"interpretation", true, YCBCR_REC_709, false});
+ interpretation_submenu.addAction(action);
+ }
+ for (YCbCrLumaCoefficients ycbcr_coefficients : { YCBCR_REC_709, YCBCR_REC_601 }) {
+ for (bool full_range : { false, true }) {
+ std::string description;
+ if (ycbcr_coefficients == YCBCR_REC_709) {
+ description = "Rec. 709 (HD)";
+ } else {
+ description = "Rec. 601 (SD)";
+ }
+ if (full_range) {
+ description += ", full range (nonstandard)";
+ }
+ QAction *action = new QAction(QString::fromStdString(description), &interpretation_group);
+ action->setCheckable(true);
+ if (!current_interpretation.ycbcr_coefficients_auto &&
+ ycbcr_coefficients == current_interpretation.ycbcr_coefficients &&
+ full_range == current_interpretation.full_range) {
+ action->setChecked(true);
+ }
+ action->setData(QList<QVariant>{"interpretation", false, ycbcr_coefficients, full_range});
+ interpretation_submenu.addAction(action);
+ }