The first task I’ve taken up for the next release of XBMC is to clean up our build system. As it stands now, XBMC is a hassle to build on any Linux distrobution except Ubuntu. This is mostly the fault of our configure and Makefiles not conforming to expected standards. I’d also like to get our Mac release to build using configure/make as well. Since I’m not autoconf expert, I started doing some research. The first thing I stumbled upon was the Gnits Standards. Wow, they’ve thought of everything! It’s time to jump down the rabbit hole and see where this takes me. If you’re interested in learning more about the GNU build system, you may want to take a look as well: http://en.wikipedia.org/wiki/Gnits_Standards.
I was recently looking into the fade effect on OS X which happens when you switch from windowed mode to full screen and vice versa. I thought it’d be better if it only faded the effected display, so I started looking into a great example from Apple. There was an issue though. After retrieving the current gamma value, and subsequently setting the value (to the value just retrieved!) the display would get brighter. Odd, that should only happen if I turn the gamma down. Well, as it turns out, the CGGetDisplayTransferByFormula function doesn’t actually calculate the current gamma correctly. If you toss the values retrieved from CGGetDisplayTransferByTable into excel and have it calculate the value for you, you’ll see that it doesn’t match up. The solution was to just throw out the value and calculate it in code. Thanks Apple, you just wasted my week.
For those interested (pay attention Apple!), the following code will do the trick. Note that M_LN2 is the natural log of 2, defined in math.h.
&redMin, &redMax, &redGamma,
&greenMin, &greenMax, &greenGamma,
&blueMin, &blueMax, &blueGamma);
CGGetDisplayTransferByTable(display, 3, redTable, greenTable, blueTable, &sampleCount);
redGamma = (CGGammaValue)(log(redTable / redTable) / M_LN2);
greenGamma = (CGGammaValue)(log(greenTable / greenTable) / M_LN2);
blueGamma = (CGGammaValue)(log(blueTable / blueTable) / M_LN2);
If you enjoy the command prompt in Linux/OS X as much as I do, then I hope you’ve been aquainted with screen. If not, think of it like tabs in your browser. Except now you can go to a different computer and pull up your browser with all those same tabs already opened. The one thing that sucks about screen is that you can’t scroll up to see the history. This makes it difficult if a bunch of shit is being dumped to the terminal and you need to look through it. Well, it turns out that it does exist, and it’s way more awesome then I ever could have imagined. It’s got a search feature! Interested? Read up on it here.
I recently switched to developing on Mac OS X from Linux, both at work and XBMC. I must say that the move went a lot smoother than expected in many respects because I can open up Terminal and pretend I’m on Linux. However, the most frustrating thing about that is how Apple decided to map the home and end keys. Luckily, there’s an easy fix.