titler overlay rework, clear yuv vframe
[goodguy/history.git] / cinelerra-5.1 / cinelerra / pluginfclient.C
index 56b459587222e120a996a1cc2fb7f89995c77779..3edc9f6777fa520df7e3455cdd6b0d0577b858ef 100644 (file)
@@ -836,6 +836,11 @@ int PluginFAClient::process_buffer(int64_t size, Samples **buffer, int64_t start
        if( ret >= 0 ) {
                in_channels = get_inchannels();
                out_channels = get_outchannels();
+               frame->nb_samples = size;
+               frame->format = AV_SAMPLE_FMT_FLTP;
+               frame->channel_layout = (1<<in_channels)-1;
+               frame->sample_rate = sample_rate;
+               frame->pts = local_to_edl(filter_position);
        }
 
        int retry = 10;
@@ -846,11 +851,6 @@ int PluginFAClient::process_buffer(int64_t size, Samples **buffer, int64_t start
                for( int i=0; i<total_in; ++i )
                        read_samples(buffer[i], i, sample_rate, filter_position, size);
                filter_position += size;
-               frame->nb_samples = size;
-               frame->format = AV_SAMPLE_FMT_FLTP;
-               frame->channel_layout = (1<<in_channels)-1;
-               frame->sample_rate = sample_rate;
-               frame->pts = local_to_edl(filter_position);
                ret = av_frame_get_buffer(frame, 0);
                if( ret < 0 ) break;
                float **in_buffers = (float **)&frame->extended_data[0];
@@ -939,7 +939,7 @@ int PluginFVClient::process_buffer(VFrame **frames, int64_t position, double fra
                ret = av_buffersink_get_frame(fsink, frame);
                if( ret >= 0 || ret != AVERROR(EAGAIN) ) break;
                if( !fsrc ) { ret = AVERROR(EIO);  break; }
-               read_frame(vframe, 0, filter_position++, frame_rate, get_use_opengl());
+               read_frame(vframe, 0, filter_position++, frame_rate, 0);
                frame->format = pix_fmt;
                frame->width  = width;
                frame->height = height;
@@ -1098,15 +1098,24 @@ int PluginFFilter::init(const char *name, PluginFClientConfig *conf)
                graph->nb_threads  = 0;
        }
        fctx = avfilter_graph_alloc_filter(graph, filter, inst_name);
-       fctx->thread_type = graph->thread_type; // bug in avfilter
        if( !fctx ) return AVERROR(ENOMEM);
+       fctx->thread_type = graph->thread_type; // bug in avfilter
        if( conf ) {
                AVDictionary *opts = 0;
                for( int i=0; i<conf->size(); ++i ) {
                        PluginFClient_Opt *op = conf->get(i);
                        const char *name = op->opt->name;
                        char val[BCTEXTLEN], *vp = op->get(val, sizeof(val));
-                       if( vp ) av_dict_set(&opts, name, vp, 0);
+                       if( !vp ) continue;
+                       uint8_t *bp = 0;
+// unspecified opts cause a special behavior in some filters (lut3d)
+// so... if opt value is the default, skip it or no special behavior
+                       if( av_opt_get(filter_config(), name, 0, &bp) >= 0 ) {
+                               int result = strcmp((const char *)bp, vp);
+                               av_freep(&bp);
+                               if( !result ) continue;
+                       }
+                       av_dict_set(&opts, name, vp, 0);
                }
                ret = avfilter_init_dict(fctx, &opts);
                av_dict_free(&opts);