blob: f44913ba05e7c1660316b18272ea3e81b7a6cab4 [file] [log] [blame]
philipel2fee4d62018-03-21 16:52:13 +01001/*
2 * Copyright (c) 2018 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 VIDEO_VIDEO_STREAM_DECODER_IMPL_H_
12#define VIDEO_VIDEO_STREAM_DECODER_IMPL_H_
13
14#include <functional>
15#include <map>
16#include <memory>
17#include <utility>
18
19#include "api/optional.h"
20#include "api/video/encoded_frame.h"
21#include "api/video/video_frame.h"
22#include "api/video/video_stream_decoder.h"
23#include "api/video_codecs/sdp_video_format.h"
24#include "api/video_codecs/video_decoder_factory.h"
25
26namespace webrtc {
27
28class VideoStreamDecoderImpl : public VideoStreamDecoder,
29 private DecodedImageCallback {
30 public:
31 VideoStreamDecoderImpl(
32 VideoStreamDecoder::Callbacks* callbacks,
33 VideoDecoderFactory* decoder_factory,
34 std::map<int, std::pair<SdpVideoFormat, int>> decoder_settings);
35
36 ~VideoStreamDecoderImpl() override;
37
38 void OnFrame(std::unique_ptr<video_coding::EncodedFrame> frame) override;
39
40 private:
41 // Implements DecodedImageCallback interface
42 int32_t Decoded(VideoFrame& decodedImage) override;
43 int32_t Decoded(VideoFrame& decodedImage, int64_t decode_time_ms) override;
44 void Decoded(VideoFrame& decodedImage,
45 rtc::Optional<int32_t> decode_time_ms,
46 rtc::Optional<uint8_t> qp) override;
47
48 VideoStreamDecoder::Callbacks* callbacks_;
49 VideoDecoderFactory* decoder_factory_;
50 std::map<int, std::pair<SdpVideoFormat, int>> decoder_settings_;
51};
52
53} // namespace webrtc
54
55#endif // VIDEO_VIDEO_STREAM_DECODER_IMPL_H_