Ticket #1685: af_ladspa_c_fixes.patch
| File af_ladspa_c_fixes.patch, 4.5 KB (added by , 16 years ago) |
|---|
-
libaf/af_ladspa.c
old new 57 57 * the data unchanged. 58 58 */ 59 59 60 int activated; /**< 0 or 1. Activate LADSPA filters only once, even61 * if the buffers get resized, to avoid a stuttering62 * filter.63 */64 65 60 char *file; 66 61 char *label; 67 62 … … 91 86 float **inbufs; 92 87 float **outbufs; 93 88 LADSPA_Handle *chhandles; 89 int *activated; /**< 0 or 1. Activate LADSPA filters only once, even 90 * if the buffers get resized, to avoid a stuttering 91 * filter. 92 */ 94 93 95 94 } af_ladspa_t; 96 95 … … 252 251 } 253 252 254 253 if (LADSPA_IS_HINT_BOUNDED_ABOVE(hint.HintDescriptor)) { 255 mp_msg(MSGT_AFILTER, MSGL_V, "%0.2f] \n", hint.UpperBound);254 mp_msg(MSGT_AFILTER, MSGL_V, "%0.2f]", hint.UpperBound); 256 255 } else { 257 mp_msg(MSGT_AFILTER, MSGL_V, "...] \n");256 mp_msg(MSGT_AFILTER, MSGL_V, "...]"); 258 257 } 259 258 259 if (LADSPA_IS_HINT_SAMPLE_RATE(hint.HintDescriptor)) { 260 mp_msg(MSGT_AFILTER, MSGL_V, "*srate\n"); 261 } else { 262 mp_msg(MSGT_AFILTER, MSGL_V, "\n"); 263 } 260 264 } 261 265 262 266 return AF_OK; … … 615 619 setup->plugin_descriptor->PortRangeHints[p]; 616 620 val = setup->inputcontrols[p]; 617 621 618 if (LADSPA_IS_HINT_BOUNDED_BELOW(hint.HintDescriptor) && 619 val < hint.LowerBound) { 620 mp_msg(MSGT_AFILTER, MSGL_ERR, MSGTR_AF_LADSPA_ErrControlBelow, 621 setup->myname, i, hint.LowerBound); 622 return AF_ERROR; 623 } 624 if (LADSPA_IS_HINT_BOUNDED_ABOVE(hint.HintDescriptor) && 625 val > hint.UpperBound) { 626 mp_msg(MSGT_AFILTER, MSGL_ERR, MSGTR_AF_LADSPA_ErrControlAbove, 627 setup->myname, i, hint.UpperBound); 628 return AF_ERROR; 622 if (!LADSPA_IS_HINT_SAMPLE_RATE(hint.HintDescriptor)) 623 { 624 if (LADSPA_IS_HINT_BOUNDED_BELOW(hint.HintDescriptor) && 625 val < hint.LowerBound ) { 626 mp_msg(MSGT_AFILTER, MSGL_ERR, MSGTR_AF_LADSPA_ErrControlBelow, 627 setup->myname, i, hint.LowerBound); 628 return AF_ERROR; 629 } 630 if (LADSPA_IS_HINT_BOUNDED_ABOVE(hint.HintDescriptor) && 631 val > hint.UpperBound ) { 632 mp_msg(MSGT_AFILTER, MSGL_ERR, MSGTR_AF_LADSPA_ErrControlAbove, 633 setup->myname, i, hint.UpperBound); 634 return AF_ERROR; 635 } 636 } else { 637 mp_msg(MSGT_AFILTER, MSGL_V, "%s: WARNING: boundaries depend on sample rate. not checked. take care\n", 638 setup->myname); 629 639 } 630 640 } 631 641 mp_msg(MSGT_AFILTER, MSGL_V, "%s: all controls have sane values\n", … … 704 714 } 705 715 free(setup->outbufs); 706 716 } 717 if (setup->activated) 718 free(setup->activated); 707 719 708 720 if (setup->libhandle) 709 721 dlclose(setup->libhandle); … … 787 799 788 800 if (!setup->chhandles) { 789 801 setup->chhandles = calloc(nch, sizeof(LADSPA_Handle)); 802 setup->activated = calloc(nch, sizeof(int)); 790 803 791 804 /* create handles 792 805 * for stereo effects, create one handle for two channels … … 801 814 } 802 815 803 816 setup->chhandles[i] = pdes->instantiate(pdes, rate); 817 setup->activated[i] = 0; 804 818 } 805 819 } 806 820 … … 832 846 } 833 847 } 834 848 849 mp_msg(MSGT_AFILTER, MSGL_DBG3, "%s: ch = %d, act = %d\n", 850 setup->myname, i, setup->activated[i]); 835 851 /* Activate filter (if it isn't already :) ) */ 836 852 837 if ( (pdes->activate) && (setup->activated == 0) ) {853 if ( (pdes->activate) && (setup->activated[i] == 0) ) { 838 854 pdes->activate(setup->chhandles[i]); 839 setup->activated = 1;855 setup->activated[i] = 1; 840 856 } 841 857 842 858 } /* All channels/filters done! except for... */
