Moved all avi config parameters/options to motion options window for Qt GUI.

This commit is contained in:
mjbudd77 2021-09-24 16:31:19 -04:00
parent 819357129f
commit 3fc74aedbe
8 changed files with 472 additions and 60 deletions

View File

@ -82,6 +82,7 @@ static int abufTail = 0;
static int abufSize = 0;
static uint32_t *rawVideoBuf = NULL;
static int16_t *rawAudioBuf = NULL;
static int aviDriver = 0;
static int videoFormat = AVI_RGB24;
static int audioSampleRate = 48000;
static FILE *avLogFp = NULL;
@ -1113,14 +1114,16 @@ static int initVideoStream( const char *codec_name, OutputStream *ost )
fprintf( avLogFp, "Error: Could not alloc an video encoding context\n");
return -1;
}
/* Put sample parameters. */
c->bit_rate = 400000;
c->gop_size = 12; /* emit one intra frame every twelve frames at most */
loadCodecConfig( 0, codec_name, c );
ost->enc = c;
//av_opt_show2( (void*)c, NULL, AV_OPT_FLAG_VIDEO_PARAM, 0 );
/* Put sample parameters. */
c->bit_rate = 400000;
/* Resolution must be a multiple of two. */
c->width = nes_shm->video.ncol;
c->height = nes_shm->video.nrow;
@ -1141,7 +1144,6 @@ static int initVideoStream( const char *codec_name, OutputStream *ost )
ost->st->time_base.den = 1000000u;
}
c->time_base = ost->st->time_base;
c->gop_size = 12; /* emit one intra frame every twelve frames at most */
//c->pix_fmt = AV_PIX_FMT_YUV420P; // Every video encoder seems to accept this
c->pix_fmt = (AVPixelFormat)ost->pixelFormat;
@ -1946,6 +1948,25 @@ static int close(void)
} // End namespace LIBAV
#endif
//**************************************************************************************
int aviRecordInit(void)
{
g_config->getOption("SDL.AviDriver", &aviDriver);
g_config->getOption("SDL.AviVideoFormat", &videoFormat);
g_config->getOption("SDL.AviRecordAudio", &recordAudio);
g_config->getOption("SDL.Sound.Rate", &audioSampleRate);
// LIBAV has its own internal video format configs,
// it does not use this videoFormat symbol.
if ( videoFormat == AVI_LIBAV )
{
aviSetSelVideoFormat( AVI_RGB24 );
}
#ifdef _USE_LIBAV
LIBAV::setCodecFromConfig();
#endif
return 0;
}
//**************************************************************************************
int aviRecordLogClose(void)
{
if ( avLogFp != NULL )
@ -2052,8 +2073,10 @@ int aviRecordOpenFile( const char *filepath )
}
}
g_config->getOption("SDL.AviVideoFormat", &videoFormat);
#ifdef WIN32
if ( videoFormat == AVI_VFW )
if ( (aviDriver == AVI_DRIVER_LIBGWAVI) && (videoFormat == AVI_VFW) )
{
if ( VFW::chooseConfig( nes_shm->video.ncol, nes_shm->video.nrow ) )
{
@ -2105,7 +2128,7 @@ int aviRecordOpenFile( const char *filepath )
#endif
#ifdef _USE_LIBAV
if ( videoFormat == AVI_LIBAV )
if ( aviDriver == AVI_DRIVER_LIBAV )
{
if ( LIBAV::initMedia( fileName ) )
{
@ -2302,6 +2325,19 @@ void FCEUD_AviStop(void)
// return;
//}
//**************************************************************************************
int aviGetSelDriver(void)
{
return aviDriver;
}
//**************************************************************************************
void aviSetSelDriver(int idx)
{
aviDriver = idx;
//printf("AVI Driver Changed:%i\n", aviDriver );
g_config->setOption("SDL.AviDriver", aviDriver);
}
//**************************************************************************************
int aviGetSelVideoFormat(void)
{
return videoFormat;
@ -2315,6 +2351,31 @@ void aviSetSelVideoFormat(int idx)
g_config->setOption("SDL.AviVideoFormat", videoFormat);
}
//**************************************************************************************
int FCEUD_AviGetDriverList( std::vector <std::string> &formatList )
{
std::string s;
for (int i=0; i<AVI_NUM_DRIVERS; i++)
{
switch ( i )
{
default:
s.assign("Unknown");
break;
case AVI_DRIVER_LIBGWAVI:
s.assign("libgwavi");
break;
#ifdef _USE_LIBAV
case AVI_DRIVER_LIBAV:
s.assign("libav (ffmpeg)");
break;
#endif
}
formatList.push_back(s);
}
return AVI_NUM_DRIVERS;
}
//**************************************************************************************
int FCEUD_AviGetFormatOpts( std::vector <std::string> &formatList )
{
std::string s;
@ -2408,7 +2469,16 @@ void AviRecordDiskThread_t::run(void)
// Error allocating buffer.
return;
}
localVideoFormat = videoFormat;
#ifdef _USE_LIBAV
if ( aviDriver == AVI_DRIVER_LIBAV )
{
localVideoFormat = AVI_LIBAV;
}
else
#endif
{
localVideoFormat = videoFormat;
}
localRecordAudio = recordAudio;
#ifdef _USE_X264
@ -2488,7 +2558,6 @@ void AviRecordDiskThread_t::run(void)
//Convert_4byte_To_I420Frame<4>(videoOut,rgb24,numPixels,width);
//convertRgb_32_to_24( (const unsigned char*)videoOut, rgb24,
// width, height, numPixels, true );
//LIBAV::encode_video_frame( rgb24 );
LIBAV::encode_video_frame( (unsigned char*)videoOut );
}
#endif
@ -2609,8 +2678,8 @@ LibavOptionsPage::LibavOptionsPage(QWidget *parent)
videoGbox = new QGroupBox( tr("Video:") );
audioGbox = new QGroupBox( tr("Audio:") );
audioGbox->setCheckable(true);
audioGbox->setChecked( aviGetAudioEnable() );
audioGbox->setCheckable(false);
//audioGbox->setChecked( aviGetAudioEnable() );
videoEncSel = new QComboBox();
audioEncSel = new QComboBox();
@ -2671,12 +2740,23 @@ LibavOptionsPage::LibavOptionsPage(QWidget *parent)
connect(videoConfBtn, SIGNAL(clicked(void)), this, SLOT(openVideoCodecOptions(void)));
connect(audioConfBtn, SIGNAL(clicked(void)), this, SLOT(openAudioCodecOptions(void)));
connect(audioGbox, SIGNAL(clicked(bool)), this, SLOT(includeAudioChanged(bool)));
//connect(audioGbox, SIGNAL(clicked(bool)), this, SLOT(includeAudioChanged(bool)));
updateTimer = new QTimer(this);
connect( updateTimer, &QTimer::timeout, this, &LibavOptionsPage::periodicUpdate );
updateTimer->start(200);
}
//-----------------------------------------------------
LibavOptionsPage::~LibavOptionsPage(void)
{
updateTimer->stop();
}
//-----------------------------------------------------
void LibavOptionsPage::periodicUpdate(void)
{
audioGbox->setEnabled( recordAudio );
}
//-----------------------------------------------------
void LibavOptionsPage::initPixelFormatSelect(const char *codec_name)
@ -3908,3 +3988,224 @@ void LibavEncOptInputWin::resetDefaultsCB(void)
//-----------------------------------------------------
#endif
//**************************************************************************************
LibgwaviOptionsPage::LibgwaviOptionsPage(QWidget *parent)
: QWidget(parent)
{
QLabel *lbl;
QVBoxLayout *vbox, *vbox1;
//QHBoxLayout *hbox;
QGridLayout *grid;
QPushButton *videoConfBtn, *audioConfBtn;
g_config->getOption("SDL.AviRecordAudio", &recordAudio);
LIBAV::setCodecFromConfig();
vbox1 = new QVBoxLayout();
videoGbox = new QGroupBox( tr("Video:") );
audioGbox = new QGroupBox( tr("Audio:") );
audioGbox->setCheckable(false);
//audioGbox->setChecked( aviGetAudioEnable() );
videoEncSel = new QComboBox();
audioEncSel = new QComboBox();
videoPixfmt = new QComboBox();
audioSamplefmt = new QComboBox();
audioSampleRate = new QComboBox();
audioChanLayout = new QComboBox();
vbox1->addWidget( videoGbox );
vbox1->addWidget( audioGbox );
vbox = new QVBoxLayout();
videoGbox->setLayout(vbox);
grid = new QGridLayout();
vbox->addLayout(grid);
lbl = new QLabel( tr("Encoder:") );
grid->addWidget( lbl, 0, 0);
grid->addWidget( videoEncSel, 0, 1);
lbl = new QLabel( tr("Pixel Format:") );
grid->addWidget( lbl, 1, 0);
grid->addWidget( videoPixfmt, 1, 1);
videoConfBtn = new QPushButton( tr("Options...") );
grid->addWidget( videoConfBtn, 2, 1);
vbox = new QVBoxLayout();
audioGbox->setLayout(vbox);
grid = new QGridLayout();
vbox->addLayout(grid);
lbl = new QLabel( tr("Encoder:") );
grid->addWidget( lbl, 0, 0);
grid->addWidget( audioEncSel, 0, 1 );
lbl = new QLabel( tr("Sample Format:") );
grid->addWidget( lbl, 1, 0);
grid->addWidget( audioSamplefmt, 1, 1);
lbl = new QLabel( tr("Sample Rate:") );
grid->addWidget( lbl, 2, 0);
grid->addWidget( audioSampleRate, 2, 1);
lbl = new QLabel( tr("Channel Layout:") );
grid->addWidget( lbl, 3, 0);
grid->addWidget( audioChanLayout, 3, 1);
audioConfBtn = new QPushButton( tr("Options...") );
grid->addWidget( audioConfBtn, 4, 1);
initCodecLists();
setLayout(vbox1);
connect(videoEncSel, SIGNAL(currentIndexChanged(int)), this, SLOT(videoCodecChanged(int)));
connect(audioEncSel, SIGNAL(currentIndexChanged(int)), this, SLOT(audioCodecChanged(int)));
connect(videoPixfmt , SIGNAL(currentIndexChanged(int)), this, SLOT(videoPixelFormatChanged(int)));
connect(audioSamplefmt , SIGNAL(currentIndexChanged(int)), this, SLOT(audioSampleFormatChanged(int)));
connect(audioSampleRate, SIGNAL(currentIndexChanged(int)), this, SLOT(audioSampleRateChanged(int)));
connect(audioChanLayout, SIGNAL(currentIndexChanged(int)), this, SLOT(audioChannelLayoutChanged(int)));
connect(videoConfBtn, SIGNAL(clicked(void)), this, SLOT(openVideoCodecOptions(void)));
connect(audioConfBtn, SIGNAL(clicked(void)), this, SLOT(openAudioCodecOptions(void)));
updateTimer = new QTimer(this);
connect( updateTimer, &QTimer::timeout, this, &LibgwaviOptionsPage::periodicUpdate );
updateTimer->start(200);
}
//-----------------------------------------------------
LibgwaviOptionsPage::~LibgwaviOptionsPage(void)
{
updateTimer->stop();
}
//-----------------------------------------------------
void LibgwaviOptionsPage::periodicUpdate(void)
{
audioGbox->setEnabled( recordAudio );
}
//-----------------------------------------------------
void LibgwaviOptionsPage::initCodecLists(void)
{
int videoEncoder = aviGetSelVideoFormat();
videoEncSel->addItem( tr("RGB24 (Uncompressed)"), AVI_RGB24 );
videoEncSel->addItem( tr("I420 (YUV 4:2:0)") , AVI_I420 );
#ifdef _USE_X264
videoEncSel->addItem( tr("X264 (H.264)") , AVI_X264 );
#endif
#ifdef _USE_X265
videoEncSel->addItem( tr("X265 (H.265)") , AVI_X265 );
#endif
#ifdef WIN32
videoEncSel->addItem( tr("VfW (Video for Windows)"), AVI_VFW);
#endif
for (int i=0; i<videoEncSel->count(); i++)
{
if ( videoEncoder == videoEncSel->itemData(i).toInt() )
{
videoEncSel->setCurrentIndex(i); break;
}
}
audioEncSel->addItem( tr("Raw PCM (Uncompressed)"), 0 );
int audioEncoder = audioEncSel->currentData().toInt();
initPixelFormatSelect(videoFormat);
initSampleFormatSelect(audioEncoder);
initSampleRateSelect(audioEncoder);
initChannelLayoutSelect(audioEncoder);
}
//-----------------------------------------------------
void LibgwaviOptionsPage::initPixelFormatSelect( int encoder )
{
videoPixfmt->clear();
videoPixfmt->addItem( tr("Auto"), -1 );
switch ( encoder )
{
default:
case AVI_I420:
videoPixfmt->addItem( tr("YUV 420"), AVI_I420 );
break;
case AVI_X264:
case AVI_X265:
videoPixfmt->addItem( tr("YUV 420"), AVI_I420 );
break;
#ifdef WIN32
case AVI_VFW:
#endif
case AVI_RGB24:
videoPixfmt->addItem( tr("RGB24"), AVI_RGB24 );
break;
}
}
//-----------------------------------------------------
void LibgwaviOptionsPage::initSampleFormatSelect( int encoder )
{
audioSamplefmt->clear();
audioSamplefmt->addItem( tr("Auto"), -1 );
audioSamplefmt->addItem( tr("S16 - Signed 16 Bit") , 0 );
}
//-----------------------------------------------------
void LibgwaviOptionsPage::initSampleRateSelect( int encoder )
{
audioSampleRate->clear();
audioSampleRate->addItem( tr("Auto"), -1 );
}
//-----------------------------------------------------
void LibgwaviOptionsPage::initChannelLayoutSelect( int encoder )
{
audioChanLayout->clear();
audioChanLayout->addItem( tr("Auto"), -1 );
audioChanLayout->addItem( tr("Mono"), 0 );
}
//-----------------------------------------------------
void LibgwaviOptionsPage::videoCodecChanged(int idx)
{
aviSetSelVideoFormat( videoEncSel->currentData().toInt() );
initPixelFormatSelect(videoFormat);
}
//-----------------------------------------------------
void LibgwaviOptionsPage::audioCodecChanged(int idx)
{
int audioEncoder = audioEncSel->currentData().toInt();
initSampleFormatSelect(audioEncoder);
initSampleRateSelect(audioEncoder);
initChannelLayoutSelect(audioEncoder);
}
//-----------------------------------------------------
void LibgwaviOptionsPage::openVideoCodecOptions(void)
{
}
//-----------------------------------------------------
void LibgwaviOptionsPage::openAudioCodecOptions(void)
{
}
//-----------------------------------------------------
void LibgwaviOptionsPage::videoPixelFormatChanged(int idx)
{
}
//-----------------------------------------------------
void LibgwaviOptionsPage::audioSampleFormatChanged(int idx)
{
}
//-----------------------------------------------------
void LibgwaviOptionsPage::audioSampleRateChanged(int idx)
{
}
//-----------------------------------------------------
void LibgwaviOptionsPage::audioChannelLayoutChanged(int idx)
{
}
//-----------------------------------------------------
//**************************************************************************************

View File

@ -22,6 +22,15 @@
#include <QTreeWidget>
#include <QTreeWidgetItem>
enum aviDriverList
{
#ifdef _USE_LIBAV
AVI_DRIVER_LIBAV,
#endif
AVI_DRIVER_LIBGWAVI,
AVI_NUM_DRIVERS
};
enum aviEncoderList
{
AVI_RGB24 = 0,
@ -41,6 +50,8 @@ enum aviEncoderList
AVI_NUM_ENC
};
int aviRecordInit(void);
int aviRecordOpenFile( const char *filepath );
int aviRecordAddFrame( void );
@ -55,10 +66,16 @@ bool aviGetAudioEnable(void);
void aviSetAudioEnable(bool val);
int aviGetSelDriver(void);
void aviSetSelDriver(int idx);
int aviGetSelVideoFormat(void);
void aviSetSelVideoFormat(int idx);
int FCEUD_AviGetDriverList( std::vector <std::string> &formatList );
int FCEUD_AviGetFormatOpts( std::vector <std::string> &formatList );
int aviDebugOpenFile( const char *filepath );
@ -175,6 +192,7 @@ class LibavOptionsPage : public QWidget
QComboBox *audioChanLayout;
QGroupBox *videoGbox;
QGroupBox *audioGbox;
QTimer *updateTimer;
void initCodecLists(void);
void initPixelFormatSelect(const char *codec_name);
@ -183,6 +201,7 @@ class LibavOptionsPage : public QWidget
void initChannelLayoutSelect(const char *codec_name);
private slots:
void periodicUpdate(void);
void includeAudioChanged(bool);
void openVideoCodecOptions(void);
void openAudioCodecOptions(void);
@ -196,4 +215,41 @@ class LibavOptionsPage : public QWidget
#endif
class LibgwaviOptionsPage : public QWidget
{
Q_OBJECT
public:
LibgwaviOptionsPage(QWidget *parent = nullptr);
~LibgwaviOptionsPage(void);
protected:
QComboBox *videoEncSel;
QComboBox *videoPixfmt;
QComboBox *audioEncSel;
QComboBox *audioSamplefmt;
QComboBox *audioSampleRate;
QComboBox *audioChanLayout;
QGroupBox *videoGbox;
QGroupBox *audioGbox;
QTimer *updateTimer;
void initCodecLists(void);
void initPixelFormatSelect(int encoder);
void initSampleFormatSelect(int encoder);
void initSampleRateSelect(int encoder);
void initChannelLayoutSelect(int encoder);
private slots:
void periodicUpdate(void);
void openVideoCodecOptions(void);
void openAudioCodecOptions(void);
void videoCodecChanged(int idx);
void audioCodecChanged(int idx);
void videoPixelFormatChanged(int idx);
void audioSampleFormatChanged(int idx);
void audioSampleRateChanged(int idx);
void audioChannelLayoutChanged(int idx);
};
#endif

View File

@ -1774,60 +1774,60 @@ void consoleWin_t::createMainMenu(void)
#endif
// Movie -> Avi Recording -> Video Format
subMenu = aviMenu->addMenu( tr("Video Format") );
//subMenu = aviMenu->addMenu( tr("Video Format") );
{
std::vector <std::string> formatList;
group = new QActionGroup(this);
//{
// std::vector <std::string> formatList;
// group = new QActionGroup(this);
group->setExclusive(true);
// group->setExclusive(true);
FCEUD_AviGetFormatOpts( formatList );
// FCEUD_AviGetFormatOpts( formatList );
for (size_t i=0; i<formatList.size(); i++)
{
act = new QAction(tr( formatList[i].c_str() ), this);
// for (size_t i=0; i<formatList.size(); i++)
// {
// act = new QAction(tr( formatList[i].c_str() ), this);
//printf("%s\n", formatList[i].c_str() );
// //printf("%s\n", formatList[i].c_str() );
act->setCheckable(true);
group->addAction(act);
subMenu->addAction(act);
// act->setCheckable(true);
// group->addAction(act);
// subMenu->addAction(act);
act->setChecked( aviGetSelVideoFormat() == i );
// act->setChecked( aviGetSelVideoFormat() == i );
// Use Lambda Function to set callback
connect( act, &QAction::triggered, [ this, i ] { aviVideoFormatChanged( i ); } );
}
// // Use Lambda Function to set callback
// connect( act, &QAction::triggered, [ this, i ] { aviVideoFormatChanged( i ); } );
// }
}
//}
// Movie -> Avi Recording -> Include Audio
act = new QAction(tr("Include Audio"), this);
act->setCheckable(true);
act->setChecked( aviGetAudioEnable() );
connect(act, SIGNAL(triggered(bool)), this, SLOT(aviAudioEnableChange(bool)) );
aviMenu->addAction(act);
//// Movie -> Avi Recording -> Include Audio
//act = new QAction(tr("Include Audio"), this);
//act->setCheckable(true);
//act->setChecked( aviGetAudioEnable() );
//connect(act, SIGNAL(triggered(bool)), this, SLOT(aviAudioEnableChange(bool)) );
//aviMenu->addAction(act);
aviMenu->addSeparator();
//aviMenu->addSeparator();
// Movie -> Avi Recording -> Enable HUD Recording
aviHudAct = new QAction(tr("Enable &HUD Recording"), this);
aviHudAct->setCheckable(true);
aviHudAct->setChecked( FCEUI_AviEnableHUDrecording() );
aviHudAct->setStatusTip(tr("Enable HUD Recording"));
connect(aviHudAct, SIGNAL(triggered(bool)), this, SLOT(setAviHudEnable(bool)) );
//// Movie -> Avi Recording -> Enable HUD Recording
//aviHudAct = new QAction(tr("Enable &HUD Recording"), this);
//aviHudAct->setCheckable(true);
//aviHudAct->setChecked( FCEUI_AviEnableHUDrecording() );
//aviHudAct->setStatusTip(tr("Enable HUD Recording"));
//connect(aviHudAct, SIGNAL(triggered(bool)), this, SLOT(setAviHudEnable(bool)) );
aviMenu->addAction(aviHudAct);
//aviMenu->addAction(aviHudAct);
// Movie -> Avi Recording -> Enable Message Recording
aviMsgAct = new QAction(tr("Enable &Msg Recording"), this);
aviMsgAct->setCheckable(true);
aviMsgAct->setChecked( !FCEUI_AviDisableMovieMessages() );
aviMsgAct->setStatusTip(tr("Enable Msg Recording"));
connect(aviMsgAct, SIGNAL(triggered(bool)), this, SLOT(setAviMsgEnable(bool)) );
//// Movie -> Avi Recording -> Enable Message Recording
//aviMsgAct = new QAction(tr("Enable &Msg Recording"), this);
//aviMsgAct->setCheckable(true);
//aviMsgAct->setChecked( !FCEUI_AviDisableMovieMessages() );
//aviMsgAct->setStatusTip(tr("Enable Msg Recording"));
//connect(aviMsgAct, SIGNAL(triggered(bool)), this, SLOT(setAviMsgEnable(bool)) );
aviMenu->addAction(aviMsgAct);
//aviMenu->addAction(aviMsgAct);
// Movie -> WAV Recording
subMenu = movieMenu->addMenu( tr("&WAV Recording") );

View File

@ -246,8 +246,8 @@ class consoleWin_t : public QMainWindow
QAction *recWavAct;
QAction *recAsWavAct;
QAction *stopWavAct;
QAction *aviHudAct;
QAction *aviMsgAct;
//QAction *aviHudAct;
//QAction *aviMsgAct;
QTimer *gameTimer;

View File

@ -50,6 +50,7 @@ MovieOptionsDialog_t::MovieOptionsDialog_t(QWidget *parent)
QVBoxLayout *vbox1, *vbox2;
QPushButton *closeButton;
std::vector <std::string> aviDriverList;
int aviDriver;
setWindowTitle("Movie Options");
@ -67,6 +68,9 @@ MovieOptionsDialog_t::MovieOptionsDialog_t(QWidget *parent)
putSubTitlesAvi = new QCheckBox(tr("Put Movie Subtitles in AVI"));
autoBackUp = new QCheckBox(tr("Automatically Backup Movies"));
loadFullStates = new QCheckBox(tr("Load Full Save-State Movies:"));
aviEnableHUD = new QCheckBox(tr("AVI Enable HUD Recording"));
aviEnableMsg = new QCheckBox(tr("AVI Enable Msg Recording"));
aviEnableAudio = new QCheckBox(tr("AVI Enable Audio Recording"));
lbl = new QLabel(tr("Loading states in record mode will not immediately truncate movie, next frame input will. (VBA-rr and SNES9x style)"));
lbl->setWordWrap(true);
@ -79,6 +83,9 @@ MovieOptionsDialog_t::MovieOptionsDialog_t(QWidget *parent)
vbox1->addWidget(putSubTitlesAvi);
vbox1->addWidget(autoBackUp);
vbox1->addWidget(loadFullStates);
vbox1->addWidget(aviEnableHUD);
vbox1->addWidget(aviEnableMsg);
vbox1->addWidget(aviEnableAudio);
vbox1->addWidget(lbl);
readOnlyReplay->setChecked(suggestReadOnlyReplay);
@ -89,6 +96,9 @@ MovieOptionsDialog_t::MovieOptionsDialog_t(QWidget *parent)
putSubTitlesAvi->setChecked(subtitlesOnAVI);
autoBackUp->setChecked(autoMovieBackup);
loadFullStates->setChecked(fullSaveStateLoads);
aviEnableHUD->setChecked(FCEUI_AviEnableHUDrecording());
aviEnableMsg->setChecked(!FCEUI_AviDisableMovieMessages());
aviEnableAudio->setChecked(aviGetAudioEnable());
closeButton = new QPushButton( tr("Close") );
closeButton->setIcon(style()->standardIcon(QStyle::SP_DialogCloseButton));
@ -99,7 +109,7 @@ MovieOptionsDialog_t::MovieOptionsDialog_t(QWidget *parent)
hbox->addWidget( closeButton, 1 );
vbox1->addLayout( hbox );
FCEUD_AviGetFormatOpts( aviDriverList );
FCEUD_AviGetDriverList( aviDriverList );
gbox = new QGroupBox( tr("AVI Recording Options") );
gbox->setLayout(vbox2);
@ -113,6 +123,8 @@ MovieOptionsDialog_t::MovieOptionsDialog_t(QWidget *parent)
vbox2->addLayout( hbox );
vbox2->addWidget( aviPageStack );
g_config->getOption("SDL.AviDriver", &aviDriver );
for (size_t i=0; i<aviDriverList.size(); i++)
{
aviBackend->addItem(tr(aviDriverList[i].c_str()), (unsigned int)i);
@ -120,18 +132,21 @@ MovieOptionsDialog_t::MovieOptionsDialog_t(QWidget *parent)
switch (i)
{
#ifdef _USE_LIBAV
case AVI_LIBAV:
case AVI_DRIVER_LIBAV:
{
aviPageStack->addWidget( new LibavOptionsPage() );
}
break;
#endif
case AVI_DRIVER_LIBGWAVI:
aviPageStack->addWidget( new LibgwaviOptionsPage() );
break;
default:
aviPageStack->addWidget( new QWidget() );
break;
}
if ( i == aviGetSelVideoFormat() )
if ( i == aviDriver )
{
aviBackend->setCurrentIndex(i);
aviPageStack->setCurrentIndex(i);
@ -143,10 +158,13 @@ MovieOptionsDialog_t::MovieOptionsDialog_t(QWidget *parent)
connect(pauseAfterPlay, SIGNAL(stateChanged(int)), this, SLOT(pauseAfterPlayChanged(int)));
connect(closeAfterPlay, SIGNAL(stateChanged(int)), this, SLOT(closeAfterPlayChanged(int)));
connect(bindSaveStates, SIGNAL(stateChanged(int)), this, SLOT(bindSaveStatesChanged(int)));
connect(dpySubTitles, SIGNAL(stateChanged(int)), this, SLOT(dpySubTitlesChanged(int)));
connect(dpySubTitles , SIGNAL(stateChanged(int)), this, SLOT(dpySubTitlesChanged(int)));
connect(putSubTitlesAvi, SIGNAL(stateChanged(int)), this, SLOT(putSubTitlesAviChanged(int)));
connect(autoBackUp, SIGNAL(stateChanged(int)), this, SLOT(autoBackUpChanged(int)));
connect(loadFullStates, SIGNAL(stateChanged(int)), this, SLOT(loadFullStatesChanged(int)));
connect(aviEnableHUD , SIGNAL(stateChanged(int)), this, SLOT(setAviHudEnable(int)));
connect(aviEnableMsg , SIGNAL(stateChanged(int)), this, SLOT(setAviMsgEnable(int)));
connect(aviEnableAudio, SIGNAL(stateChanged(int)), this, SLOT(setAviAudioEnable(int)));
connect(aviBackend, SIGNAL(currentIndexChanged(int)), this, SLOT(aviBackendChanged(int)));
@ -204,6 +222,31 @@ void MovieOptionsDialog_t::putSubTitlesAviChanged(int state)
subtitlesOnAVI = (state != Qt::Unchecked);
}
//----------------------------------------------------------------------------
void MovieOptionsDialog_t::setAviHudEnable(int state)
{
bool checked = (state != Qt::Unchecked);
FCEUI_SetAviEnableHUDrecording( checked );
g_config->setOption("SDL.RecordHUD", checked );
}
//----------------------------------------------------------------------------
void MovieOptionsDialog_t::setAviMsgEnable(int state)
{
bool checked = (state != Qt::Unchecked);
FCEUI_SetAviDisableMovieMessages( !checked );
g_config->setOption("SDL.MovieMsg", checked );
}
//----------------------------------------------------------------------------
void MovieOptionsDialog_t::setAviAudioEnable(int state)
{
bool checked = (state != Qt::Unchecked);
aviSetAudioEnable( checked );
}
//----------------------------------------------------------------------------
void MovieOptionsDialog_t::autoBackUpChanged(int state)
{
autoMovieBackup = (state != Qt::Unchecked);
@ -218,6 +261,6 @@ void MovieOptionsDialog_t::aviBackendChanged(int idx)
{
aviPageStack->setCurrentIndex(idx);
aviSetSelVideoFormat(idx);
aviSetSelDriver(idx);
}
//----------------------------------------------------------------------------

View File

@ -38,6 +38,9 @@ protected:
QCheckBox *putSubTitlesAvi;
QCheckBox *autoBackUp;
QCheckBox *loadFullStates;
QCheckBox *aviEnableHUD;
QCheckBox *aviEnableMsg;
QCheckBox *aviEnableAudio;
QComboBox *aviBackend;
QStackedWidget *aviPageStack;
@ -51,6 +54,9 @@ private slots:
void bindSaveStatesChanged(int state);
void dpySubTitlesChanged(int state);
void putSubTitlesAviChanged(int state);
void setAviHudEnable(int state);
void setAviMsgEnable(int state);
void setAviAudioEnable(int state);
void autoBackUpChanged(int state);
void loadFullStatesChanged(int state);
void aviBackendChanged(int idx);

View File

@ -596,10 +596,14 @@ InitConfig()
config->addOption("moviemsg", "SDL.MovieMsg", 0);
#ifdef _USE_LIBAV
config->addOption("SDL.AviVideoFormat", AVI_LIBAV);
#elif WIN32
config->addOption("SDL.AviDriver", AVI_DRIVER_LIBAV);
#else
config->addOption("SDL.AviDriver", AVI_DRIVER_LIBGWAVI);
#endif
#if defined(WIN32)
config->addOption("SDL.AviVideoFormat", AVI_VFW);
#elif _USE_X264
#elif defined(_USE_X264)
config->addOption("SDL.AviVideoFormat", AVI_X264);
#else
config->addOption("SDL.AviVideoFormat", AVI_RGB24);

View File

@ -907,6 +907,8 @@ int fceuWrapperInit( int argc, char *argv[] )
g_config->save();
}
aviRecordInit();
// movie playback
g_config->getOption("SDL.Movie", &s);
g_config->setOption("SDL.Movie", "");