blob: 666a791f91c6e588e48734b64afd91b166434cad [file] [log] [blame]
Marina Cioceae3e07bf2020-02-27 16:28:51 +01001/*
2 * Copyright 2020 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
11#ifndef API_FRAME_TRANSFORMER_INTERFACE_H_
12#define API_FRAME_TRANSFORMER_INTERFACE_H_
13
14#include <memory>
15#include <vector>
16
17#include "api/scoped_refptr.h"
18#include "api/video/encoded_frame.h"
19#include "rtc_base/ref_count.h"
20
21namespace webrtc {
22
23// Objects implement this interface to be notified with the transformed frame.
24class TransformedFrameCallback : public rtc::RefCountInterface {
25 public:
26 virtual void OnTransformedFrame(
27 std::unique_ptr<video_coding::EncodedFrame> transformed_frame) = 0;
28
29 protected:
30 ~TransformedFrameCallback() override = default;
31};
32
33// Transformes encoded frames. The transformed frame is sent in a callback using
34// the TransformedFrameCallback interface (see below).
35class FrameTransformerInterface : public rtc::RefCountInterface {
36 public:
37 // Transforms |frame| using the implementing class' processing logic.
38 // |additional_data| holds data that is needed in the frame transformation
39 // logic, but is not included in |frame|; for example, when the transform
40 // function is used for encrypting/decrypting the frame, the additional data
41 // holds the serialized generic frame descriptor extension calculated in
42 // webrtc::RtpDescriptorAuthentication, needed in the encryption/decryption
43 // algorithms.
44 virtual void TransformFrame(std::unique_ptr<video_coding::EncodedFrame> frame,
45 std::vector<uint8_t> additional_data,
46 uint32_t ssrc) = 0;
47
48 virtual void RegisterTransformedFrameCallback(
49 rtc::scoped_refptr<TransformedFrameCallback>) = 0;
50 virtual void UnregisterTransformedFrameCallback() = 0;
51
52 protected:
53 ~FrameTransformerInterface() override = default;
54};
55
56} // namespace webrtc
57
58#endif // API_FRAME_TRANSFORMER_INTERFACE_H_