henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 1 | /* |
kjellander | 1afca73 | 2016-02-07 20:46:45 -0800 | [diff] [blame] | 2 | * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 3 | * |
kjellander | 1afca73 | 2016-02-07 20:46:45 -0800 | [diff] [blame] | 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. |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 9 | */ |
| 10 | |
kjellander@webrtc.org | 5ad1297 | 2016-02-12 06:39:40 +0100 | [diff] [blame] | 11 | #ifndef WEBRTC_MEDIA_ENGINE_WEBRTCVIDEODECODERFACTORY_H_ |
| 12 | #define WEBRTC_MEDIA_ENGINE_WEBRTCVIDEODECODERFACTORY_H_ |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 13 | |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 14 | #include "webrtc/common_types.h" |
kthelgason | ebd4f79 | 2017-09-04 04:36:21 -0700 | [diff] [blame] | 15 | #include "webrtc/media/base/codec.h" |
Edward Lemur | c20978e | 2017-07-06 19:44:34 +0200 | [diff] [blame] | 16 | #include "webrtc/rtc_base/refcount.h" |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 17 | |
| 18 | namespace webrtc { |
| 19 | class VideoDecoder; |
| 20 | } |
| 21 | |
| 22 | namespace cricket { |
| 23 | |
sakal | 1fd9595 | 2016-06-22 00:46:15 -0700 | [diff] [blame] | 24 | struct VideoDecoderParams { |
| 25 | std::string receive_stream_id; |
| 26 | }; |
| 27 | |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 28 | class WebRtcVideoDecoderFactory { |
| 29 | public: |
| 30 | // Caller takes the ownership of the returned object and it should be released |
| 31 | // by calling DestroyVideoDecoder(). |
kthelgason | ebd4f79 | 2017-09-04 04:36:21 -0700 | [diff] [blame] | 32 | virtual webrtc::VideoDecoder* CreateVideoDecoderWithParams( |
| 33 | const VideoCodec& codec, |
| 34 | VideoDecoderParams params) { |
| 35 | // Default implementation that delegates to old version in order to preserve |
| 36 | // backwards-compatability. |
| 37 | webrtc::VideoCodecType type = webrtc::PayloadStringToCodecType(codec.name); |
| 38 | return CreateVideoDecoderWithParams(type, params); |
| 39 | } |
| 40 | // DEPRECATED. |
| 41 | // These methods should not be used by new code and will eventually be |
| 42 | // removed. See http://crbug.com/webrtc/8140. |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 43 | virtual webrtc::VideoDecoder* CreateVideoDecoder( |
kthelgason | ebd4f79 | 2017-09-04 04:36:21 -0700 | [diff] [blame] | 44 | webrtc::VideoCodecType type) { |
| 45 | RTC_NOTREACHED(); |
| 46 | return nullptr; |
| 47 | }; |
| 48 | |
sakal | 1fd9595 | 2016-06-22 00:46:15 -0700 | [diff] [blame] | 49 | virtual webrtc::VideoDecoder* CreateVideoDecoderWithParams( |
| 50 | webrtc::VideoCodecType type, |
| 51 | VideoDecoderParams params) { |
| 52 | return CreateVideoDecoder(type); |
| 53 | } |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 54 | virtual ~WebRtcVideoDecoderFactory() {} |
| 55 | |
| 56 | virtual void DestroyVideoDecoder(webrtc::VideoDecoder* decoder) = 0; |
| 57 | }; |
| 58 | |
| 59 | } // namespace cricket |
| 60 | |
kjellander@webrtc.org | 5ad1297 | 2016-02-12 06:39:40 +0100 | [diff] [blame] | 61 | #endif // WEBRTC_MEDIA_ENGINE_WEBRTCVIDEODECODERFACTORY_H_ |