blob: 9954f314a629c392a5062ab0c5449f4fd6849b87 [file] [log] [blame]
kwibergc01c6a42016-04-28 14:23:32 -07001/*
2 * Copyright (c) 2016 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
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020011#ifndef API_AUDIO_CODECS_AUDIO_DECODER_FACTORY_H_
12#define API_AUDIO_CODECS_AUDIO_DECODER_FACTORY_H_
kwibergc01c6a42016-04-28 14:23:32 -070013
14#include <memory>
15#include <vector>
16
Karl Wiberg98900742018-03-01 12:03:49 +010017#include "api/audio_codecs/audio_codec_pair_id.h"
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020018#include "api/audio_codecs/audio_decoder.h"
19#include "api/audio_codecs/audio_format.h"
Karl Wiberg98900742018-03-01 12:03:49 +010020#include "api/optional.h"
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020021#include "rtc_base/refcount.h"
kwibergc01c6a42016-04-28 14:23:32 -070022
23namespace webrtc {
24
25// A factory that creates AudioDecoders.
26// NOTE: This class is still under development and may change without notice.
ossue725f7c2016-05-19 10:48:04 -070027class AudioDecoderFactory : public rtc::RefCountInterface {
kwibergc01c6a42016-04-28 14:23:32 -070028 public:
ossud4e9f622016-08-18 02:01:17 -070029 virtual std::vector<AudioCodecSpec> GetSupportedDecoders() = 0;
kwibergc01c6a42016-04-28 14:23:32 -070030
kwibergd32bf752017-01-19 07:03:59 -080031 virtual bool IsSupportedDecoder(const SdpAudioFormat& format) = 0;
32
Karl Wiberg98900742018-03-01 12:03:49 +010033 // Create a new decoder instance. The `codec_pair_id` argument is used to
34 // link encoders and decoders that talk to the same remote entity; if a
35 // MakeAudioEncoder() and a MakeAudioDecoder() call receive non-null IDs that
36 // compare equal, the factory implementations may assume that the encoder and
37 // decoder form a pair.
38 //
39 // Note: Implementations need to be robust against combinations other than
40 // one encoder, one decoder getting the same ID; such decoders must still
41 // work.
kwibergc01c6a42016-04-28 14:23:32 -070042 virtual std::unique_ptr<AudioDecoder> MakeAudioDecoder(
Karl Wiberg98900742018-03-01 12:03:49 +010043 const SdpAudioFormat& format,
44 rtc::Optional<AudioCodecPairId> codec_pair_id);
45
46 // Deprecated version of the above.
47 virtual std::unique_ptr<AudioDecoder> MakeAudioDecoder(
48 const SdpAudioFormat& format);
kwibergc01c6a42016-04-28 14:23:32 -070049};
50
51} // namespace webrtc
52
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020053#endif // API_AUDIO_CODECS_AUDIO_DECODER_FACTORY_H_