FFMPEGConfigAudio *window = new FFMPEGConfigAudio(parent_window, asset);
format_window = window;
window->create_objects();
- window->run_window();
+ if( !window->run_window() )
+ strcpy(asset->ff_audio_options, window->audio_options->get_text());
delete window;
}
else if(video_options) {
FFMPEGConfigVideo *window = new FFMPEGConfigVideo(parent_window, asset);
format_window = window;
window->create_objects();
- window->run_window();
+ if( !window->run_window() )
+ strcpy(asset->ff_video_options, window->video_options->get_text());
delete window;
}
}
return 1;
}
-void FFMPEGConfigAudio::update_options()
-{
- audio_options->update(asset->ff_audio_options);
-}
-
FFAudioOptions::FFAudioOptions(FFMPEGConfigAudio *audio_popup,
int x, int y, int w, int rows, int size, char *text)
: BC_ScrollTextBox(audio_popup, x, y, w, rows, text, size)
return 1;
}
-void FFMPEGConfigVideo::update_options()
-{
- video_options->update(asset->ff_video_options);
-}
-
FFVideoOptions::FFVideoOptions(FFMPEGConfigVideo *video_popup,
int x, int y, int w, int rows, int size, char *text)
: BC_ScrollTextBox(video_popup, x, y, w, rows, text, size)
this->options_window = 0;
this->codec_name = 0;
this->codec = 0;
- this->ff_options = 0;
- this->ff_len = 0;
this->ff_opts = 0;
+ this->ff_len = 0;
}
FFOptionsDialog::~FFOptionsDialog()
delete [] codec_name;
}
-void FFOptionsDialog::load_options()
+void FFOptionsDialog::load_options(const char *bp, int len)
{
char line[BCTEXTLEN];
char key[BCSTRLEN], val[BCTEXTLEN];
- char *bp = ff_options, *dp = bp + ff_len-1;
+ const char *dp = bp + len-1;
int no = 0;
while( bp < dp && *bp != 0 ) {
++no;
}
}
-void FFOptionsDialog::store_options()
+void FFOptionsDialog::store_options(char *cp, int len)
{
- char *cp = ff_options, *ep = cp + ff_len-1;
+ char *ep = cp + len-1;
AVDictionaryEntry *elem = 0;
while( (elem=av_dict_get(ff_opts, "", elem, AV_DICT_IGNORE_SUFFIX)) != 0 ) {
if( elem->key[0] == '#' ) {
*cp = 0;
}
-void FFOptionsDialog::start(const char *codec_name, AVCodec *codec, char *options, int len)
+void FFOptionsDialog::start(const char *codec_name, AVCodec *codec,
+ const char *options, int len)
{
if( options_window ) {
options_window->lock_window("FFOptionsDialog::start");
this->codec_name = cstrdup(codec_name);
this->codec = codec;
this->ff_opts = 0;
- this->ff_options = options;
this->ff_len = len;
- load_options();
+ load_options(options, len);
BC_DialogThread::start();
}
void FFOptionsDialog::handle_done_event(int result)
{
if( !result ) {
- store_options();
- update_options();
+ char options[ff_len];
+ store_options(options, ff_len);
+ update_options(options);
}
options_window = 0;
delete [] codec_name; codec_name = 0;
close_window();
}
-void FFOptionsAudioDialog::update_options()
+void FFOptionsAudioDialog::update_options(const char *options)
{
- aud_config->update_options();
+ aud_config->audio_options->update(options);
}
FFOptionsVideoDialog::FFOptionsVideoDialog(FFMPEGConfigVideo *vid_config)
close_window();
}
-void FFOptionsVideoDialog::update_options()
+void FFOptionsVideoDialog::update_options(const char *options)
{
- vid_config->update_options();
+ vid_config->video_options->update(options);
}
return 1;
}
aud_config->ff_options_dialog->start(audio_codec, codec,
- asset->ff_audio_options, sizeof(asset->ff_audio_options));
+ asset->ff_audio_options, sizeof(asset->ff_audio_options));
return 1;
}
return 1;
}
vid_config->ff_options_dialog->start(video_codec, codec,
- asset->ff_video_options, sizeof(asset->ff_video_options));
+ asset->ff_video_options, sizeof(asset->ff_video_options));
return 1;
}
~FFMPEGConfigAudio();
void create_objects();
- void update_options();
int close_event();
ArrayList<BC_ListBoxItem*> presets;
~FFMPEGConfigVideo();
void create_objects();
- void update_options();
int close_event();
ArrayList<BC_ListBoxItem*> presets;
public:
FFOptionsDialog();
~FFOptionsDialog();
- virtual void update_options() = 0;
+ virtual void update_options(const char *options) = 0;
- void load_options();
- void store_options();
- void start(const char *codec_name, AVCodec *codec, char *ff_options, int ff_len);
+ void load_options(const char *bp, int len);
+ void store_options(char *cp, int len);
+ void start(const char *codec_name, AVCodec *codec, const char *options, int len);
BC_Window* new_gui();
void handle_done_event(int result);
FFOptionsWindow *options_window;
const char *codec_name;
AVCodec *codec;
- char *ff_options;
- int ff_len;
AVDictionary *ff_opts;
+ int ff_len;
};
class FFOptionsAudioDialog : public FFOptionsDialog
{
public:
FFMPEGConfigAudio *aud_config;
- void update_options();
+ void update_options(const char *options);
FFOptionsAudioDialog(FFMPEGConfigAudio *aud_config);
~FFOptionsAudioDialog();
{
public:
FFMPEGConfigVideo *vid_config;
- void update_options();
+ void update_options(const char *options);
FFOptionsVideoDialog(FFMPEGConfigVideo *vid_config);
~FFOptionsVideoDialog();