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 ChangeWindow(void* window);
     38 
     39     /**************************************************************************
     40      *
     41      *   Incoming Streams
     42      *
     43      ***************************************************************************/
     44 
     45     virtual VideoRenderCallback
     46             * AddIncomingRenderStream(const uint32_t streamId,
     47                                       const uint32_t zOrder,
     48                                       const float left, const float top,
     49                                       const float right, const float bottom);
     50 
     51     virtual int32_t
     52             DeleteIncomingRenderStream(const uint32_t streamId);
     53 
     54     virtual int32_t
     55             GetIncomingRenderStreamProperties(const uint32_t streamId,
     56                                               uint32_t& zOrder,
     57                                               float& left, float& top,
     58                                               float& right, float& bottom) const;
     59 
     60     /**************************************************************************
     61      *
     62      *   Start/Stop
     63      *
     64      ***************************************************************************/
     65 
     66     virtual int32_t StartRender();
     67 
     68     virtual int32_t StopRender();
     69 
     70     /**************************************************************************
     71      *
     72      *   Properties
     73      *
     74      ***************************************************************************/
     75 
     76     virtual VideoRenderType RenderType();
     77 
     78     virtual RawVideoType PerferedVideoType();
     79 
     80     virtual bool FullScreen();
     81 
     82     virtual int32_t
     83             GetGraphicsMemory(uint64_t& totalGraphicsMemory,
     84                               uint64_t& availableGraphicsMemory) const;
     85 
     86     virtual int32_t
     87             GetScreenResolution(uint32_t& screenWidth,
     88                                 uint32_t& screenHeight) const;
     89 
     90     virtual uint32_t RenderFrameRate(const uint32_t streamId);
     91 
     92     virtual int32_t SetStreamCropping(const uint32_t streamId,
     93                                       const float left, const float top,
     94                                       const float right, const float bottom);
     95 
     96     virtual int32_t SetTransparentBackground(const bool enable);
     97 
     98     virtual int32_t ConfigureRenderer(const uint32_t streamId,
     99                                       const unsigned int zOrder,
    100                                       const float left, const float top,
    101                                       const float right, const float bottom);
    102 
    103     virtual int32_t SetText(const uint8_t textId,
    104                             const uint8_t* text,
    105                             const int32_t textLength,
    106                             const uint32_t textColorRef,
    107                             const uint32_t backgroundColorRef,
    108                             const float left, const float top,
    109                             const float rigth, const float bottom);
    110 
    111     virtual int32_t SetBitmap(const void* bitMap,
    112                               const uint8_t pictureId,
    113                               const void* colorKey,
    114                               const float left, const float top,
    115                               const float right, const float bottom);
    116 
    117 private:
    118     int32_t _id;
    119     CriticalSectionWrapper& _renderLinuxCritsect;
    120 
    121     void* _ptrWindow;
    122 
    123     // X11 Render
    124     VideoX11Render* _ptrX11Render;
    125 };
    126 
    127 }  // namespace webrtc
    128 #endif  // WEBRTC_MODULES_VIDEO_RENDER_MAIN_SOURCE_LINUX_VIDEO_RENDER_LINUX_IMPL_H_
    129