Ticket #1828: 1828-v1.patch

File 1828-v1.patch, 86.3 KB (added by danielk, 18 years ago)
  • libs/libmythtv/NuppelVideoRecorder.cpp

     
    2626#include "channelbase.h"
    2727#include "filtermanager.h"
    2828#include "recordingprofile.h"
     29#include "tv_rec.h"
     30#include "tv_play.h"
    2931
    3032extern "C" {
    3133#include "vbitext/vbi.h"
  • libs/libmythtv/tv.h

     
    11#ifndef TV_H
    22#define TV_H
    33
     4#include <qstring.h>
     5
    46/** \brief ChannelChangeDirection is an enumeration of possible channel
    57 *         changing directions.
    68 */
     
    5052
    5153const int kLiveTVAutoExpire = 10000;
    5254
    53 #include "tv_play.h"
    54 #include "tv_rec.h"
    55 
    5655QString StateToString(TVState state);
    5756
     57typedef enum PictureAdjustType
     58{
     59    kAdjustingPicture_None = 0,
     60    kAdjustingPicture_Playback,
     61    kAdjustingPicture_Channel,
     62    kAdjustingPicture_Recording,
     63} PictureAdjustType;
     64QString toTypeString(PictureAdjustType type);
     65QString toTitleString(PictureAdjustType type);
     66
     67typedef enum PictureAttribute
     68{
     69    kPictureAttribute_None = 0,
     70    kPictureAttribute_MIN = 1,
     71    kPictureAttribute_Brightness = 1,
     72    kPictureAttribute_Contrast,
     73    kPictureAttribute_Colour,
     74    kPictureAttribute_Hue,
     75    kPictureAttribute_Volume,
     76    kPictureAttribute_MAX
     77} PictureAttribute;
     78QString toString(PictureAttribute index);
     79
     80//#ifndef IGNORE_TV_PLAY_REC
     81//#include "tv_play.h"
     82//#include "tv_rec.h"
     83//#endif
     84
    5885#endif
  • libs/libmythtv/cardutil.h

     
    5050QString get_on_source(const QString&, uint, uint);
    5151QString get_on_input(const QString&, uint, const QString&);
    5252
     53bool set_on_source(const QString&, uint, uint, const QString);
     54
    5355typedef enum
    5456{
    5557    DVB_DEV_FRONTEND = 1,
     
    137139    static QString      GetVBIDevice(uint cardid, const QString &input)
    138140        { return get_on_input("vbidevice", cardid, input); }
    139141
     142
     143    static int          GetValueInt(const QString &col, uint cid, uint sid)
     144        { return get_on_source(col, cid, sid).toInt(); }
     145    static bool         SetValue(const QString &col, uint cid,
     146                                 uint sid, int val)
     147        { return set_on_source(col, cid, sid, QString::number(val)); }
     148    static bool         SetValue(const QString &col, uint cid,
     149                                 uint sid, const QString &val)
     150        { return set_on_source(col, cid, sid, val); }
     151
     152
    140153    static QString      GetDefaultInput(uint cardid);
    141154    static QString      GetInputName(uint cardid, uint sourceid);
    142155
     
    177190
    178191    // V4L info
    179192    static bool         hasV4L2(int videofd);
     193    static bool         GetV4LInfo(int videofd, QString &card,QString &driver);
    180194    static InputNames   probeV4LInputs(int videofd, bool &ok);
    181195
    182196  private:
  • libs/libmythtv/videosource.h

     
    269269    static void fillSelections(SelectSetting* setting);
    270270};
    271271
     272class VBIDevice;
     273
     274class V4LConfigurationGroup : public VerticalConfigurationGroup
     275{
     276   Q_OBJECT
     277
     278  public:
     279     V4LConfigurationGroup(CaptureCard &parent);
     280
     281  public slots:
     282    void probeCard(const QString &device);
     283
     284  private:
     285    CaptureCard       &parent;
     286    TransLabelSetting *cardinfo;
     287    VBIDevice         *vbidev;
     288    TunerCardInput    *input;
     289};
     290
     291class MPEGConfigurationGroup: public VerticalConfigurationGroup
     292{
     293   Q_OBJECT
     294
     295  public:
     296    MPEGConfigurationGroup(CaptureCard &parent);
     297
     298  public slots:
     299    void probeCard(const QString &device);
     300
     301  private:
     302    CaptureCard       &parent;
     303    TransLabelSetting *cardinfo;
     304    TunerCardInput    *input;
     305};
     306
     307class pcHDTVConfigurationGroup: public VerticalConfigurationGroup
     308{
     309    Q_OBJECT
     310
     311  public:
     312    pcHDTVConfigurationGroup(CaptureCard& a_parent);
     313
     314  public slots:
     315    void probeCard(const QString &device);
     316
     317  private:
     318    CaptureCard       &parent;
     319    TransLabelSetting *cardinfo;
     320    TunerCardInput    *input;
     321};
     322
    272323class TunerCardInput;
    273324class DVBCardName;
    274325class DVBCardType;
  • libs/libmythtv/tv_play.h

     
    215215    void ChangeVolume(bool up);
    216216    void ToggleMute(void);
    217217    void ToggleLetterbox(int letterboxMode = -1);
    218     void ChangeContrast(bool up, bool recorder);
    219     void ChangeBrightness(bool up, bool recorder);
    220     void ChangeColour(bool up, bool recorder);
    221     void ChangeHue(bool up, bool recorder);
    222218
    223219    bool FillMenuTracks(OSDGenericTree*, uint type);
    224220    void ChangeTrack(uint type, int dir);
     
    334330    void ToggleRecord(void);
    335331    void BrowseChannel(const QString &channum);
    336332
    337     void DoTogglePictureAttribute(void);
    338     void DoToggleRecPictureAttribute(void);
    339     void DoChangePictureAttribute(int control, bool up, bool rec);
     333    void DoTogglePictureAttribute(int type);
     334    void DoChangePictureAttribute(int type, int control, bool up);
    340335
    341336    void BuildOSDTreeMenu(void);
    342337    void ShowOSDTreeMenu(void);
     
    409404    bool doSmartForward;
    410405    bool queuedTranscode;
    411406    bool getRecorderPlaybackInfo; ///< Main loop should get recorderPlaybackInfo
    412     int picAdjustment;   ///< Player pict attr to modify (on arrow left or right)
    413     int recAdjustment;   ///< Which recorder picture attribute to modify...
     407    int adjustingPicture;
     408    ; ///< picture attribute to modify (on arrow left or right)
     409    int adjustingPictureAttribute;
    414410
    415411    bool ignoreKeys;
    416412    bool needToSwapPIP;
  • libs/libmythtv/guidegrid.cpp

     
    2424#include "infostructs.h"
    2525#include "programinfo.h"
    2626#include "oldsettings.h"
    27 #include "tv.h"
     27#include "tv_play.h"
     28#include "tv_rec.h"
    2829#include "progfind.h"
    2930#include "proglist.h"
    3031#include "util.h"
  • libs/libmythtv/channel.h

     
    4040    bool SwitchToInput(int newcapchannel, bool setstarting);
    4141
    4242    // Picture attributes.
    43     void SetBrightness(void);
    44     void SetContrast(void);
    45     void SetColour(void);
    46     void SetHue(void);
    47     int  ChangeBrightness(bool up);
    48     int  ChangeColour(bool up);
    49     int  ChangeContrast(bool up);
    50     int  ChangeHue(bool up);
     43    bool InitPictureAttributes(void);
     44    int  GetPictureAttribute(const QString db_col_name) const;
     45    int  ChangePictureAttribute(int, const QString db_col_name, bool up);
    5146
    5247    // PID caching
    5348    void SaveCachedPids(const pid_cache_t&) const;
     
    6156    bool IsTuned(void) const;
    6257  private:
    6358    // Helper Sets
    64     void SetColourAttribute(int attrib, const char *name);
    6559    void SetFreqTable(const int index);
    6660    int  SetFreqTable(const QString &name);
    6761    bool SetInputAndFormat(int newcapchannel, QString newFmt);
    6862
    6963    // Helper Gets
    70     unsigned short *GetV4L1Field(int attrib, struct video_picture &vid_pic);
    7164    int  GetCurrentChannelNum(const QString &channame);
    7265    QString GetFormatForChannel(QString channum,
    7366                                QString inputname);
    7467
    7568    // Helper Commands
    76     int  ChangeColourAttribute(int attrib, const char *name, bool up);
     69    bool InitPictureAttribute(const QString db_col_name);
    7770    bool TuneTo(const QString &chan, int finetune);
    7871    bool InitializeInputs(void);
    7972
     
    8174    // Data
    8275    QString     device;
    8376    int         videofd;
     77    QString     device_name;
     78    QString     driver_name;
     79    QMap<QString,int> pict_attr_default;
    8480
    8581    struct CHANLIST *curList; 
    8682    int         totalChannels;
  • libs/libmythtv/dbcheck.cpp

     
    1010#include "mythdbcon.h"
    1111
    1212/// This is the DB schema version expected by the running MythTV instance.
    13 const QString currentDatabaseVersion = "1137";
     13const QString currentDatabaseVersion = "1138";
    1414
    1515static bool UpdateDBVersionNumber(const QString &newnumber);
    1616static bool performActualUpdate(const QString updates[], QString version,
     
    22022202            return false;
    22032203    }
    22042204
     2205    if (dbver == "1137")
     2206    {
     2207        const QString updates[] = {
     2208"ALTER TABLE capturecard ADD contrast   INT NOT NULL default '0';",
     2209"ALTER TABLE capturecard ADD brightness INT NOT NULL default '0';",
     2210"ALTER TABLE capturecard ADD colour     INT NOT NULL default '0';",
     2211"ALTER TABLE capturecard ADD hue        INT NOT NULL default '0';",
     2212"",
     2213};
     2214
     2215       if (!performActualUpdate(updates, "1138", dbver))
     2216            return false;
     2217    }
     2218
    22052219//"ALTER TABLE capturecard DROP COLUMN dvb_recordts;" in 0.21
    22062220//"ALTER TABLE capturecard DROP COLUMN dvb_hw_decoder;" in 0.21
    22072221//"ALTER TABLE cardinput DROP COLUMN  preference;" in 0.22
  • libs/libmythtv/hdhrrecorder.cpp

     
    2727#include "atsctables.h"
    2828#include "atscstreamdata.h"
    2929#include "eithelper.h"
     30#include "tv_rec.h"
    3031
    3132#define LOC QString("HDHRRec(%1): ").arg(tvrec->GetCaptureCardNum())
    3233#define LOC_ERR QString("HDHRRec(%1), Error: ") \
  • libs/libmythtv/channelbase.h

     
    129129        { StoreInputChannels(inputs); }
    130130
    131131    // Picture attribute settings
    132     virtual void SetBrightness(void) {};
    133     virtual void SetColour(void) {};
    134     virtual void SetContrast(void) {};
    135     virtual void SetHue(void) {};
    136     virtual int  ChangeBrightness(bool up) { (void)up; return 0; };
    137     virtual int  ChangeColour(bool up)     { (void)up; return 0; };
    138     virtual int  ChangeContrast(bool up)   { (void)up; return 0; };
    139     virtual int  ChangeHue(bool up)        { (void)up; return 0; };
     132    virtual bool InitPictureAttributes(void) { return false; }
     133    virtual int  GetPictureAttribute(const QString) const { return 0; }
     134    virtual int  ChangePictureAttribute(int,const QString,bool) { return 0; }
    140135
    141136    bool CheckChannel(const QString &channum, QString& inputName) const;
    142137
  • libs/libmythtv/dbox2channel.h

     
    1414
    1515// Qt headers
    1616#include <qstring.h>
     17#include <qmutex.h>
    1718
    1819// MythTV headers
    1920#include "channelbase.h"
     21#include "tv_rec.h"
    2022
    2123class DBox2Recorder;
    2224class DBox2Channel;
  • libs/libmythtv/channelbase.cpp

     
    2020#include "videodev_myth.h"
    2121#include "channel.h"
    2222#include "frequencies.h"
    23 #include "tv.h"
     23#include "tv_rec.h"
    2424#include "mythcontext.h"
    2525#include "exitcodes.h"
    2626#include "mythdbcon.h"
  • libs/libmythtv/tv_play.cpp

     
    1010#include <qtimer.h>
    1111
    1212#include "mythdbcon.h"
    13 #include "tv.h"
     13#include "tv_play.h"
     14#include "tv_rec.h"
    1415#include "osd.h"
    1516#include "osdsurface.h"
    1617#include "osdtypes.h"
     
    162163    REG_KEY("TV Playback", "TOGGLESTRETCH", "Toggle time stretch speed", "");
    163164    REG_KEY("TV Playback", "TOGGLEAUDIOSYNC",
    164165            "Turn on audio sync adjustment controls", "");
    165     REG_KEY("TV Playback", "TOGGLEPICCONTROLS", "Turn on the playback picture "
    166             "adjustment controls", "F");
    167     REG_KEY("TV Playback", "TOGGLERECCONTROLS", "Turn on the recording picture "
    168             "adjustment controls", "G");
     166    REG_KEY("TV Playback", "TOGGLEPICCONTROLS",
     167            "Playback picture adjustments",                    "F");
     168    REG_KEY("TV Playback", "TOGGLECHANCONTROLS",
     169            "Recording picture adjustments for this channel",  "Ctrl+G");
     170    REG_KEY("TV Playback", "TOGGLERECCONTROLS",
     171            "Recording picture adjustments for this recorder", "G");
    169172    REG_KEY("TV Playback", "TOGGLEEDIT", "Start Edit Mode", "E");
    170173    REG_KEY("TV Playback", "CYCLECOMMSKIPMODE", "Cycle Commercial Skip mode", "");
    171174    REG_KEY("TV Playback", "GUIDE", "Show the Program Guide", "S");
     
    232235
    233236  Global:   Return, Enter, Space, Esc
    234237
    235   Global:          F1,
    236   Playback: Ctrl-B,                  F7,F8,F9,F10,F11
    237   Teletext            F2,F3,F4,F5,F6,F7,F8
    238   ITV                 F2,F3,F4,F5,F6,F7
    239  */
     238  Global:   F1,
     239  Playback:                   F7,F8,F9,F10,F11
     240  Teletext     F2,F3,F4,F5,F6,F7,F8
     241  ITV          F2,F3,F4,F5,F6,F7
     242
     243  Playback: Ctrl-B,Ctrl-G
     244*/
    240245}
    241246
    242247void *SpawnDecode(void *param)
     
    273278      update_osd_pos(false), endOfRecording(false), requestDelete(false),
    274279      doSmartForward(false),
    275280      queuedTranscode(false), getRecorderPlaybackInfo(false),
    276       picAdjustment(kPictureAttribute_None),
    277       recAdjustment(kPictureAttribute_None),
     281      adjustingPicture(kAdjustingPicture_None),
     282      adjustingPictureAttribute(kPictureAttribute_None),
    278283      ignoreKeys(false), needToSwapPIP(false), needToJumpMenu(false),
    279284      // Channel Editing
    280285      chanEditMapLock(true), ddMapSourceId(0), ddMapLoaderRunning(false),
     
    21632168        return;
    21642169    }
    21652170
    2166     if (picAdjustment != kPictureAttribute_None)
     2171    if (adjustingPicture)
    21672172    {
    21682173        for (unsigned int i = 0; i < actions.size(); i++)
    21692174        {
     
    21712176            handled = true;
    21722177
    21732178            if (action == "LEFT")
    2174                 DoChangePictureAttribute(picAdjustment, false, false);
     2179                DoChangePictureAttribute(adjustingPicture,
     2180                                         adjustingPictureAttribute, false);
    21752181            else if (action == "RIGHT")
    2176                 DoChangePictureAttribute(picAdjustment, true, false);
     2182                DoChangePictureAttribute(adjustingPicture,
     2183                                         adjustingPictureAttribute, true);
    21772184            else
    21782185                handled = false;
    21792186        }
    21802187    }
    2181    
    2182     if (recAdjustment)
    2183     {
    2184         for (unsigned int i = 0; i < actions.size(); i++)
    2185         {
    2186             QString action = actions[i];
    2187             handled = true;
    2188 
    2189             if (action == "LEFT")
    2190                 DoChangePictureAttribute(recAdjustment, false, true);
    2191             else if (action == "RIGHT")
    2192                 DoChangePictureAttribute(recAdjustment, true, true);
    2193             else
    2194                 handled = false;
    2195         }
    2196     }
    21972188   
    21982189    if (stretchAdjustment)
    21992190    {
     
    23182309            ChangeAudioSync(0);   // just display
    23192310        else if (action == "TOGGLEPICCONTROLS")
    23202311        {
    2321             if (usePicControls)
    2322             {
    2323                 picAdjustment += 1;
    2324                 if (picAdjustment >= kPictureAttribute_MAX)
    2325                     picAdjustment = kPictureAttribute_MIN;
    2326                 DoTogglePictureAttribute();
    2327             }
     2312            DoTogglePictureAttribute(kAdjustingPicture_Playback);
    23282313        }
    23292314        else if (action == "NEXTSCAN")
    23302315        {
     
    26932678                if (!CommitQueuedInput())
    26942679                    handled = false;
    26952680            }
     2681            else if (action == "TOGGLECHANCONTROLS")
     2682                DoTogglePictureAttribute(kAdjustingPicture_Channel);
    26962683            else if (action == "TOGGLERECCONTROLS")
    2697                 DoToggleRecPictureAttribute();
     2684                DoTogglePictureAttribute(kAdjustingPicture_Recording);
    26982685            else if (action == "TOGGLEBROWSE" && pseudoLiveTVState[aindx])
    26992686                ShowOSDTreeMenu();
    27002687            else
     
    48684855    }
    48694856}
    48704857
    4871 void TV::ChangeBrightness(bool up, bool recorder)
    4872 {
    4873     int brightness;
    4874     QString text;
    4875 
    4876     if (GetOSD())
    4877     {
    4878         if (recorder)
    4879         {
    4880             brightness = activerecorder->ChangeBrightness(up);
    4881             text = QString(tr("Brightness (REC) %1 %")).arg(brightness);
    4882             GetOSD()->ShowStatus(brightness * 10, true, tr("Adjust Recording"),
    4883                 text, 5, kOSDFunctionalType_RecPictureAdjust);
    4884         }
    4885         else
    4886         {
    4887             brightness = nvp->getVideoOutput()->ChangeBrightness(up);
    4888             gContext->SaveSetting("PlaybackBrightness", brightness);
    4889             text = QString(tr("Brightness %1 %")).arg(brightness);
    4890             GetOSD()->ShowStatus(brightness * 10, true, tr("Adjust Picture"),
    4891                 text, 5, kOSDFunctionalType_PictureAdjust);
    4892         }
    4893 
    4894         update_osd_pos = false;
    4895     }
    4896 }
    4897 
    4898 void TV::ChangeContrast(bool up, bool recorder)
    4899 {
    4900     int contrast;
    4901     QString text;
    4902 
    4903     if (GetOSD())
    4904     {
    4905         if (recorder)
    4906         {
    4907             contrast = activerecorder->ChangeContrast(up);
    4908             text = QString(tr("Contrast (REC) %1 %")).arg(contrast);
    4909             GetOSD()->ShowStatus(contrast * 10, true, tr("Adjust Recording"),
    4910                 text, 5, kOSDFunctionalType_RecPictureAdjust);
    4911         }
    4912         else
    4913         {
    4914             contrast = nvp->getVideoOutput()->ChangeContrast(up);
    4915             gContext->SaveSetting("PlaybackContrast", contrast);
    4916             text = QString(tr("Contrast %1 %")).arg(contrast);
    4917             GetOSD()->ShowStatus(contrast * 10, true, tr("Adjust Picture"),
    4918                 text, 5, kOSDFunctionalType_PictureAdjust);
    4919         }
    4920 
    4921         update_osd_pos = false;
    4922     }
    4923 }
    4924 
    4925 void TV::ChangeColour(bool up, bool recorder)
    4926 {
    4927     int colour;
    4928     QString text;
    4929 
    4930     if (GetOSD())
    4931     {
    4932         if (recorder)
    4933         {
    4934             colour = activerecorder->ChangeColour(up);
    4935             text = QString(tr("Colour (REC) %1 %")).arg(colour);
    4936             GetOSD()->ShowStatus(colour * 10, true, tr("Adjust Recording"),
    4937                 text, 5, kOSDFunctionalType_RecPictureAdjust);
    4938         }
    4939         else
    4940         {
    4941             colour = nvp->getVideoOutput()->ChangeColour(up);
    4942             gContext->SaveSetting("PlaybackColour", colour);
    4943             text = QString(tr("Colour %1 %")).arg(colour);
    4944             GetOSD()->ShowStatus(colour * 10, true, tr("Adjust Picture"),
    4945                 text, 5, kOSDFunctionalType_PictureAdjust);
    4946         }
    4947 
    4948         update_osd_pos = false;
    4949     }
    4950 }
    4951 
    4952 void TV::ChangeHue(bool up, bool recorder)
    4953 {
    4954     int hue;
    4955     QString text;
    4956 
    4957     if (GetOSD())
    4958     {
    4959         if (recorder)
    4960         {
    4961             hue = activerecorder->ChangeHue(up);
    4962             text = QString(tr("Hue (REC) %1 %")).arg(hue);
    4963             GetOSD()->ShowStatus(hue * 10, true, tr("Adjust Recording"),
    4964                 text, 5, kOSDFunctionalType_RecPictureAdjust);
    4965         }
    4966         else
    4967         {
    4968             hue = nvp->getVideoOutput()->ChangeHue(up);
    4969             gContext->SaveSetting("PlaybackHue", hue);
    4970             text = QString(tr("Hue %1 %")).arg(hue);
    4971             GetOSD()->ShowStatus(hue * 10, true, tr("Adjust Picture"),
    4972                 text, 5, kOSDFunctionalType_PictureAdjust);
    4973         }
    4974 
    4975         update_osd_pos = false;
    4976     }
    4977 }
    4978 
    49794858void TV::ChangeVolume(bool up)
    49804859{
    49814860    AudioOutput *aud = nvp->getAudioOutput();
     
    55995478{
    56005479    switch (osdType)
    56015480    {
    5602         case kOSDFunctionalType_RecPictureAdjust:
    5603             recAdjustment = kPictureAttribute_None;
    5604             break;
    56055481        case kOSDFunctionalType_PictureAdjust:
    5606             picAdjustment = kPictureAttribute_None;
     5482            adjustingPicture = kAdjustingPicture_None;
     5483            adjustingPictureAttribute = kPictureAttribute_None;
    56075484            break;
    56085485        case kOSDFunctionalType_SmartForward:
    56095486            doSmartForward = false;
     
    56195496    }
    56205497}
    56215498
    5622 void TV::DoTogglePictureAttribute(void)
     5499void TV::DoTogglePictureAttribute(int itype)
    56235500{
    5624     OSDSet *oset;
    5625     int value = 0;
     5501    PictureAdjustType type = (PictureAdjustType) itype;
    56265502
    5627     if (GetOSD())
    5628     {
    5629         oset = GetOSD()->GetSet("status");
    5630         QString title = tr("Adjust Picture");
    5631         QString picName;
     5503    adjustingPicture = type;
    56325504
    5633         AudioOutput *aud = NULL;
    5634         switch (picAdjustment)
    5635         {
    5636             case kPictureAttribute_Brightness:
    5637                 value = nvp->getVideoOutput()->GetCurrentBrightness();
    5638                 picName = QString("%1 %2 %").arg(tr("Brightness")).arg(value);
    5639                 break;
    5640             case kPictureAttribute_Contrast:
    5641                 value = nvp->getVideoOutput()->GetCurrentContrast();
    5642                 picName = QString("%1 %2 %").arg(tr("Contrast")).arg(value);
    5643                 break;
    5644             case kPictureAttribute_Colour:
    5645                 value = nvp->getVideoOutput()->GetCurrentColour();
    5646                 picName = QString("%1 %2 %").arg(tr("Colour")).arg(value);
    5647                 break;
    5648             case kPictureAttribute_Hue:
    5649                 value = nvp->getVideoOutput()->GetCurrentHue();
    5650                 picName = QString("%1 %2 %").arg(tr("Hue")).arg(value);
    5651                 break;
    5652             case kPictureAttribute_Volume:
    5653                 aud = nvp->getAudioOutput();
    5654                 value = (aud) ? (aud->GetCurrentVolume()) : 99;
    5655                 title = tr("Adjust Volume");
    5656                 picName = QString("%1 %2 %").arg(tr("Volume")).arg(value);
    5657                 break;
    5658         }
    5659         GetOSD()->ShowStatus(value*10, true, title, picName, 5,
    5660                         kOSDFunctionalType_PictureAdjust);
    5661         update_osd_pos = false;
     5505    adjustingPictureAttribute += 1;
     5506    if ((adjustingPictureAttribute >= kPictureAttribute_MAX) ||
     5507        ((type >= kAdjustingPicture_Channel) &&
     5508         (adjustingPictureAttribute > kPictureAttribute_Hue)))
     5509    {
     5510        adjustingPictureAttribute = kPictureAttribute_MIN;
    56625511    }
    5663 }
    56645512
    5665 void TV::DoToggleRecPictureAttribute(void)
    5666 {
    5667     OSDSet *oset;
    5668     int value = 0;
    5669    
    5670     recAdjustment = (recAdjustment % 4) + 1;
    5671    
    5672     if (GetOSD())
     5513    PictureAttribute attr = (PictureAttribute) adjustingPictureAttribute;
     5514    QString title = toTitleString(type);
     5515
     5516    if (!GetOSD())
     5517        return;
     5518
     5519    GetOSD()->GetSet("status");
     5520
     5521    int value = 99;
     5522    if (nvp && (kAdjustingPicture_Playback == type))
    56735523    {
    5674         oset = GetOSD()->GetSet("status");
    5675         QString title = tr("Adjust Recording");
    5676         QString recName;
    5677      
    5678         switch (recAdjustment)
     5524        if (kPictureAttribute_Brightness == adjustingPictureAttribute)
     5525            value = nvp->getVideoOutput()->GetCurrentBrightness();
     5526        else if (kPictureAttribute_Contrast == adjustingPictureAttribute)
     5527            value = nvp->getVideoOutput()->GetCurrentContrast();
     5528        else if (kPictureAttribute_Colour == adjustingPictureAttribute)
     5529            value = nvp->getVideoOutput()->GetCurrentColour();
     5530        else if (kPictureAttribute_Hue == adjustingPictureAttribute)
     5531            value = nvp->getVideoOutput()->GetCurrentHue();
     5532        else if ((kPictureAttribute_Volume == adjustingPictureAttribute) &&
     5533                 nvp->getAudioOutput())
    56795534        {
    5680             case kPictureAttribute_Brightness:
    5681                 activerecorder->ChangeBrightness(true);
    5682                 value = activerecorder->ChangeBrightness(false);
    5683                 recName = QString("%1 %2 %3 %").arg(tr("Brightness"))
    5684                                   .arg(tr("(REC)")).arg(value);
    5685                 break;
    5686             case kPictureAttribute_Contrast:
    5687                 activerecorder->ChangeContrast(true);
    5688                 value = activerecorder->ChangeContrast(false);
    5689                 recName = QString("%1 %2 %3 %").arg(tr("Contrast"))
    5690                                   .arg(tr("(REC)")).arg(value);
    5691                 break;
    5692             case kPictureAttribute_Colour:
    5693                 activerecorder->ChangeColour(true);
    5694                 value = activerecorder->ChangeColour(false);
    5695                 recName = QString("%1 %2 %3 %").arg(tr("Colour"))
    5696                                   .arg(tr("(REC)")).arg(value);
    5697                 break;
    5698             case kPictureAttribute_Hue:
    5699                 activerecorder->ChangeHue(true);
    5700                 value = activerecorder->ChangeHue(false);
    5701                 recName = QString("%1 %2 %3 %").arg(tr("Hue"))
    5702                                   .arg(tr("(REC)")).arg(value);
    5703                 break;
     5535            value = nvp->getAudioOutput()->GetCurrentVolume();
     5536            title = tr("Adjust Volume");
    57045537        }
    5705         GetOSD()->ShowStatus(value * 10, true, title, recName, 5,
    5706                         kOSDFunctionalType_RecPictureAdjust);
    5707         update_osd_pos = false;
    57085538    }
     5539    else if (activerecorder && (kAdjustingPicture_Playback != type))
     5540    {
     5541        value = activerecorder->GetPictureAttribute(attr);
     5542    }
     5543
     5544    QString text = toString(attr) + " " + toTypeString(type) +
     5545        QString(" %1 %").arg(value);
     5546
     5547    GetOSD()->ShowStatus(value * 10, true, title, text, 5,
     5548                         kOSDFunctionalType_PictureAdjust);
     5549
     5550    update_osd_pos = false;
    57095551}
    57105552   
    5711 void TV::DoChangePictureAttribute(int control, bool up, bool rec)
     5553void TV::DoChangePictureAttribute(int itype, int control, bool up)
    57125554{
    5713     switch (control)
     5555    if (!GetOSD())
     5556        return;
     5557
     5558    PictureAdjustType type = (PictureAdjustType) itype;
     5559    PictureAttribute  attr = (PictureAttribute)  control;
     5560    int value = 99;
     5561
     5562    if (nvp && (kAdjustingPicture_Playback == type))
    57145563    {
    5715         case kPictureAttribute_Brightness:
    5716             ChangeBrightness(up, rec);
    5717             break;
    5718         case kPictureAttribute_Contrast:
    5719             ChangeContrast(up, rec);
    5720             break;
    5721         case kPictureAttribute_Colour:
    5722             ChangeColour(up, rec);
    5723             break;
    5724         case kPictureAttribute_Hue:
    5725             ChangeHue(up, rec);
    5726             break;
    5727         case kPictureAttribute_Volume:
     5564        if (kPictureAttribute_Brightness == control)
     5565        {
     5566            value = nvp->getVideoOutput()->ChangeBrightness(up);
     5567            gContext->SaveSetting("PlaybackBrightness", value);
     5568        }
     5569        else if (kPictureAttribute_Contrast == control)
     5570        {
     5571            value = nvp->getVideoOutput()->ChangeContrast(up);
     5572            gContext->SaveSetting("PlaybackContrast", value);
     5573        }
     5574        else if (kPictureAttribute_Colour == control)
     5575        {
     5576            value = nvp->getVideoOutput()->ChangeColour(up);
     5577            gContext->SaveSetting("PlaybackColour", value);
     5578        }
     5579        else if (kPictureAttribute_Hue == control)
     5580        {
     5581            value = nvp->getVideoOutput()->ChangeHue(up);
     5582            gContext->SaveSetting("PlaybackHue", value);
     5583        }
     5584        else if (kPictureAttribute_Volume == control)
     5585        {
    57285586            ChangeVolume(up);
    5729             break;
     5587            return;
     5588        }
    57305589    }
     5590    else if (activerecorder && (kAdjustingPicture_Playback != type))
     5591    {
     5592        value = activerecorder->ChangePictureAttribute(type, attr, up);
     5593    }
     5594
     5595    QString text = toString(attr) + " " + toTypeString(type) +
     5596        QString(" %1 %").arg(value);
     5597
     5598    GetOSD()->ShowStatus(value * 10, true, toTitleString(type), text, 5,
     5599                         kOSDFunctionalType_PictureAdjust);
     5600
     5601    update_osd_pos = false;
    57315602}
    57325603
    57335604OSD *TV::GetOSD(void)
     
    62156086    }
    62166087    else if (action.left(17) == "TOGGLEPICCONTROLS")
    62176088    {
    6218         picAdjustment = action.right(1).toInt();
    6219         DoTogglePictureAttribute();
     6089        adjustingPictureAttribute = action.right(1).toInt() - 1;
     6090        DoTogglePictureAttribute(kAdjustingPicture_Playback);
    62206091    }
    62216092    else if (action.left(12) == "TOGGLEASPECT")
    62226093    {
  • libs/libmythtv/remoteencoder.h

     
    4242    QStringList GetInputs(void);
    4343    QString GetInput(void);
    4444    QString SetInput(QString);
    45     int ChangeContrast(bool direction);
    46     int ChangeBrightness(bool direction);
    47     int ChangeColour(bool direction);
    48     int ChangeHue(bool direction);
     45    int  GetPictureAttribute(int attr);
     46    int  ChangePictureAttribute(int type, int attr, bool direction);
    4947    void ChangeChannel(int channeldirection);
    5048    void ChangeDeinterlacer(int deint_mode);
    5149    void ToggleChannelFavorite(void);
  • libs/libmythtv/cardutil.cpp

     
    229229    return QString::null;
    230230}
    231231
     232bool set_on_source(const QString &to_set, uint cardid, uint sourceid,
     233                   const QString value)
     234{
     235    QString tmp = get_on_source("capturecard.cardid", cardid, sourceid);
     236    if (tmp.isEmpty())
     237        return false;
     238
     239    bool ok;
     240    uint input_cardid = tmp.toUInt(&ok);
     241    if (!ok)
     242        return false;
     243
     244    MSqlQuery query(MSqlQuery::InitCon());
     245    query.prepare(
     246        QString("UPDATE capturecard SET %1 = :VALUE ").arg(to_set) +
     247        "WHERE cardid = :CARDID");
     248    query.bindValue(":CARDID", input_cardid);
     249    query.bindValue(":VALUE",  value);
     250
     251    if (query.exec())
     252        return true;
     253
     254    MythContext::DBError("CardUtil::set_on_source", query);
     255    return false;
     256}
     257
    232258/** \fn CardUtil::GetCardID(const QString&, QString)
    233259 *  \brief Returns the cardid of the card that uses the specified
    234260 *         videodevice, and optionally a non-local hostname.
     
    446472#endif // !USING_V4L
    447473}
    448474
     475bool CardUtil::GetV4LInfo(int videofd, QString &card, QString &driver)
     476{
     477    card = driver = QString::null;
     478
     479    if (videofd < 0)
     480        return false;
     481
     482#ifdef USING_V4L
     483    // First try V4L2 query
     484    struct v4l2_capability capability;
     485    bzero(&capability, sizeof(struct v4l2_capability));
     486    if (ioctl(videofd, VIDIOC_QUERYCAP, &capability) >= 0)
     487    {
     488        card.setAscii((char*)capability.card);
     489        driver.setAscii((char*)capability.driver);
     490    }
     491    else // Fallback to V4L1 query
     492    {
     493        struct video_capability capability;
     494        if (ioctl(videofd, VIDIOCGCAP, &capability) >= 0)
     495            card.setAscii((char*)capability.name);
     496    }
     497#endif // !USING_V4L
     498
     499    return !card.isEmpty();
     500}
     501
    449502InputNames CardUtil::probeV4LInputs(int videofd, bool &ok)
    450503{
    451504    (void) videofd;
  • libs/libmythtv/videosource.cpp

     
    500500class VideoDevice: public PathSetting, public CCSetting
    501501{
    502502  public:
    503     VideoDevice(const CaptureCard& parent,
    504                 uint minor_min=0, uint minor_max=UINT_MAX)
     503    VideoDevice(const CaptureCard &parent,
     504                uint    minor_min = 0,
     505                uint    minor_max = UINT_MAX,
     506                QString card      = QString::null,
     507                QString driver    = QString::null)
    505508      : PathSetting(true), CCSetting(parent, "videodevice")
    506509    {
    507510        setLabel(QObject::tr("Video device"));
    508511
    509512        // /dev/v4l/video*
    510513        QDir dev("/dev/v4l", "video*", QDir::Name, QDir::System);
    511         fillSelectionsFromDir(dev, minor_min, minor_max, false);
     514        fillSelectionsFromDir(dev, minor_min, minor_max,
     515                              card, driver, false);
    512516
    513517        // /dev/video*
    514518        dev.setPath("/dev");
    515         fillSelectionsFromDir(dev, minor_min, minor_max, false);
     519        fillSelectionsFromDir(dev, minor_min, minor_max,
     520                              card, driver, false);
    516521
    517522        // /dev/dtv/video*
    518523        dev.setPath("/dev/dtv");
    519         fillSelectionsFromDir(dev, minor_min, minor_max, false);
     524        fillSelectionsFromDir(dev, minor_min, minor_max,
     525                              card, driver, false);
    520526
    521527        // /dev/dtv*
    522528        dev.setPath("/dev");
    523529        dev.setNameFilter("dtv*");
    524         fillSelectionsFromDir(dev, minor_min, minor_max, false);
    525 
    526         VERBOSE(VB_IMPORTANT, "");
     530        fillSelectionsFromDir(dev, minor_min, minor_max,
     531                              card, driver, false);
    527532    };
    528533
    529     void fillSelectionsFromDir(const QDir& dir,
     534    uint fillSelectionsFromDir(const QDir& dir,
    530535                               uint minor_min, uint minor_max,
     536                               QString card, QString driver,
    531537                               bool allow_duplicates)
    532538    {
     539        uint cnt = 0;
    533540        const QFileInfoList *il = dir.entryInfoList();
    534541        if (!il)
    535             return;
     542            return cnt;
    536543       
    537544        QFileInfoListIterator it( *il );
    538545        QFileInfo *fi;
    539        
    540         for(; (fi = it.current()) != 0; ++it)
     546
     547        for (; (fi = it.current()) != 0; ++it)
    541548        {
    542549            struct stat st;
    543550            QString filepath = fi->absFilePath();
    544551            int err = lstat(filepath, &st);
    545             if (0==err)
     552
     553            if (0 != err)
    546554            {
    547                 if (S_ISCHR(st.st_mode))
     555                VERBOSE(VB_IMPORTANT,
     556                        QString("Could not stat file: %1").arg(filepath));
     557                continue;
     558            }
     559
     560            // is this is a character device?
     561            if (!S_ISCHR(st.st_mode))
     562                continue;
     563
     564            // is this device is in our minor range?
     565            uint minor_num = minor(st.st_rdev);
     566            if (minor_min > minor_num || minor_max < minor_num)
     567                continue;
     568
     569            // ignore duplicates if allow_duplicates not set
     570            if (!allow_duplicates && minor_list[minor_num])
     571                continue;
     572
     573            // if the driver returns any info add this device to our list
     574            int videofd = open(filepath.ascii(), O_RDWR);
     575            if (videofd >= 0)
     576            {
     577                QString cn, dn;
     578                if (CardUtil::GetV4LInfo(videofd, cn, dn) &&
     579                    (driver.isEmpty() || (dn == driver))  &&
     580                    (card.isEmpty()   || (cn == card)))
    548581                {
    549                     uint minor_num = minor(st.st_rdev);
    550                     // this is a character device, if in minor range to list
    551                     if (minor_min<=minor_num &&
    552                         minor_max>=minor_num &&
    553                         (allow_duplicates ||
    554                          (minor_list.find(minor_num)==minor_list.end())))
    555                     {
    556                         addSelection(filepath);
    557                         minor_list[minor_num]=1;
    558                     }
     582                    addSelection(filepath);
     583                    cnt++;
    559584                }
     585                close(videofd);
    560586            }
    561             else
    562             {
    563                 VERBOSE(VB_IMPORTANT,
    564                         QString("Could not stat file: %1").arg(filepath));
    565             }
     587
     588            // add to list of minors discovered to avoid duplicates
     589            minor_list[minor_num] = 1;
    566590        }
     591
     592        return cnt;
    567593    }
    568594
    569595  private:
    570596    QMap<uint, uint> minor_list;
    571597};
    572598
    573 class VbiDevice: public PathSetting, public CCSetting
     599class VBIDevice: public PathSetting, public CCSetting
    574600{
    575601  public:
    576     VbiDevice(const CaptureCard& parent)
     602    VBIDevice(const CaptureCard& parent)
    577603      : PathSetting(true), CCSetting(parent, "vbidevice")
    578604    {
    579605        setLabel(QObject::tr("VBI device"));
    580         QDir dev("/dev", "vbi*", QDir::Name, QDir::System);
    581         fillSelectionsFromDir(dev);
    582         dev.setPath("/dev/v4l");
    583         fillSelectionsFromDir(dev);
     606        setFilter(QString::null, QString::null);
    584607    };
     608
     609    void setFilter(const QString &card, const QString &driver)
     610    {
     611        clearSelections();
     612        QDir dev("/dev/v4l", "vbi*", QDir::Name, QDir::System);
     613        if (!fillSelectionsFromDir(dev, card, driver))
     614        {
     615            dev.setPath("/v4l");
     616            fillSelectionsFromDir(dev, card, driver);
     617        }
     618    }
     619
     620    uint fillSelectionsFromDir(const QDir &dir, const QString &card,
     621                               const QString &driver)
     622    {
     623        uint cnt = 0;
     624        const QFileInfoList *il = dir.entryInfoList();
     625        if (!il)
     626            return cnt;
     627
     628        QFileInfoListIterator it(*il);
     629        QFileInfo *fi;
     630
     631        for (; (fi = it.current()) != 0; ++it)
     632        {
     633            QString device = fi->absFilePath();
     634            int vbifd = open(device.ascii(), O_RDWR);
     635            if (vbifd < 0)
     636                continue;
     637
     638            QString cn, dn;
     639            if (CardUtil::GetV4LInfo(vbifd, cn, dn)  &&
     640                (driver.isEmpty() || (dn == driver)) &&
     641                (card.isEmpty()   || (cn == card)))
     642            {
     643                addSelection(device);
     644                cnt++;
     645            }
     646
     647            close(vbifd);
     648        }
     649
     650        return cnt;
     651    }
    585652};
    586653
    587654class AudioDevice: public PathSetting, public CCSetting
     
    9641031    CaptureCard& parent;
    9651032};
    9661033
    967 class V4LConfigurationGroup: public VerticalConfigurationGroup
     1034V4LConfigurationGroup::V4LConfigurationGroup(CaptureCard& a_parent) :
     1035    ConfigurationGroup(false, true, false, false),
     1036    VerticalConfigurationGroup(false, true, false, false),
     1037    parent(a_parent),
     1038    cardinfo(new TransLabelSetting()),  vbidev(new VBIDevice(parent)),
     1039    input(new TunerCardInput(parent))
    9681040{
    969   public:
    970     V4LConfigurationGroup(CaptureCard& a_parent):
    971         ConfigurationGroup(false, true, false, false),
    972         VerticalConfigurationGroup(false, true, false, false),
    973         parent(a_parent)
    974     {
    975         VideoDevice* device;
    976         TunerCardInput* input;
     1041    VideoDevice *device = new VideoDevice(parent);
     1042    HorizontalConfigurationGroup *audgrp =
     1043        new HorizontalConfigurationGroup(false, false, true, true);
    9771044
    978         addChild(device = new VideoDevice(parent));
    979         addChild(new VbiDevice(parent));
    980         addChild(new AudioDevice(parent));
     1045    cardinfo->setLabel(tr("Probed info"));
     1046    audgrp->addChild(new AudioRateLimit(parent));
     1047    audgrp->addChild(new SkipBtAudio(parent));
    9811048
    982         HorizontalConfigurationGroup *ag;
    983         ag = new HorizontalConfigurationGroup(false, false);
    984         ag->addChild(new AudioRateLimit(parent));
    985         ag->addChild(new SkipBtAudio(parent));
    986         addChild(ag);
     1049    addChild(device);
     1050    addChild(cardinfo);
     1051    addChild(vbidev);
     1052    addChild(new AudioDevice(parent));
     1053    addChild(audgrp);
     1054    addChild(input);
    9871055
    988         addChild(input = new TunerCardInput(parent));
     1056    connect(device, SIGNAL(valueChanged(const QString&)),
     1057            this,   SLOT(  probeCard(   const QString&)));
    9891058
    990         connect(device, SIGNAL(valueChanged(const QString&)),
    991                 input, SLOT(fillSelections(const QString&)));
    992         input->fillSelections(device->getValue());
    993     };
    994   private:
    995     CaptureCard& parent;
     1059    probeCard(device->getValue());
    9961060};
    9971061
    998 class MPEGConfigurationGroup: public VerticalConfigurationGroup
     1062void V4LConfigurationGroup::probeCard(const QString &device)
    9991063{
    1000   public:
    1001     MPEGConfigurationGroup(CaptureCard& a_parent):
    1002         ConfigurationGroup(false, true, false, false),
    1003         VerticalConfigurationGroup(false, true, false, false),
    1004         parent(a_parent)
     1064    QString cn = tr("Failed to open"), ci = cn, dn = QString::null;
     1065
     1066    int videofd = open(device.ascii(), O_RDWR);
     1067    if (videofd >= 0)
    10051068    {
    1006         VideoDevice* device;
    1007         TunerCardInput* input;
     1069        if (!CardUtil::GetV4LInfo(videofd, cn, dn))
     1070            ci = cn = tr("Failed to probe");
     1071        else if (!dn.isEmpty())
     1072            ci = cn + "  [" + dn + "]";
     1073        close(videofd);
     1074    }
    10081075
    1009         addChild(device = new VideoDevice(parent, 0, 15));
    1010         addChild(input = new TunerCardInput(parent));
    1011         connect(device, SIGNAL(valueChanged(const QString&)),
    1012                 input, SLOT(fillSelections(const QString&)));
    1013         input->fillSelections(device->getValue());
    1014     };
    1015   private:
    1016     CaptureCard& parent;
    1017 };
     1076    cardinfo->setValue(ci);
     1077    vbidev->setFilter(cn, dn);
     1078    input->fillSelections(device);
     1079}
    10181080
    1019 class pcHDTVConfigurationGroup: public VerticalConfigurationGroup
     1081
     1082MPEGConfigurationGroup::MPEGConfigurationGroup(CaptureCard &a_parent) :
     1083    ConfigurationGroup(false, true, false, false),
     1084    VerticalConfigurationGroup(false, true, false, false),
     1085    parent(a_parent), cardinfo(new TransLabelSetting()),
     1086    input(new TunerCardInput(parent))
    10201087{
    1021   public:
    1022     pcHDTVConfigurationGroup(CaptureCard& a_parent):
    1023         ConfigurationGroup(false, true, false, false),
    1024         VerticalConfigurationGroup(false, true, false, false),
    1025         parent(a_parent)
     1088    VideoDevice *device =
     1089        new VideoDevice(parent, 0, 15, QString::null, "ivtv");
     1090
     1091    cardinfo->setLabel(tr("Probed info"));
     1092
     1093    addChild(device);
     1094    addChild(cardinfo);
     1095    addChild(input);
     1096
     1097    connect(device, SIGNAL(valueChanged(const QString&)),
     1098            this,   SLOT(  probeCard(   const QString&)));
     1099
     1100    probeCard(device->getValue());
     1101}
     1102
     1103void MPEGConfigurationGroup::probeCard(const QString &device)
     1104{
     1105    QString cn = tr("Failed to open"), ci = cn, dn = QString::null;
     1106
     1107    int videofd = open(device.ascii(), O_RDWR);
     1108    if (videofd >= 0)
    10261109    {
    1027         VideoDevice *atsc_device = new VideoDevice(parent, 0, 64);
    1028         TunerCardInput *atsc_input = new TunerCardInput(parent);
    1029         SignalTimeout *signal_timeout = new SignalTimeout(parent, 500);
    1030         ChannelTimeout *channel_timeout = new ChannelTimeout(parent, 2000);
    1031         addChild(atsc_device);
    1032         addChild(signal_timeout);
    1033         addChild(channel_timeout);
    1034         addChild(atsc_input);
    1035         connect(atsc_device, SIGNAL(valueChanged(const QString&)),
    1036                 atsc_input, SLOT(fillSelections(const QString&)));
    1037         atsc_input->fillSelections(atsc_device->getValue());
    1038     };
    1039   private:
    1040     CaptureCard& parent;
    1041 };
     1110        if (!CardUtil::GetV4LInfo(videofd, cn, dn))
     1111            ci = cn = tr("Failed to probe");
     1112        else if (!dn.isEmpty())
     1113            ci = cn + "  [" + dn + "]";
     1114        close(videofd);
     1115    }
    10421116
     1117    cardinfo->setValue(ci);
     1118    input->fillSelections(device);
     1119}
     1120
     1121pcHDTVConfigurationGroup::pcHDTVConfigurationGroup(CaptureCard& a_parent) :
     1122    ConfigurationGroup(false, true, false, false),
     1123    VerticalConfigurationGroup(false, true, false, false),
     1124    parent(a_parent), cardinfo(new TransLabelSetting()),
     1125    input(new TunerCardInput(parent))
     1126{
     1127    VideoDevice    *atsc_device     = new VideoDevice(parent, 0, 64);
     1128    SignalTimeout  *signal_timeout  = new SignalTimeout(parent, 500);
     1129    ChannelTimeout *channel_timeout = new ChannelTimeout(parent, 2000);
     1130
     1131    addChild(atsc_device);
     1132    addChild(cardinfo);
     1133    addChild(signal_timeout);
     1134    addChild(channel_timeout);
     1135    addChild(input);
     1136
     1137    connect(atsc_device, SIGNAL(valueChanged(const QString&)),
     1138            this,        SLOT(  probeCard(   const QString&)));
     1139
     1140    probeCard(atsc_device->getValue());
     1141}
     1142
     1143void pcHDTVConfigurationGroup::probeCard(const QString &device)
     1144{
     1145    QString cn = tr("Failed to open"), ci = cn, dn = QString::null;
     1146
     1147    int videofd = open(device.ascii(), O_RDWR);
     1148    if (videofd >= 0)
     1149    {
     1150        if (!CardUtil::GetV4LInfo(videofd, cn, dn))
     1151            ci = cn = tr("Failed to probe");
     1152        else if (!dn.isEmpty())
     1153            ci = cn + "  [" + dn + "]";
     1154        close(videofd);
     1155    }
     1156
     1157    cardinfo->setValue(ci);
     1158    input->fillSelections(device);
     1159}
     1160
    10431161CaptureCardGroup::CaptureCardGroup(CaptureCard& parent) :
    10441162    ConfigurationGroup(true, true, false, false),
    10451163    VerticalConfigurationGroup(true, true, false, false)
  • libs/libmythtv/remoteencoder.cpp

     
    99#include "util.h"
    1010#include "mythcontext.h"
    1111#include "signalmonitor.h"
     12#include "videooutbase.h"
    1213
    1314RemoteEncoder::RemoteEncoder(int num, const QString &host, short port)
    1415    : recordernum(num),       controlSock(NULL),      remotehost(host),
     
    449450    return timeout;
    450451}
    451452
    452 /** \fn RemoteEncoder::ChangeContrast(bool)
    453  *  \brief Changes contrast of a recording.
    454  *
    455  *  Note: In practice this only works with frame grabbing recorders.
    456  *
    457  *  \return contrast if it succeeds, -1 otherwise.
    458  */
    459 int RemoteEncoder::ChangeContrast(bool direction)
    460 {
    461     QStringList strlist = QString("QUERY_RECORDER %1").arg(recordernum);
    462     strlist << "CHANGE_CONTRAST";
    463     strlist << QString::number((int)direction);
    464453
    465     SendReceiveStringList(strlist);
    466 
    467     int retval = strlist[0].toInt();
    468     return retval;
    469 }
    470 
    471 /** \fn RemoteEncoder::ChangeBrightness(bool)
    472  *  \brief Changes the brightness of a recording.
    473  *
    474  *   Note: In practice this only works with frame grabbing recorders.
    475  *
    476  *  \return brightness if it succeeds, -1 otherwise.
    477  */
    478 int RemoteEncoder::ChangeBrightness(bool direction)
     454int RemoteEncoder::GetPictureAttribute(int attr)
    479455{
    480456    QStringList strlist = QString("QUERY_RECORDER %1").arg(recordernum);
    481     strlist << "CHANGE_BRIGHTNESS";
    482     strlist << QString::number((int)direction);
    483457
     458    if (kPictureAttribute_Contrast == attr)
     459        strlist << "GET_CONTRAST";
     460    else if (kPictureAttribute_Brightness == attr)
     461        strlist << "GET_BRIGHTNESS";
     462    else if (kPictureAttribute_Colour == attr)
     463        strlist << "GET_COLOUR";
     464    else if (kPictureAttribute_Hue == attr)
     465        strlist << "GET_HUE";
     466    else
     467        return -1;
     468
    484469    SendReceiveStringList(strlist);
    485470
    486471    int retval = strlist[0].toInt();
    487472    return retval;
    488473}
    489474
    490 /** \fn RemoteEncoder::ChangeColour(bool)
    491  *  \brief Changes the colour phase of a recording.
     475/** \fn RemoteEncoder::ChangeContrast(int, int, bool)
     476 *  \brief Changes brightness/contrast/colour/hue of a recording.
    492477 *
    493  *   Note: In practice this only works with frame grabbing recorders.
     478 *  Note: In practice this only works with frame grabbing recorders.
    494479 *
    495  *  \return colour if it succeeds, -1 otherwise.
     480 *  \return contrast if it succeeds, -1 otherwise.
    496481 */
    497 int RemoteEncoder::ChangeColour(bool direction)
     482int RemoteEncoder::ChangePictureAttribute(int type, int attr, bool up)
    498483{
    499484    QStringList strlist = QString("QUERY_RECORDER %1").arg(recordernum);
    500     strlist << "CHANGE_COLOUR";
    501     strlist << QString::number((int)direction);
    502485
    503     SendReceiveStringList(strlist);
     486    if (kPictureAttribute_Contrast == attr)
     487        strlist << "CHANGE_CONTRAST";
     488    else if (kPictureAttribute_Brightness == attr)
     489        strlist << "CHANGE_BRIGHTNESS";
     490    else if (kPictureAttribute_Colour == attr)
     491        strlist << "CHANGE_COLOUR";
     492    else if (kPictureAttribute_Hue == attr)
     493        strlist << "CHANGE_HUE";
     494    else
     495        return -1;
    504496
    505     int retval = strlist[0].toInt();
    506     return retval;
    507 }
     497    strlist << QString::number(type);
     498    strlist << QString::number((int)up);
    508499
    509 /** \fn RemoteEncoder::ChangeHue(bool)
    510  *  \brief Changes the hue of a recording.
    511  *
    512  *   Note: In practice this only works with frame grabbing recorders.
    513  *
    514  *  \return hue if it succeeds, -1 otherwise.
    515  */
    516 int RemoteEncoder::ChangeHue(bool direction)
    517 {
    518     QStringList strlist = QString("QUERY_RECORDER %1").arg(recordernum);
    519     strlist << "CHANGE_HUE";
    520     strlist << QString::number((int)direction);
    521 
    522500    SendReceiveStringList(strlist);
    523501
    524502    int retval = strlist[0].toInt();
     
    655633    programid   = cleanup(strlist[11]);
    656634}
    657635
    658 void RemoteEncoder::GetChannelInfo(InfoMap &infoMap, uint chanid)
     636void RemoteEncoder::GetChannelInfo(QMap<QString, QString> &infoMap, uint chanid)
    659637{
    660638    QStringList strlist = QString("QUERY_RECORDER %1").arg(recordernum);
    661639    strlist << "GET_CHANNEL_INFO";
     
    673651    infoMap["oldchannum"] =  infoMap["channum"];
    674652}
    675653
    676 bool RemoteEncoder::SetChannelInfo(const InfoMap &infoMap)
     654bool RemoteEncoder::SetChannelInfo(const QMap<QString, QString> &infoMap)
    677655{
    678656    QStringList strlist = "SET_CHANNEL_INFO";
    679657    strlist << make_safe(infoMap["chanid"]);
  • libs/libmythtv/videoout_xv.cpp

     
    3636#include "mythconfig.h"
    3737#include "mythcontext.h"
    3838#include "filtermanager.h"
     39#define IGNORE_TV_PLAY_REC
     40#include "tv.h"
    3941
    4042#define LOC QString("VideoOutputXv: ")
    4143#define LOC_ERR QString("VideoOutputXv Error: ")
  • libs/libmythtv/udpnotify.cpp

     
    4545#include "udpnotify.h"
    4646#include "mythcontext.h"
    4747#include "osd.h"
    48 #include "tv.h"
     48#include "tv_play.h"
    4949
    5050UDPNotifyOSDSet::UDPNotifyOSDSet(const QString &name)
    5151{
  • libs/libmythtv/tv_rec.cpp

     
    26382638    }
    26392639}
    26402640
    2641 /** \fn TVRec::ChangeContrast(bool)
    2642  *  \brief Changes contrast of a recording.
     2641/** \fn TVRec::ChangePictureAttribute(PictureAdjustType,PictureAttribute,bool)
     2642 *  \brief Returns current value [0,100] if it succeeds, -1 otherwise.
    26432643 *
    26442644 *  Note: In practice this only works with frame grabbing recorders.
    2645  *
    2646  *  \return contrast if it succeeds, -1 otherwise.
    26472645 */
    2648 int TVRec::ChangeContrast(bool direction)
     2646int TVRec::GetPictureAttribute(PictureAttribute attr)
    26492647{
    26502648    QMutexLocker lock(&stateChangeLock);
    2651 
    26522649    if (!channel)
    26532650        return -1;
    26542651
    2655     int ret = channel->ChangeContrast(direction);
    2656     return ret;
    2657 }
     2652    int ret = -1;
     2653    if (kPictureAttribute_Brightness == attr)
     2654        ret = channel->GetPictureAttribute("brightness");
     2655    else if (kPictureAttribute_Contrast == attr)
     2656        ret = channel->GetPictureAttribute("contrast");
     2657    else if (kPictureAttribute_Colour == attr)
     2658        ret = channel->GetPictureAttribute("colour");
     2659    else if (kPictureAttribute_Hue == attr)
     2660        ret = channel->GetPictureAttribute("hue");
    26582661
    2659 /** \fn TVRec::ChangeBrightness(bool)
    2660  *  \brief Changes the brightness of a recording.
    2661  *
    2662  *  Note: In practice this only works with frame grabbing recorders.
    2663  *
    2664  *  \return brightness if it succeeds, -1 otherwise.
    2665  */
    2666 int TVRec::ChangeBrightness(bool direction)
    2667 {
    2668     QMutexLocker lock(&stateChangeLock);
    2669 
    2670     if (!channel)
     2662    if (ret < 0)
    26712663        return -1;
    2672 
    2673     int ret = channel->ChangeBrightness(direction);
    2674     return ret;
     2664    return ret / 655;
    26752665}
    26762666
    2677 /** \fn TVRec::ChangeColour(bool)
    2678  *  \brief Changes the colour phase of a recording.
     2667/** \fn TVRec::ChangePictureAttribute(PictureAdjustType,PictureAttribute,bool)
     2668 *  \brief Changes brightness/contrast/colour/hue of a recording.
    26792669 *
    26802670 *  Note: In practice this only works with frame grabbing recorders.
    26812671 *
    2682  *  \return colour if it succeeds, -1 otherwise.
     2672 *  \return current value [0,100] if it succeeds, -1 otherwise.
    26832673 */
    2684 int TVRec::ChangeColour(bool direction)
     2674int TVRec::ChangePictureAttribute(PictureAdjustType type,
     2675                                  PictureAttribute  attr,
     2676                                  bool              direction)
    26852677{
    26862678    QMutexLocker lock(&stateChangeLock);
    2687 
    26882679    if (!channel)
    26892680        return -1;
    26902681
    2691     int ret = channel->ChangeColour(direction);
    2692     return ret;
    2693 }
     2682    int ret = -1;
     2683    if (kPictureAttribute_Brightness == attr)
     2684        ret = channel->ChangePictureAttribute(type, "brightness", direction);
     2685    else if (kPictureAttribute_Contrast == attr)
     2686        ret = channel->ChangePictureAttribute(type, "contrast", direction);
     2687    else if (kPictureAttribute_Colour == attr)
     2688        ret = channel->ChangePictureAttribute(type, "colour", direction);
     2689    else if (kPictureAttribute_Hue == attr)
     2690        ret = channel->ChangePictureAttribute(type, "hue", direction);
    26942691
    2695 /** \fn TVRec::ChangeHue(bool)
    2696  *  \brief Changes the hue of a recording.
    2697  *
    2698  *  Note: In practice this only works with frame grabbing recorders.
    2699  *
    2700  *  \return hue if it succeeds, -1 otherwise.
    2701  */
    2702 int TVRec::ChangeHue(bool direction)
    2703 {
    2704     QMutexLocker lock(&stateChangeLock);
    2705 
    2706     if (!channel)
     2692    if (ret < 0)
    27072693        return -1;
    2708 
    2709     int ret = channel->ChangeHue(direction);
    2710     return ret;
     2694    return ret / 655;
    27112695}
    27122696
    27132697/** \fn TVRec::GetConnectedInputs(void) const
     
    36763660#ifdef USING_V4L
    36773661    if (GetV4LChannel())
    36783662    {
    3679         channel->SetBrightness();
    3680         channel->SetContrast();
    3681         channel->SetColour();
    3682         channel->SetHue();
     3663        channel->InitPictureAttributes();
    36833664        CloseChannel();
    36843665    }
    36853666#endif
  • libs/libmythtv/videooutbase.h

     
    7070    kCodec_SPECIAL_END,
    7171};
    7272
    73 enum PictureAttribute
    74 {
    75     kPictureAttribute_None = 0,
    76     kPictureAttribute_MIN = 1,
    77     kPictureAttribute_Brightness = 1,
    78     kPictureAttribute_Contrast,
    79     kPictureAttribute_Colour,
    80     kPictureAttribute_Hue,
    81     kPictureAttribute_Volume,
    82     kPictureAttribute_MAX
    83 };
    84 
    8573enum PIPLocations
    8674{
    8775    kPIPTopLeft = 0,
  • libs/libmythtv/tv_rec.h

     
    212212    void SetChannel(QString name, uint requestType = kFlagDetect);
    213213
    214214    int SetSignalMonitoringRate(int msec, int notifyFrontend = 1);
    215     int ChangeColour(bool direction);
    216     int ChangeContrast(bool direction);
    217     int ChangeBrightness(bool direction);
    218     int ChangeHue(bool direction);
     215    int  GetPictureAttribute(PictureAttribute attr);
     216    int  ChangePictureAttribute(PictureAdjustType type, PictureAttribute attr,
     217                                bool direction);
    219218    bool CheckChannel(QString name) const;
    220219    bool ShouldSwitchToAnotherCard(QString chanid);
    221220    bool CheckChannelPrefix(const QString&,uint&,bool&,QString&);
  • libs/libmythtv/tv.cpp

     
     1#include <algorithm>
     2using namespace std;
     3
    14#include "tv.h"
     5#include "tv_play.h"
     6#include "tv_rec.h"
    27
    38/** \fn StateToString(TVState state)
    49 *  \brief Returns a human readable QString representing a TVState.
     
    1924    }
    2025    return statestr;
    2126}
     27
     28QString toTypeString(PictureAdjustType type)
     29{
     30    const QString kPicAdjType[] =
     31    {
     32        "",
     33        "",
     34        QObject::tr("(CH)"),
     35        QObject::tr("(REC)"),
     36    };
     37
     38    return kPicAdjType[(int)type & 0x3];
     39}
     40
     41QString toTitleString(PictureAdjustType type)
     42{
     43    const QString kPicAdjTitles[] =
     44    {
     45        "",
     46        QObject::tr("Adjust Playback"),
     47        QObject::tr("Adjust Recorder"),
     48        QObject::tr("Adjust Recorder"),
     49    };
     50
     51    return kPicAdjTitles[(int)type & 0x3];
     52}
     53
     54QString toString(PictureAttribute index)
     55{
     56    const QString tbl[] =
     57    {
     58        QObject::tr("None"),
     59        QObject::tr("Brightness"),
     60        QObject::tr("Contrast"),
     61        QObject::tr("Colour"),
     62        QObject::tr("Hue"),
     63        QObject::tr("Volume"),
     64        QObject::tr("MAX"),
     65    };
     66
     67    int i = (int)index;
     68    i = max(i, (int) kPictureAttribute_None);
     69    i = min(i, (int) kPictureAttribute_MAX);
     70
     71    return tbl[i];
     72}
  • libs/libmythtv/dbox2channel.cpp

     
    1717#include "dbox2channel.h"
    1818#include "dbox2recorder.h"
    1919#include "dbox2epg.h"
    20 #include "tv_rec.h"
    2120
    2221//#define DBOX2_CHANNEL_DEBUG
    2322
  • libs/libmythtv/channel.cpp

     
    2323#include "videodev_myth.h"
    2424#include "channel.h"
    2525#include "frequencies.h"
    26 #include "tv.h"
     26#include "tv_rec.h"
    2727#include "mythcontext.h"
    2828#include "mythdbcon.h"
    2929#include "channelutil.h"
    3030#include "cardutil.h"
    3131
     32#define DEBUG_ATTRIB 1
     33
    3234#define LOC QString("Channel(%1): ").arg(device)
    3335#define LOC_ERR QString("Channel(%1) Error: ").arg(device)
    3436
     
    4143 */
    4244
    4345Channel::Channel(TVRec *parent, const QString &videodevice)
    44     : ChannelBase(parent), device(videodevice), videofd(-1),
    45       curList(NULL), totalChannels(0),
    46       currentFormat(""), is_dtv(false), usingv4l2(false),
    47       defaultFreqTable(1)
     46    : ChannelBase(parent),
     47      device(videodevice),          videofd(-1),
     48      device_name(QString::null),   driver_name(QString::null),
     49      curList(NULL),                totalChannels(0),
     50      currentFormat(""),            is_dtv(false),
     51      usingv4l2(false),             defaultFreqTable(1)
    4852{
    4953}
    5054
     
    7175    }
    7276
    7377    usingv4l2 = CardUtil::hasV4L2(videofd);
     78    CardUtil::GetV4LInfo(videofd, device_name, driver_name);
     79    VERBOSE(VB_CHANNEL, LOC + QString("Device name '%1' driver '%2'.")
     80            .arg(device_name).arg(driver_name));
    7481
    7582    if (!InitializeInputs())
    7683    {
     
    495502    if (pParent)
    496503        pParent->SetVideoFiltersForChannel(GetCurrentSourceID(), chan);
    497504
    498     SetContrast();
    499     SetColour();
    500     SetBrightness();
    501     SetHue();
     505    InitPictureAttributes();
    502506
    503507    inputs[currentInputID]->startChanNum = curchannelname;
    504508
     
    903907    return ok;
    904908}
    905909
    906 unsigned short *Channel::GetV4L1Field(int attrib, struct video_picture &vid_pic)
     910static unsigned short *get_v4l1_field(
     911    int v4l2_attrib, struct video_picture &vid_pic)
    907912{
    908     switch (attrib)
     913    switch (v4l2_attrib)
    909914    {
    910915        case V4L2_CID_CONTRAST:
    911916            return &vid_pic.contrast;
     
    916921        case V4L2_CID_HUE:
    917922            return &vid_pic.hue;
    918923        default:
    919             VERBOSE(VB_IMPORTANT,
    920                     QString("Channel(%1)::SetColourAttribute(): "
    921                             "invalid attribute argument: %2\n").
    922                     arg(device).arg(attrib));
     924            VERBOSE(VB_IMPORTANT, "get_v4l1_field: "
     925                    "invalid attribute argument "<<v4l2_attrib);
    923926    }
    924927    return NULL;
    925928}
    926929
    927 void Channel::SetColourAttribute(int attrib, const char *name)
     930static int get_v4l2_attribute(const QString &db_col_name)
    928931{
     932    if ("brightness" == db_col_name)
     933        return V4L2_CID_BRIGHTNESS;
     934    else if ("contrast" == db_col_name)
     935        return V4L2_CID_SATURATION;
     936    else if ("colour" == db_col_name)
     937        return V4L2_CID_SATURATION;
     938    else if ("hue" == db_col_name)
     939        return V4L2_CID_HUE;
     940    return -1;
     941}
     942
     943bool Channel::InitPictureAttribute(const QString db_col_name)
     944{
    929945    if (!pParent || is_dtv)
    930         return;
     946        return false;
    931947
    932     QString field_name = name;
    933     int field = ChannelUtil::GetChannelValueInt(
    934         field_name, GetCurrentSourceID(), curchannelname);
     948    int v4l2_attrib = get_v4l2_attribute(db_col_name);
     949    if (v4l2_attrib == -1)
     950        return false;
    935951
     952    int cfield = ChannelUtil::GetChannelValueInt(
     953        db_col_name, GetCurrentSourceID(), curchannelname);
     954    int sfield = CardUtil::GetValueInt(
     955        db_col_name, GetCardID(), GetCurrentSourceID());
     956
     957    if ((cfield == -1) || (sfield == -1))
     958        return false;
     959
     960    int field = (cfield + sfield) & 0xFFFF;
     961
     962    QString loc = LOC +
     963        QString("InitPictureAttribute(%1): ").arg(db_col_name, 10);
     964    QString loc_err = LOC_ERR +
     965        QString("InitPictureAttribute(%1): ").arg(db_col_name, 10);
     966
    936967    if (usingv4l2)
    937968    {
    938969        struct v4l2_control ctrl;
    939970        struct v4l2_queryctrl qctrl;
    940         memset(&ctrl, 0, sizeof(ctrl));
    941         memset(&qctrl, 0, sizeof(qctrl));
     971        bzero(&ctrl, sizeof(ctrl));
     972        bzero(&qctrl, sizeof(qctrl));
    942973
    943         if (field != -1)
     974        ctrl.id = qctrl.id = v4l2_attrib;
     975        if (ioctl(videofd, VIDIOC_QUERYCTRL, &qctrl) < 0)
    944976        {
    945             ctrl.id = qctrl.id = attrib;
    946             if (ioctl(videofd, VIDIOC_QUERYCTRL, &qctrl) < 0)
     977            VERBOSE(VB_IMPORTANT, loc_err + "failed to query controls." + ENO);
     978            return false;
     979        }
     980
     981        float new_range = qctrl.maximum - qctrl.minimum;
     982        float old_range = 65535 - 0;
     983        float scl_range = new_range / old_range;
     984        float dfl       = (qctrl.default_value - qctrl.minimum) / new_range;
     985        int   norm_dfl  = (0x10000 + (int)(dfl * old_range) - 32768) & 0xFFFF;
     986
     987        if (pict_attr_default.find(db_col_name) == pict_attr_default.end())
     988        {
     989            if (device_name == "pcHDTV HD3000 HDTV")
    947990            {
    948                 VERBOSE(VB_IMPORTANT,
    949                         QString("Channel(%1)::SetColourAttribute(): "
    950                                 "failed to query controls, error: %2").
    951                         arg(device).arg(strerror(errno)));
    952                 return;
     991                pict_attr_default["brightness"] = 9830;
     992                pict_attr_default["contrast"]   = 39322;
     993                pict_attr_default["colour"]     = 45875;
     994                pict_attr_default["hue"]        = 0;
    953995            }
    954             ctrl.value = (int)((qctrl.maximum - qctrl.minimum)
    955                                / 65535.0 * field + qctrl.minimum);
    956             ctrl.value = ctrl.value > qctrl.maximum
    957                               ? qctrl.maximum
    958                                   : ctrl.value < qctrl.minimum
    959                                        ? qctrl.minimum
    960                                             : ctrl.value;
    961             if (ioctl(videofd, VIDIOC_S_CTRL, &ctrl) < 0)
     996            else
    962997            {
    963                 VERBOSE(VB_IMPORTANT,
    964                         QString("Channel(%1)::SetColourAttribute(): "
    965                                 "failed to set controls, error: %2").
    966                         arg(device).arg(strerror(errno)));
    967                 return;
     998                pict_attr_default[db_col_name] = norm_dfl;
    968999            }
    9691000        }
    970     }
    971     else
    972     {
    973         unsigned short *setfield;
    974         struct video_picture vid_pic;
    975         memset(&vid_pic, 0, sizeof(vid_pic));
    9761001
    977         if (ioctl(videofd, VIDIOCGPICT, &vid_pic) < 0)
     1002        int dfield = pict_attr_default[db_col_name];
     1003        field      = (cfield + sfield + dfield) & 0xFFFF;
     1004        int value0 = (int) ((scl_range * field) + qctrl.minimum);
     1005        int value1 = min(value0, (int)qctrl.maximum);
     1006        ctrl.value = max(value1, (int)qctrl.minimum);
     1007
     1008#if DEBUG_ATTRIB
     1009        VERBOSE(VB_CHANNEL, loc + QString("\n\t\t\t[%1,%2] dflt(%3, %4, %5)")
     1010                .arg(qctrl.minimum, 5).arg(qctrl.maximum, 5)
     1011                .arg(qctrl.default_value, 5).arg(dfl, 4, 'f', 2)
     1012                .arg(norm_dfl));
     1013#endif
     1014
     1015        if (ioctl(videofd, VIDIOC_S_CTRL, &ctrl) < 0)
    9781016        {
    979             VERBOSE(VB_IMPORTANT,
    980                     QString("Channel(%1)::SetColourAttribute(): failed "
    981                             "to get picture controls, error: %2").
    982                     arg(device).arg(strerror(errno)));
    983             return;
     1017            VERBOSE(VB_IMPORTANT, loc_err + "failed to set controls" + ENO);
     1018            return false;
    9841019        }
    985         setfield = GetV4L1Field(attrib, vid_pic);
    986         if (field != -1 && setfield)
    987         {
    988             *setfield = field;
    989             if (ioctl(videofd, VIDIOCSPICT, &vid_pic) < 0)
    990             {
    991                 VERBOSE(VB_IMPORTANT,
    992                         QString("Channel(%1)::SetColourAttribute(): failed "
    993                                 "to set picture controls, error: %2").
    994                         arg(device).arg(strerror(errno)));
    995                 return;
    996             }
    997         }
     1020
     1021        return true;
    9981022    }
    999     return;
     1023
     1024    // V4L1
     1025    unsigned short *setfield;
     1026    struct video_picture vid_pic;
     1027    bzero(&vid_pic, sizeof(vid_pic));
     1028
     1029    if (ioctl(videofd, VIDIOCGPICT, &vid_pic) < 0)
     1030    {
     1031        VERBOSE(VB_IMPORTANT, loc_err + "failed to query controls." + ENO);
     1032        return false;
     1033    }
     1034    setfield = get_v4l1_field(v4l2_attrib, vid_pic);
     1035
     1036    if (!setfield)
     1037        return false;
     1038
     1039    *setfield = field;
     1040    if (ioctl(videofd, VIDIOCSPICT, &vid_pic) < 0)
     1041    {
     1042        VERBOSE(VB_IMPORTANT, loc_err + "failed to set controls." + ENO);
     1043        return false;
     1044    }
     1045
     1046    return true;
    10001047}
    10011048
    1002 void Channel::SetContrast(void)
     1049bool Channel::InitPictureAttributes(void)
    10031050{
    1004     SetColourAttribute(V4L2_CID_CONTRAST, "contrast");
    1005     return;
     1051    return (InitPictureAttribute("brightness") &&
     1052            InitPictureAttribute("contrast")   &&
     1053            InitPictureAttribute("colour")     &&
     1054            InitPictureAttribute("hue"));
    10061055}
    10071056
    1008 void Channel::SetBrightness()
     1057int Channel::GetPictureAttribute(const QString db_col_name) const
    10091058{
    1010     SetColourAttribute(V4L2_CID_BRIGHTNESS, "brightness");
    1011     return;
    1012 }
     1059    int cfield = ChannelUtil::GetChannelValueInt(
     1060        db_col_name, GetCurrentSourceID(), curchannelname);
     1061    int sfield = CardUtil::GetValueInt(
     1062        db_col_name, GetCardID(), GetCurrentSourceID());
     1063    int dfield = 0;
    10131064
    1014 void Channel::SetColour()
    1015 {
    1016     SetColourAttribute(V4L2_CID_SATURATION, "colour");
    1017     return;
     1065    if (pict_attr_default.find(db_col_name) != pict_attr_default.end())
     1066        dfield = pict_attr_default[db_col_name];
     1067
     1068    int val = (cfield + sfield + dfield) & 0xFFFF;
     1069
     1070#if DEBUG_ATTRIB
     1071    VERBOSE(VB_CHANNEL, QString(
     1072                "GetPictureAttribute(%1) -> cdb %2 rdb %3 d %4 -> %5")
     1073            .arg(db_col_name).arg(cfield).arg(sfield)
     1074            .arg(dfield).arg(val));
     1075#endif
     1076
     1077    return val;
    10181078}
    10191079
    1020 void Channel::SetHue(void)
     1080static int get_v4l2_attribute_value(int videofd, int v4l2_attrib)
    10211081{
    1022     SetColourAttribute(V4L2_CID_HUE, "hue");
    1023     return;
    1024 }
     1082    struct v4l2_control ctrl;
     1083    struct v4l2_queryctrl qctrl;
     1084    bzero(&ctrl, sizeof(ctrl));
     1085    bzero(&qctrl, sizeof(qctrl));
    10251086
    1026 int Channel::ChangeColourAttribute(int attrib, const char *name, bool up)
    1027 {
    1028     if (!pParent || is_dtv)
     1087    ctrl.id = qctrl.id = v4l2_attrib;
     1088    if (ioctl(videofd, VIDIOC_QUERYCTRL, &qctrl) < 0)
     1089    {
     1090        VERBOSE(VB_IMPORTANT, "get_v4l2_attribute_value: "
     1091                "failed to query controls (1)" + ENO);
    10291092        return -1;
     1093    }
    10301094
    1031     int newvalue;    // The int should have ample space to avoid overflow
    1032                      // in the case that we're just over or under 65535
     1095    if (ioctl(videofd, VIDIOC_G_CTRL, &ctrl) < 0)
     1096    {
     1097        VERBOSE(VB_IMPORTANT, "get_v4l2_attribute_value: "
     1098                "failed to get controls (2)" + ENO);
     1099        return -1;
     1100    }
    10331101
    1034     QString channel_field = name;
    1035     int current_value = ChannelUtil::GetChannelValueInt(
    1036         channel_field, GetCurrentSourceID(), curchannelname);
     1102    return (int)(65535.0 / (qctrl.maximum - qctrl.minimum) * ctrl.value);
     1103}
    10371104
    1038     int card_value;
     1105static int get_v4l1_attribute_value(int videofd, int v4l2_attrib)
     1106{
     1107    struct video_picture vid_pic;
     1108    bzero(&vid_pic, sizeof(vid_pic));
    10391109
    1040     if (usingv4l2)
     1110    if (ioctl(videofd, VIDIOCGPICT, &vid_pic) < 0)
    10411111    {
    1042         struct v4l2_control ctrl;
    1043         struct v4l2_queryctrl qctrl;
    1044         memset(&ctrl, 0, sizeof(ctrl));
    1045         memset(&qctrl, 0, sizeof(qctrl));
     1112        VERBOSE(VB_IMPORTANT, "get_v4l1_attribute_value: "
     1113                "failed to get picture control (1)" + ENO);
     1114        return -1;
     1115    }
    10461116
    1047         ctrl.id = qctrl.id = attrib;
    1048         if (ioctl(videofd, VIDIOC_QUERYCTRL, &qctrl) < 0)
    1049         {
    1050             VERBOSE(VB_IMPORTANT,
    1051                     QString("Channel(%1)::ChangeColourAttribute(): "
    1052                             "failed to query controls (1), error: %2").
    1053                     arg(device).arg(strerror(errno)));
    1054             return -1;
    1055         }
     1117    unsigned short *setfield = get_v4l1_field(v4l2_attrib, vid_pic);
     1118    if (setfield)
     1119        return *setfield;
    10561120
    1057         if (ioctl(videofd, VIDIOC_G_CTRL, &ctrl) < 0)
    1058         {
    1059             VERBOSE(VB_IMPORTANT,
    1060                     QString("Channel(%1)::ChangeColourAttribute(): "
    1061                             "failed to get control, error: %2").
    1062                     arg(device).arg(strerror(errno)));
    1063             return -1;
    1064         }
    1065         card_value = (int)(65535.0 / (qctrl.maximum - qctrl.minimum) *
    1066                            ctrl.value);
    1067     }
    1068     else
    1069     {
    1070         unsigned short *setfield;
    1071         struct video_picture vid_pic;
    1072         memset(&vid_pic, 0, sizeof(vid_pic));
     1121    return -1;
     1122}
    10731123
    1074         if (ioctl(videofd, VIDIOCGPICT, &vid_pic) < 0)
    1075         {
    1076             VERBOSE(VB_IMPORTANT,
    1077                     QString("Channel(%1)::ChangeColourAttribute(): "
    1078                             "failed to get picture control (1), error: %2").
    1079                     arg(device).arg(strerror(errno)));
    1080             return -1;
    1081         }
     1124static int get_attribute_value(bool usingv4l2, int videofd, int v4l2_attrib)
     1125{
     1126    if (usingv4l2)
     1127        return get_v4l2_attribute_value(videofd, v4l2_attrib);
     1128    return get_v4l1_attribute_value(videofd, v4l2_attrib);
     1129}
    10821130
    1083         setfield = GetV4L1Field(attrib, vid_pic);
    1084         if (!setfield)
    1085         {
    1086             return -1;
    1087         }
     1131static int set_v4l2_attribute_value(int videofd, int v4l2_attrib, int newvalue)
     1132{
     1133    struct v4l2_control ctrl;
     1134    struct v4l2_queryctrl qctrl;
     1135    bzero(&ctrl, sizeof(ctrl));
     1136    bzero(&qctrl, sizeof(qctrl));
    10881137
    1089         card_value = *setfield;
     1138    ctrl.id = qctrl.id = v4l2_attrib;
     1139    if (ioctl(videofd, VIDIOC_QUERYCTRL, &qctrl) < 0)
     1140    {
     1141        VERBOSE(VB_IMPORTANT, "set_v4l2_attribute_value: "
     1142                "failed to query control" + ENO);
     1143        return -1;
    10901144    }
    10911145
    1092     newvalue  = (current_value < 0) ? card_value : current_value;
    1093     newvalue += (up) ? 655 : -655;
     1146    float mult = (qctrl.maximum - qctrl.minimum) / 65535.0;
     1147    ctrl.value = (int)(mult * newvalue + qctrl.minimum);
     1148    ctrl.value = min(ctrl.value, qctrl.maximum);
     1149    ctrl.value = max(ctrl.value, qctrl.minimum);
    10941150
    1095     if (V4L2_CID_HUE == attrib)
     1151    if (ioctl(videofd, VIDIOC_S_CTRL, &ctrl) < 0)
    10961152    {
    1097         // wrap around for hue
    1098         newvalue = (newvalue > 65535) ? newvalue - 65535 : newvalue;
    1099         newvalue = (newvalue < 0)     ? newvalue + 65535 : newvalue;
     1153        VERBOSE(VB_IMPORTANT, "set_v4l2_attribute_value: "
     1154                "failed to set control" + ENO);
     1155        return -1;
    11001156    }
    11011157
    1102     // make sure we are within bounds
    1103     newvalue  = min(newvalue, 65535);
    1104     newvalue  = max(newvalue, 0);
     1158    return 0;
     1159}
    11051160
    1106     if (current_value >= 0)
     1161static int set_v4l1_attribute_value(int videofd, int v4l2_attrib, int newvalue)
     1162{
     1163    unsigned short *setfield;
     1164    struct video_picture vid_pic;
     1165    bzero(&vid_pic, sizeof(vid_pic));
     1166
     1167    if (ioctl(videofd, VIDIOCGPICT, &vid_pic) < 0)
    11071168    {
    1108         // tell the DB about the new attributes
    1109         ChannelUtil::SetChannelValue(channel_field, QString::number(newvalue),
    1110                                      GetCurrentSourceID(), curchannelname);
     1169        VERBOSE(VB_IMPORTANT, "set_v4l1_attribute_value: "
     1170                "failed to get picture control." + ENO);
     1171        return -1;
    11111172    }
    1112 
    1113     if (usingv4l2)
     1173    setfield = get_v4l1_field(v4l2_attrib, vid_pic);
     1174    if (newvalue != -1 && setfield)
    11141175    {
    1115         struct v4l2_control ctrl;
    1116         struct v4l2_queryctrl qctrl;
    1117         memset(&ctrl, 0, sizeof(ctrl));
    1118         memset(&qctrl, 0, sizeof(qctrl));
    1119 
    1120         ctrl.id = qctrl.id = attrib;
    1121         if (ioctl(videofd, VIDIOC_QUERYCTRL, &qctrl) < 0)
     1176        *setfield = newvalue;
     1177        if (ioctl(videofd, VIDIOCSPICT, &vid_pic) < 0)
    11221178        {
    1123             VERBOSE(VB_IMPORTANT,
    1124                     QString("Channel(%1)::ChangeColourAttribute(): "
    1125                             "failed to query controls (2), error: %2").
    1126                     arg(device).arg(strerror(errno)));
     1179            VERBOSE(VB_IMPORTANT, "set_v4l1_attribute_value: "
     1180                    "failed to set picture control." + ENO);
    11271181            return -1;
    11281182        }
    1129         float mult = (qctrl.maximum - qctrl.minimum) / 65535.0;
    1130         ctrl.value = (int)(mult * newvalue + qctrl.minimum);
    1131         ctrl.value = min(ctrl.value, qctrl.maximum);
    1132         ctrl.value = max(ctrl.value, qctrl.minimum);
    1133 
    1134         if (ioctl(videofd, VIDIOC_S_CTRL, &ctrl) < 0)
    1135         {
    1136             VERBOSE(VB_IMPORTANT,
    1137                     QString("Channel(%1)::ChangeColourAttribute(): "
    1138                             "failed to set control, error: %2").
    1139                     arg(device).arg(strerror(errno)));
    1140             return -1;
    1141         }
    11421183    }
    11431184    else
    11441185    {
    1145         unsigned short *setfield;
    1146         struct video_picture vid_pic;
    1147         memset(&vid_pic, 0, sizeof(vid_pic));
    1148 
    1149         if (ioctl(videofd, VIDIOCGPICT, &vid_pic) < 0)
    1150         {
    1151             VERBOSE(VB_IMPORTANT,
    1152                     QString("Channel(%1)::ChangeColourAttribute(): "
    1153                             "failed to get picture control (2), error: %2").
    1154                     arg(device).arg(strerror(errno)));
    1155             return -1;
    1156         }
    1157         setfield = GetV4L1Field(attrib, vid_pic);
    1158         if (newvalue != -1 && setfield)
    1159         {
    1160             *setfield = newvalue;
    1161             if (ioctl(videofd, VIDIOCSPICT, &vid_pic) < 0)
    1162             {
    1163                 VERBOSE(VB_IMPORTANT,
    1164                         QString("Channel(%1)::ChangeColourAttribute(): "
    1165                                 "failed to set picture control, error: %2").
    1166                         arg(device).arg(strerror(errno)));
    1167                 return -1;
    1168             }
    1169         }
    1170         else
    1171         {
    1172             // ???
    1173             return -1;
    1174         }
     1186        // ???
     1187        return -1;
    11751188    }
    11761189
    1177     return newvalue / 655;
     1190    return 0;
    11781191}
    11791192
    1180 int Channel::ChangeContrast(bool up)
     1193static int set_attribute_value(bool usingv4l2, int videofd,
     1194                               int v4l2_attrib, int newvalue)
    11811195{
    1182     return ChangeColourAttribute(V4L2_CID_CONTRAST, "contrast", up);
     1196    if (usingv4l2)
     1197        return set_v4l2_attribute_value(videofd, v4l2_attrib, newvalue);
     1198    return set_v4l1_attribute_value(videofd, v4l2_attrib, newvalue);
    11831199}
    11841200
    1185 int Channel::ChangeBrightness(bool up)
     1201int Channel::ChangePictureAttribute(
     1202    int type, const QString db_col_name, bool up)
    11861203{
    1187     return ChangeColourAttribute(V4L2_CID_BRIGHTNESS, "brightness", up);
    1188 }
     1204    if (!pParent || is_dtv)
     1205        return -1;
    11891206
    1190 int Channel::ChangeColour(bool up)
    1191 {
    1192     return ChangeColourAttribute(V4L2_CID_SATURATION, "colour", up);
    1193 }
     1207    int v4l2_attrib = get_v4l2_attribute(db_col_name);
     1208    if (v4l2_attrib == -1)
     1209        return -1;
    11941210
    1195 int Channel::ChangeHue(bool up)
    1196 {
    1197     return ChangeColourAttribute(V4L2_CID_HUE, "hue", up);
     1211    // get the old attribute value from the hardware, this is
     1212    // just a sanity check on whether this attribute exists
     1213    if (get_attribute_value(usingv4l2, videofd, v4l2_attrib) < 0)
     1214        return -1;
     1215
     1216    int old_value = GetPictureAttribute(db_col_name);
     1217    int new_value = old_value + ((up) ? 655 : -655);
     1218
     1219    // make sure we are within bounds (wrap around for hue)
     1220    if (V4L2_CID_HUE == v4l2_attrib)
     1221        new_value &= 0xffff;
     1222    new_value = min(max(new_value, 0), 65535);
     1223
     1224#if DEBUG_ATTRIB
     1225    VERBOSE(VB_CHANNEL, QString(
     1226                "ChangePictureAttribute(%1,%2,%3) cur %4 -> new %5")
     1227            .arg(type).arg(db_col_name).arg(up)
     1228            .arg(old_value).arg(new_value));
     1229#endif
     1230
     1231    // actually set the new attribute value on the hardware
     1232    if (set_attribute_value(usingv4l2, videofd, v4l2_attrib, new_value) < 0)
     1233        return -1;
     1234
     1235    // tell the DB about the new attribute value
     1236    if (kAdjustingPicture_Channel == type)
     1237    {
     1238        int adj_value = ChannelUtil::GetChannelValueInt(
     1239            db_col_name, GetCurrentSourceID(), curchannelname);
     1240
     1241        int tmp = new_value - old_value + adj_value;
     1242        tmp = (tmp < 0)      ? tmp + 0x10000 : tmp;
     1243        tmp = (tmp > 0xffff) ? tmp - 0x10000 : tmp;
     1244        ChannelUtil::SetChannelValue(db_col_name, QString::number(tmp),
     1245                                     GetCurrentSourceID(), curchannelname);
     1246    }
     1247    else if (kAdjustingPicture_Recording == type)
     1248    {
     1249        int adj_value = CardUtil::GetValueInt(
     1250            db_col_name, GetCardID(), GetCurrentSourceID());
     1251
     1252        int tmp = new_value - old_value + adj_value;
     1253        tmp = (tmp < 0)      ? tmp + 0x10000 : tmp;
     1254        tmp = (tmp > 0xffff) ? tmp - 0x10000 : tmp;
     1255        CardUtil::SetValue(db_col_name, GetCardID(),
     1256                           GetCurrentSourceID(), tmp);
     1257    }
     1258
     1259    return new_value;
    11981260}
    1199 
  • libs/libmyth/mythcontext.h

     
    229229 *   You must also update this value in
    230230 *   mythplugins/mythweb/includes/mythbackend.php
    231231 */
    232 #define MYTH_PROTO_VERSION "29"
     232#define MYTH_PROTO_VERSION "30"
    233233
    234234/** \class MythContext
    235235 *  \brief This class contains the runtime context for MythTV.
  • programs/mythfrontend/manualbox.h

     
    99
    1010#include <pthread.h>
    1111
     12class TV;
    1213class QListViewItem;
    1314class QLabel;
    1415class QProgressBar;
  • programs/mythbackend/encoderlink.h

     
    44#include <qstring.h>
    55
    66#include "tv.h"
     7#include "programinfo.h"
    78
     9class TVRec;
    810class MainServer;
    911class PlaybackSock;
    1012class LiveTVChain;
     
    8284    void ToggleChannelFavorite(void);
    8385    void ChangeChannel(int channeldirection);
    8486    void SetChannel(const QString &name);
    85     int ChangeContrast(bool direction);
    86     int ChangeBrightness(bool direction);
    87     int ChangeColour(bool direction);
    88     int ChangeHue(bool direction);
     87    int  GetPictureAttribute(PictureAttribute attr);
     88    int  ChangePictureAttribute(PictureAdjustType type,
     89                                PictureAttribute  attr,
     90                                bool              direction);
    8991    bool CheckChannel(const QString &name);
    9092    bool ShouldSwitchToAnotherCard(const QString &channelid);
    9193    bool CheckChannelPrefix(const QString&,uint&,bool&,QString&);
  • programs/mythbackend/mainserver.cpp

     
    25632563        int oldrate = enc->SetSignalMonitoringRate(rate, notifyFrontend);
    25642564        retlist << QString::number(oldrate);
    25652565    }
     2566    else if (command == "GET_COLOUR")
     2567    {
     2568        int ret = enc->GetPictureAttribute(kPictureAttribute_Colour);
     2569        retlist << QString::number(ret);
     2570    }
     2571    else if (command == "GET_CONTRAST")
     2572    {
     2573        int ret = enc->GetPictureAttribute(kPictureAttribute_Contrast);
     2574        retlist << QString::number(ret);
     2575    }
     2576    else if (command == "GET_BRIGHTNESS")
     2577    {
     2578        int ret = enc->GetPictureAttribute(kPictureAttribute_Brightness);
     2579        retlist << QString::number(ret);
     2580    }
     2581    else if (command == "GET_HUE")
     2582    {
     2583        int ret = enc->GetPictureAttribute(kPictureAttribute_Hue);
     2584        retlist << QString::number(ret);
     2585    }
    25662586    else if (command == "CHANGE_COLOUR")
    25672587    {
    2568         bool up = slist[2].toInt();
    2569         retlist << QString::number(enc->ChangeColour(up));
     2588        int  type = slist[2].toInt();
     2589        bool up   = slist[3].toInt();
     2590        int  ret = enc->ChangePictureAttribute(
     2591            (PictureAdjustType) type, kPictureAttribute_Colour, up);
     2592        retlist << QString::number(ret);
    25702593    }
    25712594    else if (command == "CHANGE_CONTRAST")
    25722595    {
    2573         bool up = slist[2].toInt();
    2574         retlist << QString::number(enc->ChangeContrast(up));
     2596        int  type = slist[2].toInt();
     2597        bool up   = slist[3].toInt();
     2598        int  ret = enc->ChangePictureAttribute(
     2599            (PictureAdjustType) type, kPictureAttribute_Contrast, up);
     2600        retlist << QString::number(ret);
    25752601    }
    25762602    else if (command == "CHANGE_BRIGHTNESS")
    25772603    {
    2578         bool up = slist[2].toInt();
    2579         retlist << QString::number(enc->ChangeBrightness(up));
     2604        int  type= slist[2].toInt();
     2605        bool up  = slist[3].toInt();
     2606        int  ret = enc->ChangePictureAttribute(
     2607            (PictureAdjustType) type, kPictureAttribute_Brightness, up);
     2608        retlist << QString::number(ret);
    25802609    }
    25812610    else if (command == "CHANGE_HUE")
    25822611    {
    2583         bool up = slist[2].toInt();
    2584         retlist << QString::number(enc->ChangeHue(up));
     2612        int  type= slist[2].toInt();
     2613        bool up  = slist[3].toInt();
     2614        int  ret = enc->ChangePictureAttribute(
     2615            (PictureAdjustType) type, kPictureAttribute_Hue, up);
     2616        retlist << QString::number(ret);
    25852617    }
    25862618    else if (command == "CHECK_CHANNEL")
    25872619    {
  • programs/mythbackend/scheduler.cpp

     
    2525#include "encoderlink.h"
    2626#include "mainserver.h"
    2727#include "remoteutil.h"
     28#include "libmyth/util.h"
    2829#include "libmyth/exitcodes.h"
    2930#include "libmyth/mythcontext.h"
    3031#include "libmyth/mythdbcon.h"
  • programs/mythbackend/main.cpp

     
    22#include <qsqldatabase.h>
    33#include <qfile.h>
    44#include <qmap.h>
     5#include <qregexp.h>
    56#include <unistd.h>
    67#include <sys/types.h>
    78#include <sys/stat.h>
     
    1920#include <fstream>
    2021using namespace std;
    2122
    22 #include "tv.h"
     23#include "tv_rec.h"
    2324#include "autoexpire.h"
    2425#include "scheduler.h"
    2526#include "mainserver.h"
  • programs/mythbackend/encoderlink.cpp

     
    99#include "mythcontext.h"
    1010#include "encoderlink.h"
    1111#include "playbacksock.h"
    12 #include "tv.h"
     12#include "tv_rec.h"
    1313#include "programinfo.h"
    1414#include "util.h"
    1515#include "previewgenerator.h"
     
    750750        VERBOSE(VB_IMPORTANT, "Should be local only query: SetChannel");
    751751}
    752752
    753 /** \fn EncoderLink::ChangeContrast(bool)
    754  *  \brief Changes contrast of a recording.
     753/** \fn EncoderLink::GetPictureAttribute(PictureAttribute)
     754 *  \brief Changes brightness/contrast/colour/hue of a recording.
    755755 *         <b>This only works on local recorders.</b>
    756756 *
    757757 *  Note: In practice this only works with frame grabbing recorders.
    758758 *
    759  *  \return contrast if it succeeds, -1 otherwise.
     759 *  \return current value if it succeeds, -1 otherwise.
    760760 */
    761 int EncoderLink::ChangeContrast(bool direction)
     761int EncoderLink::GetPictureAttribute(PictureAttribute attr)
    762762{
    763     int ret = -1;
     763    if (!local)
     764    {
     765        VERBOSE(VB_IMPORTANT, "Should be local only query: "
     766                "GetPictureAttribute");
     767        return -1;
     768    }
    764769
    765     if (local)
    766         ret = tv->ChangeContrast(direction);
    767     else
    768         VERBOSE(VB_IMPORTANT, "Should be local only query: ChangeContrast");
    769 
    770     return ret;
     770    return tv->GetPictureAttribute(attr);
    771771}
    772772
    773 /** \fn EncoderLink::ChangeBrightness(bool)
    774  *  \brief Changes the brightness of a recording.
     773/** \fn EncoderLink::ChangePictureAttribute(PictureAdjustType,PictureAttribute,bool)
     774 *  \brief Changes brightness/contrast/colour/hue of a recording.
    775775 *         <b>This only works on local recorders.</b>
    776776 *
    777777 *  Note: In practice this only works with frame grabbing recorders.
    778778 *
    779  *  \return brightness if it succeeds, -1 otherwise.
     779 *  \return current value if it succeeds, -1 otherwise.
    780780 */
    781 int EncoderLink::ChangeBrightness(bool direction)
     781int EncoderLink::ChangePictureAttribute(PictureAdjustType type,
     782                                        PictureAttribute  attr,
     783                                        bool              direction)
    782784{
    783     int ret = -1;
     785    if (!local)
     786    {
     787        VERBOSE(VB_IMPORTANT, "Should be local only query: "
     788                "ChangePictureAttribute");
     789        return -1;
     790    }
    784791
    785     if (local)
    786         ret = tv->ChangeBrightness(direction);
    787     else
    788         VERBOSE(VB_IMPORTANT, "Should be local only query: ChangeBrightness");
    789 
    790     return ret;
     792    return tv->ChangePictureAttribute(type, attr, direction);
    791793}
    792794
    793 /** \fn EncoderLink::ChangeColour(bool)
    794  *  \brief Changes the colour phase of a recording.
    795  *         <b>This only works on local recorders.</b>
    796  *
    797  *  Note: In practice this only works with frame grabbing recorders.
    798  *
    799  *  \return colour if it succeeds, -1 otherwise.
    800  */
    801 int EncoderLink::ChangeColour(bool direction)
    802 {
    803     int ret = -1;
    804 
    805     if (local)
    806         ret = tv->ChangeColour(direction);
    807     else
    808         VERBOSE(VB_IMPORTANT, "Should be local only query: ChangeColor");
    809 
    810     return ret;
    811 }
    812 
    813 /** \fn EncoderLink::ChangeHue(bool)
    814  *  \brief Changes the hue of a recording.
    815  *         <b>This only works on local recorders.</b>
    816  *
    817  *  Note: In practice this only works with frame grabbing recorders.
    818  *
    819  *  \return hue if it succeeds, -1 otherwise.
    820  */
    821 int EncoderLink::ChangeHue(bool direction)
    822 {
    823     int ret = -1;
    824 
    825     if (local)
    826         ret = tv->ChangeHue(direction);
    827     else
    828         VERBOSE(VB_IMPORTANT, "Should be local only query: ChangeHue");
    829 
    830     return ret;
    831 }
    832 
    833795/** \fn EncoderLink::CheckChannel(const QString&)
    834796 *  \brief Checks if named channel exists on current tuner.
    835797 *         <b>This only works on local recorders.</b>
  • programs/mythlcdserver/main.cpp

     
    1919#include "exitcodes.h"
    2020#include "mythcontext.h"
    2121#include "mythdbcon.h"
     22#include "tv_play.h"
    2223
    2324#include "lcdserver.h"
    2425
  • programs/mythtv/main.cpp

     
     1#include <unistd.h>
     2
    13#include <qapplication.h>
    24#include <qsqldatabase.h>
    35#include <qstring.h>
    4 #include <unistd.h>
    5 #include "tv.h"
     6#include <qregexp.h>
     7
     8#include "tv_play.h"
    69#include "programinfo.h"
    710
    811#include "libmyth/exitcodes.h"