2 * Copyright (C) <2008> Wim Taymans <wim.taymans@gmail.com>
4 * gstrdtbuffer.h: various helper functions to manipulate buffers
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.
23 #ifndef __GST_RDTBUFFER_H__
24 #define __GST_RDTBUFFER_H__
31 * @GST_RDT_TYPE_INVALID:
32 * @GST_RDT_TYPE_ASMACTION:
34 * @GST_RDT_TYPE_RTTREQ:
35 * @GST_RDT_TYPE_RTTRESP:
36 * @GST_RDT_TYPE_CONGESTION:
37 * @GST_RDT_TYPE_STREAMEND:
38 * @GST_RDT_TYPE_LATENCY:
39 * @GST_RDT_TYPE_INFOREQ:
40 * @GST_RDT_TYPE_INFORESP:
41 * @GST_RDT_TYPE_AUTOBW:
43 * Different RDT packet types.
47 GST_RDT_TYPE_INVALID = 0xffff,
48 GST_RDT_TYPE_ASMACTION = 0xff00,
49 GST_RDT_TYPE_BWREPORT = 0xff01,
50 GST_RDT_TYPE_ACK = 0xff02,
51 GST_RDT_TYPE_RTTREQ = 0xff03,
52 GST_RDT_TYPE_RTTRESP = 0xff04,
53 GST_RDT_TYPE_CONGESTION = 0xff05,
54 GST_RDT_TYPE_STREAMEND = 0xff06,
55 GST_RDT_TYPE_REPORT = 0xff07,
56 GST_RDT_TYPE_LATENCY = 0xff08,
57 GST_RDT_TYPE_INFOREQ = 0xff09,
58 GST_RDT_TYPE_INFORESP = 0xff0a,
59 GST_RDT_TYPE_AUTOBW = 0xff0b
63 * GST_RDT_IS_DATA_TYPE:
64 * @t: the #GstRDTType to check
66 * Check if @t is a data packet type.
68 #define GST_RDT_IS_DATA_TYPE(t) ((t) < 0xff00)
70 typedef struct _GstRDTPacket GstRDTPacket;
74 * @buffer: pointer to RDT buffer
75 * @offset: offset of packet in buffer data
77 * Data structure that points to a packet at @offset in @buffer.
78 * The size of the structure is made public to allow stack allocations.
86 GstRDTType type; /* type of current packet */
87 guint16 length; /* length of current packet in bytes */
88 GstMapInfo map; /* last mapped data */
91 /* validate buffers */
92 gboolean gst_rdt_buffer_validate_data (guint8 *data, guint len);
93 gboolean gst_rdt_buffer_validate (GstBuffer *buffer);
95 /* retrieving packets */
96 guint gst_rdt_buffer_get_packet_count (GstBuffer *buffer);
97 gboolean gst_rdt_buffer_get_first_packet (GstBuffer *buffer, GstRDTPacket *packet);
98 gboolean gst_rdt_packet_move_to_next (GstRDTPacket *packet);
100 /* working with packets */
101 GstRDTType gst_rdt_packet_get_type (GstRDTPacket *packet);
102 guint16 gst_rdt_packet_get_length (GstRDTPacket *packet);
103 GstBuffer* gst_rdt_packet_to_buffer (GstRDTPacket *packet);
107 guint16 gst_rdt_packet_data_get_seq (GstRDTPacket *packet);
108 guint8 * gst_rdt_packet_data_map (GstRDTPacket *packet, guint *size);
109 gboolean gst_rdt_packet_data_unmap (GstRDTPacket *packet);
110 guint16 gst_rdt_packet_data_get_stream_id (GstRDTPacket *packet);
111 guint32 gst_rdt_packet_data_get_timestamp (GstRDTPacket *packet);
113 guint8 gst_rdt_packet_data_get_flags (GstRDTPacket * packet);
116 gint gst_rdt_buffer_compare_seqnum (guint16 seqnum1, guint16 seqnum2);
120 #endif /* __GST_RDTBUFFER_H__ */