2 * Copyright (C) 2015-2017 YouView TV Ltd
3 * Author: Vincent Penquerch <vincent.penquerch@collabora.co.uk>
5 * gstipcpipelinecomm.h:
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Library General Public License for more details.
17 * You should have received a copy of the GNU Library General Public
18 * License along with this library; if not, write to the
19 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
20 * Boston, MA 02110-1301, USA.
24 #ifndef __GST_IPC_PIPELINE_COMM_H__
25 #define __GST_IPC_PIPELINE_COMM_H__
28 #include <gst/base/gstadapter.h>
32 #define GST_FLOW_COMM_ERROR GST_FLOW_CUSTOM_ERROR_1
34 extern GQuark QUARK_ID;
37 GST_IPC_PIPELINE_COMM_STATE_TYPE = 0,
38 /* for the rest of the states we use directly the data type enums below */
39 } GstIpcPipelineCommState;
43 GST_IPC_PIPELINE_COMM_DATA_TYPE_ACK = 1,
44 GST_IPC_PIPELINE_COMM_DATA_TYPE_QUERY_RESULT,
46 GST_IPC_PIPELINE_COMM_DATA_TYPE_BUFFER,
47 GST_IPC_PIPELINE_COMM_DATA_TYPE_EVENT,
48 GST_IPC_PIPELINE_COMM_DATA_TYPE_SINK_MESSAGE_EVENT,
49 GST_IPC_PIPELINE_COMM_DATA_TYPE_QUERY,
50 GST_IPC_PIPELINE_COMM_DATA_TYPE_STATE_CHANGE,
51 GST_IPC_PIPELINE_COMM_DATA_TYPE_STATE_LOST,
52 GST_IPC_PIPELINE_COMM_DATA_TYPE_MESSAGE,
53 GST_IPC_PIPELINE_COMM_DATA_TYPE_GERROR_MESSAGE,
54 } GstIpcPipelineCommDataType;
63 GHashTable *waiting_ids;
65 GThread *reader_thread;
73 guint32 payload_length;
76 guint read_chunk_size;
77 GstClockTime ack_time;
79 void (*on_buffer) (guint32, GstBuffer *, gpointer);
80 void (*on_event) (guint32, GstEvent *, gboolean, gpointer);
81 void (*on_query) (guint32, GstQuery *, gboolean, gpointer);
82 void (*on_state_change) (guint32, GstStateChange, gpointer);
83 void (*on_state_lost) (gpointer);
84 void (*on_message) (guint32, GstMessage *, gpointer);
89 void gst_ipc_pipeline_comm_plugin_init (void);
91 void gst_ipc_pipeline_comm_init (GstIpcPipelineComm *comm, GstElement *e);
92 void gst_ipc_pipeline_comm_clear (GstIpcPipelineComm *comm);
93 void gst_ipc_pipeline_comm_cancel (GstIpcPipelineComm * comm,
96 void gst_ipc_pipeline_comm_write_flow_ack_to_fd (GstIpcPipelineComm * comm,
97 guint32 id, GstFlowReturn ret);
98 void gst_ipc_pipeline_comm_write_boolean_ack_to_fd (GstIpcPipelineComm * comm,
99 guint32 id, gboolean ret);
100 void gst_ipc_pipeline_comm_write_state_change_ack_to_fd (
101 GstIpcPipelineComm * comm, guint32 id, GstStateChangeReturn ret);
103 void gst_ipc_pipeline_comm_write_query_result_to_fd (GstIpcPipelineComm * comm,
104 guint32 id, gboolean result, GstQuery *query);
106 GstFlowReturn gst_ipc_pipeline_comm_write_buffer_to_fd (
107 GstIpcPipelineComm * comm, GstBuffer * buffer);
108 gboolean gst_ipc_pipeline_comm_write_event_to_fd (GstIpcPipelineComm * comm,
109 gboolean upstream, GstEvent * event);
110 gboolean gst_ipc_pipeline_comm_write_query_to_fd (GstIpcPipelineComm * comm,
111 gboolean upstream, GstQuery * query);
112 GstStateChangeReturn gst_ipc_pipeline_comm_write_state_change_to_fd (
113 GstIpcPipelineComm * comm, GstStateChange transition);
114 void gst_ipc_pipeline_comm_write_state_lost_to_fd (GstIpcPipelineComm * comm);
115 gboolean gst_ipc_pipeline_comm_write_message_to_fd (GstIpcPipelineComm * comm,
116 GstMessage *message);
118 gboolean gst_ipc_pipeline_comm_start_reader_thread (GstIpcPipelineComm * comm,
119 void (*on_buffer) (guint32, GstBuffer *, gpointer),
120 void (*on_event) (guint32, GstEvent *, gboolean, gpointer),
121 void (*on_query) (guint32, GstQuery *, gboolean, gpointer),
122 void (*on_state_change) (guint32, GstStateChange, gpointer),
123 void (*on_state_lost) (gpointer),
124 void (*on_message) (guint32, GstMessage *, gpointer),
126 void gst_ipc_pipeline_comm_stop_reader_thread (GstIpcPipelineComm * comm);