dom/plugins/base/android/ANPVideo.cpp

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/dom/plugins/base/android/ANPVideo.cpp	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,62 @@
     1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.6 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.7 +
     1.8 +#include <android/log.h>
     1.9 +#include "AndroidBridge.h"
    1.10 +#include "ANPBase.h"
    1.11 +#include "nsIPluginInstanceOwner.h"
    1.12 +#include "nsPluginInstanceOwner.h"
    1.13 +#include "nsNPAPIPluginInstance.h"
    1.14 +#include "gfxRect.h"
    1.15 +
    1.16 +#define LOG(args...)  __android_log_print(ANDROID_LOG_INFO, "GeckoPlugins" , ## args)
    1.17 +#define ASSIGN(obj, name)   (obj)->name = anp_video_##name
    1.18 +
    1.19 +using namespace mozilla;
    1.20 +
    1.21 +typedef nsNPAPIPluginInstance::VideoInfo VideoInfo;
    1.22 +
    1.23 +static ANPNativeWindow anp_video_acquireNativeWindow(NPP instance) {
    1.24 +  nsNPAPIPluginInstance* pinst = static_cast<nsNPAPIPluginInstance*>(instance->ndata);
    1.25 +
    1.26 +  return pinst->AcquireVideoWindow();
    1.27 +}
    1.28 +
    1.29 +static void anp_video_setWindowDimensions(NPP instance, const ANPNativeWindow window,
    1.30 +                                          const ANPRectF* dimensions) {
    1.31 +  nsNPAPIPluginInstance* pinst = static_cast<nsNPAPIPluginInstance*>(instance->ndata);
    1.32 +
    1.33 +  gfxRect rect(dimensions->left, dimensions->top,
    1.34 +               dimensions->right - dimensions->left,
    1.35 +               dimensions->bottom - dimensions->top);
    1.36 +
    1.37 +  pinst->SetVideoDimensions(window, rect);
    1.38 +  pinst->RedrawPlugin();
    1.39 +}
    1.40 +
    1.41 +static void anp_video_releaseNativeWindow(NPP instance, ANPNativeWindow window) {
    1.42 +  nsNPAPIPluginInstance* pinst = static_cast<nsNPAPIPluginInstance*>(instance->ndata);
    1.43 +  pinst->ReleaseVideoWindow(window);
    1.44 +  pinst->RedrawPlugin();
    1.45 +}
    1.46 +
    1.47 +static void anp_video_setFramerateCallback(NPP instance, const ANPNativeWindow window, ANPVideoFrameCallbackProc callback) {
    1.48 +  // Bug 722682
    1.49 +  NOT_IMPLEMENTED();
    1.50 +}
    1.51 +
    1.52 +///////////////////////////////////////////////////////////////////////////////
    1.53 +
    1.54 +void InitVideoInterfaceV0(ANPVideoInterfaceV0* i) {
    1.55 +    ASSIGN(i, acquireNativeWindow);
    1.56 +    ASSIGN(i, setWindowDimensions);
    1.57 +    ASSIGN(i, releaseNativeWindow);
    1.58 +}
    1.59 +
    1.60 +void InitVideoInterfaceV1(ANPVideoInterfaceV1* i) {
    1.61 +    ASSIGN(i, acquireNativeWindow);
    1.62 +    ASSIGN(i, setWindowDimensions);
    1.63 +    ASSIGN(i, releaseNativeWindow);
    1.64 +    ASSIGN(i, setFramerateCallback);
    1.65 +}

mercurial