Ticket #6032: getwidthtoo.diff

File getwidthtoo.diff, 4.6 KB (added by robert.mcnamara@…, 17 years ago)

Adds getwidth and uses it to calculate overall resolution (allows for weirdo cropped material)

  • libs/libmythtv/programinfo.h

     
    321321
    322322    // Resolution Set/Get
    323323    void SetResolution(uint width, uint height, long long frame);
     324    int GetWidth(void);
    324325    int GetHeight(void);
    325     void SetVidpropHeight(int height);
     326    void SetVidpropHeight(int width, int height);
    326327
    327328    // GUI stuff
    328329    void showDetails(void) const;
     
    359360    QString chanstr;
    360361    QString chansign;
    361362    QString channame;
     363    uint m_videoWidth;
    362364    uint m_videoHeight;
    363365
    364366    int recpriority;
  • libs/libmythtv/tv_rec.cpp

     
    10831083    int filelen = -1;
    10841084    pauseNotify = false;
    10851085    ispip = false;
     1086    int recWidth;
    10861087    int recHeight;
    10871088
    10881089    if (recorder && HasFlags(kFlagRecorderRunning))
     
    10921093        filelen = (int)((float)GetFramesWritten() / GetFramerate());
    10931094
    10941095        // Get the height and set the videoprops
     1096        recWidth = curRecording->GetWidth();
    10951097        recHeight = curRecording->GetHeight();
    1096         curRecording->SetVidpropHeight(recHeight);
     1098        curRecording->SetVidpropHeight(recWidth, recHeight);
    10971099
    10981100        QString message = QString("DONE_RECORDING %1 %2")
    10991101            .arg(cardid).arg(filelen);
  • libs/libmythtv/programinfo.cpp

     
    160160
    161161    record = NULL;
    162162
     163    m_videoWidth = 0;
    163164    m_videoHeight = 0;
    164165}
    165166
     
    265266    lastInUseTime = other.lastInUseTime;
    266267    record = NULL;
    267268
     269    m_videoWidth = other.m_videoWidth;
    268270    m_videoHeight = other.m_videoHeight;
    269271
    270272    positionMapDBReplacement = other.positionMapDBReplacement;
     
    30873089    return m_videoHeight;
    30883090}
    30893091
     3092/** \fn ProgramInfo::GetWidth(void)
     3093 *  \brief Gets overall average width.
     3094 */
     3095int ProgramInfo::GetWidth(void)
     3096{
     3097    MSqlQuery query(MSqlQuery::InitCon());
     3098
     3099    query.prepare("SELECT recordedmarkup.DATA FROM recordedmarkup"
     3100                  " WHERE recordedmarkup.chanid = :CHANID"
     3101                  " AND recordedmarkup.starttime = :STARTTIME"
     3102                  " AND recordedmarkup.type = 30"
     3103                  " GROUP BY recordedmarkup.data ORDER BY"
     3104                  " SUM((SELECT IFNULL(rm.mark, recordedmarkup.mark)"
     3105                  " FROM recordedmarkup AS rm WHERE rm.chanid = recordedmarkup.chanid"
     3106                  " AND rm.starttime = recordedmarkup.starttime AND"
     3107                  " rm.type = recordedmarkup.type AND"
     3108                  " rm.mark > recordedmarkup.mark"
     3109                  " ORDER BY rm.mark ASC LIMIT 1)"
     3110                  " - recordedmarkup.mark) DESC LIMIT 1;");
     3111    query.bindValue(":CHANID", chanid);
     3112    query.bindValue(":STARTTIME", recstartts);
     3113
     3114    if (query.exec() && query.next())
     3115    {
     3116        m_videoWidth = query.value(0).toInt();
     3117    }
     3118    else
     3119        m_videoWidth = 0;
     3120
     3121    return m_videoWidth;
     3122}
     3123
    30903124/** \fn ProgramInfo::SetVidpropHeight(int height)
    30913125 *  \brief Sets overall average height flag in videoprops.
    30923126 */
    3093 void ProgramInfo::SetVidpropHeight(int height)
     3127void ProgramInfo::SetVidpropHeight(int width, int height)
    30943128{
    30953129    MSqlQuery query(MSqlQuery::InitCon());
    30963130
     
    30983132    " CONCAT_WS(',', IF(videoprop = '', NULL, videoprop), :VALUE)"
    30993133    " WHERE chanid = :CHANID AND starttime = :STARTTIME;");
    31003134
    3101     if (height > 700 && height < 800)
     3135    if (height > 700 && height < 800 && width < 1400)
    31023136    {
    3103         VERBOSE(VB_IMPORTANT, QString("Recording designated 720p because height was %1").arg(height));
     3137        VERBOSE(VB_IMPORTANT, QString("Recording designated 720p because width was %1 "
     3138                                      "and height was %2").arg(width).arg(height));
    31043139        videoproperties |= VID_720;
    31053140
    31063141        query.bindValue(":VALUE", "720");
     
    31123147            MythDB::DBError("UpdateRes", query);
    31133148
    31143149    }
    3115     else if (height > 1000 && height < 1100)
     3150    else if (height > 1000 && height < 1100 || width >= 1400)
    31163151    {
    3117         VERBOSE(VB_IMPORTANT, QString("Recording designated 1080i/p because height was %1").arg(height));
     3152        VERBOSE(VB_IMPORTANT, QString("Recording designated 1080i/p because width was %1 "
     3153                                      "and height was %2").arg(width).arg(height));
    31183154        videoproperties |= VID_1080;
    31193155
    31203156        query.bindValue(":VALUE", "1080");