10e118e7129884fbea117e78d6f2068139a414dbhenrike@webrtc.org/*
20e118e7129884fbea117e78d6f2068139a414dbhenrike@webrtc.org * libjingle
30e118e7129884fbea117e78d6f2068139a414dbhenrike@webrtc.org * Copyright 2011, Google Inc.
40e118e7129884fbea117e78d6f2068139a414dbhenrike@webrtc.org *
50e118e7129884fbea117e78d6f2068139a414dbhenrike@webrtc.org * Redistribution and use in source and binary forms, with or without
60e118e7129884fbea117e78d6f2068139a414dbhenrike@webrtc.org * modification, are permitted provided that the following conditions are met:
70e118e7129884fbea117e78d6f2068139a414dbhenrike@webrtc.org *
80e118e7129884fbea117e78d6f2068139a414dbhenrike@webrtc.org *  1. Redistributions of source code must retain the above copyright notice,
90e118e7129884fbea117e78d6f2068139a414dbhenrike@webrtc.org *     this list of conditions and the following disclaimer.
100e118e7129884fbea117e78d6f2068139a414dbhenrike@webrtc.org *  2. Redistributions in binary form must reproduce the above copyright notice,
110e118e7129884fbea117e78d6f2068139a414dbhenrike@webrtc.org *     this list of conditions and the following disclaimer in the documentation
120e118e7129884fbea117e78d6f2068139a414dbhenrike@webrtc.org *     and/or other materials provided with the distribution.
130e118e7129884fbea117e78d6f2068139a414dbhenrike@webrtc.org *  3. The name of the author may not be used to endorse or promote products
140e118e7129884fbea117e78d6f2068139a414dbhenrike@webrtc.org *     derived from this software without specific prior written permission.
150e118e7129884fbea117e78d6f2068139a414dbhenrike@webrtc.org *
160e118e7129884fbea117e78d6f2068139a414dbhenrike@webrtc.org * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
170e118e7129884fbea117e78d6f2068139a414dbhenrike@webrtc.org * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
180e118e7129884fbea117e78d6f2068139a414dbhenrike@webrtc.org * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
190e118e7129884fbea117e78d6f2068139a414dbhenrike@webrtc.org * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
200e118e7129884fbea117e78d6f2068139a414dbhenrike@webrtc.org * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
210e118e7129884fbea117e78d6f2068139a414dbhenrike@webrtc.org * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
220e118e7129884fbea117e78d6f2068139a414dbhenrike@webrtc.org * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
230e118e7129884fbea117e78d6f2068139a414dbhenrike@webrtc.org * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
240e118e7129884fbea117e78d6f2068139a414dbhenrike@webrtc.org * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
250e118e7129884fbea117e78d6f2068139a414dbhenrike@webrtc.org * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
260e118e7129884fbea117e78d6f2068139a414dbhenrike@webrtc.org */
270e118e7129884fbea117e78d6f2068139a414dbhenrike@webrtc.org
280e118e7129884fbea117e78d6f2068139a414dbhenrike@webrtc.org#ifndef TALK_APP_WEBRTC_AUDIOTRACK_H_
290e118e7129884fbea117e78d6f2068139a414dbhenrike@webrtc.org#define TALK_APP_WEBRTC_AUDIOTRACK_H_
300e118e7129884fbea117e78d6f2068139a414dbhenrike@webrtc.org
310e118e7129884fbea117e78d6f2068139a414dbhenrike@webrtc.org#include "talk/app/webrtc/mediastreaminterface.h"
320e118e7129884fbea117e78d6f2068139a414dbhenrike@webrtc.org#include "talk/app/webrtc/mediastreamtrack.h"
330e118e7129884fbea117e78d6f2068139a414dbhenrike@webrtc.org#include "talk/app/webrtc/notifier.h"
340e118e7129884fbea117e78d6f2068139a414dbhenrike@webrtc.org#include "talk/base/scoped_ptr.h"
350e118e7129884fbea117e78d6f2068139a414dbhenrike@webrtc.org#include "talk/base/scoped_ref_ptr.h"
360e118e7129884fbea117e78d6f2068139a414dbhenrike@webrtc.org
370e118e7129884fbea117e78d6f2068139a414dbhenrike@webrtc.orgnamespace webrtc {
380e118e7129884fbea117e78d6f2068139a414dbhenrike@webrtc.org
390e118e7129884fbea117e78d6f2068139a414dbhenrike@webrtc.orgclass AudioTrack : public MediaStreamTrack<AudioTrackInterface> {
400e118e7129884fbea117e78d6f2068139a414dbhenrike@webrtc.org public:
410e118e7129884fbea117e78d6f2068139a414dbhenrike@webrtc.org  static talk_base::scoped_refptr<AudioTrack> Create(
420e118e7129884fbea117e78d6f2068139a414dbhenrike@webrtc.org      const std::string& id, AudioSourceInterface* source);
430e118e7129884fbea117e78d6f2068139a414dbhenrike@webrtc.org
44c583107e6b398a140dc56f9539b0e01b58af8c61henrike@webrtc.org  // AudioTrackInterface implementation.
45c583107e6b398a140dc56f9539b0e01b58af8c61henrike@webrtc.org  virtual AudioSourceInterface* GetSource() const OVERRIDE {
460e118e7129884fbea117e78d6f2068139a414dbhenrike@webrtc.org    return audio_source_.get();
470e118e7129884fbea117e78d6f2068139a414dbhenrike@webrtc.org  }
48c583107e6b398a140dc56f9539b0e01b58af8c61henrike@webrtc.org  // TODO(xians): Implement these methods.
49c583107e6b398a140dc56f9539b0e01b58af8c61henrike@webrtc.org  virtual void AddSink(AudioTrackSinkInterface* sink) OVERRIDE {}
50c583107e6b398a140dc56f9539b0e01b58af8c61henrike@webrtc.org  virtual void RemoveSink(AudioTrackSinkInterface* sink) OVERRIDE {}
51c583107e6b398a140dc56f9539b0e01b58af8c61henrike@webrtc.org  virtual bool GetSignalLevel(int* level) OVERRIDE { return false; }
52ac5a3e5f1e59174797dc60641cba617c1bf0c279henrike@webrtc.org  virtual talk_base::scoped_refptr<AudioProcessorInterface> GetAudioProcessor()
53ac5a3e5f1e59174797dc60641cba617c1bf0c279henrike@webrtc.org      OVERRIDE { return NULL; }
54c583107e6b398a140dc56f9539b0e01b58af8c61henrike@webrtc.org  virtual cricket::AudioRenderer* GetRenderer() OVERRIDE {
557162d28d68ad58802a5a52eca0df59150ee7b9d4henrike@webrtc.org    return NULL;
560e118e7129884fbea117e78d6f2068139a414dbhenrike@webrtc.org  }
570e118e7129884fbea117e78d6f2068139a414dbhenrike@webrtc.org
58c583107e6b398a140dc56f9539b0e01b58af8c61henrike@webrtc.org  // MediaStreamTrack implementation.
59c583107e6b398a140dc56f9539b0e01b58af8c61henrike@webrtc.org  virtual std::string kind() const OVERRIDE;
600e118e7129884fbea117e78d6f2068139a414dbhenrike@webrtc.org
610e118e7129884fbea117e78d6f2068139a414dbhenrike@webrtc.org protected:
620e118e7129884fbea117e78d6f2068139a414dbhenrike@webrtc.org  AudioTrack(const std::string& label, AudioSourceInterface* audio_source);
630e118e7129884fbea117e78d6f2068139a414dbhenrike@webrtc.org
640e118e7129884fbea117e78d6f2068139a414dbhenrike@webrtc.org private:
650e118e7129884fbea117e78d6f2068139a414dbhenrike@webrtc.org  talk_base::scoped_refptr<AudioSourceInterface> audio_source_;
660e118e7129884fbea117e78d6f2068139a414dbhenrike@webrtc.org};
670e118e7129884fbea117e78d6f2068139a414dbhenrike@webrtc.org
680e118e7129884fbea117e78d6f2068139a414dbhenrike@webrtc.org}  // namespace webrtc
690e118e7129884fbea117e78d6f2068139a414dbhenrike@webrtc.org
700e118e7129884fbea117e78d6f2068139a414dbhenrike@webrtc.org#endif  // TALK_APP_WEBRTC_AUDIOTRACK_H_
71