#include "fileffmpeg.h"
#include "filesystem.h"
#include "indexfile.h"
+#include "language.h"
#include "mainerror.h"
#include "mainprogress.h"
#include "mutex.h"
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;
}
}
int FileFFMPEG::get_best_colormodel(Asset *asset, int driver)
{
switch(driver) {
- case PLAYBACK_X11: return BC_RGB888;
- case PLAYBACK_X11_GL: return BC_YUV888;
+ case PLAYBACK_X11:
+ return BC_RGB888;
+ case PLAYBACK_X11_XV:
+ case PLAYBACK_ASYNCHRONOUS:
+ return BC_YUV888;
+ case PLAYBACK_X11_GL:
+ return BC_YUV888;
+ case PLAYBACK_DV1394:
+ case PLAYBACK_FIREWIRE:
+ return BC_YUV422P;
+ case VIDEO4LINUX2:
+ return BC_RGB888;
+ case VIDEO4LINUX2JPEG:
+ return BC_COMPRESSED;
+ case CAPTURE_DVB:
+ case VIDEO4LINUX2MPEG:
+ return BC_YUV422P;
+ case CAPTURE_JPEG_WEBCAM:
+ return BC_COMPRESSED;
+ case CAPTURE_YUYV_WEBCAM:
+ return BC_YUV422;
+ case CAPTURE_FIREWIRE:
+ case CAPTURE_IEC61883:
+ return BC_YUV422P;
}
- return BC_YUV420P;
+
+ 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;
}
//======
audio_options->create_objects();
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;
}
void FFOptions_OptPanel::create_objects()
{
- const char *cols[] = { "option", "value", };
+ const char *cols[] = { _("option"), _("value"), };
const int col1_w = 150;
int wids[] = { col1_w, get_w()-col1_w };
BC_ListBox::update(&items[0], &cols[0], &wids[0], sizeof(items)/sizeof(items[0]));
void FFOptionsKind::set(int k)
{
this->kind = k;
- set_text(kinds[k]);
+ set_text(_(kinds[k]));
}
FFOptionsText::
{
const char *cp = "";
if( opt ) switch (opt->type) {
- case AV_OPT_TYPE_FLAGS: cp = "<flags>"; break;
- case AV_OPT_TYPE_INT: cp = "<int>"; break;
- case AV_OPT_TYPE_INT64: cp = "<int64>"; break;
- case AV_OPT_TYPE_DOUBLE: cp = "<double>"; break;
- case AV_OPT_TYPE_FLOAT: cp = "<float>"; break;
- case AV_OPT_TYPE_STRING: cp = "<string>"; break;
- case AV_OPT_TYPE_RATIONAL: cp = "<rational>"; break;
- case AV_OPT_TYPE_BINARY: cp = "<binary>"; break;
- case AV_OPT_TYPE_IMAGE_SIZE: cp = "<image_size>"; break;
- case AV_OPT_TYPE_VIDEO_RATE: cp = "<video_rate>"; break;
- case AV_OPT_TYPE_PIXEL_FMT: cp = "<pix_fmt>"; break;
- case AV_OPT_TYPE_SAMPLE_FMT: cp = "<sample_fmt>"; break;
- case AV_OPT_TYPE_DURATION: cp = "<duration>"; break;
- case AV_OPT_TYPE_COLOR: cp = "<color>"; break;
- case AV_OPT_TYPE_CHANNEL_LAYOUT: cp = "<channel_layout>"; break;
- case AV_OPT_TYPE_BOOL: cp = "<bool>"; break;
- default: cp = "<undef>"; break;
+ case AV_OPT_TYPE_FLAGS: cp = N_("<flags>"); break;
+ case AV_OPT_TYPE_INT: cp = N_("<int>"); break;
+ case AV_OPT_TYPE_INT64: cp = N_("<int64>"); break;
+ case AV_OPT_TYPE_DOUBLE: cp = N_("<double>"); break;
+ case AV_OPT_TYPE_FLOAT: cp = N_("<float>"); break;
+ case AV_OPT_TYPE_STRING: cp = N_("<string>"); break;
+ case AV_OPT_TYPE_RATIONAL: cp = N_("<rational>"); break;
+ case AV_OPT_TYPE_BINARY: cp = N_("<binary>"); break;
+ case AV_OPT_TYPE_IMAGE_SIZE: cp = N_("<image_size>"); break;
+ case AV_OPT_TYPE_VIDEO_RATE: cp = N_("<video_rate>"); break;
+ case AV_OPT_TYPE_PIXEL_FMT: cp = N_("<pix_fmt>"); break;
+ case AV_OPT_TYPE_SAMPLE_FMT: cp = N_("<sample_fmt>"); break;
+ case AV_OPT_TYPE_DURATION: cp = N_("<duration>"); break;
+ case AV_OPT_TYPE_COLOR: cp = N_("<color>"); break;
+ case AV_OPT_TYPE_CHANNEL_LAYOUT: cp = N_("<channel_layout>"); break;
+ case AV_OPT_TYPE_BOOL: cp = N_("<bool>"); break;
+ default: cp = N_("<undef>"); break;
}
- return sprintf(rp, "%s", cp);
+ return sprintf(rp, "%s", _(cp));
}
int FFOptions_Opt::scalar(double d, char *rp)
{