Commit b39c0884 authored by Felix Paul Kühne's avatar Felix Paul Kühne

Mac windowless: fix video output under Safari 5, which doesn't support NPN_PluginThreadAsyncCall

parent 007c8626
/*****************************************************************************
* vlcplugin_mac.h: a VLC plugin for Mozilla (Mac interface)
*****************************************************************************
* Copyright (C) 2011-2013 VLC authors and VideoLAN
* Copyright (C) 2011-2014 VLC authors and VideoLAN
* $Id$
*
* Authors: Felix Paul Kühne <fkuehne # videolan # org>
......
/*****************************************************************************
* vlcplugin_mac.cpp: a VLC plugin for Mozilla (Mac interface)
*****************************************************************************
* Copyright (C) 2011-2013 VLC Authors and VideoLAN
* Copyright (C) 2011-2014 VLC Authors and VideoLAN
* $Id$
*
* Authors: Felix Paul Kühne <fkuehne # videolan # org>
......
/*****************************************************************************
* vlcwindowless_mac.cpp: VLC NPAPI windowless plugin for Mac
*****************************************************************************
* Copyright (C) 2012-2013 VLC Authors and VideoLAN
* Copyright (C) 2012-2014 VLC Authors and VideoLAN
* $Id$
*
* Authors: Felix Paul Kühne <fkuehne # videolan # org>
......@@ -30,6 +30,12 @@ VlcWindowlessMac::VlcWindowlessMac(NPP instance, NPuint16_t mode) :
VlcWindowlessBase(instance, mode)
{
colorspace = CGColorSpaceCreateDeviceRGB();
const char *userAgent = NPN_UserAgent(this->getBrowser());
if (strstr(userAgent, "Safari") && strstr(userAgent, "Version/5")) {
legacy_drawing_mode = true;
fprintf(stderr, "Safari 5 detected, using legacy drawing mode\n");
}
}
VlcWindowlessMac::~VlcWindowlessMac()
......@@ -249,3 +255,26 @@ bool VlcWindowlessMac::handle_event(void *event)
return VlcPluginBase::handle_event(event);
}
void VlcWindowlessMac::video_display_cb(void * /*picture*/)
{
if (p_browser) {
if (!legacy_drawing_mode)
NPN_PluginThreadAsyncCall(p_browser,
VlcWindowlessBase::invalidate_window_proxy,
this);
else
invalidate_window();
}
}
void VlcWindowlessMac::set_player_window() {
libvlc_video_set_format_callbacks(getMD(),
video_format_proxy,
video_cleanup_proxy);
libvlc_video_set_callbacks(getMD(),
video_lock_proxy,
video_unlock_proxy,
video_display_proxy,
this);
}
/*****************************************************************************
* vlcwindowsless_mac.h: VLC NPAPI windowless plugin for Mac
*****************************************************************************
* Copyright (C) 2012-2013 VLC Authors and VideoLAN
* Copyright (C) 2012-2014 VLC Authors and VideoLAN
* $Id$
*
* Authors: Felix Paul Kühne <fkuehne # videolan # org>
......@@ -34,6 +34,11 @@ public:
bool handle_event(void *event);
NPError get_root_layer(void *value);
void video_display_cb(void *picture);
void set_player_window();
static void video_display_proxy(void *opaque, void *picture)
{ reinterpret_cast<VlcWindowlessMac*>(opaque)->video_display_cb(picture); }
protected:
void drawNoPlayback(CGContextRef cgContext);
......@@ -43,6 +48,7 @@ private:
CGImageRef lastFrame;
int cached_width;
int cached_height;
bool legacy_drawing_mode;
};
#endif /* __VLCWINDOWLESS_MAC_H__ */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment