clean up libs docs; add dataprotocol
[glsdk/gstreamer0-10.git] / libs / gst / dataprotocol / dataprotocol.h
1 /* GStreamer
2  * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
3  * Copyright (C) <2004> Thomas Vander Stichele <thomas at apestaart dot org>
4  *
5  * dataprotocol.h: Functions implementing the GStreamer Data Protocol
6  *
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.
11  *
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.
16  *
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.
21  */
23 #ifndef __GST_DATA_PROTOCOL_H__
24 #define __GST_DATA_PROTOCOL_H__
26 #include <gst/gstdata.h>
27 #include <gst/gstbuffer.h>
28 #include <gst/gstevent.h>
29 #include <gst/gstcaps.h>
31 G_BEGIN_DECLS
33 /* GStreamer Data Protocol Version */
34 #define GST_DP_VERSION_MAJOR 0
35 #define GST_DP_VERSION_MINOR 0
37 #define GST_DP_HEADER_LENGTH 60 /* header size in bytes */
40 /* header flags */
41 typedef enum {
42   GST_DP_HEADER_FLAG_NONE        = 0,
43   GST_DP_HEADER_FLAG_CRC_HEADER  = (1 << 0),
44   GST_DP_HEADER_FLAG_CRC_PAYLOAD = (1 << 1),
45   GST_DP_HEADER_FLAG_CRC         = (1 << 1) | (1 <<0),
46 } GstDPHeaderFlag;
48 /* payload types */
49 typedef enum {
50   GST_DP_PAYLOAD_NONE            = 0,
51   GST_DP_PAYLOAD_BUFFER,
52   GST_DP_PAYLOAD_CAPS,
53   GST_DP_PAYLOAD_EVENT_NONE      = 64,
54 } GstDPPayloadType;
56 /* payload information from header */
57 guint32         gst_dp_header_payload_length    (const guint8 * header);
58 GstDPPayloadType
59                 gst_dp_header_payload_type      (const guint8 * header);
61 /* converting from GstBuffer/GstEvent/GstCaps */
62 gboolean        gst_dp_header_from_buffer       (const GstBuffer * buffer,
63                                                 GstDPHeaderFlag flags,
64                                                 guint * length,
65                                                 guint8 ** header);
66 gboolean        gst_dp_packet_from_caps         (const GstCaps * caps,
67                                                 GstDPHeaderFlag flags,
68                                                 guint * length,
69                                                 guint8 ** header,
70                                                 guint8 ** payload);
71 gboolean        gst_dp_packet_from_event        (const GstEvent * event,
72                                                 GstDPHeaderFlag flags,
73                                                 guint * length,
74                                                 guint8 ** header,
75                                                 guint8 ** payload);
78 /* converting to GstBuffer/GstEvent/GstCaps */
79 GstBuffer *     gst_dp_buffer_from_header       (guint header_length,
80                                                 const guint8 * header);
81 GstCaps *       gst_dp_caps_from_packet         (guint header_length,
82                                                 const guint8 * header,
83                                                 const guint8 * payload);
84 GstEvent *      gst_dp_event_from_packet        (guint header_length,
85                                                 const guint8 * header,
86                                                 const guint8 * payload);
88 /* validation */
89 gboolean        gst_dp_validate_header          (guint header_length,
90                                                 const guint8 * header);
91 gboolean        gst_dp_validate_payload         (guint header_length,
92                                                 const guint8 * header,
93                                                 const guint8 * payload);
94 gboolean        gst_dp_validate_packet          (guint header_length,
95                                                 const guint8 * header,
96                                                 const guint8 * payload);
98 G_END_DECLS
100 #endif /* __GST_DATA_PROTOCOL_H__ */