tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

PCameras.ipdl (3239B)


      1 /* This Source Code Form is subject to the terms of the Mozilla Public
      2  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
      3  * You can obtain one at http://mozilla.org/MPL/2.0/. */
      4 
      5 include protocol PContent;
      6 include protocol PBackground;
      7 
      8 include PBackgroundSharedTypes;
      9 
     10 include "mozilla/dom/MediaIPCUtils.h";
     11 
     12 using mozilla::camera::CaptureEngine from "mozilla/media/CamerasTypes.h";
     13 using mozilla::dom::VideoResizeModeEnum from "mozilla/dom/MediaStreamTrackBinding.h";
     14 using mozilla::TimeStamp from "mozilla/TimeStamp.h";
     15 using mozilla::media::TimeUnit from "TimeUnits.h";
     16 using mozilla::NormalizedConstraints from "MediaTrackConstraints.h";
     17 
     18 namespace mozilla {
     19 namespace camera {
     20 
     21 // IPC analog for webrtc::VideoCaptureCapability
     22 struct VideoCaptureCapability
     23 {
     24   int width;
     25   int height;
     26   int maxFPS;
     27   int videoType;
     28   bool interlaced;
     29 };
     30 
     31 
     32 // IPC analog for webrtc::VideoFrame
     33 // the described buffer is transported seperately in a Shmem
     34 // See VideoFrameUtils.h
     35 struct VideoFrameProperties
     36 {
     37   TimeStamp captureTime;
     38   // Size of image data within the ShMem,
     39   // the ShMem is at least this large
     40   uint32_t bufferSize;
     41   // From webrtc::VideoFrame
     42   uint32_t rtpTimeStamp;
     43   int64_t ntpTimeMs;
     44   int64_t renderTimeMs;
     45   // See webrtc/**/rotation.h
     46   int rotation;
     47   int yAllocatedSize;
     48   int uAllocatedSize;
     49   int vAllocatedSize;
     50   // From webrtc::VideoFrameBuffer
     51   int width;
     52   int height;
     53   int yStride;
     54   int uStride;
     55   int vStride;
     56 };
     57 
     58 [ManualDealloc, ChildImpl=virtual, ParentImpl=virtual]
     59 async protocol PCameras
     60 {
     61   manager PBackground;
     62 
     63 child:
     64   async CaptureEnded(int[] streamIds);
     65   // transfers ownership of |buffer| from parent to child
     66   async DeliverFrame(int captureId, int[] streamIds, Shmem buffer, VideoFrameProperties props);
     67   async DeviceChange();
     68   async ReplyNumberOfCaptureDevices(int deviceCount);
     69   async ReplyNumberOfCapabilities(int capabilityCount);
     70   async ReplyAllocateCapture(int streamId);
     71   async ReplyGetCaptureCapability(VideoCaptureCapability cap);
     72   async ReplyGetCaptureDevice(nsCString device_name, nsCString device_id, bool scary);
     73   async ReplyFailure();
     74   async ReplySuccess();
     75   async __delete__();
     76 
     77 parent:
     78   async NumberOfCaptureDevices(CaptureEngine engine);
     79   async NumberOfCapabilities(CaptureEngine engine, nsCString deviceUniqueIdUTF8);
     80 
     81   async GetCaptureCapability(CaptureEngine engine, nsCString unique_idUTF8,
     82                              int capability_number);
     83   async GetCaptureDevice(CaptureEngine engine, int deviceIndex);
     84 
     85   async AllocateCapture(CaptureEngine engine, nsCString unique_idUTF8,
     86                         uint64_t windowID);
     87   async ReleaseCapture(CaptureEngine engine, int streamId);
     88   async StartCapture(CaptureEngine engine, int streamId,
     89                      VideoCaptureCapability capability,
     90                      NormalizedConstraints constraints,
     91                      VideoResizeModeEnum resizeMode);
     92   async FocusOnSelectedSource(CaptureEngine engine, int streamId);
     93   async StopCapture(CaptureEngine engine, int streamId);
     94   // transfers frame back
     95   async ReleaseFrame(int captureId, Shmem s);
     96 
     97   // setup camera engine
     98   async EnsureInitialized(CaptureEngine engine);
     99 };
    100 
    101 } // namespace camera
    102 } // namespace mozilla