Plex Media Center for OS X Leopard

Much progress on video

Changes in this version:

  • Videos play at the right speed, and don’t lock up. Even seeking works.
  • Audio now works during video playback, including DTS and AC3 passthrough!!
  • SDL’s OpenGL vertical sync support is enabled, to avoid tearing.
  • If we can’t open the selected audio device, try opening the default device. Might prevent some crashes.
  • Integrated fix for Mac Mini OpenGL issue, it *should* run there too (but I haven’t tested it).

The hardest piece of work for this release was tracking down a nefarious deadlock in CSharedSection. Deadlocks are a pain in the ass to track down, and the method I’ve always used is quite simple: printf. I run the program inside gdb, wait for it to deadlock, and then backtrack with the printf output to see what went wrong (looking at thread stack traces to see where the threads blocked). Tracking down this particular problem took me about four hours, which is about par for the course. I would have bet money that it was a bug in my code, since I’ve rewritten the critical section and event code (both of which CSharedSection relies upon heavily), but it turned out to be a bug in the class itself.

deadlock.jpg

Once I fixed the problem the movie 187 (my test video, for whatever reason), played through until the end, at turbo speed. I watched it for a few minutes, left the house, and when I returned I had a glorious kernel panic staring at me (although I could see that the movie had ended, at least). I haven’t seen any panics since, perhaps something to do with the fact that playing it so fast taxed the system much harder than usual. Plus it turns out the debug line on the screen (showing memory, CPU, etc.) isn’t thread safe with the video rendering code so that could have had something to do with it too (although it should never kernel panic, of course).

Once I got the audio working (through Portaudio), the video played at normal speed. This was so exhilarating that I started watching Along Came Polly and my wife came and sat with me and we watched the whole thing. (I have to admit, I was half expecting it to crash halfway through, but it didn’t.)

It was about this time when I realized that the mix-down code was ALSA dependent, so my only hope for multi-channel audio was through my surround receiver. I crossed my fingers, redirected the audio to Digital Output, and selected a video with AC3. It worked!!! DTS worked as well, which was incredibly exciting, because I’ve never found another application on OS X which could do DTS passthrough. No speaker-abusing audio glitches, either, like those that happen with some of the applications that try to feign passthrough with QuickTime. The way I’ve coded it is that if encoded digital audio is to be played, it looks for an output with “Digital” in it (thanks to the people who contributed data on this!). Otherwise it plays to the selected output in Audio Hardware. This isn’t perfect, but it’s probably a decent first take.

After fixing a few more bugs (seeking, OpenGL threading weirdness), and just for giggles, we decided to try to watch our nightly Six Feet Under on our Sony TV, which is connected to the second DVI port on my Mac. I changed the XBMC resolution to 1080i (and had to change it in the video settings as well), and moved the window over to the second display (with Anna yelling from around the corner “right…up…a bit more….stop!”) and we watched S03E03. Worked perfectly. One interesting note: Since it wasn’t officially full-screen, the first display wasn’t black, so it would have been possible to check email or do something else while the other person was using XBMC. This is an advantage over Front Row, which takes over your entire display.

IMG_1400.jpg

Next up:

  • Use an optimized, assembly-enabled (and non-buggy) ffmpeg.
  • Get full-screen display working.
  • Lots of other bugs…

At that point, it should be possible to actually to use XBMC on a TV with a halfway decent experience, and certainly better than that which Front Row offers.

I uploaded the new binary (why bother uploading an entire new package, right?) here. Enjoy!

25 Comments so far

  1. leigh January 21st, 2008 10:37 pm

    Awesome…..i can’t thank you enough for the work you are putting into this…

    Hopefully if apple releases a decent upgrade to the mac mini soon i will be able to replace my xbox….

  2. bob January 21st, 2008 11:16 pm

    Fantastic work so far!!!

  3. zAo January 22nd, 2008 1:10 am

    Dude, you’re doing some fantastic work here!

    Thanks a lot!

  4. Emil January 22nd, 2008 3:31 am

    Keep up the great wotk you are doing!!

  5. UKP January 22nd, 2008 5:03 am

    For me, the sound is still missing and video is still at fast speed. But great work so far :)

    Can I ask when you will check the changes into svn?

  6. Matt January 22nd, 2008 5:26 am

    UKP - what mac are you running?

    Elan, thanks for all the hard work! BTW, are you getting any donations?

  7. UKP January 22nd, 2008 5:33 am

    Matt, I am using a santa rosa macbook pro.

  8. Ezrem January 22nd, 2008 5:55 am

    I tried this on my 1.66GHz Core Duo Mac Mini…

    Everything installed fine, XBMC runs. I can play music, look at pictures, change skins, navigate all file lists including videos, etc.

    As soon as I try to play a video, XBMC closes and at the console I get:

    Bus error

    Nothing more descriptive than that that I can find.

    I would be more than happy to do any mac mini testing that you would like to help get this working!

  9. Manas January 22nd, 2008 6:13 am

    XBMC on OSX Project…

    I hardly run across a software project that really excites me. But when it happens, its euphoric. For the longest time I have been a proponent of the Xbox Media Center (XBMC). Whether its AppleTV or Xbox 360 or Playstation 3 (forget the Wii for media)…

  10. Abhimanyu Chirimar January 22nd, 2008 6:14 am

    Wow,
    this is just phenomenal work. Cannot wait for a stable release.
    My favorite media player on my favorite OS!

  11. Martin January 22nd, 2008 6:38 am

    Sorry for my newb question, but how do I install and use the new binary release?

    I already have the first release installed and working I just want to upgrade to the new version.

    Thanks :)
    Martin

  12. Ezrem January 22nd, 2008 7:08 am

    @Martin -

    If you already have the old release working, all you need to do is extract the new binary and drop it into your XBMC folder.

    XBMC will then run with the new code.

  13. Jasper January 22nd, 2008 7:13 am

    Nice work,
    some graphics some won;t display when i play video’s and i don’t get an video playing. I hear the sound playing ! :-) but no image.. (white screen on black background, what’s cropped is black)
    When i set pause these grapics won’t work.
    i;m on a MBP 2.33 Mhz with an ATI X1600
    Maybe it’s on my side somewhere , can anyone reporting it working ok (video) on a MBP 2.xx ?

  14. Jasper January 22nd, 2008 7:35 am

    Whuups. .
    i’ve got the problem
    For some reasson i changed some settings in the beginning in profiles.xml regarding display and video res.
    I’ve deleted the profiles.xml and set both resolutions to the same and voila :-)
    works like clockwork.

    it crashes when i try it with subs tho .. but anyhow .. it feals great to have it working !!!

  15. yaneku January 22nd, 2008 7:39 am

    Great! Now I can play even my 720p x264 videos! I haven’t tried the dts or ac3 passthrough yet.

    A minor problem is that an assert fires when it tries to load a .srt file containing swedish characters.

    I will now move my iMac to my reciever to try out digital output. Does anyone know how I can go up to previous directory when browsing files (using my keyboard)? I have to restart xbmc if I want to go to another directory :/

    Elan, really really excellent work!!

  16. elan January 22nd, 2008 7:54 am

    @yaneku: I use the backspace key to move up a directory. You can have a look at UserData/KeyMap.xml to discover the full set of keys, as well as modify bindings.

  17. Qwan January 22nd, 2008 8:27 am

    Does the apple remote work yet?

  18. yaneku January 22nd, 2008 8:30 am

    Ok. Now I’ve tried the digital output using a minijack-toslink cable. All I get is noise i my speakers. My reciever doesn’t realize that it should decode the dts signal and tries to play it as a regular signal (probably?). The same movies with dts/ac3 works in VLC when enabling S/PDIF. Regular movies/music in xbmc works fine.

    When I try to play a dts or ac3 movie I get this debug text:

    Asked to open device: [iec958]
    Asked to create device: [iec958]
    Device should be digital: [1]

  19. bouriko January 22nd, 2008 8:40 am

    Elan for president !!!!!! ^

  20. elan January 22nd, 2008 9:22 am

    @yaneku: Make sure you go to Audio Hardware settings and set the Audio Output to Digital and enable AC3/DTS Capable Receiver. The log looks right. That’s all I can say for now, sadly. It works flawlessly on my Marantz SR-7000.

    @Qwan: Apple remote will act like cursor keys, so it will do something, but XBMC really needs a more fully keyed remote. You can tweak KeyMap.xml to help out. I’m thinking of using a bluetooth Apple keyboard, and perhaps getting a wireless Xbox360 controller working.

    @Matt: One individual was kind enough to donate some great beer to the cause.

    @Jasper: Subs are known broken.

    @everyone: Thanks so much for your kind words!

    If you’re getting a crash (playing videos, for example), a stack trace helps me greatly. Do the following to obtain one:

    $ gdb XBMC
    > run
    …. crash …
    > where
    … send me this output …

  21. yaneku January 22nd, 2008 9:57 am

    I have Audio Output to Digital and enabled AC3/DTS Capable Receiver. Maybe it’s my old Sony reciever thats crap but strange that it works using VLC. Let me know if you come up with something I can test.

  22. yaneku January 22nd, 2008 10:18 am

    btw. elan, what cable are you using for digital output? have you enabled something in osx?

  23. Ezrem January 22nd, 2008 10:41 am

    @elan -

    I submitted the stack trace to your bug tracker. Hopefully this is where you want it, as I couldn’t find an email address anywhere.

    Thanks so much to your whole team for this! I have been hoping to get rid of my XBOX for ages!

  24. andy January 22nd, 2008 11:01 am

    Now that video is working, are there any CPU usage benchmarks available? Is there any decoding work being offloaded to the GPU?
    Looking sweet.

  25. elan January 22nd, 2008 11:11 am

    @andy: It uses ffmpeg for decoding, albeit an unoptimized version for now, so the CPU usage should be similar to other players that also use ffmpeg. However, as a real world example, I’ve found skipping through MKV files to be quite a bit faster than with other players I’ve tried. The XBMC core code is well written!

Leave a reply

Support Plex

Mmmmm...Beer!

Contact Me

elan at plexapp dot com
  • Meta

  • Recent Comments

    • Mickey"oops I am late :( Happy Thanksgiving Elan and everyone celebrating it! I make a toast to all the things done..."
    • sham"I installed plex 7.1 for the first time yesterday, being a long time htpc guy (done dev for freevo, mce xp, mce..."
    • Anton"Hi, Thanks for the app. I’ve switched from Sapphire, some things I love some thing I hate. Overall great..."
    • Jakob Metzger"ok, yea. I kinda figured that out. I noticed that it is exactly the same OSD as the regular iTunes..."
  • What I'm Doing...

  • Archives