1 /* GStreamer plugin for forward error correction
2 * Copyright (C) 2017 Pexip
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 * Author: Mikhail Fludkov <misha@pexip.com>
21 #ifndef __RTP_RED_COMMON_H__
22 #define __RTP_RED_COMMON_H__
28 typedef struct _RedBlockHeader RedBlockHeader;
33 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
34 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
35 |F| block PT | timestamp offset | block length |
36 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
39 struct _RedBlockHeader {
40 #if G_BYTE_ORDER == G_LITTLE_ENDIAN
44 guint timestamp_offset_hi: 8;
47 guint timestamp_offset_lo: 6;
50 #elif G_BYTE_ORDER == G_BIG_ENDIAN
54 guint timestamp_offset_hi: 8;
56 guint timestamp_offset_lo: 6;
61 #error "G_BYTE_ORDER should be big or little endian."
65 #define RED_BLOCK_TIMESTAMP_OFFSET_MAX ((1<<14) - 1)
66 #define RED_BLOCK_LENGTH_MAX ((1<<10) - 1)
68 gsize rtp_red_block_header_get_length (gboolean is_redundant);
69 gboolean rtp_red_block_is_redundant (gpointer red_block);
70 void rtp_red_block_set_payload_type (gpointer red_block, guint8 pt);
71 void rtp_red_block_set_timestamp_offset (gpointer red_block, guint16 timestamp_offset);
72 void rtp_red_block_set_payload_length (gpointer red_block, guint16 length);
73 guint16 rtp_red_block_get_timestamp_offset (gpointer red_block);
74 guint8 rtp_red_block_get_payload_type (gpointer red_block);
75 void rtp_red_block_set_is_redundant (gpointer red_block, gboolean is_redundant);
76 guint16 rtp_red_block_get_payload_length (gpointer red_block);