Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(71)

Side by Side Diff: modules/video_coding/codecs/stereo/include/stereo_encoder_adapter.h

Issue 3015663002: [Experiment] Alpha Channel Support
Patch Set: Remove Frame Matching On Sender Side Created 3 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
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
11 #ifndef WEBRTC_MODULES_VIDEO_CODING_CODECS_ALPHA_INCLUDE_ALPHA_ENCODER_ADAPTER_H _
12 #define WEBRTC_MODULES_VIDEO_CODING_CODECS_ALPHA_INCLUDE_ALPHA_ENCODER_ADAPTER_H _
13
14 #include <map>
15 #include <memory>
16 #include <vector>
17
18 #include "api/video_codecs/video_encoder.h"
19 #include "modules/video_coding/include/video_codec_interface.h"
20
21 namespace webrtc {
22
23 enum StereoCodecStream {
24 kYUVStream = 0,
25 kAXXStream = 1,
26 kStereoCodecStreams = 2,
27 };
28
29 class StereoEncoderAdapter : public VideoEncoder {
30 public:
31 explicit StereoEncoderAdapter(VideoEncoderFactoryEx* factory);
32 virtual ~StereoEncoderAdapter();
33
34 // Implements VideoEncoder
35 int InitEncode(const VideoCodec* inst,
36 int number_of_cores,
37 size_t max_payload_size) override;
38 int Encode(const VideoFrame& input_image,
39 const CodecSpecificInfo* codec_specific_info,
40 const std::vector<FrameType>* frame_types) override;
41 int RegisterEncodeCompleteCallback(EncodedImageCallback* callback) override;
42 int SetChannelParameters(uint32_t packet_loss, int64_t rtt) override;
43 int SetRateAllocation(const BitrateAllocation& bitrate,
44 uint32_t new_framerate) override;
45 int Release() override;
46 const char* ImplementationName() const override {
47 return "StereoEncoderAdapter";
48 }
49
50 EncodedImageCallback::Result OnEncodedImage(
51 StereoCodecStream stream_idx,
52 const EncodedImage& encodedImage,
53 const CodecSpecificInfo* codecSpecificInfo,
54 const RTPFragmentationHeader* fragmentation);
55
56 private:
57 // Wrapper class that redirects OnEncodedImage() calls.
58 class AdapterEncodedImageCallback;
59
60 // Holds the encoded image output of a frame.
61 struct EncodedImageData;
62
63 std::unique_ptr<VideoEncoderFactoryEx> factory_;
64 std::vector<VideoEncoder*> encoders_;
65 std::vector<std::unique_ptr<AdapterEncodedImageCallback>> adapter_callbacks_;
66 EncodedImageCallback* encoded_complete_callback_;
67
68 // Map timestamp.
69 std::map<uint32_t /* timestamp */, int /*count*/> frame_count_;
70
71 uint64_t picture_index_ = 0;
72 std::vector<uint8_t> merged_image_buffer_;
73 std::vector<uint8_t> stereo_dummy_planes_;
74 };
75
76 } // namespace webrtc
77
78 #endif // WEBRTC_MODULES_VIDEO_CODING_CODECS_ALPHA_INCLUDE_ALPHA_ENCODER_ADAPTE R_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698