blob: 030904f1b84b7bb454ae09eedd43ee496ed96f3c [file] [log] [blame]
Emircan Uysaler0a375472017-12-11 12:21:02 +05301/*
2 * Copyright (c) 2017 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
Emircan Uysalerd7ae3c32018-01-25 13:01:09 -080011#ifndef MEDIA_ENGINE_MULTIPLEXCODECFACTORY_H_
12#define MEDIA_ENGINE_MULTIPLEXCODECFACTORY_H_
Emircan Uysaler0a375472017-12-11 12:21:02 +053013
14#include <memory>
15#include <vector>
16
17#include "api/video_codecs/video_decoder_factory.h"
18#include "api/video_codecs/video_encoder_factory.h"
19
20namespace webrtc {
21
Emircan Uysalerd7ae3c32018-01-25 13:01:09 -080022class MultiplexEncoderFactory : public VideoEncoderFactory {
Emircan Uysaler0a375472017-12-11 12:21:02 +053023 public:
Tarek Hefny77c8e652018-08-15 10:19:32 -070024 // supports_augmenting_data defines if the encoder would support augmenting
25 // data in that case the encoder expects video frame buffer of type
26 // AugmentedVideoFrameBuffer the encoder would encode the attached buffer and
27 // data together if the flag is not set any frame buffer can be passed in
28 MultiplexEncoderFactory(std::unique_ptr<VideoEncoderFactory> factory,
29 bool supports_augmenting_data = false);
Emircan Uysaler0a375472017-12-11 12:21:02 +053030
31 std::vector<SdpVideoFormat> GetSupportedFormats() const override;
32 CodecInfo QueryVideoEncoder(const SdpVideoFormat& format) const override;
33 std::unique_ptr<VideoEncoder> CreateVideoEncoder(
34 const SdpVideoFormat& format) override;
35
36 private:
37 std::unique_ptr<VideoEncoderFactory> factory_;
Tarek Hefny77c8e652018-08-15 10:19:32 -070038 const bool supports_augmenting_data_;
Emircan Uysaler0a375472017-12-11 12:21:02 +053039};
40
Emircan Uysalerd7ae3c32018-01-25 13:01:09 -080041class MultiplexDecoderFactory : public VideoDecoderFactory {
Emircan Uysaler0a375472017-12-11 12:21:02 +053042 public:
Tarek Hefny77c8e652018-08-15 10:19:32 -070043 // supports_augmenting_data defines if the decoder would support augmenting
44 // data in that case the decoder expects the encoded video frame to contain
45 // augmenting_data it is expected that the sender is using MultiplexEncoder
46 // with supports_augmenting_data set
47 MultiplexDecoderFactory(std::unique_ptr<VideoDecoderFactory> factory,
48 bool supports_augmenting_data = false);
Emircan Uysaler0a375472017-12-11 12:21:02 +053049
50 std::vector<SdpVideoFormat> GetSupportedFormats() const override;
51 std::unique_ptr<VideoDecoder> CreateVideoDecoder(
52 const SdpVideoFormat& format) override;
53
54 private:
55 std::unique_ptr<VideoDecoderFactory> factory_;
Tarek Hefny77c8e652018-08-15 10:19:32 -070056 const bool supports_augmenting_data_;
Emircan Uysaler0a375472017-12-11 12:21:02 +053057};
58
59} // namespace webrtc
60
Emircan Uysalerd7ae3c32018-01-25 13:01:09 -080061#endif // MEDIA_ENGINE_MULTIPLEXCODECFACTORY_H_