sync to last commit on google_code
authorGood Guy <[email protected]>
Mon, 24 Aug 2015 15:19:47 +0000 (09:19 -0600)
committerGood Guy <[email protected]>
Mon, 24 Aug 2015 15:19:47 +0000 (09:19 -0600)
cinelerra-5.0/cinelerra/ffmpeg.C
cinelerra-5.0/guicast/bcwindowbase.C
cinelerra-5.0/guicast/bcwindowbase.h
cinelerra-5.0/plugins/titler/title.C
cinelerra-5.0/plugins/titler/titlewindow.C

index decb3d0078260bf419a7469a16e00d62def79f89..89175ff737032e2bf6790c7676f9f4ec280ebd34 100644 (file)
@@ -941,8 +941,8 @@ FFMPEG::~FFMPEG()
        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)
@@ -2070,6 +2070,11 @@ int FFVideoStream::create_filter(const char *filter_spec,
                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");
@@ -2101,6 +2106,11 @@ int FFAudioStream::create_filter(const char *filter_spec,
                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");
index 841d6c54c0105a0763e7b4ed8c4e6f6fd0a494ce..32547118e6514c29fd63d1b52b0884b7082fb3e0 100644 (file)
@@ -408,7 +408,7 @@ int BC_WindowBase::create_window(BC_WindowBase *parent_window,
        else
                this->display_name[0] = 0;
 
-       strcpy(this->title, _(title));
+       put_title(_(title));
        if(bg_pixmap) shared_bg_pixmap = 1;
 
        subwindows = new BC_SubWindowList;
@@ -3994,15 +3994,30 @@ void BC_WindowBase::set_background(VFrame *bitmap)
        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);
index b1261e23b464cacc7b2939470a177485dbd08bb7..f2314753599f6a11beb3d63cd40cc9d76ac39b5f 100644 (file)
@@ -443,6 +443,7 @@ public:
        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);
index 66755018b012c0640cd6697bffacf9282e90916a..6155d20b2a3f2cdf6588118d4fd8027cfffd10b2 100644 (file)
@@ -86,7 +86,7 @@ TitleConfig::TitleConfig()
        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;
@@ -204,8 +204,8 @@ void TitleConfig::interpolate(TitleConfig &prev,
 //     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()
@@ -539,10 +539,14 @@ void TitleUnit::draw_glyph(VFrame *output, VFrame *data, TitleGlyph *glyph, int
        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;
@@ -1734,8 +1738,8 @@ int TitleMain::draw_mask()
 
        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;
@@ -1759,7 +1763,7 @@ int TitleMain::draw_mask()
                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;
index b481f7b0def803e189c2d59830a67dd9af5a1336..a2ad2cf7c821b74a5a86495941377db23701bc23 100644 (file)
@@ -852,7 +852,7 @@ int TitleText::handle_event()
 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,