Added libav audio encoder config window.

This commit is contained in:
mjbudd77 2021-09-21 22:54:32 -04:00
parent d20a7bb452
commit 135325f9ae
2 changed files with 22 additions and 9 deletions

View File

@ -850,7 +850,7 @@ int saveCodecConfig( int type, const char *codec_name, AVCodecContext *ctx)
} }
if ( buffer ) if ( buffer )
{ {
av_free(buffer); av_free(buffer); buffer = NULL;
} }
return 0; return 0;
} }
@ -2307,7 +2307,7 @@ LibavOptionsPage::LibavOptionsPage(QWidget *parent)
{ {
QLabel *lbl; QLabel *lbl;
QVBoxLayout *vbox, *vbox1; QVBoxLayout *vbox, *vbox1;
QHBoxLayout *hbox; //QHBoxLayout *hbox;
QGridLayout *grid; QGridLayout *grid;
QPushButton *videoConfBtn, *audioConfBtn; QPushButton *videoConfBtn, *audioConfBtn;
@ -2344,11 +2344,13 @@ LibavOptionsPage::LibavOptionsPage(QWidget *parent)
vbox = new QVBoxLayout(); vbox = new QVBoxLayout();
audioGbox->setLayout(vbox); audioGbox->setLayout(vbox);
hbox = new QHBoxLayout(); grid = new QGridLayout();
vbox->addLayout(hbox); vbox->addLayout(grid);
lbl = new QLabel( tr("Encoder:") ); lbl = new QLabel( tr("Encoder:") );
hbox->addWidget( lbl, 1 ); grid->addWidget( lbl, 0, 0);
hbox->addWidget( audioEncSel, 5 ); grid->addWidget( audioEncSel, 0, 1 );
audioConfBtn = new QPushButton( tr("Options...") );
grid->addWidget( audioConfBtn, 1, 1);
initCodecLists(); initCodecLists();
@ -2360,6 +2362,7 @@ LibavOptionsPage::LibavOptionsPage(QWidget *parent)
connect(videoPixfmt, SIGNAL(currentIndexChanged(int)), this, SLOT(videoPixelFormatChanged(int))); connect(videoPixfmt, SIGNAL(currentIndexChanged(int)), this, SLOT(videoPixelFormatChanged(int)));
connect(videoConfBtn, SIGNAL(clicked(void)), this, SLOT(openVideoCodecOptions(void))); connect(videoConfBtn, SIGNAL(clicked(void)), this, SLOT(openVideoCodecOptions(void)));
connect(audioConfBtn, SIGNAL(clicked(void)), this, SLOT(openAudioCodecOptions(void)));
} }
//----------------------------------------------------- //-----------------------------------------------------
LibavOptionsPage::~LibavOptionsPage(void) LibavOptionsPage::~LibavOptionsPage(void)
@ -2566,6 +2569,13 @@ void LibavOptionsPage::openVideoCodecOptions(void)
win->show(); win->show();
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void LibavOptionsPage::openAudioCodecOptions(void)
{
LibavEncOptWin *win = new LibavEncOptWin(1,this);
win->show();
}
//----------------------------------------------------------------------------
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
LibavEncOptItem::LibavEncOptItem(QTreeWidgetItem *parent) LibavEncOptItem::LibavEncOptItem(QTreeWidgetItem *parent)
@ -2597,7 +2607,7 @@ void LibavEncOptItem::setValueText(void *obj)
} }
if ( s != NULL ) if ( s != NULL )
{ {
av_free(s); av_free(s); s = NULL;
} }
if ( units.size() > 0 ) if ( units.size() > 0 )
@ -2676,19 +2686,21 @@ LibavEncOptWin::LibavEncOptWin(int type, QWidget *parent)
const AVCodec *codec; const AVCodec *codec;
const AVOption *opt; const AVOption *opt;
bool useOpt, newOpt; bool useOpt, newOpt;
char title[128];
this->type = type; this->type = type;
if ( type ) if ( type )
{ {
setWindowTitle("Audio Encoder Configuration");
codec_name = LIBAV::audio_st.selEnc.c_str(); codec_name = LIBAV::audio_st.selEnc.c_str();
sprintf( title, "%s Audio Encoder Configuration", codec_name );
} }
else else
{ {
setWindowTitle("Video Encoder Configuration");
codec_name = LIBAV::video_st.selEnc.c_str(); codec_name = LIBAV::video_st.selEnc.c_str();
sprintf( title, "%s Video Encoder Configuration", codec_name );
} }
setWindowTitle( title );
resize(512, 512); resize(512, 512);
/* find the video encoder */ /* find the video encoder */

View File

@ -139,6 +139,7 @@ class LibavOptionsPage : public QWidget
private slots: private slots:
void openVideoCodecOptions(void); void openVideoCodecOptions(void);
void openAudioCodecOptions(void);
void videoCodecChanged(int idx); void videoCodecChanged(int idx);
void audioCodecChanged(int idx); void audioCodecChanged(int idx);
void videoPixelFormatChanged(int idx); void videoPixelFormatChanged(int idx);