Home | History | Annotate | Download | only in webrtc
      1 /*
      2  * libjingle
      3  * Copyright 2012 Google Inc.
      4  *
      5  * Redistribution and use in source and binary forms, with or without
      6  * modification, are permitted provided that the following conditions are met:
      7  *
      8  *  1. Redistributions of source code must retain the above copyright notice,
      9  *     this list of conditions and the following disclaimer.
     10  *  2. Redistributions in binary form must reproduce the above copyright notice,
     11  *     this list of conditions and the following disclaimer in the documentation
     12  *     and/or other materials provided with the distribution.
     13  *  3. The name of the author may not be used to endorse or promote products
     14  *     derived from this software without specific prior written permission.
     15  *
     16  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
     17  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
     18  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
     19  * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
     20  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
     21  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
     22  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
     23  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
     24  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
     25  * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     26  */
     27 
     28 #ifndef TALK_APP_WEBRTC_MEDIASTREAMPROVIDER_H_
     29 #define TALK_APP_WEBRTC_MEDIASTREAMPROVIDER_H_
     30 
     31 #include "webrtc/base/basictypes.h"
     32 #include "webrtc/base/scoped_ptr.h"
     33 
     34 namespace cricket {
     35 
     36 class AudioRenderer;
     37 class VideoCapturer;
     38 class VideoRenderer;
     39 struct AudioOptions;
     40 struct VideoOptions;
     41 
     42 }  // namespace cricket
     43 
     44 namespace webrtc {
     45 
     46 class AudioSinkInterface;
     47 
     48 // TODO(deadbeef): Change the key from an ssrc to a "sender_id" or
     49 // "receiver_id" string, which will be the MSID in the short term and MID in
     50 // the long term.
     51 
     52 // TODO(deadbeef): These interfaces are effectively just a way for the
     53 // RtpSenders/Receivers to get to the BaseChannels. These interfaces should be
     54 // refactored away eventually, as the classes converge.
     55 
     56 // This interface is called by AudioRtpSender/Receivers to change the settings
     57 // of an audio track connected to certain PeerConnection.
     58 class AudioProviderInterface {
     59  public:
     60   // Enable/disable the audio playout of a remote audio track with |ssrc|.
     61   virtual void SetAudioPlayout(uint32_t ssrc, bool enable) = 0;
     62   // Enable/disable sending audio on the local audio track with |ssrc|.
     63   // When |enable| is true |options| should be applied to the audio track.
     64   virtual void SetAudioSend(uint32_t ssrc,
     65                             bool enable,
     66                             const cricket::AudioOptions& options,
     67                             cricket::AudioRenderer* renderer) = 0;
     68 
     69   // Sets the audio playout volume of a remote audio track with |ssrc|.
     70   // |volume| is in the range of [0, 10].
     71   virtual void SetAudioPlayoutVolume(uint32_t ssrc, double volume) = 0;
     72 
     73   // Allows for setting a direct audio sink for an incoming audio source.
     74   // Only one audio sink is supported per ssrc and ownership of the sink is
     75   // passed to the provider.
     76   virtual void SetRawAudioSink(
     77       uint32_t ssrc,
     78       rtc::scoped_ptr<webrtc::AudioSinkInterface> sink) = 0;
     79 
     80  protected:
     81   virtual ~AudioProviderInterface() {}
     82 };
     83 
     84 // This interface is called by VideoRtpSender/Receivers to change the settings
     85 // of a video track connected to a certain PeerConnection.
     86 class VideoProviderInterface {
     87  public:
     88   virtual bool SetCaptureDevice(uint32_t ssrc,
     89                                 cricket::VideoCapturer* camera) = 0;
     90   // Enable/disable the video playout of a remote video track with |ssrc|.
     91   virtual void SetVideoPlayout(uint32_t ssrc,
     92                                bool enable,
     93                                cricket::VideoRenderer* renderer) = 0;
     94   // Enable sending video on the local video track with |ssrc|.
     95   virtual void SetVideoSend(uint32_t ssrc,
     96                             bool enable,
     97                             const cricket::VideoOptions* options) = 0;
     98 
     99  protected:
    100   virtual ~VideoProviderInterface() {}
    101 };
    102 
    103 }  // namespace webrtc
    104 
    105 #endif  // TALK_APP_WEBRTC_MEDIASTREAMPROVIDER_H_
    106