2 * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
3 * Copyright (C) <2004> Thomas Vander Stichele <thomas at apestaart dot org>
5 * dataprotocol.h: Functions implementing the GStreamer Data Protocol
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., 59 Temple Place - Suite 330,
20 * Boston, MA 02111-1307, USA.
24 #ifndef __GST_DATA_PROTOCOL_H__
25 #define __GST_DATA_PROTOCOL_H__
27 #include <gst/gstdata.h>
28 #include <gst/gstbuffer.h>
29 #include <gst/gstevent.h>
30 #include <gst/gstcaps.h>
34 /* GStreamer Data Protocol Version */
35 #define GST_DP_VERSION_MAJOR 0
36 #define GST_DP_VERSION_MINOR 1
38 #define GST_DP_HEADER_LENGTH 60 /* header size in bytes */
43 GST_DP_HEADER_FLAG_NONE = 0,
44 GST_DP_HEADER_FLAG_CRC_HEADER = (1 << 0),
45 GST_DP_HEADER_FLAG_CRC_PAYLOAD = (1 << 1),
46 GST_DP_HEADER_FLAG_CRC = (1 << 1) | (1 <<0),
51 GST_DP_PAYLOAD_NONE = 0,
52 GST_DP_PAYLOAD_BUFFER,
54 GST_DP_PAYLOAD_EVENT_NONE = 64,
57 /* payload information from header */
58 guint32 gst_dp_header_payload_length (const guint8 * header);
60 gst_dp_header_payload_type (const guint8 * header);
62 /* converting from GstBuffer/GstEvent/GstCaps */
63 gboolean gst_dp_header_from_buffer (const GstBuffer * buffer,
64 GstDPHeaderFlag flags,
67 gboolean gst_dp_packet_from_caps (const GstCaps * caps,
68 GstDPHeaderFlag flags,
72 gboolean gst_dp_packet_from_event (const GstEvent * event,
73 GstDPHeaderFlag flags,
79 /* converting to GstBuffer/GstEvent/GstCaps */
80 GstBuffer * gst_dp_buffer_from_header (guint header_length,
81 const guint8 * header);
82 GstCaps * gst_dp_caps_from_packet (guint header_length,
83 const guint8 * header,
84 const guint8 * payload);
85 GstEvent * gst_dp_event_from_packet (guint header_length,
86 const guint8 * header,
87 const guint8 * payload);
90 gboolean gst_dp_validate_header (guint header_length,
91 const guint8 * header);
92 gboolean gst_dp_validate_payload (guint header_length,
93 const guint8 * header,
94 const guint8 * payload);
95 gboolean gst_dp_validate_packet (guint header_length,
96 const guint8 * header,
97 const guint8 * payload);
101 #endif /* __GST_DATA_PROTOCOL_H__ */
102 #endif /* GST_ENABLE_NEW */