Added boolean option type config code for libav.

This commit is contained in:
mjbudd77 2021-09-22 22:31:32 -04:00
parent 1f1551a716
commit f774d320de
2 changed files with 42 additions and 0 deletions

View File

@ -3322,6 +3322,30 @@ LibavEncOptInputWin::LibavEncOptInputWin( LibavEncOptItem *itemIn, QWidget *pare
grid->addWidget( denEntry, 4, 1 );
}
break;
case AV_OPT_TYPE_BOOL:
{
int64_t val;
QCheckBox *c;
av_opt_get_int( obj, opt->name, 0, &val );
grid->addWidget( new QLabel( tr("Default:") ), 2, 0 );
sprintf( stmp, "%s", opt->default_val.i64 ? "true" : "false" );
grid->addWidget( new QLabel( tr(stmp) ), 2, 1 );
grid->addWidget( new QLabel( tr("Value:") ), 3, 0 );
c = new QCheckBox( tr("Checked=true") );
c->setChecked( val != 0 );
chkBox.push_back(c);
grid->addWidget( c, 3, 1 );
}
break;
default:
break;
@ -3424,6 +3448,14 @@ void LibavEncOptInputWin::applyChanges(void)
av_opt_set_q( item->obj, item->opt->name, q, 0 );
}
break;
case AV_OPT_TYPE_BOOL:
{
if ( chkBox.size() > 0 )
{
av_opt_set_int( item->obj, item->opt->name, chkBox[0]->isChecked(), 0 );
}
}
break;
default:
break;
}
@ -3494,6 +3526,14 @@ void LibavEncOptInputWin::resetDefaultsCB(void)
}
}
break;
case AV_OPT_TYPE_BOOL:
{
if ( chkBox.size() > 0 )
{
chkBox[0]->setChecked( item->opt->default_val.i64 != 0 );
}
}
break;
default:
break;

View File

@ -17,6 +17,7 @@
#include <QLineEdit>
#include <QComboBox>
#include <QGroupBox>
#include <QCheckBox>
#include <QPushButton>
#include <QTreeWidget>
#include <QTreeWidgetItem>
@ -121,6 +122,7 @@ protected:
QPushButton *okButton;
QPushButton *cancelButton;
QPushButton *resetDefaults;
std::vector <QCheckBox*> chkBox;
public slots:
void closeWindow(void);