Home | History | Annotate | Download | only in linux
      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 #ifndef WEBRTC_MODULES_VIDEO_RENDER_MAIN_SOURCE_LINUX_VIDEO_RENDER_LINUX_IMPL_H_
     12 #define WEBRTC_MODULES_VIDEO_RENDER_MAIN_SOURCE_LINUX_VIDEO_RENDER_LINUX_IMPL_H_
     13 
     14 #include "webrtc/modules/video_render/i_video_render.h"
     15 
     16 namespace webrtc {
     17 class CriticalSectionWrapper;
     18 
     19 class VideoX11Render;
     20 
     21 // Class definitions
     22 class VideoRenderLinuxImpl: IVideoRender
     23 {
     24 public:
     25     /*
     26      *   Constructor/destructor
     27      */
     28 
     29     VideoRenderLinuxImpl(const int32_t id,
     30                          const VideoRenderType videoRenderType,
     31                          void* window, const bool fullscreen);
     32 
     33     virtual ~VideoRenderLinuxImpl();
     34 
     35     virtual int32_t Init();
     36 
     37     virtual int32_t ChangeUniqueId(const int32_t id);
     38 
     39     virtual int32_t ChangeWindow(void* window);
     40 
     41     /**************************************************************************
     42      *
     43      *   Incoming Streams
     44      *
     45      ***************************************************************************/
     46 
     47     virtual VideoRenderCallback
     48             * AddIncomingRenderStream(const uint32_t streamId,
     49                                       const uint32_t zOrder,
     50                                       const float left, const float top,
     51                                       const float right, const float bottom);
     52 
     53     virtual int32_t
     54             DeleteIncomingRenderStream(const uint32_t streamId);
     55 
     56     virtual int32_t
     57             GetIncomingRenderStreamProperties(const uint32_t streamId,
     58                                               uint32_t& zOrder,
     59                                               float& left, float& top,
     60                                               float& right, float& bottom) const;
     61 
     62     /**************************************************************************
     63      *
     64      *   Start/Stop
     65      *
     66      ***************************************************************************/
     67 
     68     virtual int32_t StartRender();
     69 
     70     virtual int32_t StopRender();
     71 
     72     /**************************************************************************
     73      *
     74      *   Properties
     75      *
     76      ***************************************************************************/
     77 
     78     virtual VideoRenderType RenderType();
     79 
     80     virtual RawVideoType PerferedVideoType();
     81 
     82     virtual bool FullScreen();
     83 
     84     virtual int32_t
     85             GetGraphicsMemory(uint64_t& totalGraphicsMemory,
     86                               uint64_t& availableGraphicsMemory) const;
     87 
     88     virtual int32_t
     89             GetScreenResolution(uint32_t& screenWidth,
     90                                 uint32_t& screenHeight) const;
     91 
     92     virtual uint32_t RenderFrameRate(const uint32_t streamId);
     93 
     94     virtual int32_t SetStreamCropping(const uint32_t streamId,
     95                                       const float left, const float top,
     96                                       const float right, const float bottom);
     97 
     98     virtual int32_t SetTransparentBackground(const bool enable);
     99 
    100     virtual int32_t ConfigureRenderer(const uint32_t streamId,
    101                                       const unsigned int zOrder,
    102                                       const float left, const float top,
    103                                       const float right, const float bottom);
    104 
    105     virtual int32_t SetText(const uint8_t textId,
    106                             const uint8_t* text,
    107                             const int32_t textLength,
    108                             const uint32_t textColorRef,
    109                             const uint32_t backgroundColorRef,
    110                             const float left, const float top,
    111                             const float rigth, const float bottom);
    112 
    113     virtual int32_t SetBitmap(const void* bitMap,
    114                               const uint8_t pictureId,
    115                               const void* colorKey,
    116                               const float left, const float top,
    117                               const float right, const float bottom);
    118 
    119 private:
    120     int32_t _id;
    121     CriticalSectionWrapper& _renderLinuxCritsect;
    122 
    123     void* _ptrWindow;
    124 
    125     // X11 Render
    126     VideoX11Render* _ptrX11Render;
    127 };
    128 
    129 }  // namespace webrtc
    130 #endif  // WEBRTC_MODULES_VIDEO_RENDER_MAIN_SOURCE_LINUX_VIDEO_RENDER_LINUX_IMPL_H_
    131