+FormatFFMPEG::FormatFFMPEG(int x, int y, FormatTools *format)
+ : FFMPEGPopup(format->plugindb, x, y)
+{
+ this->format = format;
+}
+
+FormatFFMPEG::~FormatFFMPEG()
+{
+}
+
+int FormatFFMPEG::load_defaults(const char *path, const char *type,
+ char *codec, char *codec_options, int len)
+{
+ char default_file[BCTEXTLEN];
+ FFMPEG::set_option_path(default_file, "%s/%s.dfl", path, type);
+ FILE *fp = fopen(default_file,"r");
+ if( !fp ) return 1;
+ fgets(codec, BCSTRLEN, fp);
+ fclose(fp);
+ char *cp = codec;
+ while( *cp && *cp!='\n' ) ++cp;
+ *cp = 0;
+ FFMPEG::set_option_path(default_file, "%s/%s", path, codec);
+ return FFMPEG::load_options(default_file, codec_options, len);
+}
+
+int FormatFFMPEG::handle_event()
+{
+ BC_ListBoxItem *selection = get_selection(0, 0);
+ if( selection ) {
+ char *text = get_selection(0, 0)->get_text();
+ format->ffmpeg_type->update(text);
+ Asset *asset = format->asset;
+ strcpy(asset->fformat, text);
+ strcpy(asset->ff_audio_options, "");
+ strcpy(asset->ff_video_options, "");
+ asset->audio_data = !load_defaults("audio", text, asset->acodec,
+ asset->ff_audio_options, sizeof(asset->ff_audio_options));
+ asset->video_data = !load_defaults("video", text, asset->vcodec,
+ asset->ff_video_options, sizeof(asset->ff_video_options));
+ format->update_extension();
+ format->close_format_windows();
+ format->update_format();
+ }
+ return 1;
+}
+
+
+