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.
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).
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.
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
Leave a reply

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….
Fantastic work so far!!!
Dude, you’re doing some fantastic work here!
Thanks a lot!
Keep up the great wotk you are doing!!
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?
UKP - what mac are you running?
Elan, thanks for all the hard work! BTW, are you getting any donations?
Matt, I am using a santa rosa macbook pro.
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!
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)…
Wow,
this is just phenomenal work. Cannot wait for a stable release.
My favorite media player on my favorite OS!
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
@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.
Nice work,
but no image.. (white screen on black background, what’s cropped is black)
some graphics some won;t display when i play video’s and i don’t get an video playing. I hear the sound playing !
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 ?
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 !!!
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!!
@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.
Does the apple remote work yet?
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]
Elan for president !!!!!! ^
@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 …
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.
btw. elan, what cable are you using for digital output? have you enabled something in osx?
@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!
Now that video is working, are there any CPU usage benchmarks available? Is there any decoding work being offloaded to the GPU?
Looking sweet.
@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!