My Mac Mini HTPC saga: TV tuners

 

Do I really *need* a tuner?

One of the major hang-ups I had – in making the switch from Windows Media Center to a Mac Mini – was worrying whether I’d be able to plug in enough TV tuners into the Mac Mini to be able to record all the TV I usually watch.

However, after having been *without* an HTPC for almost a year, it’s amazing how little I feel like I *must* get record whatever current-run TV shows are being played.  What with the availability of almost every TV season on Netflix instant watch, or a full season on DVD, or (theoretically) a quick download via bittorrent, there’s almost no sense of urgency left to the act of watching TV, and if we happen to miss it – oh well, I’m sure I’ll be able to get it real soon. I’ve caught up on a year’s worth of The Big Bang Theory just recently, and I’m about to re-orient myself to two years’ worth of Supernatural (so I have the possibility of watching current-run episodes within the next few weeks).

All that said, I can’t quite bring myself to give up my ability to accumulate a “taped” copy of the shows that were broadcast to me, for later viewing when I have more time.  Breaking the cycle of dependence between me and the timeslot the broadcaster decides to air the show is a powerful mental leap to make, and makes me feel less like a prisoner of the networks (and their increasingly hostile attitude towards their audience).  If only to make myself feel like I have a modicum of control over my TV habits, I’ve decided to drop another $200 on an Elgato EyeTV 250 Plus tuner.

Why that brand and model?  Couple of reasons:

  1. My research into Mac-based HTPC’s and Mac-compatible tuners seems to mention the Elgato products more than any other brand.  It feels like what I saw with Hauppauge for Windows Media Center, and if my satisfaction with the Hauppauge products is any indication, the Elgato products should be good.
  2. It’s not just the hardware – apparently the EyeTV software is the best available for recording and managing playback of recordings on the Mac.

Finding all the digital channels available to be recorded with your tuner

If you’re going the OTA route, then this seems like a great way to see what all is available without a prescription (ha – I mean, subscription):

http://www.equinux.com/us/products/tubestick/tuningmap.html

If you’re stuck (like me) with wanting to get the few remaining channels that haven’t gone the full-streaming/Hulu/TV.com type of approach, and you *need* that subscription to bastards like Comcast, then your tuner has one of two uses:

  1. Analog tuner (receiving the analog output from a DTA box), in which case be prepared to buy an “IR blaster” (device that allows your HTPC to direct “change channel” commands to the IR receiver of the DTA box).  This way, you get all the channels to which you’ve subscribed – whether the cable company is encrypting those QAM signals or not.
  2. Digital tuner (receiving whichever unencrypted (aka “clear QAM”) channels your cable company hasn’t yet obfuscated with the 56-bit DES encryption that (so far) is only supportably-decryptable by the DTA and/or full cable box solutions they hook up on your behalf).  This way, you get all the channels your cable company hasn’t yet encrypted – usually including the “extended basic” channels, and probably a few others that might not be high on their list of “must-have” channels.

The EyeTV software that comes with Elgato products includes a feature called “Exhaustive Scan”, which picks up the digital channels that aren’t sent out on the typical frequencies that are publicized by Comcast.  I was able to find about 80% of the non-local channels that I normally watch (and a bunch that I’ll *never* watch, no matter *how* high-def they are).  However it took me most of the afternoon to map those channels out.

Be careful though: I don’t know why, but somehow all the configuration that I did to map those channels went up in smoke the next time I rebooted the Mini. Now maybe the system crashed before shutting down EyeTV – but is this software *really* so fragile that it doesn’t cache these settings as soon as they’re configured?  And make sure that the file that stores these settings doesn’t get wiped out by an errant half-open write operation or something?

 

Future question:

Is there a similar Plex plug-in for EyeTV as is available for Boxee?

My Mac Mini HTPC saga: software & configurations

Now that I’ve done the whole hardware upgrade and full, clean install of Mac OS X 10.6, I have to start all over again (this time with a little practice under my belt) on getting all the stuff assembled for a well-oiled home theatre machine.

Plex, Boxee, EyeTV, VLC, Transmission, Silverlight, MacTheRipper

Lots of software, so little attention span. 🙂

Plex

  • As my chosen media front-end, I intend to do as much as possible from here, and only veer into the other apps I’m using when necessary
  • I choose to install the following apps: Hulu, Apple Movie Trailers, South Park, Netflix, The Daily Show, Pandora, PBS, Picasa Web, Trailer Addict, YouTube

Boxee

  • I hear this is the only way to get full streaming of the CBS TV shows in a 10’ UI experience (rather than fire up Safari/Firefox and click away directly)
  • So I logged into Boxee.tv, downloaded the Mac OS X alpha of Boxee (which is simply yet another XBMC fork/port) and started looking at the “Applications” – Videos > CBS > Full Episodes shows listings for How I Met Your Mother (which I watch) but not for The Big Bang Theory (which I *slavishly* watch)

CBS: Fail.

EyeTV

  • Once I decided to definitely get a tuner (more on that in another blog article), the overwhelming number of times I’ve heard Elgato’s products recommended (not just their tuner, but their pretty great EyeTV software app to manage the tuner) was the clincher
  • The trickiest part was upgrading EyeTV from 3.0.x to 3.2 (which just came out a few days ago).  It turns out that on systems running Mac OS X 10.6, EyeTV 3.0.x won’t even launch – Apple in the infinite wisdom intentionally put a “block” in place so that it won’t start.
  • It turns out there’s an “under the covers” way to bypass such Mac OS X “blocks”, by launching the application’s actual binary file, rather than using the “user friendly shortcut” that is presented in the Applications folder (and which I, like most Mac users, seem to happily use until something prevents us from getting in the easy way).
  • I found an article at Elgato’s site that outlined the process: http://support.elgato.com/index.php?_m=knowledgebase&_a=viewarticle&kbarticleid=3628
  • Once I got EyeTV 3.0.x (I think it was 3.0.3 that shipped with my EyeTV 250 Plus tuner) running, I was able to use the EyeTV “Check for Updates” menu option to get the 3.2 download and be back working like a charm.

VLC Media Player

  • I remembered that VLC was the easiest way to get access to all the significant codecs, and have a nice media player in the background in case any of the rest of ‘em weren’t working out for me.
  • Downloaded, installed, and already confirmed that VLC can play VOB files that were copied directly off a DVD (for backup purposes, naturally – who wants to scratch their only copy of Robot Chicken?)

Transmission BitTorrent client

  • Ever since hearing about PeerGuardian for Windows (a piece of software that prevents your computer from connecting to “blacklisted” IP addresses – e.g. those servers setup by the RIAA, government agencies and others to track what you’re doing with your downloads and other torrent-like activity), I’ve been dreading the conversion over to my Mac Mini
  • Then somehow today, my searches through Lifehacker’s archives for “p2p file sharing ‘mac os x’” turned up an article from 2008 on Transmission – a BitTorrent client for Mac OS X and Linux.
  • It turns out that the friendly and nice folks at Transmission have integrated the PeerGuardian functionality into their app, including automatic downloads of the Bluetack blocklists
  • That’s enough for me – I’ve already got Transmission installed and slurping down some great media for later watching.

Silverlight 3.0 (for Netflix)

  • Silverlight is necessary for playing the Netflix Instant Watch streaming movies, and it doesn’t seem to get installed “in the background” by Plex, Boxee or any of the other media-front-end apps that provide a Netflix wrapper
  • Makes sense now that I think about it, but I can’t say I wasn’t disappointed by the fact that the Mac software community hasn’t made all this stuff entirely hidden from my relatively novice eyes.

MacTheRipper

Great little app for making backup copies of your DVDs onto a local hard drive.  Essential in this day and age.

Issue: Mac OS X 10.6 intercepts all Apple Remote commands

As of OS X 10.6, the operating system itself intercepts all Apple Remote commands, and cannot be overridden by application-specific configurations (as was apparently the case with Plex and probably others in the past).  Instead, hitting the Menu button on the Apple Remote will always bring up Front Row; hitting the volume buttons will always change the system-wide volume, and other irritating effects (for an HTPC user who’s using third-party HTPC-oriented software) are seen as well.

While there’s no supported, by-design way in OS X to disable this “feature”, there are some known workarounds – which I’ve implemented:

http://forums.plexapp.com/index.php?showtopic=8658

  • edited the /System/Library/LaunchAgents/com.apple.RemoteUI.plist file (after making a copy of the file in the same directory, in case I later want to revert back to the original settings)
  • deleted the /System/Library/LoginPlugins/BezelServices.loginPlugin (after making a copy of the file – ibid)

http://www.tech-recipes.com/rx/2754/os_x_edit_file_using_textedit_as_root_superuser/

I had to use this article’s cluefulness to allow me to interactively edit the RemoteUI.plist file using TextEdit.

http://support.apple.com/kb/TA25121

I also got bit by the “blank admin password” problem – wasn’t able to fire up sudo when my current account had a blank password.  So I changed it, did the sudo-enabled edit, and changed the password back.

Next Steps…

Wondering – do I really *need* a TV tuner, to enjoy the world’s best offerings of TV and other media?

My Mac Mini HTPC saga: upgrading hardware, optimizations

 

Replace RAM, Hard drive with beefier options I bought myself

I wanted to have the maximum available ‘headroom’ in this box before I committed a lot of time installing and configuring lots of software (e.g. if I wanted to run software-driven encoding, have multiple big apps running at the same time, or even to run a virtualized instance of Windows whenever I felt the ‘itch’). 

So after reading about what some of the braver souls have done under the hood, I decided that I’d purchase the lowest-end Mac Mini (with the exception of getting the fastest processor, which aren’t upgradeable AFAIK) and then purchase 4 GB of RAM & a 320 GB 7200 RPM SATA drive.

4 GB of RAM (or 8?)

While deciding on a brand of RAM is usually a decision with way too many options, on what should be but sometimes isn’t a commodity purchase, I cheated.  When browsing around Amazon.com for what kinds of prices they had available for Mac Mini’s, I noticed their “what other people purchase with this item” was consistently coming up with one package of Corsair 2 x 2GB DDR3 (PC3-8500) RAM – this one, for (at the time I purchased)

Note: I’ve done as much reading as I could about the new 64-bit capabilities unlocked by Mac OX 10.6 (Snow Leopard), and while there’s promising speculation that the Mac Mini could take 2 x 4GB RAM (i.e. 8GB total), the reality is the price of the 4GB PC3-8500 modules is astronomical compared to 2GB modules.  I’ll keep that in mind for the future, but for now the 4GB is plenty of extra capacity for now, and I can keep the extra couple hundred dollars for something else.

Which Hard Drive?

Over the decades, different hard drive manufacturers have produced drives of higher or lower quality, and I can never keep up with “which manufacturer is the king for each drive size and capacity”.  For this I trundled down to my local PC supply shop with two specifications in hand: it has to be a 2.5” drive (the bigger ‘desktop’ drives won’t fit) and it has to be a 7200 RPM drive (my reading suggests the faster drive speeds make a big difference in a Mac Mini HTPC).

The dude behind the counter was very definitive – according to him, the most reliable and best-performing 2.5” 7200 rpm drive on the market today is from Western Digital (aka the “Scorpio Black” line of drives).

If you’re looking at other brands, and you’d like to know if other Mac Mini owners have been successful upgrading with them, I found a really useful resource that could help: “Mac Drive Upgrades/Compatibility Database” at http://forums.xlr8yourmac.com/drivedb/search.drivedb.lasso

Procedure to Open the Mac and Upgrade the Components

Search Google for “Mac Mini RAM upgrade” and/or “Mac Mini hard drive upgrade” – there are many step-by-step guides available (e.g. this one), and a number of great YouTube videos that take you visually through the process. I just followed the first couple that I found and everything seemed to work fine (at least, for this “old hat” at constructing my own PCs for so many years).

For me, the only tools I needed were:

  • a putty knife or scraper blade (anything thin, metal and long enough to wedge in a few inches into the Mac Mini case)
  • a Philips (the “x” kind) screwdriver that is thin enough to get into a very narrow plastic tube (eyeglasses screwdrivers are usually good for this), and has a small/thin enough head that it can unscrew (and not strip) the screws with the very narrow “x” channel.
    • As some pointed out, magnetizing the screwdriver head is very handy for extracting those tiny little, fidgety screws – otherwise they tend to drop into the Mac Mini guts, and then you’re shaking it hard enough to get it loose (but not too hard so that you risk “damaging” some microscopic parts – not that I think there is any real danger of this with what I saw, but even an “old hat” gets worried there’s some new level of miniaturization that makes some part extremely sensitive to impact from even a 1/4-ounce screw.

Remember: Format your new Drive

Oh, and don’t forget to format the drive using Disk Utility (accessible from the top menu bar after the Mac OS X installer has asked which language you want to install).  I went through the install twice, both times wondering why the new 320GB disk wasn’t available as a selection for “where do you want to install Mac OS X”.  I figured that the installer was so smart that it recognized an unformatted disk, and would automatically format it for me.  (Soon, perhaps, but not at present.)  Embarrassing, but easily corrected – once I realized that I *had* checked all connections twice, and there was really very little that *could* prevent the drive from being recognized at the physical level.

Reinstalling Mac OS X and the rest of the bits from the two DVDs

This part was a freakin dream – so few questions, everything possible automated – it’s like Apple realizes that most people don’t care to fiddle, they just want the sucker to work.

The only extra steps I had to take were installing the optional bits (mostly utilities, but also Safari, Mail, iCal and some other useful things) from the OS X install DVD, and then installing whatever comes on that DVD labelled “”.  (Heck, it only consumed 4GB of my new 320GB drive, and until I know more about what I *don’t* need, I’m pretty comfortable taking 4GB “just in case”.)

Misc optimizations:

  • enable SMB sharing in Mac OS X, so that Plex (or Boxee) can find and scour any locally-attached external drive for photos, music and video.  (Apparently the XBMC codebase always expected to find all media on a network-shared device, since the original XBox hardware itself couldn’t retrieve or store that much media locally on the puny 20GB XBox drive.)
  • Add an entry point in the Front Row menu for Boxee – does this work for Plex as well?
  • Added link to 10-foot-UI-friendly version of my Google Reader account (via http://mymediaexperience.com/feeds-as-newspaper-in-your-living-room/)
  • Something about reconfiguring audio for Plex: “As for setting up Plex with a DTS or DD receiver. Go Configure The System -> System -> Audio Hardware from the menu. Then change the audio output from analog to digital. ” (http://www.123macmini.com/forums/viewtopic.php?t=20440)

My Mac Mini HTPC saga: filesystem selection for external media drive

 

Quest: best filesystem for my external hard drive

I have a 750 GB Seagate FreeAgent drive, where I’ve kept most of my media (photos, music, video, backups) for the past couple of years.  Until now, I was operating in an all-Windows world of my own design, and NTFS was the best (most reliable, performant, flexible) filesystem for that drive.

Now that I’ve introduced a Mac into my life, and because I’m planning to plug it into the Mac Mini for the vast majority of the time (to host media I record from or wish to display via the Mini) I’m faced with what feels like an imperfect choice:

  • FAT32 doesn’t support > 4 GB filesize, which in this day and age of recorded/downloaded TV (not to mention the potential for virtualization in my future, in case I want to keep experimenting/developing) is damned easy to exceed.
  • NTFS isn’t natively supported in Mac OS X (at least, not for writes, though a read-only NTFS driver is available).
  • Mac-only filesystems (e.g. HFS+) feel like a bit *too* much commitment to a platform that isn’t the dominant in my lifestyle yet – e.g. what if I want to unplug that drive from the Mac mini and hook it to my Windows box to do some USB 2.0-speed backups or other file transfers?  I know that most of my file transfers will probably work fine with an SMB share over the Wifi network (it’s all 802.11 g or better, in a pretty confined space), but sometimes I just want to get something done quickly.  Not to mention I’m not yet familiar with what steps I would have to take if I were to hook up my external drives (the 750GB – cleaned off now – and my backup one – FAT32), format the 750 gigger and try to copy over all my FAT32 data into reasonable facsimiles of the data I replicated off the 750 (before I repartitioned it).

There’s some fairly predictable chatter about lower performance of 3rd-party (R/W) NTFS drivers when used within Mac OS X (http://www.123macmini.com/forums/viewtopic.php?t=23243&highlight=ntfs), and I’d expect similar concerns about 3rd-party HFS+ drivers (R/W) running in Windows.  I’m not worried about booting from the external drive, so that limitation of NTFS-3g isn’t a concern for me (http://www.123macmini.com/forums/viewtopic.php?t=23057&highlight=ntfs).

However, after thinking about what my *majority* usage will be, it’s clear to me that I’ll end up leaving the drive mounted to the Mac Mini 95% of the time, so I should optimize it for that scenario and not the “just in case” fear-based scenario.  If it turns out that I’m using the drive directly attached to my Windows box *that* often, I can always use a one-time read-only HFS+ driver in Windows to get the data off the drive, then reformat with NTFS.  Getting the data off the drive isn’t a worry of mine (these drivers all seem good enough for at least the “disaster recovery – get my data off the drive *eventually*” scenarios); so I’d be an idiot not to optimize for the day-to-day performance issues I’d otherwise be facing with a non-native filesystem for the host where it’ll be plugged in 95% of the time.

Next time

  • Quest: a tuner I can “set and forget” (i.e. reliable, stable, robust performance)
  • Quest: improve the screen drawing response time in “Screen Sharing” (aka VNC)

My Mac Mini HTPC saga: Plex or Boxee as the front-end?

After opening my mind to the possibility that I could find in the Mac Mini a worthy replacement for the aging (and rotting) promise of Windows Media Center as an HTPC, it didn’t take long to find out just how far the Mac HTPC community has come.  Between the streaming media front ends like Plex & Boxee, and the first-class support from digital-TV-tuner manufacturers like Hauppauge, and the number of people who’ve blazed the trail ahead of me, it seemed like a no-brainer.

However, unlike an Apple TV (a low-powered CPU ‘appliance’ that was intended merely to download movies and TV from the iTunes store), the Mac Mini isn’t specifically designed as a home theater PC (HTPC), and doesn’t present itself to the uninitiated user as a direct complement to their TV.

That said, with not a whole lot of effort and a few add-on bits of hardware, this Mac Mini is easily the equal of the functionality of my old Windows Media Center system, and has the advantage of being a lot smaller and ridiculously quieter than a clunky monster PC.  [Outside of an extra $grand or two for a custom-designed HTPC, if you’ve got more money than brains.]

Which streaming media front end?

There are plenty of “Plex vs. Boxee” articles/forum chatter for anyone who’s looking (these are just the ones I found in my first couple of pages of Google results: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12).  There’s a lot of active development in both projects, and there’s a lot of enthusiasm for both, but there seem to be some common themes to the discussions I’ve read:

  1. Plex is more “fiddly” to setup your library of existing, local content – finding the folders and assigning the metadata.  Boxee seems to have mastered the “point it at folders and it’ll organize it into a library” approach.
  2. Boxee is more socially oriented, as in it lets other members of Boxee find out what you’ve watched (at least among the online sources – presumably it doesn’t advertise what you’re watching of your locally-stored media).
  3. One covers the BBC online media; the other covers integration of the Netflix instant watch streaming. (Or at least that’s what I recall reading.)
  4. Since they’re both based on the XBMC codebase, they’ll both benefit tremendously from future enhancements to the
  5. Boxee seems to have already skewed towards/created a culture of “cut the cable” (i.e. “help me get rid of Comcast/Time Warner stat!”), while Plex (perhaps as a Mac-only product) has a little less of the prickly attitude.
  6. They’re both generally considered inferior to Front Row from a UI/usability perspective, but neither one is ever accused of being “unusuable”.
  7. They both integrate with the Apple Remote (or if you’re a Logitech weenie, with most Harmony remotes – personally, after trying and failing for over a year to get a Harmony to operate as a set-it-and-forget-it, “universal one-touch” remote, I’ll avoid those hack-jobs like the plague).

While my girlfriend is quite adept at her Macbook, our discussions so far have led me to believe that the less fiddly/quirky this setup is on a day-to-day basis, the more comfortable she’ll be at using this (and the less I’ll have to coach her down off the ledge and into the world of computer-based home media.

Thus I’m convinced by what I’ve read to veer towards Plex (and not bother her with it until I’ve got the existing content adequately catalogued in the Plex library).

Next Steps: setting up Plex

Apparently, as one poster indicated, “The key seems to be putting Plex in Library mode. Once done, its scraper will dl the video info.”

There’s also some question whether Plex yet provides integrations with Netflix and Flickr.  I’ll have to dig through the PlexApp plug-in announcement archives.

Then I’ll be interested to dig further into the question of whether, by installing VLC media player, the codecs that it uses will be available to all media players, or just to my Mac.

Finally, I’d like to revisit the question of which desktop resolution is best suited to my 1080p HDTV – I’d tried 1920×1080, but wasn’t able to see the Mac menu bar (so e.g. I couldn’t click on the little Apple menu to reboot), so now I’m at something in the 1300-pixel-width range.

"Go/No-Go" Decisions on MyPicasaPictures, Attensa Sync to Google Reader, W2MW++

I’ve done a lot of investigatory work in the last few lunar cycles of different development projects I’d dreamed up.  However, after the investigation and the internal decision making was completed, I didn’t do a good job of “closing the loop” with any of you who have wondered “what happened all those projects?”.

I haven’t thought much about the royal “you” in this work — I’ve been sharing the steps and findings, but recently I started to wonder what people would think in the future if they happened to search on something that led them to one of these projects’ articles.  I’d feel pretty frustrated trying to find out where these things led (if anywhere) and where (if anywhere) there might be code that came out of these efforts.

Well then, it’s time to close the loop on these — at least, as much as I am “decided” on any of these so far.  That said, I’m never committed to any particular decision like this if any new evidence surfaces in the future to challenge my assumptions.  So if anyone is interested in picking up where I left off on any of this, drop me a line to let me know (I’m always interested in this kind of experimental work), and if you’d like to bounce some ideas off me, or see if I’d be interested in participating, I’ll always be open to such inquiries.

MyPicasaPictures: No-Go

Bottom line: while the effort to understand the VMC development environment was instructional and probably honed my ability to figure out what to look for in future explorations, my overall impression of MCML is that it’s just too damned hard for amount of value I might derive from it.

That, plus the chronic and unresolved stability issues I’m seeing with Vista Media Center (exacerbated by the merciless complaints and teasing I receive from my wife, who keeps saying “The XP box was much more stable, wasn’t it?”) have pretty much convinced me to pave the box, downgrade to Windows XP and to give Beyond TV a try.  [Their SDKs and more open, flexible architecture look like the perfect place to invest .NET development efforts, and the customer satisfaction with Beyond TV seems far superior to Windows Media Center, at least based on my initial research.]

Attensa Sync to Google Reader: No-Go

I had already decided to move from Attensa for Outlook to NewsGator Inbox, and then a few weeks ago NewsGator announced that their previously $30 Outlook client would henceforth be available for FREE to any and all concerned.

While there was no conversion possible from Attensa to NewsGator (well, I could import the OPML, but I couldn’t sync the “read/unread” status of all my articles, nor transparently migrate old articles to the new folder structure), everything else about this has been a positive experience.  I’m totally addicted to the NewsGator Mobile Reader for iPhone, and the fact that it syncs with my Outlook “read/unread” status is just awesome.  Congrats, NewsGator!

Attensa, I wish you luck in trying to survive the competitive pressures from NewsGator.  If I didn’t know better, I’d guess this is the beginning of the decline for Attensa, even though I think their Outlook client is superior to the current NewsGator Inbox offering.

W2MW++: Undecided

When I first read about the “export to MediaWiki” capability in OpenOffice Writer 2.3, I quickly concluded that any work I or the rest of the community had done for an Office add-in would become a moot point.  [Amusing but not-entirely-inaccurate Spoonerism: my wife knew a guy who insisted that the term was “a mute point”.]

However, after using Writer 2.3 to convert a few relatively simple Word 2003 documents to MediaWiki format, I realize that they still have a long way to go to preserve real fidelity of layout and formatting in Word documents.  I have faith that they’ll get there, and that eventually Writer’s integrated engine will become the translation engine for .DOC & .DOCX, but I now feel like there’s a significant unmet need that the work I’ve invested so far in W2MW++ could still address, and that that unmet need will exist for quite a while yet.

That said, there’s one thing that’s been bugging me for a few months now: the name.  WordToMediaWikiPlusPlus is a clever extension of the Word2MediaWikiPlus project, and it makes obvious the heritage of W2MW++, but it makes it sound like the project is more “hardcore” than it really is.  If I had my druthers, I’d rename the project “Word2MediaWiki.NET” (W2MW.NET), to make it clearer that the project is based in .NET code, not C++.  I’d hate to think anyone would be disappointed by the fact that it’s written in one of these “shiny new” languages — there’s something more “honest” or “obvious” about using the “.NET” suffix instead.

Now all I have to do is figure out how to Rename all the dozens of “++” references throughout the project AND figure out how to get a CodePlex project renamed.  [THAT should be fun :)]

MyPicasaPictures Part 5: Hacking the XP development environment for Vista Media Center applications

So I’m going through the Windows Media Center Application Step by Step guide (which incidentally, is in the XPS format — Microsoft’s pretender to the PDF throne, and a risky choice for any application to choose ahead of the widespread adoption of the underlying platform).  I’ve gotten as far as to add the References to the MediaCenter assemblies, when I realize (for the first time) that developing a Media Center application might very well mean that I have to have the development environment installed on a Media Center PC.

This seems like an odd dependency to have, considering all the other types of development projects that don’t necessarily require you to run your IDE on the target platform.  So I’m wondering if there’s a way to either (a) just drop the assembly files (i.e. the DLLs) into the expected directory and just reference them & go, or (b) I’ll have to figure out how to register those assemblies on my non-Media Center system.

On pages 5 and 6 of the Step by Step guide the instructions indicate to add references to the Microsoft.MediaCenter.dll and Microsoft.MediaCenter.UI.dll assemblies.  While it assumes you’re working from a Vista Premium/Ultimate machine and have those assemblies in the %SYSTEMROOT%\ehome folder, I found that copying those files from the VMC box and browsing to their copied location on my Windows XP SP2 system seemed to resolve the references just fine.  [I’m not convinced there won’t be other issues later on, but it’s at least worth a try.]

What’s The Sample Code Doing?

The code going into Application.cs looks interesting, but without any Comments to help us understand the purpose of each line, it’s not very instructive.  For me, this is all I’m able to infer:

  • we’re creating an Application class (though I don’t know what VMC developers would think of as an “application” — an add-in?  a piece of UI?  an assembly?  the whole Media Center process and children?)
  • we’re creating three Properties, both a private instance and its public instance (though I don’t really have any specific idea what these properties are meant to do)
  • the Application “object” is overloaded, but I’m not even sure if it’s a Property or something else
  • there are references to this, but I don’t really know what the “this” is referencing — is it the Application class, or is it something else?  [It doesn’t help that I’m not an expert at coding, so I don’t intuitively recognize what each of these things are, but it sure would help to reinforce my tentative steps into this if I had Comments that told me what I was looking at.]

I’m also puzzled by why this code doesn’t follow the Design Guidelines for Managed Class Developers, when nearly all managed code published by Microsoft adheres to these standards.  For example,

public void DialogTest(string strClickedText)

does not need “str” to prefix the ClickedText variable (aka Hungarian notation) — Visual Studio will always indicate the datatype with tooltips.

As another example, the private member variables

            int timeout = 5;
            bool modal = true;
            string caption = Resources.DialogCaption;

are all named using Camel case but without any prefix (such as a leading “_” character).  I understand that the Design Guidelines don’t specifically call out prefixing rules for member (? or private ?) variables, but apparently the guidelines do recommend the use of “this.” to prefix instance variables (which is awful confusing, as you can see above).  Personally I’d prefer to see “_” or “m_” prefixes on private member variables, but I’d at least like to see *some* consistency in the use (or non-use) of prefixes on variables.

While prefixing is a religious fight, the use of Hungarian is not — it’s clearly not recommended.

Compile Errors

I followed the Step by Step through to Build the Solution, at which point I got back one error in the compiler, at Line 55 of my code:

‘MyProject.Resources’ does not contain a definition for ‘DialogCaption’

If I followed the code adequately, the Step by Step has a bug (or at least an ambiguity) in the step Add Resources.resx/Add Strings.  Whereas the Step by Step guide actually wanted me to create one String called “DialogCaption” in the Resources file, I understood it to instruct me to create two Strings — one called “Name” and the other called “Value”:
Snippy0002

It seems pretty obvious now, but at the time my interpretation seemed intuitive.

 

After resolving that more trivial issue, the next Build confronted me with this error:

The command “%windir%\eHome\McmlVerifier.exe -verbose -assemblyredirect:”C:\VS2005 Projects\MyProject\MyProject\bin\Debug” -directory:”C:\VS2005 Projects\MyProject\MyProject\Markup”” exited with code 9009.

This turned out to be harder (and dumber) to diagnose.  There were no specific errors related to McmlVerifier and 9009, and the first real lead from Google referred to path quoting issues.  I finally realized that the McmlVerifier.exe file didn’t even exist on my XP (development) system.  Strangely though, it didn’t exist on the VMC system either – is this one of the SDK tools?  Yes.  However, for some reason the SDK didn’t install it into the %windir%\ehome directory.

Once I copied McmlVerifier.exe to the ehome directory, the Build completed successfully.

Strangely, most of the steps under Enable UI Testing and MCML Verification (steps 7-17) were redundant – they were already completed on my behalf.

Debugging

When I tried Debugging the solution, I got yet another error:
image

System.DllNotFoundException was unhandled

Unable to load DLL “EhUI.dll”: The specified module could not be found.
(Exception from HRESULT: 0x8007007E)

However, this time when I merely copied EhUI.dll to the %windir%\ehome directory, the Debugger threw another exception, slightly more impenetrable:
 image

System.DllNotFoundException was unhandled

Unable to load DLL “EhUI.dll”: The specified procedure could not be found.
(Exception from HRESULT: 0x8007007F)

The stack trace for this was:

at Microsoft.MediaCenter.Interop.RenderApi.SpWrapBufferProc(ProcessBufferProc pfnProcessBufferProc, IntPtr* ppNativeProc)\r\n
at Microsoft.MediaCenter.Interop.RenderApi.InitArgs..ctor(MessageCookieLayout layout, ContextID idContextNew, ProcessBufferProc pfnProcessBufferProc)\r\n
at Microsoft.MediaCenter.UI.MessagingSession..ctor(UiSession parentSession, ContextID idLocalContext, TimeoutHandler handlerTimeout, UInt32 nTimeoutSec)\r\n
at Microsoft.MediaCenter.UI.UiSession..ctor(ContextID idLocalContext, IServiceProvider parentProvider, RenderingInfo renderingInfo, EventHandler rendererConnectedCallback, TimeoutHandler handlerTimeout, UInt32 nTimeoutSec)\r\n
at Microsoft.MediaCenter.UI.UiSession..ctor(RenderingInfo renderingInfo)\r\n
at Microsoft.MediaCenter.Tools.StandAlone.Startup(String[] args)\r\n
at Microsoft.MediaCenter.Tools.StandAlone.Startup()\r\n
at Microsoft.MediaCenter.Tools.McmlPad.Main(String[] args)

Given that I’ve got the Vista version of EHUI.DLL in the right place, I assumed I’d have to “register” it (I forget the equivalent in the .NET Framework world) so that its procedures could be “found”.  However, before going down a “.NET theory” path I decided to google the error message.  The first five or so forum posts that came back pointed finally clued me in that in fact this may represent a second-order dependency in another missing DLL.  With that, I decided to just copy in the entire contents of my VMC’s %WINDIR%\eHome directory and retry debugging.

Debugging exponentially: Process Monitor, Dependency Walker

That wasn’t any more successful, so next I fired up Process Monitor and watched for any “NOT FOUND” errors that followed the EHUI.DLL load event (hoping that this was merely a case of a missing filesystem reference, and not something more sinister).  That helped me discover the following errors (presumably, as is often the case in these situations, mostly a list of false negatives):

  • McmlPad.exe called RegCreateKey() for HKLM\Software\Microsoft\Fusion\GACChangeNotification\Default
  • McmlPad.exe failed to find OLE32.DLL under C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727, and oddly didn’t try searching the environment’s PATH locations
  • devenv.exe searched multiple times for C:\temp\symbols.flat.txt and McmlPad.pdb (symbols) under C:\temp\symbols\McmlPad.pdb\6B1042D64F29479FA1C07939AE072D941\, C:\Windows\symbols\exe, C:\Windows\exe, C:\Windows
  • McmlPad.exe failed to find C:\WINDOWS\assembly\GAC\PublisherPolicy.tme (and didn’t look anywhere else)
  • McmlPad.exe tried looking for a couple of files in the GAC search paths before it went looking directly for the file in C:\Windows\ehome:
    • Microsoft.MediaCenter\6.0.6000.0__31bf3856ad364e35
    • Microsoft.MediaCenter.UI\6.0.6000.0__31bf3856ad364e35
  • Once McmlPad.exe successfully loaded EHUI.DLL from C:\Windows\ehome, it (successfully) opened these files:
    • C:\WINDOWS\assembly\GAC_32\mscorlib\2.0.0.0__b77a5c561934e089\sorttbls.nlp
    • C:\WINDOWS\assembly\GAC_32\mscorlib\2.0.0.0__b77a5c561934e089\sortkey.nlp
  • Then devenv.exe successfully loaded C:\Program Files\Microsoft Visual Studio 8\Common7\Packages\Debugger\cscompee.dll
  • Then McmlPad.exe loaded C:\WINDOWS\assembly\NativeImages_v2.0.50727_32\System.Configuration\eee9b48577689e92db5a7b5c5de98d9b\System.Configuration.ni.dll

Hmmm, I’m not sure I learned much from that.  It looks like the application being debugged (McmlPad.exe) was looking for some GAC registration info and a few obscure files.  However, it’s likely that this is expected behaviour even on a working system.

So I went back to my google search results which convinced me to try DEPENDS.EXE to see what it would say.  I expected nothing, frankly, but that gave me two new leads I wouldn’t have otherwise found: it indicates that EHUI.DLL is looking for DWMAPI.DLL and DXGI.DLL, neither of which were present anywhere on my system.

Fascinating – one of the first Forum posts I found referencing DWMAPI.DLL indicates this file may not be needed when “linked” by a multi-OS-targeting application.  However, I suspect that for VMC libraries like EHUI.DLL, these two missing DLLs are not “load on demand” libraries – they’re just libraries that don’t appear on non-Vista platforms.

Once I grabbed copies of these two files from my Vista machine and dropped them into the %windir%\ehome folder, DEPENDS.EXE warned me that D3D10.DLL and NUCLEUS.DLL were required for DXGI.DLL, and that EHTRACE.DLL (a demand-load library) was missing.  Okey-dokey… and then I’m “warned” that even with all these files in place…:

Error: At least one module has an unresolved import due to a missing export function in an implicitly dependent module.
Warning: At least one module has an unresolved import due to a missing export function in a delay-load dependent module.

Feeling lucky despite all evidence to the contrary, I re-ran MyProject from Visual Studio, but no love was had – still and all, “the specified procedure could not be found”.  OK, let’s continue…

The unresolved imports were flagged in the following libraries on my XP development PC:

Library

Unresolved Import(s)

MSVCRT.DLL _except_handler4_common
_ftol2
_ftol2_sse
D3D9.DLL Direct3DCreate9Ex
USER32.DLL IsThreadDesktopComposited
ADVAPI32.DLL RegGetValueW
MPR.DLL WNetRestoreConnectionA

So, the obvious question is: if I copy *these* libraries from my VMC computer to C:\windows\ehome on my development XP computer, will that suffice to allow McmlPad.exe + Visual Studio 2005 to successfully debug my VMC app?

And the answer is: not quite yet.  Unfortunately, when loading EHUI.DLL, Windows will still end up loading the standard libraries (such as MSVCRT.DLL) from the PATH (i.e. %windir%\system32).  I realize that Windows is just trying to behave nicely, not being “tricked” into loading rogue versions of already-installed libraries, so I am not too upset by this.  However, this has turned into a much more difficult problem than I first anticipated.

Files copied to my development system so far:

  • %windir%\ehome\Microsoft.MediaCenter.dll (from VMC system)
  • %windir%\ehome\Microsoft.MediaCenter.UI.dll (from VMC system)
  • %windir%\ehome\ehui.dll (from VMC system)
  • %programfiles%\Microsoft SDKs\Windows Media Center\v5.0\Tools\McmlVerifier.exe (to %windir%\ehome)
  • %programfiles%\Microsoft SDKs\Windows Media Center\v5.0\Tools\McmlPad.exe (to %windir%\ehome)
  • %windir%\system32\dwmapi.dll (from VMC system)
  • %windir%\system32\dxgi.dll (from VMC system)
  • %windir%\system32\d3d10.dll (from VMC system)
  • nucleus.dll (from I don’t remember where)
  • %windir%\system32\msvcrt.dll (from VMC system)
  • %windir%\system32\d3d9.dll (from VMC system)
  • %windir%\system32\user32.dll (from VMC system)
  • %windir%\system32\advapi32.dll (from VMC system)
  • %windir%\system32\mpr.dll (from VMC system)

  Tidbits

  • 😦 “I will say that if you are a hobbyist then MCML is not likely to be very friendly to you.”
  • 😦 “It took me a long while to create a gallery that displays a list of images from an ArrayListDataSet.”
  • 🙂 “I have persevered in the days since my last post and have managed to get a repeater/scroller working to emulate the behaviour of the ‘my music’ section of media center.”
  • 🙂http://mobilewares.spaces.live.com/ has a good tutorial on making the sliding menu at the top of the screen.”
  • 😦 “Following the rumour about Microsoft encouraging their internal teams to deprecate the use of an underscore prefix for private fields, I have decided to do the same.”  [I just got my head wrapped around the use of underscores for private fields, and now I need to unlearn that behaviour just as quickly.  At least I haven’t done too much damage with it.]
  • 🙂 “If you can’t easily work out where the variable is defined (local scope, local parameter, member variable) then your code is too complex and needs refactoring.  It’s that simple.”  [I can handle that idea, yeah.]