Showing posts with label Microsoft Media Center. Show all posts
Showing posts with label Microsoft Media Center. Show all posts

Friday, July 23, 2010

Finding missing ClearQAM streams


Often, after installing a new Digital TV Tuner into your system Media Center will not detect any channels on it. You run 100's of  'Scan for more Channels' and just end up with 'No Channels Found. To add insult to injury you attempt to add the channels manually but you have absolutely no luck as guessing the channel numbers and sub numbers is just that - a guess.

Figure 1 The Dreaded - No channels found - screen
Well I had enough of that and I decided to write a small utility to scan every channel that media center scans and display the information in the hopes that someone else can find it useful - I know I did.
To understand why your channels are not detected you need to understand how Media Center 'detects' a unique channel. The first step is of course scanning for channels usually this starts by setting the digital tuner to channel 55.25 MHz (if you live in the USA) Media Center uses frequencies for BDA tuners to set the channel. It then jumps in increments of roughly 6 Mhz searching for a digital signal - there are some places where it jumps a different amount but this is outside the scope of this discussion.
Every time the tuner locks onto a signal the transport stream is scanned for a Program Association Table (PAT) table - the PAT table contains each program number and the PID associated with that program. After the PAT table is detected the Program Map Table (PMT) needs to be found. The PMT contains the information (PID and type) of each elementary stream i.e. video, audio, etc.
Now you are wondering what is he talking about what's all this talk about programs when we are talking transport streams…well a transport stream can carry many different streams that are multiplexed, each stream is identified by a PID which is contained in the PAT.

Now Media Center has determined that this is a digital stream and it wants to get 'Digital' information. The stream is now scanned for PSIP (Program and System Information Protocol) information. This starts off with the Master Guide Table (MGT) – this table, similar to how PAT contains information about the streams, contains information about PSIP tables. Most PSIP packets have a PID of 0x1ffb (8187) so detecting the correct table is just a matter of detecting the table field. The MGT will define if a stream contains a Terrestrial Virtual Channel Table (TVCT) used by ATSC transmissions or a Cable VCT (CVCT) which is obviously used by Cable transmissions. These two VCT tables along with the MGT are all that is used for channel detection. There are other tables – the Event Information Table (EIT) is used for guide information if a channel match cannot be found, the Extended Text Table (ETT), etc.
If everything panned out MCE would have detected your channels and you would not be reading this postJ. However there is one caveat occasionally program with duplicate program numbers may be overwritten. I have tested and verified this in a couple of times.

Figure 2 Channel information returned
As you can see in Figure 2 channel 72 two channels with PSIP information were detected and 3 without – the Call Signs are displayed along with the channel numbers that Media Center will present the channel as on the guide the other may be displayed as C72.97, C72.20 and of course C72.235. This of just depends of course on no other channels show up with the same program number and overwrite them.

Figure 3 Media Center Channel edit
As you can see in Figure 3 the information detected on the utility is reflected in Media Center. The pad-lock on the right shows that the channels are encrypted if there is no padlock you can check the box and the channel will show up on your guide without any information. You can then watch it for a while to determine what channel it is and change the listing manually.
If you do not see your program and you know more or less what channel it is you will be able to add it manually. Select Add a QAM channel enter the missing channel number which is either the PSIP number or the "channe .program number". You can select QAM256 by default it does not really make a difference as he tuner handles the demodulation not Media Center.

Figure 4 Adding Channel manually
Unfortunately Media Center will never map a xx.yy channel that it detected via a scan to a xx channel that you will see if you are using a cable card or a STB. This is because Media Center is treating every program as if is a ATSC program – scanning the internals of Media Center also reflects this.
The utility I wrote just scans the channels for now – I am busy porting some of this code to C# so that I can combine it with the code in my previous article to allow editing of the Media Center Guide listings directly. This will also give the ability to select a full channel number as opposed to a x.y number.

Here are the links to the files:
32bit ClearQAM Scanner.
64bit ClearQAM Scanner.

This files are offered without warranty, however they are not public domain please leave any comments re bugs etc. here.

To install run the registerdll.bat file then run the exe file - it will grab the first QAM capable tuner that Media Center is aware of i.e. you must have set up Media Center to use the Digital Cable Tuner before running this utility.

Friday, June 11, 2010

Forget the MCE Extender - just stream the tuner output.


A number of companies that used to make MCE Extenders have stopped making them - I can understand why...you cannot play DVD's from a central server and you cannot access MCE applications like Netflix, Hulu, etc.

My solution to this is to try use the features included with Windows in order to get what you need and just create the rest. Since ATI came out with their firmware upgrade for their cable card tuner it is now possible to play recorded content on other computers on your network (except of course premium content like HBO). Content like videos, pictures, recorded tv, etc. can also be accessed by firstly sharing the folders and then adding the shares to your libraries on other systems. All this leaves is live TV.

There is a solution out there from SiliconDust called HDHomeRun but that will only give you ATSC and Clear QAM - although they have announced a cablecard solution. I bought one of the 2 port devices to play with and it seems pretty decent except for the fact that I need to keep poking holes in my firewall so it can communicate with its driver.

Looking at what is available it becomes obvious that the only solution would be to develop my own tuner streaming solution. I thought about reverse engineering the tuner portion of the extender but that seemed like way to much effort.

Phase 1
I spent 3 months delving into the AVStream class in the WDK during this time I played around with the sample tuner that is included in the DDK hacked out a lot of code and added a lot more. And finally came up with my first alpha solution.

For this I have an application on the 'tuner server' (main MCE box) and a tuner driver on the client system. when you start up a TV application on the client the tuner driver is started which communicates with the server. after that all tune requests are passed to the server and the tuner stream is passed back to the client.

I have included a capture of a Windows 7 x86 session running in VMWare (x86 is faster to kernel debug than x64 with windbg). Media Center is running in the VM communicating with the server (console box) on the left of the screen. My other client box is my Dell XPS notebook running Win 7 x64.

I experiance very little tiling but that could be because I am running on a 1Gbps network. I also spent a lot of time optimizing the network code.
This concludes Phase 1 of the project Phase 2 will include support for multiple simultaneous client and cable card tuners. I am still waiting for my Ceton 4 port tuner which I ordered in April but seems to have been delayed until July.

Part two...