Debian Codegraph @

gst/unixfd/gstunixfd.h

raw symbols SCIP
1 /* GStreamer unix file-descriptor source/sink
2 *
3 * Copyright (C) 2023 Netflix Inc.
4 * Author: Xavier Claessens <[email protected]>
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library General Public License for more details.
15 *
16 * You should have received a copy of the GNU Library General Public
17 * License along with this library; if not, write to the
18 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
19 * Boston, MA 02110-1301, USA.
20 */
21
22 #pragma once
23
24 #include <gst/gst.h>
25 #include <gio/gio.h>
26 #include <gio/gunixfdlist.h>
27
28 G_BEGIN_DECLS
29
30 typedef enum
31 {
32 COMMAND_TYPE_NEW_BUFFER = 0,
33 COMMAND_TYPE_RELEASE_BUFFER = 1,
34 COMMAND_TYPE_CAPS = 2,
35 COMMAND_TYPE_EOS = 3,
36 } CommandType;
37
38 typedef enum
39 {
40 MEMORY_TYPE_DEFAULT = 0,
41 MEMORY_TYPE_DMABUF = 1,
42 MEMORY_TYPE_LAST,
43 } MemoryType;
44
45 typedef struct {
46 guint64 size;
47 guint64 offset;
48 } MemoryPayload;
49
50 typedef struct {
51 guint64 id;
52 guint64 pts;
53 guint64 dts;
54 guint64 duration;
55 guint64 offset;
56 guint64 offset_end;
57 guint32 flags;
58 guint8 type;
59 guint8 n_memory;
60 guint16 n_meta;
61 MemoryPayload memories[];
62 } NewBufferPayload;
63
64 typedef struct {
65 guint64 id;
66 } ReleaseBufferPayload;
67
68 gboolean gst_unix_fd_send_command(GSocket * socket, CommandType type,
69 GUnixFDList * fds, const guint8 * payload, gsize payload_size,
70 GError ** error);
71 gboolean gst_unix_fd_receive_command (GSocket *socket,
72 GCancellable *cancellable, CommandType *type, GUnixFDList **fds,
73 guint8 **payload, gsize *payload_size, GError **error);
74
75 gboolean gst_unix_fd_parse_new_buffer (guint8 *payload, gsize payload_size,
76 NewBufferPayload **new_buffer, guint32 *consumed);
77 gboolean gst_unix_fd_parse_release_buffer(guint8 *payload, gsize payload_size,
78 ReleaseBufferPayload **release_buffer);
79 gboolean gst_unix_fd_parse_caps (guint8 *payload, gsize payload_size,
80 gchar **caps_str);
81
82 GSocket *gst_unix_fd_socket_new(const gchar *socket_path,
83 GUnixSocketAddressType socket_type, GSocketAddress **address,
84 GError **error);
85
86 GST_ELEMENT_REGISTER_DECLARE (unixfdsrc);
87 GST_ELEMENT_REGISTER_DECLARE (unixfdsink);
88
89 G_END_DECLS