- if (num_empty_pads > 0){
- if (num_empty_pads < numsinkpads){
- /* only some pads have EOS, need to create some empty buffers */
- for (i=0 ; i<numsinkpads ; i++){
- if (buffers_in[i] == NULL){
- int x;
- LADSPA_Data *data;
- buffers_in[i] = gst_buffer_new_from_pool (ladspa->bufpool, 0, 0);
- GST_BUFFER_TIMESTAMP(buffers_in[i]) = ladspa->timestamp;
- data_in[i] = data = (LADSPA_Data *) GST_BUFFER_DATA(buffers_in[i]);
- for (x=0 ; x < ladspa->buffersize ; x++)
- data[x] = 0.0F;
-
- data_in[i] = (LADSPA_Data *) GST_BUFFER_DATA(buffers_in[i]);
- GST_BUFFER_TIMESTAMP(buffers_in[i]) = ladspa->timestamp;
- }
- }
- }
- else {
- /* all pads have EOS, time to quit */
- /* CHECKME do I have to push EOS events here? */
- GST_DEBUG (0, "All sink pads have EOS, finishing.");
- break;
- }
- }
-
- GST_DPMAN_PREPROCESS(ladspa->dpman, ladspa->buffersize, ladspa->timestamp);
- num_processed = 0;
-
- /* split up processing of the buffer into chunks so that dparams can
- * be updated when required.
- * In many cases the buffer will be processed in one chunk anyway.
- */
- while(GST_DPMAN_PROCESS(ladspa->dpman, num_processed)) {
-
- num_to_process = GST_DPMAN_FRAMES_TO_PROCESS(ladspa->dpman);
- for (i=0 ; i<numsinkpads ; i++){
- desc->connect_port (ladspa->handle, oclass->sinkpad_portnums[i], data_in[i]);
- }
- for (i=0 ; i<numsrcpads ; i++){
- desc->connect_port (ladspa->handle, oclass->srcpad_portnums[i], data_out[i]);
- }
- desc->run(ladspa->handle, num_to_process);
- for (i=0 ; i<numsinkpads ; i++){
- data_in[i] += num_to_process;
- }
- for (i=0 ; i<numsrcpads ; i++){
- data_out[i] += num_to_process;
- }
+ if (largest_buffer < 0)
+ largest_buffer = GST_BUFFER_SIZE (buffers_in[i])/sizeof(gfloat);
+ else
+ largest_buffer = MIN (GST_BUFFER_SIZE (buffers_in[i])/sizeof(gfloat), largest_buffer);
+ data_in[i] = (LADSPA_Data *) GST_BUFFER_DATA(buffers_in[i]);
+ GST_BUFFER_TIMESTAMP(buffers_in[i]) = ladspa->timestamp;
+ }