A peek under the hood: Windows Media Center’s PVR in Windows 7

Written by JeremyC on October 10th, 2009. Posted in Beginner Information, Recent News

A common question we see in the community is “why didn’t show x or show y record when scheduled?”

I thought that an article outlining some of the inner workings Windows Media Center for Windows 7 uses to determine what gets record and when. A caveat: the PVR is a complex beast so not everything will be covered. Also the type and number of tuners can affect how the PVR behaves.

In the descriptions below the machine will have NTSC and QAM tuners. So two shows can be recorded at once and the configuration will have SD and HD capabilities.

Alternate Shows

An alternate show is an airing that occurs more than once. Good examples would be ‘Dr Phil’ or ‘Oprah’ which air in the afternoon and are repeated in the evening.

Prototypical and Non-prototypical recordings

Going to the guide and choosing to record series ‘Oprah’ at 8pm generates a prototypical recording. This means that we will record this specific airing and then going forward get any other airings when they are on. It also infers that you prefer this specific channel and signal type (HD or SD).

wmctb2

A non-prototypical recording could be a keyword request rather than recording a specific guide entry. Oprah might be recorded via a Title Search. This would result in a series recording on any channel, any signal type and at any time.

wmctb1

Conflicts

Conflicts happen when more shows have been requested to be recorded than tuners are available for a given time period. So a typical system may have 2 tuners installed and if 3 shows need to be recorded at the same time, one of the shows will not be recorded. First of all shows will be recorded by their priority and then the PVR will attempt to see if an alternate airing is available. If there is an alternate then the conflict can be auto resolved. The show which couldn’t be recorded at the original time will get a blue ! icon indicating that it will be recorded sometime in the future. Or a yellow ! icon indicating that it will not be recorded. (This doesn’t mean it will never be recorded, only that the current guide doesn’t allow it to be recorded in the near future.)

clip_image006

[Spot the UI Bug for bonus points in the above screen shot]

However if the conflict cannot be resolved automatically via alternates, then the conflict UI pops up and the user makes the decision of which show to record.

clip_image008

Example PVR Functionality

Does the conflicting show exist elsewhere?

As mentioned earlier, the first thing the PVR scheduler does is to see if the conflicting show exists elsewhere. It looks for alternates in order of priority, higher priority shows should be recorded first. It also must consider future conflicts as well; by recording an alternate airing it is quite possible new future conflicts will be created. The technique used to calculate all of these dependencies is called branch and bound. This article will not discuss branch and bound since it is beyond the scope of this article. To limit the sheer number of permutations the branch and bound system PVR only looks three days ahead.

Jumping to other tuners

Using the conflict example in the screen shot below; there is a prototypical series recording of Oprah on channel 5. Another show has been scheduled to record at the same time on the same tuner. So Oprah has been “banged out” (! icon) on both 5 and 5.1 even though the QAM tuner is available. As you can see from the screenshot there is another airing on channel 5.1. The prototypical airing of Oprah was SD, so the scheduler looks for an SD airing first. In our example an SD airing of Oprah will be recorded later in the day. Rather than record the HD version which is on now.  The reason is that the scheduler prefers Quality over Time and tries to keep the requested record quality rather than get the exact time.

There is a caveat to the above scenario: The above scenario only works if the airing of Oprah is a repeat. If this is a first run episode then the behavior is slightly different. Instead the scheduler would prefer Time over Quality and choose the airing on channel 5.1 at 4pm. The later airing on SD would be the schedulers’ second choice. The idea is that if you are watching a time specific show such as Survivor-Dancing-Idol-Apprenticeship, you would want the first showing where ever possible, rather than wait for the 2 a.m. rerun next day.

clip_image009

Partial Recordings

One cool feature of Windows Media Center in Windows 7 is its ability to get your requested show again if the original recording is considered a partial. Partial recordings can happen for a number of reasons; the most common is when the user changes the channel to watch something else. In this case Windows 7 Media Center will keep the partial recording and attempt to record the same show again in the future.

As you can see, once the record button get pressed, a lot of decisions have to be made under the hood. Even just writing the scenarios out in plain language is very verbose and open to interpretation. If there is interest perhaps my next article could outline our internal notation for describing such scenarios and expected results.

Hopefully this article was of interest to you and I look forward to writing more in the coming year.

by Richard Cook

About the Author

Richard Cook works on Media Center for Windows, more specifically the PVR feature set. He joined the team about 1.5 years ago after moving from the Visual Studio Debugger Team. Now his friends and family can actually relate to the software he helps to create, rather than just smiling and nodding blankly. He is also pleased that he can now do some cool demos of his work for firends and family at home.

Link to original post: thegreenbutton