mozIGeckoMediaPluginService.idl (4655B)
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 /* This Source Code Form is subject to the terms of the Mozilla Public 3 * License, v. 2.0. If a copy of the MPL was not distributed with this 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 5 6 #include "nsISupports.idl" 7 #include "nsIThread.idl" 8 9 interface nsIFile; 10 11 %{C++ 12 #include "mozilla/UniquePtr.h" 13 #include "nsTArray.h" 14 #include "nsString.h" 15 class GMPDecryptorProxy; 16 class GMPVideoDecoderProxy; 17 class GMPVideoEncoderProxy; 18 class GMPVideoHost; 19 20 namespace mozilla { 21 class GMPCrashHelper; 22 } 23 24 template<class T> 25 class GMPGetterCallback 26 { 27 public: 28 GMPGetterCallback() { MOZ_COUNT_CTOR(GMPGetterCallback<T>); } 29 virtual ~GMPGetterCallback() { MOZ_COUNT_DTOR(GMPGetterCallback<T>); } 30 virtual void Done(T*) = 0; 31 }; 32 template<class T> 33 class GMPVideoGetterCallback 34 { 35 public: 36 GMPVideoGetterCallback() { MOZ_COUNT_CTOR(GMPVideoGetterCallback<T>); } 37 virtual ~GMPVideoGetterCallback() { MOZ_COUNT_DTOR(GMPVideoGetterCallback<T>); } 38 virtual void Done(T*, GMPVideoHost*) = 0; 39 }; 40 typedef GMPGetterCallback<GMPDecryptorProxy> GetGMPDecryptorCallback; 41 typedef GMPVideoGetterCallback<GMPVideoDecoderProxy> GetGMPVideoDecoderCallback; 42 typedef GMPVideoGetterCallback<GMPVideoEncoderProxy> GetGMPVideoEncoderCallback; 43 class GetNodeIdCallback 44 { 45 public: 46 MOZ_COUNTED_DEFAULT_CTOR(GetNodeIdCallback) 47 MOZ_COUNTED_DTOR_VIRTUAL(GetNodeIdCallback) 48 virtual void Done(nsresult aResult, const nsACString& aNodeId) = 0; 49 }; 50 %} 51 52 [ptr] native TagArray(nsTArray<nsCString>); 53 [ref] native ConstTagArrayRef(const nsTArray<nsCString>); 54 native GetGMPDecryptorCallback(mozilla::UniquePtr<GetGMPDecryptorCallback>&&); 55 native GetGMPVideoDecoderCallback(mozilla::UniquePtr<GetGMPVideoDecoderCallback>&&); 56 native GetGMPVideoEncoderCallback(mozilla::UniquePtr<GetGMPVideoEncoderCallback>&&); 57 native GetNodeIdCallback(mozilla::UniquePtr<GetNodeIdCallback>&&); 58 native GMPCrashHelperPtr(mozilla::GMPCrashHelper*); 59 60 [scriptable, builtinclass, uuid(44d362ae-937a-4803-bee6-f2512a0149d1)] 61 interface mozIGeckoMediaPluginService : nsISupports 62 { 63 64 /** 65 * The GMP thread. Callable from any thread. 66 */ 67 readonly attribute nsIThread thread; 68 69 /** 70 * Run through windows registered registered for pluginId, sending 71 * 'PluginCrashed' chrome-only event 72 */ 73 void RunPluginCrashCallbacks(in unsigned long pluginId, in ACString pluginName); 74 75 /** 76 * Get a plugin that supports the specified tags. 77 * Callable on any thread 78 */ 79 [noscript] 80 boolean hasPluginForAPI(in ACString api, in ConstTagArrayRef tags); 81 82 /** 83 * Get the plugin directory for a plugin that supports the specified tags. 84 * Callable on any thread 85 */ 86 [noscript] 87 nsIFile findPluginDirectoryForAPI(in ACString api, in ConstTagArrayRef tags); 88 89 /** 90 * Get a video decoder that supports the specified tags. 91 * The array of tags should at least contain a codec tag, and optionally 92 * other tags such as for EME keysystem. 93 * Callable only on GMP thread. 94 * This is an asynchronous operation, the Done method of the callback object 95 * will be called on the GMP thread with the result (which might be null in 96 * the case of failure). This method always takes ownership of the callback 97 * object, but if this method returns an error then the Done method of the 98 * callback object will not be called at all. 99 */ 100 [noscript] 101 void getGMPVideoDecoder(in GMPCrashHelperPtr helper, 102 in TagArray tags, 103 [optional] in ACString nodeId, 104 in GetGMPVideoDecoderCallback callback); 105 106 /** 107 * Get a video encoder that supports the specified tags. 108 * The array of tags should at least contain a codec tag, and optionally 109 * other tags. 110 * Callable only on GMP thread. 111 * This is an asynchronous operation, the Done method of the callback object 112 * will be called on the GMP thread with the result (which might be null in 113 * the case of failure). This method always takes ownership of the callback 114 * object, but if this method returns an error then the Done method of the 115 * callback object will not be called at all. 116 */ 117 [noscript] 118 void getGMPVideoEncoder(in GMPCrashHelperPtr helper, 119 in TagArray tags, 120 [optional] in ACString nodeId, 121 in GetGMPVideoEncoderCallback callback); 122 123 /** 124 * Gets the NodeId for a (origin, urlbarOrigin) pair. 125 */ 126 [noscript] 127 void getNodeId(in AString origin, 128 in AString topLevelOrigin, 129 in AString gmpName, 130 in GetNodeIdCallback callback); 131 };