1 /* RTP Retransmission receiver element for GStreamer
2  *
3  * gstrtprtxreceive.h:
4  *
5  * Copyright (C) 2013 Collabora Ltd.
6  *   @author Julien Isorce <julien.isorce@collabora.co.uk>
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Library General Public
10  * License as published by the Free Software Foundation; either
11  * version 2 of the License, or (at your option) any later version.
12  *
13  * This library is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16  * Library General Public License for more details.
17  *
18  * You should have received a copy of the GNU Library General Public
19  * License along with this library; if not, write to the
20  * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
21  * Boston, MA 02110-1301, USA.
22  */
23 
24 #ifndef __GST_RTP_RTX_RECEIVE_H__
25 #define __GST_RTP_RTX_RECEIVE_H__
26 
27 #include <gst/gst.h>
28 #include <gst/rtp/gstrtpbuffer.h>
29 
30 G_BEGIN_DECLS
31 #define GST_TYPE_RTP_RTX_RECEIVE (gst_rtp_rtx_receive_get_type())
32 #define GST_RTP_RTX_RECEIVE(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_RTP_RTX_RECEIVE, GstRtpRtxReceive))
33 #define GST_RTP_RTX_RECEIVE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_RTP_RTX_RECEIVE, GstRtpRtxReceiveClass))
34 #define GST_RTP_RTX_RECEIVE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_RTP_RTX_RECEIVE, GstRtpRtxReceiveClass))
35 #define GST_IS_RTP_RTX_RECEIVE(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_RTP_RTX_RECEIVE))
36 #define GST_IS_RTP_RTX_RECEIVE_CLASS(obj) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_RTP_RTX_RECEIVE))
37 typedef struct _GstRtpRtxReceive GstRtpRtxReceive;
38 typedef struct _GstRtpRtxReceiveClass GstRtpRtxReceiveClass;
39 
40 struct _GstRtpRtxReceive
41 {
42   GstElement element;
43 
44   /* pad */
45   GstPad *sinkpad;
46   GstPad *srcpad;
47 
48   /* retrieve associated master stream from rtx stream
49    * it also works to retrieve rtx stream from master stream
50    * as we make sure all ssrc are unique */
51   GHashTable *ssrc2_ssrc1_map;
52 
53   /* contains seqnum of request packets of whom their ssrc have
54    * not been associated to a rtx stream yet */
55   GHashTable *seqnum_ssrc1_map;
56 
57   /* rtx pt (uint) -> origin pt (uint) */
58   GHashTable *rtx_pt_map;
59   /* origin pt (string) -> rtx pt (uint) */
60   GstStructure *rtx_pt_map_structure;
61 
62   /* statistics */
63   guint num_rtx_requests;
64   guint num_rtx_packets;
65   guint num_rtx_assoc_packets;
66 
67   GstClockTime last_time;
68 };
69 
70 struct _GstRtpRtxReceiveClass
71 {
72   GstElementClass parent_class;
73 };
74 
75 
76 GType gst_rtp_rtx_receive_get_type (void);
77 gboolean gst_rtp_rtx_receive_plugin_init (GstPlugin * plugin);
78 
79 G_END_DECLS
80 #endif /* __GST_RTP_RTX_RECEIVE_H__ */
81