[mythtv] OSX backend obstacles?

David Abrahams dave at boost-consulting.com
Mon Dec 19 06:53:28 EST 2005

Daniel Kristjansson <danielk at cuymedia.net> writes:

> On Sun, 2005-12-18 at 14:06 -0500, David Abrahams wrote:
>> Easier said than done, it turns out.  Well, I'm not an OSX programmer
>> really, but the ways to access firewire video on OSX are myriad, and
>> not well documented.  Even an experienced OSX programmer wouldn't have
>> an easy time of it unless he were intimately familiar with this part
>> of the API.
> :/
>> I can capture it to a QuickTime file easily enough, but
>> the innards of MythTv seem to want mpeg-2 frames (?) and it's not
>> obvious how to deliver those using MacOS.  It's not even easy to
>> understand what the mythtv code is doing, since libiec61883 isn't
>> documented in any place that I could find.
> It looks like you are looking at too high a level API. 

I could be wrong of course, but now I don't think so.  I found out how
to get raw frames through QuickTime.  Basically you tell it to record
using a component called a SequenceGrabber but not use a file, and not
use a preview window, and you give it a DataProc which is essentially
a callback.  The only issue is that there's an idle routine that has
to be called at least once per frame you want to receive, but Apple
recommends setting up a timer to handle that.  I thought I'd use the
one from Qt.

> DTVRecorder
> wants the raw MPEG-TS stream, without any repackaging in a quicktime
> or other format.
> There are probably 3 levels of API for OS X that are pertinent:
>   IEEE-1394 : send & get data, allocate bandwidth, etc.

It does have a low-level firewire API.

>   IEC-61883 : send & get A/V commands, change channels, initiate
>               streaming, get callbacks on MPEG2 data arriving.

It doesn't have that... ok... after having followed your link below, I
eventually discovered that the FireWireMPEG.framework has been
superseded by the AVCVideoServices.framework, which of course is
undocumented, which is why Google turned up nothing for me.  It seems
to be a common theme at this level of API :).
AVCVideoServices.framework does come with source code, and some
examples, though, so I should be able to make something of it.

Thanks; that will probably be very helpful.  It looks like this may
integrate more smoothly with MythTv as well.

Hmm, it has A/V command support, for sure.  It also has support for
some specific commands, such as PowerOn and PowerOff... I expected to
see channel changing in there, but no dice.  Is there some standard I
can look at to find out the byte sequence for performing channel
changes?  Hah!  There it is, in a different class.  Okay, this is
going to be fantastic... and none of that fancy command stuff would 
be available if I went through QuickTime.  And no pesky idle loop :)

Now I just need to adjust to reading objective-C (that's how all the
examples are coded).

>   AV Capture: same commands as IEC-61883, except instead of
>               getting callbacks on data you tell it where the
>               data should go and it uses it's own callbacks
>               to do mythtv's job of finding keyframes, cleaning
>               up the stream, and sticking it in a container.

I can do that in QuickTime, but also an example for doing
this with the AVCVideoServices.framework.  So I don't think I'll be
needing QuickTime at all.

> There are probably other libraries specific to hard-drives,
> scanners, etc. And maybe even a library specific to DV devices
> such as camcorders. The AV Capture library probably encapsulates
> such a library in addition to other IEC-61883 devices. It is also
> possible that no generic IEC-61883 library exists, and that you
> must port the libiec61883 over to sit on top of the OSX raw
> IEEE-1394 library, in which case this becomes a larger project.

Yeah, it would.  But I actually think I have everything I need now.

> You might also want to look for the HAVi acronym, this is DV + PnP
> and usually sits directly on top of the systems IEC-61883 library;
> see what dependencies the HAVi or DV library has and you might just
> find out what OSX calls their IEC-61883 library.

I don't think you can expect to see Apple using the same terminology
in their interfaces, sadly

> Hmm, just turned this up in a google:
>   http://www.dvinfo.net/conf/archive/index.php/t-10828.html
> Perhaps this "FireWireMPEG.framework" is what you are looking for?
> "supports IEC 61883-4 transmission and reception of MPEG2-TS packets..."

This is killa.  Now I have 2.5 days to pack for my winter break and
get this done :)

Thanks again,

Dave Abrahams
Boost Consulting

More information about the mythtv-dev mailing list