Home | History | Annotate | Download | only in primitives
      1 /*
      2  *  Copyright (c) 2012 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_VIDEO_ENGINE_TEST_AUTO_TEST_PRIMITIVES_GENERAL_PRIMITIVES_H_
     12 #define WEBRTC_VIDEO_ENGINE_TEST_AUTO_TEST_PRIMITIVES_GENERAL_PRIMITIVES_H_
     13 
     14 class ViEToFileRenderer;
     15 
     16 #include "webrtc/common_types.h"
     17 
     18 namespace webrtc {
     19 class VideoCaptureModule;
     20 class ViEBase;
     21 class ViECapture;
     22 class ViECodec;
     23 class ViERender;
     24 class ViERTP_RTCP;
     25 struct VideoCodec;
     26 }
     27 
     28 enum ProtectionMethod {
     29   kNack,
     30   kHybridNackFec,
     31 };
     32 
     33 // This constant can be used as input to various functions to not force the
     34 // codec resolution.
     35 const int kDoNotForceResolution = 0;
     36 
     37 // Finds a suitable capture device (e.g. camera) on the current system
     38 // and allocates it. Details about the found device are filled into the out
     39 // parameters. If this operation fails, device_id is assigned a negative value
     40 // and number_of_errors is incremented.
     41 void FindCaptureDeviceOnSystem(webrtc::ViECapture* capture,
     42                                char* device_name,
     43                                const unsigned int kDeviceNameLength,
     44                                int* device_id,
     45                                webrtc::VideoCaptureModule** device_video);
     46 
     47 // Sets up rendering in a window previously created using a Window Manager
     48 // (See vie_window_manager_factory.h for more details on how to make one of
     49 // those). The frame provider id is a source of video frames, for instance
     50 // a capture device or a video channel.
     51 void RenderInWindow(webrtc::ViERender* video_render_interface,
     52                     int  frame_provider_id,
     53                     void* os_window,
     54                     float z_index);
     55 
     56 // Similar in function to RenderInWindow, this function instead renders to
     57 // a file using a to-file-renderer. The frame provider id is a source of
     58 // video frames, for instance a capture device or a video channel.
     59 void RenderToFile(webrtc::ViERender* renderer_interface,
     60                   int frame_provider_id,
     61                   ViEToFileRenderer* to_file_renderer);
     62 
     63 // Configures RTP-RTCP.
     64 void ConfigureRtpRtcp(webrtc::ViERTP_RTCP* rtcp_interface,
     65                       ProtectionMethod protection_method,
     66                       int video_channel);
     67 
     68 // Finds a codec in the codec list. Returns true on success, false otherwise.
     69 // The resulting codec is filled into result on success but is zeroed out
     70 // on failure.
     71 bool FindSpecificCodec(webrtc::VideoCodecType of_type,
     72                        webrtc::ViECodec* codec_interface,
     73                        webrtc::VideoCodec* result);
     74 
     75 // Sets up the provided codec with a resolution that takes individual codec
     76 // quirks into account (except if the forced* variables are
     77 // != kDoNotForceResolution)
     78 void SetSuitableResolution(webrtc::VideoCodec* video_codec,
     79                            int forced_codec_width,
     80                            int forced_codec_height);
     81 
     82 #endif  // WEBRTC_VIDEO_ENGINE_TEST_AUTO_TEST_PRIMITIVES_GENERAL_PRIMITIVES_H_
     83