• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* GStreamer plugin for forward error correction
2  * Copyright (C) 2017 Pexip
3  *
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.
8  *
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.
13  *
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
17  *
18  * Author: Mikhail Fludkov <misha@pexip.com>
19  */
20 
21 #ifndef __RTP_STORAGE_H__
22 #define __RTP_STORAGE_H__
23 
24 #include <gst/gst.h>
25 
26 G_BEGIN_DECLS
27 
28 #define RTP_TYPE_STORAGE \
29   (rtp_storage_get_type())
30 #define RTP_STORAGE(obj) \
31   (G_TYPE_CHECK_INSTANCE_CAST((obj),RTP_TYPE_STORAGE,RtpStorage))
32 #define RTP_STORAGE_CLASS(klass) \
33   (G_TYPE_CHECK_CLASS_CAST((klass),RTP_TYPE_STORAGE,RtpStorageClass))
34 #define GST_IS_RTP_STORAGE(obj) \
35   (G_TYPE_CHECK_INSTANCE_TYPE((obj),RTP_TYPE_STORAGE))
36 #define GST_IS_RTP_STORAGE_CLASS(klass) \
37   (G_TYPE_CHECK_CLASS_TYPE((klass),RTP_TYPE_RED_DEC))
38 
39 typedef struct _RtpStorage RtpStorage;
40 typedef struct _RtpStorageClass RtpStorageClass;
41 
42 struct _RtpStorageClass {
43   GObjectClass parent_class;
44 };
45 
46 struct _RtpStorage {
47   GObject parent;
48   GstClockTime size_time;
49   GHashTable *streams;
50   GMutex streams_lock;
51 };
52 
53 GstBufferList * rtp_storage_get_packets_for_recovery (RtpStorage * self, gint fec_pt,
54                                                       guint32 ssrc, guint16 lost_seq);
55 void            rtp_storage_put_recovered_packet     (RtpStorage * self, GstBuffer * buffer,
56                                                       guint8 pt, guint32 ssrc, guint16 seq);
57 GstBuffer     * rtp_storage_get_redundant_packet     (RtpStorage * self, guint32 ssrc,
58                                                       guint16 lost_seq);
59 gboolean        rtp_storage_append_buffer            (RtpStorage *self, GstBuffer *buffer);
60 void            rtp_storage_clear                    (RtpStorage *self);
61 RtpStorage    * rtp_storage_new                      (void);
62 void            rtp_storage_set_size                 (RtpStorage *self, GstClockTime size);
63 GstClockTime    rtp_storage_get_size                 (RtpStorage *self);
64 
65 GType rtp_storage_get_type (void);
66 
67 G_END_DECLS
68 
69 #endif /* __RTP_STORAGE_H__ */
70