blob: d0dc3a500ea8a49d7bcd8c58d867d8adf859ecda [file] [log] [blame]
henrike@webrtc.org28e20752013-07-10 00:45:36 +00001/*
kjellander1afca732016-02-07 20:46:45 -08002 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved.
henrike@webrtc.org28e20752013-07-10 00:45:36 +00003 *
kjellander1afca732016-02-07 20:46:45 -08004 * 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.org28e20752013-07-10 00:45:36 +00009 */
10
kjellander@webrtc.org5ad12972016-02-12 06:39:40 +010011#ifndef WEBRTC_MEDIA_ENGINE_WEBRTCVIDEODECODERFACTORY_H_
12#define WEBRTC_MEDIA_ENGINE_WEBRTCVIDEODECODERFACTORY_H_
henrike@webrtc.org28e20752013-07-10 00:45:36 +000013
henrike@webrtc.org28e20752013-07-10 00:45:36 +000014#include "webrtc/common_types.h"
kthelgasonebd4f792017-09-04 04:36:21 -070015#include "webrtc/media/base/codec.h"
Edward Lemurc20978e2017-07-06 19:44:34 +020016#include "webrtc/rtc_base/refcount.h"
henrike@webrtc.org28e20752013-07-10 00:45:36 +000017
18namespace webrtc {
19class VideoDecoder;
20}
21
22namespace cricket {
23
sakal1fd95952016-06-22 00:46:15 -070024struct VideoDecoderParams {
25 std::string receive_stream_id;
26};
27
henrike@webrtc.org28e20752013-07-10 00:45:36 +000028class WebRtcVideoDecoderFactory {
29 public:
30 // Caller takes the ownership of the returned object and it should be released
31 // by calling DestroyVideoDecoder().
kthelgasonebd4f792017-09-04 04:36:21 -070032 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.org28e20752013-07-10 00:45:36 +000043 virtual webrtc::VideoDecoder* CreateVideoDecoder(
kthelgasonebd4f792017-09-04 04:36:21 -070044 webrtc::VideoCodecType type) {
45 RTC_NOTREACHED();
46 return nullptr;
47 };
48
sakal1fd95952016-06-22 00:46:15 -070049 virtual webrtc::VideoDecoder* CreateVideoDecoderWithParams(
50 webrtc::VideoCodecType type,
51 VideoDecoderParams params) {
52 return CreateVideoDecoder(type);
53 }
henrike@webrtc.org28e20752013-07-10 00:45:36 +000054 virtual ~WebRtcVideoDecoderFactory() {}
55
56 virtual void DestroyVideoDecoder(webrtc::VideoDecoder* decoder) = 0;
57};
58
59} // namespace cricket
60
kjellander@webrtc.org5ad12972016-02-12 06:39:40 +010061#endif // WEBRTC_MEDIA_ENGINE_WEBRTCVIDEODECODERFACTORY_H_