| Flutter Linux Embedder |

Classes | Functions
fl_binary_codec.cc File Reference
`#include "flutter/shell/platform/linux/public/flutter_linux/fl_binary_codec.h"`
`#include <gmodule.h>`

Go to the source code of this file.

## Classes
struct | _FlBinaryCodec

## Functions
static GBytes * | fl_binary_codec_encode_message (FlMessageCodec *codec, FlValue *value, GError **error)
static FlValue * | fl_binary_codec_decode_message (FlMessageCodec *codec, GBytes *message, GError **error)
static void | fl_binary_codec_class_init (FlBinaryCodecClass *klass)
static void | fl_binary_codec_init (FlBinaryCodec *self)
G_MODULE_EXPORT FlBinaryCodec * | fl_binary_codec_new ()

## Function Documentation

## ◆ fl_binary_codec_class_init()

static void fl_binary_codec_class_init | ( | FlBinaryCodecClass * | klass | ) |
| static

Definition at line 42 of file fl_binary_codec.cc.

42 {
43 FL_MESSAGE_CODEC_CLASS(klass)->encode_message =
44 fl_binary_codec_encode_message;
45 FL_MESSAGE_CODEC_CLASS(klass)->decode_message =
46 fl_binary_codec_decode_message;
47 }
fl_binary_codec_decode_message
static FlValue * fl_binary_codec_decode_message(FlMessageCodec *codec, GBytes *message, GError **error)
Definition: fl_binary_codec.cc:33
fl_binary_codec_encode_message
static GBytes * fl_binary_codec_encode_message(FlMessageCodec *codec, FlValue *value, GError **error)
Definition: fl_binary_codec.cc:18

References fl_binary_codec_decode_message(), and fl_binary_codec_encode_message().

## ◆ fl_binary_codec_decode_message()

static FlValue* fl_binary_codec_decode_message | ( | FlMessageCodec * | codec,
|  | GBytes * | message,
|  | GError ** | error
| ) |  |
| static

Definition at line 33 of file fl_binary_codec.cc.

35 {
36 gsize data_length;
37 const uint8_t* data =
38 static_cast<const uint8_t*>(g_bytes_get_data(message, &data_length));
39 return fl_value_new_uint8_list(data, data_length);
40 }
fl_value_new_uint8_list
G_MODULE_EXPORT FlValue * fl_value_new_uint8_list(const uint8_t *data, size_t data_length)
Definition: fl_value.cc:292

References fl_value_new_uint8_list().

Referenced by fl_binary_codec_class_init().

## ◆ fl_binary_codec_encode_message()

static GBytes* fl_binary_codec_encode_message | ( | FlMessageCodec * | codec,
|  | FlValue * | value,
|  | GError ** | error
| ) |  |
| static

Definition at line 18 of file fl_binary_codec.cc.

20 {
21 if (fl_value_get_type(value) != FL_VALUE_TYPE_UINT8_LIST) {
22 g_set_error(error, FL_MESSAGE_CODEC_ERROR,
23 FL_MESSAGE_CODEC_ERROR_UNSUPPORTED_TYPE,
24 "Only uint8[] values supported");
25 return nullptr;
26 }
27
28 return g_bytes_new(fl_value_get_uint8_list(value),
29 fl_value_get_length(value));
30 }
FL_MESSAGE_CODEC_ERROR_UNSUPPORTED_TYPE
@ FL_MESSAGE_CODEC_ERROR_UNSUPPORTED_TYPE
Definition: fl_message_codec.h:36
FL_MESSAGE_CODEC_ERROR
#define FL_MESSAGE_CODEC_ERROR
Definition: fl_message_codec.h:30
error
const uint8_t uint32_t uint32_t GError ** error
Definition: fl_pixel_buffer_texture_test.cc:40
value
uint8_t value
Definition: fl_standard_message_codec.cc:36
fl_value_get_uint8_list
G_MODULE_EXPORT const uint8_t * fl_value_get_uint8_list(FlValue *self)
Definition: fl_value.cc:689
fl_value_get_type
G_MODULE_EXPORT FlValueType fl_value_get_type(FlValue *self)
Definition: fl_value.cc:466
fl_value_get_length
G_MODULE_EXPORT size_t fl_value_get_length(FlValue *self)
Definition: fl_value.cc:724
FL_VALUE_TYPE_UINT8_LIST
@ FL_VALUE_TYPE_UINT8_LIST
Definition: fl_value.h:69

References error, FL_MESSAGE_CODEC_ERROR, FL_MESSAGE_CODEC_ERROR_UNSUPPORTED_TYPE, fl_value_get_length(), fl_value_get_type(), fl_value_get_uint8_list(), FL_VALUE_TYPE_UINT8_LIST, and value.

Referenced by fl_binary_codec_class_init().

## ◆ fl_binary_codec_init()

static void fl_binary_codec_init | ( | FlBinaryCodec * | self | ) |
| static

Definition at line 49 of file fl_binary_codec.cc.

49 {}

## ◆ fl_binary_codec_new()

G_MODULE_EXPORT FlBinaryCodec* fl_binary_codec_new | ( |  | ) |

Definition at line 51 of file fl_binary_codec.cc.

51 {
52 return static_cast<FlBinaryCodec*>(
53 g_object_new(fl_binary_codec_get_type(), nullptr));
54 }

Referenced by decode_message(), encode_message(), encode_message_error(), and TEST().