BC_TumbleTextBox::create_objects();
}
+int FFMpegConfigNum::update_param(const char *param, const char *opts)
+{
+ char value[BCTEXTLEN];
+ if( !FileFFMPEG::get_ff_option(param, opts, value) ) {
+ if( (*output = atol(value)) < 0 ) {
+ disable(1);
+ return 0;
+ }
+ BC_TumbleTextBox::update(value);
+ }
+ enable();
+ return 1;
+}
+
int FFMpegConfigNum::handle_event()
{
*output = atol(get_text());
return ret;
}
+void FileFFMPEG::set_parameters(char *cp, int len, const char *bp)
+{
+ char *ep = cp + len-2, ch = 0;
+ while( cp < ep && *bp != 0 ) { ch = *bp++; *cp++ = ch; }
+ if( ch != '\n' ) *cp++ = '\n';
+ *cp = 0;
+}
+
void FileFFMPEG::get_parameters(BC_WindowBase *parent_window,
Asset *asset, BC_WindowBase *&format_window,
int audio_options, int video_options)
format_window = window;
window->create_objects();
if( !window->run_window() )
- strcpy(asset->ff_audio_options, window->audio_options->get_text());
+ set_parameters(asset->ff_audio_options, sizeof(asset->ff_audio_options),
+ window->audio_options->get_text());
delete window;
}
else if(video_options) {
format_window = window;
window->create_objects();
if( !window->run_window() )
- strcpy(asset->ff_video_options, window->video_options->get_text());
+ set_parameters(asset->ff_video_options, sizeof(asset->ff_video_options),
+ window->video_options->get_text());
delete window;
}
}
return BC_RGB888;
}
+
+int FileFFMPEG::get_ff_option(const char *nm, const char *options, char *value)
+{
+ for( const char *cp=options; *cp!=0; ) {
+ char line[BCTEXTLEN], *bp = line, *ep = bp+sizeof(line)-1;
+ while( bp < ep && *cp && *cp!='\n' ) *bp++ = *cp++;
+ if( *cp ) ++cp;
+ *bp = 0;
+ if( !line[0] || line[0] == '#' || line[0] == ';' ) continue;
+ char key[BCSTRLEN], val[BCTEXTLEN];
+ if( FFMPEG::scan_option_line(line, key, val) ) continue;
+ if( !strcmp(key, nm) ) {
+ strcpy(value, val);
+ return 0;
+ }
+ }
+ return 1;
+}
+
//======
FFMPEGConfigAudio::FFMPEGConfigAudio(BC_WindowBase *parent_window, Asset *asset)
add_subwindow(new BC_OKButton(this));
add_subwindow(new BC_CancelButton(this));
+ bitrate->update_param("cin_bitrate", asset->ff_audio_options);
+
show_window(1);
bitrate->handle_event();
unlock_window();
this->audio_popup = audio_popup;
}
-int FFAudioOptions::handle_event()
-{
- strcpy(audio_popup->asset->ff_audio_options, get_text());
- return 1;
-}
-
FFMPEGConfigAudioPopup::FFMPEGConfigAudioPopup(FFMPEGConfigAudio *popup, int x, int y)
: BC_PopupTextBox(popup, &popup->presets, popup->asset->acodec, x, y, 300, 300)
FFMPEG::load_options(option_path, asset->ff_audio_options,
sizeof(asset->ff_audio_options));
popup->audio_options->update(asset->ff_audio_options);
+ popup->audio_options->set_text_row(0);
+
+ popup->bitrate->update_param("cin_bitrate", asset->ff_audio_options);
return 1;
}
add_subwindow(new BC_OKButton(this));
add_subwindow(new BC_CancelButton(this));
+ bitrate->update_param("cin_bitrate", asset->ff_video_options);
+ quality->update_param("cin_quality", asset->ff_video_options);
+
show_window(1);
if( asset->ff_video_bitrate )
quality->disable();
this->video_popup = video_popup;
}
-int FFVideoOptions::handle_event()
-{
- strcpy(video_popup->asset->ff_video_options, get_text());
- return 1;
-}
-
FFMPEGConfigVideoPopup::FFMPEGConfigVideoPopup(FFMPEGConfigVideo *popup, int x, int y)
: BC_PopupTextBox(popup, &popup->presets, popup->asset->vcodec, x, y, 300, 300)
FFMPEG::load_options(option_path, asset->ff_video_options,
sizeof(asset->ff_video_options));
popup->video_options->update(asset->ff_video_options);
+ popup->video_options->set_text_row(0);
+
+ popup->bitrate->update_param("cin_bitrate", asset->ff_video_options);
+ popup->quality->update_param("cin_quality", asset->ff_video_options);
return 1;
}