diff options
author | Derek Sollenberger <djsollen@google.com> | 2011-09-08 11:25:50 -0400 |
---|---|---|
committer | Derek Sollenberger <djsollen@google.com> | 2011-09-08 11:25:50 -0400 |
commit | 86772c601f6ccc0e1d0e0eca429cc2a73c6c3207 (patch) | |
tree | a440047fdbc9647b83c91ee7df4824b1fccf8b5c /Source/WebKit | |
parent | 666a074f73aab3617c866ebe204ce841978ba270 (diff) | |
download | external_webkit-86772c601f6ccc0e1d0e0eca429cc2a73c6c3207.zip external_webkit-86772c601f6ccc0e1d0e0eca429cc2a73c6c3207.tar.gz external_webkit-86772c601f6ccc0e1d0e0eca429cc2a73c6c3207.tar.bz2 |
Add Plugin API for a video framerate callback.
bug: 5239378
Change-Id: I5f7d33302d5a40f58ec12a3c0be63cb51d4ffc75
Diffstat (limited to 'Source/WebKit')
-rw-r--r-- | Source/WebKit/android/plugins/ANPVideoInterface.cpp | 16 | ||||
-rw-r--r-- | Source/WebKit/android/plugins/ANPVideo_npapi.h | 15 |
2 files changed, 31 insertions, 0 deletions
diff --git a/Source/WebKit/android/plugins/ANPVideoInterface.cpp b/Source/WebKit/android/plugins/ANPVideoInterface.cpp index 8eb9846..f39d0b1 100644 --- a/Source/WebKit/android/plugins/ANPVideoInterface.cpp +++ b/Source/WebKit/android/plugins/ANPVideoInterface.cpp @@ -70,6 +70,14 @@ static void anp_releaseNativeWindow(NPP instance, ANativeWindow* window) { mediaLayer->releaseNativeWindowForVideo(window); } +static void anp_setFramerateCallback(NPP instance, const ANativeWindow* window, ANPVideoFrameCallbackProc callback) { + WebCore::MediaLayer* mediaLayer = mediaLayerForInstance(instance); + if (!mediaLayer) + return; + + mediaLayer->setFramerateCallback(window, callback); +} + /////////////////////////////////////////////////////////////////////////////// #define ASSIGN(obj, name) (obj)->name = anp_##name @@ -81,3 +89,11 @@ void ANPVideoInterfaceV0_Init(ANPInterface* value) { ASSIGN(i, setWindowDimensions); ASSIGN(i, releaseNativeWindow); } + +void ANPVideoInterfaceV1_Init(ANPInterface* value) { + // initialize the functions from the previous interface + ANPVideoInterfaceV0_Init(value); + // add any new functions or override existing functions + ANPVideoInterfaceV1* i = reinterpret_cast<ANPVideoInterfaceV1*>(value); + ASSIGN(i, setFramerateCallback); +} diff --git a/Source/WebKit/android/plugins/ANPVideo_npapi.h b/Source/WebKit/android/plugins/ANPVideo_npapi.h index 3d234f2..02e8392 100644 --- a/Source/WebKit/android/plugins/ANPVideo_npapi.h +++ b/Source/WebKit/android/plugins/ANPVideo_npapi.h @@ -58,4 +58,19 @@ struct ANPVideoInterfaceV0 : ANPInterface { void (*releaseNativeWindow)(NPP instance, ANativeWindow* window); }; +/** Called to notify the plugin that a video frame has been composited by the + * browser for display. This will be called in a separate thread and as such + * you cannot call releaseNativeWindow from the callback. + * + * The timestamp is in nanoseconds, and is monotonically increasing. + */ +typedef void (*ANPVideoFrameCallbackProc)(ANativeWindow* window, int64_t timestamp); + +struct ANPVideoInterfaceV1 : ANPVideoInterfaceV0 { + /** Set a callback to be notified when an ANativeWindow is composited by + * the browser. + */ + void (*setFramerateCallback)(NPP instance, const ANativeWindow* window, ANPVideoFrameCallbackProc); +}; + #endif // ANPVideo_npapi_h |