Permalink
Browse files

Adds 'damaged' video property for poor recordings.

This sets the 'warning' state for the Watch Recordings list item if the
property is set and also adds a 'videoquality' statetypes for those themes
that wish to use an icon for this property.

The idea is that the recording is perhaps watchable, but this gives you
a warning that a there may be a serious problem with the recording so
you should perhaps check it before inviting a friend over to watch it
with you.

The property is set whenever RecordingQuality::IsDamaged() returns true.
This is primarily based gaps in the recording with extra weight given
to gaps at the beginning and end of the scheduled program slot. In the
future we may add transport stream discontinuity or other recorder
specific quality metrics.
  • Loading branch information...
1 parent f5f6b85 commit 72d437001e74c57f64217de14c383e22e081a857 @daniel-kristjansson daniel-kristjansson committed Dec 12, 2011
@@ -114,7 +114,7 @@ package MythTV;
# schema version supported in the main code. We need to check that the schema
# version in the database is as expected by the bindings, which are expected
# to be kept in sync with the main code.
- our $SCHEMA_VERSION = "1288";
+ our $SCHEMA_VERSION = "1289";
# NUMPROGRAMLINES is defined in mythtv/libs/libmythtv/programinfo.h and is
# the number of items in a ProgramInfo QStringList group used by
@@ -5,7 +5,7 @@
"""
OWN_VERSION = (0,25,-1,3)
-SCHEMA_VERSION = 1288
+SCHEMA_VERSION = 1289
NVSCHEMA_VERSION = 1007
MUSICSCHEMA_VERSION = 1018
PROTO_VERSION = '70'
@@ -3693,23 +3693,27 @@ int64_t ProgramInfo::QueryTotalFrames(void) const
return frames;
}
-void ProgramInfo::SaveResolutionProperty(VideoProperty vid_flags)
+void ProgramInfo::SaveVideoProperties(uint mask, uint vid_flags)
{
MSqlQuery query(MSqlQuery::InitCon());
+ LOG(VB_RECORD, LOG_INFO,
+ QString("SaveVideoProperties(0x%1, 0x%2)")
+ .arg(mask,2,16,QChar('0')).arg(vid_flags,2,16,QChar('0')));
+
query.prepare(
"UPDATE recordedprogram "
"SET videoprop = ((videoprop+0) & :OTHERFLAGS) | :FLAGS "
"WHERE chanid = :CHANID AND starttime = :STARTTIME");
- query.bindValue(":OTHERFLAGS", ~(VID_1080|VID_720));
+ query.bindValue(":OTHERFLAGS", ~mask);
query.bindValue(":FLAGS", vid_flags);
query.bindValue(":CHANID", chanid);
query.bindValue(":STARTTIME", startts);
query.exec();
uint videoproperties = GetVideoProperties();
- videoproperties &= ~(VID_1080|VID_720);
+ videoproperties &= ~mask;
videoproperties |= vid_flags;
properties &= ~kVideoPropertyMask;
properties |= videoproperties << kVideoPropertyOffset;
@@ -552,7 +552,7 @@ class MPUBLIC ProgramInfo
void SaveFrameRate(uint64_t frame, uint framerate);
void SaveTotalDuration(int64_t duration);
void SaveTotalFrames(int64_t frames);
- void SaveResolutionProperty(VideoProperty vid_flags);
+ void SaveVideoProperties(uint mask, uint video_property_flags);
void SaveMarkupFlag(MarkTypes type) const;
void ClearMarkupFlag(MarkTypes type) const { ClearMarkupMap(type); }
void UpdateLastDelete(bool setTime) const;
@@ -177,10 +177,11 @@ typedef enum VideoProps {
VID_AVC = 0x04,
VID_720 = 0x08,
VID_1080 = 0x10,
-} VideoProperty; // has 5 bits in ProgramInfo::properties
-#define kVideoPropertyBits 5
+ VID_DAMAGED = 0x20,
+} VideoProperty; // has 6 bits in ProgramInfo::properties
+#define kVideoPropertyBits 6
#define kVideoPropertyOffset kAudioPropertyBits
-#define kVideoPropertyMask (0x1f<<kVideoPropertyOffset)
+#define kVideoPropertyMask (0x3f<<kVideoPropertyOffset)
/// if SubtitleTypes changes, the audioprop column in program and
/// recordedprogram has to changed accordingly
@@ -51,7 +51,7 @@
* MythTV Python Bindings
* mythtv/bindings/python/MythTV/static.py
*/
-#define MYTH_DATABASE_VERSION "1288"
+#define MYTH_DATABASE_VERSION "1289"
MBASE_PUBLIC const char *GetMythSourceVersion();
@@ -6022,6 +6022,16 @@ NULL
return false;
}
+ if (dbver == "1288")
+ {
+ const char *updates[] = {
+"ALTER TABLE recordedprogram CHANGE COLUMN videoprop videoprop "
+" SET('HDTV', 'WIDESCREEN', 'AVC', '720', '1080', 'DAMAGED') NOT NULL; ",
+NULL
+};
+ if (!performActualUpdate(updates, "1289", dbver))
+ return false;
+ }
return true;
}
@@ -877,9 +877,10 @@ void TVRec::FinishedRecording(RecordingInfo *curRec, RecordingQuality *recq)
// Get the width and set the videoprops
uint avg_height = curRec->QueryAverageHeight();
- curRec->SaveResolutionProperty(
- (avg_height > 1000) ? VID_1080 :
- ((avg_height > 700) ? VID_720 : VID_UNKNOWN));
+ curRec->SaveVideoProperties(
+ VID_1080 | VID_720 | VID_DAMAGED,
+ ((avg_height > 1000) ? VID_1080 : ((avg_height > 700) ? VID_720 : 0)) |
+ ((is_good&&false) ? 0 : VID_DAMAGED));
// Make sure really short recordings have positive run time.
if (curRec->GetRecordingEndTime() <= curRec->GetRecordingStartTime())
@@ -269,6 +269,9 @@ static QString extract_main_state(const ProgramInfo &pginfo, const TV *player)
state = "disabled";
}
+ if (state == "normal" && (pginfo.GetVideoProperties() & VID_DAMAGED))
+ state = "warning";
+
return state;
}
@@ -1095,6 +1098,28 @@ void PlaybackBox::updateIcons(const ProgramInfo *pginfo)
iconState->Reset();
iconMap.clear();
+ iconMap["damaged"] = VID_DAMAGED;
+
+ iconState = dynamic_cast<MythUIStateType *>(GetChild("videoquality"));
+ haveIcon = false;
+ if (pginfo && iconState)
+ {
+ for (it = iconMap.begin(); it != iconMap.end(); ++it)
+ {
+ if (pginfo->GetVideoProperties() & (*it))
+ {
+ if (iconState->DisplayState(it.key()))
+ {
+ haveIcon = true;
+ break;
+ }
+ }
+ }
+ }
+
+ if (iconState && !haveIcon)
+ iconState->Reset();
+ iconMap.clear();
iconMap["deafsigned"] = SUB_SIGNED;
iconMap["onscreensub"] = SUB_ONSCREEN;
iconMap["subtitles"] = SUB_NORMAL;
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 72d4370

Please sign in to comment.