Blame gst/rtp/rtpredcommon.h

Packit 8ff292
/* GStreamer plugin for forward error correction
Packit 8ff292
 * Copyright (C) 2017 Pexip
Packit 8ff292
 *
Packit 8ff292
 * This library is free software; you can redistribute it and/or
Packit 8ff292
 * modify it under the terms of the GNU Lesser General Public
Packit 8ff292
 * License as published by the Free Software Foundation; either
Packit 8ff292
 * version 2.1 of the License, or (at your option) any later version.
Packit 8ff292
 *
Packit 8ff292
 * This library is distributed in the hope that it will be useful,
Packit 8ff292
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 8ff292
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit 8ff292
 * Lesser General Public License for more details.
Packit 8ff292
 *
Packit 8ff292
 * You should have received a copy of the GNU Lesser General Public
Packit 8ff292
 * License along with this library; if not, write to the Free Software
Packit 8ff292
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
Packit 8ff292
 *
Packit 8ff292
 * Author: Mikhail Fludkov <misha@pexip.com>
Packit 8ff292
 */
Packit 8ff292
Packit 8ff292
#ifndef __RTP_RED_COMMON_H__
Packit 8ff292
#define __RTP_RED_COMMON_H__
Packit 8ff292
Packit 8ff292
#include <glib.h>
Packit 8ff292
Packit 8ff292
G_BEGIN_DECLS
Packit 8ff292
Packit 8ff292
typedef struct _RedBlockHeader RedBlockHeader;
Packit 8ff292
Packit 8ff292
/* RFC 2198 */
Packit 8ff292
/*
Packit 8ff292
    0                   1                   2                   3
Packit 8ff292
    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
Packit 8ff292
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Packit 8ff292
   |F|   block PT  |  timestamp offset         |   block length    |
Packit 8ff292
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Packit 8ff292
*/
Packit 8ff292
Packit 8ff292
struct _RedBlockHeader {
Packit 8ff292
#if G_BYTE_ORDER == G_LITTLE_ENDIAN
Packit 8ff292
  guint pt:7;
Packit 8ff292
  guint F:1;
Packit 8ff292
Packit 8ff292
  guint timestamp_offset_hi: 8;
Packit 8ff292
Packit 8ff292
  guint length_hi: 2;
Packit 8ff292
  guint timestamp_offset_lo: 6;
Packit 8ff292
Packit 8ff292
  guint length_lo: 8;
Packit 8ff292
#elif G_BYTE_ORDER == G_BIG_ENDIAN
Packit 8ff292
  guint F:1;
Packit 8ff292
  guint pt:7;
Packit 8ff292
Packit 8ff292
  guint timestamp_offset_hi: 8;
Packit 8ff292
Packit 8ff292
  guint timestamp_offset_lo: 6;
Packit 8ff292
  guint length_hi: 2;
Packit 8ff292
Packit 8ff292
  guint length_lo: 8;
Packit 8ff292
#else
Packit 8ff292
#error "G_BYTE_ORDER should be big or little endian."
Packit 8ff292
#endif
Packit 8ff292
};
Packit 8ff292
Packit 8ff292
#define RED_BLOCK_TIMESTAMP_OFFSET_MAX ((1<<14) - 1)
Packit 8ff292
#define RED_BLOCK_LENGTH_MAX ((1<<10) - 1)
Packit 8ff292
Packit 8ff292
gsize    rtp_red_block_header_get_length    (gboolean is_redundant);
Packit 8ff292
gboolean rtp_red_block_is_redundant         (gpointer red_block);
Packit 8ff292
void     rtp_red_block_set_payload_type     (gpointer red_block, guint8 pt);
Packit 8ff292
void     rtp_red_block_set_timestamp_offset (gpointer red_block, guint16 timestamp_offset);
Packit 8ff292
void     rtp_red_block_set_payload_length   (gpointer red_block, guint16 length);
Packit 8ff292
guint16  rtp_red_block_get_timestamp_offset (gpointer red_block);
Packit 8ff292
guint8   rtp_red_block_get_payload_type     (gpointer red_block);
Packit 8ff292
void     rtp_red_block_set_is_redundant     (gpointer red_block, gboolean is_redundant);
Packit 8ff292
guint16  rtp_red_block_get_payload_length   (gpointer red_block);
Packit 8ff292
Packit 8ff292
G_END_DECLS
Packit 8ff292
Packit 8ff292
#endif