[vlc-devel] [PATCH] Add MacOSX OpenGL callbacks to enable Syphon broadcast

Adam Fedor afedor at t1v.com
Tue May 15 16:06:56 CEST 2018



> On May 15, 2018, at 5:21 AM, Felix Paul Kühne <fkuehne at videolan.org> wrote:
> 
> Hi Adam,
> 
> Thanks for the patch.
> 
>> On 14. May 2018, at 19:21, adampcc at runbox.com wrote:
>> 
>> From: Adam Fedor <afedor at t1v.com>
>> 
>> This is a fairly simple patch that adds callbacks to the MacOSX OpenGL 
>> rendering so that VLC output can be broadcast using Syphon (I imagine 
>> there are other uses for the callbacks, but that is not my purpose). I
>> know other people are interested in this as well (See 
>> https://github.com/rsodre/VLCSyphon and 
>> http://v002.info/forums/topic/vlckit-to-syphon/)
>> 
>> I am not quite sure I'm using the right method to get the size of the
>> display output, so any help with that is appreciated.
> 
> Supporting Syphon would be an interesting addition, however I’m not sure if the proposed patch is the straight way to go. Calling both additional functions every time a frame is drawn seems very expensive to me as this can be up to 120 times/s, but chances are very low that the vout size actually changed.
> 
> In fact, VLC’s video output size depends on the container view size. It’s exactly the same, so I’m a bit puzzled why you need that info since you define the dimensions of the container view yourself. Further, is it intrinsic to the Syphon protocol to be notified every single time the OpenGL context is being updated? That seems weird to me.
> 
> 

The Syphon protocol is designed to “publish” every time something changes. Just calling the callback functions themselves shouldn’t be that expensive, and it should be up to the Syphon server itself to decide it it wanted to skip frames in order to save load. I’ve looked at other methods of using VLC with Syphon but they involve access to the textures that vlc uses, which are even more deeply buried in the code (and also don’t necessarily include everything that vlc draws, like captions).  It would be hard to justify patching vlc to get direct access to this stuff.

Sure, the size does not need to be updated every time, but it fits in with the method that I use with Syphon to publish a frame, which is to bind an FBO object so it can capture the drawing. In fact implementing a Syphon server with this patch is pretty trivial now:

- (void) willDrawVoutSize:(NSSize)size
{
  didBind = [syServer bindToDrawFrameOfSize:size];
}

- (void) didDrawVout
{
  if (didBind)
    [syServer unbindAndPublish];
}




More information about the vlc-devel mailing list