Home | History | Annotate | Download | only in mac
      1 /*
      2  *  Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
      3  *
      4  *  Use of this source code is governed by a BSD-style license
      5  *  that can be found in the LICENSE file in the root of the source
      6  *  tree. An additional intellectual property rights grant can be found
      7  *  in the file PATENTS.  All contributing project authors may
      8  *  be found in the AUTHORS file in the root of the source tree.
      9  */
     10 
     11 #include "webrtc/engine_configurations.h"
     12 #if defined(CARBON_RENDERING)
     13 
     14 #ifndef WEBRTC_MODULES_VIDEO_RENDER_MAIN_SOURCE_MAC_VIDEO_RENDER_MAC_CARBON_IMPL_H_
     15 #define WEBRTC_MODULES_VIDEO_RENDER_MAIN_SOURCE_MAC_VIDEO_RENDER_MAC_CARBON_IMPL_H_
     16 
     17 #include "webrtc/modules/video_render/i_video_render.h"
     18 
     19 namespace webrtc {
     20 
     21 class CriticalSectionWrapper;
     22 class VideoRenderAGL;
     23 
     24 // Class definitions
     25 class VideoRenderMacCarbonImpl : IVideoRender
     26 {
     27 public:
     28     /*
     29      *   Constructor/destructor
     30      */
     31 
     32     VideoRenderMacCarbonImpl(const int32_t id,
     33             const VideoRenderType videoRenderType,
     34             void* window,
     35             const bool fullscreen);
     36 
     37     virtual ~VideoRenderMacCarbonImpl();
     38 
     39     virtual int32_t Init();
     40 
     41     virtual int32_t ChangeUniqueId(const int32_t id);
     42 
     43     virtual int32_t ChangeWindow(void* window);
     44 
     45     /**************************************************************************
     46      *
     47      *   Incoming Streams
     48      *
     49      ***************************************************************************/
     50     virtual VideoRenderCallback* AddIncomingRenderStream(const uint32_t streamId,
     51             const uint32_t zOrder,
     52             const float left,
     53             const float top,
     54             const float right,
     55             const float bottom);
     56 
     57     virtual int32_t DeleteIncomingRenderStream(const uint32_t streamId);
     58 
     59     virtual int32_t GetIncomingRenderStreamProperties(const uint32_t streamId,
     60                                                       uint32_t& zOrder,
     61                                                       float& left,
     62                                                       float& top,
     63                                                       float& right,
     64                                                       float& bottom) const;
     65 
     66     /**************************************************************************
     67      *
     68      *   Start/Stop
     69      *
     70      ***************************************************************************/
     71 
     72     virtual int32_t StartRender();
     73 
     74     virtual int32_t StopRender();
     75 
     76     /**************************************************************************
     77      *
     78      *   Properties
     79      *
     80      ***************************************************************************/
     81 
     82     virtual VideoRenderType RenderType();
     83 
     84     virtual RawVideoType PerferedVideoType();
     85 
     86     virtual bool FullScreen();
     87 
     88     virtual int32_t GetGraphicsMemory(uint64_t& totalGraphicsMemory,
     89             uint64_t& availableGraphicsMemory) const;
     90 
     91     virtual int32_t GetScreenResolution(uint32_t& screenWidth,
     92             uint32_t& screenHeight) const;
     93 
     94     virtual uint32_t RenderFrameRate(const uint32_t streamId);
     95 
     96     virtual int32_t SetStreamCropping(const uint32_t streamId,
     97             const float left,
     98             const float top,
     99             const float right,
    100             const float bottom);
    101 
    102     virtual int32_t ConfigureRenderer(const uint32_t streamId,
    103             const unsigned int zOrder,
    104             const float left,
    105             const float top,
    106             const float right,
    107             const float bottom);
    108 
    109     virtual int32_t SetTransparentBackground(const bool enable);
    110 
    111     virtual int32_t SetText(const uint8_t textId,
    112             const uint8_t* text,
    113             const int32_t textLength,
    114             const uint32_t textColorRef,
    115             const uint32_t backgroundColorRef,
    116             const float left,
    117             const float top,
    118             const float right,
    119             const float bottom);
    120 
    121     virtual int32_t SetBitmap(const void* bitMap,
    122             const uint8_t pictureId,
    123             const void* colorKey,
    124             const float left,
    125             const float top,
    126             const float right,
    127             const float bottom);
    128 
    129     virtual int32_t FullScreenRender(void* window, const bool enable)
    130     {
    131         // not supported in Carbon at this time
    132         return -1;
    133     }
    134 
    135 private:
    136     int32_t _id;
    137     CriticalSectionWrapper& _renderMacCarbonCritsect;
    138     bool _fullScreen;
    139     void* _ptrWindow;
    140     VideoRenderAGL* _ptrCarbonRender;
    141 
    142 };
    143 
    144 
    145 }  // namespace webrtc
    146 
    147 #endif  // WEBRTC_MODULES_VIDEO_RENDER_MAIN_SOURCE_MAC_VIDEO_RENDER_MAC_CARBON_IMPL_H_
    148 #endif // CARBON_RENDERING
    149