0ad98f6affd2597cee41118ea4b7df7a6249427c
[platform/framework/web/chromium-efl.git] /
1 // Copyright 2022 Samsung Electronics Inc. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef THIRD_PARTY_BLINK_RENDERER_PLATFORM_PEERCONNECTION_TIZEN_VIDEO_ENCODER_FACADE_UTILS_H_
6 #define THIRD_PARTY_BLINK_RENDERER_PLATFORM_PEERCONNECTION_TIZEN_VIDEO_ENCODER_FACADE_UTILS_H_
7
8 #include <memory>
9 #include <ostream>
10
11 #include <encoder.h>
12 #include <media_packet.h>
13
14 #include "third_party/blink/renderer/platform/peerconnection/tizen_video_encoder_utils.h"
15
16 namespace blink {
17 namespace tizen {
18
19 // Enum representing currently used encoding mode of platform encoder.
20 // Once set, it cannot be changed.
21 enum class EncodingMode {
22   kUnspecified,
23   kEncodingFromSubscaler,
24   kEncodingFromUserData
25 };
26
27 int NV12DataSize(int height, int stride_y, int stride_uv);
28
29 std::ostream& operator<<(std::ostream& os, encoder_input_type_e status);
30 std::ostream& operator<<(std::ostream& os, encoder_state_e state);
31 std::ostream& operator<<(std::ostream& os, encoder_buffer_status_e status);
32 std::ostream& operator<<(std::ostream& os, encoder_error_e err);
33 std::ostream& operator<<(std::ostream& os, media_format_error_e err);
34 std::ostream& operator<<(std::ostream& os, media_packet_error_e err);
35 std::ostream& operator<<(std::ostream& os, const EncodingMode& encoding_mode);
36
37 struct EncoderDeleter {
38   void operator()(encoder_h encoder);
39 };
40
41 struct MediaFormatDeleter {
42   void operator()(media_format_h media_format);
43 };
44
45 struct MediaPacketDeleter {
46   void operator()(media_packet_h packet);
47 };
48
49 // unique_ptr with custom deleter used for preventing leak of `media_packet_h`
50 // pointer.
51 using MediaPacketType =
52     std::unique_ptr<std::remove_pointer<media_packet_h>::type,
53                     MediaPacketDeleter>;
54
55 // unique_ptr with custom deleter used for preventing leak of `media_format_h`
56 // pointer.
57 using MediaFormatType =
58     std::unique_ptr<std::remove_pointer<media_format_h>::type,
59                     MediaFormatDeleter>;
60
61 }  // namespace tizen
62 }  // namespace blink
63
64 #endif  // THIRD_PARTY_BLINK_RENDERER_PLATFORM_PEERCONNECTION_TIZEN_VIDEO_ENCODER_FACADE_UTILS_H_