Home | History | Annotate | Download | only in dev
      1 /* Copyright (c) 2012 The Chromium Authors. All rights reserved.
      2  * Use of this source code is governed by a BSD-style license that can be
      3  * found in the LICENSE file.
      4  */
      5 
      6 /**
      7  * This file defines the <code>PPB_DeviceRef_Dev</code> interface.
      8  */
      9 
     10 [generate_thunk]
     11 
     12 label Chrome {
     13   M18 = 0.1
     14 };
     15 
     16 /**
     17  * Defines the callback type to receive device change notifications for
     18  * <code>PPB_AudioInput_Dev.MonitorDeviceChange()</code> and
     19  * <code>PPB_VideoCapture_Dev.MonitorDeviceChange()</code>.
     20  *
     21  * @param[inout] user_data The opaque pointer that the caller passed into
     22  * <code>MonitorDeviceChange()</code>.
     23  * @param[in] device_count How many devices in the array.
     24  * @param[in] devices An array of <code>PPB_DeviceRef_Dev</code>. Please note
     25  * that the ref count of the elements is not increased on behalf of the plugin.
     26  */
     27 typedef void PP_MonitorDeviceChangeCallback(
     28     [inout] mem_t user_data,
     29     [in] uint32_t device_count,
     30     [in, size_is(device_count)] PP_Resource[] devices);
     31 
     32 /**
     33  * Device types.
     34  */
     35 [assert_size(4)]
     36 enum PP_DeviceType_Dev {
     37   PP_DEVICETYPE_DEV_INVALID = 0,
     38   PP_DEVICETYPE_DEV_AUDIOCAPTURE = 1,
     39   PP_DEVICETYPE_DEV_VIDEOCAPTURE = 2
     40 };
     41 
     42 interface PPB_DeviceRef_Dev {
     43   /**
     44    * Determines if the provided resource is a device reference.
     45    *
     46    * @param[in] resource A <code>PP_Resource</code> corresponding to a generic
     47    * resource.
     48    *
     49    * @return A <code>PP_Bool</code> that is <code>PP_TRUE</code> if the given
     50    * resource is a device reference, otherwise <code>PP_FALSE</code>.
     51    */
     52   PP_Bool IsDeviceRef([in] PP_Resource resource);
     53 
     54   /**
     55    * Gets the device type.
     56    *
     57    * @param[in] device_ref A <code>PP_Resource</code> corresponding to a device
     58    * reference.
     59    *
     60    * @return A <code>PP_DeviceType_Dev</code> value.
     61    */
     62   [on_failure=PP_DEVICETYPE_DEV_INVALID]
     63   PP_DeviceType_Dev GetType([in] PP_Resource device_ref);
     64 
     65   /**
     66    * Gets the device name.
     67    *
     68    * @param[in] device_ref A <code>PP_Resource</code> corresponding to a device
     69    * reference.
     70    *
     71    * @return A <code>PP_Var</code> of type <code>PP_VARTYPE_STRING</code>
     72    * containing the name of the device if successful; a <code>PP_Var</code> of
     73    * type <code>PP_VARTYPE_UNDEFINED</code> if failed.
     74    */
     75   PP_Var GetName([in] PP_Resource device_ref);
     76 };
     77