delete flow_lock;
delete mux_lock;
av_dict_free(&opts);
- delete opt_video_filter;
- delete opt_audio_filter;
+ delete [] opt_video_filter;
+ delete [] opt_audio_filter;
}
int FFMPEG::check_sample_rate(AVCodec *codec, int sample_rate)
AVCodecContext *src_ctx, AVCodecContext *sink_ctx)
{
avfilter_register_all();
+ AVFilter *filter = avfilter_get_by_name(filter_spec);
+ if( !filter || filter->inputs->type != AVMEDIA_TYPE_VIDEO ) {
+ ff_err(AVERROR(EINVAL), "FFVideoStream::create_filter: %s\n", filter_spec);
+ return -1;
+ }
filter_graph = avfilter_graph_alloc();
AVFilter *buffersrc = avfilter_get_by_name("buffer");
AVFilter *buffersink = avfilter_get_by_name("buffersink");
AVCodecContext *src_ctx, AVCodecContext *sink_ctx)
{
avfilter_register_all();
+ AVFilter *filter = avfilter_get_by_name(filter_spec);
+ if( !filter || filter->inputs->type != AVMEDIA_TYPE_AUDIO ) {
+ ff_err(AVERROR(EINVAL), "FFAudioStream::create_filter: %s\n", filter_spec);
+ return -1;
+ }
filter_graph = avfilter_graph_alloc();
AVFilter *buffersrc = avfilter_get_by_name("abuffer");
AVFilter *buffersink = avfilter_get_by_name("abuffersink");
else
this->display_name[0] = 0;
- strcpy(this->title, _(title));
+ put_title(_(title));
if(bg_pixmap) shared_bg_pixmap = 1;
subwindows = new BC_SubWindowList;
draw_background(0, 0, w, h);
}
+void BC_WindowBase::put_title(const char *text)
+{
+ if( BC_Resources::locale_utf8 ) {
+ char *bp=this->title, *ep = bp+sizeof(this->title)-1;
+ for( const char *cp=text; *cp!=0 && bp<ep; ) {
+ if( *cp < 0 ) { do { *bp++ = *cp++; } while( *cp < 0 ); continue; }
+ if( *cp < ' ' ) { *bp++ = ' '; ++cp; continue; }
+ *bp++ = *cp++;
+ }
+ *bp = 0;
+ }
+ else
+ strcpy(this->title, text);
+}
+
void BC_WindowBase::set_title(const char *text)
{
- XTextProperty titleprop;
- char *txlist[2];
+ put_title(_(text));
- strcpy(this->title, _(text));
+ char *txlist[2];
txlist[0] = this->title;
txlist[1] = 0;
+ XTextProperty titleprop;
XmbTextListToTextProperty(top_level->display, txlist, 1,
XStdICCTextStyle, &titleprop);
XSetWMName(top_level->display, top_level->win, &titleprop);
void set_inverse();
void set_background(VFrame *bitmap);
// Change the window title.
+ void put_title(const char *text);
void set_title(const char *text);
const char *get_title();
void set_utf8title(const char *text);
fade_out = 0.0;
x = 0.0;
y = 0.0;
- dropshadow = 10;
+ dropshadow = 2;
sprintf(font, "fixed");
sprintf(encoding, DEFAULT_ENCODING);
timecode_format = DEFAULT_TIMECODEFORMAT;
// this->y = prev.y;
timecode = prev.timecode;
timecode_format = prev.timecode_format;
-// this->dropshadow = (int)(prev.dropshadow * prev_scale + next.dropshadow * next_scale);
- this->dropshadow = prev.dropshadow;
+ this->dropshadow = prev.dropshadow * prev_scale + next.dropshadow * next_scale;
+// this->dropshadow = prev.dropshadow;
}
void TitleConfig::limits()
unsigned char **out_rows = output->get_rows();
int baseline = plugin->get_char_height();
- if(engine->do_dropshadow) {
+ if( engine->do_dropshadow ) {
x += plugin->config.dropshadow;
y += plugin->config.dropshadow;
}
+ else if( plugin->config.dropshadow < 0 ) {
+ x -= plugin->config.dropshadow;
+ y -= plugin->config.dropshadow;
+ }
int x_in = 0, y_in = 0;
int x_out = x + glyph->left;
extent.x1 -= config.outline_size*2;
extent.y1 -= config.outline_size*2;
- extent.x2 += config.dropshadow + config.outline_size*2;
- extent.y2 += config.dropshadow + config.outline_size*2;
+ extent.x2 += abs(config.dropshadow) + config.outline_size*2;
+ extent.y2 += abs(config.dropshadow) + config.outline_size*2;
// Determine mask geometry
mask_w = extent.x2 - extent.x1;
text_mask = new VFrame;
text_mask->set_use_shm(0);
text_mask->reallocate(0, -1, 0, 0, 0, mask_w, mask_h, color_model, -1);
- int drop = !config.dropshadow ? 0 : config.dropshadow;
+ float drop = abs(config.dropshadow);
int drop_w = mask_w + drop;
int drop_h = mask_h + drop;
text_mask_stroke = new VFrame;
TitleDropShadow::TitleDropShadow(TitleMain *client, TitleWindow *window, int x, int y)
: BC_TumbleTextBox(window,
(int64_t)client->config.dropshadow,
- (int64_t)0,
+ (int64_t)-1000,
(int64_t)1000,
x,
y,