]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - glsdk/gstreamer0-10.git/blob - libs/gst/dataprotocol/dataprotocol.h
ca394ccf9ae51d88774cc1936c636c5e32c67be8
[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 #ifdef GST_ENABLE_NEW
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>
32 G_BEGIN_DECLS
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 */
41 /* header flags */
42 typedef enum {
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),
47 } GstDPHeaderFlag;
49 /* payload types */
50 typedef enum {
51   GST_DP_PAYLOAD_NONE            = 0,
52   GST_DP_PAYLOAD_BUFFER,
53   GST_DP_PAYLOAD_CAPS,
54   GST_DP_PAYLOAD_EVENT_NONE      = 64,
55 } GstDPPayloadType;
57 /* payload information from header */
58 guint32         gst_dp_header_payload_length    (const guint8 * header);
59 GstDPPayloadType
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,
65                                                 guint * length,
66                                                 guint8 ** header);
67 gboolean        gst_dp_packet_from_caps         (const GstCaps * caps,
68                                                 GstDPHeaderFlag flags,
69                                                 guint * length,
70                                                 guint8 ** header,
71                                                 guint8 ** payload);
72 gboolean        gst_dp_packet_from_event        (const GstEvent * event,
73                                                 GstDPHeaderFlag flags,
74                                                 guint * length,
75                                                 guint8 ** header,
76                                                 guint8 ** payload);
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);
89 /* validation */
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);
99 G_END_DECLS
101 #endif /* __GST_DATA_PROTOCOL_H__ */
102 #endif /* GST_ENABLE_NEW */