Ticket #3152: filterwizard4.patch

File filterwizard4.patch, 37.1 KB (added by Marc Alban <marcalban@…>, 17 years ago)

Updated patch to rev. 18555

  • mythtv/libs/libmythtv/libmythtv.pro

     
    225225    HEADERS += profilegroup.h
    226226    SOURCES += profilegroup.cpp
    227227
     228    # Filter wizard stuff
     229    HEADERS += filterchaineditor.h
     230    SOURCES += filterchaineditor.cpp
     231
    228232    # XBox LED control
    229233    HEADERS += xbox.h
    230234    SOURCES += xbox.cpp
  • mythtv/libs/libmythtv/filterchaineditor.cpp

     
     1#include "filterchaineditor.h"
     2#include "filtermanager.h"
     3#include "libmyth/mythcontext.h"
     4#include <mythtv/libmythui/mythuihelper.h>
     5#include <qlayout.h>
     6
     7FilterChainEditor::FilterChainEditor(QString chain) :
     8    m_listbox(new ListBoxSetting(this)), m_dialog(NULL), m_redraw(true)
     9{
     10    addChild(m_listbox);
     11    m_listbox->setLabel(QObject::tr("Filter Chain"));
     12
     13    // Parse the filter string into individual filters
     14    m_filterList = QStringList::split(",", chain);
     15}
     16
     17QString FilterChainEditor::exec()
     18{
     19    int ret = QDialog::Accepted;
     20    m_redraw = true;
     21
     22    while ((QDialog::Accepted == ret) || m_redraw)
     23    {
     24        m_redraw = false;
     25
     26        load();
     27
     28        m_dialog = new ConfigurationDialogWidget(gContext->GetMainWindow(),
     29                                               "FilterChainEditor");
     30        connect(m_dialog, SIGNAL(menuButtonPressed()),
     31                  this,   SLOT(               open()));
     32        connect(m_dialog, SIGNAL(deleteButtonPressed()),
     33                  this,   SLOT(         deleteFilter()));
     34
     35        int   width = 0,    height = 0;
     36        float wmult = 0.0f, hmult  = 0.0f;
     37       
     38        GetMythUI()->GetScreenSettings(width, wmult, height, hmult);
     39
     40        QVBoxLayout *layout = new QVBoxLayout(m_dialog, (int)(20 * hmult));
     41        layout->addWidget(m_listbox->configWidget(NULL, m_dialog));
     42
     43        m_dialog->Show();
     44        ret = m_dialog->exec();
     45       
     46        m_dialog->deleteLater();
     47        m_dialog = NULL;
     48
     49        if (ret == QDialog::Accepted)
     50        {
     51            editFilter(m_listbox->getValue().toInt());
     52        }
     53    }
     54    return getFilterString();
     55}
     56
     57void FilterChainEditor::load(void)
     58{
     59    m_listbox->clearSelections();
     60
     61    // Fill the listbox with filters in the filter chain
     62    int index = 1;
     63    for (QStringList::Iterator i = m_filterList.begin(); i != m_filterList.end(); ++i)
     64    {
     65        m_listbox->addSelection(*i, QString::number(index));
     66        index++;
     67    }
     68    m_listbox->addSelection(QObject::tr("(Add new filter)"), "0");
     69
     70    if (m_lastSelected < index && m_lastSelected >= 0)
     71    {
     72        m_listbox->setValue(m_lastSelected);
     73    }
     74    m_lastSelected = 0;
     75}
     76
     77void FilterChainEditor::open()
     78{
     79    int id = m_listbox->getValue().toInt();
     80    if (id != 0)
     81    {
     82        // Prompt user for action
     83        QStringList buttons;
     84        buttons << QObject::tr("Move Up");
     85        buttons << QObject::tr("Move Down");
     86        buttons << QObject::tr("Remove");
     87        buttons << QObject::tr("Cancel");
     88        int value = MythPopupBox::ShowButtonPopup(gContext->GetMainWindow(),
     89                                         "", QObject::tr("Filter Options"),
     90                                         buttons, kDialogCodeButton3);
     91        if (value == 0)
     92        {
     93            raiseFilter();   // Move the filter up in the chain
     94        }
     95        else if (value == 1)
     96        {
     97            lowerFilter();   // Move the filter down in the chain
     98        }
     99        else if (value == 2)
     100        {
     101            deleteFilter();  // Remove the filter from the chain
     102        }
     103    }
     104}
     105
     106void FilterChainEditor::deleteFilter()
     107{
     108    int id = m_listbox->getValue().toInt();
     109    if (id == 0)
     110    {
     111        return;
     112    }
     113
     114    // Prompt user for confirmation
     115    int value = MythPopupBox::Show2ButtonPopup(gContext->GetMainWindow(),"",
     116                                     QObject::tr("Delete filter?"),
     117                                     QObject::tr("Yes, delete filter"),
     118                                     QObject::tr("No, Don't delete filter"), kDialogCodeButton2);
     119    if (value == 0)
     120    {
     121        m_filterList.removeAt(id - 1);
     122        m_redraw = true;
     123        if (m_dialog)
     124        {
     125            m_dialog->done(QDialog::Rejected);
     126        }
     127    }
     128}
     129
     130void FilterChainEditor::editFilter(int id)
     131{
     132    if (id != 0)
     133    {
     134        m_lastSelected = id - 1;
     135        QString filterName = m_filterList.at(id - 1).section('=', 0, 0);
     136        const FilterInfo* info = m_manager.GetFilterInfo(filterName);
     137        if (info)
     138        {
     139            QStringList parameters = QStringList::split(",", info->params);
     140            if (parameters.size() > 0)
     141            {
     142                // Edit the filters parameters
     143                FilterWizard filterwizard(filterName);
     144                filterwizard.loadByString(m_filterList.at(id - 1).section('=', 1));
     145                if (filterwizard.exec(false) == QDialog::Accepted)
     146                {
     147                    filterwizard.Save();
     148                    m_filterList.replace(id - 1, filterwizard.getString());
     149                }
     150            }
     151        }
     152    }
     153    else
     154    {
     155        // Allow user to choose which type of filter to add
     156        FilterSelector selector;
     157        selector.exec();
     158        if (selector.getString() != "")
     159        {
     160            m_filterList.append(selector.getString());
     161        }
     162    }
     163}
     164
     165void FilterChainEditor::raiseFilter()
     166{
     167    int id = m_listbox->getValue().toInt() - 1;
     168    if (id <= 0)
     169    {
     170        return;
     171    }
     172       
     173    m_lastSelected = id - 1;
     174    m_filterList.swap(id - 1, id);
     175    m_redraw = true;
     176   
     177    if (m_dialog)
     178    {
     179        m_dialog->done(QDialog::Rejected);
     180    }
     181}
     182
     183void FilterChainEditor::lowerFilter()
     184{
     185    int id = m_listbox->getValue().toInt() - 1;
     186    if (id >= (int)m_filterList.size() - 1)
     187    {
     188        return;
     189    }
     190       
     191    m_lastSelected = id + 1;
     192    m_filterList.swap(id, id + 1);
     193    m_redraw = true;
     194   
     195    if (m_dialog)
     196    {
     197        m_dialog->done(QDialog::Rejected);
     198    }
     199}
     200
     201QString FilterChainEditor::getFilterString()
     202{
     203    // Concatenate all the filters together with commas
     204    QStringListIterator iter(m_filterList);
     205    QString filterstring = "";
     206    bool hasFirst = false;
     207    while (iter.hasNext())
     208    {
     209       if (hasFirst)
     210       {
     211          filterstring.append(",");
     212       }
     213       hasFirst = true;
     214       filterstring.append(iter.next());
     215    }
     216
     217    return filterstring;
     218}
     219
     220FilterSelector::FilterSelector() : m_listbox(new FilterListBox(this)),
     221    m_help(new TransLabelSetting()), m_dialog(NULL), m_redraw(true)
     222{
     223    addChild(m_listbox);
     224    addChild(m_help);
     225    m_listbox->setLabel(QObject::tr("Filters"));
     226}
     227
     228int FilterSelector::exec()
     229{
     230    int ret = QDialog::Accepted;
     231    m_redraw = true;
     232
     233    while ((QDialog::Accepted == ret) || m_redraw)
     234    {
     235        m_redraw = false;
     236
     237        load();
     238
     239        m_dialog = new ConfigurationDialogWidget(gContext->GetMainWindow(),
     240                                               "FilterSelector");
     241
     242        int   width = 0,    height = 0;
     243        float wmult = 0.0f, hmult  = 0.0f;
     244        GetMythUI()->GetScreenSettings(width, wmult, height, hmult);
     245
     246        QVBoxLayout *layout = new QVBoxLayout(m_dialog, (int)(20 * hmult));
     247        layout->addWidget(m_listbox->configWidget(NULL, m_dialog));
     248        layout->addWidget(m_help->configWidget(NULL, m_dialog));
     249
     250        connect(m_listbox, SIGNAL(highlighted(int)),
     251                this,      SLOT(  setHelpText(int)));
     252        m_dialog->Show();
     253        ret = m_dialog->exec();
     254        m_dialog->deleteLater();
     255        m_dialog = NULL;
     256
     257        if (ret == QDialog::Accepted)
     258        {
     259            if (open(m_listbox->getSelectionLabel()) == QDialog::Accepted)
     260            {
     261                return ret;
     262            }
     263        }
     264    }
     265
     266    return QDialog::Rejected;
     267}
     268
     269void FilterSelector::load(void)
     270{
     271    m_listbox->clearSelections();
     272
     273    // Get the list of the available filters on the system
     274    filter_map_t info = m_manager.GetAllFilterInfo();
     275    filter_map_t::iterator iter;
     276
     277    for (iter = info.begin(); iter != info.end(); ++iter)
     278    {
     279        m_listbox->addSelection(iter->second->name);
     280    }
     281   
     282    m_listbox->setValue(0);
     283    setHelpText(0);
     284}
     285
     286void FilterSelector::setHelpText(int id)
     287{
     288    const FilterInfo* info = m_manager.GetFilterInfo(m_listbox->getSelectionLabel());
     289    m_help->setValue(info->descript);
     290}
     291
     292int FilterSelector::open(QString filterName)
     293{
     294    const FilterInfo* info = m_manager.GetFilterInfo(filterName);
     295   
     296    QString params(info->params);
     297    if (!params.isNull() && !params.isEmpty())
     298    {
     299        QStringList parameters = QStringList::split(",", params);
     300        FilterWizard filterwizard(filterName);
     301        if (filterwizard.exec(false) == QDialog::Accepted)
     302        {
     303            filterwizard.Save();
     304            m_filterstring = filterwizard.getString();
     305            return QDialog::Accepted;
     306        }
     307        return QDialog::Rejected;
     308    }
     309    m_filterstring = filterName;
     310    return QDialog::Accepted;
     311}
     312
     313QWidget* FilterListBox::configWidget(ConfigurationGroup *cg, QWidget* parent,
     314                                  const char* widgetName)
     315{
     316    QWidget* box = ListBoxSetting::configWidget(cg,parent,widgetName);
     317
     318    connect(widget, SIGNAL(highlighted(int)),
     319            this,   SIGNAL(highlighted(int)));
     320
     321    return box;
     322}
     323
     324FilterWizard::FilterWizard(QString name)
     325{
     326    m_name = name;
     327    m_hasDisable = false;
     328    m_config = new VerticalConfigurationGroup(false);
     329    m_config->setLabel("Filters->" + m_name);
     330
     331    FilterManager manager;
     332    const FilterInfo* info = manager.GetFilterInfo(m_name);
     333    QStringList parameters = QStringList::split(",", info->params);
     334
     335    // Create a widget for each parameter
     336    QStringListIterator iter(parameters);
     337    while(iter.hasNext())
     338    {
     339        QStringList description = QStringList::split(":", iter.next());
     340        if (description.size() == 3 && description[0] == "disable")
     341        {
     342            // The disable parameter is special and overrides all the other
     343            // parameters.  If the filter is disabled then none of the
     344            // other parameters will be stored.
     345            m_disableBox = new DisableFilterParam(description);
     346            m_config->addChild(m_disableBox);
     347            m_hasDisable = true;
     348        }
     349        else
     350        {
     351            QString* store = new QString("");
     352            if (description.count() == 6 && description[0] == "int")
     353            {
     354                IntegerFilterParam* param = new IntegerFilterParam(description, store);
     355                m_config->addChild(param);
     356                m_values.append(store);
     357            }
     358            else if (description.size() == 6 && description[0] == "float")
     359            {
     360                FloatFilterParam* param = new FloatFilterParam(description, store);
     361                m_config->addChild(param);
     362                m_values.append(store);
     363            }
     364            else if (description.size() == 5 && description[0] == "flag")
     365            {
     366                BooleanFilterParam* param = new BooleanFilterParam(description, store);
     367                m_config->addChild(param);
     368                m_values.append(store);
     369            }
     370            else
     371            {
     372               delete store;
     373            }
     374        }
     375    }
     376    addChild(m_config);
     377}
     378
     379FilterWizard::~FilterWizard()
     380{
     381    QListIterator<QString*> values(m_values);
     382    while (values.hasNext())
     383    {
     384        delete values.next();
     385    }
     386}
     387
     388void FilterWizard::loadByString(QString params)
     389{
     390    // Split the existing filter string into individual parameter values
     391    QStringList parameters = QStringList::split(":", params);
     392
     393    // If the filter is disabled don't look for the rest of the parameters in
     394    // the string.
     395    if (m_hasDisable && parameters.count() == 1 && parameters[0] == m_disableBox->getFlag())
     396    {
     397        m_disableBox->setValue(true);
     398    }
     399    else
     400    {
     401        for (int i = 0; i < parameters.count() && i < m_values.count(); i++)
     402        {
     403            m_values.value(i)->truncate(0);
     404            m_values.value(i)->append(parameters[i]);
     405        }
     406    }
     407    m_config->Load();
     408}
     409
     410QString FilterWizard::getString()
     411{
     412    // Construct a filter parameter string from the widget values
     413    QString filterstring = m_name;
     414    QString parameters = "";
     415
     416    // If the filter is disabled don't output any other parameters
     417    if (m_hasDisable && m_disableBox->boolValue() == true)
     418    {
     419        parameters = m_disableBox->getFlag();
     420    }
     421    else
     422    {
     423        bool hasFirst = false;
     424        QListIterator<QString*> values(m_values);
     425        while (values.hasNext())
     426        {
     427           QString* value = values.next();
     428           if (!value->isNull() && !value->isEmpty())
     429           {
     430              if (hasFirst)
     431              {
     432                 parameters.append(":");
     433              }
     434              hasFirst = true;
     435              parameters.append(*value);
     436           }
     437        }
     438    }
     439    if (parameters.stripWhiteSpace() != "")
     440    {
     441        filterstring.append("=" + parameters);
     442    }
     443   
     444    return filterstring;
     445}
     446
     447FilterWizard::IntegerFilterParam::IntegerFilterParam(QStringList info, QString* store) :
     448    SliderSetting::SliderSetting(this,0,255,1), stringVal(store)
     449{
     450    if (info.count() == 6)
     451    {
     452        min = info[3].toInt();
     453        max = info[4].toInt();
     454
     455        setName(info[1]);
     456        setLabel(info[1]);
     457        setHelpText(info[2]);
     458
     459        setValue(info[5].toInt());
     460        stringVal->append(info[5]);
     461    }
     462}
     463
     464void FilterWizard::IntegerFilterParam::Save()
     465{
     466    stringVal->truncate(0);
     467    stringVal->append(getValue());
     468}
     469
     470FilterWizard::FloatFilterParam::FloatFilterParam(QStringList info, QString* store) :
     471    SliderSetting::SliderSetting(this,0,100,1), stringVal(store)
     472{
     473    if (info.count() == 6)
     474    {
     475        min = info[3].toFloat() >= 0 ? int(info[3].toFloat() * 100.0 + .1) :
     476                                       int(info[3].toFloat() * 100.0 - .1);
     477        max = info[4].toFloat() >= 0 ? int(info[4].toFloat() * 100.0 + .1) :
     478                                       int(info[4].toFloat() * 100.0 - .1 );
     479
     480        setName(info[1]);
     481        setLabel(info[1]);
     482        setHelpText(info[2]);
     483
     484        int defVal = info[5].toFloat() >= 0 ? int(info[5].toFloat() * 100.0 + .1) :
     485                                              int(info[5].toFloat() * 100.0 - .1);
     486        setValue(defVal);
     487        stringVal->append(info[5]);
     488    }
     489}
     490
     491void FilterWizard::FloatFilterParam::Load()
     492{
     493     setValue(stringVal->toFloat() >= 0 ? int(stringVal->toFloat() * 100.0 + .1) :
     494                                            int(stringVal->toFloat() * 100.0 - .1));
     495}
     496
     497void FilterWizard::FloatFilterParam::Save()
     498{
     499    stringVal->truncate(0);
     500    stringVal->append(QString::number((float)(getValue().toInt()) / 100.0,'f',2));
     501}
     502
     503FilterWizard::BooleanFilterParam::BooleanFilterParam(QStringList info, QString* store) :
     504    CheckBoxSetting::CheckBoxSetting(this), stringVal(store)
     505{
     506    if (info.count() == 5)
     507    {
     508        setName(info[1]);
     509        setLabel(info[1]);
     510        setHelpText(info[2]);
     511
     512        flag = info[3];
     513        if (info[4] == "on")
     514        {
     515           setValue(true);
     516           stringVal->append(flag);
     517        }
     518        else
     519        {
     520           setValue(false);
     521        }
     522        setEnabled(true);
     523    }
     524}
     525
     526void FilterWizard::BooleanFilterParam::Save()
     527{
     528    stringVal->truncate(0);
     529    stringVal->append(boolValue() ? flag : "");
     530}
     531
     532FilterWizard::DisableFilterParam::DisableFilterParam(QStringList info) :
     533    CheckBoxSetting::CheckBoxSetting(this)
     534{
     535    if (info.count() == 3)
     536    {
     537        setName(info[0]);
     538        setLabel(info[0]);
     539        setHelpText(QObject::tr("Disable the filter."));
     540
     541        flag = info[1];
     542        if (info[2] == "yes")
     543        {
     544           setValue(true);
     545        }
     546        else
     547        {
     548           setValue(false);
     549        }
     550        setEnabled(true);
     551    }
     552}
  • mythtv/libs/libmythtv/filter.h

     
    2626    char *descript;
    2727    FmtConv *formats;
    2828    char *libname;
     29    char *params;
    2930} FilterInfo;
    3031
    3132typedef struct  VideoFilter_
  • mythtv/libs/libmythtv/filtermanager.cpp

     
    105105        free(tmp->name);
    106106        free(tmp->descript);
    107107        free(tmp->libname);
     108        free(tmp->params);
    108109        delete [] (tmp->formats);
    109110        delete tmp;
    110111    }
     
    161162        newFilter->symbol   = strdup(filtInfo->symbol);
    162163        newFilter->name     = strdup(filtInfo->name);
    163164        newFilter->descript = strdup(filtInfo->descript);
     165        newFilter->params   = strdup(filtInfo->params);
    164166
    165167        int i = 0;
    166168        for (; filtInfo->formats[i].in != FMT_NONE; i++);
  • mythtv/libs/libmythtv/recordingprofile.h

     
    116116    void ResizeTranscode(bool resize);
    117117    void SetLosslessTranscode(bool lossless);
    118118    void FiltersChanged(const QString &val);
     119    void EditFilters();
    119120
    120121  private:
    121122    ID                       *id;
  • mythtv/libs/libmythtv/channelsettings.cpp

     
    11#include "channelsettings.h"
    22#include "cardutil.h"
    33#include "channelutil.h"
     4#include "filterchaineditor.h"
    45
    56QString ChannelDBStorage::GetWhereClause(MSqlBindings &bindings) const
    67{
     
    196197    }
    197198};
    198199
    199 class VideoFilters : public LineEditSetting, public ChannelDBStorage
     200class VideoFilterButton : public ButtonSetting, public ChannelDBStorage
    200201{
    201202  public:
    202     VideoFilters(const ChannelID &id) :
    203         LineEditSetting(this), ChannelDBStorage(this, id, "videofilters")
     203    VideoFilterButton(const ChannelID &id) :
     204        ButtonSetting(this), ChannelDBStorage(this, id, "videofilters")
    204205    {
    205206        setLabel(QObject::tr("Video filters"));
    206207        setHelpText(QObject::tr("Filters to be used when recording "
     
    211212};
    212213
    213214
    214 class OutputFilters : public LineEditSetting, public ChannelDBStorage
     215class OutputFilterButton : public ButtonSetting, public ChannelDBStorage
    215216{
    216217  public:
    217     OutputFilters(const ChannelID &id) :
    218         LineEditSetting(this), ChannelDBStorage(this, id, "outputfilters")
     218    OutputFilterButton(const ChannelID &id) :
     219        ButtonSetting(this), ChannelDBStorage(this, id, "outputfilters")
    219220    {
    220221        setLabel(QObject::tr("Playback filters"));
    221222        setHelpText(QObject::tr("Filters to be used when recordings "
     
    468469    setLabel(QObject::tr("Channel Options - Filters"));
    469470    setUseLabel(false);
    470471
    471     addChild(new VideoFilters(id));
    472     addChild(new OutputFilters(id));
     472    videoButton = new VideoFilterButton(id);
     473    outputButton = new OutputFilterButton(id);
     474
     475    addChild(videoButton);
     476    addChild(outputButton);
     477
     478    connect(videoButton,  SIGNAL(   pressed()),
     479            this,         SLOT(videoPressed()));
     480    connect(outputButton, SIGNAL(    pressed()),
     481            this,         SLOT(outputPressed()));
    473482}
    474483
     484void ChannelOptionsFilters::videoPressed()
     485{
     486    FilterChainEditor editor(videoButton->getValue());
     487    videoButton->setValue(editor.exec());
     488}
     489
     490void ChannelOptionsFilters::outputPressed()
     491{
     492    FilterChainEditor editor(outputButton->getValue());
     493    outputButton->setValue(editor.exec());
     494}
     495
    475496ChannelOptionsV4L::ChannelOptionsV4L(const ChannelID& id) :
    476497    VerticalConfigurationGroup(false, true, false, false)
    477498{
  • mythtv/libs/libmythtv/filterchaineditor.h

     
     1#ifndef FILTERCHAINEDITOR_H
     2#define FILTERCHAINEDITOR_H
     3
     4#include "libmyth/settings.h"
     5#include "libmyth/mythwidgets.h"
     6#include "filtermanager.h"
     7
     8class FilterWizard : public ConfigurationWizard
     9{
     10protected:
     11  class IntegerFilterParam : public SliderSetting, public TransientStorage
     12  {
     13  public:
     14    IntegerFilterParam(QStringList info, QString* store);
     15    void Load() {settingValue = *stringVal;}
     16    void Save();
     17  protected:
     18    QString* stringVal; // The stored value
     19  };
     20
     21  class FloatFilterParam : public SliderSetting, public TransientStorage
     22  {
     23    public:
     24      FloatFilterParam(QStringList info, QString* store);
     25      void Load();
     26      void Save();
     27    protected:
     28      QString* stringVal; // The stored value
     29  };
     30
     31  class BooleanFilterParam : public CheckBoxSetting, public TransientStorage
     32  {
     33    public:
     34      BooleanFilterParam(QStringList info, QString* store);
     35      void Load() {setValue(stringVal->compare(flag) == 0);}
     36      void Save();
     37    protected:
     38      QString  flag;      // The enabled flag
     39      QString* stringVal; // The stored value
     40  };
     41
     42  class DisableFilterParam : public CheckBoxSetting, public TransientStorage
     43  {
     44  public:
     45    DisableFilterParam(QStringList info);
     46    QString getFlag(){return flag;}
     47  protected:
     48    QString flag; // The enabled flag
     49  };
     50
     51  VerticalConfigurationGroup *m_config;
     52  DisableFilterParam         *m_disableBox;
     53  bool                        m_hasDisable; // If this filter can be disabled
     54  QList<QString*>             m_values;     // List of the stored values
     55  QString                     m_name;       // Filter name
     56
     57public:
     58  FilterWizard(QString name);
     59  ~FilterWizard();
     60  void loadByString(QString params);
     61  QString getString();
     62};
     63
     64class FilterListBox : public ListBoxSetting
     65{
     66Q_OBJECT
     67public:
     68  FilterListBox(Storage *_storage) : ListBoxSetting(_storage){}
     69  virtual QWidget* configWidget(ConfigurationGroup *cg, QWidget* parent,
     70                                  const char* widgetName = 0);
     71signals:
     72  void highlighted(int);
     73};
     74
     75class MPUBLIC FilterSelector : public QObject, public ConfigurationDialog
     76{
     77Q_OBJECT
     78public:
     79  FilterSelector();
     80  QString getString(){return m_filterstring;}
     81  virtual int exec();
     82  virtual void load();
     83  virtual void save(){};
     84
     85protected slots:
     86  int open(QString filterName);
     87  void setHelpText(int id);
     88
     89protected:
     90  FilterManager      m_manager;      // Gets info on available filters
     91  QString            m_filterstring; // [[<filter>=<options>,]...]
     92  FilterListBox     *m_listbox;
     93  TransLabelSetting *m_help;
     94  MythDialog        *m_dialog;
     95  bool               m_redraw;
     96};
     97
     98class MPUBLIC FilterChainEditor : public QObject, public ConfigurationDialog
     99{
     100Q_OBJECT
     101public:
     102  FilterChainEditor(QString chain);
     103  virtual QString exec();
     104  virtual void load();
     105  virtual void save(){};
     106
     107protected slots:
     108  void open();
     109  void deleteFilter();            // Remove filter from the chain
     110
     111protected:
     112  void raiseFilter();             // Move filter forward in the chain
     113  void lowerFilter();             // Move filter backward in the chain
     114  void editFilter(int id);        // Modify filter paramters
     115  QString getFilterString();      // Return a comma delineated filter list
     116  FilterManager   m_manager;      // Gets info on available filters
     117  QStringList     m_filterList;   // list of [[<filter>=<options>,]...]
     118  ListBoxSetting *m_listbox;
     119  MythDialog     *m_dialog;
     120  int             m_lastSelected;
     121  bool            m_redraw;
     122};
     123
     124#endif
  • mythtv/libs/libmythtv/filtermanager.h

     
    4545                             VideoFrameType &outpixfmt, int &width,
    4646                             int &height, int &bufsize);
    4747
     48    const FilterInfo *GetFilterInfo(const QString &name) const;
     49   
     50    filter_map_t GetAllFilterInfo()
     51    {
     52      return filter_map_t(filters);
     53    }
     54   
    4855  private:
    4956    bool LoadFilterLib(const QString &path);
    50     const FilterInfo *GetFilterInfo(const QString &name) const;
    51 
     57   
    5258    library_map_t dlhandles;
    5359    filter_map_t  filters;
    5460};
  • mythtv/libs/libmythtv/recordingprofile.cpp

     
    44#include <QLayout>
    55
    66#include "recordingprofile.h"
     7#include "filterchaineditor.h"
    78#include "cardutil.h"
    89#include "libmyth/mythcontext.h"
    910#include "libmythdb/mythdb.h"
     
    994995    };
    995996};
    996997
    997 class TranscodeFilters : public LineEditSetting, public CodecParamStorage
     998class TranscodeFilters : public ButtonSetting, public CodecParamStorage
    998999{
    9991000  public:
    10001001    TranscodeFilters(const RecordingProfile &parent) :
    1001         LineEditSetting(this),
     1002        ButtonSetting(this),
    10021003        CodecParamStorage(this, parent, "transcodefilters")
    10031004    {
    10041005        setLabel(QObject::tr("Custom Filters"));
    10051006        setHelpText(QObject::tr("Filters used when transcoding with this "
    10061007                                "profile. This value must be blank to perform "
    1007                                 "lossless transcoding.  Format: "
    1008                                 "[[<filter>=<options>,]...]"
     1008                                "lossless transcoding."
    10091009                                ));
    10101010    };
    10111011};
     
    12731273                    this,        SLOT(  SetLosslessTranscode(bool)));
    12741274            connect(tr_filters,  SIGNAL(valueChanged(const QString&)),
    12751275                    this,        SLOT(FiltersChanged(const QString&)));
     1276            connect(tr_filters,  SIGNAL(pressed  ()),
     1277                    this,        SLOT(EditFilters()));
    12761278        }
    12771279    }
    12781280    else if (type.toUpper() == "DVB")
     
    12841286    Load();
    12851287}
    12861288
     1289void RecordingProfile::EditFilters()
     1290{
     1291    FilterChainEditor editor(tr_filters->getValue());
     1292    tr_filters->setValue(editor.exec());
     1293}
     1294
    12871295void RecordingProfile::FiltersChanged(const QString &val)
    12881296{
    12891297    if (!tr_filters || !tr_lossless)
  • mythtv/libs/libmythtv/channelsettings.h

     
    105105
    106106class OnAirGuide;
    107107class XmltvID;
     108class VideoFilterButton;
     109class OutputFilterButton;
    108110
    109111class ChannelOptionsCommon: public VerticalConfigurationGroup
    110112{
     
    124126};
    125127
    126128class ChannelOptionsFilters: public VerticalConfigurationGroup {
     129Q_OBJECT
    127130public:
    128131    ChannelOptionsFilters(const ChannelID& id);
     132public slots:
     133    void outputPressed();
     134    void videoPressed();
     135protected:
     136    VideoFilterButton  *videoButton;
     137    OutputFilterButton *outputButton;
    129138};
    130139
    131140class ChannelOptionsV4L: public VerticalConfigurationGroup {
  • mythtv/filters/linearblend/filter_linearblend.c

     
    380380        name:       "linearblend",
    381381        descript:   "fast blending deinterlace filter",
    382382        formats:    FmtList,
    383         libname:    NULL
     383        libname:    NULL,
     384        params:     ""
    384385    },
    385386    FILT_NULL
    386387};
  • mythtv/filters/quickdnr/filter_quickdnr.c

     
    586586        name:       "quickdnr",
    587587        descript:   "removes noise with a fast single/double thresholded average filter",
    588588        formats:    FmtList,
    589         libname:    NULL
     589        libname:    NULL,
     590        params:     "int:threshold:Less to more filtering.:0:255:0"
    590591    },
    591592    FILT_NULL
    592593};
  • mythtv/filters/postprocess/filter_postprocess.c

     
    133133        name:       "postprocess",
    134134        descript:   "FFMPEG's postprocessing filters",
    135135        formats:    FmtList,
    136         libname:    NULL
     136        libname:    NULL,
     137        params:     ""
    137138    },
    138139    FILT_NULL
    139140};
  • mythtv/filters/onefield/filter_onefield.c

     
    101101    {
    102102        symbol:     "new_filter",
    103103        name:       "onefield",
    104         descript:   "one-field-only deinterlace filter; parameter \"bottom\" for bottom field, otherwise top",
     104        descript:   "one-field-only deinterlace filter",
    105105        formats:    FmtList,
    106106        libname:    NULL,
     107        params:     "flag:keep bottom field:Keep the bottom field instead of the top one.:bottom:off"
    107108    },
    108109    FILT_NULL
    109110};
  • mythtv/filters/bobdeint/filter_bobdeint.c

     
    150150        descript:   "bob deinterlace filter; splits fields to top and bottom of buffer",
    151151        formats:    FmtList,
    152152        libname:    NULL,
     153        params:     ""
    153154    },
    154155    FILT_NULL
    155156};
  • mythtv/filters/adjust/filter_adjust.c

     
    313313        name:       "adjust",
    314314        descript:   "adjust range and gamma of video",
    315315        formats:    FmtList,
    316         libname:    NULL
     316        libname:    NULL,
     317        params:     "disable:-1:no,"
     318                    "int:minimum luma:Minimum luma input value.:0:255:16,"
     319                    "int:maximum luma:Maximum luma input value.:0:255:253,"
     320                    "float:luma gamma:Luma gamma correction.:0:1:1,"
     321                    "int:minimum chroma:Minimum chroma input value.:0:255:2,"
     322                    "int:maximum chroma:Maximum chroma input value.:0:255:253,"
     323                    "float:chroma gamma:Chroma gamma correction.:0:1:1"
    317324    },
    318325    FILT_NULL
    319326};
  • mythtv/filters/yadif/filter_yadif.c

     
    592592            name:       "yadifdeint",
    593593            descript:   "combines data from several fields to deinterlace with less motion blur",
    594594            formats:    FmtList,
    595             libname:    NULL
     595            libname:    NULL,
     596            params:     ""
    596597    },
    597598    {
    598599symbol:     "YadifDeintFilter",
    599600            name:       "yadifdoubleprocessdeint",
    600601            descript:   "combines data from several fields to deinterlace with less motion blur",
    601602            formats:    FmtList,
    602             libname:    NULL
     603            libname:    NULL,
     604            params:     ""
    603605    },FILT_NULL
    604606};
    605607
  • mythtv/filters/force/filter_force.c

     
    101101        name:       "forceyv12",
    102102        descript:   "forces use of YV12 video format",
    103103        formats:    Fmt_List_YV12,
    104         libname:    NULL
     104        libname:    NULL,
     105        params:     ""
    105106    },
    106107    {
    107108        symbol:     "new_force_yuv422p",
    108109        name:       "forceyuv422p",
    109110        descript:   "forces use of YUV422P video format",
    110111        formats:    Fmt_List_YUV422P,
    111         libname:    NULL
     112        libname:    NULL,
     113        params:     ""
    112114    },
    113115    {
    114116        symbol:     "new_force_rgb24",
    115117        name:       "forcergb24",
    116118        descript:   "forces use of RGB24 video format",
    117119        formats:    Fmt_List_RGB24,
    118         libname:    NULL
     120        libname:    NULL,
     121        params:     ""
    119122    },
    120123    {
    121124        symbol:     "new_force_argb32",
    122125        name:       "forceargb32",
    123126        descript:   "forces use of ARGB32 video format",
    124127        formats:    Fmt_List_ARGB32,
    125         libname:    NULL
     128        libname:    NULL,
     129        params:     ""
    126130    },
    127131    FILT_NULL
    128132};
  • mythtv/filters/crop/filter_crop.c

     
    301301        name:       "crop",
    302302        descript:   "crops picture by macroblock intervals",
    303303        formats:    FmtList,
    304         libname:    NULL
     304        libname:    NULL,
     305        params:     "int:top:Amount to crop on top as number of 16 pixel blocks.:0:255:1,"
     306                    "int:left:Amount to crop on left as number of 16 pixel blocks.:0:255:1,"
     307                    "int:bottom:Amount to crop on bottom as number of 16 pixel blocks.:0:255:1,"
     308                    "int:right:Amount to crop on right as number of 16 pixel blocks.:0:255:1"
    305309    },
    306310    FILT_NULL
    307311};
  • mythtv/filters/kerneldeint/filter_kerneldeint.c

     
    370370        name:       "kerneldeint",
    371371        descript:   "combines data from several fields to deinterlace with less motion blur",
    372372        formats:    FmtList,
    373         libname:    NULL
     373        libname:    NULL,
     374        params:     "int:threshold:Adjacent lines differing by more than the threshold value are filtered.:0:255:10,"
     375                    "flag:skip chroma:If enabled only luminance will be filtered.:1:off"
    374376    },
    375377    FILT_NULL
    376378};
  • mythtv/filters/ivtc/filter_ivtc.c

     
    252252        name:       "ivtc",
    253253        descript:   "inverse telecine filter",
    254254        formats:    FmtList,
    255         libname:    NULL   
     255        libname:    NULL,
     256        params:     ""
    256257    },
    257258    FILT_NULL
    258259};
  • mythtv/filters/invert/filter_invert.c

     
    7979        name:       "invert",
    8080        descript:   "inverts the colors of the input video",
    8181        formats:    FmtList,
    82         libname:    NULL
     82        libname:    NULL,
     83        params:     ""
    8384    },
    8485    FILT_NULL
    8586};
  • mythtv/filters/greedyhdeint/filter_greedyhdeint.c

     
    333333            name:       "greedyhdeint",
    334334            descript:   "combines data from several fields to deinterlace with less motion blur",
    335335            formats:    FmtList,
    336             libname:    NULL
     336            libname:    NULL,
     337            params:     ""
    337338    },
    338339    {
    339340symbol:     "GreedyHDeintFilter",
    340341            name:       "greedyhdoubleprocessdeint",
    341342            descript:   "combines data from several fields to deinterlace with less motion blur",
    342343            formats:    FmtList,
    343             libname:    NULL
     344            libname:    NULL,
     345            params:     ""
    344346    },FILT_NULL
    345347};
    346348
  • mythtv/filters/denoise3d/filter_denoise3d.c

     
    474474        name:       "denoise3d",
    475475        descript:   "removes noise with a spatial and temporal low-pass filter",
    476476        formats:    FmtList,
    477         libname:    NULL
     477        libname:    NULL,
     478        params:     "float:luma spatial filter strength:Luma spatial filter strength.:0:1:0,"
     479                    "float:chroma spatial filter strength:Chroma spatial filter strength.:0:1:0,"
     480                    "float:luma temporal filter strength:Luma temporal filter strength.:0:1:0"
    478481    },
    479482    FILT_NULL
    480483};