2012-05-29 08:52:43 -07:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2012-01-31 06:40:58 -08:00
|
|
|
|
|
|
|
#include <android/log.h>
|
2012-07-20 12:20:51 -07:00
|
|
|
#include "AndroidBridge.h"
|
2012-01-31 06:40:58 -08:00
|
|
|
#include "ANPBase.h"
|
|
|
|
#include "nsIPluginInstanceOwner.h"
|
|
|
|
#include "nsPluginInstanceOwner.h"
|
|
|
|
#include "nsNPAPIPluginInstance.h"
|
|
|
|
#include "gfxRect.h"
|
|
|
|
|
|
|
|
#define LOG(args...) __android_log_print(ANDROID_LOG_INFO, "GeckoPlugins" , ## args)
|
|
|
|
#define ASSIGN(obj, name) (obj)->name = anp_video_##name
|
|
|
|
|
|
|
|
using namespace mozilla;
|
|
|
|
|
2012-07-20 12:20:51 -07:00
|
|
|
typedef nsNPAPIPluginInstance::VideoInfo VideoInfo;
|
2012-01-31 06:40:58 -08:00
|
|
|
|
|
|
|
static ANPNativeWindow anp_video_acquireNativeWindow(NPP instance) {
|
2012-07-20 12:20:51 -07:00
|
|
|
nsNPAPIPluginInstance* pinst = static_cast<nsNPAPIPluginInstance*>(instance->ndata);
|
2012-01-31 06:40:58 -08:00
|
|
|
|
2012-07-20 12:20:51 -07:00
|
|
|
return pinst->AcquireVideoWindow();
|
2012-01-31 06:40:58 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void anp_video_setWindowDimensions(NPP instance, const ANPNativeWindow window,
|
2012-07-20 12:20:51 -07:00
|
|
|
const ANPRectF* dimensions) {
|
|
|
|
nsNPAPIPluginInstance* pinst = static_cast<nsNPAPIPluginInstance*>(instance->ndata);
|
2012-01-31 06:40:58 -08:00
|
|
|
|
|
|
|
gfxRect rect(dimensions->left, dimensions->top,
|
|
|
|
dimensions->right - dimensions->left,
|
|
|
|
dimensions->bottom - dimensions->top);
|
|
|
|
|
2012-07-20 12:20:51 -07:00
|
|
|
pinst->SetVideoDimensions(window, rect);
|
|
|
|
pinst->RedrawPlugin();
|
2012-01-31 06:40:58 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void anp_video_releaseNativeWindow(NPP instance, ANPNativeWindow window) {
|
2012-07-20 12:20:51 -07:00
|
|
|
nsNPAPIPluginInstance* pinst = static_cast<nsNPAPIPluginInstance*>(instance->ndata);
|
|
|
|
pinst->ReleaseVideoWindow(window);
|
|
|
|
pinst->RedrawPlugin();
|
2012-01-31 06:40:58 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void anp_video_setFramerateCallback(NPP instance, const ANPNativeWindow window, ANPVideoFrameCallbackProc callback) {
|
|
|
|
// Bug 722682
|
|
|
|
NOT_IMPLEMENTED();
|
|
|
|
}
|
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
void InitVideoInterfaceV0(ANPVideoInterfaceV0* i) {
|
|
|
|
ASSIGN(i, acquireNativeWindow);
|
|
|
|
ASSIGN(i, setWindowDimensions);
|
|
|
|
ASSIGN(i, releaseNativeWindow);
|
|
|
|
}
|
|
|
|
|
|
|
|
void InitVideoInterfaceV1(ANPVideoInterfaceV1* i) {
|
|
|
|
ASSIGN(i, acquireNativeWindow);
|
|
|
|
ASSIGN(i, setWindowDimensions);
|
|
|
|
ASSIGN(i, releaseNativeWindow);
|
|
|
|
ASSIGN(i, setFramerateCallback);
|
|
|
|
}
|