Emircan Uysaler | 0a37547 | 2017-12-11 12:21:02 +0530 | [diff] [blame] | 1 | /* |
| 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 Uysaler | d7ae3c3 | 2018-01-25 13:01:09 -0800 | [diff] [blame] | 11 | #ifndef MEDIA_ENGINE_MULTIPLEXCODECFACTORY_H_ |
| 12 | #define MEDIA_ENGINE_MULTIPLEXCODECFACTORY_H_ |
Emircan Uysaler | 0a37547 | 2017-12-11 12:21:02 +0530 | [diff] [blame] | 13 | |
| 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 | |
| 20 | namespace webrtc { |
| 21 | |
Emircan Uysaler | d7ae3c3 | 2018-01-25 13:01:09 -0800 | [diff] [blame] | 22 | class MultiplexEncoderFactory : public VideoEncoderFactory { |
Emircan Uysaler | 0a37547 | 2017-12-11 12:21:02 +0530 | [diff] [blame] | 23 | public: |
Tarek Hefny | 77c8e65 | 2018-08-15 10:19:32 -0700 | [diff] [blame] | 24 | // 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 Uysaler | 0a37547 | 2017-12-11 12:21:02 +0530 | [diff] [blame] | 30 | |
| 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 Hefny | 77c8e65 | 2018-08-15 10:19:32 -0700 | [diff] [blame] | 38 | const bool supports_augmenting_data_; |
Emircan Uysaler | 0a37547 | 2017-12-11 12:21:02 +0530 | [diff] [blame] | 39 | }; |
| 40 | |
Emircan Uysaler | d7ae3c3 | 2018-01-25 13:01:09 -0800 | [diff] [blame] | 41 | class MultiplexDecoderFactory : public VideoDecoderFactory { |
Emircan Uysaler | 0a37547 | 2017-12-11 12:21:02 +0530 | [diff] [blame] | 42 | public: |
Tarek Hefny | 77c8e65 | 2018-08-15 10:19:32 -0700 | [diff] [blame] | 43 | // 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 Uysaler | 0a37547 | 2017-12-11 12:21:02 +0530 | [diff] [blame] | 49 | |
| 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 Hefny | 77c8e65 | 2018-08-15 10:19:32 -0700 | [diff] [blame] | 56 | const bool supports_augmenting_data_; |
Emircan Uysaler | 0a37547 | 2017-12-11 12:21:02 +0530 | [diff] [blame] | 57 | }; |
| 58 | |
| 59 | } // namespace webrtc |
| 60 | |
Emircan Uysaler | d7ae3c3 | 2018-01-25 13:01:09 -0800 | [diff] [blame] | 61 | #endif // MEDIA_ENGINE_MULTIPLEXCODECFACTORY_H_ |