summaryrefslogtreecommitdiffstats
path: root/chromecast/media/cma/backend/audio_decoder_default.h
blob: ea712dad6b613d957ba339611dbfbc14ff63050b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef CHROMECAST_MEDIA_CMA_BACKEND_AUDIO_DECODER_DEFAULT_H_
#define CHROMECAST_MEDIA_CMA_BACKEND_AUDIO_DECODER_DEFAULT_H_

#include <stdint.h>

#include "base/macros.h"
#include "base/memory/weak_ptr.h"
#include "chromecast/public/media/media_pipeline_backend.h"

namespace chromecast {
namespace media {

class AudioDecoderDefault : public MediaPipelineBackend::AudioDecoder {
 public:
  AudioDecoderDefault();
  ~AudioDecoderDefault() override;

  int64_t last_push_pts() const { return last_push_pts_; }

  // MediaPipelineBackend::AudioDecoder implementation:
  void SetDelegate(Delegate* delegate) override;
  MediaPipelineBackend::BufferStatus PushBuffer(
      CastDecoderBuffer* buffer) override;
  void GetStatistics(Statistics* statistics) override;
  bool SetConfig(const AudioConfig& config) override;
  bool SetVolume(float multiplier) override;
  RenderingDelay GetRenderingDelay() override;

 private:
  void OnEndOfStream();

  Delegate* delegate_;
  int64_t last_push_pts_;
  base::WeakPtrFactory<AudioDecoderDefault> weak_factory_;

  DISALLOW_COPY_AND_ASSIGN(AudioDecoderDefault);
};

}  // namespace media
}  // namespace chromecast

#endif  // CHROMECAST_MEDIA_CMA_BACKEND_AUDIO_DECODER_DEFAULT_H_